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

Alexandre Julliard julliard at winehq.org
Thu Feb 27 17:15:11 CST 2020


Module: wine
Branch: master
Commit: 6ac2ba3e3cb8110c59071ab57098116a85427589
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6ac2ba3e3cb8110c59071ab57098116a85427589

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Feb 19 12:30:33 2020 +0800

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

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/class.c | 3 ---
 server/class.c            | 5 ++++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 67c95225f4..51bc116908 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -128,14 +128,11 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
        WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
        CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
        0, hInstance2, 0);
-todo_wine_if (!global)
     ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2);
 
-todo_wine_if (!global)
     ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
        "Wrong GCL instance %p != %p\n",
        (HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
-todo_wine_if (!global)
     ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2,
        "Wrong GWL instance %p != %p\n",
        (HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2);
diff --git a/server/class.c b/server/class.c
index b8240bd568..92cbfa2d7e 100644
--- a/server/class.c
+++ b/server/class.c
@@ -100,9 +100,12 @@ static struct window_class *find_class( struct process *process, atom_t atom, mo
 
     LIST_FOR_EACH( ptr, &process->classes )
     {
+        int is_win16;
         struct window_class *class = LIST_ENTRY( ptr, struct window_class, entry );
         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;
 }




More information about the wine-cvs mailing list