ReactOS  0.4.15-dev-1187-g119f102
MessageStateAnalyzer.c File Reference
#include "precomp.h"
#include "undocuser.h"
#include "winxx.h"
#include <strsafe.h>
#include "msgdump.h"
Include dependency graph for MessageStateAnalyzer.c:

Go to the source code of this file.

Classes

struct  STAGE
 

Macros

#define MSGDUMP_TPRINTF   MsgDumpPrintf
 
#define MSGDUMP_PREFIX   s_prefix
 
#define TIMEOUT_TIMER   999
 
#define TOTAL_TIMEOUT   (5 * 1000)
 
#define WIDTH   300
 
#define HEIGHT   200
 
#define PARENT_MSG   s_msgStack[s_nLevel - 1]
 

Typedefs

typedef enum STAGE_TYPE STAGE_TYPE
 
typedef struct STAGE STAGE
 
typedef enum ACTION ACTION
 

Enumerations

enum  STAGE_TYPE { STAGE_TYPE_SEQUENCE, STAGE_TYPE_COUNTING }
 
enum  ACTION {
  ACTION_ZERO = 0, ACTION_FIRSTMINMAX, ACTION_NCCREATE, ACTION_SHOW,
  ACTION_IME_SETCONTEXT_OPEN, ACTION_IME_NOTIFY_OPEN, ACTION_DESTROY, ACTION_IME_SETCONTEXT_CLOSE,
  ACTION_IME_NOTIFY_CLOSE, ACTION_HIDE, ACTION_DEACTIVATE, ACTION_ACTIVATE
}
 

Functions

static void MsgDumpPrintf (LPCSTR fmt,...)
 
static void DoInitialize (const STAGE *pStages, INT cStages)
 
static void DoFinish (void)
 
static void DoAction (HWND hwnd, INT iAction, WPARAM wParam, LPARAM lParam)
 
static void NextStage (HWND hwnd)
 
static void DoStage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK InnerWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void DoBuildPrefix (void)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void General_DoTest (void)
 
static void IME_DoTest (void)
 
 START_TEST (MessageStateAnalyzer)
 

Variables

static char s_prefix [16] = ""
 
static INT s_iStage
 
static INT s_iStep
 
static INT s_nLevel
 
static BOOL s_bNextStage
 
static INT s_nCounters [10]
 
static UINT s_msgStack [32]
 
static const STAGEs_pStages
 
static INT s_cStages
 
static const STAGE s_GeneralStages []
 
static const STAGE s_IMEStages []
 

Macro Definition Documentation

◆ HEIGHT

#define HEIGHT   200

Definition at line 60 of file MessageStateAnalyzer.c.

◆ MSGDUMP_PREFIX

#define MSGDUMP_PREFIX   s_prefix

Definition at line 24 of file MessageStateAnalyzer.c.

◆ MSGDUMP_TPRINTF

#define MSGDUMP_TPRINTF   MsgDumpPrintf

Definition at line 22 of file MessageStateAnalyzer.c.

◆ PARENT_MSG

#define PARENT_MSG   s_msgStack[s_nLevel - 1]

Definition at line 61 of file MessageStateAnalyzer.c.

◆ TIMEOUT_TIMER

#define TIMEOUT_TIMER   999

Definition at line 57 of file MessageStateAnalyzer.c.

◆ TOTAL_TIMEOUT

#define TOTAL_TIMEOUT   (5 * 1000)

Definition at line 58 of file MessageStateAnalyzer.c.

◆ WIDTH

#define WIDTH   300

Definition at line 59 of file MessageStateAnalyzer.c.

Typedef Documentation

◆ ACTION

typedef enum ACTION ACTION

◆ STAGE

typedef struct STAGE STAGE

◆ STAGE_TYPE

Enumeration Type Documentation

◆ ACTION

Enumerator
ACTION_ZERO 
ACTION_FIRSTMINMAX 
ACTION_NCCREATE 
ACTION_SHOW 
ACTION_IME_SETCONTEXT_OPEN 
ACTION_IME_NOTIFY_OPEN 
ACTION_DESTROY 
ACTION_IME_SETCONTEXT_CLOSE 
ACTION_IME_NOTIFY_CLOSE 
ACTION_HIDE 
ACTION_DEACTIVATE 
ACTION_ACTIVATE 

Definition at line 82 of file MessageStateAnalyzer.c.

◆ STAGE_TYPE

Enumerator
STAGE_TYPE_SEQUENCE 
STAGE_TYPE_COUNTING 

Definition at line 27 of file MessageStateAnalyzer.c.

Function Documentation

◆ DoAction()

static void DoAction ( HWND  hwnd,
INT  iAction,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 98 of file MessageStateAnalyzer.c.

99 {
100  RECT rc;
101  switch (iAction)
102  {
103  case ACTION_ZERO:
104  /* does nothing */
105  break;
106  case ACTION_FIRSTMINMAX:
107  GetWindowRect(hwnd, &rc);
108  ok_long(rc.right - rc.left, 0);
109  ok_long(rc.bottom - rc.top, 0);
111  break;
112  case ACTION_NCCREATE:
113  GetWindowRect(hwnd, &rc);
114  ok_long(rc.right - rc.left, WIDTH);
115  ok_long(rc.bottom - rc.top, HEIGHT);
117  break;
118  case ACTION_SHOW:
120  break;
122  ok(wParam == 1, "Step %d: wParam was %p\n", s_iStep, (void *)wParam);
123  ok(lParam == 0xC000000F, "Step %d: lParam was %p\n", s_iStep, (void *)lParam);
124  break;
126  ok(wParam == 2, "Step %d: wParam was %p\n", s_iStep, (void *)wParam);
127  ok(lParam == 0, "Step %d: lParam was %p\n", s_iStep, (void *)lParam);
128  break;
129  case ACTION_DESTROY:
131  break;
133  ok(wParam == 0, "Step %d: wParam was %p\n", s_iStep, (void *)wParam);
134  ok(lParam == 0xC000000F, "Step %d: lParam was %p\n", s_iStep, (void *)lParam);
135  break;
137  ok(wParam == 1, "Step %d: wParam was %p\n", s_iStep, (void *)wParam);
138  ok(lParam == 0, "Step %d: lParam was %p\n", s_iStep, (void *)lParam);
139  break;
140  case ACTION_HIDE:
142  break;
143  case ACTION_DEACTIVATE:
145  break;
146  case ACTION_ACTIVATE:
148  break;
149  }
150 }
#define WIDTH
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define SW_HIDE
Definition: winuser.h:762
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define ok_long(expression, result)
Definition: atltest.h:133
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define ok_int(expression, result)
Definition: atltest.h:134
#define HEIGHT
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static INT s_iStep
LPARAM lParam
Definition: combotst.c:139

Referenced by DoStage(), InnerWindowProc(), SetupDiInstallDevice(), and SetupDiRegisterCoDeviceInstallers().

◆ DoBuildPrefix()

static void DoBuildPrefix ( void  )
static

Definition at line 278 of file MessageStateAnalyzer.c.

279 {
281  INT i = 0;
282 
283  if (Flags & ISMEX_CALLBACK)
284  s_prefix[i++] = 'C';
285  if (Flags & ISMEX_NOTIFY)
286  s_prefix[i++] = 'N';
287  if (Flags & ISMEX_REPLIED)
288  s_prefix[i++] = 'R';
289  if (Flags & ISMEX_SEND)
290  s_prefix[i++] = 'S';
291  if (i == 0)
292  s_prefix[i++] = 'P';
293 
294  s_prefix[i++] = ':';
295  s_prefix[i++] = ' ';
296  s_prefix[i] = 0;
297 }
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI InSendMessageEx(LPVOID lpReserved)
Definition: message.c:1391
unsigned long DWORD
Definition: ntddk_ex.h:95
static char s_prefix[16]

Referenced by WindowProc().

◆ DoFinish()

static void DoFinish ( void  )
static

Definition at line 73 of file MessageStateAnalyzer.c.

74 {
76  if (s_iStage != s_cStages)
77  {
78  skip("Some stage(s) skipped (Step: %d)\n", s_iStep);
79  }
80 }
#define ok_int(expression, result)
Definition: atltest.h:134
static INT s_iStage
static INT s_cStages
#define skip(...)
Definition: atltest.h:64
static INT s_iStep

Referenced by General_DoTest(), and IME_DoTest().

◆ DoInitialize()

static void DoInitialize ( const STAGE pStages,
INT  cStages 
)
static

Definition at line 63 of file MessageStateAnalyzer.c.

64 {
65  s_iStage = s_iStep = s_nLevel = 0;
69  s_pStages = pStages;
70  s_cStages = cStages;
71 }
static const STAGE * s_pStages
static INT s_nLevel
#define ZeroMemory
Definition: winbase.h:1648
static BOOL s_bNextStage
static INT s_nCounters[10]
#define FALSE
Definition: types.h:117
static INT s_iStage
static UINT s_msgStack[32]
static INT s_cStages
static INT s_iStep

Referenced by General_DoTest(), and IME_DoTest().

◆ DoStage()

static void DoStage ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 188 of file MessageStateAnalyzer.c.

189 {
190  INT i, iAction;
191  const STAGE *pStage;
193 
194  if (s_iStage >= s_cStages)
195  return;
196 
197  pStage = &s_pStages[s_iStage];
198  switch (pStage->nType)
199  {
200  case STAGE_TYPE_SEQUENCE:
201  if (pStage->uMessages[s_iStep] == uMsg)
202  {
203  ok_int(1, 1);
204  ok(s_nLevel == pStage->nLevel,
205  "Line %d, Step %d: Level expected %d but %d.\n",
206  pStage->nLine, s_iStep, pStage->nLevel, s_nLevel);
207  ok(PARENT_MSG == pStage->uParentMsg,
208  "Line %d, Step %d: PARENT_MSG expected %u but %u.\n",
209  pStage->nLine, s_iStep, pStage->uParentMsg, PARENT_MSG);
210 
211  iAction = pStage->iActions[s_iStep];
212  if (iAction)
213  DoAction(hwnd, iAction, wParam, lParam);
214 
215  ++s_iStep;
216  if (s_iStep >= pStage->nCount)
217  s_bNextStage = TRUE;
218  }
219  break;
220  case STAGE_TYPE_COUNTING:
221  for (i = 0; i < pStage->nCount; ++i)
222  {
223  if (pStage->uMessages[i] == uMsg)
224  {
225  ok_int(1, 1);
226  ok(s_nLevel == pStage->nLevel,
227  "Line %d: Level expected %d but %d.\n",
228  pStage->nLine, pStage->nLevel, s_nLevel);
229  ok(PARENT_MSG == pStage->uParentMsg,
230  "Line %d: PARENT_MSG expected %u but %u.\n",
231  pStage->nLine, pStage->uParentMsg, PARENT_MSG);
232 
233  iAction = pStage->iActions[i];
234  if (iAction)
235  DoAction(hwnd, iAction, wParam, lParam);
236 
237  ++s_nCounters[i];
238 
239  if (i == pStage->nCount - 1)
240  s_bNextStage = TRUE;
241  break;
242  }
243  }
244  break;
245  }
246 
247  if (s_bNextStage)
248  {
249  NextStage(hwnd);
250  }
251 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
INT iActions[10]
UINT uMsg
Definition: menu.cpp:213
static const STAGE * s_pStages
#define TRUE
Definition: types.h:120
static INT s_nLevel
static void NextStage(HWND hwnd)
int32_t INT
Definition: typedefs.h:58
static BOOL s_bNextStage
WPARAM wParam
Definition: combotst.c:138
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static INT s_nCounters[10]
#define FALSE
Definition: types.h:117
#define ok_int(expression, result)
Definition: atltest.h:134
static INT s_iStage
static INT s_cStages
STAGE_TYPE nType
#define ok(value,...)
Definition: atltest.h:57
UINT uMessages[10]
static void DoAction(HWND hwnd, INT iAction, WPARAM wParam, LPARAM lParam)
static INT s_iStep
LPARAM lParam
Definition: combotst.c:139
#define PARENT_MSG

Referenced by WindowProc().

◆ General_DoTest()

static void General_DoTest ( void  )
static

Definition at line 357 of file MessageStateAnalyzer.c.

358 {
359  WNDCLASSA wc;
360  HWND hwnd;
361  MSG msg;
362  static const char s_szName[] = "MessageStateAnalyzerGeneral";
363 
364  trace("General_DoTest\n");
366 
367  /* register window class */
368  ZeroMemory(&wc, sizeof(wc));
370  wc.lpfnWndProc = WindowProc;
374  wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
375  wc.lpszClassName = s_szName;
376  if (!RegisterClassA(&wc))
377  {
378  skip("RegisterClassW failed.\n");
379  return;
380  }
381 
382  /* create a window */
384  0, 0, WIDTH, HEIGHT, NULL, NULL,
386  if (!hwnd)
387  {
388  skip("CreateWindowW failed.\n");
389  return;
390  }
391 
392  /* message loop */
393  while (GetMessageA(&msg, NULL, 0, 0))
394  {
397  }
398 
400 
401  DoFinish();
402 }
#define WIDTH
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1648
#define CS_HREDRAW
Definition: winuser.h:648
#define IDI_APPLICATION
Definition: winuser.h:699
HBRUSH hbrBackground
Definition: winuser.h:3145
static void DoFinish(void)
#define COLOR_3DFACE
Definition: winuser.h:919
static const STAGE s_GeneralStages[]
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
HCURSOR hCursor
Definition: winuser.h:3144
smooth NULL
Definition: ftsmooth.c:416
#define ok_int(expression, result)
Definition: atltest.h:134
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define CS_VREDRAW
Definition: winuser.h:653
#define trace
Definition: atltest.h:70
#define HEIGHT
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define CS_DBLCLKS
Definition: winuser.h:646
LPCSTR lpszClassName
Definition: winuser.h:3147
#define LoadCursor
Definition: winuser.h:5787
UINT style
Definition: winuser.h:3138
HINSTANCE hInstance
Definition: winuser.h:3142
static WCHAR s_szName[MAX_PATH]
Definition: find.c:34
static void DoInitialize(const STAGE *pStages, INT cStages)
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define skip(...)
Definition: atltest.h:64
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define LoadIcon
Definition: winuser.h:5788
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

Referenced by START_TEST().

◆ IME_DoTest()

static void IME_DoTest ( void  )
static

Definition at line 523 of file MessageStateAnalyzer.c.

524 {
525  WNDCLASSA wc;
526  HWND hwnd;
527  MSG msg;
528  static const char s_szName[] = "MessageStateAnalyzerIME";
529 
530  trace("IME_DoTest\n");
532 
533  /* register window class */
534  ZeroMemory(&wc, sizeof(wc));
536  wc.lpfnWndProc = WindowProc;
540  wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
541  wc.lpszClassName = s_szName;
542  if (!RegisterClassA(&wc))
543  {
544  skip("RegisterClassW failed.\n");
545  return;
546  }
547 
548  /* create a window */
550  0, 0, WIDTH, HEIGHT, NULL, NULL,
552  if (!hwnd)
553  {
554  skip("CreateWindowW failed.\n");
555  return;
556  }
557 
558  /* message loop */
559  while (GetMessageA(&msg, NULL, 0, 0))
560  {
563  }
564 
566 
567  DoFinish();
568 }
#define WIDTH
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1648
#define CS_HREDRAW
Definition: winuser.h:648
#define IDI_APPLICATION
Definition: winuser.h:699
HBRUSH hbrBackground
Definition: winuser.h:3145
static void DoFinish(void)
#define COLOR_3DFACE
Definition: winuser.h:919
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
HCURSOR hCursor
Definition: winuser.h:3144
smooth NULL
Definition: ftsmooth.c:416
#define ok_int(expression, result)
Definition: atltest.h:134
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define CS_VREDRAW
Definition: winuser.h:653
#define trace
Definition: atltest.h:70
#define HEIGHT
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define CS_DBLCLKS
Definition: winuser.h:646
LPCSTR lpszClassName
Definition: winuser.h:3147
#define LoadCursor
Definition: winuser.h:5787
UINT style
Definition: winuser.h:3138
HINSTANCE hInstance
Definition: winuser.h:3142
static WCHAR s_szName[MAX_PATH]
Definition: find.c:34
static void DoInitialize(const STAGE *pStages, INT cStages)
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define skip(...)
Definition: atltest.h:64
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define LoadIcon
Definition: winuser.h:5788
static const STAGE s_IMEStages[]
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

Referenced by START_TEST().

◆ InnerWindowProc()

static LRESULT CALLBACK InnerWindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 254 of file MessageStateAnalyzer.c.

255 {
256  switch (uMsg)
257  {
258  case WM_COMMAND:
259  DoAction(hwnd, LOWORD(wParam), 0, 0);
260  break;
261  case WM_TIMER:
263  if (wParam == TIMEOUT_TIMER)
265  break;
266  case WM_DESTROY:
267  PostQuitMessage(0);
268  break;
269  case WM_NCCREATE:
271  /* FALL THROUGH */
272  default:
273  return DefWindowProc(hwnd, uMsg, wParam, lParam);
274  }
275  return 0;
276 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT uMsg
Definition: menu.cpp:213
#define WM_NCCREATE
Definition: winuser.h:1665
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_TIMER
Definition: winuser.h:1724
#define TIMEOUT_TIMER
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_COMMAND
Definition: winuser.h:1722
unsigned int UINT
Definition: ndis.h:50
static void DoAction(HWND hwnd, INT iAction, WPARAM wParam, LPARAM lParam)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define TOTAL_TIMEOUT

Referenced by WindowProc().

◆ MsgDumpPrintf()

static void MsgDumpPrintf ( LPCSTR  fmt,
  ... 
)
static

Definition at line 13 of file MessageStateAnalyzer.c.

14 {
15  static char s_szText[1024];
16  va_list va;
17  va_start(va, fmt);
18  StringCbVPrintfA(s_szText, sizeof(s_szText), fmt, va);
19  trace("%s", s_szText);
20  va_end(va);
21 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define trace
Definition: atltest.h:70
STRSAFEAPI StringCbVPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat, va_list argList)
Definition: strsafe.h:502
#define va_start(ap, A)
Definition: acmsvcex.h:91
Definition: dsound.c:943

◆ NextStage()

static void NextStage ( HWND  hwnd)
static

Definition at line 152 of file MessageStateAnalyzer.c.

153 {
154  INT i, iAction;
155  const STAGE *pStage = &s_pStages[s_iStage];
156 
157  if (pStage->nType == STAGE_TYPE_COUNTING)
158  {
159  /* check counters */
160  for (i = 0; i < pStage->nCount; ++i)
161  {
162  if (pStage->nCounters[i] > 0)
163  {
164  ok(pStage->nCounters[i] == s_nCounters[i],
165  "Line %d: s_nCounters[%d] expected %d but %d.\n",
166  pStage->nLine, i, pStage->nCounters[i], s_nCounters[i]);
167  }
168  }
169  }
170 
171  /* go to next stage */
172  ++s_iStage;
173  if (s_iStage >= s_cStages)
174  {
176  return;
177  }
178  trace("Stage %d (Line %d)\n", s_iStage, s_pStages[s_iStage].nLine);
179 
180  s_iStep = 0;
182 
183  iAction = s_pStages[s_iStage].iFirstAction;
184  if (iAction)
185  PostMessage(hwnd, WM_COMMAND, iAction, 0);
186 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const STAGE * s_pStages
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:58
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static INT s_nCounters[10]
#define PostMessage
Definition: winuser.h:5807
#define trace
Definition: atltest.h:70
static INT s_iStage
#define WM_COMMAND
Definition: winuser.h:1722
static INT s_cStages
STAGE_TYPE nType
INT nCounters[10]
#define ok(value,...)
Definition: atltest.h:57
static INT s_iStep

Referenced by DoStage().

◆ START_TEST()

START_TEST ( MessageStateAnalyzer  )

Definition at line 570 of file MessageStateAnalyzer.c.

571 {
572  General_DoTest();
573  IME_DoTest();
574 }
static void General_DoTest(void)
static void IME_DoTest(void)

◆ WindowProc()

static LRESULT CALLBACK WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 329 of file MessageStateAnalyzer.c.

330 {
331  LRESULT lResult;
332 
333  /* Skip asynchronous WM_TIMER messages */
334  if (uMsg == WM_TIMER) return InnerWindowProc(hwnd, uMsg, wParam, lParam);
335 
336  /* build s_prefix */
337  DoBuildPrefix();
338 
339  /* message dump */
341 
342  ++s_nLevel;
344  {
345  /* do inner task */
347  lResult = InnerWindowProc(hwnd, uMsg, wParam, lParam);
348  }
349  --s_nLevel;
350 
351  /* message return */
352  StringCbCopyA(s_prefix, sizeof(s_prefix), "R: ");
353  MD_msgresult(hwnd, uMsg, wParam, lParam, lResult);
354  return lResult;
355 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT uMsg
Definition: menu.cpp:213
static void DoBuildPrefix(void)
static INT s_nLevel
static void DoStage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WPARAM wParam
Definition: combotst.c:138
STRSAFEAPI StringCbCopyA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:161
static LRESULT CALLBACK InnerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static UINT s_msgStack[32]
#define WM_TIMER
Definition: winuser.h:1724
static char s_prefix[16]
static __inline LRESULT MSGDUMP_API MD_msgresult(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT lResult)
Definition: msgdump.h:5359
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
static __inline LRESULT MSGDUMP_API MD_msgdump(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: msgdump.h:4655

Referenced by General_DoTest(), and IME_DoTest().

Variable Documentation

◆ s_bNextStage

BOOL s_bNextStage
static

Definition at line 50 of file MessageStateAnalyzer.c.

Referenced by DoInitialize(), and DoStage().

◆ s_cStages

INT s_cStages
static

Definition at line 54 of file MessageStateAnalyzer.c.

Referenced by DoFinish(), DoInitialize(), DoStage(), and NextStage().

◆ s_GeneralStages

const STAGE s_GeneralStages[]
static
Initial value:
=
{
{
__LINE__, WM_NULL, 1, STAGE_TYPE_SEQUENCE, 0,
4,
},
{
6,
},
{
6,
},
{
__LINE__, WM_COMMAND, 2, STAGE_TYPE_SEQUENCE, 0,
2,
},
}
#define WM_NULL
Definition: winuser.h:1589
#define WM_NCCALCSIZE
Definition: winuser.h:1667
#define WM_SHOWWINDOW
Definition: winuser.h:1610
#define WM_NCCREATE
Definition: winuser.h:1665
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define WM_ACTIVATE
Definition: winuser.h:1594
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define WM_CREATE
Definition: winuser.h:1590
#define WM_GETMINMAXINFO
Definition: winuser.h:1622

Definition at line 299 of file MessageStateAnalyzer.c.

Referenced by General_DoTest().

◆ s_IMEStages

const STAGE s_IMEStages[]
static

Definition at line 404 of file MessageStateAnalyzer.c.

Referenced by IME_DoTest().

◆ s_iStage

INT s_iStage
static

Definition at line 47 of file MessageStateAnalyzer.c.

Referenced by DoFinish(), DoInitialize(), DoStage(), and NextStage().

◆ s_iStep

INT s_iStep
static

Definition at line 48 of file MessageStateAnalyzer.c.

Referenced by DoAction(), DoFinish(), DoInitialize(), DoStage(), and NextStage().

◆ s_msgStack

UINT s_msgStack[32]
static

Definition at line 52 of file MessageStateAnalyzer.c.

Referenced by DoInitialize(), and WindowProc().

◆ s_nCounters

INT s_nCounters[10]
static

Definition at line 51 of file MessageStateAnalyzer.c.

Referenced by DoInitialize(), DoStage(), and NextStage().

◆ s_nLevel

INT s_nLevel
static

Definition at line 49 of file MessageStateAnalyzer.c.

Referenced by DoInitialize(), DoStage(), and WindowProc().

◆ s_prefix

char s_prefix[16] = ""
static

Definition at line 23 of file MessageStateAnalyzer.c.

Referenced by DoBuildPrefix(), and WindowProc().

◆ s_pStages

const STAGE* s_pStages
static

Definition at line 53 of file MessageStateAnalyzer.c.

Referenced by DoInitialize(), DoStage(), and NextStage().