From f282cff1542a791b90eaea4523a462c4ab5232bb Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 18 Aug 2012 20:55:59 +0200 Subject: [PATCH] Updated Visual Studio 2008 project file. --- LameXP_VS2008.vcproj | 9 ++++++--- src/Config.h | 2 +- src/Global.cpp | 24 +++++++++++++++++++++++- src/Global.h | 10 ++++++---- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/LameXP_VS2008.vcproj b/LameXP_VS2008.vcproj index c2794ea4..84440e16 100644 --- a/LameXP_VS2008.vcproj +++ b/LameXP_VS2008.vcproj @@ -71,6 +71,7 @@ AdditionalLibraryDirectories=""$(QTDIR)\lib";"$(QTDIR)\plugins\imageformats";"$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\lib\Win32"" GenerateDebugInformation="true" SubSystem="2" + EntryPointSymbol="lamexp_entry_point" TargetMachine="1" /> @@ -265,6 +267,7 @@ OptimizeReferences="2" EnableCOMDATFolding="2" LinkTimeCodeGeneration="1" + EntryPointSymbol="lamexp_entry_point" SetChecksum="true" TargetMachine="1" /> @@ -635,7 +638,7 @@ @@ -645,7 +648,7 @@ @@ -655,7 +658,7 @@ diff --git a/src/Config.h b/src/Config.h index 55b45367..bded25b3 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 5 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 4 -#define VER_LAMEXP_BUILD 1089 +#define VER_LAMEXP_BUILD 1090 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Global.cpp b/src/Global.cpp index 5d5e7d77..748cf741 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -2176,6 +2176,22 @@ QStringList lamexp_available_codepages(bool noAliases) return codecList; } +/* + * 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) +{ + if(!g_lamexp_entry_check) + { + FatalAppExit(0, L"Application initialization has failed!"); + TerminateProcess(GetCurrentProcess(), -1); + } + return true; +} + /* * Application entry point (runs before static initializers) */ @@ -2185,13 +2201,15 @@ 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); } - //Init global structs to NULL *before* constructors are called + //Zero *before* constructors are called LAMEXP_ZERO_MEMORY(g_lamexp_argv); LAMEXP_ZERO_MEMORY(g_lamexp_tools); LAMEXP_ZERO_MEMORY(g_lamexp_currentTranslator); @@ -2199,6 +2217,10 @@ extern "C" LAMEXP_ZERO_MEMORY(g_lamexp_folder); LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr); + //Make sure we will pass the check + g_lamexp_entry_check = true; + + //Now initialize the C Runtime library! return WinMainCRTStartup(); } } diff --git a/src/Global.h b/src/Global.h index a742cfbe..68ae2f68 100644 --- a/src/Global.h +++ b/src/Global.h @@ -185,7 +185,7 @@ SIZE_T lamexp_dbg_private_bytes(void); //Memory check #if LAMEXP_DEBUG -#define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) \ +#define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) do \ { \ SIZE_T _privateBytesBefore = lamexp_dbg_private_bytes(); \ RETV = FUNC(__VA_ARGS__); \ @@ -197,12 +197,14 @@ SIZE_T lamexp_dbg_private_bytes(void); OutputDebugStringA(_buffer); \ OutputDebugStringA("----------\n"); \ } \ -} +} \ +while(0) #else -#define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) \ +#define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) do \ { \ RETV = __noop(__VA_ARGS__); \ -} +} \ +while(0) #endif //Check for CPU-compatibility options