summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-05 19:07:01 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-05 19:07:01 +0000
commit9520538df4328f38ab55d6032e9679e6627da850 (patch)
tree34e5db93575b75b6fd1292fa97c7faa50c3528a8 /plugins/PluginUpdater
parent87cb6f6dc1904efe8e398bcdf6ad804c9ad60622 (diff)
fix for running PU under Miranda IM
git-svn-id: http://svn.miranda-ng.org/main/trunk@3900 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 89d817a06f..4d169825f2 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -175,19 +175,6 @@ int Get_CRC(unsigned char* buffer, ULONG bufsize)
return crc^0xffffffff;
}
-long FileSize(FILE *input)
-{
-
- long fileSizeBytes;
- fseek(input, 0, SEEK_END);
- fileSizeBytes = ftell(input);
- fseek(input, 0, SEEK_SET);
-
- return fileSizeBytes;
-
-
-}
-
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal, int CRCsum)
{
DWORD dwBytes;
@@ -259,11 +246,6 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal, int CRCsum)
return ret;
}
-void __stdcall RestartMe(void*)
-{
- CallService(MS_SYSTEM_RESTART, db_get_b(NULL,MODNAME,"RestartCurrentProfile",1) ? 1 : 0, 0);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
BOOL AllowUpdateOnStartup()
@@ -355,6 +337,30 @@ void CreatePathToFileT(TCHAR* tszFilePath)
CreateDirectoryTreeT(tszFilePath);
*pszLastBackslash = '\\';
}
+
+void __stdcall RestartMe(void*)
+{
+ TCHAR mirandaPath[MAX_PATH], cmdLine[MAX_PATH];
+ 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);
+ mir_free(profilename);
+
+ CallService("CloseAction", 0, 0);
+
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si = { sizeof(si) };
+ CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+}
+
+#else
+
+void __stdcall RestartMe(void*)
+{
+ CallService(MS_SYSTEM_RESTART, db_get_b(NULL,MODNAME,"RestartCurrentProfile",1) ? 1 : 0, 0);
+}
+
#endif
// FUNCTION: IsRunAsAdmin()