Dmitry Timoshkov : user32: Avoid compiler specific code in the DefWindowProc test.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 20 08:11:03 CDT 2007


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Mon Mar 19 23:56:49 2007 +0800

user32: Avoid compiler specific code in the DefWindowProc test.

---

 dlls/user32/tests/class.c |   46 ++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 782f0ba..bd1cde6 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -558,10 +558,14 @@ static void test_instances(void)
 
 static void test_defwndproc()
 {
-    char classA[] = "deftest";
-    WCHAR classW[] = {'d','e','f','t','e','s','t',0};
+    static const char classA[] = "deftest";
+    static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
+    WNDPROC pDefWindowProcA, pDefWindowProcW;
     int i;
 
+    pDefWindowProcA = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcA");
+    pDefWindowProcW = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcW");
+
     for (i = 0; i < 4; i++)
     {
         WNDCLASSEXA cls;  /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */
@@ -572,9 +576,9 @@ static void test_defwndproc()
         cls.hInstance = GetModuleHandle(NULL);
         cls.hbrBackground = GetStockObject (WHITE_BRUSH);
         if (i & 1)
-            cls.lpfnWndProc = DefWindowProcA;
+            cls.lpfnWndProc = pDefWindowProcA;
         else
-            cls.lpfnWndProc = DefWindowProcW;
+            cls.lpfnWndProc = pDefWindowProcW;
 
         if (i & 2)
         {
@@ -583,7 +587,7 @@ static void test_defwndproc()
         }
         else
         {
-            cls.lpszClassName = (LPSTR)classW;
+            cls.lpszClassName = (LPCSTR)classW;
             atom = RegisterClassExW((WNDCLASSEXW *)&cls);
         }
         ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
@@ -592,32 +596,32 @@ static void test_defwndproc()
         ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
         if ((i & 1) && (i & 2))
         {
-            ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-                (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), DefWindowProcA);
-            ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-                (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), DefWindowProcA);
+            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);
         }
         else
         todo_wine {
-            ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-                (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), DefWindowProcA);
-            ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
-                (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), DefWindowProcA);
+            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);
         }
 
         if (!(i & 1) && !(i & 2))
         {
-            ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-                (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), DefWindowProcW);
-            ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-                (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), DefWindowProcW);
+            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);
         }
         else
         todo_wine {
-            ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-                (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), DefWindowProcW);
-            ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
-                (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), DefWindowProcW);
+            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);




More information about the wine-cvs mailing list