diff options
author | George Hazan <george.hazan@gmail.com> | 2016-06-06 15:47:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-06-06 15:47:34 +0000 |
commit | 3d03ebefdd8f81e84275d858be1aa56aae1e12f1 (patch) | |
tree | f4a1fe6b2756a19549538125e3befc0e053306d2 | |
parent | 3c86f787291fd5cdc88ea4a0ae8501b5ad413429 (diff) |
parameter added to MS_SYSTEM_RESTART: a path to Miranda's binary
git-svn-id: http://svn.miranda-ng.org/main/trunk@16927 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_system.h | 2 | ||||
-rw-r--r-- | src/mir_core/src/miranda.cpp | 15 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/m_system.h b/include/m_system.h index 8f6f3f843b..3adb87982f 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -65,7 +65,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //restarts miranda (0.8+)
//wParam = 0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
-//lParam = 0
+//lParam = (TCHAR*)path to a new miranda32.exe binary or NULL to use current
#define MS_SYSTEM_RESTART "Miranda/System/Restart"
//miranda/system/oktoexit event
diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index bc926d1c9a..f5a2997367 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -48,13 +48,14 @@ DWORD mir_tls = 0; /////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR RestartMiranda(WPARAM wParam, LPARAM)
+static INT_PTR RestartMiranda(WPARAM wParam, LPARAM lParam)
{
TCHAR mirandaPath[MAX_PATH], cmdLine[MAX_PATH];
- PROCESS_INFORMATION pi;
- STARTUPINFO startupInfo = { 0 };
- startupInfo.cb = sizeof(startupInfo);
- GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+ if (lParam)
+ _tcsncpy_s(mirandaPath, (const TCHAR*)lParam, _TRUNCATE);
+ else
+ GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+
if (wParam) {
VARST profilename(_T("%miranda_profilename%"));
mir_sntprintf(cmdLine, _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), (TCHAR*)profilename);
@@ -62,6 +63,10 @@ static INT_PTR RestartMiranda(WPARAM wParam, LPARAM) else mir_sntprintf(cmdLine, _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
+
+ PROCESS_INFORMATION pi;
+ STARTUPINFO startupInfo = { 0 };
+ startupInfo.cb = sizeof(startupInfo);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &pi);
return 0;
}
|