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