mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
hook ShowWindow
This commit is contained in:
parent
46c064ae56
commit
21790200af
@ -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 BOOL (WINAPI* SHOWWINDOWPROC)(HWND, int);
|
||||
typedef HHOOK(WINAPI* SETWINDOWSHOOKEXAPROC)(int, HOOKPROC, HINSTANCE, DWORD);
|
||||
typedef int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
||||
typedef HMODULE(WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
||||
@ -60,6 +61,7 @@ extern ENABLEWINDOWPROC real_EnableWindow;
|
||||
extern CREATEWINDOWEXAPROC real_CreateWindowExA;
|
||||
extern DESTROYWINDOWPROC real_DestroyWindow;
|
||||
extern MAPWINDOWPOINTSPROC real_MapWindowPoints;
|
||||
extern SHOWWINDOWPROC real_ShowWindow;
|
||||
extern SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA;
|
||||
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
||||
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
||||
|
@ -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);
|
||||
BOOL WINAPI fake_ShowWindow(HWND hWnd, int nCmdShow);
|
||||
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);
|
||||
|
@ -38,6 +38,7 @@ ENABLEWINDOWPROC real_EnableWindow = EnableWindow;
|
||||
CREATEWINDOWEXAPROC real_CreateWindowExA = CreateWindowExA;
|
||||
DESTROYWINDOWPROC real_DestroyWindow = DestroyWindow;
|
||||
MAPWINDOWPOINTSPROC real_MapWindowPoints = MapWindowPoints;
|
||||
SHOWWINDOWPROC real_ShowWindow = ShowWindow;
|
||||
SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
||||
@ -74,6 +75,7 @@ static HOOKLIST g_hooks[] =
|
||||
{ "CreateWindowExA", (PROC)fake_CreateWindowExA, (PROC*)&real_CreateWindowExA },
|
||||
{ "DestroyWindow", (PROC)fake_DestroyWindow, (PROC*)&real_DestroyWindow },
|
||||
{ "MapWindowPoints", (PROC)fake_MapWindowPoints, (PROC*)&real_MapWindowPoints },
|
||||
{ "ShowWindow", (PROC)fake_ShowWindow, (PROC*)&real_ShowWindow },
|
||||
{ "", NULL, NULL }
|
||||
}
|
||||
},
|
||||
|
@ -471,6 +471,20 @@ int WINAPI fake_MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UI
|
||||
return real_MapWindowPoints(hWndFrom, hWndTo, lpPoints, cPoints);
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_ShowWindow(HWND hWnd, int nCmdShow)
|
||||
{
|
||||
if (g_ddraw && g_ddraw->hwnd == hWnd)
|
||||
{
|
||||
if (nCmdShow == SW_SHOWMAXIMIZED)
|
||||
nCmdShow = SW_SHOWNORMAL;
|
||||
|
||||
if (nCmdShow == SW_MAXIMIZE)
|
||||
nCmdShow = SW_NORMAL;
|
||||
}
|
||||
|
||||
return real_ShowWindow(hWnd, nCmdShow);
|
||||
}
|
||||
|
||||
HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)
|
||||
{
|
||||
if (idHook == WH_KEYBOARD_LL && hmod && GetModuleHandle("AcGenral") == hmod)
|
||||
|
@ -524,7 +524,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
{
|
||||
if (g_ddraw->renderer != d3d9_render_main)
|
||||
{
|
||||
ShowWindow(g_ddraw->hwnd, SW_MINIMIZE);
|
||||
real_ShowWindow(g_ddraw->hwnd, SW_MINIMIZE);
|
||||
ChangeDisplaySettings(NULL, g_ddraw->bnet_active ? CDS_FULLSCREEN : 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user