From 48a274ac835c0b29fa7b1ac7428004d878ae266f Mon Sep 17 00:00:00 2001 From: slayercio Date: Tue, 18 Nov 2025 19:26:27 +0100 Subject: [PATCH] feat: add vcruntime wrapper --- src/impl/wrapper.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/impl/wrapper.cpp diff --git a/src/impl/wrapper.cpp b/src/impl/wrapper.cpp new file mode 100644 index 0000000..f91792e --- /dev/null +++ b/src/impl/wrapper.cpp @@ -0,0 +1,39 @@ +#include +#include + +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( + GetProcAddress(hModule, "__CxxFrameHandler4") + ); + } + } + + if (real_CxxFrameHandler4) + { + return real_CxxFrameHandler4(a1, a2, a3, a4); + } + + return 0; + } +} \ No newline at end of file