ReactOS  0.4.12-dev-934-g9a4676f
misc.c File Reference
#include <win32k.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserMisc)
 
int __cdecl _scwprintf (const wchar_t *format,...)
 
PTHREADINFO FASTCALL IntTID2PTI (HANDLE id)
 
DWORD FASTCALL UserGetLanguageToggle (VOID)
 
SHORT FASTCALL UserGetLanguageID (VOID)
 
HBRUSH FASTCALL GetControlColor (PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
 
HBRUSH FASTCALL GetControlBrush (PWND pwnd, HDC hdc, UINT ctlType)
 
HBRUSH APIENTRY NtUserGetControlBrush (HWND hwnd, HDC hdc, UINT ctlType)
 
HBRUSH APIENTRY NtUserGetControlColor (HWND hwndParent, HWND hwnd, HDC hdc, UINT CtlMsg)
 
DWORD_PTR APIENTRY NtUserGetThreadState (DWORD Routine)
 
DWORD APIENTRY NtUserSetThreadState (DWORD Set, DWORD Flags)
 
UINT APIENTRY NtUserGetDoubleClickTime (VOID)
 
BOOL APIENTRY NtUserGetGUIThreadInfo (DWORD idThread, LPGUITHREADINFO lpgui)
 
DWORD APIENTRY NtUserGetGuiResources (HANDLE hProcess, DWORD uiFlags)
 
VOID FASTCALL IntSetWindowState (PWND pWnd, UINT Flag)
 
VOID FASTCALL IntClearWindowState (PWND pWnd, UINT Flag)
 
NTSTATUS FASTCALL IntSafeCopyUnicodeString (PUNICODE_STRING Dest, PUNICODE_STRING Source)
 
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL (PUNICODE_STRING Dest, PUNICODE_STRING Source)
 
void UserDbgAssertThreadInfo (BOOL showCaller)
 
void NTAPI UserDbgPreServiceHook (ULONG ulSyscallId, PULONG_PTR pulArguments)
 
ULONG_PTR NTAPI UserDbgPostServiceHook (ULONG ulSyscallId, ULONG_PTR ulResult)
 
PPROCESSINFO GetW32ProcessInfo (VOID)
 
PTHREADINFO GetW32ThreadInfo (VOID)
 
NTSTATUS GetProcessLuid (IN PETHREAD Thread OPTIONAL, IN PEPROCESS Process OPTIONAL, OUT PLUID Luid)
 

Function Documentation

◆ _scwprintf()

int __cdecl _scwprintf ( const wchar_t format,
  ... 
)

Definition at line 21 of file misc.c.

24 {
25  int len;
26  va_list args;
27 
30  va_end(args);
31 
32  return len;
33 }
Definition: match.c:390
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define args
Definition: format.c:66

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMisc  )

◆ GetControlBrush()

HBRUSH FASTCALL GetControlBrush ( PWND  pwnd,
HDC  hdc,
UINT  ctlType 
)

Definition at line 171 of file misc.c.

175 {
176  PWND pwndParent = IntGetParent(pwnd);
177  return GetControlColor( pwndParent, pwnd, hdc, ctlType);
178 }
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
HDC hdc
Definition: main.c:9
Definition: ntuser.h:657
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185

Referenced by EDIT_NotifyCtlColor(), IntDrawScrollInterior(), NtUserGetControlBrush(), and STATIC_SendWmCtlColorStatic().

◆ GetControlColor()

HBRUSH FASTCALL GetControlColor ( PWND  pwndParent,
PWND  pwnd,
HDC  hdc,
UINT  CtlMsg 
)

Definition at line 145 of file misc.c.

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 }
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:532
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1141
UINT_PTR WPARAM
Definition: windef.h:207
THRDESKHEAD head
Definition: ntuser.h:659
LONG_PTR LPARAM
Definition: windef.h:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1291
HDC hdc
Definition: main.c:9
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183

Referenced by ButtonWndProc_common(), CB_Paint(), COMBO_PrepareColors(), DEFDLG_Proc(), GB_Paint(), GetControlBrush(), IntFillWindow(), LISTBOX_Paint(), LISTBOX_RepaintItem(), ListBoxWndProc_common(), NtUserGetControlColor(), OB_Paint(), PB_Paint(), and UB_Paint().

◆ GetProcessLuid()

NTSTATUS GetProcessLuid ( IN PETHREAD Thread  OPTIONAL,
IN PEPROCESS Process  OPTIONAL,
OUT PLUID  Luid 
)

Definition at line 791 of file misc.c.

795 {
800 
801  if (Thread && Process)
803 
804  /* If nothing has been specified, use the current thread */
805  if (!Thread && !Process)
807 
808  if (Thread)
809  {
810  /* Use a thread token */
811  ASSERT(!Process);
813  &CopyOnOpen,
814  &EffectiveOnly,
816 
817  /* If we don't have a thread token, use a process token */
818  if (!Token)
820  }
821  if (!Token && Process)
822  {
823  /* Use a process token */
825 
826  /* If we don't have a token, fail */
827  if (!Token)
828  return STATUS_NO_TOKEN;
829  }
830  ASSERT(Token);
831 
832  /* Query the LUID */
834 
835  /* Get rid of the token and return */
837  return Status;
838 }
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_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
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI SeQueryAuthenticationIdToken(IN PACCESS_TOKEN Token, OUT PLUID LogonId)
Definition: token.c:1752
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
PEPROCESS PsGetThreadProcess(_In_ PETHREAD Thread)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define STATUS_NO_TOKEN
Definition: ntstatus.h:346
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:432
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:774
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN EffectiveOnly
Definition: sefuncs.h:417

Referenced by BuildUserModeWindowStationName(), IntResolveDesktop(), UserEndShutdown(), and UserInitiateShutdown().

◆ GetW32ProcessInfo()

◆ GetW32ThreadInfo()

PTHREADINFO GetW32ThreadInfo ( VOID  )

Definition at line 783 of file misc.c.

784 {
787 }
#define TRUE
Definition: types.h:120
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:708

Referenced by NtUserGetThreadState().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 592 of file misc.c.

593 {
594  UINT bit;
595  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
596  bit = 1 << LOWORD(Flag);
597  TRACE("CWS %x\n",bit);
598  switch(HIWORD(Flag))
599  {
600  case 0:
601  pWnd->state &= ~bit;
602  break;
603  case 1:
604  pWnd->state2 &= ~bit;
605  break;
606  case 2:
607  pWnd->ExStyle2 &= ~bit;
608  break;
609  }
610 }
DWORD ExStyle2
Definition: ntuser.h:709
PPROCESSINFO ppi
Definition: win32.h:87
THRDESKHEAD head
Definition: ntuser.h:659
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: xml2sdb.h:79
DWORD state
Definition: ntuser.h:665
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:246
DWORD state2
Definition: ntuser.h:666
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NtUserCallHwndParam().

◆ IntSafeCopyUnicodeString()

NTSTATUS FASTCALL IntSafeCopyUnicodeString ( PUNICODE_STRING  Dest,
PUNICODE_STRING  Source 
)

Definition at line 613 of file misc.c.

615 {
617  PWSTR Src;
618 
619  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
620  if(!NT_SUCCESS(Status))
621  {
622  return Status;
623  }
624 
625  if(Dest->Length > 0x4000)
626  {
627  return STATUS_UNSUCCESSFUL;
628  }
629 
630  Src = Dest->Buffer;
631  Dest->Buffer = NULL;
632  Dest->MaximumLength = Dest->Length;
633 
634  if(Dest->Length > 0 && Src)
635  {
637  if(!Dest->Buffer)
638  {
639  return STATUS_NO_MEMORY;
640  }
641 
642  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
643  if(!NT_SUCCESS(Status))
644  {
646  Dest->Buffer = NULL;
647  return Status;
648  }
649 
650 
651  return STATUS_SUCCESS;
652  }
653 
654  /* String is empty */
655  return STATUS_SUCCESS;
656 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TAG_STRING
Definition: oslist.c:24
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
#define MmCopyFromCaller
Definition: polytest.cpp:29
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ IntSafeCopyUnicodeStringTerminateNULL()

NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL ( PUNICODE_STRING  Dest,
PUNICODE_STRING  Source 
)

Definition at line 659 of file misc.c.

661 {
663  PWSTR Src;
664 
665  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
666  if(!NT_SUCCESS(Status))
667  {
668  return Status;
669  }
670 
671  if(Dest->Length > 0x4000)
672  {
673  return STATUS_UNSUCCESSFUL;
674  }
675 
676  Src = Dest->Buffer;
677  Dest->Buffer = NULL;
678  Dest->MaximumLength = 0;
679 
680  if(Dest->Length > 0 && Src)
681  {
682  Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
684  if(!Dest->Buffer)
685  {
686  return STATUS_NO_MEMORY;
687  }
688 
689  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
690  if(!NT_SUCCESS(Status))
691  {
693  Dest->Buffer = NULL;
694  return Status;
695  }
696 
697  /* Make sure the string is null-terminated */
698  Src = (PWSTR)((PBYTE)Dest->Buffer + Dest->Length);
699  *Src = L'\0';
700 
701  return STATUS_SUCCESS;
702  }
703 
704  /* String is empty */
705  return STATUS_SUCCESS;
706 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TAG_STRING
Definition: oslist.c:24
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
#define MmCopyFromCaller
Definition: polytest.cpp:29
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2725
BYTE * PBYTE
Definition: pedump.c:66

Referenced by InitThreadCallback(), and NtUserRegisterWindowMessage().

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 571 of file misc.c.

572 {
573  UINT bit;
574  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
575  bit = 1 << LOWORD(Flag);
576  TRACE("SWS %x\n",bit);
577  switch(HIWORD(Flag))
578  {
579  case 0:
580  pWnd->state |= bit;
581  break;
582  case 1:
583  pWnd->state2 |= bit;
584  break;
585  case 2:
586  pWnd->ExStyle2 |= bit;
587  break;
588  }
589 }
DWORD ExStyle2
Definition: ntuser.h:709
PPROCESSINFO ppi
Definition: win32.h:87
THRDESKHEAD head
Definition: ntuser.h:659
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: xml2sdb.h:79
DWORD state
Definition: ntuser.h:665
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:246
DWORD state2
Definition: ntuser.h:666
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NtUserCallHwndParam().

◆ IntTID2PTI()

PTHREADINFO FASTCALL IntTID2PTI ( HANDLE  id)

Definition at line 41 of file misc.c.

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 }
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
FLONG TIF_flags
Definition: win32.h:94
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:264
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define TIF_INCLEANUP
Definition: ntuser.h:240

Referenced by NtUserAttachThreadInput(), and NtUserSetWindowsHookEx().

◆ NtUserGetControlBrush()

HBRUSH APIENTRY NtUserGetControlBrush ( HWND  hwnd,
HDC  hdc,
UINT  ctlType 
)

Definition at line 182 of file misc.c.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
smooth NULL
Definition: ftsmooth.c:416
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1742
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
HDC hdc
Definition: main.c:9
#define CTLCOLOR_MAX
Definition: winuser.h:948
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:171

Referenced by GetControlBrush().

◆ NtUserGetControlColor()

HBRUSH APIENTRY NtUserGetControlColor ( HWND  hwndParent,
HWND  hwnd,
HDC  hdc,
UINT  CtlMsg 
)

Definition at line 206 of file misc.c.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1742
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
HDC hdc
Definition: main.c:9
#define CTLCOLOR_MAX
Definition: winuser.h:948
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255

Referenced by GetControlColor().

◆ NtUserGetDoubleClickTime()

UINT APIENTRY NtUserGetDoubleClickTime ( VOID  )

Definition at line 357 of file misc.c.

358 {
359  UINT Result;
360 
361  TRACE("Enter NtUserGetDoubleClickTime\n");
362  UserEnterShared();
363 
364  // FIXME: Check if this works on non-interactive winsta
366 
367  TRACE("Leave NtUserGetDoubleClickTime, ret=%u\n", Result);
368  UserLeave();
369  return Result;
370 }
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
INT iDblClickTime
Definition: sysparams.h:90
_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 TRACE(s)
Definition: solgame.cpp:4
SPIVALUES gspv
Definition: sysparams.c:17
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
unsigned int UINT
Definition: ndis.h:50

Referenced by GetDoubleClickTime().

◆ NtUserGetGuiResources()

DWORD APIENTRY NtUserGetGuiResources ( HANDLE  hProcess,
DWORD  uiFlags 
)

Definition at line 507 of file misc.c.

510 {
512  PPROCESSINFO W32Process;
514  DWORD Ret = 0;
516 
517  TRACE("Enter NtUserGetGuiResources\n");
518  UserEnterShared();
519 
522  *PsProcessType,
524  (PVOID*)&Process,
525  NULL);
526 
527  if(!NT_SUCCESS(Status))
528  {
530  RETURN( 0);
531  }
532 
533  W32Process = (PPROCESSINFO)Process->Win32Process;
534  if(!W32Process)
535  {
538  RETURN( 0);
539  }
540 
541  switch(uiFlags)
542  {
543  case GR_GDIOBJECTS:
544  {
545  Ret = (DWORD)W32Process->GDIHandleCount;
546  break;
547  }
548  case GR_USEROBJECTS:
549  {
550  Ret = (DWORD)W32Process->UserHandleCount;
551  break;
552  }
553  default:
554  {
556  break;
557  }
558  }
559 
561 
562  RETURN( Ret);
563 
564 CLEANUP:
565  TRACE("Leave NtUserGetGuiResources, ret=%lu\n",_ret_);
566  UserLeave();
567  END_CLEANUP;
568 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
#define CLEANUP
Definition: ntuser.h:5
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:158
LONG NTSTATUS
Definition: precomp.h:26
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2966
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static DWORD
Definition: misc.c:47
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
POBJECT_TYPE PsProcessType
Definition: process.c:20
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define RETURN(rrr)
Definition: decompress.c:40
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetGuiResources().

◆ NtUserGetGUIThreadInfo()

BOOL APIENTRY NtUserGetGUIThreadInfo ( DWORD  idThread,
LPGUITHREADINFO  lpgui 
)

Definition at line 374 of file misc.c.

377 {
379  PTHRDCARETINFO CaretInfo;
380  GUITHREADINFO SafeGui;
382  PUSER_MESSAGE_QUEUE MsgQueue;
383  PTHREADINFO W32Thread;
384  PETHREAD Thread = NULL;
385 
387 
388  TRACE("Enter NtUserGetGUIThreadInfo\n");
389  UserEnterShared();
390 
391  Status = MmCopyFromCaller(&SafeGui, lpgui, sizeof(DWORD));
392  if(!NT_SUCCESS(Status))
393  {
395  RETURN( FALSE);
396  }
397 
398  if(SafeGui.cbSize != sizeof(GUITHREADINFO))
399  {
401  RETURN( FALSE);
402  }
403 
404  if (idThread)
405  {
407  if(!NT_SUCCESS(Status))
408  {
410  RETURN( FALSE);
411  }
412  W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
413  Desktop = W32Thread->rpdesk;
414 
415  if (!Thread || !Desktop )
416  {
417  if(Thread)
420  RETURN( FALSE);
421  }
422 
423  if ( W32Thread->MessageQueue )
424  MsgQueue = W32Thread->MessageQueue;
425  else
426  {
427  if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
428  }
429  }
430  else
431  { /* Get the foreground thread */
432  /* FIXME: Handle NULL queue properly? */
433  MsgQueue = IntGetFocusMessageQueue();
434  if(!MsgQueue)
435  {
437  RETURN( FALSE);
438  }
439  }
440 
441  CaretInfo = &MsgQueue->CaretInfo;
442 
443  SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0);
444 /*
445  if (W32Thread->pMenuState->pGlobalPopupMenu)
446  {
447  SafeGui.flags |= GUI_INMENUMODE;
448 
449  if (W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify)
450  SafeGui.hwndMenuOwner = UserHMGetHandle(W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify);
451 
452  if (W32Thread->pMenuState->pGlobalPopupMenu->fHasMenuBar)
453  {
454  if (W32Thread->pMenuState->pGlobalPopupMenu->fIsSysMenu)
455  {
456  SafeGui.flags |= GUI_SYSTEMMENUMODE;
457  }
458  }
459  else
460  {
461  SafeGui.flags |= GUI_POPUPMENUMODE;
462  }
463  }
464  */
465  SafeGui.hwndMenuOwner = MsgQueue->MenuOwner;
466 
467  if (MsgQueue->MenuOwner)
468  SafeGui.flags |= GUI_INMENUMODE | MsgQueue->MenuState;
469 
470  if (MsgQueue->MoveSize)
471  SafeGui.flags |= GUI_INMOVESIZE;
472 
473  /* FIXME: Add flag GUI_16BITTASK */
474 
475  SafeGui.hwndActive = MsgQueue->spwndActive ? UserHMGetHandle(MsgQueue->spwndActive) : 0;
476  SafeGui.hwndFocus = MsgQueue->spwndFocus ? UserHMGetHandle(MsgQueue->spwndFocus) : 0;
477  SafeGui.hwndCapture = MsgQueue->spwndCapture ? UserHMGetHandle(MsgQueue->spwndCapture) : 0;
478  SafeGui.hwndMoveSize = MsgQueue->MoveSize;
479  SafeGui.hwndCaret = CaretInfo->hWnd;
480 
481  SafeGui.rcCaret.left = CaretInfo->Pos.x;
482  SafeGui.rcCaret.top = CaretInfo->Pos.y;
483  SafeGui.rcCaret.right = SafeGui.rcCaret.left + CaretInfo->Size.cx;
484  SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + CaretInfo->Size.cy;
485 
486  if (idThread)
488 
489  Status = MmCopyToCaller(lpgui, &SafeGui, sizeof(GUITHREADINFO));
490  if(!NT_SUCCESS(Status))
491  {
493  RETURN( FALSE);
494  }
495 
496  RETURN( TRUE);
497 
498 CLEANUP:
499  TRACE("Leave NtUserGetGUIThreadInfo, ret=%u\n",_ret_);
500  UserLeave();
501  END_CLEANUP;
502 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HWND hwndMenuOwner
Definition: winable.h:75
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
#define TRUE
Definition: types.h:120
#define CLEANUP
Definition: ntuser.h:5
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
DWORD cbSize
Definition: winable.h:70
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
LONG NTSTATUS
Definition: precomp.h:26
KTHREAD Tcb
Definition: pstypes.h:1034
LONG top
Definition: windef.h:292
HWND hwndActive
Definition: winable.h:72
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define GUI_CARETBLINKING
Definition: winable.h:27
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1271
struct _DESKTOP * rpdesk
Definition: win32.h:91
HWND hwndCaret
Definition: winable.h:77
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
HWND hwndFocus
Definition: winable.h:73
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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
HWND hwndMoveSize
Definition: winable.h:76
THRDCARETINFO CaretInfo
Definition: msgqueue.h:92
uint32_t DWORD_PTR
Definition: typedefs.h:63
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
#define GUI_INMENUMODE
Definition: winable.h:29
Status
Definition: gdiplustypes.h:24
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
PVOID Win32Thread
Definition: ketypes.h:1756
LONG bottom
Definition: windef.h:294
LONG cy
Definition: windef.h:320
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
HWND hwndCapture
Definition: winable.h:74
#define RETURN(rrr)
Definition: decompress.c:40
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetGUIThreadInfo().

◆ NtUserGetThreadState()

DWORD_PTR APIENTRY NtUserGetThreadState ( DWORD  Routine)

Definition at line 231 of file misc.c.

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;
298  LARGE_INTEGER LargeTickCount;
300  KeQueryTickCount(&LargeTickCount);
301  pti->timeLast = LargeTickCount.u.LowPart;
302  pti->pcti->tickLastMsgChecked = LargeTickCount.u.LowPart;
303  }
304  break;
305 
308  break;
309 
312  break;
314  ret = (DWORD_PTR) (GetW32ThreadInfo()->MessageQueue->CursorObject ?
315  UserHMGetHandle(GetW32ThreadInfo()->MessageQueue->CursorObject) : 0);
316  break;
319  break;
320  }
321 
322  TRACE("Leave NtUserGetThreadState, ret=%lu\n", ret);
323  UserLeave();
324 
325  return ret;
326 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:39
#define DWORD_PTR
Definition: treelist.c:76
PTHREADINFO GetW32ThreadInfo(VOID)
Definition: misc.c:783
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID)
Definition: msgqueue.c:2501
#define QS_TIMER
Definition: winuser.h:893
#define QS_SMRESULT
Definition: undocuser.h:93
DWORD APIENTRY IntGetQueueStatus(DWORD Changes)
Definition: message.c:1933
#define QS_SENDMESSAGE
Definition: winuser.h:892
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:90
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
#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
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
CHAR Message[80]
Definition: alive.c:5
int ret
LONG timeLast
Definition: win32.h:101
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1322
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define QS_POSTMESSAGE
Definition: winuser.h:888
#define QS_MOUSEBUTTON
Definition: winuser.h:885
#define QS_PAINT
Definition: winuser.h:887
struct _LARGE_INTEGER::@2192 u
#define QS_KEY
Definition: winuser.h:883
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:92
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DIALOG_CreateIndirect(), GetActiveWindow(), GetCapture(), GetCursor(), GetFocus(), GetInputState(), GetMessageTime(), GetProgmanWindow(), GetTaskmanWindow(), GetW32ThreadInfo(), InSendMessage(), InSendMessageEx(), IsGUIThread(), NtUserxGetMessageExtraInfo(), and PeekMessageWorker().

◆ NtUserSetThreadState()

DWORD APIENTRY NtUserSetThreadState ( DWORD  Set,
DWORD  Flags 
)

Definition at line 330 of file misc.c.

333 {
334  PTHREADINFO pti;
335  DWORD Ret = 0;
336  // Test the only flags user can change.
341  if (pti->MessageQueue)
342  {
343  Ret = pti->MessageQueue->QF_flags; // Get the queue flags.
344  if (Set)
345  pti->MessageQueue->QF_flags |= (Set&Flags); // Set the queue flags.
346  else
347  {
348  if (Flags) pti->MessageQueue->QF_flags &= ~Flags; // Clr the queue flags.
349  }
350  }
351  UserLeave();
352  return Ret;
353 }
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define QF_TABSWITCHING
Definition: msgqueue.h:101
#define QF_DIALOGACTIVE
Definition: msgqueue.h:106
static BOOL Set
Definition: pageheap.c:10
#define QF_FF10STATUS
Definition: msgqueue.h:98
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96

Referenced by DEFDLG_Proc().

◆ UserDbgAssertThreadInfo()

void UserDbgAssertThreadInfo ( BOOL  showCaller)

Definition at line 708 of file misc.c.

709 {
710  PTEB Teb;
711  PPROCESSINFO ppi;
712  PCLIENTINFO pci;
713  PTHREADINFO pti;
714 
717  Teb = NtCurrentTeb();
718  pci = GetWin32ClientInfo();
719 
720  ASSERT(Teb);
721  ASSERT(pti);
722  ASSERT(pti->ppi == ppi);
723  ASSERT(pti->pClientInfo == pci);
724  ASSERT(Teb->Win32ThreadInfo == pti);
725  ASSERT(pci->ppi == ppi);
726  ASSERT(pci->fsHooks == pti->fsHooks);
728  if (pti->pcti && pci->pDeskInfo)
729  ASSERT(pci->pClientThreadInfo == (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta));
730  if (pti->pcti && IsListEmpty(&pti->SentMessagesListHead))
731  ASSERT((pti->pcti->fsChangeBits & QS_SENDMESSAGE) == 0);
732  if (pti->KeyboardLayout)
733  ASSERT(pci->hKL == pti->KeyboardLayout->hkl);
734  if(pti->rpdesk != NULL)
735  ASSERT(pti->pDeskInfo == pti->rpdesk->pDeskInfo);
736 
737  /*too bad we still get this assertion*/
738 
739  // Why? Not all flags are passed to the user and doing so could crash the system........
740 
741  /* ASSERT(pci->dwTIFlags == pti->TIF_flags); */
742 /* if(pci->dwTIFlags != pti->TIF_flags)
743  {
744  ERR("pci->dwTIFlags(0x%x) doesn't match pti->TIF_flags(0x%x)\n", pci->dwTIFlags, pti->TIF_flags);
745  if(showCaller)
746  {
747  DbgPrint("Caller:\n");
748  KeRosDumpStackFrames(NULL, 10);
749  }
750  pci->dwTIFlags = pti->TIF_flags;
751  }
752 */
753 }
ULONG fsHooks
Definition: ntuser.h:296
PVOID Win32ThreadInfo
Definition: compat.h:495
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define GetWin32ClientInfo()
Definition: ntuser.h:320
struct _DESKTOP * rpdesk
Definition: win32.h:91
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PCLIENTTHREADINFO pClientThreadInfo
Definition: ntuser.h:300
PPROCESSINFO ppi
Definition: win32.h:87
uint32_t ULONG_PTR
Definition: typedefs.h:63
LIST_ENTRY SentMessagesListHead
Definition: win32.h:99
smooth NULL
Definition: ftsmooth.c:416
#define QS_SENDMESSAGE
Definition: winuser.h:892
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:90
ULONG_PTR ulClientDelta
Definition: ntuser.h:294
ULONG fsHooks
Definition: win32.h:116
struct _CLIENTINFO * pClientInfo
Definition: win32.h:93
HKL hKL
Definition: ntuser.h:307
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PDESKTOPINFO pDeskInfo
Definition: ntuser.h:293
struct tagKL * KeyboardLayout
Definition: win32.h:89
Definition: compat.h:484
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
static __inline ULONG_PTR DesktopHeapGetUserDelta(VOID)
Definition: desktop.h:291
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:92
struct _PROCESSINFO * ppi
Definition: ntuser.h:314

Referenced by GetW32ThreadInfo(), UserDbgPostServiceHook(), and UserDbgPreServiceHook().

◆ UserDbgPostServiceHook()

ULONG_PTR NTAPI UserDbgPostServiceHook ( ULONG  ulSyscallId,
ULONG_PTR  ulResult 
)

Definition at line 764 of file misc.c.

765 {
766  /* Make sure that the first syscall is NtUserInitialize */
767  /* too bad this fails */
768  // ASSERT(gpepCSRSS);
769 
771 
772  return ulResult;
773 }
#define TRUE
Definition: types.h:120
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:708

◆ UserDbgPreServiceHook()

void NTAPI UserDbgPreServiceHook ( ULONG  ulSyscallId,
PULONG_PTR  pulArguments 
)

Definition at line 757 of file misc.c.

758 {
760 }
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:708

◆ UserGetLanguageID()

SHORT FASTCALL UserGetLanguageID ( VOID  )

Definition at line 96 of file misc.c.

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 (SHORT) Ret;
141 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define TAG_STRING
Definition: oslist.c:24
uint16_t * PWSTR
Definition: typedefs.h:54
#define SUBLANG_DEFAULT
Definition: nls.h:168
short SHORT
Definition: pedump.c:59
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define LANG_ENGLISH
Definition: nls.h:52
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
unsigned int ULONG
Definition: retypes.h:1
#define MAKELANGID(p, s)
Definition: nls.h:15
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231

Referenced by DriverEntry().

◆ UserGetLanguageToggle()

DWORD FASTCALL UserGetLanguageToggle ( VOID  )

Definition at line 80 of file misc.c.

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 }
LONG NTSTATUS
Definition: precomp.h:26
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by SpiGetSet(), and SpiUpdatePerUserSystemParameters().