fix(mcp_frame): 补齐版本校验源码(上一提交因文件名大小写漏带)

2fa27b1 只带上了文档,未纳入源文件。此处补上 mcp_ConfigParser.cpp 的实际改动:
- acrxGetApiVersion 返回值按 (major<<16)|minor 拆分大/小版本;
- 默认只比大版本(同一大版本内二进制兼容);
- 例外 R24.3 与 R24.0~R24.2 因 MSVC toolset 不同,按 minor>=3 分组判定。
This commit is contained in:
gjm committed 2026-10-09 23:42:31 +08:00
1 parent 2fa27b1161
commit 3b1cc88262
1 file changed
+27 -5
+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);