EgtMachKernel 1.6c6 :
- primo commit.
This commit is contained in:
+109
@@ -0,0 +1,109 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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)
|
||||
#if defined( _DEBUG)
|
||||
const char* EMK_STR = "EgtMachKernelD64.dll ver. " ;
|
||||
#else
|
||||
const char* EMK_STR = "EgtMachKernelR64.dll ver. " ;
|
||||
#endif
|
||||
#elif defined( _WIN32)
|
||||
#if defined( _DEBUG)
|
||||
const char* EMK_STR = "EgtMachKernelD32.dll ver. " ;
|
||||
#else
|
||||
const char* EMK_STR = "EgtMachKernelR32.dll ver. " ;
|
||||
#endif
|
||||
#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 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
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 ;
|
||||
}
|
||||
Reference in New Issue
Block a user