From ffd9f0c1bd6ab8fd800f18bb06c46efd16854682 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 15 Sep 2014 07:04:25 +0000 Subject: [PATCH] EgtGeomKernel 1.5i3 : - aggiunto controllo chiave di protezione. --- DllMain.h | 2 ++ EGkDllMain.cpp | 17 +++++++++++++++++ EgtGeomKernel.rc | Bin 11710 -> 11710 bytes GeomDB.cpp | 9 +++++++++ stdafx.h | 1 + 5 files changed, 29 insertions(+) diff --git a/DllMain.h b/DllMain.h index a694cb1..e635221 100644 --- a/DllMain.h +++ b/DllMain.h @@ -15,6 +15,8 @@ #include "/EgtDev/Include/EgtILogger.h" +#include //----------------------------------------------------------------------------- ILogger* GetEGkLogger( void) ; +const std::string& GetEGkKey( void) ; diff --git a/EGkDllMain.cpp b/EGkDllMain.cpp index a8934be..764ec7b 100644 --- a/EGkDllMain.cpp +++ b/EGkDllMain.cpp @@ -91,6 +91,23 @@ GetEGkLogger( void) return s_pLogger ; } +//----------------------------------------------------------------------------- +static std::string s_sKey ; + +//----------------------------------------------------------------------------- +void +SetEGkKey( const std::string& sKey) +{ + s_sKey = sKey ; +} + +//----------------------------------------------------------------------------- +const std::string& +GetEGkKey( void) +{ + return s_sKey ; +} + //----------------------------------------------------------------------------- void InitFontManager( const std::string& sNfeFontDir, const std::string& sDefaultFont) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 4fb9aa1082d3b46b1263c1631ce479cd3e9753b0..e183462619df40c149f567b957004c8aee7745bd 100644 GIT binary patch delta 81 zcmdlNy)SyhH#SD&&FAG5nSs using namespace std ; @@ -31,6 +32,14 @@ using namespace std ; IGeomDB* CreateGeomDB( void) { + // verifico la chiave + int nRet = VerifyKey( GetEGkKey(), 1231, 15, 1) ; + if ( nRet != KEY_OK) { + string sErr = "Error on Key (" + ToString( nRet) + ")" ; + LOG_ERROR( GetEGkLogger(), sErr.c_str()) ; + return nullptr ; + } + // creo il GeomDB return static_cast ( new(nothrow) GeomDB) ; } diff --git a/stdafx.h b/stdafx.h index 8712f37..829862a 100644 --- a/stdafx.h +++ b/stdafx.h @@ -31,3 +31,4 @@ #pragma comment(lib, EGTEXTDIR "zlib/lib/zlib" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib") +#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")