summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-02 18:54:39 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-02 18:54:39 +0000
commit2bdd151424c835908851394f99f8a57e325dfd06 (patch)
tree55d317735a6486600f07160d82fea2e1430f7d9d /src
parent8a1836d5bfac6c478f26cc0ffa4d70f1d40368c8 (diff)
Restarting miranda now really restart it
git-svn-id: http://svn.miranda-ng.org/main/trunk@724 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/utils/utils.cpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index bb0a60c67f..4af0230071 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -375,7 +375,6 @@ static INT_PTR AssertInsideScreen(WPARAM wParam, LPARAM lParam)
return 1;
}
-
static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam)
{
SAVEWINDOWPOS *swp=(SAVEWINDOWPOS*)lParam;
@@ -415,7 +414,6 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam)
}
/////////////////////////////////////////////////////////////////////////////////////////
-
static INT_PTR RestartMiranda(WPARAM, LPARAM)
{
TCHAR mirandaPath[ MAX_PATH ], cmdLine[ 100 ];
@@ -424,6 +422,7 @@ static INT_PTR RestartMiranda(WPARAM, LPARAM)
si.cb = sizeof(si);
GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("/restart:%d"), GetCurrentProcessId());
+ CallService("CloseAction", 0, 0);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
return 0;
}
@@ -434,33 +433,32 @@ typedef BOOL (APIENTRY *PGENRANDOM)(PVOID, ULONG);
static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam)
{
- if (wParam == 0 || lParam == 0) return 0;
-
- PGENRANDOM pfnRtlGenRandom = NULL;
- HMODULE hModule = GetModuleHandleA("advapi32");
- if (hModule)
- {
- pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036");
- if (pfnRtlGenRandom)
- {
- if ( !pfnRtlGenRandom((PVOID)lParam, wParam))
- pfnRtlGenRandom = NULL;
- }
- }
- if (pfnRtlGenRandom == NULL)
- {
- srand(GetTickCount());
- unsigned short* buf = (unsigned short*)lParam;
- for (; (long)(wParam-=2) >= 0;)
- *(buf++) = (unsigned short)rand();
- if (lParam < 0)
- *(char*)buf = (char)(rand() & 0xFF);
- }
- return 0;
+ if (wParam == 0 || lParam == 0) return 0;
+
+ PGENRANDOM pfnRtlGenRandom = NULL;
+ HMODULE hModule = GetModuleHandleA("advapi32");
+ if (hModule)
+ {
+ pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036");
+ if (pfnRtlGenRandom)
+ {
+ if ( !pfnRtlGenRandom((PVOID)lParam, wParam))
+ pfnRtlGenRandom = NULL;
+ }
+ }
+ if (pfnRtlGenRandom == NULL)
+ {
+ srand(GetTickCount());
+ unsigned short* buf = (unsigned short*)lParam;
+ for (; (long)(wParam-=2) >= 0;)
+ *(buf++) = (unsigned short)rand();
+ if (lParam < 0)
+ *(char*)buf = (char)(rand() & 0xFF);
+ }
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-
int LoadUtilsModule(void)
{
bModuleInitialized = TRUE;