From c4f03397e24cbfe0736b48c70b36ab92213efd10 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Wed, 6 Nov 2024 17:58:10 +0300 Subject: [PATCH] better fix for nvapi loading (thx to FakeMichau) --- OptiScaler/NVNGX_Proxy.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OptiScaler/NVNGX_Proxy.h b/OptiScaler/NVNGX_Proxy.h index ee24276e..728c7098 100644 --- a/OptiScaler/NVNGX_Proxy.h +++ b/OptiScaler/NVNGX_Proxy.h @@ -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");