ReactOS  0.4.14-dev-1296-g56aa513
misc.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: Miscellaneous User functions
5  * FILE: win32ss/user/ntuser/misc.c
6  * PROGRAMER: Ge van Geldorp (ge@gse.nl)
7  */
8 
9 #include <win32k.h>
10 DBG_DEFAULT_CHANNEL(UserMisc);
11 
12 
13 /*
14  * NOTE: _scwprintf() is NOT exported by ntoskrnl.exe,
15  * only _vscwprintf() is, so we need to implement it here.
16  * Code comes from sdk/lib/crt/printf/_scwprintf.c .
17  * See also win32ss/user/winsrv/usersrv/harderror.c .
18  */
19 int
20 __cdecl
22  const wchar_t *format,
23  ...)
24 {
25  int len;
26  va_list args;
27 
30  va_end(args);
31 
32  return len;
33 }
34 
35 
36 /*
37  * Test the Thread to verify and validate it. Hard to the core tests are required.
38  */
42 {
45  PTHREADINFO pti;
47  if (!NT_SUCCESS(Status))
48  {
49  return NULL;
50  }
52  {
54  return NULL;
55  }
57  if (!pti)
58  {
60  return NULL;
61  }
62  // Validate and verify!
63  _SEH2_TRY
64  {
65  if (pti->TIF_flags & TIF_INCLEANUP) pti = NULL;
66  if (pti && !(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) pti = NULL;
67  if (PsGetThreadId(Thread) != id) pti = NULL;
68  }
70  {
71  pti = NULL;
72  }
73  _SEH2_END
75  return pti;
76 }
77 
78 DWORD
81 {
83  DWORD dwValue = 0;
84 
85  Status = RegReadUserSetting(L"Keyboard Layout\\Toggle", L"Layout Hotkey", REG_SZ, &dwValue, sizeof(dwValue));
86  if (NT_SUCCESS(Status))
87  {
88  dwValue = atoi((char *)&dwValue);
89  TRACE("Layout Hotkey %d\n",dwValue);
90  }
91  return dwValue;
92 }
93 
94 USHORT
97 {
99  OBJECT_ATTRIBUTES ObAttr;
100 // http://support.microsoft.com/kb/324097
104  UNICODE_STRING Language;
105 
106  RtlInitUnicodeString( &Language,
107  L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Language");
108 
110  &Language,
112  NULL,
113  NULL);
114 
115  if ( NT_SUCCESS(ZwOpenKey(&KeyHandle, KEY_READ, &ObAttr)))
116  {
118  if ( pKeyInfo )
119  {
120  RtlInitUnicodeString(&Language, L"Default");
121 
122  if ( NT_SUCCESS(ZwQueryValueKey( KeyHandle,
123  &Language,
125  pKeyInfo,
126  Size,
127  &Size)) )
128  {
129  RtlInitUnicodeString(&Language, (PWSTR)pKeyInfo->Data);
130  if (!NT_SUCCESS(RtlUnicodeStringToInteger(&Language, 16, &Ret)))
131  {
133  }
134  }
135  ExFreePoolWithTag(pKeyInfo, TAG_STRING);
136  }
138  }
139  TRACE("Language ID = %x\n",Ret);
140  return (USHORT) Ret;
141 }
142 
143 HBRUSH
144 FASTCALL
146  PWND pwndParent,
147  PWND pwnd,
148  HDC hdc,
149  UINT CtlMsg)
150 {
151  HBRUSH hBrush;
152 
153  if (!pwndParent) pwndParent = pwnd;
154 
155  if ( pwndParent->head.pti->ppi != PsGetCurrentProcessWin32Process())
156  {
157  return (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
158  }
159 
160  hBrush = (HBRUSH)co_IntSendMessage( UserHMGetHandle(pwndParent), CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd));
161 
162  if (!hBrush || !GreIsHandleValid(hBrush))
163  {
164  hBrush = (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
165  }
166  return hBrush;
167 }
168 
169 HBRUSH
170 FASTCALL
172  PWND pwnd,
173  HDC hdc,
174  UINT ctlType)
175 {
176  PWND pwndParent = IntGetParent(pwnd);
177  return GetControlColor( pwndParent, pwnd, hdc, ctlType);
178 }
179 
180 HBRUSH
181 APIENTRY
183  HWND hwnd,
184  HDC hdc,
185  UINT ctlType)
186 {
187  PWND pwnd;
188  HBRUSH hBrush = NULL;
189 
191  if ( (pwnd = UserGetWindowObject(hwnd)) &&
192  ((ctlType - WM_CTLCOLORMSGBOX) < CTLCOLOR_MAX) &&
193  hdc )
194  {
195  hBrush = GetControlBrush(pwnd, hdc, ctlType);
196  }
197  UserLeave();
198  return hBrush;
199 }
200 
201 /*
202  * Called from PaintRect, works almost like wine PaintRect16 but returns hBrush.
203  */
204 HBRUSH
205 APIENTRY
208  HWND hwnd,
209  HDC hdc,
210  UINT CtlMsg) // Wine PaintRect: WM_CTLCOLORMSGBOX + hbrush
211 {
212  PWND pwnd, pwndParent = NULL;
213  HBRUSH hBrush = NULL;
214 
216  if ( (pwnd = UserGetWindowObject(hwnd)) &&
217  ((CtlMsg - WM_CTLCOLORMSGBOX) < CTLCOLOR_MAX) &&
218  hdc )
219  {
220  if (hwndParent) pwndParent = UserGetWindowObject(hwndParent);
221  hBrush = GetControlColor( pwndParent, pwnd, hdc, CtlMsg);
222  }
223  UserLeave();
224  return hBrush;
225 }
226 
227 /*
228  * @unimplemented
229  */
232  DWORD Routine)
233 {
234  DWORD_PTR ret = 0;
235 
236  TRACE("Enter NtUserGetThreadState\n");
237  if (Routine != THREADSTATE_GETTHREADINFO)
238  {
239  UserEnterShared();
240  }
241  else
242  {
244  }
245 
246  switch (Routine)
247  {
250  break;
253  break;
255  /* FIXME: Should use UserEnterShared */
257  break;
259  ret = (DWORD_PTR)GetW32ThreadInfo()->pDeskInfo->hProgmanWindow;
260  break;
262  ret = (DWORD_PTR)GetW32ThreadInfo()->pDeskInfo->hTaskManWindow;
263  break;
266  break;
268  {
270  ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->pusmCurrent;
271  TRACE("THREADSTATE_INSENDMESSAGE\n");
272 
273  ret = ISMEX_NOSEND;
274  if (Message)
275  {
276  if (Message->ptiSender)
277  ret = ISMEX_SEND;
278  else
279  {
280  if (Message->CompletionCallback)
281  ret = ISMEX_CALLBACK;
282  else
283  ret = ISMEX_NOTIFY;
284  }
285  /* If ReplyMessage */
286  if (Message->QS_Flags & QS_SMRESULT) ret |= ISMEX_REPLIED;
287  }
288 
289  break;
290  }
293  break;
294 
296  {
297  PTHREADINFO pti;
299  pti->pcti->timeLastRead = EngGetTickCount32();
300  break;
301  }
302 
305  break;
306 
309  break;
311  ret = (DWORD_PTR) (GetW32ThreadInfo()->MessageQueue->CursorObject ?
312  UserHMGetHandle(GetW32ThreadInfo()->MessageQueue->CursorObject) : 0);
313  break;
316  break;
317  }
318 
319  TRACE("Leave NtUserGetThreadState, ret=%lu\n", ret);
320  UserLeave();
321 
322  return ret;
323 }
324 
325 DWORD
326 APIENTRY
328  DWORD Set,
329  DWORD Flags)
330 {
331  PTHREADINFO pti;
332  DWORD Ret = 0;
333  // Test the only flags user can change.
338  if (pti->MessageQueue)
339  {
340  Ret = pti->MessageQueue->QF_flags; // Get the queue flags.
341  if (Set)
342  pti->MessageQueue->QF_flags |= (Set&Flags); // Set the queue flags.
343  else
344  {
345  if (Flags) pti->MessageQueue->QF_flags &= ~Flags; // Clr the queue flags.
346  }
347  }
348  UserLeave();
349  return Ret;
350 }
351 
352 UINT
353 APIENTRY
355 {
356  UINT Result;
357 
358  TRACE("Enter NtUserGetDoubleClickTime\n");
359  UserEnterShared();
360 
361  // FIXME: Check if this works on non-interactive winsta
363 
364  TRACE("Leave NtUserGetDoubleClickTime, ret=%u\n", Result);
365  UserLeave();
366  return Result;
367 }
368 
369 BOOL
370 APIENTRY
372  DWORD idThread, /* If NULL use foreground thread */
373  LPGUITHREADINFO lpgui)
374 {
376  PTHRDCARETINFO CaretInfo;
377  GUITHREADINFO SafeGui;
379  PUSER_MESSAGE_QUEUE MsgQueue;
380  PTHREADINFO W32Thread;
381  PETHREAD Thread = NULL;
382 
384 
385  TRACE("Enter NtUserGetGUIThreadInfo\n");
386  UserEnterShared();
387 
388  Status = MmCopyFromCaller(&SafeGui, lpgui, sizeof(DWORD));
389  if(!NT_SUCCESS(Status))
390  {
392  RETURN( FALSE);
393  }
394 
395  if(SafeGui.cbSize != sizeof(GUITHREADINFO))
396  {
398  RETURN( FALSE);
399  }
400 
401  if (idThread)
402  {
404  if(!NT_SUCCESS(Status))
405  {
407  RETURN( FALSE);
408  }
409  W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
410  Desktop = W32Thread->rpdesk;
411 
412  if (!Thread || !Desktop )
413  {
414  if(Thread)
417  RETURN( FALSE);
418  }
419 
420  if ( W32Thread->MessageQueue )
421  MsgQueue = W32Thread->MessageQueue;
422  else
423  {
424  if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
425  }
426  }
427  else
428  { /* Get the foreground thread */
429  /* FIXME: Handle NULL queue properly? */
430  MsgQueue = IntGetFocusMessageQueue();
431  if(!MsgQueue)
432  {
434  RETURN( FALSE);
435  }
436  }
437 
438  CaretInfo = &MsgQueue->CaretInfo;
439 
440  SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0);
441 /*
442  if (W32Thread->pMenuState->pGlobalPopupMenu)
443  {
444  SafeGui.flags |= GUI_INMENUMODE;
445 
446  if (W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify)
447  SafeGui.hwndMenuOwner = UserHMGetHandle(W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify);
448 
449  if (W32Thread->pMenuState->pGlobalPopupMenu->fHasMenuBar)
450  {
451  if (W32Thread->pMenuState->pGlobalPopupMenu->fIsSysMenu)
452  {
453  SafeGui.flags |= GUI_SYSTEMMENUMODE;
454  }
455  }
456  else
457  {
458  SafeGui.flags |= GUI_POPUPMENUMODE;
459  }
460  }
461  */
462  SafeGui.hwndMenuOwner = MsgQueue->MenuOwner;
463 
464  if (MsgQueue->MenuOwner)
465  SafeGui.flags |= GUI_INMENUMODE | MsgQueue->MenuState;
466 
467  if (MsgQueue->MoveSize)
468  SafeGui.flags |= GUI_INMOVESIZE;
469 
470  /* FIXME: Add flag GUI_16BITTASK */
471 
472  SafeGui.hwndActive = MsgQueue->spwndActive ? UserHMGetHandle(MsgQueue->spwndActive) : 0;
473  SafeGui.hwndFocus = MsgQueue->spwndFocus ? UserHMGetHandle(MsgQueue->spwndFocus) : 0;
474  SafeGui.hwndCapture = MsgQueue->spwndCapture ? UserHMGetHandle(MsgQueue->spwndCapture) : 0;
475  SafeGui.hwndMoveSize = MsgQueue->MoveSize;
476  SafeGui.hwndCaret = CaretInfo->hWnd;
477 
478  SafeGui.rcCaret.left = CaretInfo->Pos.x;
479  SafeGui.rcCaret.top = CaretInfo->Pos.y;
480  SafeGui.rcCaret.right = SafeGui.rcCaret.left + CaretInfo->Size.cx;
481  SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + CaretInfo->Size.cy;
482 
483  if (idThread)
485 
486  Status = MmCopyToCaller(lpgui, &SafeGui, sizeof(GUITHREADINFO));
487  if(!NT_SUCCESS(Status))
488  {
490  RETURN( FALSE);
491  }
492 
493  RETURN( TRUE);
494 
495 CLEANUP:
496  TRACE("Leave NtUserGetGUIThreadInfo, ret=%u\n",_ret_);
497  UserLeave();
498  END_CLEANUP;
499 }
500 
501 
502 DWORD
503 APIENTRY
506  DWORD uiFlags)
507 {
509  PPROCESSINFO W32Process;
511  DWORD Ret = 0;
513 
514  TRACE("Enter NtUserGetGuiResources\n");
515  UserEnterShared();
516 
519  *PsProcessType,
521  (PVOID*)&Process,
522  NULL);
523 
524  if(!NT_SUCCESS(Status))
525  {
527  RETURN( 0);
528  }
529 
530  W32Process = (PPROCESSINFO)Process->Win32Process;
531  if(!W32Process)
532  {
535  RETURN( 0);
536  }
537 
538  switch(uiFlags)
539  {
540  case GR_GDIOBJECTS:
541  {
542  Ret = (DWORD)W32Process->GDIHandleCount;
543  break;
544  }
545  case GR_USEROBJECTS:
546  {
547  Ret = (DWORD)W32Process->UserHandleCount;
548  break;
549  }
550  default:
551  {
553  break;
554  }
555  }
556 
558 
559  RETURN( Ret);
560 
561 CLEANUP:
562  TRACE("Leave NtUserGetGuiResources, ret=%lu\n",_ret_);
563  UserLeave();
564  END_CLEANUP;
565 }
566 
569 {
570  UINT bit;
571  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
572  bit = 1 << LOWORD(Flag);
573  TRACE("SWS %x\n",bit);
574  switch(HIWORD(Flag))
575  {
576  case 0:
577  pWnd->state |= bit;
578  break;
579  case 1:
580  pWnd->state2 |= bit;
581  break;
582  case 2:
583  pWnd->ExStyle2 |= bit;
584  break;
585  }
586 }
587 
590 {
591  UINT bit;
592  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
593  bit = 1 << LOWORD(Flag);
594  TRACE("CWS %x\n",bit);
595  switch(HIWORD(Flag))
596  {
597  case 0:
598  pWnd->state &= ~bit;
599  break;
600  case 1:
601  pWnd->state2 &= ~bit;
602  break;
603  case 2:
604  pWnd->ExStyle2 &= ~bit;
605  break;
606  }
607 }
608 
612 {
614  PWSTR Src;
615 
616  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
617  if(!NT_SUCCESS(Status))
618  {
619  return Status;
620  }
621 
622  if(Dest->Length > 0x4000)
623  {
624  return STATUS_UNSUCCESSFUL;
625  }
626 
627  Src = Dest->Buffer;
628  Dest->Buffer = NULL;
629  Dest->MaximumLength = Dest->Length;
630 
631  if(Dest->Length > 0 && Src)
632  {
634  if(!Dest->Buffer)
635  {
636  return STATUS_NO_MEMORY;
637  }
638 
639  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
640  if(!NT_SUCCESS(Status))
641  {
643  Dest->Buffer = NULL;
644  return Status;
645  }
646 
647 
648  return STATUS_SUCCESS;
649  }
650 
651  /* String is empty */
652  return STATUS_SUCCESS;
653 }
654 
658 {
660  PWSTR Src;
661 
662  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
663  if(!NT_SUCCESS(Status))
664  {
665  return Status;
666  }
667 
668  if(Dest->Length > 0x4000)
669  {
670  return STATUS_UNSUCCESSFUL;
671  }
672 
673  Src = Dest->Buffer;
674  Dest->Buffer = NULL;
675  Dest->MaximumLength = 0;
676 
677  if(Dest->Length > 0 && Src)
678  {
679  Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
681  if(!Dest->Buffer)
682  {
683  return STATUS_NO_MEMORY;
684  }
685 
686  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
687  if(!NT_SUCCESS(Status))
688  {
690  Dest->Buffer = NULL;
691  return Status;
692  }
693 
694  /* Make sure the string is null-terminated */
695  Src = (PWSTR)((PBYTE)Dest->Buffer + Dest->Length);
696  *Src = L'\0';
697 
698  return STATUS_SUCCESS;
699  }
700 
701  /* String is empty */
702  return STATUS_SUCCESS;
703 }
704 
706 {
707  PTEB Teb;
708  PPROCESSINFO ppi;
709  PCLIENTINFO pci;
710  PTHREADINFO pti;
711 
714  Teb = NtCurrentTeb();
715  pci = GetWin32ClientInfo();
716 
717  ASSERT(Teb);
718  ASSERT(pti);
719  ASSERT(pti->ppi == ppi);
720  ASSERT(pti->pClientInfo == pci);
721  ASSERT(Teb->Win32ThreadInfo == pti);
722  ASSERT(pci->ppi == ppi);
723  ASSERT(pci->fsHooks == pti->fsHooks);
725  if (pti->pcti && pci->pDeskInfo)
726  ASSERT(pci->pClientThreadInfo == (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta));
727  if (pti->pcti && IsListEmpty(&pti->SentMessagesListHead))
728  ASSERT((pti->pcti->fsChangeBits & QS_SENDMESSAGE) == 0);
729  if (pti->KeyboardLayout)
730  ASSERT(pci->hKL == pti->KeyboardLayout->hkl);
731  if(pti->rpdesk != NULL)
732  ASSERT(pti->pDeskInfo == pti->rpdesk->pDeskInfo);
733 
734  /*too bad we still get this assertion*/
735 
736  // Why? Not all flags are passed to the user and doing so could crash the system........
737 
738  /* ASSERT(pci->dwTIFlags == pti->TIF_flags); */
739 /* if(pci->dwTIFlags != pti->TIF_flags)
740  {
741  ERR("pci->dwTIFlags(0x%x) doesn't match pti->TIF_flags(0x%x)\n", pci->dwTIFlags, pti->TIF_flags);
742  if(showCaller)
743  {
744  DbgPrint("Caller:\n");
745  KeRosDumpStackFrames(NULL, 10);
746  }
747  pci->dwTIFlags = pti->TIF_flags;
748  }
749 */
750 }
751 
752 void
753 NTAPI
754 UserDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments)
755 {
757 }
758 
759 ULONG_PTR
760 NTAPI
761 UserDbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
762 {
763  /* Make sure that the first syscall is NtUserInitialize */
764  /* too bad this fails */
765  // ASSERT(gpepCSRSS);
766 
768 
769  return ulResult;
770 }
771 
772 
775 {
777 }
778 
781 {
784 }
785 
786 
787 NTSTATUS
791  OUT PLUID Luid)
792 {
797 
798  if (Thread && Process)
800 
801  /* If nothing has been specified, use the current thread */
802  if (!Thread && !Process)
804 
805  if (Thread)
806  {
807  /* Use a thread token */
808  ASSERT(!Process);
810  &CopyOnOpen,
811  &EffectiveOnly,
813 
814  /* If we don't have a thread token, use a process token */
815  if (!Token)
817  }
818  if (!Token && Process)
819  {
820  /* Use a process token */
822 
823  /* If we don't have a token, fail */
824  if (!Token)
825  return STATUS_NO_TOKEN;
826  }
827  ASSERT(Token);
828 
829  /* Query the LUID */
831 
832  /* Get rid of the token and return */
834  return Status;
835 }
836 
837 /* EOF */
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:532
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
HBRUSH APIENTRY NtUserGetControlColor(HWND hwndParent, HWND hwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:206
HWND hwndMenuOwner
Definition: winable.h:75
ULONG fsHooks
Definition: ntuser.h:296
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
#define IN
Definition: typedefs.h:39
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
#define TRUE
Definition: types.h:120
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:39
#define CLEANUP
Definition: ntuser.h:5
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
long y
Definition: polytest.cpp:48
#define RETURN(value)
Definition: ntuser.h:4
#define DWORD_PTR
Definition: treelist.c:76
DWORD ExStyle2
Definition: ntuser.h:709
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define __cdecl
Definition: accygwin.h:79
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:158
PTHREADINFO GetW32ThreadInfo(VOID)
Definition: misc.c:780
USHORT MaximumLength
Definition: env_spec_w32.h:370
long x
Definition: polytest.cpp:48
PVOID Win32ThreadInfo
Definition: compat.h:503
#define KEY_READ
Definition: nt_native.h:1023
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:55
#define EngGetTickCount32()
Definition: eng.h:43
DWORD cbSize
Definition: winable.h:70
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
FLONG TIF_flags
Definition: win32.h:94
DWORD APIENTRY NtUserSetThreadState(DWORD Set, DWORD Flags)
Definition: misc.c:327
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define SUBLANG_DEFAULT
Definition: nls.h:168
LONG NTSTATUS
Definition: precomp.h:26
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID)
Definition: msgqueue.c:2512
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
static HDC
Definition: imagelist.c:92
KTHREAD Tcb
Definition: pstypes.h:1034
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
LONG top
Definition: windef.h:307
#define QF_TABSWITCHING
Definition: msgqueue.h:101
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
#define QS_TIMER
Definition: winuser.h:893
HWND hwndActive
Definition: winable.h:72
#define QS_SMRESULT
Definition: undocuser.h:93
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define MmCopyFromCaller
Definition: polytest.cpp:29
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWin32ClientInfo()
Definition: ntuser.h:320
#define GUI_CARETBLINKING
Definition: winable.h:27
LONG left
Definition: windef.h:306
#define QF_DIALOGACTIVE
Definition: msgqueue.h:106
LONG right
Definition: windef.h:308
PPROCESSINFO GetW32ProcessInfo(VOID)
Definition: misc.c:774
#define FASTCALL
Definition: nt_native.h:50
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
Definition: match.c:390
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1271
struct _DESKTOP * rpdesk
Definition: win32.h:91
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static BOOL Set
Definition: pageheap.c:10
#define QF_FF10STATUS
Definition: msgqueue.h:98
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
_SEH2_TRY
Definition: create.c:4250
PCLIENTTHREADINFO pClientThreadInfo
Definition: ntuser.h:300
HWND hwndCaret
Definition: winable.h:77
PPROCESSINFO ppi
Definition: win32.h:87
uint32_t ULONG_PTR
Definition: typedefs.h:64
PTHREADINFO FASTCALL IntTID2PTI(HANDLE id)
Definition: misc.c:41
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
NTSTATUS NTAPI SeQueryAuthenticationIdToken(IN PACCESS_TOKEN Token, OUT PLUID LogonId)
Definition: token.c:1752
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
INT iDblClickTime
Definition: sysparams.h:90
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:496
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define va_end(ap)
Definition: acmsvcex.h:90
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TAG_STRING
Definition: oslist.h:22
LIST_ENTRY SentMessagesListHead
Definition: win32.h:99
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
DBG_DEFAULT_CHANNEL(UserMisc)
HWND hwndFocus
Definition: winable.h:73
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
THRDESKHEAD head
Definition: ntuser.h:659
DWORD APIENTRY IntGetQueueStatus(DWORD Changes)
Definition: message.c:2071
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
_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 QS_SENDMESSAGE
Definition: winuser.h:892
LONG cx
Definition: windef.h:334
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1748
LONG_PTR LPARAM
Definition: windef.h:208
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:264
char * va_list
Definition: acmsvcex.h:78
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:90
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
void NTAPI UserDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments)
Definition: misc.c:754
ULONG_PTR ulClientDelta
Definition: ntuser.h:294
#define QS_INPUT
Definition: winuser.h:881
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
ULONG fsHooks
Definition: win32.h:116
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
if(!(yy_init))
Definition: macro.lex.yy.c:714
VOID FASTCALL IntSetWindowState(PWND pWnd, UINT Flag)
Definition: misc.c:568
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
Definition: xml2sdb.h:79
SPIVALUES gspv
Definition: sysparams.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
#define GUI_INMOVESIZE
Definition: winable.h:28
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:705
#define STATUS_NO_TOKEN
Definition: ntstatus.h:346
struct _CLIENTINFO * pClientInfo
Definition: win32.h:93
HKL hKL
Definition: ntuser.h:307
#define LANG_ENGLISH
Definition: nls.h:52
UINT APIENTRY NtUserGetDoubleClickTime(VOID)
Definition: misc.c:354
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
CHAR Message[80]
Definition: alive.c:5
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
int ret
ULONG_PTR NTAPI UserDbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
Definition: misc.c:761
HWND hwndMoveSize
Definition: winable.h:76
static const WCHAR L[]
Definition: oid.c:1250
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1431
HDC hdc
Definition: main.c:9
GLenum GLsizei len
Definition: glext.h:6722
int __cdecl _scwprintf(const wchar_t *format,...)
Definition: misc.c:21
THRDCARETINFO CaretInfo
Definition: msgqueue.h:92
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
PDESKTOPINFO pDeskInfo
Definition: ntuser.h:293
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
uint32_t DWORD_PTR
Definition: typedefs.h:64
struct tagKL * KeyboardLayout
Definition: win32.h:89
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1322
#define GUI_INMENUMODE
Definition: winable.h:29
#define CTLCOLOR_MAX
Definition: winuser.h:948
Status
Definition: gdiplustypes.h:24
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:782
static DWORD
Definition: misc.c:47
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
Definition: compat.h:492
DWORD_PTR APIENTRY NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
_SEH2_END
Definition: create.c:4424
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
static __inline ULONG_PTR DesktopHeapGetUserDelta(VOID)
Definition: desktop.h:291
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS GetProcessLuid(IN PETHREAD Thread OPTIONAL, IN PEPROCESS Process OPTIONAL, OUT PLUID Luid)
Definition: misc.c:788
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
DWORD state
Definition: ntuser.h:665
#define QS_POSTMESSAGE
Definition: winuser.h:888
#define va_start(ap, A)
Definition: acmsvcex.h:91
unsigned int UINT
Definition: ndis.h:50
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define QS_MOUSEBUTTON
Definition: winuser.h:885
BOOL APIENTRY NtUserGetGUIThreadInfo(DWORD idThread, LPGUITHREADINFO lpgui)
Definition: misc.c:371
HBRUSH APIENTRY NtUserGetControlBrush(HWND hwnd, HDC hdc, UINT ctlType)
Definition: misc.c:182
#define QS_PAINT
Definition: winuser.h:887
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define OUT
Definition: typedefs.h:40
PVOID Win32Thread
Definition: ketypes.h:1756
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
DWORD state2
Definition: ntuser.h:666
#define MAKELANGID(p, s)
Definition: nls.h:15
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
LONG bottom
Definition: windef.h:309
uint32_t * PULONG_PTR
Definition: typedefs.h:64
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
NTSTATUS FASTCALL IntSafeCopyUnicodeString(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:610
USHORT FASTCALL UserGetLanguageID(VOID)
Definition: misc.c:96
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID FASTCALL IntClearWindowState(PWND pWnd, UINT Flag)
Definition: misc.c:589
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN EffectiveOnly
Definition: sefuncs.h:417
#define QS_KEY
Definition: winuser.h:883
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:92
struct _PROCESSINFO * ppi
Definition: ntuser.h:314
return STATUS_SUCCESS
Definition: btrfs.c:2938
DWORD FASTCALL UserGetLanguageToggle(VOID)
Definition: misc.c:80
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:171
#define args
Definition: format.c:66
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:656
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
LONG cy
Definition: windef.h:335
DWORD APIENTRY NtUserGetGuiResources(HANDLE hProcess, DWORD uiFlags)
Definition: misc.c:504
BYTE * PBYTE
Definition: pedump.c:66
POBJECT_TYPE PsProcessType
Definition: process.c:20
#define LOWORD(l)
Definition: pedump.c:82
#define TIF_INCLEANUP
Definition: ntuser.h:240
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
HWND hwndCapture
Definition: winable.h:74
#define APIENTRY
Definition: api.h:79
#define END_CLEANUP
Definition: ntuser.h:6
#define REG_SZ
Definition: layer.c:22
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68