From 9c4f670ecbd86d49188e40a496904467263a2300 Mon Sep 17 00:00:00 2001 From: "Andon M. Coleman" Date: Wed, 6 Mar 2024 14:44:11 -0500 Subject: [PATCH] Fixed issues caused by refactoring config code to use a static structure --- config.h | 5 +++-- dllmain.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index ef808a3..d10949c 100644 --- a/config.h +++ b/config.h @@ -9,6 +9,7 @@ struct config_s { wchar_t wszPathToSystemXInput1_1 [MAX_PATH] = L""; wchar_t wszPathToSystemXInput9_1_0 [MAX_PATH] = L""; DWORD dwFillTheSwamp = 0x1; -} static config; +}; -static volatile LONG __VP_DLL_Refs = 0UL; \ No newline at end of file +extern config_s config; +extern volatile LONG __VP_DLL_Refs; \ No newline at end of file diff --git a/dllmain.cpp b/dllmain.cpp index 5cc074a..cb11c96 100644 --- a/dllmain.cpp +++ b/dllmain.cpp @@ -12,6 +12,9 @@ #pragma comment (lib, "SKinHook/libMinHook64.lib") #endif + config_s config; +volatile LONG __VP_DLL_Refs = 0UL; + static CreateFileA_pfn CreateFileA_Original = nullptr; static CreateFileW_pfn CreateFileW_Original = nullptr; static CreateFile2_pfn CreateFile2_Original = nullptr; @@ -624,17 +627,25 @@ DllMain ( HMODULE hModule, { InterlockedIncrement (&__VP_DLL_Refs); + config = { }; + #ifdef _M_IX86 GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_4, MAX_PATH); GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_3, MAX_PATH); + GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_2, MAX_PATH); + GetSystemWow64DirectoryW (config.wszPathToSystemXInput1_1, MAX_PATH); GetSystemWow64DirectoryW (config.wszPathToSystemXInput9_1_0, MAX_PATH); #else GetSystemDirectoryW (config.wszPathToSystemXInput1_4, MAX_PATH); GetSystemDirectoryW (config.wszPathToSystemXInput1_3, MAX_PATH); + GetSystemDirectoryW (config.wszPathToSystemXInput1_2, MAX_PATH); + GetSystemDirectoryW (config.wszPathToSystemXInput1_1, MAX_PATH); GetSystemDirectoryW (config.wszPathToSystemXInput9_1_0, MAX_PATH); #endif PathAppendW (config.wszPathToSystemXInput1_4, L"XInput1_4.dll"); PathAppendW (config.wszPathToSystemXInput1_3, L"XInput1_3.dll"); + PathAppendW (config.wszPathToSystemXInput1_2, L"XInput1_2.dll"); + PathAppendW (config.wszPathToSystemXInput1_1, L"XInput1_1.dll"); PathAppendW (config.wszPathToSystemXInput9_1_0, L"XInput9_1_0.dll"); CRegKey hkValvePlug;