Module: wine Branch: master Commit: d904f84ed01edc7ec56fbd736c3610057c5173b2 URL: https://gitlab.winehq.org/wine/wine/-/commit/d904f84ed01edc7ec56fbd736c36100...
Author: Sven Baars sbaars@codeweavers.com Date: Wed Dec 14 17:17:12 2022 +0100
win32u: Account for 16-bit instances in find_class().
This mimics the condition in the server.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53384
---
dlls/win32u/class.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index b18fd69edfc..9f3b4251e65 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -353,8 +353,9 @@ static void release_class_ptr( CLASS *ptr ) static CLASS *find_class( HINSTANCE module, UNICODE_STRING *name ) { ATOM atom = get_int_atom_value( name ); - ULONG_PTR instance = (UINT_PTR)module & ~0xffff; + ULONG_PTR instance = (UINT_PTR)module; CLASS *class; + int is_win16;
user_lock(); LIST_FOR_EACH_ENTRY( class, &class_list, CLASS, entry ) @@ -368,7 +369,9 @@ static CLASS *find_class( HINSTANCE module, UNICODE_STRING *name ) if (wcsnicmp( class->name, name->Buffer, name->Length / sizeof(WCHAR) ) || class->name[name->Length / sizeof(WCHAR)]) continue; } - if (!class->local || !module || (class->instance & ~0xffff) == instance) + is_win16 = !(class->instance >> 16); + if (!instance || !class->local || class->instance == instance || + (!is_win16 && ((class->instance & ~0xffff) == (instance & ~0xffff)))) { TRACE( "%s %lx -> %p\n", debugstr_us(name), instance, class ); return class;