//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : EGrDllMain.cpp Data : 13.02.14 Versione : 1.5b1 // Contenuto : Inizializzazione della DLL. // // // // Modifiche : 13.02.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "DllMain.h" #include "/EgtDev/Include/EGrDllMain.h" #include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EgtTrace.h" //--------------------------- Costanti ---------------------------------------- #if defined( _WIN64) && defined( _DEBUG) const char* EGR_STR = "EgtGraphicsD64.dll ver. " ; #elif defined( _WIN64) const char* EGR_STR = "EgtGraphicsR64.dll ver. " ; #elif defined( _WIN32) && defined( _DEBUG) const char* EGR_STR = "EgtGraphicsD32.dll ver. " ; #else const char* EGR_STR = "EgtGraphicsR32.dll ver. " ; #endif const int STR_DIM = 40 ; //----------------------------------------------------------------------------- static HINSTANCE s_hModule = NULL ; static char s_szEGrNameVer[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( "EgtGraphics.dll Initializing!\n") ; } else if ( dwReason == DLL_PROCESS_DETACH) { s_hModule = NULL ; EGT_TRACE( "EgtGraphics.dll Terminating!\n") ; } return 1 ; } //----------------------------------------------------------------------------- const char* GetEGrVersion( void) { std::string sVer ; GetModuleVersion( s_hModule, sVer) ; sprintf_s( s_szEGrNameVer, STR_DIM, "%s%s", EGR_STR, sVer.c_str()) ; return s_szEGrNameVer ; } //----------------------------------------------------------------------------- static ILogger* s_pLogger = nullptr ; //----------------------------------------------------------------------------- void SetEGrLogger( ILogger* pLogger) { s_pLogger = pLogger ; } //----------------------------------------------------------------------------- ILogger* GetEGrLogger( void) { return s_pLogger ; } //----------------------------------------------------------------------------- static std::string s_sKey ; static bool s_bNetHwKey = false ; //----------------------------------------------------------------------------- void SetEGrKey( const std::string& sKey) { s_sKey = sKey ; } //----------------------------------------------------------------------------- void SetEGrNetHwKey( bool bNetHwKey) { s_bNetHwKey = bNetHwKey ; } //----------------------------------------------------------------------------- const std::string& GetEGrKey( void) { return s_sKey ; } //----------------------------------------------------------------------------- bool GetEGrNetHwKey( void) { return s_bNetHwKey ; }