Files
EgtInterface/EInDllMain.cpp
T
Dario Sassi 2fce436ae7 EgtInterface :
- aggiunti controlli contro debug in versioni release
- modifiche configurazione per copia DLL debug.
2014-09-10 13:11:36 +00:00

75 lines
2.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EInDllMain.cpp Data : 26.08.14 Versione : 1.5h1
// Contenuto : Inizializzazione della DLL.
//
//
//
// Modifiche : 26.08.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "/EgtDev/Include/EInDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
#if defined( _WIN64)
#if defined( _DEBUG)
const char* EIN_STR = "EgtInterfaceD64.dll ver. " ;
#else
const char* EIN_STR = "EgtInterfaceR64.dll ver. " ;
#endif
#elif defined( _WIN32)
#if defined( _DEBUG)
const char* EIN_STR = "EgtInterfaceD32.dll ver. " ;
#else
const char* EIN_STR = "EgtInterfaceR32.dll ver. " ;
#endif
#endif
const int STR_DIM = 40 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = NULL ;
static char s_szEInNameVer[STR_DIM] ;
//-----------------------------------------------------------------------------
BOOL APIENTRY
DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
if ( dwReason == DLL_PROCESS_ATTACH) {
#if defined( NDEBUG)
BOOL IsDbgPresent = FALSE ;
CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ;
if ( IsDbgPresent)
return 0 ;
#endif
s_hModule = hModule ;
EGT_TRACE( "EgtInterface.dll Initializing!\n") ;
}
else if ( dwReason == DLL_PROCESS_DETACH) {
s_hModule = NULL ;
EGT_TRACE( "EgtInterface.dll Terminating!\n") ;
}
return 1 ;
}
//-----------------------------------------------------------------------------
const char*
GetEInVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEInNameVer, STR_DIM, "%s%s", EIN_STR, sVer.c_str()) ;
return s_szEInNameVer ;
}