//---------------------------------------------------------------------------- // EgalTech 2019-2019 //---------------------------------------------------------------------------- // File : ENsDllMain.cpp Data : 28.11.19 Versione : 2.1k6 // Contenuto : Inizializzazione della DLL. // // // // Modifiche : 28.11.19 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "DllMain.h" #include "/EgtDev/Include/ENsDllMain.h" #include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EgtTrace.h" //--------------------------- Costanti ---------------------------------------- #if defined( _WIN64) && defined( _DEBUG) const char* ENS_STR = "EgtNestingD64.dll ver. " ; #elif defined( _WIN64) const char* ENS_STR = "EgtNestingR64.dll ver. " ; #elif defined( _WIN32) && defined( _DEBUG) const char* ENS_STR = "EgtNestingD32.dll ver. " ; #else const char* ENS_STR = "EgtNestingR32.dll ver. " ; #endif const int STR_DIM = 40 ; //----------------------------------------------------------------------------- static HINSTANCE s_hModule = NULL ; static char s_szENsNameVer[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 s_hModule = hModule ; EGT_TRACE( "EgtNesting.dll Initializing!\n") ; } else if ( dwReason == DLL_PROCESS_DETACH) { s_hModule = NULL ; EGT_TRACE( "EgtNesting.dll Terminating!\n") ; } return 1 ; } //----------------------------------------------------------------------------- const char* GetENsVersion( void) { std::string sVer ; GetModuleVersion( s_hModule, sVer) ; sprintf_s( s_szENsNameVer, STR_DIM, "%s%s", ENS_STR, sVer.c_str()) ; return s_szENsNameVer ; } //----------------------------------------------------------------------------- static ILogger* s_pLogger = nullptr ; //----------------------------------------------------------------------------- void SetENsLogger( ILogger* pLogger) { s_pLogger = pLogger ; } //----------------------------------------------------------------------------- ILogger* GetENsLogger( void) { return s_pLogger ; } //----------------------------------------------------------------------------- static std::string s_sKey ; //----------------------------------------------------------------------------- void SetENsKey( const std::string& sKey) { s_sKey = sKey ; } //----------------------------------------------------------------------------- const std::string& GetENsKey( void) { return s_sKey ; } //----------------------------------------------------------------------------- static std::string s_sKey2 ; //----------------------------------------------------------------------------- void SetENsKey2( const std::string& sKey2) { s_sKey2 = sKey2 ; } //----------------------------------------------------------------------------- const std::string& GetENsKey2( void) { return s_sKey2 ; }