ReactOS 0.4.15-dev-7961-gdcf9eb0
WndProc.c File Reference
#include "precomp.h"
Include dependency graph for WndProc.c:

Go to the source code of this file.

Macros

#define WMPAINT_COUNT_THRESHOLD   10
 

Functions

static LRESULT WINAPI redraw_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_wndproc (void)
 
static void test_get_wndproc (void)
 
 START_TEST (WndProc)
 

Variables

static int redrawComplete
 
static int WMPAINT_count
 

Macro Definition Documentation

◆ WMPAINT_COUNT_THRESHOLD

#define WMPAINT_COUNT_THRESHOLD   10

Definition at line 12 of file WndProc.c.

Function Documentation

◆ redraw_window_procA()

static LRESULT WINAPI redraw_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 24 of file WndProc.c.

29{
30 switch (msg)
31 {
32 case WM_PAINT:
33 break;
35 trace("Doing WM_PAINT %d/%d\n", WMPAINT_count, WMPAINT_COUNT_THRESHOLD);
36
38 {
39 PAINTSTRUCT ps;
40
41 trace("Calling *Paint()\n");
42 BeginPaint(hwnd, &ps);
43 EndPaint(hwnd, &ps);
44 return 1;
45 }
46
47 // This will force one stack corruption "ret" fault with normal window
48 // procedure callback.
49#ifdef __MINGW32__
50 trace("Executing __MINGW32__ stack corruption code\n");
51 asm ("movl $0, %eax\n\t"
52 "leave\n\t"
53 "ret");
54#elif defined(_M_IX86)
55//#ifdef _MSC_VER
56 trace("Executing MSVC x86 stack corruption code\n");
57 __asm
58 {
59 mov eax, 0
60 leave
61 ret
62 }
63#else
64 ok(FALSE, "FIXME: stack corruption code is unimplemented\n");
65#endif
66
67 break;
68 default:
69 trace("Doing empty default: msg = %u\n", msg);
70 }
71
72 trace("Calling DefWindowProc()\n");
74}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
static int WMPAINT_count
Definition: WndProc.c:15
static int redrawComplete
Definition: WndProc.c:15
#define WMPAINT_COUNT_THRESHOLD
Definition: WndProc.c:12
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define leave
Definition: btrfs_drv.h:138
#define FALSE
Definition: types.h:117
#define DefWindowProc
Definition: ros2win.h:31
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
Definition: synth_sse3d.h:85
int ret
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WM_PAINT
Definition: winuser.h:1620
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by test_wndproc().

◆ START_TEST()

START_TEST ( WndProc  )

Definition at line 159 of file WndProc.c.

160{
161#ifdef __RUNTIME_CHECKS__
162 skip("This test breaks MSVC runtime checks!\n");
163 return;
164#endif /* __RUNTIME_CHECKS__ */
165
167 test_wndproc();
168}
static void test_wndproc(void)
Definition: WndProc.c:76
static void test_get_wndproc(void)
Definition: WndProc.c:138
#define skip(...)
Definition: atltest.h:64

◆ test_get_wndproc()

static void test_get_wndproc ( void  )
static

Definition at line 138 of file WndProc.c.

139{
141 SetLastError(0xfeedf00d);
143 ok (ret == 0, "Should return NULL\n");
144 ok (GetLastError() == ERROR_ACCESS_DENIED, "Wrong return error!\n");
145 SetLastError(0xfeedf00d);
147 ok (ret == 0, "Should return NULL\n");
148 ok (GetLastError() == ERROR_ACCESS_DENIED, "Wrong return error!\n");
149 SetLastError(0xfeedf00d);
151 ok (ret == 0, "Should return NULL\n");
152 ok (GetLastError() == ERROR_ACCESS_DENIED, "Wrong return error!\n");
153 SetLastError(0xfeedf00d);
155 ok (ret == 0, "Should return NULL\n");
156 ok (GetLastError() == ERROR_ACCESS_DENIED, "Wrong return error!\n");
157}
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define GetWindowLongPtrA
Definition: winuser.h:4828

Referenced by START_TEST().

◆ test_wndproc()

static void test_wndproc ( void  )
static

Definition at line 76 of file WndProc.c.

77{
78 WNDCLASSA cls;
79 ATOM clsAtom;
81
82 cls.style = CS_DBLCLKS;
84 cls.cbClsExtra = 0;
85 cls.cbWndExtra = 0;
87 cls.hIcon = NULL;
90 cls.lpszMenuName = NULL;
91 cls.lpszClassName = "RedrawWindowClass";
92
93 clsAtom = RegisterClassA(&cls);
94 ok(clsAtom != 0, "RegisterClassA() failed: LastError = %lu\n", GetLastError());
95
96 if (clsAtom == 0)
97 {
98 skip("No Class atom\n");
99 return;
100 }
101
103 CW_USEDEFAULT, 0, 100, 100, NULL, NULL, NULL, NULL);
104
105 ok(hwndMain != NULL, "CreateWindowA() failed: LastError = %lu\n", GetLastError());
106
107 ok(WMPAINT_count == 0,
108 "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
109
110 if (hwndMain == NULL)
111 {
112 skip("No Window\n");
114 "UnregisterClassA() failed: LastError = %lu\n", GetLastError());
115 return;
116 }
117
119 ok(WMPAINT_count == 0,
120 "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
121
123 ok(WMPAINT_count == 1 || broken(WMPAINT_count == 0), /* sometimes on win9x */
124 "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
125
128 "RedrawWindow (RDW_UPDATENOW) never completed (%d/%d)\n",
130
132 "DestroyWindow() failed: LastError = %lu\n", GetLastError());
133
135 "UnregisterClassA() failed: LastError = %lu\n", GetLastError());
136}
static LRESULT WINAPI redraw_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: WndProc.c:24
#define broken(x)
Definition: _sntprintf.h:21
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HWND hwndMain
Definition: solitaire.cpp:13
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define IDC_ARROW
Definition: winuser.h:687
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define CS_DBLCLKS
Definition: winuser.h:651
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define RDW_ALLCHILDREN
Definition: winuser.h:1221
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI DestroyWindow(_In_ HWND)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2090

Referenced by START_TEST().

Variable Documentation

◆ redrawComplete

int redrawComplete
static

Definition at line 15 of file WndProc.c.

Referenced by redraw_window_procA(), and test_wndproc().

◆ WMPAINT_count

int WMPAINT_count
static

Definition at line 15 of file WndProc.c.

Referenced by redraw_window_procA(), and test_wndproc().