ReactOS  0.4.14-dev-293-g2b39b42
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, DWORD ExtraData, DWORD ExtraData1, DWORD ExtraData2, DWORD ExtraData3)
 
static void test_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,
DWORD  ExtraData,
DWORD  ExtraData1,
DWORD  ExtraData2,
DWORD  ExtraData3 
)
static

Definition at line 24 of file WndProc.c.

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

Referenced by test_wndproc().

◆ START_TEST()

START_TEST ( WndProc  )

Definition at line 140 of file WndProc.c.

141 {
142 #ifdef __RUNTIME_CHECKS__
143  skip("This test breaks MSVC runtime checks!\n");
144  return;
145 #endif /* __RUNTIME_CHECKS__ */
146 
147  test_wndproc();
148 }
#define skip(...)
Definition: atltest.h:64
static void test_wndproc(void)
Definition: WndProc.c:79

◆ test_wndproc()

static void test_wndproc ( void  )
static

Definition at line 79 of file WndProc.c.

80 {
81  WNDCLASSA cls;
82  ATOM clsAtom;
83  HWND hwndMain;
84 
85  cls.style = CS_DBLCLKS;
87  cls.cbClsExtra = 0;
88  cls.cbWndExtra = 0;
90  cls.hIcon = NULL;
93  cls.lpszMenuName = NULL;
94  cls.lpszClassName = "RedrawWindowClass";
95 
96  clsAtom = RegisterClassA(&cls);
97  ok(clsAtom != 0, "RegisterClassA() failed: LastError = %lu\n", GetLastError());
98 
99  if (clsAtom == 0)
100  {
101  skip("No Class atom\n");
102  return;
103  }
104 
106  CW_USEDEFAULT, 0, 100, 100, NULL, NULL, NULL, NULL);
107  ok(hwndMain != NULL, "CreateWindowA() failed: LastError = %lu\n", GetLastError());
108 
109  ok(WMPAINT_count == 0,
110  "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
111 
112  if (hwndMain == NULL)
113  {
114  skip("No Window\n");
116  "UnregisterClassA() failed: LastError = %lu\n", GetLastError());
117  return;
118  }
119 
121  ok(WMPAINT_count == 0,
122  "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
123 
125  ok(WMPAINT_count == 1 || broken(WMPAINT_count == 0), /* sometimes on win9x */
126  "Multiple unexpected WM_PAINT calls = %d\n", WMPAINT_count);
127 
130  "RedrawWindow (RDW_UPDATENOW) never completed (%d/%d)\n",
132 
133  ok(DestroyWindow(hwndMain) != 0,
134  "DestroyWindow() failed: LastError = %lu\n", GetLastError());
135 
137  "UnregisterClassA() failed: LastError = %lu\n", GetLastError());
138 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define TRUE
Definition: types.h:120
static int WMPAINT_count
Definition: WndProc.c:15
HWND hwndMain
Definition: solitaire.cpp:12
WORD ATOM
Definition: dimm.idl:113
static int redrawComplete
Definition: WndProc.c:15
int cbClsExtra
Definition: winuser.h:3139
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpszMenuName
Definition: winuser.h:3145
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3144
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
int cbWndExtra
Definition: winuser.h:3140
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
HCURSOR hCursor
Definition: winuser.h:3143
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
static LRESULT WINAPI redraw_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD ExtraData, DWORD ExtraData1, DWORD ExtraData2, DWORD ExtraData3)
Definition: WndProc.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define CS_DBLCLKS
Definition: winuser.h:646
LPCSTR lpszClassName
Definition: winuser.h:3146
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define broken(x)
Definition: _sntprintf.h:21
UINT style
Definition: winuser.h:3137
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
HINSTANCE hInstance
Definition: winuser.h:3141
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define ok(value,...)
Definition: atltest.h:57
WNDPROC lpfnWndProc
Definition: winuser.h:3138
#define skip(...)
Definition: atltest.h:64
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define WMPAINT_COUNT_THRESHOLD
Definition: WndProc.c:12
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3142

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().