6243972bb8
- aggiornamento prototipi.
72 lines
2.5 KiB
C++
72 lines
2.5 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : EMkDllMain.h Data : 22.03.15 Versione : 1.6c6
|
|
// Contenuto : Prototipi funzioni generali della DLL.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.03.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
class ILogger ;
|
|
|
|
//----------------------- Macro per import/export ----------------------------
|
|
#undef EMK_EXPORT
|
|
#if defined( I_AM_EMK) // da definirsi solo nella DLL
|
|
#define EMK_EXPORT __declspec( dllexport)
|
|
#else
|
|
#define EMK_EXPORT __declspec( dllimport)
|
|
#endif
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// E' necessaria l'interfaccia in C per caricare queste funzioni dinamicamente
|
|
extern "C" {
|
|
// restituisce la versione della Dll
|
|
EMK_EXPORT const char* GetEMkVersion( void) ;
|
|
// permette di impostare il logger per la Dll
|
|
EMK_EXPORT void SetEMkLogger( ILogger* pLogger) ;
|
|
// imposta la chiave di protezione
|
|
EMK_EXPORT void SetEMkKey( const std::string& sKey) ;
|
|
// imposta se chiave hardware di rete
|
|
EMK_EXPORT void SetEMkNetHwKey( 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
|
|
TestKeyForEMk( 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 (MKC/" + ToString( nRet) + ")" ;
|
|
LOG_ERROR( pLogger, sErr.c_str()) ;
|
|
return false ;
|
|
}
|
|
if ( ( nOpt1 & KEYOPT_EMK_BASE) == 0 ||
|
|
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
|
|
nOptExpDays < GetCurrDay()) {
|
|
std::string sErr = "Warning on Key (MKC/OPT)" ;
|
|
LOG_ERROR( pLogger, sErr.c_str()) ;
|
|
return false ;
|
|
}
|
|
return true ;
|
|
}
|