Files
EgtExecutor/EXeDllMain.cpp
Dario Sassi 4d7c99699f EgtExecutor 1.9h1 :
- aggiunte funzioni Lua per calcolo Zeri di Polinomi (reali e complessi)
- controllo versione da chiave portato a 19.
2018-08-08 11:07:39 +00:00

88 lines
2.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : EXcDllMain.cpp Data : 04.05.15 Versione : 1.6e11
// Contenuto : Inizializzazione della DLL.
//
//
//
// Modifiche : 04.05.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "/EgtDev/Include/EXeDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
#if defined( _WIN64)
#if defined( _DEBUG)
const char* EXE_STR = "EgtExecutorD64.dll ver. " ;
#else
const char* EXE_STR = "EgtExecutorR64.dll ver. " ;
#endif
#elif defined( _WIN32)
#if defined( _DEBUG)
const char* EXE_STR = "EgtExecutorD32.dll ver. " ;
#else
const char* EXE_STR = "EgtExecutorR32.dll ver. " ;
#endif
#endif
const int STR_DIM = 50 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = nullptr ;
static char s_szEXeNameVer[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
// se debug, imposto stampe memory leaks all'uscita
#if defined ( _DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) ;
#endif
// eseguo
s_hModule = hModule ;
EGT_TRACE( "EgtExecutor.dll Initializing!\n") ;
}
else if ( dwReason == DLL_PROCESS_DETACH) {
s_hModule = nullptr ;
EGT_TRACE( "EgtExecutor.dll Terminating!\n") ;
}
return 1 ;
}
//-----------------------------------------------------------------------------
const char*
GetEXeVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
return s_szEXeNameVer ;
}
//-----------------------------------------------------------------------------
HINSTANCE
GetModuleIstance( void)
{
return s_hModule ;
}