Mercurial > mm7
diff OSAPI.cpp @ 0:9c0607679772
init
author | Ritor1 |
---|---|
date | Sat, 12 Jan 2013 09:45:18 +0600 |
parents | |
children | 739d8f3b50f9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OSAPI.cpp Sat Jan 12 09:45:18 2013 +0600 @@ -0,0 +1,40 @@ +#include "OSAPI.h" +#include "OSInfo.h" +#include "Log.h" + + +OSVersion *pVersion = nullptr; + + +//----- (00462C94) -------------------------------------------------------- +int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t *lpCmdLine, int nShowCmd) +{ + Log::Initialize(); + + //if (HWND hMM7Window = FindWindowW(L"MM7", 0)) + if (HWND hMM7Window = FindWindowW(L"M&MTrilogy", 0)) + { + if (IsIconic(hMM7Window)) + ShowWindow(hMM7Window, SW_RESTORE); + SetForegroundWindow(GetLastActivePopup(hMM7Window)); + return 0; + } + HWND hPrevWindow = GetActiveWindow(); + + pVersion = new OSVersion; + { + Log::Warning(L"OS init: ok"); + + extern bool MM_Main(const wchar_t *pCmdLine); + MM_Main(lpCmdLine); + } + delete pVersion; + pVersion = nullptr; + + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); + if (hPrevWindow) + SetActiveWindow(hPrevWindow); + + __debugbreak(); + return 0; +}