Files
Dario Sassi c92d6e6880 Integratione 2.5j1 :
- aggiornamento per modifica gestione chiave di rete
- ricompilazione con cambio versione.
2023-10-09 13:09:54 +02:00

82 lines
2.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : BtlWriter.cpp Data : 28.07.23 Versione : 2.5g1
// Contenuto : Implementazione funzioni scrittura BTL.
//
//
// Modifiche : 28.07.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Int2API.h"
#include "/EgtDev/Include/SELkLockId.h"
using namespace std ;
//----------------------------------------------------------------------------
static int s_nLockSN = 0 ;
static int s_nLockId = 0 ;
//----------------------------------------------------------------------------
BOOL
__stdcall EgtInitBtlWriter( void)
{
// ammessa solo chiave di tipo hardware
if ( ! SetLockType( KEY_LOCK_TYPE_HW))
return FALSE ;
// non ammesse chiavi di rete
if ( ! SetNetHwKey( false, 0, ""))
return FALSE ;
// verifico esistenza chiave OxySec
int nLockSN = 0 ;
if ( ! GetLockSN( nLockSN))
nLockSN = 0 ;
s_nLockSN = nLockSN ;
bool bOk = ( nLockSN > 0) ;
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtStartBtlWriter( void)
{
// verifico esistenza chiave OxySec inizializzata Egalware
string sLockId ;
if ( ! GetLockId( sLockId))
sLockId = "" ;
// eseguo test
bool bOk = ( ! sLockId.empty()) ;
// recupero Id numerico della chiave
int nLockId = 0 ;
if ( bOk) {
if ( sLockId.find( KEY_LOCK_HW_START) != string::npos) {
sLockId = sLockId.substr( 7, 6) ;
nLockId = stoi( sLockId) ;
s_nLockId = nLockId ;
}
}
return nLockId ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtEndBtlWriter( void)
{
if ( s_nLockSN <= 0)
return FALSE ;
if ( s_nLockId <= 0)
return FALSE ;
return ( s_nLockSN > 0 && s_nLockId > 0) ;
}