Files
EgtExchange/EExDllMain.cpp
T
Dario Sassi a54c08eb01 EgtExchange 1.6c2 :
- aggiunta gestione codici di protezione (con opzioni).
2015-03-30 06:50:40 +00:00

106 lines
3.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EExDllMain.cpp Data : 04.04.14 Versione : 1.5d1
// Contenuto : Inizializzazione della DLL.
//
//
//
// Modifiche : 04.04.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
#if defined( _WIN64) && defined( _DEBUG)
const char* EEX_STR = "EgtExchangeD64.dll ver. " ;
#elif defined( _WIN64)
const char* EEX_STR = "EgtExchangeR64.dll ver. " ;
#elif defined( _WIN32) && defined( _DEBUG)
const char* EEX_STR = "EgtExchangeD32.dll ver. " ;
#else
const char* EEX_STR = "EgtExchangeR32.dll ver. " ;
#endif
const int STR_DIM = 40 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = NULL ;
static char s_szEExNameVer[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( "EgtExchange.dll Initializing!\n") ;
}
else if ( dwReason == DLL_PROCESS_DETACH) {
s_hModule = NULL ;
EGT_TRACE( "EgtExchange.dll Terminating!\n") ;
}
return 1 ;
}
//-----------------------------------------------------------------------------
const char*
GetEExVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEExNameVer, STR_DIM, "%s%s", EEX_STR, sVer.c_str()) ;
return s_szEExNameVer ;
}
//-----------------------------------------------------------------------------
static ILogger* s_pLogger = nullptr ;
//-----------------------------------------------------------------------------
void
SetEExLogger( ILogger* pLogger)
{
s_pLogger = pLogger ;
}
//-----------------------------------------------------------------------------
ILogger*
GetEExLogger( void)
{
return s_pLogger ;
}
//-----------------------------------------------------------------------------
static std::string s_sKey ;
//-----------------------------------------------------------------------------
void
SetEExKey( const std::string& sKey)
{
s_sKey = sKey ;
}
//-----------------------------------------------------------------------------
const std::string&
GetEExKey( void)
{
return s_sKey ;
}