ReactOS  0.4.15-dev-1397-g19779b3
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)
 
 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;
34  WMPAINT_count++;
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");
73  return DefWindowProc(hwnd, msg, wparam, lparam);
74 }
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 *)
#define FALSE
Definition: types.h:117
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define leave
Definition: seh.h:23
#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 138 of file WndProc.c.

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

◆ test_wndproc()

static void test_wndproc ( void  )
static

Definition at line 76 of file WndProc.c.

77 {
78  WNDCLASSA cls;
79  ATOM clsAtom;
80  HWND hwndMain;
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 
131  ok(DestroyWindow(hwndMain) != 0,
132  "DestroyWindow() failed: LastError = %lu\n", GetLastError());
133 
135  "UnregisterClassA() failed: LastError = %lu\n", GetLastError());
136 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
static int WMPAINT_count
Definition: WndProc.c:15
HWND hwndMain
Definition: solitaire.cpp:12
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
static int redrawComplete
Definition: WndProc.c:15
int cbClsExtra
Definition: winuser.h:3140
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
LPCSTR lpszMenuName
Definition: winuser.h:3146
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3145
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
int cbWndExtra
Definition: winuser.h:3141
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
HCURSOR hCursor
Definition: winuser.h:3144
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:769
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define CS_DBLCLKS
Definition: winuser.h:646
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define broken(x)
Definition: _sntprintf.h:21
UINT style
Definition: winuser.h:3138
static LRESULT WINAPI redraw_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: WndProc.c:24
HINSTANCE hInstance
Definition: winuser.h:3142
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#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:3143

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