From b39c8f895698f3400292836d6d6f91470fce9cb9 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Sat, 23 Oct 2021 01:44:31 +0200 Subject: [PATCH] Unpatch a lot of Valves hooks (in own memory...) to show HID Gaming devices... --- GlosSITarget/HidHide.cpp | 10 +++++++++- GlosSITarget/HidHide.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/GlosSITarget/HidHide.cpp b/GlosSITarget/HidHide.cpp index bf63a2f..3d09bf7 100644 --- a/GlosSITarget/HidHide.cpp +++ b/GlosSITarget/HidHide.cpp @@ -118,7 +118,7 @@ void HidHide::hideDevices(const std::filesystem::path& steam_path) } if (!dev.device_instance_path.empty()) { blacklisted_devices_.push_back(dev.base_container_device_instance_path); - } + } } } } @@ -152,6 +152,14 @@ void HidHide::UnPatchValveHooks() else { spdlog::error("failed to unpatch SetupDiEnumDeviceInfo"); } + addr = reinterpret_cast(GetProcAddress(setupapidll, "SetupDiGetClassDevsW")); + if (addr) { + UnPatchHook(addr, SETUP_DI_GETCLASSDEVSW_ORIG_BYTES); + spdlog::trace("Unpatched SetupDiGetClassDevsW"); + } + else { + spdlog::error("failed to unpatch SetupDiGetClassDevsW"); + } } auto hiddll = GetModuleHandle(L"hid.dll"); if (hiddll) { diff --git a/GlosSITarget/HidHide.h b/GlosSITarget/HidHide.h index 6b6209c..f3a09d5 100644 --- a/GlosSITarget/HidHide.h +++ b/GlosSITarget/HidHide.h @@ -71,6 +71,8 @@ class HidHide { // Valve Hooks `SetupDiEnumDeviceInfo` and hides Gaming devices like this. // To be able to query them, unpatch the hook with the original bytes... static inline const std::string SETUP_DI_ENUM_DEV_INFO_ORIG_BYTES = "\x48\x89\x5C\x24\x08"; + // Valve also Hooks `SetupDiGetClassDevsW` ..unhook that as well... + static inline const std::string SETUP_DI_GETCLASSDEVSW_ORIG_BYTES = "\x48\x89\x5C\x24\x08"; // Valve also Hooks `HidD_GetPreparsedData` ..unhook that as well... static inline const std::string HID_GETPREPARSED_ORIG_BYTES = "\x48\x89\x5C\x24\x18"; // ..aand `HidP_GetCaps`