From fe9f78b01676e1852463d2cdc4f003a5349cff41 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 30 Dec 2021 00:51:44 -0500 Subject: [PATCH] removed prints, added phantom device --- hooklib/dll.c | 2 -- hooklib/setupapi.c | 1 - mercuryhook/elisabeth.c | 11 +++++------ mercuryhook/elisabeth.h | 8 ++++++++ mercuryio/mercuryio.c | 6 ++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/hooklib/dll.c b/hooklib/dll.c index 1eab2b7..9400bb9 100644 --- a/hooklib/dll.c +++ b/hooklib/dll.c @@ -284,8 +284,6 @@ static HMODULE WINAPI hook_LoadLibraryW(const wchar_t *name) { HMODULE result; - dprintf("hook_LoadLibraryW: Loading %S\n", name); - if (name == NULL) { SetLastError(ERROR_INVALID_PARAMETER); diff --git a/hooklib/setupapi.c b/hooklib/setupapi.c index 26a5b53..edd416a 100644 --- a/hooklib/setupapi.c +++ b/hooklib/setupapi.c @@ -196,7 +196,6 @@ static BOOL WINAPI my_SetupDiEnumDeviceInterfaces( DWORD MemberIndex, SP_DEVICE_INTERFACE_DATA *DeviceInterfaceData) { - dprintf("my_SetupDiEnumDeviceInterfaces hit!\n"); const struct setupapi_class *class_; size_t i; diff --git a/mercuryhook/elisabeth.c b/mercuryhook/elisabeth.c index 8dbc834..2de12dc 100644 --- a/mercuryhook/elisabeth.c +++ b/mercuryhook/elisabeth.c @@ -1,3 +1,4 @@ +#include #include #include @@ -36,8 +37,7 @@ static const struct hook_symbol win32_hooks[] = { }; static const wchar_t *target_modules[] = { - L"USBIntLED.DLL", - L"ftd2XX.dll", + L"USBIntLED.DLL" }; static const size_t target_modules_len = _countof(target_modules); @@ -45,6 +45,7 @@ static const size_t target_modules_len = _countof(target_modules); void elisabeth_hook_init() { dll_hook_insert_hooks(NULL); + setupapi_add_phantom_dev(&elisabeth_guid, L"USB\\VID_0403&PID_6001"); } static void dll_hook_insert_hooks(HMODULE target) @@ -65,8 +66,6 @@ static HMODULE WINAPI my_LoadLibraryW(const wchar_t *name) size_t name_len; size_t target_module_len; - dprintf("Elisabeth: Trying to load %S\n", name); - if (name == NULL) { SetLastError(ERROR_INVALID_PARAMETER); @@ -114,11 +113,11 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name) { uintptr_t ordinal = (uintptr_t) name; - FARPROC result = next_GetProcAddress(hModule, name); + FARPROC result = next_GetProcAddress(hModule, name); if (ordinal > 0xFFFF) { /* Import by name */ - dprintf("Elisabeth: GetProcAddress %s is %p\n", name, result); + //dprintf("Elisabeth: GetProcAddress %s is %p\n", name, result); } return result; diff --git a/mercuryhook/elisabeth.h b/mercuryhook/elisabeth.h index 30285c9..0891f48 100644 --- a/mercuryhook/elisabeth.h +++ b/mercuryhook/elisabeth.h @@ -1,3 +1,11 @@ #pragma once +#include + +DEFINE_GUID( + elisabeth_guid, + 0x219D058, + 0x57A8, + 0x4FF5, + 0x97, 0x1A, 0xBD, 0x86, 0x58, 0x7C, 0x6C, 0x7E); void elisabeth_hook_init(); diff --git a/mercuryio/mercuryio.c b/mercuryio/mercuryio.c index 96a6050..6bd410f 100644 --- a/mercuryio/mercuryio.c +++ b/mercuryio/mercuryio.c @@ -7,8 +7,6 @@ #include "mercuryio/config.h" static uint8_t mercury_opbtn; -static uint16_t mercury_player1_btn; -static uint16_t mercury_player2_btn; static struct mercury_io_config mercury_io_cfg; uint16_t mercury_io_get_api_version(void) @@ -47,5 +45,5 @@ void mercury_io_get_opbtns(uint8_t *opbtn) void mercury_io_get_gamebtns(uint16_t *player1, uint16_t *player2) { - -} \ No newline at end of file + +}