mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
hook MapWindowPoints
This commit is contained in:
parent
5baeb50d1e
commit
29863ed472
@ -28,6 +28,7 @@ typedef LONG (WINAPI* SETWINDOWLONGAPROC)(HWND, int, LONG);
|
||||
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 int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
||||
typedef HMODULE (WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
||||
typedef HMODULE (WINAPI* LOADLIBRARYWPROC)(LPCWSTR);
|
||||
@ -54,6 +55,7 @@ extern SETWINDOWLONGAPROC real_SetWindowLongA;
|
||||
extern ENABLEWINDOWPROC real_EnableWindow;
|
||||
extern CREATEWINDOWEXAPROC real_CreateWindowExA;
|
||||
extern DESTROYWINDOWPROC real_DestroyWindow;
|
||||
extern MAPWINDOWPOINTSPROC real_MapWindowPoints;
|
||||
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
||||
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
||||
extern LOADLIBRARYWPROC real_LoadLibraryW;
|
||||
|
@ -24,6 +24,7 @@ LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
|
||||
LONG WINAPI fake_SetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
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);
|
||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName);
|
||||
HMODULE WINAPI fake_LoadLibraryW(LPCWSTR lpLibFileName);
|
||||
|
@ -36,6 +36,7 @@ SETWINDOWLONGAPROC real_SetWindowLongA = SetWindowLongA;
|
||||
ENABLEWINDOWPROC real_EnableWindow = EnableWindow;
|
||||
CREATEWINDOWEXAPROC real_CreateWindowExA = CreateWindowExA;
|
||||
DESTROYWINDOWPROC real_DestroyWindow = DestroyWindow;
|
||||
MAPWINDOWPOINTSPROC real_MapWindowPoints = MapWindowPoints;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
||||
LOADLIBRARYWPROC real_LoadLibraryW = LoadLibraryW;
|
||||
@ -68,6 +69,7 @@ static hook_list g_hooks[] =
|
||||
{ "EnableWindow", (PROC)fake_EnableWindow, (PROC*)&real_EnableWindow },
|
||||
{ "CreateWindowExA", (PROC)fake_CreateWindowExA, (PROC*)&real_CreateWindowExA },
|
||||
{ "DestroyWindow", (PROC)fake_DestroyWindow, (PROC*)&real_DestroyWindow },
|
||||
{ "MapWindowPoints", (PROC)fake_MapWindowPoints, (PROC*)&real_MapWindowPoints },
|
||||
{ "", NULL, NULL }
|
||||
}
|
||||
},
|
||||
|
@ -322,7 +322,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
|
||||
|
||||
dds_GetDC(this, &src_dc);
|
||||
|
||||
MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)&pos, 2);
|
||||
real_MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)&pos, 2);
|
||||
|
||||
BitBlt(dst_dc, 0, 0, size.right, size.bottom, src_dc, pos.left, pos.top, SRCCOPY);
|
||||
|
||||
|
@ -146,7 +146,7 @@ BOOL WINAPI fake_GetWindowRect(HWND hWnd, LPRECT lpRect)
|
||||
{
|
||||
if (real_GetWindowRect(hWnd, lpRect))
|
||||
{
|
||||
MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)lpRect, 2);
|
||||
real_MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)lpRect, 2);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -282,7 +282,7 @@ LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
|
||||
{
|
||||
RECT *rc = (RECT *)lParam;
|
||||
if (rc)
|
||||
MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)rc, 2);
|
||||
real_MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)rc, 2);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -306,6 +306,21 @@ BOOL WINAPI fake_EnableWindow(HWND hWnd, BOOL bEnable)
|
||||
return real_EnableWindow(hWnd, bEnable);
|
||||
}
|
||||
|
||||
int WINAPI fake_MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
|
||||
{
|
||||
if (g_ddraw && hWndFrom == g_ddraw->hwnd && hWndTo == HWND_DESKTOP)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_ddraw && hWndFrom == HWND_DESKTOP && hWndTo == g_ddraw->hwnd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return real_MapWindowPoints(hWndFrom, hWndTo, lpPoints, cPoints);
|
||||
}
|
||||
|
||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index)
|
||||
{
|
||||
if (g_ddraw &&
|
||||
@ -416,7 +431,7 @@ HWND WINAPI fake_CreateWindowExA(
|
||||
}
|
||||
|
||||
real_GetClientRect(g_ddraw->hwnd, &g_ddraw->bnet_win_rect);
|
||||
MapWindowPoints(g_ddraw->hwnd, HWND_DESKTOP, (LPPOINT)&g_ddraw->bnet_win_rect, 2);
|
||||
real_MapWindowPoints(g_ddraw->hwnd, HWND_DESKTOP, (LPPOINT)&g_ddraw->bnet_win_rect, 2);
|
||||
|
||||
int width = g_ddraw->bnet_win_rect.right - g_ddraw->bnet_win_rect.left;
|
||||
int height = g_ddraw->bnet_win_rect.bottom - g_ddraw->bnet_win_rect.top;
|
||||
|
Loading…
x
Reference in New Issue
Block a user