summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/miranda.cpp23
-rw-r--r--src/core/modules.cpp5
-rw-r--r--src/mir_core/mir_core.def4
-rw-r--r--src/mir_core/mir_core_10.vcxproj1
-rw-r--r--src/mir_core/mir_core_10.vcxproj.filters3
5 files changed, 21 insertions, 15 deletions
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp
index be4a7691f5..133b4e1cda 100644
--- a/src/core/miranda.cpp
+++ b/src/core/miranda.cpp
@@ -195,12 +195,11 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam
return FALSE;
}
-void ParseCommandLine()
+void CheckRestart()
{
- char* cmdline = GetCommandLineA();
- char* p = strstr(cmdline, "/restart:");
- if (p) {
- HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, atol(p+9));
+ LPCTSTR tszPID = CmdLine_GetOption( _T("restart"));
+ if (tszPID) {
+ HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _ttol(tszPID));
if (hProcess) {
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WAITRESTART), NULL, WaitForProcessDlgProc, (LPARAM)hProcess);
CloseHandle(hProcess);
@@ -208,14 +207,11 @@ void ParseCommandLine()
}
}
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
+int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int)
{
- DWORD myPid = 0;
- int messageloop = 1;
- int result = 0;
-
hInst = hInstance;
+ CmdLine_Parse(cmdLine);
setlocale(LC_ALL, "");
#ifdef _DEBUG
@@ -291,6 +287,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
if ( IsWinVer7Plus())
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
+ int result = 0;
if ( LoadDefaultModules()) {
NotifyEventHooks(hShutdownEvent, 0, 0);
UnloadDefaultModules();
@@ -308,7 +305,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
CreateServiceFunction(MS_SYSTEM_SETIDLECALLBACK, SystemSetIdleCallback);
CreateServiceFunction(MS_SYSTEM_GETIDLE, SystemGetIdle);
dwEventTime = GetTickCount();
- myPid = GetCurrentProcessId();
+ DWORD myPid = GetCurrentProcessId();
+
+ bool messageloop = true;
while (messageloop) {
MSG msg;
DWORD rc;
@@ -345,7 +344,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
PostQuitMessage(0);
}
else if (dying)
- messageloop = 0;
+ messageloop = false;
}
}
diff --git a/src/core/modules.cpp b/src/core/modules.cpp
index e44114cf96..1023506247 100644
--- a/src/core/modules.cpp
+++ b/src/core/modules.cpp
@@ -30,7 +30,8 @@ static DWORD mainThreadId;
static HANDLE hMainThread;
static HANDLE hMissingService;
-void ParseCommandLine(); // core: IDD_WAITRESTART
+void CheckRestart(); // core: IDD_WAITRESTART
+
int LoadSystemModule(void); // core: m_system.h services
int LoadNewPluginsModuleInfos(void); // core: preloading plugins
int LoadNewPluginsModule(void); // core: N.O. plugins
@@ -86,7 +87,7 @@ int LoadDefaultModules(void)
//load order is very important for these
if ( LoadSystemModule()) return 1;
if ( LoadLangpackModule()) return 1; // langpack will be a system module in the new order so this is moved here
- ParseCommandLine(); // IDD_WAITRESTART need langpack so this is moved here
+ CheckRestart();
if ( LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
if ( LoadIcoTabsModule()) return 1;
if ( LoadHeaderbarModule()) return 1;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 4d231dbc70..41585d0845 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -126,4 +126,6 @@ UnloadCoreModule @123
Thread_SetName @124
replaceStr @125
replaceStrW @126
-db_setCurrent @127 \ No newline at end of file
+db_setCurrent @127
+CmdLine_GetOption @128
+CmdLine_Parse @129
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj
index 6733a99d62..c146823d55 100644
--- a/src/mir_core/mir_core_10.vcxproj
+++ b/src/mir_core/mir_core_10.vcxproj
@@ -28,6 +28,7 @@
<ClInclude Include="modules.h" />
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="cmdline.cpp" />
<ClCompile Include="commonheaders.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters
index 27b6a42604..ac781fdcba 100644
--- a/src/mir_core/mir_core_10.vcxproj.filters
+++ b/src/mir_core/mir_core_10.vcxproj.filters
@@ -49,6 +49,9 @@
<ClCompile Include="threads.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="cmdline.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">