[PATCH] gdi32: Increase first gdi handle value

Nikolay Sivov nsivov at codeweavers.com
Thu Apr 7 15:36:03 CDT 2016

Due 32->16bit handle truncation low enough handle values could be misinterpreted
as stock brushes indices in FillRect(). Gdi creates stock brushes on dll load,
on clean run white brush gets handle 0x10010 (generation 1, first handle 16).
GetStockObject() called from user.exe returns this handle value, which is then
truncated to 0x10. Test application uses it as background class brush handle during
class registration. Later doing FillRect() with 0x10 brush ends up using COLOR_BTNFACE
brush instead.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>

For https://bugs.winehq.org/show_bug.cgi?id=39730

 dlls/gdi32/gdiobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c
index e861f24..237544d 100644
--- a/dlls/gdi32/gdiobj.c
+++ b/dlls/gdi32/gdiobj.c
@@ -38,7 +38,7 @@
-#define FIRST_GDI_HANDLE 16
+#define FIRST_GDI_HANDLE 32
 #define MAX_GDI_HANDLES  16384
 struct hdc_list

More information about the wine-patches mailing list