mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
hook BitBlt
This commit is contained in:
parent
0bce13b314
commit
2f2367e5b5
@ -45,6 +45,7 @@ typedef BOOL (WINAPI* SHOWWINDOWPROC)(HWND, int);
|
|||||||
typedef HWND(WINAPI* GETTOPWINDOWPROC)(HWND);
|
typedef HWND(WINAPI* GETTOPWINDOWPROC)(HWND);
|
||||||
typedef HWND(WINAPI* GETFOREGROUNDWINDOWPROC)();
|
typedef HWND(WINAPI* GETFOREGROUNDWINDOWPROC)();
|
||||||
typedef BOOL(WINAPI* STRETCHBLTPROC)(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
|
typedef BOOL(WINAPI* STRETCHBLTPROC)(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
|
||||||
|
typedef BOOL(WINAPI* BITBLTPROC)(HDC, int, int, int, int, HDC, int, int, DWORD);
|
||||||
|
|
||||||
typedef int (WINAPI* SETDIBITSTODEVICEPROC)(
|
typedef int (WINAPI* SETDIBITSTODEVICEPROC)(
|
||||||
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
||||||
@ -97,6 +98,7 @@ extern SHOWWINDOWPROC real_ShowWindow;
|
|||||||
extern GETTOPWINDOWPROC real_GetTopWindow;
|
extern GETTOPWINDOWPROC real_GetTopWindow;
|
||||||
extern GETFOREGROUNDWINDOWPROC real_GetForegroundWindow;
|
extern GETFOREGROUNDWINDOWPROC real_GetForegroundWindow;
|
||||||
extern STRETCHBLTPROC real_StretchBlt;
|
extern STRETCHBLTPROC real_StretchBlt;
|
||||||
|
extern BITBLTPROC real_BitBlt;
|
||||||
extern SETDIBITSTODEVICEPROC real_SetDIBitsToDevice;
|
extern SETDIBITSTODEVICEPROC real_SetDIBitsToDevice;
|
||||||
extern STRETCHDIBITSPROC real_StretchDIBits;
|
extern STRETCHDIBITSPROC real_StretchDIBits;
|
||||||
extern SETFOREGROUNDWINDOWPROC real_SetForegroundWindow;
|
extern SETFOREGROUNDWINDOWPROC real_SetForegroundWindow;
|
||||||
|
@ -40,6 +40,9 @@ int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
|||||||
BOOL WINAPI fake_StretchBlt(
|
BOOL WINAPI fake_StretchBlt(
|
||||||
HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||||
|
|
||||||
|
BOOL WINAPI fake_BitBlt(
|
||||||
|
HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop);
|
||||||
|
|
||||||
int WINAPI fake_SetDIBitsToDevice(
|
int WINAPI fake_SetDIBitsToDevice(
|
||||||
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
||||||
|
|
||||||
|
@ -573,11 +573,11 @@ HRESULT dds_BltFast(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BitBlt(dst_dc, dst_x, dst_y, dst_w, dst_h, src_dc, src_x, src_y, SRCCOPY);
|
real_BitBlt(dst_dc, dst_x, dst_y, dst_w, dst_h, src_dc, src_x, src_y, SRCCOPY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
BitBlt(
|
real_BitBlt(
|
||||||
dst_dc,
|
dst_dc,
|
||||||
dwX,
|
dwX,
|
||||||
dwY,
|
dwY,
|
||||||
|
@ -42,6 +42,7 @@ SHOWWINDOWPROC real_ShowWindow = ShowWindow;
|
|||||||
GETTOPWINDOWPROC real_GetTopWindow = GetTopWindow;
|
GETTOPWINDOWPROC real_GetTopWindow = GetTopWindow;
|
||||||
GETFOREGROUNDWINDOWPROC real_GetForegroundWindow = GetForegroundWindow;
|
GETFOREGROUNDWINDOWPROC real_GetForegroundWindow = GetForegroundWindow;
|
||||||
STRETCHBLTPROC real_StretchBlt = StretchBlt;
|
STRETCHBLTPROC real_StretchBlt = StretchBlt;
|
||||||
|
BITBLTPROC real_BitBlt = BitBlt;
|
||||||
SETDIBITSTODEVICEPROC real_SetDIBitsToDevice = SetDIBitsToDevice;
|
SETDIBITSTODEVICEPROC real_SetDIBitsToDevice = SetDIBitsToDevice;
|
||||||
STRETCHDIBITSPROC real_StretchDIBits = StretchDIBits;
|
STRETCHDIBITSPROC real_StretchDIBits = StretchDIBits;
|
||||||
SETFOREGROUNDWINDOWPROC real_SetForegroundWindow = SetForegroundWindow;
|
SETFOREGROUNDWINDOWPROC real_SetForegroundWindow = SetForegroundWindow;
|
||||||
@ -127,6 +128,7 @@ HOOKLIST g_hook_hooklist[] =
|
|||||||
{
|
{
|
||||||
"gdi32.dll",
|
"gdi32.dll",
|
||||||
{
|
{
|
||||||
|
{ "BitBlt", (PROC)fake_BitBlt, (PROC*)&real_BitBlt, HOOK_SKIP_2 },
|
||||||
{ "StretchBlt", (PROC)fake_StretchBlt, (PROC*)&real_StretchBlt, HOOK_SKIP_2 },
|
{ "StretchBlt", (PROC)fake_StretchBlt, (PROC*)&real_StretchBlt, HOOK_SKIP_2 },
|
||||||
{ "SetDIBitsToDevice", (PROC)fake_SetDIBitsToDevice, (PROC*)&real_SetDIBitsToDevice, HOOK_SKIP_2 },
|
{ "SetDIBitsToDevice", (PROC)fake_SetDIBitsToDevice, (PROC*)&real_SetDIBitsToDevice, HOOK_SKIP_2 },
|
||||||
{ "StretchDIBits", (PROC)fake_StretchDIBits, (PROC*)&real_StretchDIBits, HOOK_SKIP_2 },
|
{ "StretchDIBits", (PROC)fake_StretchDIBits, (PROC*)&real_StretchDIBits, HOOK_SKIP_2 },
|
||||||
|
@ -625,7 +625,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
|
|||||||
|
|
||||||
real_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);
|
real_BitBlt(dst_dc, 0, 0, size.right, size.bottom, src_dc, pos.left, pos.top, SRCCOPY);
|
||||||
|
|
||||||
ReleaseDC(hwnd, dst_dc);
|
ReleaseDC(hwnd, dst_dc);
|
||||||
}
|
}
|
||||||
|
@ -823,6 +823,48 @@ BOOL WINAPI fake_StretchBlt(
|
|||||||
return real_StretchBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, rop);
|
return real_StretchBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, rop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI fake_BitBlt(
|
||||||
|
HDC hdc,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int cx,
|
||||||
|
int cy,
|
||||||
|
HDC hdcSrc,
|
||||||
|
int x1,
|
||||||
|
int y1,
|
||||||
|
DWORD rop)
|
||||||
|
{
|
||||||
|
if (g_ddraw.ref && g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd)
|
||||||
|
{
|
||||||
|
if (g_ddraw.primary && (g_ddraw.primary->bpp == 16 || g_ddraw.primary->bpp == 32 || g_ddraw.primary->palette))
|
||||||
|
{
|
||||||
|
HDC primary_dc;
|
||||||
|
dds_GetDC(g_ddraw.primary, &primary_dc);
|
||||||
|
|
||||||
|
if (primary_dc)
|
||||||
|
{
|
||||||
|
int result =
|
||||||
|
real_BitBlt(
|
||||||
|
primary_dc,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
cx,
|
||||||
|
cy,
|
||||||
|
hdcSrc,
|
||||||
|
x1,
|
||||||
|
y1,
|
||||||
|
rop);
|
||||||
|
|
||||||
|
dds_ReleaseDC(g_ddraw.primary, primary_dc);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return real_BitBlt(hdc, x, y, cx, cy, hdcSrc, x1, y1, rop);
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI fake_SetDIBitsToDevice(
|
int WINAPI fake_SetDIBitsToDevice(
|
||||||
HDC hdc,
|
HDC hdc,
|
||||||
int xDest,
|
int xDest,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user