Skip to content

Commit

Permalink
fix return value for NUMCOLORS on desktop window
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Dec 15, 2024
1 parent 9a015c4 commit 8be9875
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8be9875

Please sign in to comment.