6243972bb8
- aggiornamento prototipi.
70 lines
2.4 KiB
C++
70 lines
2.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : EGrDllMain.h Data : 13.02.14 Versione : 1.5b1
|
|
// Contenuto : Prototipi funzioni generali della DLL.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 13.02.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
class ILogger ;
|
|
|
|
//----------------------- Macro per import/export ----------------------------
|
|
#undef EGR_EXPORT
|
|
#if defined( I_AM_EGR) // da definirsi solo nella DLL
|
|
#define EGR_EXPORT __declspec( dllexport)
|
|
#else
|
|
#define EGR_EXPORT __declspec( dllimport)
|
|
#endif
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// E' necessaria l'interfaccia in C per caricare queste funzioni dinamicamente
|
|
extern "C" {
|
|
// restituisce la versione della Dll
|
|
EGR_EXPORT const char* GetEGrVersion( void) ;
|
|
// permette di impostare il logger per la Dll
|
|
EGR_EXPORT void SetEGrLogger( ILogger* pLogger) ;
|
|
// imposta la chiave di protezione
|
|
EGR_EXPORT void SetEGrKey( const std::string& sKey) ;
|
|
// imposta se chiave hardware di rete
|
|
EGR_EXPORT void SetEGrNetHwKey( 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
|
|
TestKeyForEGr( 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) {
|
|
std::string sErr = "Error on Key (GRC/" + ToString( nRet) + ")" ;
|
|
LOG_ERROR( pLogger, sErr.c_str()) ;
|
|
return false ;
|
|
}
|
|
if ( ( nOpt1 & KEYOPT_EGR_BASE) == 0 ||
|
|
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
|
|
nOptExpDays < GetCurrDay()) {
|
|
std::string sErr = "Warning on Key (GRC/OPT)" ;
|
|
LOG_ERROR( pLogger, sErr.c_str()) ;
|
|
return false ;
|
|
}
|
|
return true ;
|
|
}
|