mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-26 08:06:33 +00:00
Disable NtLoadDll hook
This commit is contained in:
@@ -345,8 +345,6 @@ static void hkSetComputeRootSignature(ID3D12GraphicsCommandList* commandList, ID
|
||||
tracking = true;
|
||||
}
|
||||
|
||||
LOG_TRACE("Tracking: {}", tracking);
|
||||
|
||||
s_SetComputeRootSignature.o_earlyHook(commandList, pRootSignature);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user