ReactOS 0.4.15-dev-7928-g68a8619
message.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Messages
5 * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
6 */
7
8#include <win32k.h>
9
10#include <dde.h>
11
13
14#define PM_BADMSGFLAGS ~((QS_RAWINPUT << 16)|PM_QS_SENDMESSAGE|PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_QS_INPUT|PM_NOYIELD|PM_REMOVE)
15
16/* FUNCTIONS *****************************************************************/
17
20{
21 return STATUS_SUCCESS;
22}
23
26{
27 return STATUS_SUCCESS;
28}
29
30/* From wine: */
31/* flag for messages that contain pointers */
32/* 32 messages per entry, messages 0..31 map to bits 0..31 */
33
34#define SET(msg) (1 << ((msg) & 31))
35
36static const unsigned int message_pointer_flags[] =
37{
38 /* 0x00 - 0x1f */
41 /* 0x20 - 0x3f */
44 /* 0x40 - 0x5f */
46 /* 0x60 - 0x7f */
47 SET(WM_STYLECHANGING) | SET(WM_STYLECHANGED),
48 /* 0x80 - 0x9f */
50 /* 0xa0 - 0xbf */
52 /* 0xc0 - 0xdf */
54 /* 0xe0 - 0xff */
55 SET(SBM_GETRANGE) | SET(SBM_SETSCROLLINFO) | SET(SBM_GETSCROLLINFO) | SET(SBM_GETSCROLLBARINFO),
56 /* 0x100 - 0x11f */
57 0,
58 /* 0x120 - 0x13f */
59 0,
60 /* 0x140 - 0x15f */
64 /* 0x160 - 0x17f */
65 0,
66 /* 0x180 - 0x19f */
70 /* 0x1a0 - 0x1bf */
72 /* 0x1c0 - 0x1df */
73 0,
74 /* 0x1e0 - 0x1ff */
75 0,
76 /* 0x200 - 0x21f */
78 /* 0x220 - 0x23f */
81 /* 0x240 - 0x25f */
82 0,
83 /* 0x260 - 0x27f */
84 0,
85 /* 0x280 - 0x29f */
86 0,
87 /* 0x2a0 - 0x2bf */
88 0,
89 /* 0x2c0 - 0x2df */
90 0,
91 /* 0x2e0 - 0x2ff */
92 0,
93 /* 0x300 - 0x31f */
95};
96
97/* check whether a given message type includes pointers */
99{
100 if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
101 if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
102 return (message_pointer_flags[message / 32] & SET(message)) != 0;
103}
104#undef SET
105
106#define MMS_SIZE_WPARAM -1
107#define MMS_SIZE_WPARAMWCHAR -2
108#define MMS_SIZE_LPARAMSZ -3
109#define MMS_SIZE_SPECIAL -4
110#define MMS_FLAG_READ 0x01
111#define MMS_FLAG_WRITE 0x02
112#define MMS_FLAG_READWRITE (MMS_FLAG_READ | MMS_FLAG_WRITE)
113typedef struct tagMSGMEMORY
114{
118}
120
122{
129 { WM_STYLECHANGED, sizeof(STYLESTRUCT), MMS_FLAG_READ },
130 { WM_STYLECHANGING, sizeof(STYLESTRUCT), MMS_FLAG_READWRITE },
136 { WM_SIZING, sizeof(RECT), MMS_FLAG_READWRITE },
137 { WM_MOVING, sizeof(RECT), MMS_FLAG_READWRITE },
140 { WM_HELP, sizeof(HELPINFO), MMS_FLAG_READWRITE },
143};
144
145static PMSGMEMORY FASTCALL
147{
148 PMSGMEMORY MsgMemoryEntry;
149
150 /* See if this message type is present in the table */
151 for (MsgMemoryEntry = g_MsgMemory;
152 MsgMemoryEntry < g_MsgMemory + sizeof(g_MsgMemory) / sizeof(MSGMEMORY);
153 MsgMemoryEntry++)
154 {
155 if (Msg == MsgMemoryEntry->Message)
156 {
157 return MsgMemoryEntry;
158 }
159 }
160
161 return NULL;
162}
163
164static UINT FASTCALL
166{
167 CREATESTRUCTW *Cs;
168 PLARGE_STRING WindowName;
169 PUNICODE_STRING ClassName;
170 UINT Size = 0;
171
173 {
174 if (MMS_SIZE_WPARAM == MsgMemoryEntry->Size)
175 {
176 Size = (UINT)wParam;
177 }
178 else if (MMS_SIZE_WPARAMWCHAR == MsgMemoryEntry->Size)
179 {
180 Size = (UINT) (wParam * sizeof(WCHAR));
181 }
182 else if (MMS_SIZE_LPARAMSZ == MsgMemoryEntry->Size)
183 {
184 // WM_SETTEXT and WM_SETTINGCHANGE can be null!
185 if (!lParam)
186 {
187 TRACE("lParam is NULL!\n");
188 Size = 0;
189 }
190 else
191 Size = (UINT) ((wcslen((PWSTR) lParam) + 1) * sizeof(WCHAR));
192 }
193 else if (MMS_SIZE_SPECIAL == MsgMemoryEntry->Size)
194 {
195 switch(MsgMemoryEntry->Message)
196 {
197 case WM_CREATE:
198 case WM_NCCREATE:
199 Cs = (CREATESTRUCTW *) lParam;
200 WindowName = (PLARGE_STRING) Cs->lpszName;
201 ClassName = (PUNICODE_STRING) Cs->lpszClass;
202 Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR);
203 if (IS_ATOM(ClassName->Buffer))
204 {
205 Size += sizeof(WCHAR) + sizeof(ATOM);
206 }
207 else
208 {
209 Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR);
210 }
211 break;
212
213 case WM_NCCALCSIZE:
214 Size = wParam ? sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS) : sizeof(RECT);
215 break;
216
217 case WM_COPYDATA:
218 {
220 Size = sizeof(COPYDATASTRUCT) + cds->cbData;
221 }
222 break;
223
224 case WM_DEVICECHANGE:
225 {
226 if ( lParam && (wParam & 0x8000) )
227 {
229 Size = header->dbch_size;
230 }
231 }
232 break;
233
234 default:
235 ASSERT(FALSE);
236 Size = 0;
237 break;
238 }
239 }
240 else
241 {
242 Size = MsgMemoryEntry->Size;
243 }
244 }
246 {
247 ERR("Exception caught in MsgMemorySize()! Status: 0x%x\n", _SEH2_GetExceptionCode());
248 Size = 0;
249 }
250 _SEH2_END;
251 return Size;
252}
253
255{
256 PMSGMEMORY MsgMemoryEntry = FindMsgMemory(Msg);
257 if(MsgMemoryEntry == NULL) return 0;
258 return MsgMemorySize(MsgMemoryEntry, wParam, lParam);
259}
260
261static NTSTATUS
262PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded)
263{
264 NCCALCSIZE_PARAMS *UnpackedNcCalcsize;
265 NCCALCSIZE_PARAMS *PackedNcCalcsize;
266 CREATESTRUCTW *UnpackedCs;
267 CREATESTRUCTW *PackedCs;
268 PLARGE_STRING WindowName;
269 PUNICODE_STRING ClassName;
271 UINT Size;
272 PCHAR CsData;
273
274 *lParamPacked = lParam;
275
276 if (NonPagedPoolNeeded)
278 else
280
281 if (WM_NCCALCSIZE == Msg && wParam)
282 {
283
284 UnpackedNcCalcsize = (NCCALCSIZE_PARAMS *) lParam;
285 PackedNcCalcsize = ExAllocatePoolWithTag(PoolType,
286 sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS),
287 TAG_MSG);
288
289 if (NULL == PackedNcCalcsize)
290 {
291 ERR("Not enough memory to pack lParam\n");
292 return STATUS_NO_MEMORY;
293 }
294 RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS));
295 PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1);
296 RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS));
297 *lParamPacked = (LPARAM) PackedNcCalcsize;
298 }
299 else if (WM_CREATE == Msg || WM_NCCREATE == Msg)
300 {
301 UnpackedCs = (CREATESTRUCTW *) lParam;
302 WindowName = (PLARGE_STRING) UnpackedCs->lpszName;
303 ClassName = (PUNICODE_STRING) UnpackedCs->lpszClass;
304 Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR);
305 if (IS_ATOM(ClassName->Buffer))
306 {
307 Size += sizeof(WCHAR) + sizeof(ATOM);
308 }
309 else
310 {
311 Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR);
312 }
314 if (NULL == PackedCs)
315 {
316 ERR("Not enough memory to pack lParam\n");
317 return STATUS_NO_MEMORY;
318 }
319 RtlCopyMemory(PackedCs, UnpackedCs, sizeof(CREATESTRUCTW));
320 CsData = (PCHAR) (PackedCs + 1);
321 PackedCs->lpszName = (LPCWSTR) (CsData - (PCHAR) PackedCs);
322 RtlCopyMemory(CsData, WindowName->Buffer, WindowName->Length);
323 CsData += WindowName->Length;
324 *((WCHAR *) CsData) = L'\0';
325 CsData += sizeof(WCHAR);
326 PackedCs->lpszClass = (LPCWSTR) (CsData - (PCHAR) PackedCs);
327 if (IS_ATOM(ClassName->Buffer))
328 {
329 *((WCHAR *) CsData) = L'A';
330 CsData += sizeof(WCHAR);
331 *((ATOM *) CsData) = (ATOM)(DWORD_PTR) ClassName->Buffer;
332 CsData += sizeof(ATOM);
333 }
334 else
335 {
336 NT_ASSERT(ClassName->Buffer != NULL);
337 *((WCHAR *) CsData) = L'S';
338 CsData += sizeof(WCHAR);
339 RtlCopyMemory(CsData, ClassName->Buffer, ClassName->Length);
340 CsData += ClassName->Length;
341 *((WCHAR *) CsData) = L'\0';
342 CsData += sizeof(WCHAR);
343 }
344 ASSERT(CsData == (PCHAR) PackedCs + Size);
345 *lParamPacked = (LPARAM) PackedCs;
346 }
347 else if (PoolType == NonPagedPool)
348 {
349 PMSGMEMORY MsgMemoryEntry;
350 PVOID PackedData;
351 SIZE_T size;
352
353 MsgMemoryEntry = FindMsgMemory(Msg);
354
355 if (!MsgMemoryEntry)
356 {
357 /* Keep previous behavior */
358 return STATUS_SUCCESS;
359 }
360 size = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
361 if (!size)
362 {
363 ERR("No size for lParamPacked\n");
364 return STATUS_SUCCESS;
365 }
367 if (PackedData == NULL)
368 {
369 ERR("Not enough memory to pack lParam\n");
370 return STATUS_NO_MEMORY;
371 }
372 RtlCopyMemory(PackedData, (PVOID)lParam, MsgMemorySize(MsgMemoryEntry, wParam, lParam));
373 *lParamPacked = (LPARAM)PackedData;
374 }
375
376 return STATUS_SUCCESS;
377}
378
379static NTSTATUS
380UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed)
381{
382 NCCALCSIZE_PARAMS *UnpackedParams;
383 NCCALCSIZE_PARAMS *PackedParams;
384 PWINDOWPOS UnpackedWindowPos;
385
386 if (lParamPacked == lParam)
387 {
388 return STATUS_SUCCESS;
389 }
390
391 if (WM_NCCALCSIZE == Msg && wParam)
392 {
393 PackedParams = (NCCALCSIZE_PARAMS *) lParamPacked;
394 UnpackedParams = (NCCALCSIZE_PARAMS *) lParam;
395 UnpackedWindowPos = UnpackedParams->lppos;
396 RtlCopyMemory(UnpackedParams, PackedParams, sizeof(NCCALCSIZE_PARAMS));
397 UnpackedParams->lppos = UnpackedWindowPos;
398 RtlCopyMemory(UnpackedWindowPos, PackedParams + 1, sizeof(WINDOWPOS));
399 ExFreePool((PVOID) lParamPacked);
400
401 return STATUS_SUCCESS;
402 }
403 else if (WM_CREATE == Msg || WM_NCCREATE == Msg)
404 {
405 ExFreePool((PVOID) lParamPacked);
406
407 return STATUS_SUCCESS;
408 }
409 else if (NonPagedPoolUsed)
410 {
411 PMSGMEMORY MsgMemoryEntry;
412 MsgMemoryEntry = FindMsgMemory(Msg);
413 ASSERT(MsgMemoryEntry);
414
415 if (MsgMemoryEntry->Flags == MMS_FLAG_READWRITE)
416 {
417 //RtlCopyMemory((PVOID)lParam, (PVOID)lParamPacked, MsgMemoryEntry->Size);
418 }
419 ExFreePool((PVOID) lParamPacked);
420 return STATUS_SUCCESS;
421 }
422
423 ASSERT(FALSE);
424
426}
427
428static NTSTATUS FASTCALL
429CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
430{
432
433 PVOID KernelMem;
434 UINT Size;
435
436 *KernelModeMsg = *UserModeMsg;
437
438 /* See if this message type is present in the table */
439 if (NULL == MsgMemoryEntry)
440 {
441 /* Not present, no copying needed */
442 return STATUS_SUCCESS;
443 }
444
445 /* Determine required size */
446 Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam, UserModeMsg->lParam);
447
448 if (0 != Size)
449 {
450 /* Allocate kernel mem */
452 if (NULL == KernelMem)
453 {
454 ERR("Not enough memory to copy message to kernel mem\n");
455 return STATUS_NO_MEMORY;
456 }
457 KernelModeMsg->lParam = (LPARAM) KernelMem;
458
459 /* Copy data if required */
460 if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ))
461 {
462 TRACE("Copy Message %u from usermode buffer\n", KernelModeMsg->message);
463 Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size);
464 if (! NT_SUCCESS(Status))
465 {
466 ERR("Failed to copy message to kernel: invalid usermode lParam buffer\n");
467 ExFreePoolWithTag(KernelMem, TAG_MSG);
468 return Status;
469 }
470 }
471 else
472 {
473 /* Make sure we don't pass any secrets to usermode */
474 RtlZeroMemory(KernelMem, Size);
475 }
476 }
477 else
478 {
479 KernelModeMsg->lParam = 0;
480 }
481
482 return STATUS_SUCCESS;
483}
484
485static NTSTATUS FASTCALL
486CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
487{
489 PMSGMEMORY MsgMemoryEntry;
490 UINT Size;
491
492 /* See if this message type is present in the table */
493 MsgMemoryEntry = FindMsgMemory(UserModeMsg->message);
494 if (NULL == MsgMemoryEntry)
495 {
496 /* Not present, no copying needed */
497 return STATUS_SUCCESS;
498 }
499
500 /* Determine required size */
501 Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam, UserModeMsg->lParam);
502
503 if (0 != Size)
504 {
505 /* Copy data if required */
506 if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_WRITE))
507 {
508 Status = MmCopyToCaller((PVOID) UserModeMsg->lParam, (PVOID) KernelModeMsg->lParam, Size);
509 if (! NT_SUCCESS(Status))
510 {
511 ERR("Failed to copy message from kernel: invalid usermode lParam buffer\n");
512 ExFreePool((PVOID) KernelModeMsg->lParam);
513 return Status;
514 }
515 }
516 ExFreePool((PVOID) KernelModeMsg->lParam);
517 }
518
519 return STATUS_SUCCESS;
520}
521
522//
523// Wakeup any thread/process waiting on idle input.
524//
527{
529 PTHREADINFO pti;
530
532
533 if ( pti )
534 {
535 pti->pClientInfo->cSpins = 0; // Reset spins.
536
537 if ( pti->pDeskInfo && pti == gptiForeground )
538 {
541 {
543 }
544 }
545 }
546
547 TRACE("IdlePing ppi %p\n", ppi);
548 if ( ppi && ppi->InputIdleEvent )
549 {
550 TRACE("InputIdleEvent\n");
551 KeSetEvent( ppi->InputIdleEvent, IO_NO_INCREMENT, FALSE);
552 }
553}
554
557{
559
560 TRACE("IdlePong ppi %p\n", ppi);
561 if ( ppi && ppi->InputIdleEvent )
562 {
563 KeClearEvent(ppi->InputIdleEvent);
564 }
565}
566
568{
569 return msg < WM_USER || msg >= 0xc000;
570}
571
574{
575 UINT mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */
576
577 if (first || last)
578 {
579 if ((first <= WM_KEYLAST) && (last >= WM_KEYFIRST)) mask |= QS_KEY;
580 if ( ((first <= WM_MOUSELAST) && (last >= WM_MOUSEFIRST)) ||
582 if ((first <= WM_TIMER) && (last >= WM_TIMER)) mask |= QS_TIMER;
583 if ((first <= WM_SYSTIMER) && (last >= WM_SYSTIMER)) mask |= QS_TIMER;
584 if ((first <= WM_PAINT) && (last >= WM_PAINT)) mask |= QS_PAINT;
585 }
586 else mask = QS_ALLINPUT;
587
588 return mask;
589}
590
591//
592// Pass Strings to User Heap Space for Message Hook Callbacks.
593//
594BOOL
597 PWND Window,
598 CREATESTRUCTW *pCsw,
599 CREATESTRUCTW *Cs,
600 PVOID *ppszClass,
601 PVOID *ppszName )
602{
603 PLARGE_STRING WindowName;
604 PUNICODE_STRING ClassName;
605 PVOID pszClass = NULL, pszName = NULL;
606
607 /* Fill the new CREATESTRUCTW */
608 RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW));
609 pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */
610
611 WindowName = (PLARGE_STRING) Cs->lpszName;
612 ClassName = (PUNICODE_STRING) Cs->lpszClass;
613
614 // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
615 if (!IS_ATOM(ClassName->Buffer))
616 {
617 if (ClassName->Length)
618 {
619 if (Window->state & WNDS_ANSICREATOR)
620 {
622 AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
623 pszClass = UserHeapAlloc(AnsiString.MaximumLength);
624 if (!pszClass)
625 {
626 ERR("UserHeapAlloc() failed!\n");
627 return FALSE;
628 }
629 RtlZeroMemory(pszClass, AnsiString.MaximumLength);
630 AnsiString.Buffer = (PCHAR)pszClass;
632 }
633 else
634 {
636 UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL);
637 pszClass = UserHeapAlloc(UnicodeString.MaximumLength);
638 if (!pszClass)
639 {
640 ERR("UserHeapAlloc() failed!\n");
641 return FALSE;
642 }
643 RtlZeroMemory(pszClass, UnicodeString.MaximumLength);
644 UnicodeString.Buffer = (PWSTR)pszClass;
646 }
647 *ppszClass = pszClass;
648 pCsw->lpszClass = UserHeapAddressToUser(pszClass);
649 }
650 else
651 {
652 pCsw->lpszClass = NULL;
653 }
654 }
655 else
656 {
657 pCsw->lpszClass = ClassName->Buffer;
658 }
659 if (WindowName->Length)
660 {
662 Name.Buffer = WindowName->Buffer;
663 Name.Length = (USHORT)min(WindowName->Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
664 Name.MaximumLength = (USHORT)min(WindowName->MaximumLength, MAXUSHORT);
665
666 if (Window->state & WNDS_ANSICREATOR)
667 {
669 AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(&Name) + sizeof(CHAR);
670 pszName = UserHeapAlloc(AnsiString.MaximumLength);
671 if (!pszName)
672 {
673 ERR("UserHeapAlloc() failed!\n");
674 return FALSE;
675 }
676 RtlZeroMemory(pszName, AnsiString.MaximumLength);
677 AnsiString.Buffer = (PCHAR)pszName;
679 }
680 else
681 {
683 UnicodeString.MaximumLength = Name.Length + sizeof(UNICODE_NULL);
684 pszName = UserHeapAlloc(UnicodeString.MaximumLength);
685 if (!pszName)
686 {
687 ERR("UserHeapAlloc() failed!\n");
688 return FALSE;
689 }
690 RtlZeroMemory(pszName, UnicodeString.MaximumLength);
691 UnicodeString.Buffer = (PWSTR)pszName;
693 }
694 *ppszName = pszName;
695 pCsw->lpszName = UserHeapAddressToUser(pszName);
696 }
697 else
698 {
699 pCsw->lpszName = NULL;
700 }
701
702 return TRUE;
703}
704
705static VOID FASTCALL
707{
708 BOOL SameThread = FALSE;
709 CWPSTRUCT CWP;
710 PVOID pszClass = NULL, pszName = NULL;
711 CREATESTRUCTW Csw;
712
714 if ( !ISITHOOKED(WH_CALLWNDPROC) && !(Window->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROC)) )
715 return;
716
718 SameThread = TRUE;
719
720 if ( Msg == WM_CREATE || Msg == WM_NCCREATE )
721 { //
722 // String pointers are in user heap space, like WH_CBT HCBT_CREATEWND.
723 //
724 if (!IntMsgCreateStructW( Window, &Csw, (CREATESTRUCTW *)lParam, &pszClass, &pszName ))
725 return;
726 lParam = (LPARAM)&Csw;
727 }
728
729 CWP.hwnd = hWnd;
730 CWP.message = Msg;
731 CWP.wParam = wParam;
732 CWP.lParam = lParam;
733 co_HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, SameThread, (LPARAM)&CWP );
734
735 if (pszName) UserHeapFree(pszName);
736 if (pszClass) UserHeapFree(pszClass);
737}
738
739static VOID FASTCALL
741{
742 BOOL SameThread = FALSE;
743 CWPRETSTRUCT CWPR;
744 PVOID pszClass = NULL, pszName = NULL;
745 CREATESTRUCTW Csw;
746
747 if ( !ISITHOOKED(WH_CALLWNDPROCRET) && !(Window->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET)) )
748 return;
749
751 SameThread = TRUE;
752
753 if ( Msg == WM_CREATE || Msg == WM_NCCREATE )
754 {
755 if (!IntMsgCreateStructW( Window, &Csw, (CREATESTRUCTW *)lParam, &pszClass, &pszName ))
756 return;
757 lParam = (LPARAM)&Csw;
758 }
759
760 CWPR.hwnd = hWnd;
761 CWPR.message = Msg;
762 CWPR.wParam = wParam;
763 CWPR.lParam = lParam;
764 CWPR.lResult = uResult ? (*uResult) : 0;
765 co_HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, SameThread, (LPARAM)&CWPR );
766
767 if (pszName) UserHeapFree(pszName);
768 if (pszClass) UserHeapFree(pszClass);
769}
770
772{
773 LRESULT lRes;
774// USER_REFERENCE_ENTRY Ref;
775// PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
776
777 if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
778 return 0;
779
780 TRACE("Internal Event Msg 0x%x hWnd 0x%p\n", msg, UserHMGetHandle(pWnd));
781
782 switch(msg)
783 {
785 return co_WinPosShowWindow( pWnd, wparam );
787 {
788 PWINDOWPOS winpos = (PWINDOWPOS)lparam;
789 if (!winpos) return 0;
790 lRes = co_WinPosSetWindowPos( pWnd,
791 winpos->hwndInsertAfter,
792 winpos->x,
793 winpos->y,
794 winpos->cx,
795 winpos->cy,
796 winpos->flags);
798 return lRes;
799 }
801 {
802 TRACE("WM_ASYNC_DESTROYWINDOW\n");
803 if (pWnd->style & WS_CHILD)
805 else
807 }
808 }
809 return 0;
810}
811
812static LRESULT handle_internal_events( PTHREADINFO pti, PWND pWnd, DWORD dwQEvent, LONG_PTR ExtraInfo, PMSG pMsg)
813{
814 LRESULT Result = 0;
815
816 switch(dwQEvent)
817 {
818 case POSTEVENT_NWE:
819 {
820 co_EVENT_CallEvents( pMsg->message, pMsg->hwnd, pMsg->wParam, ExtraInfo);
821 }
822 break;
823 case POSTEVENT_SAW:
824 {
825 //ERR("HIE : SAW : pti 0x%p hWnd 0x%p\n",pti,pMsg->hwnd);
826 IntActivateWindow((PWND)pMsg->wParam, pti, (HANDLE)pMsg->lParam, (DWORD)ExtraInfo);
827 }
828 break;
829 case POSTEVENT_DAW:
830 {
831 //ERR("HIE : DAW : pti 0x%p tid 0x%p hWndPrev 0x%p\n",pti,ExtraInfo,pMsg->hwnd);
832 IntDeactivateWindow(pti, (HANDLE)ExtraInfo);
833 }
834 break;
835 }
836 return Result;
837}
838
841{
842 LONG Time;
843 LRESULT retval = 0;
844 PTHREADINFO pti;
845 PWND Window = NULL;
846 BOOL DoCallBack = TRUE;
847
848 if (pMsg->hwnd)
849 {
851 if (!Window) return 0;
852 }
853
855
856 if ( Window && Window->head.pti != pti)
857 {
859 return 0;
860 }
861
862 if (((pMsg->message == WM_SYSTIMER) ||
863 (pMsg->message == WM_TIMER)) &&
864 (pMsg->lParam) )
865 {
866 if (pMsg->message == WM_TIMER)
867 {
868 if (ValidateTimerCallback(pti,pMsg->lParam))
869 {
871 retval = co_IntCallWindowProc((WNDPROC)pMsg->lParam,
872 TRUE,
873 pMsg->hwnd,
874 WM_TIMER,
875 pMsg->wParam,
876 (LPARAM)Time,
877 -1);
878 }
879 return retval;
880 }
881 else
882 {
883 PTIMER pTimer = FindSystemTimer(pMsg);
884 if (pTimer && pTimer->pfn)
885 {
887 pTimer->pfn(pMsg->hwnd, WM_SYSTIMER, (UINT)pMsg->wParam, Time);
888 }
889 return 0;
890 }
891 }
892 // Need a window!
893 if ( !Window ) return 0;
894
895 if (pMsg->message == WM_PAINT) Window->state |= WNDS_PAINTNOTPROCESSED;
896
897 if ( Window->state & WNDS_SERVERSIDEWINDOWPROC )
898 {
899 TRACE("Dispatch: Server Side Window Procedure\n");
900 switch(Window->fnid)
901 {
902 case FNID_DESKTOP:
903 DoCallBack = !DesktopWindowProc( Window,
904 pMsg->message,
905 pMsg->wParam,
906 pMsg->lParam,
907 &retval);
908 break;
909 case FNID_MESSAGEWND:
910 DoCallBack = !UserMessageWindowProc( Window,
911 pMsg->message,
912 pMsg->wParam,
913 pMsg->lParam,
914 &retval);
915 break;
916 case FNID_MENU:
917 DoCallBack = !PopupMenuWndProc( Window,
918 pMsg->message,
919 pMsg->wParam,
920 pMsg->lParam,
921 &retval);
922 break;
923 }
924 }
925
926 /* Since we are doing a callback on the same thread right away, there is
927 no need to copy the lparam to kernel mode and then back to usermode.
928 We just pretend it isn't a pointer */
929
930 if (DoCallBack)
931 retval = co_IntCallWindowProc( Window->lpfnWndProc,
932 !Window->Unicode,
933 pMsg->hwnd,
934 pMsg->message,
935 pMsg->wParam,
936 pMsg->lParam,
937 -1);
938
939 if ( pMsg->message == WM_PAINT &&
940 VerifyWnd(Window) &&
941 Window->state & WNDS_PAINTNOTPROCESSED ) // <--- Cleared, paint was already processed!
942 {
943 Window->state2 &= ~WNDS2_WMPAINTSENT;
944 /* send a WM_ERASEBKGND if the non-client area is still invalid */
945 ERR("Message WM_PAINT count %d Internal Paint Set? %s\n",Window->head.pti->cPaintsReady, Window->state & WNDS_INTERNALPAINT ? "TRUE" : "FALSE");
947 }
948
949 return retval;
950}
951
952/*
953 * Internal version of PeekMessage() doing all the work
954 *
955 * MSDN:
956 * Sent messages
957 * Posted messages
958 * Input (hardware) messages and system internal events
959 * Sent messages (again)
960 * WM_PAINT messages
961 * WM_TIMER messages
962 */
965 PWND Window,
966 UINT MsgFilterMin,
967 UINT MsgFilterMax,
968 UINT RemoveMsg,
969 LONG_PTR *ExtraInfo,
970 BOOL bGMSG )
971{
972 PTHREADINFO pti;
973 BOOL RemoveMessages;
974 UINT ProcessMask;
975 BOOL Hit = FALSE;
976
978
979 RemoveMessages = RemoveMsg & PM_REMOVE;
980 ProcessMask = HIWORD(RemoveMsg);
981
982 /* Hint, "If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns
983 all available messages (that is, no range filtering is performed)". */
984 if (!ProcessMask) ProcessMask = (QS_ALLPOSTMESSAGE|QS_ALLINPUT);
985
986 IdlePong();
987
988 do
989 {
990 /* Update the last message-queue access time */
991 pti->pcti->timeLastRead = EngGetTickCount32();
992
993 // Post mouse moves while looping through peek messages.
994 if (pti->MessageQueue->QF_flags & QF_MOUSEMOVED)
995 {
997 }
998
999 /* Dispatch sent messages here. */
1000 while ( co_MsqDispatchOneSentMessage(pti) )
1001 {
1002 /* if some PM_QS* flags were specified, only handle sent messages from now on */
1003 if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE; // wine does this; ProcessMask = QS_SENDMESSAGE;
1004 }
1005 if (Hit) return FALSE;
1006
1007 /* Clear changed bits so we can wait on them if we don't find a message */
1008 if (ProcessMask & QS_POSTMESSAGE)
1009 {
1010 pti->pcti->fsChangeBits &= ~(QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER);
1011 if (MsgFilterMin == 0 && MsgFilterMax == 0) // Wine hack does this; ~0U)
1012 {
1013 pti->pcti->fsChangeBits &= ~QS_ALLPOSTMESSAGE;
1014 }
1015 }
1016
1017 if (ProcessMask & QS_INPUT)
1018 {
1019 pti->pcti->fsChangeBits &= ~QS_INPUT;
1020 }
1021
1022 /* Now check for normal messages. */
1023 if (( (ProcessMask & QS_POSTMESSAGE) ||
1024 (ProcessMask & QS_HOTKEY) ) &&
1025 MsqPeekMessage( pti,
1026 RemoveMessages,
1027 Window,
1028 MsgFilterMin,
1029 MsgFilterMax,
1030 ProcessMask,
1031 ExtraInfo,
1032 0,
1033 Msg ))
1034 {
1035 goto GotMessage;
1036 }
1037
1038 /* Only check for quit messages if not posted messages pending. */
1039 if (ProcessMask & QS_POSTMESSAGE && pti->QuitPosted)
1040 {
1041 /* According to the PSDK, WM_QUIT messages are always returned, regardless
1042 of the filter specified */
1043 Msg->hwnd = NULL;
1044 Msg->message = WM_QUIT;
1045 Msg->wParam = pti->exitCode;
1046 Msg->lParam = 0;
1047 if (RemoveMessages)
1048 {
1049 pti->QuitPosted = FALSE;
1051 pti->pcti->fsWakeBits &= ~QS_ALLPOSTMESSAGE;
1052 pti->pcti->fsChangeBits &= ~QS_ALLPOSTMESSAGE;
1053 }
1054 goto GotMessage;
1055 }
1056
1057 /* Check for hardware events. */
1058 if ((ProcessMask & QS_INPUT) &&
1060 RemoveMessages,
1061 Window,
1062 MsgFilterMin,
1063 MsgFilterMax,
1064 ProcessMask,
1065 Msg))
1066 {
1067 goto GotMessage;
1068 }
1069
1070 /* Now check for System Event messages. */
1071 {
1072 LONG_PTR eExtraInfo;
1073 MSG eMsg;
1074 DWORD dwQEvent;
1075 if (MsqPeekMessage( pti,
1076 TRUE,
1077 Window,
1078 0,
1079 0,
1080 QS_EVENT,
1081 &eExtraInfo,
1082 &dwQEvent,
1083 &eMsg ))
1084 {
1085 handle_internal_events( pti, Window, dwQEvent, eExtraInfo, &eMsg);
1086 continue;
1087 }
1088 }
1089
1090 /* Check for sent messages again. */
1091 while ( co_MsqDispatchOneSentMessage(pti) )
1092 {
1093 if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE;
1094 }
1095 if (Hit) return FALSE;
1096
1097 /* Check for paint messages. */
1098 if ((ProcessMask & QS_PAINT) &&
1099 pti->cPaintsReady &&
1101 MsgFilterMin,
1102 MsgFilterMax,
1103 pti,
1104 Msg,
1105 RemoveMessages))
1106 {
1107 goto GotMessage;
1108 }
1109
1110 /* This is correct, check for the current threads timers waiting to be
1111 posted to this threads message queue. If any we loop again.
1112 */
1113 if ((ProcessMask & QS_TIMER) &&
1115 {
1116 continue;
1117 }
1118
1119 return FALSE;
1120 }
1121 while (TRUE);
1122
1123GotMessage:
1124 /* Update the last message-queue access time */
1125 pti->pcti->timeLastRead = EngGetTickCount32();
1126 return TRUE;
1127}
1128
1131 UINT MsgFilterMin,
1132 UINT MsgFilterMax )
1133{
1134 PTHREADINFO pti;
1136 MSG Msg;
1137 LONG_PTR ExtraInfo = 0;
1138
1140
1141 do
1142 {
1143 if ( co_IntPeekMessage( &Msg, // Dont reenter!
1144 Window,
1145 MsgFilterMin,
1146 MsgFilterMax,
1147 MAKELONG( PM_NOREMOVE, GetWakeMask( MsgFilterMin, MsgFilterMax)),
1148 &ExtraInfo,
1149 TRUE ) ) // act like GetMessage.
1150 {
1151 return TRUE;
1152 }
1153
1154 /* Nothing found. Wait for new messages. */
1156 Window,
1157 MsgFilterMin,
1158 MsgFilterMax);
1159 if (!NT_SUCCESS(Status))
1160 {
1162 ERR("Exit co_IntWaitMessage on error!\n");
1163 return FALSE;
1164 }
1166 {
1167 return FALSE;
1168 }
1169 }
1170 while ( TRUE );
1171
1172 return FALSE;
1173}
1174
1177 HWND hWnd,
1178 UINT MsgFilterMin,
1179 UINT MsgFilterMax,
1180 UINT RemoveMsg,
1181 BOOL bGMSG )
1182{
1183 PWND Window;
1184 PTHREADINFO pti;
1185 BOOL Present = FALSE;
1187 LONG_PTR ExtraInfo = 0;
1188
1189 if ( hWnd == HWND_TOPMOST || hWnd == HWND_BROADCAST )
1190 hWnd = HWND_BOTTOM;
1191
1192 /* Validate input */
1193 if (hWnd && hWnd != HWND_BOTTOM)
1194 {
1196 {
1197 if (bGMSG)
1198 return -1;
1199 else
1200 return FALSE;
1201 }
1202 }
1203 else
1204 {
1205 Window = (PWND)hWnd;
1206 }
1207
1208 if (MsgFilterMax < MsgFilterMin)
1209 {
1210 MsgFilterMin = 0;
1211 MsgFilterMax = 0;
1212 }
1213
1214 if (bGMSG)
1215 {
1216 RemoveMsg |= ((GetWakeMask( MsgFilterMin, MsgFilterMax ))<< 16);
1217 }
1218
1220 pti->pClientInfo->cSpins++; // Bump up the spin count.
1221
1222 do
1223 {
1224 Present = co_IntPeekMessage( pMsg,
1225 Window,
1226 MsgFilterMin,
1227 MsgFilterMax,
1228 RemoveMsg,
1229 &ExtraInfo,
1230 bGMSG );
1231 if (Present)
1232 {
1233 if ( pMsg->message != WM_DEVICECHANGE || (pMsg->wParam & 0x8000) )
1234 {
1235 /* GetMessage or PostMessage must never get messages that contain pointers */
1236 ASSERT(FindMsgMemory(pMsg->message) == NULL);
1237 }
1238
1239 if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <= WM_DDE_LAST )
1240 {
1241 if (!IntDdeGetMessageHook(pMsg, ExtraInfo))
1242 {
1243 TRACE("DDE Get return ERROR\n");
1244 continue;
1245 }
1246 }
1247
1248 if (pMsg->message != WM_PAINT && pMsg->message != WM_QUIT)
1249 {
1250 if (!RtlEqualMemory(&pti->ptLast, &pMsg->pt, sizeof(POINT)))
1251 {
1253 }
1254 pti->timeLast = pMsg->time;
1255 pti->ptLast = pMsg->pt;
1256 }
1257
1258 // The WH_GETMESSAGE hook enables an application to monitor messages about to
1259 // be returned by the GetMessage or PeekMessage function.
1260
1262
1263 if ( bGMSG || pMsg->message == WM_PAINT) break;
1264 }
1265
1266 if ( bGMSG )
1267 {
1269 Window,
1270 MsgFilterMin,
1271 MsgFilterMax);
1272 if ( !NT_SUCCESS(Status) ||
1275 {
1276 Present = -1;
1277 break;
1278 }
1279 }
1280 else
1281 {
1282 if (!(RemoveMsg & PM_NOYIELD))
1283 {
1284 IdlePing();
1285 // Yield this thread!
1286 UserLeave();
1289 // Fall through to exit.
1290 IdlePong();
1291 }
1292 break;
1293 }
1294 }
1295 while( bGMSG && !Present );
1296
1297 // Been spinning, time to swap vinyl...
1298 if (pti->pClientInfo->cSpins >= 100)
1299 {
1300 // Clear the spin cycle to fix the mix.
1301 pti->pClientInfo->cSpins = 0;
1302 //if (!(pti->TIF_flags & TIF_SPINNING)) // FIXME: Need to swap vinyl...
1303 }
1304 return Present;
1305}
1306
1309 UINT Msg,
1310 WPARAM wParam,
1311 LPARAM lParam )
1312{
1313 MSG Message;
1314
1316 {
1318 return FALSE;
1319 }
1320 Message.hwnd = NULL;
1321 Message.message = Msg;
1322 Message.wParam = wParam;
1323 Message.lParam = lParam;
1324 Message.pt = gpsi->ptCursor;
1325 Message.time = EngGetTickCount32();
1327 return TRUE;
1328}
1329
1332{
1333 if ( ptiCur )
1334 {
1335 if (!Window ||
1336 Window->head.pti == ptiCur )
1337 {
1338 return NULL;
1339 }
1340 }
1341 return Window ? Window->head.pti : NULL;
1342}
1343
1346 UINT Msg,
1347 WPARAM wParam,
1348 LPARAM lParam )
1349{
1350 PTHREADINFO pti;
1351 MSG Message;
1352 LONG_PTR ExtraInfo = 0;
1353
1354 Message.hwnd = Wnd;
1355 Message.message = Msg;
1356 Message.wParam = wParam;
1357 Message.lParam = lParam;
1358 Message.pt = gpsi->ptCursor;
1359 Message.time = EngGetTickCount32();
1360
1361 if (is_pointer_message(Message.message, Message.wParam))
1362 {
1364 return FALSE;
1365 }
1366
1367 if (Wnd == HWND_BROADCAST || Wnd == HWND_TOPMOST)
1368 {
1369 HWND *List;
1371 ULONG i;
1372
1373 if (!is_message_broadcastable(Msg)) return TRUE;
1374
1377
1378 if (List != NULL)
1379 {
1381 for (i = 0; List[i]; i++)
1382 {
1383 PWND pwnd = UserGetWindowObject(List[i]);
1384 if (!pwnd) continue;
1385
1386 if ( pwnd->fnid == FNID_MENU || // Also need pwnd->pcls->atomClassName == gaOleMainThreadWndClass
1388 continue;
1389
1391 }
1393 }
1394 }
1395 else
1396 {
1397 PWND Window;
1398
1399 if (!Wnd)
1400 {
1402 Msg,
1403 wParam,
1404 lParam);
1405 }
1406
1408 if ( !Window )
1409 {
1410 ERR("UserPostMessage: Invalid handle 0x%p Msg 0x%x!\n", Wnd, Msg);
1411 return FALSE;
1412 }
1413
1414 pti = Window->head.pti;
1415
1416 if ( pti->TIF_flags & TIF_INCLEANUP )
1417 {
1418 ERR("Attempted to post message to window %p when the thread is in cleanup!\n", Wnd);
1419 return FALSE;
1420 }
1421
1422 if ( Window->state & WNDS_DESTROYED )
1423 {
1424 ERR("Attempted to post message to window %p that is being destroyed!\n", Wnd);
1426 return FALSE;
1427 }
1428
1429 if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
1430 {
1431 if (!IntDdePostMessageHook(Window, Msg, wParam, &lParam, &ExtraInfo))
1432 {
1433 TRACE("Posting Exit DDE 0x%x\n",Msg);
1434 return FALSE;
1435 }
1436 Message.lParam = lParam;
1437 }
1438
1439 MsqPostMessage(pti, &Message, FALSE, QS_POSTMESSAGE, 0, ExtraInfo);
1440 }
1441 return TRUE;
1442}
1443
1446 UINT Msg,
1447 WPARAM wParam,
1448 LPARAM lParam )
1449{
1450 ULONG_PTR Result = 0;
1451
1453 {
1454 return (LRESULT)Result;
1455 }
1456 return 0;
1457}
1458
1459static LRESULT FASTCALL
1461 UINT Msg,
1462 WPARAM wParam,
1463 LPARAM lParam,
1464 UINT uFlags,
1465 UINT uTimeout,
1466 ULONG_PTR *uResult )
1467{
1469 PWND Window;
1470 PMSGMEMORY MsgMemoryEntry;
1471 INT lParamBufferSize;
1472 LPARAM lParamPacked;
1473 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1474 ULONG_PTR Result = 0;
1475 LRESULT Ret = FALSE;
1477 BOOL DoCallBack = TRUE;
1478
1480 {
1481 TRACE("SendMessageTimeoutSingle: Invalid handle 0x%p!\n",hWnd);
1482 return FALSE;
1483 }
1484
1485 UserRefObjectCo(Window, &Ref);
1486
1487 Win32Thread = PsGetCurrentThreadWin32Thread();
1488
1489 ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
1490
1491 if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
1492 {
1494 {
1495 ERR("Sending Exit DDE 0x%x\n",Msg);
1496 goto Cleanup; // Return FALSE
1497 }
1498 }
1499
1500 if ( !ptiSendTo )
1501 {
1502 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1503 {
1504 /* Never send messages to exiting threads */
1505 goto Cleanup; // Return FALSE
1506 }
1507
1508 if (Msg & 0x80000000)
1509 {
1510 TRACE("SMTS: Internal Message!\n");
1512 if (uResult) *uResult = Result;
1513 Ret = TRUE;
1514 goto Cleanup;
1515 }
1516
1517 // Only happens when calling the client!
1519
1520 if ( Window->state & WNDS_SERVERSIDEWINDOWPROC )
1521 {
1522 TRACE("SMT: Server Side Window Procedure\n");
1523 // Handle it here. Safeguard against excessive recursions.
1524 if (IoGetRemainingStackSize() < PAGE_SIZE)
1525 {
1526 ERR("Server Callback Exceeded Stack!\n");
1527 goto Cleanup; // Return FALSE
1528 }
1529 /* Return after server side call, IntCallWndProcRet will not be called. */
1530 switch(Window->fnid)
1531 {
1532 case FNID_DESKTOP:
1533 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParam,(LRESULT*)&Result);
1534 break;
1535 case FNID_MESSAGEWND:
1537 break;
1538 case FNID_MENU:
1539 DoCallBack = !PopupMenuWndProc( Window, Msg, wParam, lParam,(LRESULT*)&Result);
1540 break;
1541 }
1542 if (!DoCallBack)
1543 {
1544 if (uResult) *uResult = Result;
1545 Ret = TRUE;
1546 goto Cleanup;
1547 }
1548 }
1549 /* See if this message type is present in the table */
1550 MsgMemoryEntry = FindMsgMemory(Msg);
1551 if (NULL == MsgMemoryEntry)
1552 {
1553 lParamBufferSize = -1;
1554 }
1555 else
1556 {
1557 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1558 // If zero, do not allow callback on client side to allocate a buffer!!!!! See CORE-7695.
1559 if (!lParamBufferSize) lParamBufferSize = -1;
1560 }
1561
1562 if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, FALSE)))
1563 {
1564 ERR("Failed to pack message parameters\n");
1565 goto Cleanup; // Return FALSE
1566 }
1567
1569 !Window->Unicode,
1570 hWnd,
1571 Msg,
1572 wParam,
1573 lParamPacked,
1574 lParamBufferSize );
1575 if (uResult)
1576 {
1577 *uResult = Result;
1578 }
1579
1580 if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1581 {
1582 ERR("Failed to unpack message parameters\n");
1583 Ret = TRUE;
1584 goto Cleanup;
1585 }
1586
1587 // Only happens when calling the client!
1589
1590 Ret = TRUE;
1591 goto Cleanup;
1592 }
1593
1594 if (Window->state & WNDS_DESTROYED)
1595 {
1596 /* FIXME: Last error? */
1597 ERR("Attempted to send message to window %p that is being destroyed!\n", hWnd);
1598 goto Cleanup; // Return FALSE
1599 }
1600
1601 if ((uFlags & SMTO_ABORTIFHUNG) && MsqIsHung(ptiSendTo, 4 * MSQ_HUNG))
1602 {
1603 // FIXME: Set window hung and add to a list.
1604 /* FIXME: Set a LastError? */
1605 ERR("Window %p (%p) (pti %p) is hung!\n", hWnd, Window, ptiSendTo);
1606 goto Cleanup; // Return FALSE
1607 }
1608
1609 do
1610 {
1611 Status = co_MsqSendMessage( ptiSendTo,
1612 hWnd,
1613 Msg,
1614 wParam,
1615 lParam,
1616 uTimeout,
1617 (uFlags & SMTO_BLOCK),
1618 MSQ_NORMAL,
1619 uResult );
1620 }
1621 while ((Status == STATUS_TIMEOUT) &&
1622 (uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
1623 !MsqIsHung(ptiSendTo, MSQ_HUNG)); // FIXME: Set window hung and add to a list.
1624
1625 if (Status == STATUS_TIMEOUT)
1626 {
1627 if (0 && MsqIsHung(ptiSendTo, MSQ_HUNG))
1628 {
1629 TRACE("Let's go Ghost!\n");
1631 }
1632/*
1633 * MSDN says:
1634 * Microsoft Windows 2000: If GetLastError returns zero, then the function
1635 * timed out.
1636 * XP+ : If the function fails or times out, the return value is zero.
1637 * To get extended error information, call GetLastError. If GetLastError
1638 * returns ERROR_TIMEOUT, then the function timed out.
1639 */
1641 goto Cleanup; // Return FALSE
1642 }
1643 else if (!NT_SUCCESS(Status))
1644 {
1646 goto Cleanup; // Return FALSE
1647 }
1648
1649 Ret = TRUE;
1650
1651Cleanup:
1653 return Ret;
1654}
1655
1658 UINT Msg,
1659 WPARAM wParam,
1660 LPARAM lParam,
1661 UINT uFlags,
1662 UINT uTimeout,
1663 ULONG_PTR *uResult )
1664{
1666 HWND *Children;
1667 HWND *Child;
1668
1669 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1670 {
1671 return co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, uFlags, uTimeout, uResult);
1672 }
1673
1674 if (!is_message_broadcastable(Msg)) return TRUE;
1675
1677 if (NULL == DesktopWindow)
1678 {
1680 return 0;
1681 }
1682
1683 if (hWnd != HWND_TOPMOST)
1684 {
1685 /* Send message to the desktop window too! */
1687 }
1688
1690 if (NULL == Children)
1691 {
1692 return 0;
1693 }
1694
1695 for (Child = Children; NULL != *Child; Child++)
1696 {
1698 if (!pwnd) continue;
1699
1700 if ( pwnd->fnid == FNID_MENU ||
1702 continue;
1703
1705 }
1706
1708
1709 return (LRESULT) TRUE;
1710}
1711
1714 UINT Msg,
1715 WPARAM wParam,
1716 LPARAM lParam)
1717{
1718 ULONG_PTR Result = 0;
1720 Msg,
1721 wParam,
1722 lParam,
1723 NULL,
1724 0,
1725 &Result);
1726}
1727/* MSDN:
1728 If you send a message in the range below WM_USER to the asynchronous message
1729 functions (PostMessage, SendNotifyMessage, and SendMessageCallback), its
1730 message parameters cannot include pointers. Otherwise, the operation will fail.
1731 The functions will return before the receiving thread has had a chance to
1732 process the message and the sender will free the memory before it is used.
1733*/
1736 UINT Msg,
1737 WPARAM wParam,
1738 LPARAM lParam,
1740 ULONG_PTR CompletionCallbackContext,
1741 ULONG_PTR *uResult)
1742{
1744 PWND Window;
1745 PMSGMEMORY MsgMemoryEntry;
1746 INT lParamBufferSize;
1747 LPARAM lParamPacked;
1748 PTHREADINFO Win32Thread, ptiSendTo = NULL;
1749 LRESULT Ret = FALSE;
1752 BOOL DoCallBack = TRUE;
1753
1755 {
1756 TRACE("SendMessageWithCallBack: Invalid handle 0x%p\n",hWnd);
1757 return FALSE;
1758 }
1759
1760 UserRefObjectCo(Window, &Ref);
1761
1762 if (Window->state & WNDS_DESTROYED)
1763 {
1764 /* FIXME: last error? */
1765 ERR("Attempted to send message to window %p that is being destroyed\n", hWnd);
1766 goto Cleanup; // Return FALSE
1767 }
1768
1769 Win32Thread = PsGetCurrentThreadWin32Thread();
1770
1771 if (Win32Thread == NULL || Win32Thread->TIF_flags & TIF_INCLEANUP)
1772 goto Cleanup; // Return FALSE
1773
1774 ptiSendTo = IntSendTo(Window, Win32Thread, Msg);
1775
1776 if (Msg & 0x80000000 &&
1777 !ptiSendTo)
1778 {
1779 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1780 goto Cleanup; // Return FALSE
1781
1782 TRACE("SMWCB: Internal Message\n");
1784 if (uResult) *uResult = Result;
1785 Ret = TRUE;
1786 goto Cleanup;
1787 }
1788
1789 /* See if this message type is present in the table */
1790 MsgMemoryEntry = FindMsgMemory(Msg);
1791 if (NULL == MsgMemoryEntry)
1792 {
1793 lParamBufferSize = -1;
1794 }
1795 else
1796 {
1797 lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
1798 if (!lParamBufferSize) lParamBufferSize = -1;
1799 }
1800
1801 if (!NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, !!ptiSendTo)))
1802 {
1803 ERR("Failed to pack message parameters\n");
1804 goto Cleanup; // Return FALSE
1805 }
1806
1807 /* If it can be sent now, then send it. */
1808 if (!ptiSendTo)
1809 {
1810 if (Win32Thread->TIF_flags & TIF_INCLEANUP)
1811 {
1812 UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE);
1813 /* Never send messages to exiting threads */
1814 goto Cleanup; // Return FALSE
1815 }
1816
1818
1819 if (Window->state & WNDS_SERVERSIDEWINDOWPROC)
1820 {
1821 TRACE("SMWCB: Server Side Window Procedure\n");
1822 switch(Window->fnid)
1823 {
1824 case FNID_DESKTOP:
1825 DoCallBack = !DesktopWindowProc(Window, Msg, wParam, lParamPacked, (LRESULT*)&Result);
1826 break;
1827 case FNID_MESSAGEWND:
1829 break;
1830 case FNID_MENU:
1831 DoCallBack = !PopupMenuWndProc(Window, Msg, wParam, lParam, (LRESULT*)&Result);
1832 break;
1833 }
1834 }
1835
1836 if (DoCallBack)
1838 !Window->Unicode,
1839 hWnd,
1840 Msg,
1841 wParam,
1842 lParamPacked,
1843 lParamBufferSize);
1844 if(uResult)
1845 {
1846 *uResult = Result;
1847 }
1848
1850
1852 {
1854 hWnd,
1855 Msg,
1856 CompletionCallbackContext,
1857 Result);
1858 }
1859 }
1860
1861 if (!ptiSendTo)
1862 {
1863 if (!NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
1864 {
1865 ERR("Failed to unpack message parameters\n");
1866 }
1867 Ret = TRUE;
1868 goto Cleanup;
1869 }
1870
1872 {
1873 ERR("Failed to allocate message\n");
1874 goto Cleanup; // Return FALSE
1875 }
1876
1877 Message->Msg.hwnd = hWnd;
1878 Message->Msg.message = Msg;
1879 Message->Msg.wParam = wParam;
1880 Message->Msg.lParam = lParamPacked;
1881 Message->pkCompletionEvent = NULL; // No event needed.
1882 Message->lResult = 0;
1883 Message->QS_Flags = 0;
1884 Message->ptiReceiver = ptiSendTo;
1885 Message->ptiSender = NULL;
1886 Message->ptiCallBackSender = Win32Thread;
1887 Message->CompletionCallback = CompletionCallback;
1888 Message->CompletionCallbackContext = CompletionCallbackContext;
1889 Message->HookMessage = MSQ_NORMAL;
1890 Message->HasPackedLParam = (lParamBufferSize > 0);
1891 Message->QS_Flags = QS_SENDMESSAGE;
1892 Message->flags = SMF_RECEIVERFREE;
1893
1894 if (Msg & 0x80000000) // Higher priority event message!
1895 InsertHeadList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1896 else
1897 InsertTailList(&ptiSendTo->SentMessagesListHead, &Message->ListEntry);
1898 MsqWakeQueue(ptiSendTo, QS_SENDMESSAGE, TRUE);
1899
1900 Ret = TRUE;
1901
1902Cleanup:
1904 return Ret;
1905}
1906
1907#if 0
1908/*
1909 This HACK function posts a message if the destination's message queue belongs to
1910 another thread, otherwise it sends the message. It does not support broadcast
1911 messages!
1912*/
1915 UINT Msg,
1916 WPARAM wParam,
1917 LPARAM lParam )
1918{
1920 PTHREADINFO pti;
1921 PWND Window;
1922
1923 if ( hWnd == HWND_BROADCAST )
1924 {
1925 return 0;
1926 }
1927
1929 {
1930 TRACE("PostOrSendMessage: Invalid handle 0x%p!\n",hWnd);
1931 return 0;
1932 }
1933
1935
1936 if ( IntSendTo(Window, pti, Msg) &&
1937 FindMsgMemory(Msg) == 0 )
1938 {
1940 }
1941 else
1942 {
1944 {
1945 Result = 0;
1946 }
1947 }
1948
1949 return (LRESULT)Result;
1950}
1951#endif
1952
1953static LRESULT FASTCALL
1955 UINT Msg,
1956 WPARAM wParam,
1957 LPARAM lParam,
1958 PDOSENDMESSAGE dsm)
1959{
1962 PWND Window = NULL;
1963 MSG UserModeMsg, KernelModeMsg;
1964 PMSGMEMORY MsgMemoryEntry;
1965 PTHREADINFO ptiSendTo;
1966
1967 if (hWnd != HWND_BROADCAST && hWnd != HWND_TOPMOST)
1968 {
1970 if ( !Window )
1971 {
1972 return 0;
1973 }
1974 }
1975
1976 /* Check for an exiting window. */
1977 if (Window && Window->state & WNDS_DESTROYED)
1978 {
1979 ERR("co_IntDoSendMessage Window Exiting!\n");
1980 }
1981
1982 /* See if the current thread can handle this message */
1983 ptiSendTo = IntSendTo(Window, gptiCurrent, Msg);
1984
1985 // If broadcasting or sending to another thread, save the users data.
1986 if (!Window || ptiSendTo )
1987 {
1988 UserModeMsg.hwnd = hWnd;
1989 UserModeMsg.message = Msg;
1990 UserModeMsg.wParam = wParam;
1991 UserModeMsg.lParam = lParam;
1992 MsgMemoryEntry = FindMsgMemory(UserModeMsg.message);
1993 Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg, MsgMemoryEntry);
1994 if (!NT_SUCCESS(Status))
1995 {
1997 return (dsm ? 0 : -1);
1998 }
1999 }
2000 else
2001 {
2002 KernelModeMsg.hwnd = hWnd;
2003 KernelModeMsg.message = Msg;
2004 KernelModeMsg.wParam = wParam;
2005 KernelModeMsg.lParam = lParam;
2006 }
2007
2008 if (!dsm)
2009 {
2010 Result = co_IntSendMessage( KernelModeMsg.hwnd,
2011 KernelModeMsg.message,
2012 KernelModeMsg.wParam,
2013 KernelModeMsg.lParam );
2014 }
2015 else
2016 {
2017 Result = co_IntSendMessageTimeout( KernelModeMsg.hwnd,
2018 KernelModeMsg.message,
2019 KernelModeMsg.wParam,
2020 KernelModeMsg.lParam,
2021 dsm->uFlags,
2022 dsm->uTimeout,
2023 &dsm->Result );
2024 }
2025
2026 if (!Window || ptiSendTo )
2027 {
2028 Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg);
2029 if (!NT_SUCCESS(Status))
2030 {
2032 return(dsm ? 0 : -1);
2033 }
2034 }
2035
2036 return (LRESULT)Result;
2037}
2038
2041 UINT Msg,
2042 WPARAM wParam,
2043 LPARAM lParam )
2044{
2045 BOOL Ret = TRUE;
2046
2048 {
2050 return FALSE;
2051 }
2052
2053 // Basicly the same as IntPostOrSendMessage
2054 if (hWnd == HWND_BROADCAST) // Handle Broadcast
2055 {
2056 HWND *List;
2058 ULONG i;
2059
2062
2063 if (List != NULL)
2064 {
2066 for (i = 0; List[i]; i++)
2067 {
2068 PWND pwnd = UserGetWindowObject(List[i]);
2069 if (!pwnd) continue;
2070
2071 if ( pwnd->fnid == FNID_MENU ||
2073 continue;
2074
2076 }
2078 }
2079 }
2080 else
2081 {
2083 }
2084 return Ret;
2085}
2086
2087
2090{
2091 PTHREADINFO pti;
2092 DWORD Result;
2093
2095// wine:
2097
2098 /* High word, types of messages currently in the queue.
2099 Low word, types of messages that have been added to the queue and that
2100 are still in the queue
2101 */
2102 Result = MAKELONG(pti->pcti->fsChangeBits & Changes, pti->pcti->fsWakeBits & Changes);
2103
2104 pti->pcti->fsChangeBits &= ~Changes;
2105
2106 return Result;
2107}
2108
2111{
2113
2114 if (pti->pcti)
2115 {
2116 pti->pcti->dwcPumpHook++;
2117 return TRUE;
2118 }
2119 return FALSE;
2120}
2121
2124{
2126
2127 if (pti->pcti)
2128 {
2129 if (pti->pcti->dwcPumpHook <= 0)
2130 {
2131 return FALSE;
2132 }
2133 pti->pcti->dwcPumpHook--;
2134 return TRUE;
2135 }
2136 return FALSE;
2137}
2138
2141{
2142 BOOL Ret = FALSE;
2143
2144 if ( co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)lpmsg))
2145 {
2146 Ret = TRUE;
2147 }
2148 else
2149 {
2150 Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)lpmsg);
2151 }
2152 return Ret;
2153}
2154
2157BOOL
2160 HWND hWnd,
2161 POINT pt) // Just like the User call.
2162{
2163 MSG msg;
2164 RECT rect;
2165 ULONG wDragWidth, wDragHeight;
2166 BOOL Ret = FALSE;
2167
2168 TRACE("Enter NtUserDragDetect(%p)\n", hWnd);
2170
2171 wDragWidth = UserGetSystemMetrics(SM_CXDRAG);
2172 wDragHeight= UserGetSystemMetrics(SM_CYDRAG);
2173
2174 rect.left = pt.x - wDragWidth;
2175 rect.right = pt.x + wDragWidth;
2176
2177 rect.top = pt.y - wDragHeight;
2178 rect.bottom = pt.y + wDragHeight;
2179
2181
2182 for (;;)
2183 {
2187 {
2188 if ( msg.message == WM_LBUTTONUP )
2189 {
2191 goto Exit; // Return FALSE
2192 }
2193 if ( msg.message == WM_MOUSEMOVE )
2194 {
2195 POINT tmp;
2196 tmp.x = (short)LOWORD(msg.lParam);
2197 tmp.y = (short)HIWORD(msg.lParam);
2198 if( !RECTL_bPointInRect( &rect, tmp.x, tmp.y ) )
2199 {
2201 Ret = TRUE;
2202 goto Exit;
2203 }
2204 }
2205 if ( msg.message == WM_KEYDOWN )
2206 {
2207 if ( msg.wParam == VK_ESCAPE )
2208 {
2210 Ret = TRUE;
2211 goto Exit;
2212 }
2213 }
2214 if ( msg.message == WM_QUEUESYNC )
2215 {
2217 }
2218 }
2219 co_IntWaitMessage(NULL, 0, 0);
2220 }
2221
2222Exit:
2223 TRACE("Leave NtUserDragDetect, ret=%i\n", Ret);
2224 UserLeave();
2225 return Ret;
2226}
2227
2230 UINT Msg,
2231 WPARAM wParam,
2232 LPARAM lParam)
2233{
2234 BOOL ret;
2235
2237
2239
2240 UserLeave();
2241
2242 return ret;
2243}
2244
2247 UINT Msg,
2248 WPARAM wParam,
2249 LPARAM lParam)
2250{
2251 BOOL ret = FALSE;
2252 PETHREAD peThread;
2253 PTHREADINFO pThread;
2255
2257
2258 Status = PsLookupThreadByThreadId(UlongToHandle(idThread), &peThread);
2259
2260 if ( Status == STATUS_SUCCESS )
2261 {
2262 pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
2263 if( !pThread ||
2264 !pThread->MessageQueue ||
2265 (pThread->TIF_flags & TIF_INCLEANUP))
2266 {
2267 ObDereferenceObject( peThread );
2268 goto exit;
2269 }
2270 ret = UserPostThreadMessage( pThread, Msg, wParam, lParam);
2271 ObDereferenceObject( peThread );
2272 }
2273 else
2274 {
2276 }
2277exit:
2278 UserLeave();
2279 return ret;
2280}
2281
2284{
2285 BOOL ret;
2286
2288 TRACE("NtUserWaitMessage Enter\n");
2289 ret = co_IntWaitMessage(NULL, 0, 0);
2290 TRACE("NtUserWaitMessage Leave\n");
2291 UserLeave();
2292
2293 return ret;
2294}
2295
2298 HWND hWnd,
2299 UINT MsgFilterMin,
2300 UINT MsgFilterMax )
2301{
2302 MSG Msg;
2303 BOOL Ret;
2304
2305 if ( (MsgFilterMin|MsgFilterMax) & ~WM_MAXIMUM )
2306 {
2308 return FALSE;
2309 }
2310
2312
2313 RtlZeroMemory(&Msg, sizeof(MSG));
2314
2315 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
2316
2317 UserLeave();
2318
2319 if (Ret)
2320 {
2321 _SEH2_TRY
2322 {
2323 ProbeForWrite(pMsg, sizeof(MSG), 1);
2324 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2325 }
2327 {
2329 Ret = FALSE;
2330 }
2331 _SEH2_END;
2332 }
2333
2334 if ((INT)Ret != -1)
2335 Ret = Ret ? (WM_QUIT != pMsg->message) : FALSE;
2336
2337 return Ret;
2338}
2339
2342 HWND hWnd,
2343 UINT MsgFilterMin,
2344 UINT MsgFilterMax,
2345 UINT RemoveMsg)
2346{
2347 MSG Msg;
2348 BOOL Ret;
2349
2350 if ( RemoveMsg & PM_BADMSGFLAGS )
2351 {
2353 return FALSE;
2354 }
2355
2357
2358 RtlZeroMemory(&Msg, sizeof(MSG));
2359
2360 Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
2361
2362 UserLeave();
2363
2364 if (Ret)
2365 {
2366 _SEH2_TRY
2367 {
2368 ProbeForWrite(pMsg, sizeof(MSG), 1);
2369 RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
2370 }
2372 {
2374 Ret = FALSE;
2375 }
2376 _SEH2_END;
2377 }
2378
2379 return Ret;
2380}
2381
2384{
2385 BOOL Ret = FALSE;
2386 MSG Msg;
2387
2388 _SEH2_TRY
2389 {
2390 ProbeForRead(lpmsg, sizeof(MSG), 1);
2391 RtlCopyMemory( &Msg, lpmsg, sizeof(MSG));
2392 }
2394 {
2395 _SEH2_YIELD(return FALSE);
2396 }
2397 _SEH2_END;
2398
2400
2402 {
2403 Ret = TRUE;
2404 }
2405 else
2406 {
2408 }
2409
2410 UserLeave();
2411
2412 _SEH2_TRY
2413 {
2414 ProbeForWrite(lpmsg, sizeof(MSG), 1);
2415 RtlCopyMemory(lpmsg, &Msg, sizeof(MSG));
2416 }
2418 {
2419 Ret = FALSE;
2420 }
2421 _SEH2_END;
2422
2423 return Ret;
2424}
2425
2428{
2429 LRESULT Res = 0;
2430 MSG SafeMsg;
2431
2432 _SEH2_TRY
2433 {
2434 ProbeForRead(UnsafeMsgInfo, sizeof(MSG), 1);
2435 RtlCopyMemory(&SafeMsg, UnsafeMsgInfo, sizeof(MSG));
2436 }
2438 {
2440 _SEH2_YIELD(return FALSE);
2441 }
2442 _SEH2_END;
2443
2445
2446 Res = IntDispatchMessage(&SafeMsg);
2447
2448 UserLeave();
2449 return Res;
2450}
2451
2454{
2455 MSG SafeMsg;
2456 BOOL Ret;
2457 PWND pWnd;
2458
2459 _SEH2_TRY
2460 {
2461 ProbeForRead(lpMsg, sizeof(MSG), 1);
2462 RtlCopyMemory(&SafeMsg, lpMsg, sizeof(MSG));
2463 }
2465 {
2467 _SEH2_YIELD(return FALSE);
2468 }
2469 _SEH2_END;
2470
2472 pWnd = UserGetWindowObject(SafeMsg.hwnd);
2473 if (pWnd) // Must have a window!
2474 {
2475 Ret = IntTranslateKbdMessage(&SafeMsg, flags);
2476 }
2477 else
2478 {
2479 TRACE("No Window for Translate. hwnd 0x%p Msg %u\n", SafeMsg.hwnd, SafeMsg.message);
2480 Ret = FALSE;
2481 }
2482 UserLeave();
2483
2484 return Ret;
2485}
2486
2488
2491 UINT Msg,
2492 WPARAM wParam,
2493 LPARAM lParam,
2494 ULONG_PTR ResultInfo,
2495 DWORD dwType, // fnID?
2496 BOOL Ansi)
2497{
2498 LRESULT lResult = 0;
2499 BOOL Ret = FALSE;
2500 PWND Window = NULL;
2502
2504
2505 switch(dwType)
2506 {
2507 case FNID_SCROLLBAR:
2508 {
2509 lResult = ScrollBarWndProc(hWnd, Msg, wParam, lParam);
2510 break;
2511 }
2512 case FNID_DESKTOP:
2513 {
2515 if (Window)
2516 {
2517 //ERR("FNID_DESKTOP IN\n");
2518 Ret = DesktopWindowProc(Window, Msg, wParam, lParam, &lResult);
2519 //ERR("FNID_DESKTOP OUT\n");
2520 }
2521 break;
2522 }
2523 case FNID_MENU:
2524 {
2526 if (Window)
2527 {
2528 Ret = PopupMenuWndProc( Window, Msg, wParam, lParam, &lResult);
2529 }
2530 break;
2531 }
2532 case FNID_MESSAGEWND:
2533 {
2535 if (Window)
2536 {
2537 Ret = !UserMessageWindowProc(Window, Msg, wParam, lParam, &lResult);
2538 }
2539 break;
2540 }
2541 case FNID_DEFWINDOWPROC:
2542 /* Validate input */
2543 if (hWnd)
2544 {
2546 if (!Window)
2547 {
2548 UserLeave();
2549 return FALSE;
2550 }
2551 UserRefObjectCo(Window, &Ref);
2552 }
2553 lResult = IntDefWindowProc(Window, Msg, wParam, lParam, Ansi);
2554 Ret = TRUE;
2555 if (hWnd)
2557 break;
2560 break;
2562 {
2563 BROADCASTPARM parm, *retparam;
2564 DWORD_PTR RetVal = 0;
2565
2566 if (ResultInfo)
2567 {
2568 _SEH2_TRY
2569 {
2570 ProbeForWrite((PVOID)ResultInfo, sizeof(BROADCASTPARM), 1);
2571 RtlCopyMemory(&parm, (PVOID)ResultInfo, sizeof(BROADCASTPARM));
2572 }
2574 {
2575 _SEH2_YIELD(break);
2576 }
2577 _SEH2_END;
2578 }
2579 else
2580 break;
2581
2582 if ( parm.recipients & BSM_ALLDESKTOPS ||
2584 {
2585 PLIST_ENTRY DesktopEntry;
2586 PDESKTOP rpdesk;
2587 HWND *List, hwndDenied = NULL;
2588 HDESK hDesk = NULL;
2589 PWND pwnd, pwndDesk;
2590 ULONG i;
2591 UINT fuFlags;
2592
2593 for (DesktopEntry = InputWindowStation->DesktopListHead.Flink;
2594 DesktopEntry != &InputWindowStation->DesktopListHead;
2595 DesktopEntry = DesktopEntry->Flink)
2596 {
2597 rpdesk = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry);
2598 pwndDesk = rpdesk->pDeskInfo->spwnd;
2599 List = IntWinListChildren(pwndDesk);
2600
2601 if (parm.flags & BSF_QUERY)
2602 {
2603 if (List != NULL)
2604 {
2605 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2606 {
2607 fuFlags = SMTO_ABORTIFHUNG;
2608 }
2609 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2610 {
2611 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2612 }
2613 else
2614 {
2615 fuFlags = SMTO_NORMAL;
2616 }
2618 Msg,
2619 wParam,
2620 lParam,
2621 fuFlags,
2622 2000,
2623 &RetVal);
2624 Ret = TRUE;
2625 for (i = 0; List[i]; i++)
2626 {
2627 pwnd = UserGetWindowObject(List[i]);
2628 if (!pwnd) continue;
2629
2630 if ( pwnd->fnid == FNID_MENU ||
2632 continue;
2633
2634 if ( parm.flags & BSF_IGNORECURRENTTASK )
2635 {
2636 if ( pwnd->head.pti == gptiCurrent )
2637 continue;
2638 }
2640 Msg,
2641 wParam,
2642 lParam,
2643 fuFlags,
2644 2000,
2645 &RetVal);
2646
2647 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2648 {
2649 if (!(parm.flags & BSF_FORCEIFHUNG))
2650 Ret = FALSE;
2651 }
2652 if (RetVal == BROADCAST_QUERY_DENY)
2653 {
2654 hwndDenied = List[i];
2655 hDesk = UserHMGetHandle(pwndDesk);
2656 Ret = FALSE;
2657 }
2658 }
2660 _SEH2_TRY
2661 {
2662 retparam = (PBROADCASTPARM) ResultInfo;
2663 retparam->hDesk = hDesk;
2664 retparam->hWnd = hwndDenied;
2665 }
2667 {
2668 _SEH2_YIELD(break);
2669 }
2670 _SEH2_END;
2671 if (!Ret) break; // Have a hit! Let everyone know!
2672 }
2673 }
2674 else if (parm.flags & BSF_POSTMESSAGE)
2675 {
2676 if (List != NULL)
2677 {
2679
2680 for (i = 0; List[i]; i++)
2681 {
2682 pwnd = UserGetWindowObject(List[i]);
2683 if (!pwnd) continue;
2684
2685 if ( pwnd->fnid == FNID_MENU ||
2687 continue;
2688
2689 if ( parm.flags & BSF_IGNORECURRENTTASK )
2690 {
2691 if ( pwnd->head.pti == gptiCurrent )
2692 continue;
2693 }
2695 }
2697 }
2698 Ret = TRUE;
2699 }
2700 else
2701 {
2702 if (List != NULL)
2703 {
2705
2706 for (i = 0; List[i]; i++)
2707 {
2708 pwnd = UserGetWindowObject(List[i]);
2709 if (!pwnd) continue;
2710
2711 if ( pwnd->fnid == FNID_MENU ||
2713 continue;
2714
2715 if ( parm.flags & BSF_IGNORECURRENTTASK )
2716 {
2717 if ( pwnd->head.pti == gptiCurrent )
2718 continue;
2719 }
2721 }
2723 }
2724 Ret = TRUE;
2725 }
2726 }
2727 }
2728 else if (parm.recipients & BSM_APPLICATIONS)
2729 {
2730 HWND *List, hwndDenied = NULL;
2731 HDESK hDesk = NULL;
2732 PWND pwnd, pwndDesk;
2733 ULONG i;
2734 UINT fuFlags;
2735
2736 pwndDesk = UserGetDesktopWindow();
2737 List = IntWinListChildren(pwndDesk);
2738
2739 if (parm.flags & BSF_QUERY)
2740 {
2741 if (List != NULL)
2742 {
2743 if (parm.flags & BSF_FORCEIFHUNG || parm.flags & BSF_NOHANG)
2744 {
2745 fuFlags = SMTO_ABORTIFHUNG;
2746 }
2747 else if (parm.flags & BSF_NOTIMEOUTIFNOTHUNG)
2748 {
2749 fuFlags = SMTO_NOTIMEOUTIFNOTHUNG;
2750 }
2751 else
2752 {
2753 fuFlags = SMTO_NORMAL;
2754 }
2756 Msg,
2757 wParam,
2758 lParam,
2759 fuFlags,
2760 2000,
2761 &RetVal);
2762 Ret = TRUE;
2763 for (i = 0; List[i]; i++)
2764 {
2765 pwnd = UserGetWindowObject(List[i]);
2766 if (!pwnd) continue;
2767
2768 if ( pwnd->fnid == FNID_MENU ||
2770 continue;
2771
2772 if ( parm.flags & BSF_IGNORECURRENTTASK )
2773 {
2774 if ( pwnd->head.pti == gptiCurrent )
2775 continue;
2776 }
2778 Msg,
2779 wParam,
2780 lParam,
2781 fuFlags,
2782 2000,
2783 &RetVal);
2784
2785 if (!RetVal && EngGetLastError() == ERROR_TIMEOUT)
2786 {
2787 if (!(parm.flags & BSF_FORCEIFHUNG))
2788 Ret = FALSE;
2789 }
2790 if (RetVal == BROADCAST_QUERY_DENY)
2791 {
2792 hwndDenied = List[i];
2793 hDesk = UserHMGetHandle(pwndDesk);
2794 Ret = FALSE;
2795 }
2796 }
2798 _SEH2_TRY
2799 {
2800 retparam = (PBROADCASTPARM) ResultInfo;
2801 retparam->hDesk = hDesk;
2802 retparam->hWnd = hwndDenied;
2803 }
2805 {
2806 _SEH2_YIELD(break);
2807 }
2808 _SEH2_END;
2809 }
2810 }
2811 else if (parm.flags & BSF_POSTMESSAGE)
2812 {
2813 if (List != NULL)
2814 {
2816
2817 for (i = 0; List[i]; i++)
2818 {
2819 pwnd = UserGetWindowObject(List[i]);
2820 if (!pwnd) continue;
2821
2822 if ( pwnd->fnid == FNID_MENU ||
2824 continue;
2825
2826 if ( parm.flags & BSF_IGNORECURRENTTASK )
2827 {
2828 if ( pwnd->head.pti == gptiCurrent )
2829 continue;
2830 }
2832 }
2834 }
2835 Ret = TRUE;
2836 }
2837 else
2838 {
2839 if (List != NULL)
2840 {
2842
2843 for (i = 0; List[i]; i++)
2844 {
2845 pwnd = UserGetWindowObject(List[i]);
2846 if (!pwnd) continue;
2847
2848 if ( pwnd->fnid == FNID_MENU ||
2850 continue;
2851
2852 if ( parm.flags & BSF_IGNORECURRENTTASK )
2853 {
2854 if ( pwnd->head.pti == gptiCurrent )
2855 continue;
2856 }
2858 }
2860 }
2861 Ret = TRUE;
2862 }
2863 }
2864 }
2865 break;
2867 {
2868 CALL_BACK_INFO CallBackInfo;
2869 ULONG_PTR uResult;
2870
2871 _SEH2_TRY
2872 {
2873 ProbeForRead((PVOID)ResultInfo, sizeof(CALL_BACK_INFO), 1);
2874 RtlCopyMemory(&CallBackInfo, (PVOID)ResultInfo, sizeof(CALL_BACK_INFO));
2875 }
2877 {
2878 _SEH2_YIELD(break);
2879 }
2880 _SEH2_END;
2881
2883 {
2885 break;
2886 }
2887
2889 CallBackInfo.CallBack, CallBackInfo.Context, &uResult)))
2890 {
2891 ERR("Callback failure!\n");
2892 }
2893 }
2894 break;
2895 case FNID_SENDMESSAGE:
2896 {
2897 lResult = co_IntDoSendMessage(hWnd, Msg, wParam, lParam, 0);
2898 Ret = TRUE;
2899
2900 if (ResultInfo)
2901 {
2902 _SEH2_TRY
2903 {
2904 ProbeForWrite((PVOID)ResultInfo, sizeof(ULONG_PTR), 1);
2905 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(ULONG_PTR));
2906 }
2908 {
2909 Ret = FALSE;
2910 _SEH2_YIELD(break);
2911 }
2912 _SEH2_END;
2913 }
2914 break;
2915 }
2916 case FNID_SENDMESSAGEFF:
2918 {
2919 DOSENDMESSAGE dsm, *pdsm = (PDOSENDMESSAGE)ResultInfo;
2920 if (ResultInfo)
2921 {
2922 _SEH2_TRY
2923 {
2924 ProbeForRead(pdsm, sizeof(DOSENDMESSAGE), 1);
2925 RtlCopyMemory(&dsm, pdsm, sizeof(DOSENDMESSAGE));
2926 }
2928 {
2929 _SEH2_YIELD(break);
2930 }
2931 _SEH2_END;
2932 }
2933
2934 Ret = co_IntDoSendMessage( hWnd, Msg, wParam, lParam, pdsm ? &dsm : NULL );
2935
2936 if (pdsm)
2937 {
2938 _SEH2_TRY
2939 {
2940 ProbeForWrite(pdsm, sizeof(DOSENDMESSAGE), 1);
2941 RtlCopyMemory(pdsm, &dsm, sizeof(DOSENDMESSAGE));
2942 }
2944 {
2945 Ret = FALSE;
2946 _SEH2_YIELD(break);
2947 }
2948 _SEH2_END;
2949 }
2950 break;
2951 }
2952 // CallNextHook bypass.
2953 case FNID_CALLWNDPROC:
2955 {
2956 PTHREADINFO pti;
2958 PHOOK NextObj, Hook;
2959
2960 pti = GetW32ThreadInfo();
2961
2962 Hook = pti->sphkCurrent;
2963
2964 if (!Hook) break;
2965
2966 NextObj = Hook->phkNext;
2967 ClientInfo = pti->pClientInfo;
2968 _SEH2_TRY
2969 {
2970 ClientInfo->phkCurrent = NextObj;
2971 }
2973 {
2974 ClientInfo = NULL;
2975 }
2976 _SEH2_END;
2977
2978 if (!ClientInfo || !NextObj) break;
2979
2980 NextObj->phkNext = IntGetNextHook(NextObj);
2981
2982 if ( Hook->HookId == WH_CALLWNDPROC)
2983 {
2984 CWPSTRUCT CWP;
2985 CWP.hwnd = hWnd;
2986 CWP.message = Msg;
2987 CWP.wParam = wParam;
2988 CWP.lParam = lParam;
2989 TRACE("WH_CALLWNDPROC: Hook %p NextHook %p\n", Hook, NextObj);
2990
2991 lResult = co_IntCallHookProc( Hook->HookId,
2992 HC_ACTION,
2993 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
2994 (LPARAM)&CWP,
2995 Hook->Proc,
2996 Hook->ihmod,
2997 Hook->offPfn,
2998 Hook->Ansi,
2999 &Hook->ModuleName);
3000 }
3001 else
3002 {
3003 CWPRETSTRUCT CWPR;
3004 CWPR.hwnd = hWnd;
3005 CWPR.message = Msg;
3006 CWPR.wParam = wParam;
3007 CWPR.lParam = lParam;
3008 CWPR.lResult = ClientInfo->dwHookData;
3009
3010 lResult = co_IntCallHookProc( Hook->HookId,
3011 HC_ACTION,
3012 ((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
3013 (LPARAM)&CWPR,
3014 Hook->Proc,
3015 Hook->ihmod,
3016 Hook->offPfn,
3017 Hook->Ansi,
3018 &Hook->ModuleName);
3019 }
3020 }
3021 break;
3022 }
3023
3024 switch(dwType)
3025 {
3026 case FNID_DEFWINDOWPROC:
3027 case FNID_CALLWNDPROC:
3029 case FNID_SCROLLBAR:
3030 case FNID_DESKTOP:
3031 case FNID_MENU:
3032 if (ResultInfo)
3033 {
3034 _SEH2_TRY
3035 {
3036 ProbeForWrite((PVOID)ResultInfo, sizeof(LRESULT), 1);
3037 RtlCopyMemory((PVOID)ResultInfo, &lResult, sizeof(LRESULT));
3038 }
3040 {
3041 Ret = FALSE;
3042 }
3043 _SEH2_END;
3044 }
3045 break;
3046 default:
3047 break;
3048 }
3049
3050 UserLeave();
3051
3052 return Ret;
3053}
3054
3055#define INFINITE 0xFFFFFFFF
3056#define WAIT_FAILED ((DWORD)0xFFFFFFFF)
3057
3058DWORD
3061 IN DWORD dwMilliseconds,
3062 IN BOOL bSharedWow)
3063{
3065 PPROCESSINFO W32Process;
3066 PTHREADINFO pti;
3068 HANDLE Handles[3];
3071
3073
3077 UserMode,
3078 (PVOID*)&Process,
3079 NULL);
3080
3081 if (!NT_SUCCESS(Status))
3082 {
3083 UserLeave();
3085 return WAIT_FAILED;
3086 }
3087
3089
3090 W32Process = (PPROCESSINFO)Process->Win32Process;
3091
3093 !W32Process ||
3094 pti->ppi == W32Process)
3095 {
3097 UserLeave();
3099 return WAIT_FAILED;
3100 }
3101
3102 Handles[0] = Process;
3103 Handles[1] = W32Process->InputIdleEvent;
3104 Handles[2] = pti->pEventQueueServer; // IntMsqSetWakeMask returns hEventQueueClient
3105
3106 if (!Handles[1])
3107 {
3109 UserLeave();
3110 return STATUS_SUCCESS; /* no event to wait on */
3111 }
3112
3113 if (dwMilliseconds != INFINITE)
3114 Timeout.QuadPart = (LONGLONG) dwMilliseconds * (LONGLONG) -10000;
3115
3117 W32Process->W32PF_flags |= W32PF_WAITFORINPUTIDLE;
3118 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3119 {
3121 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3122 }
3124
3125 TRACE("WFII: ppi %p\n", W32Process);
3126 TRACE("WFII: waiting for %p\n", Handles[1] );
3127
3128 /*
3129 * We must add a refcount to our current PROCESSINFO,
3130 * because anything could happen (including process death) we're leaving win32k
3131 */
3132 IntReferenceProcessInfo(W32Process);
3133
3134 do
3135 {
3136 UserLeave();
3138 Handles,
3139 WaitAny,
3141 UserMode,
3142 FALSE,
3143 dwMilliseconds == INFINITE ? NULL : &Timeout,
3144 NULL);
3146
3147 if (!NT_SUCCESS(Status))
3148 {
3151 goto WaitExit;
3152 }
3153
3154 switch (Status)
3155 {
3156 case STATUS_WAIT_0:
3157 goto WaitExit;
3158
3159 case STATUS_WAIT_2:
3160 {
3161 MSG Msg;
3162 co_IntGetPeekMessage( &Msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, FALSE);
3163 ERR("WFII: WAIT 2\n");
3164 }
3165 break;
3166
3167 case STATUS_TIMEOUT:
3168 ERR("WFII: timeout\n");
3169 case WAIT_FAILED:
3170 goto WaitExit;
3171
3172 default:
3173 ERR("WFII: finished\n");
3175 goto WaitExit;
3176 }
3177 }
3178 while (TRUE);
3179
3180WaitExit:
3182 for (pti = W32Process->ptiList; pti; pti = pti->ptiSibling)
3183 {
3184 pti->TIF_flags &= ~TIF_WAITFORINPUTIDLE;
3185 pti->pClientInfo->dwTIFlags = pti->TIF_flags;
3186 }
3187 W32Process->W32PF_flags &= ~W32PF_WAITFORINPUTIDLE;
3189
3190 IntDereferenceProcessInfo(W32Process);
3192 UserLeave();
3193 return Status;
3194}
3195
3196/* EOF */
const TCHAR * CompletionCallback(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pszContext, const TCHAR *pszBegin)
Definition: Completion.cpp:439
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
struct NameRec_ * Name
Definition: cdprocs.h:460
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
#define CHAR(Char)
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ERR(fmt,...)
Definition: debug.h:110
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:103
#define IS_ATOM(x)
Definition: class.h:3
struct @1632 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define WM_SYSTIMER
Definition: comctl32.h:119
#define BSF_POSTMESSAGE
Definition: dbt.h:58
#define BSF_NOTIMEOUTIFNOTHUNG
Definition: dbt.h:57
#define BSF_NOHANG
Definition: dbt.h:56
#define BSF_IGNORECURRENTTASK
Definition: dbt.h:55
#define BSF_QUERY
Definition: dbt.h:59
#define BSM_APPLICATIONS
Definition: dbt.h:48
#define BSF_FORCEIFHUNG
Definition: dbt.h:54
#define BSM_ALLDESKTOPS
Definition: dbt.h:49
#define BSM_ALLCOMPONENTS
Definition: dbt.h:47
#define WM_DDE_FIRST
Definition: dde.h:47
#define WM_DDE_LAST
Definition: dde.h:46
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define APIENTRY
Definition: api.h:79
UINT uFlags
Definition: api.c:59
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
PSERVERINFO gpsi
Definition: imm.c:18
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
static const WCHAR Message[]
Definition: register.c:74
static const WCHAR Cleanup[]
Definition: register.c:80
@ AnsiString
Definition: dnslib.h:19
#define pt(x, y)
Definition: drawing.c:79
#define ULONG_PTR
Definition: config.h:101
#define EngGetTickCount32()
Definition: eng.h:43
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL FASTCALL IntDeactivateWindow(PTHREADINFO pti, HANDLE tid)
Definition: focus.c:191
VOID FASTCALL IntActivateWindow(PWND Wnd, PTHREADINFO pti, HANDLE tid, DWORD Type)
Definition: focus.c:357
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1457
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
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 ISITHOOKED(HookId)
Definition: hook.h:6
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
#define FNID_SENDMESSAGEFF
Definition: ntuser.h:883
#define TIF_INCLEANUP
Definition: ntuser.h:263
#define FNID_SCROLLBAR
Definition: ntuser.h:859
#define FNID_DEFWINDOWPROC
Definition: ntuser.h:863
#define FNID_DESKTOP
Definition: ntuser.h:862
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define TIF_WAITFORINPUTIDLE
Definition: ntuser.h:277
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:623
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
#define FNID_SENDMESSAGECALLBACK
Definition: ntuser.h:890
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
struct _WND * PWND
#define FNID_SENDMESSAGEWTOOPTION
Definition: ntuser.h:885
#define FNID_CALLWNDPROCRET
Definition: ntuser.h:877
#define FNID_CALLWNDPROC
Definition: ntuser.h:876
#define ICLS_SWITCH
Definition: ntuser.h:932
#define CI_CURTHPRHOOK
Definition: ntuser.h:304
struct tagDOSENDMESSAGE * PDOSENDMESSAGE
#define FNID_SENDMESSAGE
Definition: ntuser.h:882
struct _LARGE_STRING * PLARGE_STRING
#define WNDS_ANSICREATOR
Definition: ntuser.h:634
#define FNID_MENU
Definition: ntuser.h:861
struct _BROADCASTPARM * PBROADCASTPARM
#define FNID_BROADCASTSYSTEMMESSAGE
Definition: ntuser.h:887
#define FNID_MESSAGEWND
Definition: ntuser.h:864
#define TIF_MSGPOSCHANGED
Definition: ntuser.h:283
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:627
#define FNID_SENDNOTIFYMESSAGE
Definition: ntuser.h:889
CLIENT_DATA ClientInfo
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
if(dx< 0)
Definition: linetemp.h:194
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define PCHAR
Definition: match.c:90
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static UINT UINT last
Definition: font.c:45
static PLARGE_INTEGER Time
Definition: time.c:105
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL ClearMsgBitsMask(PTHREADINFO pti, UINT MessageBits)
Definition: msgqueue.c:445
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PTHREADINFO pti)
Definition: msgqueue.c:873
BOOL APIENTRY co_MsqPeekHardwareMessage(IN PTHREADINFO pti, IN BOOL Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT MSG *pMsg)
Definition: msgqueue.c:1933
VOID FASTCALL IntCoalesceMouseMove(PTHREADINFO pti)
Definition: msgqueue.c:551
NTSTATUS FASTCALL co_MsqSendMessage(PTHREADINFO ptirec, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult)
Definition: msgqueue.c:1056
VOID FASTCALL MsqPostMessage(PTHREADINFO pti, MSG *Msg, BOOLEAN HardwareMessage, DWORD MessageBits, DWORD dwQEvent, LONG_PTR ExtraInfo)
Definition: msgqueue.c:1337
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2137
NTSTATUS FASTCALL co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: msgqueue.c:2107
BOOLEAN APIENTRY MsqPeekMessage(IN PTHREADINFO pti, IN BOOLEAN Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT LONG_PTR *ExtraInfo, OUT DWORD *dwQEvent, OUT PMSG Message)
Definition: msgqueue.c:2050
VOID FASTCALL MsqWakeQueue(PTHREADINFO pti, DWORD MessageBits, BOOL KeyEvent)
Definition: msgqueue.c:412
PUSER_SENT_MESSAGE FASTCALL AllocateUserMessage(BOOL KEvent)
Definition: msgqueue.c:763
#define POSTEVENT_NWE
Definition: msgqueue.h:125
#define MSQ_NORMAL
Definition: msgqueue.h:4
LRESULT FASTCALL co_IntPostOrSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
@ WM_ASYNC_SHOWWINDOW
Definition: msgqueue.h:117
@ WM_ASYNC_SETWINDOWPOS
Definition: msgqueue.h:118
@ WM_ASYNC_DESTROYWINDOW
Definition: msgqueue.h:120
#define WM_NCMOUSEFIRST
Definition: msgqueue.h:239
#define WM_NCMOUSELAST
Definition: msgqueue.h:240
#define SMF_RECEIVERFREE
Definition: msgqueue.h:40
#define QF_MOUSEMOVED
Definition: msgqueue.h:99
#define MSQ_HUNG
Definition: msgqueue.h:3
#define POSTEVENT_SAW
Definition: msgqueue.h:124
#define POSTEVENT_DAW
Definition: msgqueue.h:123
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define UserMode
Definition: asm.h:35
NTSYSAPI NTSTATUS NTAPI ZwYieldExecution(VOID)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FASTCALL
Definition: nt_native.h:50
#define UNICODE_NULL
@ WaitAny
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1765
NTSTATUS NTAPI KeWaitForMultipleObjects(IN ULONG Count, IN PVOID Object[], IN WAIT_TYPE WaitType, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL, OUT PKWAIT_BLOCK WaitBlockArray OPTIONAL)
Definition: wait.c:586
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process)
Definition: process.c:1043
POBJECT_TYPE PsProcessType
Definition: process.c:20
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define STATUS_WAIT_0
Definition: ntstatus.h:237
#define STATUS_USER_APC
Definition: ntstatus.h:78
#define STATUS_WAIT_2
Definition: ntstatus.h:72
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:535
BOOL FASTCALL IntMakeHungWindowGhosted(HWND hwndHung)
Definition: ghost.c:156
PHOOK FASTCALL IntGetNextHook(PHOOK Hook)
Definition: hook.c:995
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1786
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2566
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:242
#define L(x)
Definition: ntvdm.h:50
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
static ULONG Timeout
Definition: ping.c:61
#define MmCopyFromCaller
Definition: polytest.cpp:29
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:704
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:756
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
#define exit(n)
Definition: config.h:202
#define STATUS_SUCCESS
Definition: shellext.h:65
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:601
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
Implementation of the Explorer desktop window.
Definition: desktop.h:52
Definition: window.c:28
DWORD recipients
Definition: ntuser.h:1109
DWORD flags
Definition: ntuser.h:1108
HDESK hDesk
Definition: ntuser.h:1110
SENDASYNCPROC CallBack
Definition: callback.h:45
ULONG_PTR Context
Definition: callback.h:46
RTL_ATOM atomClassName
Definition: ntuser.h:568
struct _WND * spwnd
Definition: ntuser.h:137
PDESKTOPINFO pDeskInfo
Definition: desktop.h:8
KTHREAD Tcb
Definition: pstypes.h:1103
PVOID Win32Thread
Definition: ketypes.h:1866
ULONG Length
Definition: ntuser.h:91
ULONG MaximumLength
Definition: ntuser.h:92
PVOID Buffer
Definition: ntuser.h:94
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
PTHREADINFO ptiList
Definition: win32.h:256
PPROCESSINFO ppi
Definition: win32.h:88
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
PTHREADINFO ptiSibling
Definition: win32.h:116
INT exitCode
Definition: win32.h:107
struct tagHOOK * sphkCurrent
Definition: win32.h:118
ULONG fsHooks
Definition: win32.h:117
POINT ptLast
Definition: win32.h:129
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
PKEVENT pEventQueueServer
Definition: win32.h:125
BOOLEAN QuitPosted
Definition: win32.h:105
LONG timeLast
Definition: win32.h:102
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
FLONG TIF_flags
Definition: win32.h:95
LIST_ENTRY SentMessagesListHead
Definition: win32.h:100
UINT cPaintsReady
Definition: win32.h:109
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
Definition: timer.h:4
TIMERPROC pfn
Definition: timer.h:13
Definition: object.h:4
UINT flags
Definition: winuser.h:3594
HWND hwndInsertAfter
Definition: winuser.h:3589
LIST_ENTRY DesktopListHead
Definition: winsta.h:19
Definition: ntuser.h:694
PCLS pcls
Definition: ntuser.h:720
THRDESKHEAD head
Definition: ntuser.h:695
DWORD style
Definition: ntuser.h:706
DWORD fnid
Definition: ntuser.h:709
Definition: inflate.c:139
Definition: tftpd.h:60
LPCWSTR lpszClass
Definition: winuser.h:2965
LPCWSTR lpszName
Definition: winuser.h:2964
WPARAM wParam
Definition: winuser.h:3019
LRESULT lResult
Definition: winuser.h:3017
LPARAM lParam
Definition: winuser.h:3018
LPARAM lParam
Definition: winuser.h:3025
WPARAM wParam
Definition: winuser.h:3026
UINT message
Definition: winuser.h:3027
ULONG_PTR Result
Definition: ntuser.h:2650
INT_PTR ihmod
Definition: ntuser.h:245
struct tagHOOK * phkNext
Definition: ntuser.h:241
HOOKPROC Proc
Definition: ntuser.h:250
ULONG_PTR offPfn
Definition: ntuser.h:243
int HookId
Definition: ntuser.h:242
BOOLEAN Ansi
Definition: ntuser.h:251
UNICODE_STRING ModuleName
Definition: ntuser.h:252
UINT Size
Definition: message.c:116
UINT Message
Definition: message.c:115
UINT message
Definition: winuser.h:3115
HWND hwnd
Definition: winuser.h:3114
DWORD time
Definition: winuser.h:3118
WPARAM wParam
Definition: winuser.h:3116
LPARAM lParam
Definition: winuser.h:3117
POINT pt
Definition: winuser.h:3119
PWINDOWPOS lppos
Definition: winuser.h:3599
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1060
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t DWORD_PTR
Definition: typedefs.h:65
INT POOL_TYPE
Definition: typedefs.h:78
int64_t LONGLONG
Definition: typedefs.h:68
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MAXUSHORT
Definition: typedefs.h:83
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define WM_DRAGLOOP
Definition: undocuser.h:57
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
#define WM_DRAGSELECT
Definition: undocuser.h:58
#define WM_QUERYDROPOBJECT
Definition: undocuser.h:55
#define WM_DROPOBJECT
Definition: undocuser.h:54
#define WM_DRAGMOVE
Definition: undocuser.h:59
#define QS_SMRESULT
Definition: undocuser.h:95
#define WM_MAXIMUM
Definition: undocuser.h:64
#define QS_EVENT
Definition: undocuser.h:97
VOID FASTCALL IntPaintWindow(PWND Window)
Definition: painting.c:1177
BOOL FASTCALL IntGetPaintMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove)
Definition: painting.c:1184
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2853
static __inline PVOID UserHeapAlloc(SIZE_T Bytes)
Definition: usrheap.h:34
static __inline PVOID UserHeapAddressToUser(PVOID lpMem)
Definition: usrheap.h:99
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:181
#define W32PF_WAITFORINPUTIDLE
Definition: win32.h:22
#define IntDereferenceProcessInfo(ppi)
Definition: win32.h:186
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
#define RECT
Definition: precomp.h:26
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
LRESULT APIENTRY co_IntCallHookProc(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, HOOKPROC Proc, INT Mod, ULONG_PTR offPfn, BOOLEAN Ansi, PUNICODE_STRING ModuleName)
Definition: callback.c:508
VOID APIENTRY co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, HWND hWnd, UINT Msg, ULONG_PTR CompletionCallbackContext, LRESULT Result)
Definition: callback.c:238
LRESULT APIENTRY co_IntCallWindowProc(WNDPROC Proc, BOOLEAN IsAnsiProc, HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, INT lParamBufferSize)
Definition: callback.c:282
BOOL APIENTRY IntDdePostMessageHook(IN PWND pWnd, IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, IN OUT LONG_PTR *ExtraInfo)
Definition: dde.c:172
BOOL APIENTRY IntDdeGetMessageHook(PMSG pMsg, LONG_PTR ExtraInfo)
Definition: dde.c:326
BOOL FASTCALL IntDdeSendMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dde.c:386
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
BOOL FASTCALL DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: desktop.c:1439
BOOL FASTCALL UserMessageWindowProc(PWND pwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: desktop.c:1525
PTHREADINFO gptiForeground
Definition: focus.c:15
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
LRESULT APIENTRY co_EVENT_CallEvents(DWORD event, HWND hwnd, UINT_PTR idObject, LONG_PTR idChild)
Definition: event.c:150
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1276
BOOL WINAPI PopupMenuWndProc(PWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
Definition: menu.c:4619
struct tagMSGMEMORY * PMSGMEMORY
static MSGMEMORY g_MsgMemory[]
Definition: message.c:121
UINT FASTCALL GetWakeMask(UINT first, UINT last)
Definition: message.c:573
#define PM_BADMSGFLAGS
Definition: message.c:14
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2140
#define MMS_SIZE_LPARAMSZ
Definition: message.c:108
BOOL APIENTRY NtUserDragDetect(HWND hWnd, POINT pt)
Definition: message.c:2159
static LRESULT FASTCALL co_IntSendMessageTimeoutSingle(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1460
#define MMS_SIZE_WPARAMWCHAR
Definition: message.c:107
static int is_pointer_message(UINT message, WPARAM wparam)
Definition: message.c:98
VOID FASTCALL IdlePing(VOID)
Definition: message.c:526
static VOID FASTCALL IntCallWndProcRet(PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *uResult)
Definition: message.c:740
DWORD APIENTRY IntGetQueueStatus(DWORD Changes)
Definition: message.c:2089
BOOL APIENTRY NtUserCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2383
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:840
static UINT FASTCALL MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
Definition: message.c:165
DWORD APIENTRY NtUserWaitForInputIdle(IN HANDLE hProcess, IN DWORD dwMilliseconds, IN BOOL bSharedWow)
Definition: message.c:3060
static LRESULT FASTCALL co_IntDoSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, PDOSENDMESSAGE dsm)
Definition: message.c:1954
BOOL FASTCALL IntMsgCreateStructW(PWND Window, CREATESTRUCTW *pCsw, CREATESTRUCTW *Cs, PVOID *ppszClass, PVOID *ppszName)
Definition: message.c:596
BOOL APIENTRY NtUserPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg)
Definition: message.c:2341
BOOL APIENTRY NtUserMessageCall(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
Definition: message.c:2490
#define MMS_FLAG_WRITE
Definition: message.c:111
LRESULT FASTCALL co_IntSendMessageWithCallBack(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
Definition: message.c:1735
static const unsigned int message_pointer_flags[]
Definition: message.c:36
BOOL APIENTRY NtUserWaitMessage(VOID)
Definition: message.c:2283
BOOL APIENTRY IntInitMessagePumpHook(VOID)
Definition: message.c:2110
struct tagMSGMEMORY MSGMEMORY
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1713
BOOL APIENTRY NtUserPostThreadMessage(DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2246
#define MMS_SIZE_SPECIAL
Definition: message.c:109
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2040
NTSTATUS FASTCALL IntInitMessageImpl(VOID)
Definition: message.c:19
BOOL APIENTRY NtUserTranslateMessage(LPMSG lpMsg, UINT flags)
Definition: message.c:2453
#define MMS_FLAG_READ
Definition: message.c:110
static BOOL is_message_broadcastable(UINT msg)
Definition: message.c:567
#define SET(msg)
Definition: message.c:34
static NTSTATUS FASTCALL CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
Definition: message.c:429
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1345
BOOL APIENTRY NtUserPostMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2229
BOOL FASTCALL co_IntWaitMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:1130
PTHREADINFO FASTCALL IntSendTo(PWND Window, PTHREADINFO ptiCur, UINT Msg)
Definition: message.c:1331
#define INFINITE
Definition: message.c:3055
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1657
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1176
static NTSTATUS PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded)
Definition: message.c:262
#define MMS_FLAG_READWRITE
Definition: message.c:112
#define WAIT_FAILED
Definition: message.c:3056
VOID FASTCALL IdlePong(VOID)
Definition: message.c:556
BOOL APIENTRY co_IntPeekMessage(PMSG Msg, PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, LONG_PTR *ExtraInfo, BOOL bGMSG)
Definition: message.c:964
LRESULT APIENTRY NtUserDispatchMessage(PMSG UnsafeMsgInfo)
Definition: message.c:2427
#define MMS_SIZE_WPARAM
Definition: message.c:106
BOOL APIENTRY IntUninitMessagePumpHook(VOID)
Definition: message.c:2123
static VOID FASTCALL IntCallWndProc(PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:706
static PMSGMEMORY FASTCALL FindMsgMemory(UINT Msg)
Definition: message.c:146
BOOL FASTCALL UserPostThreadMessage(PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1308
LRESULT APIENTRY ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1123
static NTSTATUS FASTCALL CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
Definition: message.c:486
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1445
static LRESULT handle_internal_message(PWND pWnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: message.c:771
static NTSTATUS UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed)
Definition: message.c:380
NTSTATUS FASTCALL IntCleanupMessageImpl(VOID)
Definition: message.c:25
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:254
static LRESULT handle_internal_events(PTHREADINFO pti, PWND pWnd, DWORD dwQEvent, LONG_PTR ExtraInfo, PMSG pMsg)
Definition: message.c:812
BOOL APIENTRY NtUserGetMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:2297
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:213
#define USERTAG_SWP
Definition: tags.h:281
#define USERTAG_WINDOWLIST
Definition: tags.h:298
#define TAG_MSG
Definition: tags.h:7
BOOL FASTCALL ValidateTimerCallback(PTHREADINFO pti, LPARAM lParam)
Definition: timer.c:150
BOOL FASTCALL PostTimerMessages(PWND Window)
Definition: timer.c:395
PTIMER FASTCALL FindSystemTimer(PMSG pMsg)
Definition: timer.c:126
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:274
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:574
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:86
ENGAPI ULONG APIENTRY EngGetLastError(VOID)
Definition: error.c:9
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_TIMEOUT
Definition: winerror.h:941
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define WM_PAINT
Definition: winuser.h:1620
#define LB_ADDFILE
Definition: winuser.h:2030
struct tagMDINEXTMENU MDINEXTMENU
#define CB_SELECTSTRING
Definition: winuser.h:1960
#define QS_KEY
Definition: winuser.h:874
#define EM_GETRECT
Definition: winuser.h:1996
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2035
void(CALLBACK * SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT)
Definition: winuser.h:2916
#define QS_SENDMESSAGE
Definition: winuser.h:880
#define WH_CALLWNDPROCRET
Definition: winuser.h:42
#define CB_GETLBTEXT
Definition: winuser.h:1952
#define WM_MOUSEFIRST
Definition: winuser.h:1774
#define SM_CXDRAG
Definition: winuser.h:1028
#define WM_NEXTMENU
Definition: winuser.h:1806
#define WM_QUIT
Definition: winuser.h:1623
#define WM_MOUSELAST
Definition: winuser.h:1801
#define WM_MDICREATE
Definition: winuser.h:1812
#define HWND_TOPMOST
Definition: winuser.h:1208
#define LB_GETTEXT
Definition: winuser.h:2049
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
struct tagNCCALCSIZE_PARAMS NCCALCSIZE_PARAMS
#define QS_TIMER
Definition: winuser.h:878
#define WM_CREATE
Definition: winuser.h:1608
#define EM_GETSEL
Definition: winuser.h:1997
#define LB_DIR
Definition: winuser.h:2033
#define SMTO_BLOCK
Definition: winuser.h:1224
#define HWND_BROADCAST
Definition: winuser.h:1204
#define WH_MSGFILTER
Definition: winuser.h:29
#define WM_WININICHANGE
Definition: winuser.h:1630
#define LB_GETITEMRECT
Definition: winuser.h:2043
#define EM_REPLACESEL
Definition: winuser.h:2006
#define WM_DEVMODECHANGE
Definition: winuser.h:1631
#define WM_KEYFIRST
Definition: winuser.h:1714
#define HC_ACTION
Definition: winuser.h:48
#define EM_SETRECT
Definition: winuser.h:2016
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:882
#define QS_ALLINPUT
Definition: winuser.h:903
struct tagCREATESTRUCTW CREATESTRUCTW
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define WM_GETTEXT
Definition: winuser.h:1618
struct tagMEASUREITEMSTRUCT MEASUREITEMSTRUCT
struct _WINDOWPOS WINDOWPOS
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1940
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WH_CBT
Definition: winuser.h:35
#define LB_ADDSTRING
Definition: winuser.h:2031
#define CB_DIR
Definition: winuser.h:1938
#define SBM_GETRANGE
Definition: winuser.h:2079
struct tagDRAWITEMSTRUCT DRAWITEMSTRUCT
#define WM_ASKCBFORMATNAME
Definition: winuser.h:1873
#define WM_DELETEITEM
Definition: winuser.h:1647
#define WM_DRAWITEM
Definition: winuser.h:1645
#define WM_NCCREATE
Definition: winuser.h:1683
struct tagMINMAXINFO MINMAXINFO
#define WM_QUEUESYNC
Definition: winuser.h:1639
#define QS_HOTKEY
Definition: winuser.h:881
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define WM_SETTEXT
Definition: winuser.h:1617
#define LB_SELECTSTRING
Definition: winuser.h:2056
#define EM_GETLINE
Definition: winuser.h:1991
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1944
#define EM_SETRECTNP
Definition: winuser.h:2017
#define WM_GETMINMAXINFO
Definition: winuser.h:1640
#define LB_FINDSTRING
Definition: winuser.h:2034
#define PM_NOYIELD
Definition: winuser.h:1197
#define WM_TIMER
Definition: winuser.h:1742
struct tagCOPYDATASTRUCT COPYDATASTRUCT
#define PM_REMOVE
Definition: winuser.h:1196
#define LB_INSERTSTRING
Definition: winuser.h:2053
#define CB_ADDSTRING
Definition: winuser.h:1936
#define QS_INPUT
Definition: winuser.h:899
#define WM_COPYDATA
Definition: winuser.h:1664
#define QS_MOUSE
Definition: winuser.h:892
#define HCBT_QS
Definition: winuser.h:57
struct tagSTYLESTRUCT STYLESTRUCT
struct tagHELPINFO HELPINFO
#define WM_MEASUREITEM
Definition: winuser.h:1646
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WH_GETMESSAGE
Definition: winuser.h:33
#define WH_SYSMSGFILTER
Definition: winuser.h:36
#define QS_POSTMESSAGE
Definition: winuser.h:877
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1223
#define WM_SIZING
Definition: winuser.h:1807
#define CB_GETEDITSEL
Definition: winuser.h:1947
#define QS_PAINT
Definition: winuser.h:879
#define LB_SETTABSTOPS
Definition: winuser.h:2069
#define EM_SETTABSTOPS
Definition: winuser.h:2019
#define CB_FINDSTRING
Definition: winuser.h:1939
#define WM_KEYDOWN
Definition: winuser.h:1715
#define BROADCAST_QUERY_DENY
Definition: winuser.h:178
#define WM_MOVING
Definition: winuser.h:1809
struct _WINDOWPOS * PWINDOWPOS
#define WM_COMPAREITEM
Definition: winuser.h:1655
#define WM_MDIGETACTIVE
Definition: winuser.h:1821
#define CB_INSERTSTRING
Definition: winuser.h:1957
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define WH_FOREGROUNDIDLE
Definition: winuser.h:41
#define SM_CYDRAG
Definition: winuser.h:1029
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define LB_GETSELITEMS
Definition: winuser.h:2048
#define WM_KEYLAST
Definition: winuser.h:1728
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
#define PM_NOREMOVE
Definition: winuser.h:1195
#define WM_GETDLGCODE
Definition: winuser.h:1689
#define HWND_BOTTOM
Definition: winuser.h:1205
#define SMTO_NORMAL
Definition: winuser.h:1225
#define WH_CALLWNDPROC
Definition: winuser.h:34
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ UserRequest
Definition: ketypes.h:421
KAPC_STATE
Definition: ketypes.h:1409
#define ObDereferenceObject
Definition: obfuncs.h:203
#define NT_ASSERT
Definition: rtlfuncs.h:3310
#define RtlUnicodeStringToAnsiSize(String)
Definition: rtlfuncs.h:1005
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185