ReactOS 0.4.15-dev-8127-g6338913
SystemMenu.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4 * PURPOSE: Tests for system menu messages, based on msg.c Wine test
5 * COPYRIGHT: Copyright 1999 Ove Kaaven <ovek@transgaming.com>
6 * Copyright 2003 Dimitrie O. Paun <dimi@lattica.com>
7 * Copyright 2004-2005, 2016 Dmitry Timoshkov <dmitry@baikal.ru>
8 * Copyright 2023 Egor Ananyin <ananinegor@gmail.com>
9 */
10
11#include "precomp.h"
12
13#define WND_PARENT_ID 1
14#define WND_POPUP_ID 2
15
16static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
17static BOOL (WINAPI *pQueryActCtxW)(DWORD, HANDLE, void *, ULONG, void *, SIZE_T, SIZE_T *);
18
21static HHOOK hKBD_hook;
22static HHOOK hCBT_hook;
24
25typedef enum
26{
27 sent = 0x1,
28 posted = 0x2,
29 parent = 0x4,
30 wparam = 0x8,
31 lparam = 0x10,
32 defwinproc = 0x20,
33 beginpaint = 0x40,
34 optional = 0x80,
35 hook = 0x100,
37 kbd_hook = 0x400
39
40struct message
41{
42 UINT message; /* the WM_* code */
43 msg_flags_t flags; /* message props */
44 WPARAM wParam; /* expected value of wParam */
45 LPARAM lParam; /* expected value of lParam */
46 WPARAM wp_mask; /* mask for wParam checks */
47 LPARAM lp_mask; /* mask for lParam checks */
48};
49
51{
52 UINT message; /* the WM_* code */
53 msg_flags_t flags; /* message props */
54 HWND hwnd; /* window that received the message */
55 WPARAM wParam; /* expected value of wParam */
56 LPARAM lParam; /* expected value of lParam */
57 int line; /* source line where logged */
58 const char *descr; /* description for trace output */
59 char output[512]; /* trace output */
60};
61
63static struct recvd_message* sequence;
65
66/* user32 functions */
67static HWND (WINAPI *pGetAncestor)(HWND, UINT);
68static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
69
70static void init_procs(void)
71{
72 HMODULE user32 = GetModuleHandleA("user32.dll");
73
74#define GET_PROC(dll, func) \
75 p ## func = (void*)GetProcAddress(dll, #func); \
76 if (!p ## func) { \
77 trace("GetProcAddress(%s) failed\n", #func); \
78 }
79
80 GET_PROC(user32, GetAncestor)
82
83#undef GET_PROC
84}
85
87{
88 /* these are always ignored */
89 return (message >= 0xc000 ||
90 message == WM_GETICON ||
91 message == WM_GETOBJECT ||
93 message == WM_DISPLAYCHANGE ||
96}
97
98#define add_message(msg) add_message_(__LINE__, msg);
99static void add_message_(int line, const struct recvd_message *msg)
100{
101 struct recvd_message *seq;
102
104 if (!sequence)
105 {
106 sequence_size = 10;
108 }
110 {
111 sequence_size *= 2;
113 }
115
116 seq = &sequence[sequence_cnt++];
117 seq->hwnd = msg->hwnd;
118 seq->message = msg->message;
119 seq->flags = msg->flags;
120 seq->wParam = msg->wParam;
121 seq->lParam = msg->lParam;
122 seq->line = line;
123 seq->descr = msg->descr;
124 seq->output[0] = 0;
126
127 if (msg->descr)
128 {
129 if (msg->flags & hook)
130 {
131 static const char * const CBT_code_name[10] =
132 {
133 "HCBT_MOVESIZE",
134 "HCBT_MINMAX",
135 "HCBT_QS",
136 "HCBT_CREATEWND",
137 "HCBT_DESTROYWND",
138 "HCBT_ACTIVATE",
139 "HCBT_CLICKSKIPPED",
140 "HCBT_KEYSKIPPED",
141 "HCBT_SYSCOMMAND",
142 "HCBT_SETFOCUS"
143 };
144 const char *code_name = (msg->message <= HCBT_SETFOCUS ? CBT_code_name[msg->message] : "Unknown");
145
146 sprintf(seq->output, "%s: hook %d (%s) wp %08Ix lp %08Ix",
147 msg->descr, msg->message, code_name, msg->wParam, msg->lParam);
148 }
149 else if (msg->flags & winevent_hook)
150 {
151 sprintf(seq->output, "%s: winevent %p %08x %08Ix %08Ix",
152 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam);
153 }
154 else
155 {
156 if (msg->message >= 0xc000)
157 return; /* ignore registered messages */
158 sprintf(seq->output, "%s: %p %04x wp %08Ix lp %08Ix",
159 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam);
160 if (msg->flags & (sent | posted | parent | defwinproc | beginpaint))
161 sprintf(seq->output + strlen(seq->output), " (flags %x)", msg->flags);
162 }
163 }
164}
165
166/* try to make sure pending X events have been processed before continuing */
167static void flush_events(void)
168{
169 MSG msg;
170 int diff = 200;
171 int min_timeout = 100;
172 DWORD time = GetTickCount() + diff;
173
174 while (diff > 0)
175 {
176 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT)
177 break;
178 while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
180 diff = time - GetTickCount();
181 }
182}
183
184static void flush_sequence(void)
185{
188 sequence = 0;
191}
192
193static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
194{
195 const struct recvd_message *actual = sequence;
196 unsigned int count = 0;
197
198 trace_(file, line)("Failed sequence %s:\n", context);
199
200 while (expected->message && actual->message)
201 {
202 if (actual->output[0])
203 {
204 if (expected->flags & hook)
205 {
206 trace_(file, line)(" %u: expected: hook %04x - actual: %s\n",
207 count, expected->message, actual->output);
208 }
209 else if (expected->flags & winevent_hook)
210 {
211 trace_(file, line)(" %u: expected: winevent %04x - actual: %s\n",
212 count, expected->message, actual->output);
213 }
214 else if (expected->flags & kbd_hook)
215 {
216 trace_(file, line)(" %u: expected: kbd %04x - actual: %s\n",
217 count, expected->message, actual->output);
218 }
219 else
220 {
221 trace_(file, line)(" %u: expected: msg %04x - actual: %s\n",
222 count, expected->message, actual->output);
223 }
224 }
225
226 if (expected->message == actual->message)
227 {
228 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
229 (expected->flags & optional))
230 {
231 /* don't match messages if their defwinproc status differs */
232 expected++;
233 }
234 else
235 {
236 expected++;
237 actual++;
238 }
239 }
240 /* silently drop winevent messages if there is no support for them */
241 else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
242 expected++;
243 else
244 {
245 expected++;
246 actual++;
247 }
248
249 count++;
250 }
251
252 /* optional trailing messages */
253 while (expected->message && ((expected->flags & optional) ||
254 ((expected->flags & winevent_hook) && !hEvent_hook)))
255 {
256 trace_(file, line)(" %u: expected: msg %04x - actual: nothing\n", count, expected->message);
257 expected++;
258 count++;
259 }
260
261 if (expected->message)
262 {
263 trace_(file, line)(" %u: expected: msg %04x - actual: nothing\n", count, expected->message);
264 return;
265 }
266
267 while (actual->message && actual->output[0])
268 {
269 trace_(file, line)(" %u: expected: nothing - actual: %s\n", count, actual->output);
270 actual++;
271 count++;
272 }
273}
274
275#define ok_sequence(exp, contx, todo) \
276 ok_sequence_((exp), (contx), (todo), __FILE__, __LINE__)
277
278
279static void ok_sequence_(const struct message *expected_list, const char *context, BOOL todo,
280 const char *file, int line)
281{
282 static const struct recvd_message end_of_sequence;
283 const struct message *expected = expected_list;
284 const struct recvd_message *actual;
285 int failcount = 0, dump = 0;
286 unsigned int count = 0;
287
288 add_message(&end_of_sequence);
289
290 actual = sequence;
291
292 while (expected->message && actual->message)
293 {
294 if (expected->message == actual->message &&
295 !((expected->flags ^ actual->flags) & (hook | winevent_hook | kbd_hook)))
296 {
297 if (expected->flags & wparam)
298 {
299 if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
300 {
302 {
303 failcount++;
304 if (strcmp(winetest_platform, "wine"))
305 dump++;
306 ok_( file, line) (FALSE,
307 "%s: %u: in msg 0x%04x expecting wParam 0x%x got 0x%x\n",
308 context, count, expected->message, expected->wParam, actual->wParam);
309 }
310 }
311 else
312 {
313 ok_( file, line)(((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
314 "%s: %u: in msg 0x%04x expecting wParam 0x%x got 0x%x\n",
315 context, count, expected->message, expected->wParam, actual->wParam);
316 if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask)
317 dump++;
318 }
319 }
320
321 if (expected->flags & lparam)
322 {
323 if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
324 {
326 {
327 failcount++;
328 if (strcmp(winetest_platform, "wine"))
329 dump++;
330 ok_( file, line) (FALSE,
331 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
332 context, count, expected->message, expected->lParam, actual->lParam);
333 }
334 }
335 else
336 {
337 ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
338 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
339 context, count, expected->message, expected->lParam, actual->lParam);
340 if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask)
341 dump++;
342 }
343 }
344 if ((expected->flags & optional) &&
345 ((expected->flags ^ actual->flags) & (defwinproc | parent)))
346 {
347 /* don't match optional messages if their defwinproc or parent status differs */
348 expected++;
349 count++;
350 continue;
351 }
352 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
353 {
355 {
356 failcount++;
357 if (strcmp(winetest_platform, "wine"))
358 dump++;
359 ok_(file, line) (FALSE,
360 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
361 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
362 }
363 }
364 else
365 {
366 ok_(file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
367 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
368 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
369 if ((expected->flags & defwinproc) != (actual->flags & defwinproc))
370 dump++;
371 }
372
373 ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
374 "%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
375 context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
376 if ((expected->flags & beginpaint) != (actual->flags & beginpaint))
377 dump++;
378
379 ok_(file, line) ((expected->flags & (sent | posted)) == (actual->flags & (sent | posted)),
380 "%s: %u: the msg 0x%04x should have been %s\n",
381 context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
382 if ((expected->flags & (sent | posted)) != (actual->flags & (sent | posted)))
383 dump++;
384
385 ok_(file, line) ((expected->flags & parent) == (actual->flags & parent),
386 "%s: %u: the msg 0x%04x was expected in %s\n",
387 context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
388 if ((expected->flags & parent) != (actual->flags & parent))
389 dump++;
390
391 ok_(file, line) ((expected->flags & hook) == (actual->flags & hook),
392 "%s: %u: the msg 0x%04x should have been sent by a hook\n",
393 context, count, expected->message);
394 if ((expected->flags & hook) != (actual->flags & hook))
395 dump++;
396
397 ok_(file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
398 "%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
399 context, count, expected->message);
400 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook))
401 dump++;
402
403 ok_(file, line) ((expected->flags & kbd_hook) == (actual->flags & kbd_hook),
404 "%s: %u: the msg 0x%04x should have been sent by a keyboard hook\n",
405 context, count, expected->message);
406 if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook))
407 dump++;
408
409 expected++;
410 actual++;
411 }
412 /* silently drop hook messages if there is no support for them */
413 else if ((expected->flags & optional) ||
414 ((expected->flags & hook) && !hCBT_hook) ||
415 ((expected->flags & winevent_hook) && !hEvent_hook) ||
416 ((expected->flags & kbd_hook) && !hKBD_hook))
417 expected++;
418 else if (todo)
419 {
420 failcount++;
422 {
423 if (strcmp(winetest_platform, "wine"))
424 dump++;
425 ok_(file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
426 context, count, expected->message, actual->message);
427 }
428 goto done;
429 }
430 else
431 {
432 ok_(file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
433 context, count, expected->message, actual->message);
434 dump++;
435 expected++;
436 actual++;
437 }
438 count++;
439 }
440
441 /* skip all optional trailing messages */
442 while (expected->message && ((expected->flags & optional) ||
443 ((expected->flags & hook) && !hCBT_hook) ||
444 ((expected->flags & winevent_hook) && !hEvent_hook)))
445 expected++;
446
447 if (todo)
448 {
450 {
451 if (expected->message || actual->message)
452 {
453 failcount++;
454 if (strcmp(winetest_platform, "wine"))
455 dump++;
456 ok_(file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
457 context, count, expected->message, actual->message);
458 }
459 }
460 }
461 else
462 {
463 if (expected->message || actual->message)
464 {
465 dump++;
466 ok_(file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
467 context, count, expected->message, actual->message);
468 }
469 }
470 if (todo && !failcount) /* succeeded yet marked todo */
472 {
473 if (!strcmp(winetest_platform, "wine"))
474 dump++;
475 ok_(file, line) (TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
476 }
477
478done:
479 if (dump) dump_sequence(expected_list, context, file, line);
481}
482
483#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
484
485/************* window procedures ********************/
486
488{
489 static LONG defwndproc_counter = 0;
490 static LONG beginpaint_counter = 0;
491 LRESULT ret;
492 struct recvd_message msg;
493
494 if (ignore_message(message)) return 0;
495
496 msg.hwnd = hwnd;
497 msg.message = message;
498 msg.flags = sent | wparam | lparam;
499 if (defwndproc_counter) msg.flags |= defwinproc;
500 if (beginpaint_counter) msg.flags |= beginpaint;
501 msg.wParam = wParam;
502 msg.lParam = lParam;
503 msg.descr = "MsgCheckProc";
505
506 defwndproc_counter++;
507 ret = unicode ? DefWindowProcW(hwnd, message, wParam, lParam)
509 defwndproc_counter--;
510
511 return ret;
512}
513
515{
517}
518
520{
521 WNDCLASSA cls;
522
523 cls.style = 0;
525 cls.cbClsExtra = 0;
526 cls.cbWndExtra = 0;
528 cls.hIcon = 0;
531 cls.lpszMenuName = NULL;
532 cls.lpszClassName = "TestWindowClass";
533 if (!RegisterClassA(&cls)) return FALSE;
534
535 return TRUE;
536}
537
539{
540 char buf[256];
541
542 if (GetClassNameA(hwnd, buf, sizeof(buf)))
543 {
544 if (!lstrcmpiA(buf, "TestWindowClass") ||
545 !lstrcmpiA(buf, "ShowWindowClass") ||
546 !lstrcmpiA(buf, "RecursiveActivationClass") ||
547 !lstrcmpiA(buf, "TestParentClass") ||
548 !lstrcmpiA(buf, "TestPopupClass") ||
549 !lstrcmpiA(buf, "SimpleWindowClass") ||
550 !lstrcmpiA(buf, "TestDialogClass") ||
551 !lstrcmpiA(buf, "MDI_frame_class") ||
552 !lstrcmpiA(buf, "MDI_client_class") ||
553 !lstrcmpiA(buf, "MDI_child_class") ||
554 !lstrcmpiA(buf, "my_button_class") ||
555 !lstrcmpiA(buf, "my_edit_class") ||
556 !lstrcmpiA(buf, "static") ||
557 !lstrcmpiA(buf, "ListBox") ||
558 !lstrcmpiA(buf, "ComboBox") ||
559 !lstrcmpiA(buf, "MyDialogClass") ||
560 !lstrcmpiA(buf, "#32770") ||
561 !lstrcmpiA(buf, "#32768"))
562 return TRUE;
563 }
564 return FALSE;
565}
566
568{
569 HWND hwnd;
570
571 ok(cbt_hook_thread_id == GetCurrentThreadId(), "we didn't ask for events from other threads\n");
572
573 if (nCode == HCBT_CLICKSKIPPED)
574 {
575 /* ignore this event, XP sends it a lot when switching focus between windows */
576 return CallNextHookEx(hCBT_hook, nCode, wParam, lParam);
577 }
578
579 if (nCode == HCBT_SYSCOMMAND || nCode == HCBT_KEYSKIPPED)
580 {
581 struct recvd_message msg;
582
583 msg.hwnd = 0;
584 msg.message = nCode;
585 msg.flags = hook | wparam | lparam;
586 msg.wParam = wParam;
587 msg.lParam = lParam;
588 msg.descr = "CBT";
590
591 return CallNextHookEx(hCBT_hook, nCode, wParam, lParam);
592 }
593
594 if (nCode == HCBT_DESTROYWND)
595 {
597 {
599 if (style & WS_CHILD)
601 else if (style & WS_POPUP)
603 else
605 }
606 }
607
608 /* Log also SetFocus(0) calls */
610
612 {
613 struct recvd_message msg;
614
615 msg.hwnd = hwnd;
616 msg.message = nCode;
617 msg.flags = hook | wparam | lparam;
618 msg.wParam = wParam;
619 msg.lParam = lParam;
620 msg.descr = "CBT";
622 }
623 return CallNextHookEx(hCBT_hook, nCode, wParam, lParam);
624}
625
626/*************************** Menu test ******************************/
627
628static const struct message wm_popup_menu_4[] =
629{
630 { HCBT_CREATEWND, hook },
631 { WM_ENTERMENULOOP, sent | wparam | lparam, 0, 0 },
632 { WM_INITMENU, sent | lparam, 0, 0 },
633 { WM_INITMENUPOPUP, sent | lparam, 0, 0x10000 },
634 { HCBT_KEYSKIPPED, hook | wparam | lparam | optional, VK_DOWN, 0x10000001 },
635 { WM_MENUSELECT, sent, MAKEWPARAM(0,0xffff), 0 },
636 { HCBT_KEYSKIPPED, hook | wparam | lparam | optional, VK_DOWN, 0xd0000001 },
637 { HCBT_KEYSKIPPED, hook | wparam | lparam | optional, VK_ESCAPE, 0x10000001 },
639 { WM_UNINITMENUPOPUP, sent | lparam, 0, 0x20000000 },
640 { WM_MENUSELECT, sent, MAKEWPARAM(0,0xffff), 0 },
641 { WM_EXITMENULOOP, sent | wparam | lparam, 0, 0 },
642 { HCBT_KEYSKIPPED, hook | wparam | lparam | optional, VK_ESCAPE, 0xc0000001 },
643 { WM_KEYUP, sent | wparam | lparam, VK_ESCAPE, 0xc0000001 },
644 { 0 }
645};
646
648{
649 if (message == WM_ENTERIDLE ||
650 message == WM_INITMENU ||
656 message == WM_UNINITMENUPOPUP ||
657 message == WM_KEYDOWN ||
658 message == WM_KEYUP ||
659 message == WM_CHAR ||
661 message == WM_SYSKEYUP ||
662 message == WM_SYSCHAR ||
663 message == WM_COMMAND ||
664 message == WM_MENUCOMMAND)
665 {
666 struct recvd_message msg;
667
668 msg.hwnd = hwnd;
669 msg.message = message;
670 msg.flags = sent | wparam | lparam;
671 msg.wParam = wp;
672 msg.lParam = lp;
673 msg.descr = "parent_menu_proc";
675 }
676
677 return DefWindowProcA(hwnd, message, wp, lp);
678}
679
680static void test_menu_messages(void)
681{
682 MSG msg;
683 WNDCLASSA cls;
684 HWND hwnd;
685 RECT rect;
686
687 cls.style = 0;
689 cls.cbClsExtra = 0;
690 cls.cbWndExtra = 0;
692 cls.hIcon = 0;
695 cls.lpszMenuName = NULL;
696 cls.lpszClassName = "TestMenuClass";
698 if (!RegisterClassA(&cls))
699 assert(0);
700
701 SetLastError(0xdeadbeef);
702 hwnd = CreateWindowExA(0, "TestMenuClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
703 100, 100, 200, 200, 0, 0, 0, NULL);
704 ok(hwnd != 0, "LoadMenuA error %lu\n", GetLastError());
705
707 flush_events();
708
709 trace("testing system menu\n");
711 SetCursorPos(rect.left + 30, rect.top + 10);
714 mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
715 keybd_event(VK_DOWN, 0, 0, 0);
717 keybd_event(VK_ESCAPE, 0, 0, 0);
719 while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
720 {
723 }
724 ok_sequence(wm_popup_menu_4, "system menu command", FALSE);
725
727}
728
729static void init_funcs(void)
730{
731 HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
732
733#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f)
736#undef X
737}
738
739static void init_tests()
740{
741 init_funcs();
742
744 init_procs();
745
747 assert(0);
748
751 if (!hCBT_hook)
752 win_skip("cannot set global hook, will skip hook tests\n");
753}
754
755static void cleanup_tests()
756{
757 BOOL ret;
759 if (pUnhookWinEvent && hEvent_hook)
760 {
761 ret = pUnhookWinEvent(hEvent_hook);
762 ok(ret, "UnhookWinEvent error %ld\n", GetLastError());
763 SetLastError(0xdeadbeef);
764 ok(!pUnhookWinEvent(hEvent_hook), "UnhookWinEvent succeeded\n");
765 ok(GetLastError() == ERROR_INVALID_HANDLE || /* Win2k */
766 GetLastError() == 0xdeadbeef, /* Win9x */
767 "unexpected error %ld\n", GetLastError());
768 }
770}
771
772START_TEST(SystemMenu)
773{
774 init_tests();
777}
msg_flags_t
Definition: SystemMenu.c:26
@ sent
Definition: SystemMenu.c:27
@ beginpaint
Definition: SystemMenu.c:33
@ defwinproc
Definition: SystemMenu.c:32
@ kbd_hook
Definition: SystemMenu.c:37
@ parent
Definition: SystemMenu.c:29
@ posted
Definition: SystemMenu.c:28
@ lparam
Definition: SystemMenu.c:31
@ hook
Definition: SystemMenu.c:35
@ winevent_hook
Definition: SystemMenu.c:36
@ wparam
Definition: SystemMenu.c:30
@ optional
Definition: SystemMenu.c:34
static void cleanup_tests()
Definition: SystemMenu.c:755
#define add_message(msg)
Definition: SystemMenu.c:98
static LRESULT MsgCheckProc(BOOL unicode, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: SystemMenu.c:487
static HWINEVENTHOOK hEvent_hook
Definition: SystemMenu.c:20
static void init_procs(void)
Definition: SystemMenu.c:70
#define X(f)
#define GET_PROC(dll, func)
static HANDLE
Definition: SystemMenu.c:17
static BOOL ignore_message(UINT message)
Definition: SystemMenu.c:86
static CRITICAL_SECTION sequence_cs
Definition: SystemMenu.c:64
static HHOOK hKBD_hook
Definition: SystemMenu.c:21
static void test_menu_messages(void)
Definition: SystemMenu.c:680
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: SystemMenu.c:514
static int sequence_size
Definition: SystemMenu.c:62
static void flush_sequence(void)
Definition: SystemMenu.c:184
static void ULONG
Definition: SystemMenu.c:17
static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
Definition: SystemMenu.c:567
#define WND_PARENT_ID
Definition: SystemMenu.c:13
static HHOOK hCBT_hook
Definition: SystemMenu.c:22
static void init_tests()
Definition: SystemMenu.c:739
static void flush_events(void)
Definition: SystemMenu.c:167
#define WND_POPUP_ID
Definition: SystemMenu.c:14
static DWORD cbt_hook_thread_id
Definition: SystemMenu.c:23
static const struct message wm_popup_menu_4[]
Definition: SystemMenu.c:628
static struct recvd_message * sequence
Definition: SystemMenu.c:63
static int sequence_cnt
Definition: SystemMenu.c:62
static LRESULT WINAPI parent_menu_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
Definition: SystemMenu.c:647
static BOOL is_our_logged_class(HWND hwnd)
Definition: SystemMenu.c:538
static void add_message_(int line, const struct recvd_message *msg)
Definition: SystemMenu.c:99
static void init_funcs(void)
Definition: SystemMenu.c:729
static void void SIZE_T *static BOOL test_DestroyWindow_flag
Definition: SystemMenu.c:19
static BOOL RegisterWindowClasses(void)
Definition: SystemMenu.c:519
static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
Definition: SystemMenu.c:193
static void ok_sequence_(const struct message *expected_list, const char *context, BOOL todo, const char *file, int line)
Definition: SystemMenu.c:279
static void void SIZE_T
Definition: SystemMenu.c:17
static UINT
Definition: SystemMenu.c:67
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Arabic default style
Definition: afstyles.h:94
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
HANDLE HWND
Definition: compat.h:19
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI QueryActCtxW(IN DWORD dwFlags, IN HANDLE hActCtx, IN PVOID pvSubInstance, IN ULONG ulInfoClass, IN PVOID pvBuffer, IN SIZE_T cbBuffer, IN OUT SIZE_T *pcbWrittenOrRequired OPTIONAL)
Definition: actctx.c:328
BOOL WINAPI GetCurrentActCtx(OUT PHANDLE phActCtx)
Definition: actctx.c:298
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
#define assert(x)
Definition: debug.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define trace_(file, line,...)
Definition: kmt_test.h:223
__u16 time
Definition: mkdosfs.c:8
HANDLE hKernel32
Definition: locale.c:13
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
#define todo_wine
Definition: custom.c:79
msg_flags_t
Definition: msg.c:136
static HWINEVENTHOOK(WINAPI *pSetWinEventHook)(DWORD
static void dump(const void *ptr, unsigned len)
Definition: msc.c:95
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
const char * winetest_platform
#define win_skip
Definition: test.h:163
& rect
Definition: startmenu.cpp:1413
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
Definition: http.c:7252
Definition: fci.c:127
Definition: parser.c:49
Definition: tftpd.h:60
UINT message
Definition: SystemMenu.c:42
WPARAM wp_mask
Definition: SystemMenu.c:46
LPARAM lp_mask
Definition: SystemMenu.c:47
msg_flags_t flags
Definition: SystemMenu.c:43
WPARAM wParam
Definition: SystemMenu.c:55
const char * descr
Definition: SystemMenu.c:58
char output[512]
Definition: SystemMenu.c:59
msg_flags_t flags
Definition: SystemMenu.c:53
LPARAM lParam
Definition: SystemMenu.c:56
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int ret
BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define WM_KEYUP
Definition: winuser.h:1716
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define WM_DWMNCRENDERINGCHANGED
Definition: winuser.h:1885
#define WM_COMMAND
Definition: winuser.h:1740
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define IDC_ARROW
Definition: winuser.h:687
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define QS_ALLINPUT
Definition: winuser.h:903
#define MOUSEEVENTF_RIGHTUP
Definition: winuser.h:1187
#define WM_INITMENU
Definition: winuser.h:1745
#define GetWindowLongPtrA
Definition: winuser.h:4828
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WH_CBT
Definition: winuser.h:35
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2693
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define HCBT_CREATEWND
Definition: winuser.h:58
HHOOK WINAPI SetWindowsHookExA(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
#define WM_TIMECHANGE
Definition: winuser.h:1634
#define WM_SYSCHAR
Definition: winuser.h:1721
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define WM_ENTERMENULOOP
Definition: winuser.h:1804
#define WM_INITMENUPOPUP
Definition: winuser.h:1746
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define HCBT_SETFOCUS
Definition: winuser.h:64
#define PM_REMOVE
Definition: winuser.h:1196
#define HCBT_CLICKSKIPPED
Definition: winuser.h:61
#define WM_SYSKEYUP
Definition: winuser.h:1720
#define WM_EXITMENULOOP
Definition: winuser.h:1805
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define WM_CHAR
Definition: winuser.h:1717
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define VK_DOWN
Definition: winuser.h:2227
#define MOUSEEVENTF_RIGHTDOWN
Definition: winuser.h:1186
#define GWLP_ID
Definition: winuser.h:860
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_KEYDOWN
Definition: winuser.h:1715
#define WM_PARENTNOTIFY
Definition: winuser.h:1803
#define GWL_STYLE
Definition: winuser.h:852
#define WM_MENUSELECT
Definition: winuser.h:1747
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_ENTERIDLE
Definition: winuser.h:1749
BOOL WINAPI DestroyWindow(_In_ HWND)
#define KEYEVENTF_KEYUP
Definition: winuser.h:1102
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
#define WM_SYSKEYDOWN
Definition: winuser.h:1719
#define HCBT_SYSCOMMAND
Definition: winuser.h:63
#define HCBT_KEYSKIPPED
Definition: winuser.h:62
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2121
const char * LPCSTR
Definition: xmlstorage.h:183