From 0ed6a6e44cbacc67d11cb7b749485c2a8649ccea Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Fri, 27 Oct 2023 00:46:46 +0800 Subject: [PATCH] CoCreateInstance fix --- .github/workflows/funding.yml | 4 ++++ source/dllmain.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/funding.yml diff --git a/.github/workflows/funding.yml b/.github/workflows/funding.yml new file mode 100644 index 0000000..3827534 --- /dev/null +++ b/.github/workflows/funding.yml @@ -0,0 +1,4 @@ +github: ThirteenAG +ko_fi: thirteenag +patreon: ThirteenAG +custom: [https://paypal.me/SergeyP13, https://boosty.to/thirteenag/donate] \ No newline at end of file diff --git a/source/dllmain.cpp b/source/dllmain.cpp index aab2cba..f4c3e44 100644 --- a/source/dllmain.cpp +++ b/source/dllmain.cpp @@ -899,7 +899,7 @@ HRESULT WINAPI CustomCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWOR else if (rclsid == CLSID_WinInet) hDll = ::LoadLibrary(L"wininet.dll"); - if (hDll == NULL) + if (hDll == NULL || GetProcAddress(hDll, "IsUltimateASILoader") != NULL) return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv); typedef HRESULT(__stdcall *pDllGetClassObject)(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID FAR* ppv); @@ -1157,6 +1157,9 @@ bool HookKernel32IAT(HMODULE mod, bool exe) auto PatchCoCreateInstance = [&](size_t start, size_t end, size_t exe_end) { + if (iequals(GetSelfName(), L"dinput8.dll") || iequals(GetSelfName(), L"dinput.dll") || iequals(GetSelfName(), L"wininet.dll")) + return; + for (size_t i = 0; i < nNumImports; i++) { if (hExecutableInstance + (pImports + i)->FirstThunk > start && !(end && hExecutableInstance + (pImports + i)->FirstThunk > end))