fix(mcp_frame): c++_dll 版本校验默认只比大版本,R24.3 单独分组 #5

Merged
gjm merged 2 commits from home-lenovo-legion-r9000/home-ai-dev AGit into main 2026-10-09 23:44:59 +08:00
Showing only changes of commit 3b1cc88262 - Show all commits
+27 -5
View File
@@ -158,13 +158,35 @@ void mcp_ConfigParser::LoadDllTool(const nlohmann::json &toolConfig, const std::
// 基座自身版本取「编译期常量」,它稳定可靠; // 基座自身版本取「编译期常量」,它稳定可靠;
// 不能依赖运行时的 acrxGetApiVersion()——该函数由 rxapi.lib 中的有状态实现提供, // 不能依赖运行时的 acrxGetApiVersion()——该函数由 rxapi.lib 中的有状态实现提供,
// 其返回值会随调用次数变化(首次为正确值,之后被进程内全局污染),无法用于比对。 // 其返回值会随调用次数变化(首次为正确值,之后被进程内全局污染),无法用于比对。
int arx_version = (ARX << 16) | SUB_ARX; // 返回值编码为 (major << 16) | minor:高 16 位=大版本,低 16 位=小版本。
int dll_version = getVerFn(); const int arx_version = (ARX << 16) | SUB_ARX;
mcpLoadLog("arx_version=" + std::to_string(arx_version) + " dll_version=" + std::to_string(dll_version)); const int arx_major = ARX;
const int arx_minor = SUB_ARX;
if (arx_version != dll_version) const int dll_version = getVerFn();
const int dll_major = (dll_version >> 16) & 0xFFFF;
const int dll_minor = dll_version & 0xFFFF;
mcpLoadLog("arx_version=" + std::to_string(arx_version) +
" dll_version=" + std::to_string(dll_version) +
" (arx " + std::to_string(arx_major) + "." + std::to_string(arx_minor) +
" / dll " + std::to_string(dll_major) + "." + std::to_string(dll_minor) + ")");
// 兼容性判定:
// - 同一大版本内通常二进制兼容(如 R24.0/R24.1/R24.2 可共用同一 ARX),故默认只比大版本;
// - 唯一例外是 R24.3:它换了 MSVC toolset,与 R24.0~R24.2 不兼容,需单独分组比较。
bool compatible = false;
if (dll_major == arx_major)
{ {
// 平台大版本不匹配,强行加载必定闪崩,果断踢掉整个模块! if (arx_major == 24)
compatible = ((arx_minor >= 3) == (dll_minor >= 3)); // 24.3+ 与 24.0~24.2 互不兼容
else
compatible = true;
}
if (!compatible)
{
// 平台不兼容,强行加载必定闪崩,果断踢掉整个模块!
FreeLibrary(hMod); FreeLibrary(hMod);
g_loadedDllModules.erase(key); g_loadedDllModules.erase(key);
AfxMessageBox(ver_errMsg); AfxMessageBox(ver_errMsg);