ReactOS 0.4.15-dev-7907-g95bf896
NtUserGetThreadState.c File Reference
#include "../win32nt.h"
#include <pseh/pseh2.h>
Include dependency graph for NtUserGetThreadState.c:

Go to the source code of this file.

Macros

#define MAX_COUNT   8
 
#define IGNORED   0xDEADFACE
 
#define RAISED   0xBADBEEF
 
#define DO_CHECK(i, value)   CheckThreadState(__LINE__, (i), (DWORD_PTR)(value))
 

Functions

static VOID CheckThreadState (INT lineno, INT i, DWORD_PTR dwState)
 
static VOID DoTest_EDIT (VOID)
 
static VOID DoTest_BUTTON (VOID)
 
 START_TEST (NtUserGetThreadState)
 

Macro Definition Documentation

◆ DO_CHECK

#define DO_CHECK (   i,
  value 
)    CheckThreadState(__LINE__, (i), (DWORD_PTR)(value))

Definition at line 14 of file NtUserGetThreadState.c.

◆ IGNORED

#define IGNORED   0xDEADFACE

Definition at line 12 of file NtUserGetThreadState.c.

◆ MAX_COUNT

#define MAX_COUNT   8

Definition at line 11 of file NtUserGetThreadState.c.

◆ RAISED

#define RAISED   0xBADBEEF

Definition at line 13 of file NtUserGetThreadState.c.

Function Documentation

◆ CheckThreadState()

static VOID CheckThreadState ( INT  lineno,
INT  i,
DWORD_PTR  dwState 
)
static

Definition at line 51 of file NtUserGetThreadState.c.

52{
53 DWORD_PTR dwValue;
54
56 {
58 }
60 {
61 dwValue = RAISED;
62 }
64
65 if (dwState != IGNORED)
66 {
67 ok(dwValue == dwState, "Line %d: Mismatch 0x%lX vs. 0x%lX\n",
68 lineno, (DWORD)dwValue, (DWORD)dwState);
69 }
70}
#define IGNORED
#define RAISED
#define ok(value,...)
Definition: atltest.h:57
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:240
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65

◆ DoTest_BUTTON()

static VOID DoTest_BUTTON ( VOID  )
static

Definition at line 194 of file NtUserGetThreadState.c.

195{
196 HWND hWnd, hImeWnd;
197 HIMC hIMC;
198 HCURSOR hCursor;
199 LPARAM ExtraInfo;
200 LONG MsgTime;
201
202 hWnd = CreateWindowA("BUTTON", "Test", BS_PUSHBUTTON | WS_VISIBLE,
203 0, 0, 50, 30,
205 hImeWnd = ImmGetDefaultIMEWnd(hWnd);
206 ok_int(hImeWnd != NULL, TRUE);
207
208 hIMC = ImmGetContext(hWnd);
209 ok_int(hIMC != NULL, FALSE);
210
211 hIMC = (HIMC)NtUserGetThreadState(4);
212 ok_int(hIMC != NULL, TRUE);
213 hCursor = GetCursor();
214 ExtraInfo = GetMessageExtraInfo();
215 MsgTime = GetMessageTime();
216
217#ifdef DO_PRINT
218 PrintThreadState(__LINE__, hWnd);
219#endif
220 DO_CHECK(0, hWnd);
221 DO_CHECK(1, hWnd);
222 DO_CHECK(2, 0);
223 DO_CHECK(3, hImeWnd);
224 DO_CHECK(4, hIMC);
225 DO_CHECK(6, hCursor);
226 DO_CHECK(8, ExtraInfo);
227 DO_CHECK(10, MsgTime);
228
230 hCursor = GetCursor();
231 ExtraInfo = GetMessageExtraInfo();
232 MsgTime = GetMessageTime();
233
234#ifdef DO_PRINT
235 PrintThreadState(__LINE__, hWnd);
236#endif
237 DO_CHECK(0, hWnd);
238 DO_CHECK(1, hWnd);
239 DO_CHECK(2, hWnd);
240 DO_CHECK(3, hImeWnd);
241 DO_CHECK(4, hIMC);
242 DO_CHECK(6, hCursor);
243 DO_CHECK(8, ExtraInfo);
244 DO_CHECK(10, MsgTime);
245
247 hCursor = GetCursor();
248 ExtraInfo = GetMessageExtraInfo();
249 MsgTime = GetMessageTime();
250
251#ifdef DO_PRINT
252 PrintThreadState(__LINE__, hWnd);
253#endif
254 DO_CHECK(0, hWnd);
255 DO_CHECK(1, hWnd);
256 DO_CHECK(2, 0);
257 DO_CHECK(3, hImeWnd);
258 DO_CHECK(4, hIMC);
259 DO_CHECK(6, hCursor);
260 DO_CHECK(8, ExtraInfo);
261 DO_CHECK(10, MsgTime);
262
263 SetFocus(hWnd);
264 hCursor = GetCursor();
265 ExtraInfo = GetMessageExtraInfo();
266 MsgTime = GetMessageTime();
267
268#ifdef DO_PRINT
269 PrintThreadState(__LINE__, hWnd);
270#endif
271 DO_CHECK(0, hWnd);
272 DO_CHECK(1, hWnd);
273 DO_CHECK(2, 0);
274 DO_CHECK(3, hImeWnd);
275 DO_CHECK(4, hIMC);
276 DO_CHECK(6, hCursor);
277 DO_CHECK(8, ExtraInfo);
278 DO_CHECK(10, MsgTime);
279
281 hCursor = GetCursor();
282 ExtraInfo = GetMessageExtraInfo();
283 MsgTime = GetMessageTime();
284
285#ifdef DO_PRINT
286 PrintThreadState(__LINE__, hWnd);
287#endif
288 DO_CHECK(0, hWnd);
289 DO_CHECK(1, hWnd);
290 DO_CHECK(2, 0);
291 DO_CHECK(3, hImeWnd);
292 DO_CHECK(4, hIMC);
293 DO_CHECK(6, hCursor);
294 DO_CHECK(8, ExtraInfo);
295 DO_CHECK(10, MsgTime);
296
298 hCursor = GetCursor();
299 ExtraInfo = GetMessageExtraInfo();
300 MsgTime = GetMessageTime();
301
302#ifdef DO_PRINT
303 PrintThreadState(__LINE__, hWnd);
304#endif
305 DO_CHECK(0, IGNORED);
306 DO_CHECK(1, IGNORED);
307 DO_CHECK(2, 0);
308 DO_CHECK(3, hImeWnd);
309 DO_CHECK(4, hIMC);
310 DO_CHECK(6, hCursor);
311 DO_CHECK(8, ExtraInfo);
312 DO_CHECK(10, MsgTime);
313
315}
#define DO_CHECK(i, value)
#define ok_int(expression, result)
Definition: atltest.h:134
HWND hWnd
Definition: settings.c:17
DWORD HIMC
Definition: dimm.idl:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
Definition: ime.c:890
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1044
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define BS_PUSHBUTTON
Definition: pedump.c:651
LONG_PTR LPARAM
Definition: windef.h:208
HICON HCURSOR
Definition: windef.h:299
HCURSOR WINAPI GetCursor(void)
Definition: cursoricon.c:2684
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI SetActiveWindow(_In_ HWND)
LONG WINAPI GetMessageTime(void)
Definition: message.c:1361
LPARAM WINAPI GetMessageExtraInfo(void)
Definition: message.c:1340
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ DoTest_EDIT()

static VOID DoTest_EDIT ( VOID  )
static

Definition at line 72 of file NtUserGetThreadState.c.

73{
74 HWND hWnd, hImeWnd;
75 HIMC hIMC;
76 HCURSOR hCursor;
77 LPARAM ExtraInfo;
78 LONG MsgTime;
79
80 hWnd = CreateWindowA("EDIT", "Test", ES_LEFT | ES_MULTILINE | WS_VISIBLE,
81 0, 0, 50, 30,
83 hImeWnd = ImmGetDefaultIMEWnd(hWnd);
84 ok_int(hImeWnd != NULL, TRUE);
85
86 hIMC = ImmGetContext(hWnd);
87 ok_int(hIMC != NULL, TRUE);
89 hCursor = GetCursor();
90 ExtraInfo = GetMessageExtraInfo();
91 MsgTime = GetMessageTime();
92
93#ifdef DO_PRINT
94 PrintThreadState(__LINE__, hWnd);
95#endif
96 DO_CHECK(0, hWnd);
97 DO_CHECK(1, hWnd);
98 DO_CHECK(2, 0);
99 DO_CHECK(3, hImeWnd);
100 DO_CHECK(4, hIMC);
101 DO_CHECK(6, hCursor);
102 DO_CHECK(8, ExtraInfo);
103 DO_CHECK(10, MsgTime);
104
106 hCursor = GetCursor();
107 ExtraInfo = GetMessageExtraInfo();
108 MsgTime = GetMessageTime();
109
110#ifdef DO_PRINT
111 PrintThreadState(__LINE__, hWnd);
112#endif
113 DO_CHECK(0, hWnd);
114 DO_CHECK(1, hWnd);
115 DO_CHECK(2, hWnd);
116 DO_CHECK(3, hImeWnd);
117 DO_CHECK(4, hIMC);
118 DO_CHECK(6, hCursor);
119 DO_CHECK(8, ExtraInfo);
120 DO_CHECK(10, MsgTime);
121
123 hCursor = GetCursor();
124 ExtraInfo = GetMessageExtraInfo();
125 MsgTime = GetMessageTime();
126
127#ifdef DO_PRINT
128 PrintThreadState(__LINE__, hWnd);
129#endif
130 DO_CHECK(0, hWnd);
131 DO_CHECK(1, hWnd);
132 DO_CHECK(2, 0);
133 DO_CHECK(3, hImeWnd);
134 DO_CHECK(4, hIMC);
135 DO_CHECK(6, hCursor);
136 DO_CHECK(8, ExtraInfo);
137 DO_CHECK(10, MsgTime);
138
139 SetFocus(hWnd);
140 hCursor = GetCursor();
141 ExtraInfo = GetMessageExtraInfo();
142 MsgTime = GetMessageTime();
143
144#ifdef DO_PRINT
145 PrintThreadState(__LINE__, hWnd);
146#endif
147 DO_CHECK(0, hWnd);
148 DO_CHECK(1, hWnd);
149 DO_CHECK(2, 0);
150 DO_CHECK(3, hImeWnd);
151 DO_CHECK(4, hIMC);
152 DO_CHECK(6, hCursor);
153 DO_CHECK(8, ExtraInfo);
154 DO_CHECK(10, MsgTime);
155
157 hCursor = GetCursor();
158 ExtraInfo = GetMessageExtraInfo();
159 MsgTime = GetMessageTime();
160
161#ifdef DO_PRINT
162 PrintThreadState(__LINE__, hWnd);
163#endif
164 DO_CHECK(0, hWnd);
165 DO_CHECK(1, hWnd);
166 DO_CHECK(2, 0);
167 DO_CHECK(3, hImeWnd);
168 DO_CHECK(4, hIMC);
169 DO_CHECK(6, hCursor);
170 DO_CHECK(8, ExtraInfo);
171 DO_CHECK(10, MsgTime);
172
174 hCursor = GetCursor();
175 ExtraInfo = GetMessageExtraInfo();
176 MsgTime = GetMessageTime();
177
178#ifdef DO_PRINT
179 PrintThreadState(__LINE__, hWnd);
180#endif
181 DO_CHECK(0, IGNORED);
182 DO_CHECK(1, IGNORED);
183 DO_CHECK(2, 0);
184 DO_CHECK(3, hImeWnd);
185 DO_CHECK(4, hIMC);
186 DO_CHECK(6, hCursor);
187 DO_CHECK(8, ExtraInfo);
188 DO_CHECK(10, MsgTime);
189
190 ImmReleaseContext(hWnd, hIMC);
192}
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1085
#define ES_LEFT
Definition: pedump.c:664
#define ES_MULTILINE
Definition: pedump.c:667

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( NtUserGetThreadState  )

Definition at line 317 of file NtUserGetThreadState.c.

318{
319 DoTest_EDIT();
321}
static VOID DoTest_EDIT(VOID)
static VOID DoTest_BUTTON(VOID)