EgtGeneral 2.5e3 :
- aggiunta gestione deposito dati chiave di protezione in uso.
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMain.h Data : 25.02.14 Versione : 1.5b2
|
||||
// File : DllMain.h Data : 29.05.23 Versione : 2.5e3
|
||||
// Contenuto : Prototipi funzioni per uso locale della DLL.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 25.02.14 DS Creazione modulo.
|
||||
//
|
||||
// 29.05.23 DS Aggiunte funzioni per chiavi di protezione.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
#include <string>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger* GetEGnLogger( void) ;
|
||||
const std::string& GetEGnKey( void) ;
|
||||
bool GetEGnNetHwKey( void) ;
|
||||
|
||||
+49
-5
@@ -1,22 +1,24 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2013
|
||||
// EgalTech 2013-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EGnDllMain.cpp Data : 20.11.13 Versione : 1.3a1
|
||||
// File : EGnDllMain.cpp Data : 29.05.23 Versione : 2.5e3
|
||||
// Contenuto : Inizializzazione della DLL.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 20.11.13 DS Creazione modulo.
|
||||
// 21.11.13 DS Agg. GetEGnVersion.
|
||||
// 29.05.23 DS Agg. funzioni per chiave.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include <\EgtDev\Include\EGnDllMain.h>
|
||||
#include <\EgtDev\Include\EGnGetModuleVer.h>
|
||||
#include <\EgtDev\Include\EgtTrace.h>
|
||||
#include "/EgtDev/Include/EGnDllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EgtTrace.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -92,3 +94,45 @@ GetEGnLogger( void)
|
||||
{
|
||||
return s_pLogger ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static string s_sKey ;
|
||||
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
||||
static bool s_bNetHwKey = false ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEGnKey( const string& sKey)
|
||||
{
|
||||
s_sKey = sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEGnKeyType( int nType)
|
||||
{
|
||||
s_nKeyType = nType ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEGnNetHwKey( bool bNetHwKey)
|
||||
{
|
||||
s_bNetHwKey = bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const string&
|
||||
GetEGnKey( void)
|
||||
{
|
||||
SetLockType( s_nKeyType) ;
|
||||
return s_sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
GetEGnNetHwKey( void)
|
||||
{
|
||||
SetNetHwKey( s_bNetHwKey) ;
|
||||
return s_bNetHwKey ;
|
||||
}
|
||||
|
||||
Binary file not shown.
+6
-4
@@ -108,7 +108,7 @@
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;C:\EgtDev\Extern\OxySec\Lib\x32\xnodus32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
@@ -131,7 +131,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;C:\EgtDev\Extern\OxySec\Lib\x64\xnodus.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
@@ -164,7 +164,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;C:\EgtDev\Extern\OxySec\Lib\x32\xnodus32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
@@ -198,7 +198,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;Rpcrt4.lib;C:\EgtDev\Extern\OxySec\Lib\x64\xnodus.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
@@ -215,6 +215,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGnDllMain.h" />
|
||||
<ClInclude Include="..\Include\EGnEgtUUID.h" />
|
||||
<ClInclude Include="..\Include\EGnFileUtils.h" />
|
||||
<ClInclude Include="..\Include\EGnGetKeyData.h" />
|
||||
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
|
||||
<ClInclude Include="..\Include\EGnLuaAux.h" />
|
||||
<ClInclude Include="..\Include\EGnLuaMgr.h" />
|
||||
@@ -258,6 +259,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeyKeyData.cpp" />
|
||||
<ClCompile Include="LuaManager.cpp" />
|
||||
<ClCompile Include="Scanner.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<ClInclude Include="..\Include\EGnEgtUUID.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnGetKeyData.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@@ -116,6 +119,9 @@
|
||||
<ClCompile Include="Scanner.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeyKeyData.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtGeneral.rc">
|
||||
|
||||
+1
-1
@@ -84,4 +84,4 @@ bool
|
||||
SetCurrentDirectory( const string& sDir)
|
||||
{
|
||||
return ( SetCurrentDirectoryW( stringtoW( sDir)) != 0) ;
|
||||
}
|
||||
}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GetKeyData.cpp Data : 29.05.23 Versione : 2.5e3
|
||||
// Contenuto : Funzione che restituisce i dati della chiave di protezione.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.05.23 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static int s_nKeyLevRet = - 1;
|
||||
static int s_nKeyLev = 0 ;
|
||||
static int s_nKeyExpDays = 0 ;
|
||||
static int s_nKeyOptRet = - 1;
|
||||
static int s_nKeyOpt1 = 0 ;
|
||||
static int s_nKeyOpt2 = 0 ;
|
||||
static int s_nKeyOptExpDays = 0 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
SetEGnKeyLevel( int nRet, int nKeyLev, int nKeyExpDays)
|
||||
{
|
||||
s_nKeyLevRet = nRet ;
|
||||
s_nKeyLev = nKeyLev ;
|
||||
s_nKeyExpDays = nKeyExpDays ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
GetEGnKeyLevel( int nProd, int nVer, int nLev, int& nKeyLev, int& nKeyExpDays)
|
||||
{
|
||||
// Chiave di rete
|
||||
if ( GetEGnNetHwKey()) {
|
||||
int nCurrDay = GetCurrDay() ;
|
||||
int nMinDay = GetMinDay() ;
|
||||
if ( nCurrDay < nMinDay)
|
||||
return KEY_ERR_WRONG_TIME ;
|
||||
}
|
||||
// chiave Hw locale
|
||||
else {
|
||||
int nMyKeyLev, nMyKeyExpDays ;
|
||||
int nRet = GetKeyLevel( GetEGnKey(), nProd, nVer, nLev, nMyKeyLev, nMyKeyExpDays) ;
|
||||
s_nKeyLevRet = nRet ;
|
||||
s_nKeyLev = nMyKeyLev ;
|
||||
s_nKeyExpDays = nMyKeyExpDays ;
|
||||
}
|
||||
// restituzione dati
|
||||
nKeyLev = s_nKeyLev ;
|
||||
nKeyExpDays = s_nKeyExpDays ;
|
||||
return s_nKeyLevRet ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
SetEGnKeyOptions( int nRet, int nKeyOpt1, int nKeyOpt2, int nKeyOptExpDays)
|
||||
{
|
||||
s_nKeyOptRet = nRet ;
|
||||
s_nKeyOpt1 = nKeyOpt1 ;
|
||||
s_nKeyOpt2 = nKeyOpt2 ;
|
||||
s_nKeyOptExpDays = nKeyOptExpDays ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
GetEGnKeyOptions( int nProd, int nVer, int nLev, unsigned int& nKeyOpt1, unsigned int& nKeyOpt2, int& nKeyOptExpDays)
|
||||
{
|
||||
// Chiave di rete
|
||||
if ( GetEGnNetHwKey()) {
|
||||
int nCurrDay = GetCurrDay() ;
|
||||
int nMinDay = GetMinDay() ;
|
||||
if ( nCurrDay < nMinDay)
|
||||
return KEY_ERR_WRONG_TIME ;
|
||||
}
|
||||
// chiave Hw locale
|
||||
else {
|
||||
unsigned int nMyKeyOpt1, nMyKeyOpt2 ;
|
||||
int nMyKeyOptExpDays ;
|
||||
int nRet = GetKeyOptions( GetEGnKey(), nProd, nVer, nLev, nMyKeyOpt1, nMyKeyOpt2, nMyKeyOptExpDays) ;
|
||||
s_nKeyOptRet = nRet ;
|
||||
s_nKeyOpt1 = nMyKeyOpt1 ;
|
||||
s_nKeyOpt2 = nMyKeyOpt2 ;
|
||||
s_nKeyOptExpDays = nMyKeyOptExpDays ;
|
||||
}
|
||||
// restituzione dati
|
||||
nKeyOpt1 = s_nKeyOpt1 ;
|
||||
nKeyOpt2 = s_nKeyOpt2 ;
|
||||
nKeyOptExpDays = s_nKeyOptExpDays ;
|
||||
return s_nKeyOptRet ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user