f37abb39dc
- in Generator aggiunta variabile per versione (EMT.VER) e variabili per punto medio arco (EMT.M1, EMT.M2, EMT.M3).
115 lines
3.3 KiB
C++
115 lines
3.3 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : EMkDllMain.cpp Data : 22.03.15 Versione : 1.6c6
|
|
// Contenuto : Inizializzazione della DLL.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.03.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "DllMain.h"
|
|
#include "/EgtDev/Include/EMkDllMain.h"
|
|
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
|
#include "/EgtDev/Include/EgtTrace.h"
|
|
|
|
//--------------------------- Costanti ----------------------------------------
|
|
#if defined( _WIN64) && defined( _DEBUG)
|
|
const char* EMK_STR = "EgtMachKernelD64.dll ver. " ;
|
|
#elif defined( _WIN64)
|
|
const char* EMK_STR = "EgtMachKernelR64.dll ver. " ;
|
|
#elif defined( _WIN32) && defined( _DEBUG)
|
|
const char* EMK_STR = "EgtMachKernelD32.dll ver. " ;
|
|
#else
|
|
const char* EMK_STR = "EgtMachKernelR32.dll ver. " ;
|
|
#endif
|
|
const int STR_DIM = 40 ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static HINSTANCE s_hModule = NULL ;
|
|
static char s_szEMkNameVer[STR_DIM] ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
extern "C" int 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( "EgtMachKernel.dll Initializing!\n") ;
|
|
}
|
|
else if ( dwReason == DLL_PROCESS_DETACH) {
|
|
s_hModule = NULL ;
|
|
EGT_TRACE( "EgtMachKernel.dll Terminating!\n") ;
|
|
}
|
|
|
|
return 1 ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
const char*
|
|
GetEMkVersion( void)
|
|
{
|
|
std::string sVer ;
|
|
|
|
GetModuleVersion( s_hModule, sVer) ;
|
|
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
|
|
|
|
return s_szEMkNameVer ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
std::string
|
|
GetEMkVer( void)
|
|
{
|
|
std::string sVer ;
|
|
GetModuleVersion( s_hModule, sVer) ;
|
|
return sVer ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static ILogger* s_pLogger = nullptr ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void
|
|
SetEMkLogger( ILogger* pLogger)
|
|
{
|
|
s_pLogger = pLogger ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
ILogger*
|
|
GetEMkLogger( void)
|
|
{
|
|
return s_pLogger ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
static std::string s_sKey ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void
|
|
SetEMkKey( const std::string& sKey)
|
|
{
|
|
s_sKey = sKey ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
const std::string&
|
|
GetEMkKey( void)
|
|
{
|
|
return s_sKey ;
|
|
}
|