summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 11:18:18 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 11:18:18 +0000
commit26043c64e60b22915f88a1661766a74f8f5634d0 (patch)
treebb17826e8f5caf8d60fa7aa25819fa6ef58d9cbc /plugins/PluginUpdater/src
parent39b98d62430ee2a762db94822c2da05b2065d021 (diff)
PluginUpdater: restart with the same profile that started the update
git-svn-id: http://svn.miranda-ng.org/main/trunk@1813 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index ad1a5fe774..da09a0846e 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -168,8 +168,16 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
void __stdcall RestartMe(void*)
{
+ TCHAR mirandaPath[MAX_PATH], cmdLine[100];
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si = {0};
+ si.cb = sizeof(si);
+ GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
+ TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), profilename);
CallService("CloseAction", 0, 0);
- CallService(MS_SYSTEM_RESTART, 0, 0);
+ CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ mir_free(profilename);
}
/////////////////////////////////////////////////////////////////////////////////////////