diff options
98 files changed, 203 insertions, 378 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex 41dd7ad925..7cb342352d 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 304852b2ac..6b78833ac8 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex 41dd7ad925..7cb342352d 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 304852b2ac..6b78833ac8 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib Binary files differindex 41dd7ad925..7cb342352d 100644 --- a/bin14/lib/mir_app.lib +++ b/bin14/lib/mir_app.lib diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib Binary files differindex 304852b2ac..6b78833ac8 100644 --- a/bin14/lib/mir_app64.lib +++ b/bin14/lib/mir_app64.lib diff --git a/include/delphi/m_system.inc b/include/delphi/m_system.inc index 2567b8c2b9..07d308069b 100644 --- a/include/delphi/m_system.inc +++ b/include/delphi/m_system.inc @@ -64,38 +64,6 @@ const }
ME_SYSTEM_OKTOEXIT:PAnsiChar = 'Miranda/System/OkToExitEvent';
- { miranda/system/oktoexit service
- Check if everyone is happy to exit
- wParam=lParam=0
- if everyone acknowleges OK to exit then returns true, otherwise false
- }
- MS_SYSTEM_OKTOEXIT:PAnsiChar = 'Miranda/System/OkToExit';
-
- { gets the version number of Miranda encoded as a dword v0.1.0.1+
- wParam=lParam=0
- returns the version number, encoded as one version per byte, therefore
- version 1.2.3.10 is 0x0102030a
- }
- MS_SYSTEM_GETVERSION:PAnsiChar = 'Miranda/System/GetVersion';
-
- {
- gets the version number of Miranda encoded as four WORDs v0.92.2+
- wParam = 0
- lParam = word[4]*
- returns the version number, encoded as one version per word, therefore
- version 1.2.3.3210 is 0x0001, 0x0002, 0x0003, 0x0C8a
- }
- MS_SYSTEM_GETFILEVERSION:PAnsiChar = 'Miranda/System/GetFileVersion';
-
- { gets the version of Miranda encoded as text v0.1.0.1+
- wParam=cch
- lParam=(LPARAM)(AnsiChar*)pszVersion
- cch is the size of the buffer pointed to by pszVersion, in bytes
- may return a build qualifier, such as "0.1.0.1 alpha"
- returns 0 on success, nonzero on failure
- }
- MS_SYSTEM_GETVERSIONTEXT:PAnsiChar = 'Miranda/System/GetVersionText';
-
{
wParam=0
lParam=0
@@ -107,15 +75,6 @@ const ME_SYSTEM_PRESHUTDOWN:PAnsiChar = 'Miranda/System/PShutdown';
{
- wParam=0
- lParam=0
-
- Returns TRUE when Miranda has got WM_QUIT and is in the process
- of shutting down
- }
- MS_SYSTEM_TERMINATED:PAnsiChar = 'Miranda/SysTerm';
-
- {
wParam : 0
lParam : (address) void (__cdecl callback) (void)
Affect : Setup a function pointer to be called after main loop iterations, it allows for
@@ -148,36 +107,6 @@ const }
MS_SYSTEM_GETBUILDSTRING:PAnsiChar = 'Miranda/GetBuildString';
- {
- Missing service catcher
- Is being called when one calls the non-existent service.
- All parameters are stored in the special structure
-
- The event handler takes 0 as wParam and TMissingServiceParams* as lParam.
-
- 0.4.3+ addition (2006/03/27)
- }
-type
- PTMissingServiceParams = ^TMissingServiceParams;
- TMissingServiceParams = record
- name :PAnsiChar;
- wParam:WPARAM;
- lParam:LPARAM;
- end;
-
-const
- ME_SYSTEM_MISSINGSERVICE:PAnsiChar = 'System/MissingService';
-
-{ Unhandled exceptions filter
-Is being called inside any thread launched via mir_forkthread, including the main thread.
-If a plugin's author executes a large piece of code inside __try/__except, he should
-obtain this filter and call it inside the __except section
-
-0.8.0+ addition (2008/07/20)
-}
-
-const
- MS_SYSTEM_GETEXCEPTFILTER:PAnsiChar = 'System/GetExceptFilter';
-
+function Miranda_IsTerminated : bytebool; stdcall; external AppDll;
{$ENDIF}
diff --git a/include/m_system.h b/include/m_system.h index f0b16ea385..c09ef42c23 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -48,82 +48,67 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_core.h>
-//miranda/system/modulesloaded
-//called after all modules have been successfully initialised
-//wParam = lParam = 0
-//used to resolve double-dependencies in the module load order
+// miranda/system/modulesloaded
+// called after all modules have been successfully initialised
+// wParam = lParam = 0
+// used to resolve double-dependencies in the module load order
#define ME_SYSTEM_MODULESLOADED "Miranda/System/ModulesLoaded"
-//miranda/system/shutdown event
-//called just before the application terminates
-//the database is still guaranteed to be running during this hook.
-//wParam = lParam = 0
+// miranda/system/shutdown event
+// called just before the application terminates
+// the database is still guaranteed to be running during this hook.
+// wParam = lParam = 0
#define ME_SYSTEM_SHUTDOWN "Miranda/System/Shutdown"
-//restarts miranda (0.8+)
-//wParam = 0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
-//lParam = (wchar_t*)path to a new miranda32.exe binary or NULL to use current
+// restarts miranda (0.8+)
+// wParam = 0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
+// lParam = (wchar_t*)path to a new miranda32.exe binary or NULL to use current
#define MS_SYSTEM_RESTART "Miranda/System/Restart"
-//miranda/system/oktoexit event
-//called before the app goes into shutdown routine to make sure everyone is
-//happy to exit
-//wParam = lParam = 0
-//return nonzero to stop the exit cycle
+// miranda/system/oktoexit event
+// called before the app goes into shutdown routine to make sure everyone is
+// happy to exit
+// wParam = lParam = 0
+// return nonzero to stop the exit cycle
#define ME_SYSTEM_OKTOEXIT "Miranda/System/OkToExitEvent"
-//miranda/system/oktoexit service
-//Check if everyone is happy to exit
-//wParam = lParam = 0
-//if everyone acknowleges OK to exit then returns true, otherwise false
-#define MS_SYSTEM_OKTOEXIT "Miranda/System/OkToExit"
-
-//gets the version number of Miranda encoded as a DWORD v0.1.0.1+
-//wParam = lParam = 0
-//returns the version number, encoded as one version per byte, therefore
-//version 1.2.3.10 is 0x0102030a
-#define MS_SYSTEM_GETVERSION "Miranda/System/GetVersion"
-
-//gets the version number of Miranda encoded as four WORDs v0.92.2+
-//wParam = 0
-//lParam = WORD[4]*
-//returns the version number, encoded as one version per word, therefore
-//version 1.2.3.3210 is 0x0001, 0x0002, 0x0003, 0x0C8a
-#define MS_SYSTEM_GETFILEVERSION "Miranda/System/GetFileVersion"
-
-// gets the version of Miranda encoded as text v0.1.0.1+
-// wParam = cch
-// lParam = (LPARAM)(char*)pszVersion
+// gets the version number of Miranda encoded as a DWORD
+// returns the version number, encoded as one version per byte, therefore
+// version 1.2.3.10 is 0x0102030a
+EXTERN_C MIR_APP_DLL(DWORD) Miranda_GetVersion(void);
+
+// gets the version number of Miranda encoded as four WORDs v0.92.2+
+// returns the version number, encoded as one version per word, therefore
+// version 1.2.3.3210 is 0x0001, 0x0002, 0x0003, 0x0C8a
+typedef WORD MFileVersion[4];
+EXTERN_C MIR_APP_DLL(void) Miranda_GetFileVersion(MFileVersion*);
+
+// gets the version of Miranda encoded as text
// cch is the size of the buffer pointed to by pszVersion, in bytes
// may return a build qualifier, such as "0.1.0.1 alpha"
// returns 0 on success, nonzero on failure
-#define MS_SYSTEM_GETVERSIONTEXT "Miranda/System/GetVersionText"
+EXTERN_C MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize);
// Adds an event to the list to be checked in the main message loop
// when a handle gets triggered, an appopriate stub gets called
-
typedef void (CALLBACK *MWaitableStub)(void);
-MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent = NULL);
-/*
-wParam = 0
-lParam = 0
+EXTERN_C MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent = NULL);
-This hook is fired just before the thread unwind stack is used,
-it allows MT plugins to shutdown threads if they have any special
-processing to do, etc.
-
-*/
+// wParam = 0 (ignored)
+// lParam = 0 (ignored)
+//
+// This hook is fired just before the thread unwind stack is used,
+// it allows MT plugins to shutdown threads if they have any special
+// processing to do, etc.
#define ME_SYSTEM_PRESHUTDOWN "Miranda/System/PShutdown"
-/*
-wParam = 0
-lParam = 0
+// Returns true when Miranda has got WM_QUIT and is in the process of shutting down
+EXTERN_C MIR_APP_DLL(bool) Miranda_IsTerminated(void);
-Returns TRUE when Miranda has got WM_QUIT and is in the process
-of shutting down
-*/
-#define MS_SYSTEM_TERMINATED "Miranda/SysTerm"
+// Check if everyone is happy to exit
+// if everyone acknowleges OK to exit then returns true, otherwise false
+EXTERN_C MIR_APP_DLL(bool) Miranda_OkToExit(void);
/*
wParam : 0
@@ -159,20 +144,6 @@ of shutting down */
#define MS_SYSTEM_GETBUILDSTRING "Miranda/GetBuildString"
-#ifdef MIR_APP_EXPORTS
-INT_PTR MirandaIsTerminated(WPARAM, LPARAM);
-
-__forceinline INT_PTR Miranda_Terminated(void)
-{
- return MirandaIsTerminated(0, 0);
-}
-#else
-__forceinline INT_PTR Miranda_Terminated(void)
-{
- return CallService(MS_SYSTEM_TERMINATED, 0, 0);
-}
-#endif
-
/* Missing service catcher
Is being called when one calls the non-existent service.
All parameters are stored in the special structure
@@ -192,24 +163,4 @@ typedef struct #define ME_SYSTEM_MISSINGSERVICE "System/MissingService"
-/* Unhandled exceptions filter
-Is being called inside any thread launched via mir_forkthread, including the main thread.
-If a plugin's author executes a large piece of code inside __try/__except, he should
-obtain this filter and call it inside the __except section
-
-0.8.0+ addition (2008/07/20)
-*/
-
-#define MS_SYSTEM_GETEXCEPTFILTER "System/GetExceptFilter"
-
-__forceinline pfnExceptionFilter Miranda_GetExceptFilter(void)
-{ return GetExceptionFilter();
-}
-
-#define MS_SYSTEM_SETEXCEPTFILTER "System/SetExceptFilter"
-
-__forceinline pfnExceptionFilter Miranda_SetExceptFilter(pfnExceptionFilter foo)
-{ return SetExceptionFilter(foo);
-}
-
#endif // M_SYSTEM_H
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index 1bdd09efaa..555f1c8dbb 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -69,7 +69,7 @@ static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage) }
if (!param->pfnDataAvailProc(nCpuUsage, param->lParam)) return FALSE;
SleepEx(param->dwDelayMillis, TRUE);
- return !Miranda_Terminated();
+ return !Miranda_IsTerminated();
}
static void WinNT_PollThread(void *vparam)
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index d21934975e..553ec71f87 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -134,17 +134,17 @@ static DWORD ShutdownNow(BYTE shutdownType) DWORD dwErrCode = ERROR_SUCCESS;
switch (shutdownType) {
case SDSDT_CLOSEMIRANDA:
- if (!Miranda_Terminated()) {
+ if (!Miranda_IsTerminated()) {
/* waiting for short until ready (but not too long...) */
DWORD dwLastTickCount = GetTickCount();
- while (!CallService(MS_SYSTEM_OKTOEXIT, 0, 0)) {
+ while (!Miranda_OkToExit()) {
/* infinite loop protection (max 5 sec) */
if (GetTickCount() - dwLastTickCount >= 5000) { /* wraparound works */
OutputDebugStringA("Timeout (5 sec)\n"); /* tell others, all ascii */
break;
}
SleepEx(1000, TRUE);
- if (Miranda_Terminated()) break; /* someone else did it */
+ if (Miranda_IsTerminated()) break; /* someone else did it */
OutputDebugStringA("Not ready to exit. Waiting...\n"); /* tell others, all ascii */
}
/* shutdown service must be called from main thread anyway */
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 62966543f5..2ef6bf3317 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1295,7 +1295,7 @@ void DoError(const TaskOptions& to, const std::wstring _error) }
if (Options::instance->schedulerAlerts) {
- if (CallService(MS_SYSTEM_TERMINATED, 0, 0))
+ if (Miranda_IsTerminated())
return;
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
diff --git a/plugins/Clist_blind/src/clistmenus.cpp b/plugins/Clist_blind/src/clistmenus.cpp index 1eb84d0911..87c8b1f602 100644 --- a/plugins/Clist_blind/src/clistmenus.cpp +++ b/plugins/Clist_blind/src/clistmenus.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CloseAction(WPARAM, LPARAM)
{
- if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
+ if (Miranda_OkToExit())
DestroyWindow(pcli->hwndContactList);
return 0;
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 7d97a9d428..7cee0bee47 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -30,11 +30,13 @@ int LoadFavoriteContactMenu(); INT_PTR CloseAction(WPARAM, LPARAM)
{
- int k;
g_CluiData.bSTATE = STATE_PREPARETOEXIT; // workaround for avatar service and other wich destroys service on OK_TOEXIT
- do
- k = CallService(MS_SYSTEM_OKTOEXIT, 0, 0);
- while (!k);
+
+ bool k;
+ do {
+ k = Miranda_OkToExit();
+ }
+ while (!k);
if (k)
DestroyWindow(pcli->hwndContactList);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 6c0e1af226..d42f7c6455 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -538,7 +538,7 @@ static BOOL CLUI_WaitThreadsCompletion() static const BYTE bcMAX_AWAITING_RETRY = 10; // repeat awaiting only 10 times
TRACE("CLUI_WaitThreadsCompletion Enter");
if (bEntersCount < bcMAX_AWAITING_RETRY &&
- (g_CluiData.mutexPaintLock || g_hAwayMsgThread || g_hGetTextAsyncThread || g_hSmoothAnimationThread) && !Miranda_Terminated())
+ (g_CluiData.mutexPaintLock || g_hAwayMsgThread || g_hGetTextAsyncThread || g_hSmoothAnimationThread) && !Miranda_IsTerminated())
{
TRACE("Waiting threads");
TRACEVAR("g_CluiData.mutexPaintLock: %x", g_CluiData.mutexPaintLock);
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 5a71b78328..0a842dff26 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -34,10 +34,9 @@ void InitIconLibMenuIcons(); INT_PTR CloseAction(WPARAM, LPARAM)
{
- int k;
cfg::shutDown = 1;
- k = CallService(MS_SYSTEM_OKTOEXIT, 0, 0);
- if (k) {
+
+ if (Miranda_OkToExit()) {
DestroyWindow(pcli->hwndContactList);
PostQuitMessage(0);
Sleep(0);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 16b1e83f60..0862892698 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1482,7 +1482,7 @@ buttons_done: case ID_TRAY_EXIT: case ID_ICQ_EXIT: cfg::shutDown = 1; - if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0)) + if (Miranda_OkToExit()) DestroyWindow(hwnd); break; case ID_TRAY_HIDE: diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 6d4323338e..774aabc674 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1555,7 +1555,7 @@ void HandleVersionCommand(PCommand command, TArgument*, int argc, PReply reply) else {
char miranda[512];
DWORD v = pluginInfo.version;
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(miranda), (LPARAM)miranda);
+ Miranda_GetVersionText(miranda, sizeof(miranda));
mir_snprintf(reply->message, "Miranda %s\nCmdLine v.%d.%d.%d.%d", miranda, ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF), (v & 0xFF));
}
}
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index cd73cb1b30..eebd830f2b 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -241,7 +241,7 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM) static int ModulesLoaded(WPARAM, LPARAM)
{
char temp[MAX_PATH];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(temp), (LPARAM)temp);
+ Miranda_GetVersionText(temp, _countof(temp));
crs_a2t(vertxt, temp);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 0a23ed5ba9..92219a5128 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -137,12 +137,12 @@ DWORD MirandaThreadFilter(DWORD code, EXCEPTION_POINTERS* info) void InitExceptionHandler(void)
{
- threadfltr = Miranda_SetExceptFilter(MirandaThreadFilter);
+ threadfltr = SetExceptionFilter(MirandaThreadFilter);
SetExceptionHandler();
}
void DestroyExceptionHandler(void)
{
- Miranda_SetExceptFilter(threadfltr);
+ SetExceptionFilter(threadfltr);
RemoveExceptionHandler();
}
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index e768e1377e..aad3eef30a 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -114,7 +114,7 @@ extern "C" __declspec(dllexport) int Load(void) {
mir_getLP(&pluginInfo);
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));
+ Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index a9ebbd7d4d..0735bedc22 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -391,7 +391,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar uDlg->m_tabs[i]->m_job->pause();
int result = IDYES;
- if (!Miranda_Terminated() && UploadJob::iRunningJobCount > 0)
+ if (!Miranda_IsTerminated() && UploadJob::iRunningJobCount > 0)
result = Utils::msgBox(TranslateT("Do you really want to cancel all running jobs?"), MB_YESNO | MB_ICONQUESTION);
if (result == IDYES) {
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp index 858bb9e58e..3a3238d7cc 100644 --- a/plugins/FTPFileYM/src/job_delete.cpp +++ b/plugins/FTPFileYM/src/job_delete.cpp @@ -42,7 +42,7 @@ void DeleteJob::waitingThread(void *arg) {
DeleteJob *job = (DeleteJob *)arg;
- while (!Miranda_Terminated()) {
+ while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
iRunningJobCount++;
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 29ec91c4b8..47c2df2906 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -78,7 +78,7 @@ void PackerJob::waitingThread(void *arg) {
PackerJob *job = (PackerJob *)arg;
- while (!Miranda_Terminated()) {
+ while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
iRunningJobCount++;
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index 8443dafb6b..9fabe869db 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -148,7 +148,7 @@ void UploadJob::waitingThread(void *arg) {
UploadJob *job = (UploadJob *)arg;
- while (!Miranda_Terminated()) {
+ while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
iRunningJobCount++;
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 9737381a2f..62c9e21bb0 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -110,35 +110,13 @@ namespace mu }
/*
- * system
- */
-
- namespace system
- {
- DWORD getVersion()
- {
- return static_cast<DWORD>(CallService(MS_SYSTEM_GETVERSION, 0, 0));
- }
-
- int getVersionText(int cchVersion, char* szVersion)
- {
- return CallService(MS_SYSTEM_GETVERSIONTEXT, cchVersion, reinterpret_cast<LPARAM>(szVersion));
- }
-
- int terminated()
- {
- return CallService(MS_SYSTEM_TERMINATED, 0, 0);
- }
- }
-
- /*
* core interface functions
*/
bool load()
{
// check for version
- if (!isMirandaVersionOk(system::getVersion()))
+ if (!isMirandaVersionOk(Miranda_GetVersion()))
return false;
return true;
@@ -160,17 +138,6 @@ namespace mu bool isMirandaUnicode()
{
- if (system::getVersion() < PLUGIN_MAKE_VERSION(0, 4, 3, 33))
- return false;
-
- char szVersion[256] = { 0 };
-
- if (system::getVersionText(256, szVersion) != 0)
- return false;
-
- if (!strstr(szVersion, "Unicode"))
- return false;
-
return true;
}
diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index f2afb7c9df..11905e187d 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -58,17 +58,6 @@ namespace mu }
/*
- * system
- */
-
- namespace system
- {
- DWORD getVersion();
- int getVersionText(int cchVersion, char* szVersion);
- int terminated();
- }
-
- /*
* updater [external]
*/
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index b064304cbf..b2882ed476 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -1379,7 +1379,7 @@ void __cdecl Statistic::threadProc(void *lpParameter) pStats->createStatistics();
// check for errors
- if (!pStats->m_ErrorText.empty() && !mu::system::terminated())
+ if (!pStats->m_ErrorText.empty() && !Miranda_IsTerminated())
MessageBox(0, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
// free statistics
diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h index 93f3d729bf..c08661a373 100644 --- a/plugins/HistoryStats/src/statistic.h +++ b/plugins/HistoryStats/src/statistic.h @@ -133,7 +133,7 @@ private: // misc routines
DWORD getTimeStarted() { return m_TimeStarted; }
- bool shouldTerminate() { return (WaitForSingleObject(m_hCancelEvent, 0) == WAIT_OBJECT_0) || (bool_(mu::system::terminated())); }
+ bool shouldTerminate() { return (WaitForSingleObject(m_hCancelEvent, 0) == WAIT_OBJECT_0) || bool_(Miranda_IsTerminated()); }
void handleAddMessage(Contact& contact, Message& msg);
void handleAddChat(Contact& contact, bool bOutgoing, DWORD localTimestampStarted, DWORD duration);
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 1e572922bd..9c5d016cde 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -524,8 +524,8 @@ int check() { return 1;
}
- if (Plugin_Terminated || Miranda_Terminated()){
- log_p(L"check: Plugin_Terminated (=%d) OR Miranda_Terminated()", Plugin_Terminated);
+ if (Plugin_Terminated || Miranda_IsTerminated()){
+ log_p(L"check: Plugin_Terminated (=%d) OR Miranda_IsTerminated()", Plugin_Terminated);
return 0;
}
@@ -641,8 +641,8 @@ void checkthread(void*) TIMEDATE sendDate;
char strLink[4 * 16];
- if (Plugin_Terminated || Miranda_Terminated()) {
- log_p(L"checkthread: Plugin_Terminated (=%d) OR Miranda_Terminated()", Plugin_Terminated);
+ if (Plugin_Terminated || Miranda_IsTerminated()) {
+ log_p(L"checkthread: Plugin_Terminated (=%d) OR Miranda_IsTerminated()", Plugin_Terminated);
break;
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index b3d859ba60..dfaf7d73f0 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -68,7 +68,7 @@ std::wstring& MirandaUtils::getDisplayName() displayName.append(L"Miranda NG v.");
char mirandaVersion[128];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(mirandaVersion), (LPARAM)mirandaVersion);
+ Miranda_GetVersionText(mirandaVersion, _countof(mirandaVersion));
displayName.append(_A2T(mirandaVersion));
displayName.append(L" (");
displayName.append(getProfileName());
@@ -175,11 +175,11 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ EnterCriticalSection(&ackMapCs);
myMfAck = ackMap[hProcess];
LeaveCriticalSection(&ackMapCs);
- if(Miranda_Terminated() || args->mirfoxDataPtr->Plugin_Terminated){
- logger->log_p(L"SMTC: ACK break by Plugin_Terminated (=%d) or Miranda_Terminated()", args->mirfoxDataPtr->Plugin_Terminated);
+ if(Miranda_IsTerminated() || args->mirfoxDataPtr->Plugin_Terminated){
+ logger->log_p(L"SMTC: ACK break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", args->mirfoxDataPtr->Plugin_Terminated);
break;
}
- } while (myMfAck == NULL && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_Terminated()
+ } while (myMfAck == NULL && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_IsTerminated()
logger->log_p(L"SMTC: ACK found counter = [%d] myMfAck = [" SCNuPTR L"]", counter, myMfAck);
}
diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index f5d64b0450..0a59139994 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -121,7 +121,7 @@ void CMirfoxMiranda::onContactAdded_async(void* threadArg) bool canAdd = true;
// ceck miranda
- if (Miranda_Terminated() || mirfoxMiranda->getMirfoxData().Plugin_Terminated)
+ if (Miranda_IsTerminated() || mirfoxMiranda->getMirfoxData().Plugin_Terminated)
canAdd = false;
// check if hContact still exist
@@ -182,7 +182,7 @@ void CMirfoxMiranda::onContactSettingChanged_async(void* threadArg){ bool canAdd = true;
// ceck miranda
- if (Miranda_Terminated() || mirfoxMiranda->getMirfoxData().Plugin_Terminated)
+ if (Miranda_IsTerminated() || mirfoxMiranda->getMirfoxData().Plugin_Terminated)
canAdd = false;
// check if hContact still exist
@@ -393,8 +393,8 @@ void CMirfoxMiranda::csmThread(void* threadArg) SleepEx(CSMTHREAD_TICK_TIME, TRUE); //check exit every 0,1s
//if miranda is exiting - exit this thread
- if (Miranda_Terminated() || mirfoxDataPtr->Plugin_Terminated){
- logger->log_p(L"MirfoxMiranda::csmThread break by Plugin_Terminated (=%d) or Miranda_Terminated()", mirfoxDataPtr->Plugin_Terminated);
+ if (Miranda_IsTerminated() || mirfoxDataPtr->Plugin_Terminated){
+ logger->log_p(L"MirfoxMiranda::csmThread break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", mirfoxDataPtr->Plugin_Terminated);
break;
}
@@ -540,8 +540,8 @@ void CMirfoxMiranda::msgQueueThread(void* threadArg) SleepEx(MQTHREAD_TICK_TIME, TRUE); //check exit every 0,1s
//if miranda is exiting - exit this thread
- if (Miranda_Terminated() || mirfoxDataPtr->Plugin_Terminated){
- logger->log_p(L"mqThread break by Plugin_Terminated (=%d) or Miranda_Terminated()", mirfoxDataPtr->Plugin_Terminated);
+ if (Miranda_IsTerminated() || mirfoxDataPtr->Plugin_Terminated){
+ logger->log_p(L"mqThread break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", mirfoxDataPtr->Plugin_Terminated);
delete [] userActionSelection;
break;
}
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index fa4a769a74..46d6c50c8b 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -423,7 +423,7 @@ LUAMOD_API int luaopen_m_core(lua_State *L) lua_setfield(L, -2, "CALLSERVICE_NOTFOUND");
char version[128];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(version), (LPARAM)version);
+ Miranda_GetVersionText(version, _countof(version));
lua_pushstring(L, ptrA(mir_utf8encode(version)));
lua_setfield(L, -2, "Version");
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index ec08831a1d..7323755ea5 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -18,7 +18,7 @@ void Log(const wchar_t *format, ...) void ShowNotification(const char *caption, const char *message, int flags, MCONTACT hContact)
{
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1))
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index c521025ef2..ccc723812a 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -203,7 +203,7 @@ extern "C" { wchar_t buff[512]; mir_snwprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(hContact)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); - if (!Miranda_Terminated()) { + if (!Miranda_IsTerminated()) { ShowMessage(hContact, buff); } diff --git a/plugins/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/src/svcs_proto.cpp index 74934fbfd1..4dd0ca4f59 100644 --- a/plugins/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/src/svcs_proto.cpp @@ -108,7 +108,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam) mir_free(uname); OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED); - if (tlv && !Miranda_Terminated()) { + if (tlv && !Miranda_IsTerminated()) { /* Notify the user that the other side disconnected. */ wchar_t buff[256]; mir_snwprintf(buff, TranslateW(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index d0447831d6..12d5d553ab 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -111,7 +111,7 @@ wchar_t* ProtoGetNickname(const char* proto) } void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { - if(CallService(MS_SYSTEM_TERMINATED, 0, 0)) return; + if(Miranda_IsTerminated()) return; if ( !options.bHavePopups) { wchar_t title[256]; diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index 5d0c349801..f83dc3a0be 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -36,7 +36,7 @@ void __cdecl UpdateMsgsThreadProc(void *) PROTOACCOUNT **accs;
Proto_EnumAccounts(&numAccs, &accs);
- while (WaitForSingleObject(g_hTerminateUpdateMsgsThread, 0) == WAIT_TIMEOUT && !Miranda_Terminated()) {
+ while (WaitForSingleObject(g_hTerminateUpdateMsgsThread, 0) == WAIT_TIMEOUT && !Miranda_IsTerminated()) {
DWORD MinUpdateTimeDifference = (DWORD)g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGSPERIOD) * 1000; // in milliseconds
for (int i = 0; i < numAccs; i++) {
PROTOACCOUNT *p = accs[i];
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 69bcc3bf16..a2bc038bfa 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -83,7 +83,7 @@ void init_vars() bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0) != 0;
password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L"");
debuglog.init();
- bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001;
+ bIsMiranda09 = false;
bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09) != 0;
bPresenceSigning = db_get_b(NULL, szGPGModuleName, "bPresenceSigning", 0) != 0;
bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0) != 0;
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp index 196d47df2a..245229e698 100644 --- a/plugins/NewsAggregator/Src/Update.cpp +++ b/plugins/NewsAggregator/Src/Update.cpp @@ -28,7 +28,7 @@ UPDATELIST *UpdateListTail = NULL; void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
{
// only run if it is not current updating and the auto update option is enabled
- if (!ThreadRunning && !Miranda_Terminated()) {
+ if (!ThreadRunning && !Miranda_IsTerminated()) {
bool HaveUpdates = FALSE;
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) {
@@ -51,7 +51,7 @@ void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD) KillTimer(NULL, timerId);
ThreadRunning = FALSE;
- if (db_get_b(NULL, MODULE, "AutoUpdate", 1) && !Miranda_Terminated()) {
+ if (db_get_b(NULL, MODULE, "AutoUpdate", 1) && !Miranda_IsTerminated()) {
if (db_get_b(NULL, MODULE, "StartupRetrieve", 1))
CheckAllFeeds(0, 1);
timerId = SetTimer(NULL, 0, 30000, (TIMERPROC)timerProc);
@@ -125,7 +125,7 @@ void UpdateThreadProc(void *AvatarCheck) CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// update news by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_Terminated()) {
+ while (UpdateListHead != NULL && !Miranda_IsTerminated()) {
if (AvatarCheck != NULL)
CheckCurrentFeedAvatar(UpdateGetFirst());
else
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 8eb2002532..f1882181dc 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -28,7 +28,7 @@ void CALLBACK sttMainThreadCallback(ULONG_PTR dwParam) void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags)
{
- if (CallService(MS_SYSTEM_TERMINATED, 0, 0)) return;
+ if (Miranda_IsTerminated()) return;
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
ShowClassPopupT("pingpopups", line1, line2);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 2ba4607482..536e018471 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -44,7 +44,7 @@ static int GetUpdateMode() if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
// Missing or unknown mode, determine correct from version of running core
char coreVersion[512];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(coreVersion), (LPARAM)coreVersion);
+ Miranda_GetVersionText(coreVersion, _countof(coreVersion));
UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
}
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 3cb5dad4f2..d1cf8d8a17 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -680,7 +680,7 @@ int ModeChange(WPARAM, LPARAM lparam) if ((isetting > ID_STATUS_OFFLINE) && ((WORD)ack->hProcess <= ID_STATUS_OFFLINE)) {
//we have just loged-in
db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
- if (!Miranda_Terminated() && IsWatchedProtocol(ack->szModule)) {
+ if (!Miranda_IsTerminated() && IsWatchedProtocol(ack->szModule)) {
logthread_info *info = (logthread_info *)mir_alloc(sizeof(logthread_info));
mir_strncpy(info->sProtoName, courProtoName, _countof(info->sProtoName));
info->hContact = 0;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 1cd20ad1ba..6aaa1dde2f 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -74,7 +74,7 @@ BOOL AddToList(TAddArgList& args) DWORD attr = GetFileAttributesA(args.szFile);
if (attr != 0xFFFFFFFF && (attr & FILE_ATTRIBUTE_HIDDEN) == 0) {
if ((args.count % 10) == 5)
- if (CallService(MS_SYSTEM_TERMINATED, 0, 0) != 0)
+ if (Miranda_IsTerminated() != 0)
return true;
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
@@ -490,7 +490,7 @@ void __cdecl ThreadServer(HANDLE hMainThread) if (retVal == WAIT_OBJECT_0)
QueueUserAPC(ipcService, hMainThread, 0);
- if (CallService(MS_SYSTEM_TERMINATED, 0, 0) == 1)
+ if (Miranda_IsTerminated() == 1)
break;
}
CloseHandle(hEvent);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index a0b4f95870..4b942d6ef9 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -822,7 +822,7 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM, LPARAM lParam) struct MsgBoxInitData *box_data;
BOOL idvstatusmsg = FALSE;
- if (Miranda_Terminated()) return 0;
+ if (Miranda_IsTerminated()) return 0;
if (hTTBButton) {
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButton, (LPARAM)0);
@@ -898,7 +898,7 @@ INT_PTR ShowStatusMessageDialog(WPARAM, LPARAM lParam) struct MsgBoxInitData *box_data;
BOOL idvstatusmsg = FALSE;
- if (Miranda_Terminated()) return 0;
+ if (Miranda_IsTerminated()) return 0;
box_data = (struct MsgBoxInitData *)mir_alloc(sizeof(struct MsgBoxInitData));
@@ -945,7 +945,7 @@ INT_PTR ShowStatusMessageDialog(WPARAM, LPARAM lParam) int ChangeStatusMessage(WPARAM wParam, LPARAM lParam)
{
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return 0;
int iStatus = (int)wParam;
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 8e7fa9f86f..fe117a0b9e 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -129,7 +129,7 @@ void __cdecl SmileyDownloadThread(void*) bool needext = false;
HANDLE hHttpDwnl = NULL;
WaitForSingleObject(g_hDlMutex, 3000);
- while (!Miranda_Terminated() && dlQueue.getCount()) {
+ while (!Miranda_IsTerminated() && dlQueue.getCount()) {
ReleaseMutex(g_hDlMutex);
if (_waccess(dlQueue[0].fname.c_str(), 0) != 0) {
InternetDownloadFile(_T2A(dlQueue[0].url.c_str()), _T2A(dlQueue[0].fname.c_str()), hHttpDwnl);
@@ -148,7 +148,7 @@ void __cdecl SmileyDownloadThread(void*) threadRunning = false;
ReleaseMutex(g_hDlMutex);
- if (!Miranda_Terminated()) {
+ if (!Miranda_IsTerminated()) {
if (needext)
CallServiceSync(MS_SMILEYADD_RELOAD, 0, 0);
else
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 2731a951a9..4b0203cf0e 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -66,7 +66,7 @@ void SplashMain() // Retrive path to exe of current running Miranda is located
szMirDir = Utils_ReplaceVarsW(L"%miranda_path%");
mir_snwprintf(szhAdvaimgPath, L"%s\\plugins\\advaimg.dll", szMirDir);
- CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
+ Miranda_GetVersionText(szVersion, MAX_PATH);
#ifdef _DEBUG
mir_snwprintf(szLogFile, L"%s\\%s.log", szMirDir, _A2W(__PLUGIN_NAME));
diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp index 0667585be3..41c244cde4 100644 --- a/plugins/StatusManager/src/keepstatus.cpp +++ b/plugins/StatusManager/src/keepstatus.cpp @@ -142,7 +142,7 @@ int KSLoadMainOptions() if (ServiceExists(ME_CS_STATUSCHANGE)) hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGE, CSStatusChange); hCSStatusChangeExHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx); - if (db_get_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) { + if (db_get_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, 0)) { if (!IsWindow(hMessageWindow)) { hMessageWindow = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc); diff --git a/plugins/StatusManager/src/ks_options.cpp b/plugins/StatusManager/src/ks_options.cpp index e76a4464b6..890981a8c1 100644 --- a/plugins/StatusManager/src/ks_options.cpp +++ b/plugins/StatusManager/src/ks_options.cpp @@ -170,9 +170,9 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(NULL, KSMODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY), FALSE); SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(NULL, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0), FALSE); CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(NULL, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(NULL, KSMODULENAME, SETTING_CNCOTHERLOC, FALSE) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(NULL, KSMODULENAME, SETTING_CNCOTHERLOC, FALSE)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(NULL, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, FALSE) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, FALSE)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (db_get_b(NULL, KSMODULENAME, SETTING_FIRSTOFFLINE, FALSE)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_NOLOCKED, (db_get_b(NULL, KSMODULENAME, SETTING_NOLOCKED, FALSE)) ? BST_CHECKED : BST_UNCHECKED); SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(NULL, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE); @@ -235,13 +235,13 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case KS_ENABLEITEMS: EnableWindow(GetDlgItem(hwndDlg, IDC_INCREASEEXPONENTIAL), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCONNECTINGTIME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CNCOTHERLOC), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CNCOTHERLOC), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_CANCEL), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXDELAY), (IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKAPMRESUME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKAPMRESUME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_FIRSTOFFLINE), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOLOCKED), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_PINGCOUNT), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_BYPING, 0)); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 1d636d1fe3..5052e5f644 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -577,7 +577,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateDialogDefault(hwndDlg); { WORD v[4]; - CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v); + Miranda_GetFileVersion(&v); wchar_t tStr[80]; mir_snwprintf(tStr, L"%s %d.%d.%d.%d [build %d]", diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index f0e86cabb9..8fa62b1c8f 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -109,7 +109,7 @@ unsigned int CALLBACK MessagePumpThread(void*) CLCINFOTIPEX *clcitex = NULL;
MSG hwndMsg = {0};
- while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_Terminated()) {
+ while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_IsTerminated()) {
if (hwndMsg.hwnd != NULL && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
continue;
switch (hwndMsg.message) {
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index f1a1d753c0..da9874adad 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -598,9 +598,7 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE;
char versionString[128];
- if (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(versionString), (LPARAM)versionString))
- return NULL;
-
+ Miranda_GetVersionText(versionString, sizeof(versionString));
return mir_a2u(versionString);
}
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 148f53ba65..578bec0a8d 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -290,7 +290,7 @@ static void UpdateThreadProc(void *) ReleaseMutex(hUpdateMutex);
// update weather by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_Terminated())
+ while (UpdateListHead != NULL && !Miranda_IsTerminated())
UpdateWeather(UpdateGetFirst());
NetlibHttpDisconnect();
@@ -588,7 +588,7 @@ int GetWeatherData(MCONTACT hContact) void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
{
// only run if it is not current updating and the auto update option is enabled
- if (!ThreadRunning && opt.CAutoUpdate && !Miranda_Terminated() && (opt.NoProtoCondition || status == ID_STATUS_ONLINE))
+ if (!ThreadRunning && opt.CAutoUpdate && !Miranda_IsTerminated() && (opt.NoProtoCondition || status == ID_STATUS_ONLINE))
UpdateAll(TRUE, FALSE);
}
@@ -600,7 +600,7 @@ void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD) KillTimer(NULL, timerId);
ThreadRunning = FALSE;
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return;
if (opt.StartupUpdate && opt.NoProtoCondition)
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index 220d93ab51..d428154a0a 100755 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -53,7 +53,7 @@ int CAimProto::aim_auth_request(HANDLE hServerConn, unsigned short &seqno, const mir_md5_finish(&state, auth_hash);
char client_id[64], mirver[64];
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mirver), (LPARAM)mirver);
+ Miranda_GetVersionText(mirver, sizeof(mirver));
int client_id_len = mir_snprintf(client_id, "Miranda AIM, version %s", mirver);
char* buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE * 13 + MD5_HASH_LENGTH + mir_strlen(username) + client_id_len + 30 + mir_strlen(language) + mir_strlen(country));
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 45f7416536..cb4fbf092f 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -391,7 +391,7 @@ void __cdecl CAimProto::aim_protocol_negotiation(void*) {
unsigned short offset = 0;
char client_id[64], mirver[64];
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mirver), (LPARAM)mirver);
+ Miranda_GetVersionText(mirver, sizeof(mirver));
int client_id_len = mir_snprintf(client_id, "Miranda AIM, version %s", mirver);
char* buf_ = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE * 8 + COOKIE_LENGTH + client_id_len + 30); //TODO: correct length
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp index c4d026515d..fa1f8ea22c 100644 --- a/protocols/AimOscar/src/direct_connect.cpp +++ b/protocols/AimOscar/src/direct_connect.cpp @@ -44,7 +44,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini if (result == 0)
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
else {
- if (!ft->requester && result == 1 && !Miranda_Terminated()) {
+ if (!ft->requester && result == 1 && !Miranda_IsTerminated()) {
ft->accepted = false;
HANDLE hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn) {
diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp index 35076518ae..10e04df718 100644 --- a/protocols/AimOscar/src/proxy.cpp +++ b/protocols/AimOscar/src/proxy.cpp @@ -105,7 +105,7 @@ void __cdecl CAimProto::aim_proxy_helper(void* param) int i;
for (i = 21; --i; )
{
- if (Miranda_Terminated()) return;
+ if (Miranda_IsTerminated()) return;
Sleep(100);
if (ft->accepted) break;
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 50bddbceb9..7b9b04854d 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -941,7 +941,7 @@ void CAimProto::snac_contact_list(SNAC &snac, HANDLE hServerConn, unsigned short if (getDword(AIM_KEY_LV, 0) < 0x80500) {
upload_nicks();
- setDword(AIM_KEY_LV, (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0));
+ setDword(AIM_KEY_LV, Miranda_GetVersion());
}
if (getByte(AIM_KEY_CM, 0))
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 6ac3457ed4..1e9601c836 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -149,7 +149,7 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service) if (WaitForSingleObjectEx(hEvent, 10000, TRUE) != WAIT_OBJECT_0)
return false;
- if (Miranda_Terminated() || m_iStatus == ID_STATUS_OFFLINE)
+ if (Miranda_IsTerminated() || m_iStatus == ID_STATUS_OFFLINE)
return false;
return true;
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 14d8d6030b..3f4c3852d5 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -98,7 +98,7 @@ void FacebookProto::UpdateAvatarWorker(void *) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = avatar_queue[0];
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
{
debugLogA("*** Terminating avatar update early: %s", url.c_str());
break;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index 77c280e9af..dd4a7b11c6 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -105,7 +105,7 @@ extern "C" int __declspec(dllexport) Load(void) // Init native User-Agent
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
+ Miranda_GetFileVersion(&v);
std::stringstream agent;
agent << "Miranda NG/" << v[0] << "." << v[1] << "." << v[2];
#ifdef _WIN64
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 421cfef1a7..000edf3ed9 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -441,7 +441,7 @@ retry: hConnStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
dwResult = WaitForSingleObjectEx(hConnStopEvent, dwInterval, TRUE);
if ((dwResult == WAIT_OBJECT_0 && m_iDesiredStatus == ID_STATUS_OFFLINE)
- || (dwResult == WAIT_IO_COMPLETION && Miranda_Terminated()))
+ || (dwResult == WAIT_IO_COMPLETION && Miranda_IsTerminated()))
bRetry = FALSE;
CloseHandle(hConnStopEvent);
hConnStopEvent = NULL;
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 0d68758a86..dcc88ee18c 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -151,7 +151,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags)
{
- if (Miranda_Terminated()) return;
+ if (Miranda_IsTerminated()) return;
PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flags = flags;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 26eaeebb80..6782a772a0 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2252,7 +2252,7 @@ void CIrcProto::OnIrcDisconnected() Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
- if (!Miranda_Terminated())
+ if (!Miranda_IsTerminated())
CList_SetAllOffline(m_disconnectDCCChats);
// restore the original nick, cause it might be changed
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index ecdbe4c3ff..84df4d72a5 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -174,7 +174,7 @@ CMStringW CIrcProto::DoIdentifiers(CMStringW text, const wchar_t*) text.Replace(L"%me", m_info.sNick.c_str());
char mirver[100];
- CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(mirver), LPARAM(mirver));
+ Miranda_GetVersionText(mirver, _countof(mirver));
text.Replace(L"%mirver", _A2T(mirver));
text.Replace(L"%version", _A2T(__VERSION_STRING_DOTS));
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index d59717900a..84b5d6476e 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -218,7 +218,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) } } - if (Miranda_Terminated()) { + if (Miranda_IsTerminated()) { Disconnect(); return false; } diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index dc0b504209..e60957ab47 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -963,7 +963,7 @@ void __cdecl CIrcProto::ConnectServerThread(void*) InterlockedIncrement((long *)&m_bConnectThreadRunning);
InterlockedIncrement((long *)&m_bConnectRequested);
- while (!Miranda_Terminated() && m_bConnectRequested > 0) {
+ while (!Miranda_IsTerminated() && m_bConnectRequested > 0) {
while (m_bConnectRequested > 0)
InterlockedDecrement((long *)&m_bConnectRequested);
if (IsConnected()) {
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 412dec2b39..161d9b10af 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -676,7 +676,7 @@ void CIcqProto::setUserInfo() packDWord(&packet, 0x6E64614E);
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
+ Miranda_GetFileVersion(&v);
packWord(&packet, v[0]);
packWord(&packet, v[1]);
packWord(&packet, v[2]);
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 57616ecde7..6fd71d67e0 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -894,7 +894,7 @@ void avatars_server_connection::connectionThread() if (recvResult == SOCKET_ERROR) {
if (GetLastError() == ERROR_TIMEOUT) { // timeout, check if we should be still running
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
break;
if (time(0) >= dwLastKeepAlive) { // limit frequency (HACK: on some systems select() does not work well)
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index e6be98831a..2f35f7e007 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -234,7 +234,7 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else {
char str[MAX_PATH];
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v);
+ Miranda_GetFileVersion(&v);
mir_snprintf(str, "Miranda NG %d.%d.%d.%d (ICQ %s)", v[0], v[1], v[2], v[3], __VERSION_STRING_DOTS);
SetValue(ppro, hwndDlg, IDC_PORT, hContact, (char*)DBVT_WORD, (char*)ppro->wListenPort, SVS_ZEROISUNSPEC);
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index d15779ae08..49ef420754 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1355,7 +1355,7 @@ DWORD ICQWaitForSingleObject(HANDLE hObject, DWORD dwMilliseconds, int bWaitAlwa do { // will get WAIT_IO_COMPLETION for QueueUserAPC(), ignore it unless terminating
dwResult = WaitForSingleObjectEx(hObject, dwMilliseconds, TRUE);
}
- while (dwResult == WAIT_IO_COMPLETION && (bWaitAlways || !Miranda_Terminated()));
+ while (dwResult == WAIT_IO_COMPLETION && (bWaitAlways || !Miranda_IsTerminated()));
return dwResult;
}
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 5b1ad552b1..35d92e6f17 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -193,7 +193,7 @@ extern "C" int __declspec(dllexport) Load() }
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
+ Miranda_GetFileVersion(&v);
mir_snwprintf(szCoreVersion, L"%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 844d654245..3b77a98b25 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -32,7 +32,7 @@ CMStringA MraGetSelfVersionString() LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : "";
CMStringA szSelfVersion;
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
+ Miranda_GetFileVersion(&v);
szSelfVersion.Format("Miranda NG %lu.%lu.%lu.%lu Unicode (MRA v%lu.%lu.%lu.%lu)%s, version: %lu.%lu",
v[0], v[1], v[2], v[3], __FILEVERSION_STRING, lpszSecIM, PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR);
return szSelfVersion;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 9f035200e4..0f30f5f06f 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -93,7 +93,7 @@ void __cdecl SendThread(LPVOID param) { pfts.totalFiles = ftcd->first->ft_count;
pfts.totalBytes = ftcd->first->totalSize;
- while(SendFileChunk(proto, ft, ftcd) && !Miranda_Terminated()) {
+ while(SendFileChunk(proto, ft, ftcd) && !Miranda_IsTerminated()) {
pfts.currentFileNumber = ftcd->ft_number;
pfts.totalProgress = ftcd->sizeToHere + mwFileTransfer_getSent(ft);
pfts.szWorkingDir = ftcd->save_path;
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index f1f595d8a7..e492bdaa94 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -362,7 +362,7 @@ void __cdecl KeepAliveThread(LPVOID param) SleepEx(250, TRUE);
mir_cslock lck(proto->session_cs);
- if (Miranda_Terminated() || !proto->session) {
+ if (Miranda_IsTerminated() || !proto->session) {
proto->debugLogW(L"KeepAliveThread() end");
break;
}
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 321115a890..27d962a9d9 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -113,7 +113,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) void CSametimeProto::showPopup(const wchar_t* msg, SametimePopupEnum flag)
{
- if (Miranda_Terminated()) return;
+ if (Miranda_IsTerminated()) return;
PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flag = flag;
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index 6c4965b96b..b1ebb5b7c7 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -60,7 +60,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface();
pci = Chat_GetInterface();
CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii);
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));
+ Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
PROTOCOLDESCRIPTOR pd = { 0 };
pd.cbSize = sizeof(pd);
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 810491c807..d3ffa065b3 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -49,7 +49,7 @@ void CSkypeProto::UninitPopups() void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact, int type)
{
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return;
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 1d5b85e89e..bed1e13ea3 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -266,7 +266,7 @@ int CSkypeProto::SetStatus(int iNewStatus) CloseDialogs();
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, ID_STATUS_OFFLINE);
- if (!Miranda_Terminated())
+ if (!Miranda_IsTerminated())
SetAllContactsStatus(ID_STATUS_OFFLINE);
return 0;
}
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 264be85961..3acfe40114 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -315,7 +315,7 @@ int CSteamProto::SetStatus(int new_status) requestQueue->Stop(); - if (!Miranda_Terminated()) + if (!Miranda_IsTerminated()) SetAllContactsStatus(ID_STATUS_OFFLINE); } else if (old_status == ID_STATUS_OFFLINE) diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 6c70528787..1f3cfdfa8e 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -161,7 +161,7 @@ exit: void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
{
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1))
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f0cc77fd33..b6956a3095 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -561,7 +561,7 @@ static void TlenProcessIqGetVersion(TlenProtocol *proto, XmlNode *node) if ( os == NULL ) os = TlenTextEncode("Windows");
mir_strcpy(mversion, "Miranda NG ");
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof( mversion ) - 11, ( LPARAM )mversion + 11 );
+ Miranda_GetVersionText(mversion + 11, sizeof(mversion) - 11);
mir_strcat(mversion, " (Tlen v.");
mir_strcat(mversion, TLEN_VERSION_STRING);
mir_strcat(mversion, ")");
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index d249a59a86..7efbe6c7a6 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -157,7 +157,7 @@ int CToxProto::SetStatus(int iNewStatus) toxThread = NULL;
}
- if (!Miranda_Terminated())
+ if (!Miranda_IsTerminated())
{
SetAllContactsStatus(ID_STATUS_OFFLINE);
CloseAllChatChatSessions();
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 009c32b867..c8fb9e6b2b 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -105,7 +105,7 @@ wchar_t* CToxProto::ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error) void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
{
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
{
return;
}
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 913bcd70e2..b23c3a3d5a 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -417,7 +417,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) debugLogA("***** Updating avatar: %s", data->url.c_str());
mir_cslock lck(avatar_lock_);
- if (CallService(MS_SYSTEM_TERMINATED, 0, 0)) // if miranda is shutting down...
+ if (Miranda_IsTerminated()) // if miranda is shutting down...
{
debugLogA("***** Terminating avatar update early: %s", data->url.c_str());
return;
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index 7905c42ccc..54da26d108 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -81,7 +81,7 @@ extern "C" int __declspec(dllexport) Load(void) // Init native User-Agent
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, LPARAM(&v));
+ Miranda_GetFileVersion(&v);
WAConnection::globalInit();
return 0;
diff --git a/src/core/stdclist/src/clistmenus.cpp b/src/core/stdclist/src/clistmenus.cpp index fe2aaea72e..78b901d1c7 100644 --- a/src/core/stdclist/src/clistmenus.cpp +++ b/src/core/stdclist/src/clistmenus.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR CloseAction(WPARAM, LPARAM)
{
- if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
+ if (Miranda_OkToExit())
DestroyWindow(pcli->hwndContactList);
return(0);
diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index ea58985f7d..66a6334e5e 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -48,7 +48,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar }
{
char productVersion[56];
- CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(productVersion), (LPARAM)productVersion);
+ Miranda_GetVersionText(productVersion, _countof(productVersion));
wchar_t str[64];
mir_snwprintf(str, STR_VERSION_FORMAT, productVersion);
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 873caf139f..d884c372af 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -688,7 +688,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) {
case ID_TRAY_EXIT:
case ID_ICQ_EXIT:
- if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
+ if (Miranda_OkToExit())
DestroyWindow(hwnd);
break;
@@ -1012,7 +1012,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return 0;
case WM_CLOSE:
- if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
+ if (Miranda_OkToExit())
DestroyWindow(hwnd);
return FALSE;
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 8dc230808b..80f1466f49 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -127,7 +127,7 @@ void CLangpackDlg::LoadLangpacks() mir_wstrcpy(pack.tszLanguage, L"English");
pack.szAuthors = "Miranda NG Development Team";
pack.szAuthorEmail = "project-info@miranda-ng.org";
- DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0);
+ DWORD v = Miranda_GetVersion();
pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF));
if (GetModuleFileName(NULL, pack.tszFullPath, _countof(pack.tszFullPath))) {
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 2dcaf3ed1b..da19c3658d 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -339,3 +339,8 @@ Srmm_GetNthButton @339 Srmm_GetButtonCount @340
Srmm_ClickToolbarIcon @341
Miranda_WaitOnHandle @342
+Miranda_IsTerminated @343
+Miranda_OkToExit @344
+Miranda_GetVersion @345
+Miranda_GetFileVersion @346
+Miranda_GetVersionText @347
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 73b3111bf1..84a99f806f 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -339,3 +339,8 @@ Srmm_GetNthButton @339 Srmm_GetButtonCount @340
Srmm_ClickToolbarIcon @341
Miranda_WaitOnHandle @342
+Miranda_IsTerminated @343
+Miranda_OkToExit @344
+Miranda_GetVersion @345
+Miranda_GetFileVersion @346
+Miranda_GetVersionText @347
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index e21b06339e..188785555e 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -102,33 +102,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID) }
/////////////////////////////////////////////////////////////////////////////////////////
-// exception handling
-
-static INT_PTR srvGetExceptionFilter(WPARAM, LPARAM)
-{
- return (INT_PTR)GetExceptionFilter();
-}
-
-static INT_PTR srvSetExceptionFilter(WPARAM, LPARAM lParam)
-{
- return (INT_PTR)SetExceptionFilter((pfnExceptionFilter)lParam);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
typedef LONG(WINAPI *pNtQIT)(HANDLE, LONG, PVOID, ULONG, PULONG);
#define ThreadQuerySetWin32StartAddress 9
-INT_PTR MirandaIsTerminated(WPARAM, LPARAM)
-{
- return WaitForSingleObject(hMirandaShutdown, 0) == WAIT_OBJECT_0;
-}
-
static void __cdecl compactHeapsThread(void*)
{
Thread_SetName("compactHeapsThread");
- while (!Miranda_Terminated()) {
+ while (!Miranda_IsTerminated()) {
HANDLE hHeaps[256];
DWORD hc;
SleepEx((1000 * 60) * 5, TRUE); // every 5 minutes
@@ -382,12 +364,22 @@ int WINAPI mir_main(LPTSTR cmdLine) return result;
}
-static INT_PTR OkToExit(WPARAM, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(bool) Miranda_IsTerminated()
+{
+ return WaitForSingleObject(hMirandaShutdown, 0) == WAIT_OBJECT_0;
+}
+
+MIR_APP_DLL(bool) Miranda_OkToExit()
{
return NotifyEventHooks(hOkToExitEvent, 0, 0) == 0;
}
-static INT_PTR GetMirandaVersion(WPARAM, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+// version functions
+
+MIR_APP_DLL(DWORD) Miranda_GetVersion()
{
wchar_t filename[MAX_PATH];
GetModuleFileName(g_hInst, filename, _countof(filename));
@@ -399,14 +391,13 @@ static INT_PTR GetMirandaVersion(WPARAM, LPARAM) UINT blockSize;
VS_FIXEDFILEINFO *vsffi;
VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
- DWORD ver = (((vsffi->dwProductVersionMS >> 16) & 0xFF) << 24) |
+ return (((vsffi->dwProductVersionMS >> 16) & 0xFF) << 24) |
((vsffi->dwProductVersionMS & 0xFF) << 16) |
(((vsffi->dwProductVersionLS >> 16) & 0xFF) << 8) |
(vsffi->dwProductVersionLS & 0xFF);
- return (INT_PTR)ver;
}
-static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam)
+MIR_APP_DLL(void) Miranda_GetFileVersion(MFileVersion *pVer)
{
wchar_t filename[MAX_PATH];
GetModuleFileName(g_hInst, filename, _countof(filename));
@@ -419,15 +410,13 @@ static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam) VS_FIXEDFILEINFO *vsffi;
VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
- WORD* p = (WORD*)lParam;
- p[0] = HIWORD(vsffi->dwProductVersionMS);
- p[1] = LOWORD(vsffi->dwProductVersionMS);
- p[2] = HIWORD(vsffi->dwProductVersionLS);
- p[3] = LOWORD(vsffi->dwProductVersionLS);
- return 0;
+ *pVer[0] = HIWORD(vsffi->dwProductVersionMS);
+ *pVer[1] = LOWORD(vsffi->dwProductVersionMS);
+ *pVer[2] = HIWORD(vsffi->dwProductVersionLS);
+ *pVer[3] = LOWORD(vsffi->dwProductVersionLS);
}
-static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize)
{
wchar_t filename[MAX_PATH], *productVersion;
GetModuleFileName(g_hInst, filename, _countof(filename));
@@ -438,11 +427,10 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) UINT blockSize;
VerQueryValue(pVerInfo, L"\\StringFileInfo\\000004b0\\ProductVersion", (LPVOID*)&productVersion, &blockSize);
- strncpy((char*)lParam, _T2A(productVersion), wParam);
+ strncpy_s(pDest, cbSize, _T2A(productVersion), _TRUNCATE);
#if defined(_WIN64)
- strcat_s((char*)lParam, wParam, " x64");
+ strcat_s(pDest, cbSize, " x64");
#endif
- return 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -455,13 +443,5 @@ int LoadSystemModule(void) hPreShutdownEvent = CreateHookableEvent(ME_SYSTEM_PRESHUTDOWN);
hModulesLoadedEvent = CreateHookableEvent(ME_SYSTEM_MODULESLOADED);
hOkToExitEvent = CreateHookableEvent(ME_SYSTEM_OKTOEXIT);
-
- CreateServiceFunction(MS_SYSTEM_TERMINATED, MirandaIsTerminated);
- CreateServiceFunction(MS_SYSTEM_OKTOEXIT, OkToExit);
- CreateServiceFunction(MS_SYSTEM_GETVERSION, GetMirandaVersion);
- CreateServiceFunction(MS_SYSTEM_GETFILEVERSION, GetMirandaFileVersion);
- CreateServiceFunction(MS_SYSTEM_GETVERSIONTEXT, GetMirandaVersionText);
- CreateServiceFunction(MS_SYSTEM_GETEXCEPTFILTER, srvGetExceptionFilter);
- CreateServiceFunction(MS_SYSTEM_SETEXCEPTFILTER, srvSetExceptionFilter);
return 0;
}
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index cc83510207..d229b1712b 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -97,7 +97,7 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, ch return NLRecv(nlc, buf, len, flags);
}
- if (nlc->termRequested || Miranda_Terminated())
+ if (nlc->termRequested || Miranda_IsTerminated())
return 0;
}
SetLastError(ERROR_TIMEOUT);
@@ -303,7 +303,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, SetLastError(ERROR_BUFFER_OVERFLOW);
return 0;
}
- if (Miranda_Terminated())
+ if (Miranda_IsTerminated())
return 0;
Sleep(10);
}
diff --git a/src/mir_app/src/netlibhttpproxy.cpp b/src/mir_app/src/netlibhttpproxy.cpp index 4f1caf3f2b..b8fd51fcb1 100644 --- a/src/mir_app/src/netlibhttpproxy.cpp +++ b/src/mir_app/src/netlibhttpproxy.cpp @@ -266,7 +266,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) if (nlc->pHttpProxyPacketQueue != NULL && GetTickCount() - nlc->lastPost > 1000)
break;
- if (nlc->termRequested || (SleepEx(1000, TRUE) && Miranda_Terminated()))
+ if (nlc->termRequested || (SleepEx(1000, TRUE) && Miranda_IsTerminated()))
return SOCKET_ERROR;
}
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 0dd4312c59..40feea10d5 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -367,7 +367,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) ReleaseMutex(hConnectionOpenMutex); // might of died in between the wait - if (Miranda_Terminated()) return false; + if (Miranda_IsTerminated()) return false; } PHOSTENT he; @@ -393,7 +393,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) he = gethostbyname(nloc->szHost); } - for (char** har = he->h_addr_list; *har && !Miranda_Terminated(); ++har) { + for (char** har = he->h_addr_list; *har && !Miranda_IsTerminated(); ++har) { sin.sin_addr.s_addr = *(u_long*)*har; char* szIp = NetlibAddressToString((SOCKADDR_INET_M*)&sin); @@ -459,7 +459,7 @@ retry: } break; } - else if (Miranda_Terminated()) { + else if (Miranda_IsTerminated()) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -510,7 +510,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) ReleaseMutex(hConnectionOpenMutex); // might of died in between the wait - if (Miranda_Terminated()) return false; + if (Miranda_IsTerminated()) return false; } char szPort[6]; @@ -553,7 +553,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) } } - for (ai = air; ai && !Miranda_Terminated(); ai = ai->ai_next) { + for (ai = air; ai && !Miranda_IsTerminated(); ai = ai->ai_next) { NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, ptrA(NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr))); retry: nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -622,7 +622,7 @@ retry: } break; } - else if (Miranda_Terminated()) { + else if (Miranda_IsTerminated()) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -804,7 +804,7 @@ bool NetlibReconnect(NetlibConnection *nlc) } if (!opened) { - if (Miranda_Terminated()) + if (Miranda_IsTerminated()) return false; if (nlc->usingHttpGateway) { @@ -888,8 +888,8 @@ NetlibConnection::~NetlibConnection() if (s != INVALID_SOCKET) closesocket(s); - mir_free(szNewUrl);
- mir_free(szProxyServer);
+ mir_free(szNewUrl); + mir_free(szProxyServer); mir_free(nlhpi.szHttpPostUrl); mir_free(nlhpi.szHttpGetUrl); diff --git a/src/mir_app/src/netlibpktrecver.cpp b/src/mir_app/src/netlibpktrecver.cpp index 4383ba841f..456ff10634 100644 --- a/src/mir_app/src/netlibpktrecver.cpp +++ b/src/mir_app/src/netlibpktrecver.cpp @@ -58,7 +58,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
- if (Miranda_Terminated()) { /* HACK: Lame, break while loops of protocols that can't kill their while loops, (cough, ICQ, cough) */
+ if (Miranda_IsTerminated()) { /* HACK: Lame, break while loops of protocols that can't kill their while loops, (cough, ICQ, cough) */
SetLastError(ERROR_TIMEOUT);
return SOCKET_ERROR;
}
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index 4107cd7958..5979624949 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -595,7 +595,7 @@ static void discoverUPnP(void) LongLog(buf);
}
- if (Miranda_Terminated()) break;
+ if (Miranda_IsTerminated()) break;
FD_ZERO(&readfd);
FD_SET(s, &readfd);
@@ -760,7 +760,7 @@ void NetlibUPnPCleanup(void*) num = atol(buf);
WORD ports[30];
- for (unsigned i = 0; i < num && !Miranda_Terminated(); i++) {
+ for (unsigned i = 0; i < num && !Miranda_IsTerminated(); i++) {
mir_snprintf(szData, 4096, get_port_mapping, i);
ReleaseMutex(portListMutex);
@@ -792,7 +792,7 @@ void NetlibUPnPCleanup(void*) ReleaseMutex(portListMutex);
- for (unsigned i = 0; i < j && !Miranda_Terminated(); i++)
+ for (unsigned i = 0; i < j && !Miranda_IsTerminated(); i++)
NetlibUPnPDeletePortMapping(ports[i], "TCP");
}
}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 9fbb3e9b4a..aa948c6fb6 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -864,7 +864,7 @@ int LoadNewPluginsModuleInfos(void) LoadPluginOptions();
hPluginListHeap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
- mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
+ mirandaVersion = Miranda_GetVersion();
// remember where the mirandaboot.ini goes
PathToAbsoluteW(L"mirandaboot.ini", mirandabootini);
|