Skip to content

Commit

Permalink
CoCreateInstance fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 26, 2023
1 parent d124a34 commit 0ed6a6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github: ThirteenAG
ko_fi: thirteenag
patreon: ThirteenAG
custom: [https://paypal.me/SergeyP13, https://boosty.to/thirteenag/donate]
5 changes: 4 additions & 1 deletion source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 0ed6a6e

Please sign in to comment.