Greg Geldorp : user32/tests: Skip DefWindowProc tests on Vista+.

Alexandre Julliard julliard at winehq.org
Mon Jan 3 10:58:01 CST 2011


Module: wine
Branch: master
Commit: 4856c299ba04250b8e6140763b7f69b02a4bf47d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4856c299ba04250b8e6140763b7f69b02a4bf47d

Author: Greg Geldorp <ggeldorp at vmware.com>
Date:   Sun Jan  2 10:55:48 2011 +0100

user32/tests: Skip DefWindowProc tests on Vista+.

---

 dlls/user32/tests/class.c |   84 +++++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 95f8aeb..ed288aa 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -617,6 +617,7 @@ static void test_builtinproc(void)
     static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
     WCHAR unistring[] = {0x142, 0x40e, 0x3b4, 0};  /* a string that would be destroyed by a W->A->W conversion */
     WNDPROC pDefWindowProcA, pDefWindowProcW;
+    WNDPROC pNtdllDefWindowProcA, pNtdllDefWindowProcW;
     WNDPROC oldproc;
     WNDCLASSEXA cls;  /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */
     WCHAR buf[128];
@@ -626,45 +627,56 @@ static void test_builtinproc(void)
 
     pDefWindowProcA = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcA");
     pDefWindowProcW = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcW");
-
-    for (i = 0; i < 4; i++)
+    pNtdllDefWindowProcA = (void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtdllDefWindowProc_A");
+    pNtdllDefWindowProcW = (void *)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtdllDefWindowProc_W");
+
+    /* On Vista+, the user32.dll export DefWindowProcA/W is forwarded to  */
+    /* ntdll.NtdllDefWindowProc_A/W. However, the wndproc returned by     */
+    /* GetClassLong/GetWindowLong points to an unexported user32 function */
+    if (pDefWindowProcA == pNtdllDefWindowProcA &&
+        pDefWindowProcW == pNtdllDefWindowProcW)
+        skip("user32.DefWindowProcX forwarded to ntdll.NtdllDefWindowProc_X\n");
+    else
     {
-        ZeroMemory(&cls, sizeof(cls));
-        cls.cbSize = sizeof(cls);
-        cls.hInstance = GetModuleHandle(NULL);
-        cls.hbrBackground = GetStockObject (WHITE_BRUSH);
-        if (i & 1)
-            cls.lpfnWndProc = pDefWindowProcA;
-        else
-            cls.lpfnWndProc = pDefWindowProcW;
-
-        if (i & 2)
-        {
-            cls.lpszClassName = classA;
-            atom = RegisterClassExA(&cls);
-        }
-        else
+        for (i = 0; i < 4; i++)
         {
-            cls.lpszClassName = (LPCSTR)classW;
-            atom = RegisterClassExW((WNDCLASSEXW *)&cls);
+            ZeroMemory(&cls, sizeof(cls));
+            cls.cbSize = sizeof(cls);
+            cls.hInstance = GetModuleHandle(NULL);
+            cls.hbrBackground = GetStockObject (WHITE_BRUSH);
+            if (i & 1)
+                cls.lpfnWndProc = pDefWindowProcA;
+            else
+                cls.lpfnWndProc = pDefWindowProcW;
+
+            if (i & 2)
+            {
+                cls.lpszClassName = classA;
+                atom = RegisterClassExA(&cls);
+            }
+            else
+            {
+                cls.lpszClassName = (LPCSTR)classW;
+                atom = RegisterClassExW((WNDCLASSEXW *)&cls);
+            }
+            ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
+
+            hwnd = CreateWindowA(classA, NULL, 0, 0, 0, 100, 100, NULL, NULL, GetModuleHandle(NULL), NULL);
+            ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
+
+            ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
+                (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), pDefWindowProcA);
+            ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
+                (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), pDefWindowProcA);
+
+            ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
+                (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), pDefWindowProcW);
+            ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
+                (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), pDefWindowProcW);
+
+            DestroyWindow(hwnd);
+            UnregisterClass((LPSTR)(DWORD_PTR)atom, GetModuleHandle(NULL));
         }
-        ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
-
-        hwnd = CreateWindowA(classA, NULL, 0, 0, 0, 100, 100, NULL, NULL, GetModuleHandle(NULL), NULL);
-        ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
-
-        ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-            (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), pDefWindowProcA);
-        ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-            (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), pDefWindowProcA);
-
-        ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-            (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), pDefWindowProcW);
-        ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-            (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), pDefWindowProcW);
-
-        DestroyWindow(hwnd);
-        UnregisterClass((LPSTR)(DWORD_PTR)atom, GetModuleHandle(NULL));
     }
 
     /* built-in winproc - window A/W type automatically detected */




More information about the wine-cvs mailing list