mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
hook SetWindowsHookExA
This commit is contained in:
parent
2214751089
commit
242c40a197
@ -30,6 +30,7 @@ typedef BOOL (WINAPI* ENABLEWINDOWPROC)(HWND, BOOL);
|
||||
typedef HWND (WINAPI* CREATEWINDOWEXAPROC)(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
|
||||
typedef BOOL (WINAPI* DESTROYWINDOWPROC)(HWND);
|
||||
typedef int (WINAPI* MAPWINDOWPOINTSPROC)(HWND, HWND, LPPOINT, UINT);
|
||||
typedef HHOOK (WINAPI* SETWINDOWSHOOKEXAPROC)(int, HOOKPROC, HINSTANCE, DWORD);
|
||||
typedef int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
||||
typedef HMODULE (WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
||||
typedef HMODULE (WINAPI* LOADLIBRARYWPROC)(LPCWSTR);
|
||||
@ -58,6 +59,7 @@ extern ENABLEWINDOWPROC real_EnableWindow;
|
||||
extern CREATEWINDOWEXAPROC real_CreateWindowExA;
|
||||
extern DESTROYWINDOWPROC real_DestroyWindow;
|
||||
extern MAPWINDOWPOINTSPROC real_MapWindowPoints;
|
||||
extern SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA;
|
||||
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
||||
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
||||
extern LOADLIBRARYWPROC real_LoadLibraryW;
|
||||
|
@ -26,6 +26,7 @@ LONG WINAPI fake_GetWindowLongA(HWND hWnd, int nIndex);
|
||||
BOOL WINAPI fake_EnableWindow(HWND hWnd, BOOL bEnable);
|
||||
BOOL WINAPI fake_DestroyWindow(HWND hWnd);
|
||||
int WINAPI fake_MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints);
|
||||
HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId);
|
||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName);
|
||||
HMODULE WINAPI fake_LoadLibraryW(LPCWSTR lpLibFileName);
|
||||
|
@ -38,6 +38,7 @@ ENABLEWINDOWPROC real_EnableWindow = EnableWindow;
|
||||
CREATEWINDOWEXAPROC real_CreateWindowExA = CreateWindowExA;
|
||||
DESTROYWINDOWPROC real_DestroyWindow = DestroyWindow;
|
||||
MAPWINDOWPOINTSPROC real_MapWindowPoints = MapWindowPoints;
|
||||
SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
||||
LOADLIBRARYWPROC real_LoadLibraryW = LoadLibraryW;
|
||||
@ -439,6 +440,7 @@ void hook_early_init()
|
||||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "dinput.dll", "DirectInputCreateW", (PROC)fake_DirectInputCreateW);
|
||||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "dinput.dll", "DirectInputCreateEx", (PROC)fake_DirectInputCreateEx);
|
||||
hook_patch_iat(GetModuleHandle(NULL), FALSE, "dinput8.dll", "DirectInput8Create", (PROC)fake_DirectInput8Create);
|
||||
hook_patch_iat(GetModuleHandle("AcGenral"), FALSE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
}
|
||||
|
||||
void hook_exit()
|
||||
@ -491,4 +493,5 @@ void hook_exit()
|
||||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "dinput.dll", "DirectInputCreateW", (PROC)fake_DirectInputCreateW);
|
||||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "dinput.dll", "DirectInputCreateEx", (PROC)fake_DirectInputCreateEx);
|
||||
hook_patch_iat(GetModuleHandle(NULL), TRUE, "dinput8.dll", "DirectInput8Create", (PROC)fake_DirectInput8Create);
|
||||
hook_patch_iat(GetModuleHandle("AcGenral"), TRUE, "user32.dll", "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA);
|
||||
}
|
||||
|
@ -364,6 +364,16 @@ int WINAPI fake_MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UI
|
||||
return real_MapWindowPoints(hWndFrom, hWndTo, lpPoints, cPoints);
|
||||
}
|
||||
|
||||
HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)
|
||||
{
|
||||
if (idHook == WH_KEYBOARD_LL && hmod && GetModuleHandle("AcGenral") == hmod)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return real_SetWindowsHookExA(idHook, lpfn, hmod, dwThreadId);
|
||||
}
|
||||
|
||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index)
|
||||
{
|
||||
if (g_ddraw &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user