Slightly tweaked initialization checks.

This commit is contained in:
LoRd_MuldeR 2012-08-19 14:34:04 +02:00
parent 9a7f0d5176
commit c6fcad10c4
2 changed files with 16 additions and 12 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 5 #define VER_LAMEXP_MINOR_LO 5
#define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 4 #define VER_LAMEXP_PATCH 4
#define VER_LAMEXP_BUILD 1090 #define VER_LAMEXP_BUILD 1091
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -2180,17 +2180,17 @@ QStringList lamexp_available_codepages(bool noAliases)
/* /*
* Entry point checks * Entry point checks
*/ */
static bool lamexp_entry_check(void); static DWORD lamexp_entry_check(void);
static bool g_lamexp_entry_check = false; static DWORD g_lamexp_entry_check_result = lamexp_entry_check();
static bool g_lamexp_entry_check_result = lamexp_entry_check(); static DWORD g_lamexp_entry_check_flag = 0x789E09B2;
static bool lamexp_entry_check(void) 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); TerminateProcess(GetCurrentProcess(), -1);
} }
volatile bool retVal = true;
return retVal; return retVal;
} }
@ -2203,14 +2203,18 @@ extern "C"
int lamexp_entry_point(void) int lamexp_entry_point(void)
{ {
/*MessageBoxA(NULL, "lamexp_entry_point", NULL, MB_TOPMOST);*/
if((!LAMEXP_DEBUG) && lamexp_check_for_debugger()) if((!LAMEXP_DEBUG) && lamexp_check_for_debugger())
{ {
FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!"); FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!");
TerminateProcess(GetCurrentProcess(), -1); 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 //Zero *before* constructors are called
LAMEXP_ZERO_MEMORY(g_lamexp_argv); LAMEXP_ZERO_MEMORY(g_lamexp_argv);
LAMEXP_ZERO_MEMORY(g_lamexp_tools); LAMEXP_ZERO_MEMORY(g_lamexp_tools);
@ -2220,7 +2224,7 @@ extern "C"
LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr); LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr);
//Make sure we will pass the check //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! //Now initialize the C Runtime library!
return WinMainCRTStartup(); return WinMainCRTStartup();