feat: add vcruntime wrapper

This commit is contained in:
2025-11-18 19:26:27 +01:00
parent 21991a42ae
commit 48a274ac83

39
src/impl/wrapper.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include <Windows.h>
#include <cstdint>
extern "C"
{
__declspec(dllexport) void __NLG_Dispatch2()
{
// nullsub
}
__declspec(dllexport) void __NLG_Return2()
{
// nullsub
}
__declspec(dllexport) std::int64_t __CxxFrameHandler4(std::int64_t a1, std::int64_t a2, std::int32_t a3, std::int64_t a4)
{
using CxxFrameHandler4_t = decltype(&__CxxFrameHandler4);
static CxxFrameHandler4_t real_CxxFrameHandler4 = nullptr;
if (!real_CxxFrameHandler4)
{
HMODULE hModule = LoadLibraryA("vcruntime140_1.orig.dll");
if (hModule)
{
real_CxxFrameHandler4 = reinterpret_cast<CxxFrameHandler4_t>(
GetProcAddress(hModule, "__CxxFrameHandler4")
);
}
}
if (real_CxxFrameHandler4)
{
return real_CxxFrameHandler4(a1, a2, a3, a4);
}
return 0;
}
}