OSDN Git Service

Slightly tweaked initialization checks.
authorLoRd_MuldeR <mulder2@gmx.de>
Sun, 19 Aug 2012 12:34:04 +0000 (14:34 +0200)
committerLoRd_MuldeR <mulder2@gmx.de>
Sun, 19 Aug 2012 12:34:04 +0000 (14:34 +0200)
src/Config.h
src/Global.cpp

index bded25b..1114df5 100644 (file)
@@ -30,7 +30,7 @@
 #define VER_LAMEXP_MINOR_LO                                    5
 #define VER_LAMEXP_TYPE                                                Beta
 #define VER_LAMEXP_PATCH                                       4
-#define VER_LAMEXP_BUILD                                       1090
+#define VER_LAMEXP_BUILD                                       1091
 
 ///////////////////////////////////////////////////////////////////////////////
 // Tool versions (minimum expected versions!)
index 39d7a41..aa426c7 100644 (file)
@@ -2180,17 +2180,17 @@ QStringList lamexp_available_codepages(bool noAliases)
 /*
  * Entry point checks
  */
-static bool lamexp_entry_check(void);
-static bool g_lamexp_entry_check = false;
-static bool g_lamexp_entry_check_result = lamexp_entry_check();
-static bool lamexp_entry_check(void)
+static DWORD lamexp_entry_check(void);
+static DWORD g_lamexp_entry_check_result = lamexp_entry_check();
+static DWORD g_lamexp_entry_check_flag = 0x789E09B2;
+static DWORD lamexp_entry_check(void)
 {
-       if(!g_lamexp_entry_check)
+       volatile DWORD retVal = 0xA199B5AF;
+       if(g_lamexp_entry_check_flag != 0x8761F64D)
        {
-               FatalAppExit(0, L"Application initialization has failed!");
+               FatalAppExit(0, L"Application initialization has failed, take care!");
                TerminateProcess(GetCurrentProcess(), -1);
        }
-       volatile bool retVal = true;
        return retVal;
 }
 
@@ -2203,14 +2203,18 @@ extern "C"
        
        int lamexp_entry_point(void)
        {
-               /*MessageBoxA(NULL, "lamexp_entry_point", NULL, MB_TOPMOST);*/
-               
                if((!LAMEXP_DEBUG) && lamexp_check_for_debugger())
                {
                        FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!");
                        TerminateProcess(GetCurrentProcess(), -1);
                }
-               
+
+               if(g_lamexp_entry_check_flag != 0x789E09B2)
+               {
+                       FatalAppExit(0, L"Application initialization has failed, take care!");
+                       TerminateProcess(GetCurrentProcess(), -1);
+               }
+
                //Zero *before* constructors are called
                LAMEXP_ZERO_MEMORY(g_lamexp_argv);
                LAMEXP_ZERO_MEMORY(g_lamexp_tools);
@@ -2220,7 +2224,7 @@ extern "C"
                LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr);
 
                //Make sure we will pass the check
-               g_lamexp_entry_check = true;
+               g_lamexp_entry_check_flag = ~g_lamexp_entry_check_flag;
 
                //Now initialize the C Runtime library!
                return WinMainCRTStartup();