//---------------------------------------------------------------------------- // 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 = 50 ; //----------------------------------------------------------------------------- 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) { // Controllo commentato per problemi con VB.NET //#if defined( NDEBUG) // BOOL IsDbgPresent = FALSE ; // CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ; // if ( IsDbgPresent) // return 0 ; //#endif // se debug, imposto stampe memory leaks all'uscita #if defined ( _DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) ; #endif // eseguo 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* __stdcall 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 ; }