From 2034bd429c5ab345d480c7faeb8ee2185d3449e4 Mon Sep 17 00:00:00 2001
From: Francisco Casas franciscojacb@gmail.com Date: Fri, 22 Oct 2021 11:09:44 -0300 Subject: [PATCH] Fixed obj_map_cmp when the difference between key and entry is too large.
e.g. The substraction:
000000000A0A009F - FFFFFFFF9910019E
doesn't result in -1 as it should. --- dlls/gdi32/objects.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 4b390aa0160..3eebaef31cc 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -178,7 +178,11 @@ DWORD WINAPI GetObjectType( HGDIOBJ handle ) static int obj_map_cmp( const void *key, const struct wine_rb_entry *entry ) { struct obj_map_entry *obj_entry = WINE_RB_ENTRY_VALUE( entry, struct obj_map_entry, entry ); - return HandleToLong( key ) - HandleToLong( obj_entry->obj ); + LONG32 a = HandleToLong( key ); + LONG32 b = HandleToLong( obj_entry->obj ); + if(a>b) return 1; + if(a<b) return -1; + return 0; };
struct wine_rb_tree obj_map = { obj_map_cmp };