From 5df02037058bcd7976a576440dcfbd4a0405b021 Mon Sep 17 00:00:00 2001 From: cdozdil Date: Sun, 31 May 2026 22:09:49 +0300 Subject: [PATCH] Disable NtLoadDll hook --- OptiScaler/hooks/D3D12_Hooks.cpp | 2 -- OptiScaler/hooks/LibraryLoad_Hooks.cpp | 24 ++++++++++++++++-------- OptiScaler/hooks/Ntdll_Hooks.h | 4 ++-- OptiScaler/proxies/Dxgi_Proxy.h | 2 ++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/OptiScaler/hooks/D3D12_Hooks.cpp b/OptiScaler/hooks/D3D12_Hooks.cpp index 3ac0acca..24b32db0 100644 --- a/OptiScaler/hooks/D3D12_Hooks.cpp +++ b/OptiScaler/hooks/D3D12_Hooks.cpp @@ -345,8 +345,6 @@ static void hkSetComputeRootSignature(ID3D12GraphicsCommandList* commandList, ID tracking = true; } - LOG_TRACE("Tracking: {}", tracking); - s_SetComputeRootSignature.o_earlyHook(commandList, pRootSignature); } diff --git a/OptiScaler/hooks/LibraryLoad_Hooks.cpp b/OptiScaler/hooks/LibraryLoad_Hooks.cpp index d28d2f57..f7c7553a 100644 --- a/OptiScaler/hooks/LibraryLoad_Hooks.cpp +++ b/OptiScaler/hooks/LibraryLoad_Hooks.cpp @@ -277,8 +277,6 @@ HMODULE LibraryLoadHooks::LoadLibraryCheckW(std::wstring libName, LPCWSTR lpLibF } else if (CheckDllNameW(&libName, &overlayNamesW)) { - LOG_DEBUG("Overlay dll: {}", wstring_to_string(libName)); - // If we hook CreateSwapChainForHwnd & CreateSwapChainForCoreWindow here // Order of CreateSwapChain calls become // Game -> Overlay -> Opti @@ -297,30 +295,40 @@ HMODULE LibraryLoadHooks::LoadLibraryCheckW(std::wstring libName, LPCWSTR lpLibF auto module = NtdllProxy::LoadLibraryExW_Ldr(libName.c_str(), NULL, 0); + LOG_DEBUG("Overlay dll: {}, module: {:X}", wstring_to_string(libName), (size_t) module); + if (module != nullptr) { if (DxgiProxy::Module() != nullptr) { - insideThisCode = true; - LOG_INFO("Calling CreateDxgiFactory methods for overlay!"); IDXGIFactory* factory = nullptr; IDXGIFactory1* factory1 = nullptr; IDXGIFactory2* factory2 = nullptr; - if (DxgiProxy::CreateDxgiFactory_()(__uuidof(factory), &factory) == S_OK && factory != nullptr) + auto ocResult = DxgiProxy::CreateDxgiFactory_()(__uuidof(factory), &factory); + LOG_DEBUG("CreateDxgiFactory result: {:X}", ocResult); + + if (ocResult == S_OK && factory != nullptr) { + insideThisCode = true; LOG_DEBUG("CreateDxgiFactory ok"); factory->Release(); } - if (DxgiProxy::CreateDxgiFactory1_()(__uuidof(factory1), &factory1) == S_OK && factory1 != nullptr) + ocResult = DxgiProxy::CreateDxgiFactory1_()(__uuidof(factory1), &factory1); + LOG_DEBUG("CreateDxgiFactory1 result: {:X}", ocResult); + + if (ocResult == S_OK && factory1 != nullptr) { LOG_DEBUG("CreateDxgiFactory1 ok"); factory1->Release(); } - if (DxgiProxy::CreateDxgiFactory2_()(0, __uuidof(factory2), &factory2) == S_OK && factory2 != nullptr) + ocResult = DxgiProxy::CreateDxgiFactory2_()(0, __uuidof(factory2), &factory2); + LOG_DEBUG("CreateDxgiFactory2 result: {:X}", ocResult); + + if (ocResult == S_OK && factory2 != nullptr) { LOG_DEBUG("CreateDxgiFactory2 ok"); factory2->Release(); @@ -467,7 +475,7 @@ HMODULE LibraryLoadHooks::LoadLibraryCheckW(std::wstring libName, LPCWSTR lpLibF auto module = NtdllProxy::LoadLibraryExW_Ldr(libName.c_str(), NULL, 0); if (module != nullptr) - InitFSR4Update(); + Amdxc64Hooks::Init(); return module; } diff --git a/OptiScaler/hooks/Ntdll_Hooks.h b/OptiScaler/hooks/Ntdll_Hooks.h index 502a3aaf..2db86eb7 100644 --- a/OptiScaler/hooks/Ntdll_Hooks.h +++ b/OptiScaler/hooks/Ntdll_Hooks.h @@ -197,8 +197,8 @@ class NtdllHooks if (o_RtlGetVersion == nullptr) o_RtlGetVersion = NtdllProxy::Hook_RtlGetVersion(hkRtlGetVersion); - if (o_NtLoadDll == nullptr) - o_NtLoadDll = NtdllProxy::Hook_NtLoadDll(hkNtLoadDll); + // if (o_NtLoadDll == nullptr) + // o_NtLoadDll = NtdllProxy::Hook_NtLoadDll(hkNtLoadDll); if (o_LdrLoadDll == nullptr) o_LdrLoadDll = NtdllProxy::Hook_LdrLoadDll(hkLdrLoadDll); diff --git a/OptiScaler/proxies/Dxgi_Proxy.h b/OptiScaler/proxies/Dxgi_Proxy.h index 29e352a9..bf8ba51c 100644 --- a/OptiScaler/proxies/Dxgi_Proxy.h +++ b/OptiScaler/proxies/Dxgi_Proxy.h @@ -45,6 +45,8 @@ class DxgiProxy if (_dll == nullptr) return; + LOG_DEBUG("dxgi.dll loaded at {:X}", (uintptr_t) _dll); + _CreateDxgiFactory = (PFN_CreateDxgiFactory) KernelBaseProxy::GetProcAddress_()(_dll, "CreateDXGIFactory"); _CreateDxgiFactory1 = (PFN_CreateDxgiFactory1) KernelBaseProxy::GetProcAddress_()(_dll, "CreateDXGIFactory1"); _CreateDxgiFactory2 = (PFN_CreateDxgiFactory2) KernelBaseProxy::GetProcAddress_()(_dll, "CreateDXGIFactory2");