server: Ignore low word of a class instance when looking up for a window class.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-02-19 12:30:33 +08:00 committed by Alexandre Julliard
parent e2c0f51312
commit 6ac2ba3e3c
2 changed files with 4 additions and 4 deletions

View File

@ -128,14 +128,11 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL, WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
0, hInstance2, 0); 0, hInstance2, 0);
todo_wine_if (!global)
ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2); ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2);
todo_wine_if (!global)
ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance, ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
"Wrong GCL instance %p != %p\n", "Wrong GCL instance %p != %p\n",
(HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance); (HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
todo_wine_if (!global)
ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2, ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2,
"Wrong GWL instance %p != %p\n", "Wrong GWL instance %p != %p\n",
(HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2); (HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2);

View File

@ -100,9 +100,12 @@ static struct window_class *find_class( struct process *process, atom_t atom, mo
LIST_FOR_EACH( ptr, &process->classes ) LIST_FOR_EACH( ptr, &process->classes )
{ {
int is_win16;
struct window_class *class = LIST_ENTRY( ptr, struct window_class, entry ); struct window_class *class = LIST_ENTRY( ptr, struct window_class, entry );
if (class->atom != atom) continue; if (class->atom != atom) continue;
if (!instance || !class->local || class->instance == instance) return class; is_win16 = !(class->instance >> 16);
if (!instance || !class->local || class->instance == instance ||
(!is_win16 && ((class->instance & ~0xffff) == (instance & ~0xffff)))) return class;
} }
return NULL; return NULL;
} }