EgtExecutor :

- modifiche per spostamento import/export da dll Exchange a dll Exch3dm.
This commit is contained in:
Dario Sassi
2023-11-14 18:58:01 +01:00
parent e2c401cc4a
commit 15633ec6d7
8 changed files with 239 additions and 43 deletions
+181
View File
@@ -0,0 +1,181 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni di gestione della libreria opzionale EgtExch3dme.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EE3DllMain.h"
#define NOMINMAX
#include <windows.h>
using namespace std ;
//-----------------------------------------------------------------------------
// Nome della libreria
#if defined( _WIN64) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD64.dll" ;
#elif defined( _WIN64)
static const wchar_t* EE3_NAME = L"EgtExch3dmR64.dll" ;
#elif defined( _WIN32) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD32.dll" ;
#else
static const wchar_t* EE3_NAME = L"EgtExch3dmR32.dll" ;
#endif
// Nome delle funzioni caricate
static const char* EE3_SETEE3LOGGER = "SetEE3Logger" ;
static const char* EE3_GETEE3VERSION = "GetEE3Version" ;
static const char* EE3_SETEE3KEY = "SetEE3Key" ;
static const char* EE3_SETEE3NETHWKEY = "SetEE3NetHwKey" ;
static const char* EE3_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EE3_CREATEEXPORT3DM = "CreateExport3dm" ;
//-----------------------------------------------------------------------------
HMODULE s_hEE3 = nullptr ;
//-----------------------------------------------------------------------------
bool
LoadExch3dmDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
{
// verifico la chiave
if ( ! TestKeyForEE3( sKey, 0, pLogger)) {
FreeExch3dmDll() ;
return false ;
}
// se già caricata
if ( s_hEE3 != nullptr)
return true ;
// carico la libreria EgtExch3dm
s_hEE3 = LoadLibrary( EE3_NAME) ;
if ( s_hEE3 == nullptr)
return false ;
// imposto logger
MySetEE3Logger( pLogger) ;
// imposto i codici della chiave
MySetEE3Key( sKey) ;
// imposto eventuale chiave di rete
MySetEE3NetHwKey( bNetHwKey) ;
return true ;
}
//-----------------------------------------------------------------------------
bool
FreeExch3dmDll( void)
{
// se non è già caricata
if ( s_hEE3 == nullptr)
return true ;
// libero la libreria EgtExch3dm
FreeLibrary( s_hEE3) ;
s_hEE3 = nullptr ;
return true ;
}
//-----------------------------------------------------------------------------
bool
IsLoadedExch3dmDll( void)
{
return ( s_hEE3 != nullptr) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Logger( ILogger* pLogger)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il logger
typedef void (* PF_SetEE3Logger) ( ILogger* pLogger) ;
PF_SetEE3Logger pFun = (PF_SetEE3Logger)GetProcAddress( s_hEE3, EE3_SETEE3LOGGER) ;
if ( pFun == nullptr)
return ;
pFun( pLogger) ;
}
//-----------------------------------------------------------------------------
const char*
MyGetEE3Version( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return "" ;
// recupero funzione che restituisce la versione della libreria
typedef const char* (* PF_GetEE3Version) ( void) ;
PF_GetEE3Version pFun = (PF_GetEE3Version)GetProcAddress( s_hEE3, EE3_GETEE3VERSION) ;
if ( pFun == nullptr)
return "" ;
return pFun() ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Key( const string& sKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta i codici di protezione
typedef void (* PF_SetEE3Key) ( const string& sKey) ;
PF_SetEE3Key pFun = (PF_SetEE3Key)GetProcAddress( s_hEE3, EE3_SETEE3KEY) ;
if ( pFun == nullptr)
return ;
pFun( sKey) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3NetHwKey( bool bNetHwKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il flag per chiave di rete
typedef void (* PF_SetEE3NetHwKey) ( bool bNetHwKey) ;
PF_SetEE3NetHwKey pFun = (PF_SetEE3NetHwKey)GetProcAddress( s_hEE3, EE3_SETEE3NETHWKEY) ;
if ( pFun == nullptr)
return ;
pFun( bNetHwKey) ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEE3, EE3_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEE3, EE3_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
+31
View File
@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.h Data : 14.11.23 Versione : 2.5k3
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
class IImport3dm ;
class IExport3dm ;
//----------------------------------------------------------------------------
bool LoadExch3dmDll( ILogger* pLogger, const std::string& sKey, bool bNetHwKey) ;
bool FreeExch3dmDll( void) ;
bool IsLoadedExch3dmDll( void) ;
void MySetEE3Logger( ILogger* pLogger) ;
void MySetEE3Key( const std::string& sKey) ;
void MySetEE3NetHwKey( bool bNetHwKey) ;
const char* MyGetEE3Version( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExport3dm* MyCreateExport3dm( void) ;
+2 -34
View File
@@ -51,11 +51,9 @@ static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
static const char* EEX_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORT3DM = "CreateExport3dm" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
@@ -74,7 +72,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
FreeExchangeDll() ;
return false ;
}
// se gi caricata
// se già caricata
if ( s_hEEx != nullptr)
return true ;
// carico la libreria EgtExchange
@@ -94,7 +92,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
bool
FreeExchangeDll( void)
{
// se non gi caricata
// se non è già caricata
if ( s_hEEx == nullptr)
return true ;
// libero la libreria EgtExchange
@@ -320,21 +318,6 @@ MyCreateImport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEEx, EEX_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportDxf*
MyCreateExportDxf( void)
@@ -380,21 +363,6 @@ MyCreateExport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportSvg*
MyCreateExportSvg( void)
-4
View File
@@ -25,11 +25,9 @@ class IImportDxf ;
class IImportPnt ;
class IImportStl ;
class IImport3MF ;
class IImport3dm ;
class IExportDxf ;
class IExportStl ;
class IExport3MF ;
class IExport3dm ;
class IExportThreeJS ;
class IExportSvg ;
class IExcExecutor ;
@@ -52,11 +50,9 @@ IImportDxf* MyCreateImportDxf( void) ;
IImportPnt* MyCreateImportPnt( void) ;
IImportStl* MyCreateImportStl( void) ;
IImport3MF* MyCreateImport3MF( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
IExport3dm* MyCreateExport3dm( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
+3 -2
View File
@@ -17,6 +17,7 @@
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
@@ -28,13 +29,13 @@
#include "/EgtDev/Include/EExImportPnt.h"
#include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExImportBtlx.h"
#include "/EgtDev/Include/EExImport3dm.h"
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EE3Import3dm.h"
#include "/EgtDev/Include/EE3Export3dm.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
+14 -3
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1
// File : EXE_General.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni generali per EXE.
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting.
// 28.11.19 DS Aggiunto caricamento opzionale di Nesting.
// 14.11.23 DS Aggiunto caricamento opzionale di Exchange 3dm.
//
//----------------------------------------------------------------------------
@@ -17,6 +18,7 @@
#include "LUA_Base.h"
#include "DllGraphics.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "DllMachKernel.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EXeExecutor.h"
@@ -112,6 +114,10 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEExVersion())
// carico libreria exchange 3dm opzionale
if ( LoadExch3dmDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEE3Version())
// carico libreria di lavorazione opzionale
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEMkVersion())
@@ -168,6 +174,7 @@ ExeExit( void)
// libero le librerie opzionali
FreeMachKernelDll() ;
FreeExchangeDll() ;
FreeExch3dmDll() ;
FreeGraphicsDll() ;
// cancello riferimenti a funzioni installate
@@ -438,6 +445,10 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
sVer += szNewLine ;
sVer += MyGetEExVersion() ;
}
if ( IsLoadedExch3dmDll()) {
sVer += szNewLine ;
sVer += MyGetEE3Version() ;
}
if ( IsLoadedMachKernelDll()) {
sVer += szNewLine ;
sVer += MyGetEMkVersion() ;
+2
View File
@@ -228,6 +228,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="DllExch3dm.h" />
<ClInclude Include="DllMain.h" />
<ClInclude Include="DllNesting.h" />
<ClInclude Include="EXE.h" />
@@ -248,6 +249,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_BeamMgr.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" />
+6
View File
@@ -108,6 +108,9 @@
<ClInclude Include="DllNesting.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="DllExch3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LUA_Exchange.cpp">
@@ -389,6 +392,9 @@
<ClCompile Include="EXE_Mutex.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="DllExch3dm.cpp">
<Filter>File di origine\Optional Dll</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">