From 8be98755535f01d7d447dc5e97f22a910425e26d Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 15 Dec 2024 20:16:49 +0100 Subject: [PATCH] fix return value for NUMCOLORS on desktop window --- src/winapi_hooks.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index 9a2366a..081bdee 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -893,10 +893,22 @@ int WINAPI fake_GetDeviceCaps(HDC hdc, int index) return RC_PALETTE | real_GetDeviceCaps(hdc, index); } - if (index == SIZEPALETTE || index == NUMCOLORS) + if (index == SIZEPALETTE) { return 256; } + + if (index == NUMCOLORS) + { + if (WindowFromDC(hdc) == GetDesktopWindow()) + { + return 20; + } + else + { + return 256; + } + } } return real_GetDeviceCaps(hdc, index);