From a8bd9ccb8e8b9b56584d28a9c6e43debf746e314 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Thu, 11 Jun 2020 18:58:42 +0200 Subject: [PATCH] Abort if dnsapi.dll exists and PD Loader was loaded from dinput8.dll --- source-code/source/PD-Loader/dllmain.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source-code/source/PD-Loader/dllmain.cpp b/source-code/source/PD-Loader/dllmain.cpp index 21f7a36..7473261 100644 --- a/source-code/source/PD-Loader/dllmain.cpp +++ b/source-code/source/PD-Loader/dllmain.cpp @@ -735,6 +735,20 @@ void Init() VirtualProtect(&SetUnhandledExceptionFilter, sizeof(ret), protect[0], &protect[1]); } + + auto szSelfName = GetSelfName(); + if (iequals(szSelfName, L"dinput8.dll")) + { + auto dir = GetCurrentDirectoryW(); + WIN32_FIND_DATAW fd; + HANDLE dnsloader = FindFirstFileW(L"dnsapi.dll", &fd); + if (dnsloader != INVALID_HANDLE_VALUE) + { + MessageBoxW(0, L"PD Loader was loaded from dinput8.dll, but dnsapi.dll was found. Aborting.\nPlease refer to the quick start guide or the wiki.", L"PD Loader", MB_ICONERROR); + exit(1); + } + } + LoadEverything(); }