6243972bb8
- aggiornamento prototipi.
74 lines
2.6 KiB
C++
74 lines
2.6 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : EExDllMain.h Data : 04.04.14 Versione : 1.5d1
|
|
// Contenuto : Prototipi funzioni generali della DLL.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 04.04.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
class ILogger ;
|
|
|
|
//----------------------- Macro per import/export ----------------------------
|
|
#undef EEX_EXPORT
|
|
#if defined( I_AM_EEX) // da definirsi solo nella DLL
|
|
#define EEX_EXPORT __declspec( dllexport)
|
|
#else
|
|
#define EEX_EXPORT __declspec( dllimport)
|
|
#endif
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// E' necessaria l'interfaccia in C per caricare queste funzioni dinamicamente
|
|
extern "C" {
|
|
// restituisce la versione della Dll
|
|
EEX_EXPORT const char* GetEExVersion( void) ;
|
|
// permette di impostare il logger per la Dll
|
|
EEX_EXPORT void SetEExLogger( ILogger* pLogger) ;
|
|
// imposta la chiave di protezione
|
|
EEX_EXPORT void SetEExKey( const std::string& sKey) ;
|
|
// imposta se chiave hardware di rete
|
|
EEX_EXPORT void SetEExNetHwKey( 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
|
|
TestKeyForEEx( 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, "EExBase")) {
|
|
if ( nRet != KEY_OK) {
|
|
std::string sErr = "Error on Key (EXC/" + 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 (EXC/OPT)" ;
|
|
LOG_ERROR( pLogger, sErr.c_str()) ;
|
|
return false ;
|
|
}
|
|
}
|
|
return true ;
|
|
}
|