2042d2b4ee
- aggiustate maiuscole/minuscole per inclusione file.
95 lines
2.8 KiB
C++
95 lines
2.8 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// File : EGnDllMain.cpp Data : 20.11.13 Versione : 1.3a1
|
|
// Contenuto : Inizializzazione della DLL.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 20.11.13 DS Creazione modulo.
|
|
// 21.11.13 DS Agg. GetEGnVersion.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "DllMain.h"
|
|
#include <\EgtDev\Include\EGnDllMain.h>
|
|
#include <\EgtDev\Include\EGnGetModuleVer.h>
|
|
#include <\EgtDev\Include\EgtTrace.h>
|
|
|
|
using namespace std ;
|
|
|
|
//--------------------------- Costanti ----------------------------------------
|
|
#if defined( _WIN64)
|
|
#if defined( _DEBUG)
|
|
const char* EGN_STR = "EgtGeneralD64.dll ver. " ;
|
|
#else
|
|
const char* EGN_STR = "EgtGeneralR64.dll ver. " ;
|
|
#endif
|
|
#elif defined( _WIN32)
|
|
#if defined( _DEBUG)
|
|
const char* EGN_STR = "EgtGeneralD32.dll ver. " ;
|
|
#else
|
|
const char* EGN_STR = "EgtGeneralR32.dll ver. " ;
|
|
#endif
|
|
#endif
|
|
const int STR_DIM = 40 ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static HINSTANCE s_hModule = nullptr ;
|
|
static char s_szEGnNameVer[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( "EgtGeneral.dll Initializing!\n") ;
|
|
}
|
|
else if ( dwReason == DLL_PROCESS_DETACH) {
|
|
s_hModule = nullptr ;
|
|
EGT_TRACE( "EgtGeneral.dll Terminating!\n") ;
|
|
}
|
|
|
|
return 1 ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
const char*
|
|
GetEGnVersion( void)
|
|
{
|
|
string sVer ;
|
|
|
|
GetModuleVersion( s_hModule, sVer) ;
|
|
sprintf_s( s_szEGnNameVer, STR_DIM, "%s%s", EGN_STR, sVer.c_str()) ;
|
|
|
|
return s_szEGnNameVer ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static ILogger* s_pLogger = nullptr ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void
|
|
SetEGnLogger( ILogger* pLogger)
|
|
{
|
|
s_pLogger = pLogger ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
ILogger*
|
|
GetEGnLogger( void)
|
|
{
|
|
return s_pLogger ;
|
|
}
|