mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
hook SetDIBitsToDevice
This commit is contained in:
parent
707239ba61
commit
2a8a5f85ec
@ -35,6 +35,8 @@ typedef BOOL(WINAPI* DESTROYWINDOWPROC)(HWND);
|
|||||||
typedef int (WINAPI* MAPWINDOWPOINTSPROC)(HWND, HWND, LPPOINT, UINT);
|
typedef int (WINAPI* MAPWINDOWPOINTSPROC)(HWND, HWND, LPPOINT, UINT);
|
||||||
typedef BOOL (WINAPI* SHOWWINDOWPROC)(HWND, int);
|
typedef BOOL (WINAPI* SHOWWINDOWPROC)(HWND, int);
|
||||||
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 int (WINAPI* SETDIBITSTODEVICEPROC)(
|
||||||
|
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
||||||
typedef HHOOK(WINAPI* SETWINDOWSHOOKEXAPROC)(int, HOOKPROC, HINSTANCE, DWORD);
|
typedef HHOOK(WINAPI* SETWINDOWSHOOKEXAPROC)(int, HOOKPROC, HINSTANCE, DWORD);
|
||||||
typedef int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
typedef int (WINAPI* GETDEVICECAPSPROC)(HDC, int);
|
||||||
typedef HMODULE(WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
typedef HMODULE(WINAPI* LOADLIBRARYAPROC)(LPCSTR);
|
||||||
@ -67,6 +69,7 @@ extern DESTROYWINDOWPROC real_DestroyWindow;
|
|||||||
extern MAPWINDOWPOINTSPROC real_MapWindowPoints;
|
extern MAPWINDOWPOINTSPROC real_MapWindowPoints;
|
||||||
extern SHOWWINDOWPROC real_ShowWindow;
|
extern SHOWWINDOWPROC real_ShowWindow;
|
||||||
extern STRETCHBLTPROC real_StretchBlt;
|
extern STRETCHBLTPROC real_StretchBlt;
|
||||||
|
extern SETDIBITSTODEVICEPROC real_SetDIBitsToDevice;
|
||||||
extern SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA;
|
extern SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA;
|
||||||
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
extern GETDEVICECAPSPROC real_GetDeviceCaps;
|
||||||
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
extern LOADLIBRARYAPROC real_LoadLibraryA;
|
||||||
|
@ -30,17 +30,9 @@ BOOL WINAPI fake_ShowWindow(HWND hWnd, int nCmdShow);
|
|||||||
HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId);
|
HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId);
|
||||||
int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
int WINAPI fake_GetDeviceCaps(HDC hdc, int index);
|
||||||
BOOL WINAPI fake_StretchBlt(
|
BOOL WINAPI fake_StretchBlt(
|
||||||
HDC hdcDest,
|
HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||||
int xDest,
|
int WINAPI fake_SetDIBitsToDevice(
|
||||||
int yDest,
|
HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID*, const BITMAPINFO*, UINT);
|
||||||
int wDest,
|
|
||||||
int hDest,
|
|
||||||
HDC hdcSrc,
|
|
||||||
int xSrc,
|
|
||||||
int ySrc,
|
|
||||||
int wSrc,
|
|
||||||
int hSrc,
|
|
||||||
DWORD rop);
|
|
||||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName);
|
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName);
|
||||||
HMODULE WINAPI fake_LoadLibraryW(LPCWSTR lpLibFileName);
|
HMODULE WINAPI fake_LoadLibraryW(LPCWSTR lpLibFileName);
|
||||||
HMODULE WINAPI fake_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
|
HMODULE WINAPI fake_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
|
||||||
|
@ -41,6 +41,7 @@ DESTROYWINDOWPROC real_DestroyWindow = DestroyWindow;
|
|||||||
MAPWINDOWPOINTSPROC real_MapWindowPoints = MapWindowPoints;
|
MAPWINDOWPOINTSPROC real_MapWindowPoints = MapWindowPoints;
|
||||||
SHOWWINDOWPROC real_ShowWindow = ShowWindow;
|
SHOWWINDOWPROC real_ShowWindow = ShowWindow;
|
||||||
STRETCHBLTPROC real_StretchBlt = StretchBlt;
|
STRETCHBLTPROC real_StretchBlt = StretchBlt;
|
||||||
|
SETDIBITSTODEVICEPROC real_SetDIBitsToDevice = SetDIBitsToDevice;
|
||||||
SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
||||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||||
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
LOADLIBRARYAPROC real_LoadLibraryA = LoadLibraryA;
|
||||||
@ -84,6 +85,7 @@ static HOOKLIST g_hooks[] =
|
|||||||
"gdi32.dll",
|
"gdi32.dll",
|
||||||
{
|
{
|
||||||
{ "StretchBlt", (PROC)fake_StretchBlt, (PROC*)&real_StretchBlt, SKIP_HOOK2 | SKIP_HOOK3 },
|
{ "StretchBlt", (PROC)fake_StretchBlt, (PROC*)&real_StretchBlt, SKIP_HOOK2 | SKIP_HOOK3 },
|
||||||
|
{ "SetDIBitsToDevice", (PROC)fake_SetDIBitsToDevice, (PROC*)&real_SetDIBitsToDevice, SKIP_HOOK2 | SKIP_HOOK3 },
|
||||||
{ "GetDeviceCaps", (PROC)fake_GetDeviceCaps, (PROC*)&real_GetDeviceCaps, SKIP_HOOK3 },
|
{ "GetDeviceCaps", (PROC)fake_GetDeviceCaps, (PROC*)&real_GetDeviceCaps, SKIP_HOOK3 },
|
||||||
{ "", NULL, NULL, 0 }
|
{ "", NULL, NULL, 0 }
|
||||||
}
|
}
|
||||||
|
@ -598,6 +598,54 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WINAPI fake_SetDIBitsToDevice(
|
||||||
|
HDC hdc,
|
||||||
|
int xDest,
|
||||||
|
int yDest,
|
||||||
|
DWORD w,
|
||||||
|
DWORD h,
|
||||||
|
int xSrc,
|
||||||
|
int ySrc,
|
||||||
|
UINT StartScan,
|
||||||
|
UINT cLines,
|
||||||
|
const VOID* lpvBits,
|
||||||
|
const BITMAPINFO* lpbmi,
|
||||||
|
UINT ColorUse)
|
||||||
|
{
|
||||||
|
if (g_ddraw && WindowFromDC(hdc) == g_ddraw->hwnd)
|
||||||
|
{
|
||||||
|
if (g_ddraw->primary)
|
||||||
|
{
|
||||||
|
HDC primary_dc;
|
||||||
|
dds_GetDC(g_ddraw->primary, &primary_dc);
|
||||||
|
|
||||||
|
if (primary_dc)
|
||||||
|
{
|
||||||
|
BOOL result =
|
||||||
|
real_SetDIBitsToDevice(
|
||||||
|
primary_dc,
|
||||||
|
xDest,
|
||||||
|
yDest,
|
||||||
|
w,
|
||||||
|
h,
|
||||||
|
xSrc,
|
||||||
|
ySrc,
|
||||||
|
StartScan,
|
||||||
|
cLines,
|
||||||
|
lpvBits,
|
||||||
|
lpbmi,
|
||||||
|
ColorUse);
|
||||||
|
|
||||||
|
dds_ReleaseDC(g_ddraw->primary, primary_dc);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return real_SetDIBitsToDevice(hdc, xDest, yDest, w, h, xSrc, ySrc, StartScan, cLines, lpvBits, lpbmi, ColorUse);
|
||||||
|
}
|
||||||
|
|
||||||
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName)
|
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName)
|
||||||
{
|
{
|
||||||
HMODULE hmod = real_LoadLibraryA(lpLibFileName);
|
HMODULE hmod = real_LoadLibraryA(lpLibFileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user