From 2c178ca2ed5b35f90477d451a55a88ac972c4868 Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Thu, 27 Apr 2023 11:09:49 +0200 Subject: [PATCH] Improve new MG license mechanism to make it work on Windows --- src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx index 412fb0b5d..530bfc25d 100644 --- a/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx +++ b/src/SMESHUtils/SMESH_MGLicenseKeyGen.cxx @@ -447,12 +447,10 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation return false; bool ok = false; - // get the key from KeyGen - std::string key = SMESHUtils_MGLicenseKeyGen::GetKey(error); - typedef int (*SignFun)(const char* ); + typedef bool (*SignFun)(const std::string& ); // specific function to unlock each product - std::string function = "meshgems_" + product + "_unlock_product"; + std::string function = "UnlockProduct"; SignFun signFun = (SignFun) GetProc( theLibraryHandle, function.c_str() ); if ( !signFun ) @@ -464,14 +462,13 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation { SMESH_TRY; - int status = signFun( key.c_str() ); - // MeshGems status: 0: OK, 1: warning, -1: error - ok = status >= 0; + ok = signFun( product.c_str() ); SMESH_CATCH( SMESH::returnError ); if ( !error.empty() ) { + std::cerr << "error: " << error << std::endl; ok = false; } else if ( !ok ) -- 2.39.2