Files
Include/EE3DllMain.h
Dario Sassi 841dddf047 Include :
- sistemazione prototipi per passaggio import/export 3dm da Exchange a Exch3dm.
2023-11-14 19:11:35 +01:00

74 lines
2.5 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : EE3DllMain.h Data : 14.11.23 Versione : 2.5k2
// Contenuto : Prototipi funzioni generali della DLL.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
//----------------------- Macro per import/export ----------------------------
#undef EE3_EXPORT
#if defined( I_AM_EE3) // da definirsi solo nella DLL
#define EE3_EXPORT __declspec( dllexport)
#else
#define EE3_EXPORT __declspec( dllimport)
#endif
//-----------------------------------------------------------------------------
// E' necessaria l'interfaccia in C per caricare queste funzioni dinamicamente
extern "C" {
// restituisce la versione della Dll
EE3_EXPORT const char* GetEE3Version( void) ;
// permette di impostare il logger per la Dll
EE3_EXPORT void SetEE3Logger( ILogger* pLogger) ;
// imposta la chiave di protezione
EE3_EXPORT void SetEE3Key( const std::string& sKey) ;
// imposta se chiave hardware di rete
EE3_EXPORT void SetEE3NetHwKey( bool bNetHwKey) ;
}
//-----------------------------------------------------------------------------
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtILogger.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
//-----------------------------------------------------------------------------
// Test della chiave per caricare la DLL
inline bool
TestKeyForEE3( const std::string& sKey, int nKeyOpt, ILogger* pLogger)
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( sKey, KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK && ! EqualNoCase( sKey, "EE3Base")) {
if ( nRet != KEY_OK) {
std::string sErr = "Error on Key (EE3/" + ToString( nRet) + ")" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
return false ;
}
if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 ||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
nOptExpDays < GetCurrDay()) {
std::string sErr = "Warning on Key (EE3/OPT)" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
return false ;
}
}
return true ;
}