Commit 6e5b36d4 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: Avoid compiler specific code in the DefWindowProc test.

parent ce6a7595
...@@ -558,10 +558,14 @@ static void test_instances(void) ...@@ -558,10 +558,14 @@ static void test_instances(void)
static void test_defwndproc() static void test_defwndproc()
{ {
char classA[] = "deftest"; static const char classA[] = "deftest";
WCHAR classW[] = {'d','e','f','t','e','s','t',0}; static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
WNDPROC pDefWindowProcA, pDefWindowProcW;
int i; int i;
pDefWindowProcA = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcA");
pDefWindowProcW = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcW");
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
WNDCLASSEXA cls; /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */ WNDCLASSEXA cls; /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */
...@@ -572,9 +576,9 @@ static void test_defwndproc() ...@@ -572,9 +576,9 @@ static void test_defwndproc()
cls.hInstance = GetModuleHandle(NULL); cls.hInstance = GetModuleHandle(NULL);
cls.hbrBackground = GetStockObject (WHITE_BRUSH); cls.hbrBackground = GetStockObject (WHITE_BRUSH);
if (i & 1) if (i & 1)
cls.lpfnWndProc = DefWindowProcA; cls.lpfnWndProc = pDefWindowProcA;
else else
cls.lpfnWndProc = DefWindowProcW; cls.lpfnWndProc = pDefWindowProcW;
if (i & 2) if (i & 2)
{ {
...@@ -583,7 +587,7 @@ static void test_defwndproc() ...@@ -583,7 +587,7 @@ static void test_defwndproc()
} }
else else
{ {
cls.lpszClassName = (LPSTR)classW; cls.lpszClassName = (LPCSTR)classW;
atom = RegisterClassExW((WNDCLASSEXW *)&cls); atom = RegisterClassExW((WNDCLASSEXW *)&cls);
} }
ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError()); ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
...@@ -592,32 +596,32 @@ static void test_defwndproc() ...@@ -592,32 +596,32 @@ static void test_defwndproc()
ok(hwnd != NULL, "Couldn't create window i=%d\n", i); ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
if ((i & 1) && (i & 2)) if ((i & 1) && (i & 2))
{ {
ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n", ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
(void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), DefWindowProcA); (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), pDefWindowProcA);
ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n", ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
(void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), DefWindowProcA); (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), pDefWindowProcA);
} }
else else
todo_wine { todo_wine {
ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n", ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
(void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), DefWindowProcA); (void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), pDefWindowProcA);
ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n", ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
(void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), DefWindowProcA); (void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), pDefWindowProcA);
} }
if (!(i & 1) && !(i & 2)) if (!(i & 1) && !(i & 2))
{ {
ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n", ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
(void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), DefWindowProcW); (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), pDefWindowProcW);
ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n", ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
(void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), DefWindowProcW); (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), pDefWindowProcW);
} }
else else
todo_wine { todo_wine {
ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n", ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
(void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), DefWindowProcW); (void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), pDefWindowProcW);
ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (LONG_PTR)DefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n", ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
(void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), DefWindowProcW); (void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), pDefWindowProcW);
} }
DestroyWindow(hwnd); DestroyWindow(hwnd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment