diff OSAPI.cpp @ 0:8b8875f5b359

Initial commit
author Nomad
date Fri, 05 Oct 2012 16:07:14 +0200
parents
children 509744251c8e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OSAPI.cpp	Fri Oct 05 16:07:14 2012 +0200
@@ -0,0 +1,36 @@
+#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 (IsIconic(hMM7Window))
+      ShowWindow(hMM7Window, SW_RESTORE);
+    SetForegroundWindow(GetLastActivePopup(hMM7Window));
+    return 0;
+  }
+  HWND hPrevWindow = GetActiveWindow();
+
+  pVersion = new OSVersion;
+  {
+    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;
+}