EgtLock 2.3h1 :

- eliminati i goto
- versione a 64 bit compilata con LLVM.
This commit is contained in:
DarioS
2021-08-20 14:54:56 +02:00
parent a56da8ea0d
commit 8131fca92c
3 changed files with 36 additions and 43 deletions
+14 -20
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2017
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : DongleId.cpp Data : 30.12.17 Versione : 1.8l4
// File : DongleId.cpp Data : 20.08.21 Versione : 2.3h1
// Contenuto : Funzioni per gestione/calcolo Id chiave OxySec.
//
//
//
// Modifiche : 27.07.15 DS Creazione modulo.
// 30.12.17 DS Passaggio a nuova interfaccia xNodus.
// 20.08.21 DS Eliminati goto.
//
//----------------------------------------------------------------------------
@@ -25,23 +26,19 @@ using namespace std ;
bool
GetDongleId( string& sDongleId)
{
// imposto l'esito
bool bOk = true ;
// cerco la chiave
unsigned char label[XLT_LABEL_SIZE] ;
string sLabel = "EgalTech s.r.l. - CAD/CAM/CIM Software Solutions" ;
strcpy_s( (char*)label, XLT_LABEL_SIZE, sLabel.c_str()) ;
memset( label + sLabel.size(), 0x00, sizeof( label) - sLabel.size()) ;
XND_XLT_ENV env = xnd_xlt_env_create() ;
if ( env == nullptr) {
bOk = false ;
goto end ;
}
if ( env == nullptr)
return false ;
int nStatus = 0 ;
XND_DEVICE_CONTEXT dev_ctx = xnd_xlt_locate( env, label, &nStatus) ;
if ( dev_ctx == nullptr) {
bOk = false ;
goto end ;
xnd_xlt_env_release( env) ;
return false ;
}
// richiamo funzioni di verifica chiave con decifratura RSA 512 di dati generati al volo
// ... DA FARE ...
@@ -82,14 +79,11 @@ GetDongleId( string& sDongleId)
pwd[29] = '\0' ;
pwd[31] = '\0' ;
int nRes = xnd_xlt_read( dev_ctx, pwd, 0, data) ;
if ( nRes != XLT_ERROR_SUCCESS) {
bOk = false ;
goto end ;
}
sDongleId = (char*) data ;
end :
xnd_xlt_devctx_release( dev_ctx) ;
xnd_xlt_env_release( env) ;
return bOk ;
bool bOk = ( nRes == XLT_ERROR_SUCCESS) ;
if ( bOk)
sDongleId = (char*) data ;
// rilascio
xnd_xlt_devctx_release( dev_ctx) ;
xnd_xlt_env_release( env) ;
return bOk ;
}
+15 -21
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
// EgalTech 2018-2021
//----------------------------------------------------------------------------
// File : DongleSN.cpp Data : 13.05.18 Versione : 2.1e1
// File : DongleSN.cpp Data : 20.08.21 Versione : 2.3h1
// Contenuto : Funzioni per lettura SN chiave OxySec.
//
//
//
// Modifiche : 13.05.18 DS Creazione modulo.
//
// 20.08.21 DS Eliminati goto.
//
//----------------------------------------------------------------------------
@@ -25,23 +25,19 @@ using namespace std ;
bool
GetDongleSN( int& nDongleSN)
{
// imposto l'esito
bool bOk = true ;
// cerco la chiave
unsigned char label[XLT_LABEL_SIZE] ;
string sLabel = "EgalTech s.r.l. - CAD/CAM/CIM Software Solutions" ;
strcpy_s( (char*)label, XLT_LABEL_SIZE, sLabel.c_str()) ;
memset( label + sLabel.size(), 0x00, sizeof( label) - sLabel.size()) ;
XND_XLT_ENV env = xnd_xlt_env_create() ;
if ( env == nullptr) {
bOk = false ;
goto end ;
}
if ( env == nullptr)
return false ;
int nStatus = 0 ;
XND_DEVICE_CONTEXT dev_ctx = xnd_xlt_locate( env, label, &nStatus) ;
if ( dev_ctx == nullptr) {
bOk = false ;
goto end ;
xnd_xlt_env_release( env) ;
return false ;
}
// eseguo la lettura del Serial Number
unsigned int nVer ;
@@ -50,15 +46,13 @@ GetDongleSN( int& nDongleSN)
unsigned int nSerial ;
unsigned char szLabelPrint[XLT_LABEL_SIZE + 1] ;
int nRes = xnd_xlt_getinfo( dev_ctx, &nVer, &nModel, &nFlags, &nSerial, szLabelPrint) ;
if ( nRes != XLT_ERROR_SUCCESS) {
bOk = false ;
goto end ;
bool bOk = ( nRes == XLT_ERROR_SUCCESS) ;
if ( bOk) {
szLabelPrint[XLT_LABEL_SIZE] = '\0' ;
nDongleSN = int( nSerial) ;
}
szLabelPrint[XLT_LABEL_SIZE] = '\0' ;
nDongleSN = int( nSerial) ;
end :
xnd_xlt_devctx_release( dev_ctx) ;
xnd_xlt_env_release( env) ;
return bOk ;
// rilascio
xnd_xlt_devctx_release( dev_ctx) ;
xnd_xlt_env_release( env) ;
return bOk ;
}
+7 -2
View File
@@ -35,7 +35,7 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
@@ -49,7 +49,7 @@
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -100,6 +100,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -119,6 +120,8 @@ copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<MinimalRebuild>false</MinimalRebuild>
<LanguageStandard>stdcpp17</LanguageStandard>
<SuppressStartupBanner>false</SuppressStartupBanner>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -166,6 +169,8 @@ copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<OmitFramePointers>false</OmitFramePointers>
<LanguageStandard>stdcpp17</LanguageStandard>
<SuppressStartupBanner>false</SuppressStartupBanner>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>