2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for mismatch with function prototype in window procedure callback.
12 /* Used wine Redraw test for proof in principle. */
14 /* Global variables to trigger exit from loop */
15 static int redrawComplete
, WMPAINT_count
;
18 Force stack corruption when calling from assumed window procedure callback.
19 Adding (6 and) more will force exception faults and terminate the test program.
20 The test is with five and this is safe for windows.
22 But,,,, ReactOS compiled with GCC can handle this,,,,,,
24 static LRESULT WINAPI
redraw_window_procA(HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
, DWORD ExtraData
,DWORD ExtraData1
,DWORD ExtraData2
,DWORD ExtraData3
)
29 trace("doing WM_PAINT %d\n", WMPAINT_count
);
31 if (WMPAINT_count
> 10 && redrawComplete
== 0)
34 BeginPaint(hwnd
, &ps
);
39 This will force one stack corruption "ret" fault with normal window
43 asm ("movl $0, %eax\n\t"
46 #elif defined(_M_IX86)
55 trace("unimplemented\n");
58 return DefWindowProc(hwnd
, msg
, wparam
, lparam
);
61 static void test_wndproc(void)
66 cls
.style
= CS_DBLCLKS
;
67 cls
.lpfnWndProc
= (WNDPROC
)redraw_window_procA
;
70 cls
.hInstance
= GetModuleHandleA(0);
72 cls
.hCursor
= LoadCursorA(0, IDC_ARROW
);
73 cls
.hbrBackground
= GetStockObject(WHITE_BRUSH
);
74 cls
.lpszMenuName
= NULL
;
75 cls
.lpszClassName
= "RedrawWindowClass";
77 if (!RegisterClassA(&cls
))
79 trace("Register failed %d\n", (int)GetLastError());
83 hwndMain
= CreateWindowA("RedrawWindowClass", "Main Window", WS_OVERLAPPEDWINDOW
,
84 CW_USEDEFAULT
, 0, 100, 100, NULL
, NULL
, 0, NULL
);
86 ok( WMPAINT_count
== 0, "Multiple unexpected WM_PAINT calls %d\n", WMPAINT_count
);
87 ShowWindow(hwndMain
, SW_SHOW
);
88 ok( WMPAINT_count
== 0, "Multiple unexpected WM_PAINT calls %d\n", WMPAINT_count
);
89 RedrawWindow(hwndMain
, NULL
,NULL
,RDW_UPDATENOW
| RDW_ALLCHILDREN
);
90 ok( WMPAINT_count
== 1 || broken(WMPAINT_count
== 0), /* sometimes on win9x */
91 "Multiple unexpected WM_PAINT calls %d\n", WMPAINT_count
);
92 redrawComplete
= TRUE
;
93 ok( WMPAINT_count
< 10, "RedrawWindow (RDW_UPDATENOW) never completed (%d)\n", WMPAINT_count
);
96 DestroyWindow( hwndMain
);