better fix for nvapi loading (thx to FakeMichau)

This commit is contained in:
cdozdil
2024-11-06 17:58:10 +03:00
parent 1e3a6932d2
commit c4f03397e2
+9 -7
View File
@@ -159,10 +159,13 @@ inline static void HookNvApi()
LOG_INFO("NvAPI_QueryInterface found, hooking!");
fakenvapi::Init((fakenvapi::PFN_Fake_QueryInterface&)OriginalNvAPI_QueryInterface);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)OriginalNvAPI_QueryInterface, HookedNvAPI_QueryInterface);
DetourTransactionCommit();
if (!Config::Instance()->DE_Available)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)OriginalNvAPI_QueryInterface, HookedNvAPI_QueryInterface);
DetourTransactionCommit();
}
}
}
@@ -491,11 +494,10 @@ public:
if (_dll != nullptr)
{
HookNvApi();
if (!Config::Instance()->DE_Available)
{
HookNvApi();
HookNgxApi(_dll);
}
LOG_INFO("getting nvngx method addresses");