ReactOS  0.4.15-dev-5452-g3c95c95
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)
 
USHORT 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 }
#define args
Definition: format.c:66
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
va_start(ap, x)
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)

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMisc  )

◆ GetControlBrush()

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

Definition at line 172 of file misc.c.

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

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

◆ GetControlColor()

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

Definition at line 146 of file misc.c.

151 {
152  HBRUSH hBrush;
153 
154  if (!pwndParent) pwndParent = pwnd;
155 
156  if ( pwndParent->head.pti->ppi != PsGetCurrentProcessWin32Process())
157  {
158  return (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
159  }
160 
161  hBrush = (HBRUSH)co_IntSendMessage( UserHMGetHandle(pwndParent), CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd));
162 
163  if (!hBrush || !GreIsHandleValid(hBrush))
164  {
165  hBrush = (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
166  }
167  return hBrush;
168 }
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:537
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
UINT_PTR WPARAM
Definition: windef.h:207
#define FALSE
Definition: types.h:117
THRDESKHEAD head
Definition: ntuser.h:690
LONG_PTR LPARAM
Definition: windef.h:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
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 809 of file misc.c.

813 {
818 
819  if (Thread && Process)
821 
822  /* If nothing has been specified, use the current thread */
823  if (!Thread && !Process)
825 
826  if (Thread)
827  {
828  /* Use a thread token */
829  ASSERT(!Process);
831  &CopyOnOpen,
832  &EffectiveOnly,
834 
835  /* If we don't have a thread token, use a process token */
836  if (!Token)
838  }
839  if (!Token && Process)
840  {
841  /* Use a process token */
843 
844  /* If we don't have a token, fail */
845  if (!Token)
846  return STATUS_NO_TOKEN;
847  }
848  ASSERT(Token);
849 
850  /* Query the LUID */
852 
853  /* Get rid of the token and return */
855  return Status;
856 }
#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
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
#define ObDereferenceObject
Definition: obfuncs.h:203
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:849
NTSTATUS NTAPI SeQueryAuthenticationIdToken(_In_ PACCESS_TOKEN Token, _Out_ PLUID LogonId)
Queries the authentication ID of an access token.
Definition: token.c:1823
#define NULL
Definition: types.h:112
_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:401

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

◆ GetW32ProcessInfo()

◆ GetW32ThreadInfo()

PTHREADINFO GetW32ThreadInfo ( VOID  )

Definition at line 801 of file misc.c.

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

Referenced by NtUserGetThreadState().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 612 of file misc.c.

613 {
614  UINT bit;
615  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
616  bit = 1 << LOWORD(Flag);
617  TRACE("CWS %x\n",bit);
618  switch(HIWORD(Flag))
619  {
620  case 0:
621  pWnd->state &= ~bit;
622  break;
623  case 1:
624  pWnd->state2 &= ~bit;
625  break;
626  case 2:
627  pWnd->ExStyle2 &= ~bit;
628  break;
629  }
630 }
DWORD ExStyle2
Definition: ntuser.h:740
PPROCESSINFO ppi
Definition: win32.h:88
THRDESKHEAD head
Definition: ntuser.h:690
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: xml2sdb.h:79
DWORD state
Definition: ntuser.h:696
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:247
DWORD state2
Definition: ntuser.h:697
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NtUserCallHwndParam().

◆ IntSafeCopyUnicodeString()

NTSTATUS FASTCALL IntSafeCopyUnicodeString ( PUNICODE_STRING  Dest,
PUNICODE_STRING  Source 
)

Definition at line 633 of file misc.c.

635 {
637  PWSTR Src;
638 
639  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
640  if(!NT_SUCCESS(Status))
641  {
642  return Status;
643  }
644 
645  if(Dest->Length > 0x4000)
646  {
647  return STATUS_UNSUCCESSFUL;
648  }
649 
650  Src = Dest->Buffer;
651  Dest->Buffer = NULL;
652  Dest->MaximumLength = Dest->Length;
653 
654  if(Dest->Length > 0 && Src)
655  {
657  if(!Dest->Buffer)
658  {
659  return STATUS_NO_MEMORY;
660  }
661 
662  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
663  if(!NT_SUCCESS(Status))
664  {
666  Dest->Buffer = NULL;
667  return Status;
668  }
669 
670 
671  return STATUS_SUCCESS;
672  }
673 
674  /* String is empty */
675  return STATUS_SUCCESS;
676 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define TAG_STRING
Definition: oslist.h:22
Status
Definition: gdiplustypes.h:24
#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
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ IntSafeCopyUnicodeStringTerminateNULL()

NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL ( PUNICODE_STRING  Dest,
PUNICODE_STRING  Source 
)

Definition at line 679 of file misc.c.

681 {
683  PWSTR Src;
684 
685  Status = MmCopyFromCaller(Dest, Source, sizeof(UNICODE_STRING));
686  if(!NT_SUCCESS(Status))
687  {
688  return Status;
689  }
690 
691  if(Dest->Length > 0x4000)
692  {
693  return STATUS_UNSUCCESSFUL;
694  }
695 
696  Src = Dest->Buffer;
697  Dest->Buffer = NULL;
698  Dest->MaximumLength = 0;
699 
700  if(Dest->Length > 0 && Src)
701  {
702  Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
704  if(!Dest->Buffer)
705  {
706  return STATUS_NO_MEMORY;
707  }
708 
709  Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
710  if(!NT_SUCCESS(Status))
711  {
713  Dest->Buffer = NULL;
714  return Status;
715  }
716 
717  /* Make sure the string is null-terminated */
718  Src = (PWSTR)((PBYTE)Dest->Buffer + Dest->Length);
719  *Src = L'\0';
720 
721  return STATUS_SUCCESS;
722  }
723 
724  /* String is empty */
725  return STATUS_SUCCESS;
726 }
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define L(x)
Definition: ntvdm.h:50
#define TAG_STRING
Definition: oslist.h:22
Status
Definition: gdiplustypes.h:24
__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
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
BYTE * PBYTE
Definition: pedump.c:66

Referenced by InitThreadCallback(), and NtUserRegisterWindowMessage().

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 591 of file misc.c.

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

Referenced by NtUserCallHwndParam().

◆ IntTID2PTI()

PTHREADINFO FASTCALL IntTID2PTI ( HANDLE  id)

Definition at line 42 of file misc.c.

43 {
46  PTHREADINFO pti;
48  if (!NT_SUCCESS(Status))
49  {
50  return NULL;
51  }
53  {
55  return NULL;
56  }
58  if (!pti)
59  {
61  return NULL;
62  }
63  // Validate and verify!
64  _SEH2_TRY
65  {
66  if (pti->TIF_flags & TIF_INCLEANUP) pti = NULL;
67  if (pti && !(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) pti = NULL;
68  if (PsGetThreadId(Thread) != id) pti = NULL;
69  }
71  {
72  pti = NULL;
73  }
74  _SEH2_END
76  return pti;
77 }
_SEH2_TRY
Definition: create.c:4226
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:95
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_END
Definition: create.c:4400
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:286
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ObDereferenceObject
Definition: obfuncs.h:203
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
#define NULL
Definition: types.h:112
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define TIF_INCLEANUP
Definition: ntuser.h:262

Referenced by NtUserAttachThreadInput(), NtUserBuildHimcList(), NtUserDisableThreadIme(), NtUserGetGUIThreadInfo(), NtUserGetThreadDesktop(), and NtUserSetWindowsHookEx().

◆ NtUserGetControlBrush()

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

Definition at line 183 of file misc.c.

187 {
188  PWND pwnd;
189  HBRUSH hBrush = NULL;
190 
192  if ( (pwnd = UserGetWindowObject(hwnd)) &&
193  ((ctlType - WM_CTLCOLORMSGBOX) < CTLCOLOR_MAX) &&
194  hdc )
195  {
196  hBrush = GetControlBrush(pwnd, hdc, ctlType);
197  }
198  UserLeave();
199  return hBrush;
200 }
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1756
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:245
HDC hdc
Definition: main.c:9
#define CTLCOLOR_MAX
Definition: winuser.h:952
Definition: ntuser.h:688
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
#define NULL
Definition: types.h:112
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:172

Referenced by GetControlBrush().

◆ NtUserGetControlColor()

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

Definition at line 207 of file misc.c.

212 {
213  PWND pwnd, pwndParent = NULL;
214  HBRUSH hBrush = NULL;
215 
217  if ( (pwnd = UserGetWindowObject(hwnd)) &&
218  ((CtlMsg - WM_CTLCOLORMSGBOX) < CTLCOLOR_MAX) &&
219  hdc )
220  {
221  if (hwndParent) pwndParent = UserGetWindowObject(hwndParent);
222  hBrush = GetControlColor( pwndParent, pwnd, hdc, CtlMsg);
223  }
224  UserLeave();
225  return hBrush;
226 }
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:146
static HWND hwndParent
Definition: cryptui.c:300
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1756
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:245
HDC hdc
Definition: main.c:9
#define CTLCOLOR_MAX
Definition: winuser.h:952
Definition: ntuser.h:688
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
#define NULL
Definition: types.h:112
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by GetControlColor().

◆ NtUserGetDoubleClickTime()

UINT APIENTRY NtUserGetDoubleClickTime ( VOID  )

Definition at line 378 of file misc.c.

379 {
380  UINT Result;
381 
382  TRACE("Enter NtUserGetDoubleClickTime\n");
383  UserEnterShared();
384 
385  // FIXME: Check if this works on non-interactive winsta
387 
388  TRACE("Leave NtUserGetDoubleClickTime, ret=%u\n", Result);
389  UserLeave();
390  return Result;
391 }
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:238
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:254
unsigned int UINT
Definition: ndis.h:50

Referenced by GetDoubleClickTime().

◆ NtUserGetGuiResources()

DWORD APIENTRY NtUserGetGuiResources ( HANDLE  hProcess,
DWORD  uiFlags 
)

Definition at line 527 of file misc.c.

530 {
532  PPROCESSINFO W32Process;
534  DWORD Ret = 0;
536 
537  TRACE("Enter NtUserGetGuiResources\n");
538  UserEnterShared();
539 
542  *PsProcessType,
544  (PVOID*)&Process,
545  NULL);
546 
547  if(!NT_SUCCESS(Status))
548  {
550  RETURN( 0);
551  }
552 
553  W32Process = (PPROCESSINFO)Process->Win32Process;
554  if(!W32Process)
555  {
558  RETURN( 0);
559  }
560 
561  switch(uiFlags)
562  {
563  case GR_GDIOBJECTS:
564  {
565  Ret = (DWORD)W32Process->GDIHandleCount;
566  break;
567  }
568  case GR_USEROBJECTS:
569  {
570  Ret = (DWORD)W32Process->UserHandleCount;
571  break;
572  }
573  default:
574  {
576  break;
577  }
578  }
579 
581 
582  RETURN( Ret);
583 
584 CLEANUP:
585  TRACE("Leave NtUserGetGuiResources, ret=%lu\n",_ret_);
586  UserLeave();
587  END_CLEANUP;
588 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:238
#define CLEANUP
Definition: ntuser.h:5
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
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:3062
#define RETURN(x)
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
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
static DWORD
Definition: misc.c:47
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
#define NULL
Definition: types.h:112
_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:28
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetGuiResources().

◆ NtUserGetGUIThreadInfo()

BOOL APIENTRY NtUserGetGUIThreadInfo ( DWORD  idThread,
LPGUITHREADINFO  lpgui 
)

Definition at line 395 of file misc.c.

398 {
400  PTHRDCARETINFO CaretInfo;
401  GUITHREADINFO SafeGui;
403  PUSER_MESSAGE_QUEUE MsgQueue;
404  PTHREADINFO W32Thread, pti;
405 
407 
408  TRACE("Enter NtUserGetGUIThreadInfo\n");
409  UserEnterShared();
410 
411  Status = MmCopyFromCaller(&SafeGui, lpgui, sizeof(DWORD));
412  if(!NT_SUCCESS(Status))
413  {
415  RETURN( FALSE);
416  }
417 
418  if(SafeGui.cbSize != sizeof(GUITHREADINFO))
419  {
421  RETURN( FALSE);
422  }
423 
424  if (idThread)
425  {
427 
428  // Validate Tread ID
429  W32Thread = IntTID2PTI((HANDLE)(DWORD_PTR)idThread);
430 
431  if ( !W32Thread )
432  {
434  RETURN( FALSE);
435  }
436 
437  Desktop = W32Thread->rpdesk;
438 
439  // Check Desktop and it must be the same as current.
440  if ( !Desktop || Desktop != pti->rpdesk )
441  {
443  RETURN( FALSE);
444  }
445 
446  if ( W32Thread->MessageQueue )
447  MsgQueue = W32Thread->MessageQueue;
448  else
449  {
450  MsgQueue = Desktop->ActiveMessageQueue;
451  }
452  }
453  else
454  { /* Get the foreground thread */
455  /* FIXME: Handle NULL queue properly? */
456  MsgQueue = IntGetFocusMessageQueue();
457  if(!MsgQueue)
458  {
460  RETURN( FALSE);
461  }
462  }
463 
464  CaretInfo = &MsgQueue->CaretInfo;
465 
466  SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0);
467 /*
468  if (W32Thread->pMenuState->pGlobalPopupMenu)
469  {
470  SafeGui.flags |= GUI_INMENUMODE;
471 
472  if (W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify)
473  SafeGui.hwndMenuOwner = UserHMGetHandle(W32Thread->pMenuState->pGlobalPopupMenu->spwndNotify);
474 
475  if (W32Thread->pMenuState->pGlobalPopupMenu->fHasMenuBar)
476  {
477  if (W32Thread->pMenuState->pGlobalPopupMenu->fIsSysMenu)
478  {
479  SafeGui.flags |= GUI_SYSTEMMENUMODE;
480  }
481  }
482  else
483  {
484  SafeGui.flags |= GUI_POPUPMENUMODE;
485  }
486  }
487  */
488  SafeGui.hwndMenuOwner = MsgQueue->MenuOwner;
489 
490  if (MsgQueue->MenuOwner)
491  SafeGui.flags |= GUI_INMENUMODE | MsgQueue->MenuState;
492 
493  if (MsgQueue->MoveSize)
494  SafeGui.flags |= GUI_INMOVESIZE;
495 
496  /* FIXME: Add flag GUI_16BITTASK */
497 
498  SafeGui.hwndActive = MsgQueue->spwndActive ? UserHMGetHandle(MsgQueue->spwndActive) : 0;
499  SafeGui.hwndFocus = MsgQueue->spwndFocus ? UserHMGetHandle(MsgQueue->spwndFocus) : 0;
500  SafeGui.hwndCapture = MsgQueue->spwndCapture ? UserHMGetHandle(MsgQueue->spwndCapture) : 0;
501  SafeGui.hwndMoveSize = MsgQueue->MoveSize;
502  SafeGui.hwndCaret = CaretInfo->hWnd;
503 
504  SafeGui.rcCaret.left = CaretInfo->Pos.x;
505  SafeGui.rcCaret.top = CaretInfo->Pos.y;
506  SafeGui.rcCaret.right = SafeGui.rcCaret.left + CaretInfo->Size.cx;
507  SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + CaretInfo->Size.cy;
508 
509  Status = MmCopyToCaller(lpgui, &SafeGui, sizeof(GUITHREADINFO));
510  if(!NT_SUCCESS(Status))
511  {
513  RETURN( FALSE);
514  }
515 
516  RETURN( TRUE);
517 
518 CLEANUP:
519  TRACE("Leave NtUserGetGUIThreadInfo, ret=%u\n",_ret_);
520  UserLeave();
521  END_CLEANUP;
522 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HWND hwndMenuOwner
Definition: winable.h:75
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:238
#define CLEANUP
Definition: ntuser.h:5
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
DWORD cbSize
Definition: winable.h:70
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LONG NTSTATUS
Definition: precomp.h:26
LONG top
Definition: windef.h:307
HWND hwndActive
Definition: winable.h:72
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define GUI_CARETBLINKING
Definition: winable.h:27
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1307
struct _DESKTOP * rpdesk
Definition: win32.h:92
#define RETURN(x)
HWND hwndCaret
Definition: winable.h:77
PTHREADINFO FASTCALL IntTID2PTI(HANDLE id)
Definition: misc.c:42
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
HWND hwndFocus
Definition: winable.h:73
unsigned char BOOLEAN
LONG cx
Definition: windef.h:334
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
Status
Definition: gdiplustypes.h:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#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
#define GUI_INMOVESIZE
Definition: winable.h:28
HWND hwndMoveSize
Definition: winable.h:76
THRDCARETINFO CaretInfo
Definition: msgqueue.h:92
uint32_t DWORD_PTR
Definition: typedefs.h:65
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
#define GUI_INMENUMODE
Definition: winable.h:29
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
LONG bottom
Definition: windef.h:309
LONG cy
Definition: windef.h:335
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
HWND hwndCapture
Definition: winable.h:74
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetGUIThreadInfo().

◆ NtUserGetThreadState()

DWORD_PTR APIENTRY NtUserGetThreadState ( DWORD  Routine)

Definition at line 232 of file misc.c.

234 {
235  DWORD_PTR ret = 0;
236  PTHREADINFO pti;
237 
238  TRACE("Enter NtUserGetThreadState\n");
239  if (Routine != THREADSTATE_GETTHREADINFO)
240  {
241  UserEnterShared();
242  }
243  else
244  {
246  }
247 
249 
250  switch (Routine)
251  {
253  ret = TRUE;
254  break;
257  break;
259  /* FIXME: Should use UserEnterShared */
261  break;
262  case THREADSTATE_PROGMANWINDOW: /* FIXME: Delete this HACK */
263  ret = (DWORD_PTR)GetW32ThreadInfo()->pDeskInfo->hProgmanWindow;
264  break;
265  case THREADSTATE_TASKMANWINDOW: /* FIXME: Delete this HACK */
266  ret = (DWORD_PTR)GetW32ThreadInfo()->pDeskInfo->hTaskManWindow;
267  break;
270  break;
272  {
274  ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->pusmCurrent;
275  TRACE("THREADSTATE_INSENDMESSAGE\n");
276 
277  ret = ISMEX_NOSEND;
278  if (Message)
279  {
280  if (Message->ptiSender)
281  ret = ISMEX_SEND;
282  else
283  {
284  if (Message->CompletionCallback)
285  ret = ISMEX_CALLBACK;
286  else
287  ret = ISMEX_NOTIFY;
288  }
289  /* If ReplyMessage */
290  if (Message->QS_Flags & QS_SMRESULT) ret |= ISMEX_REPLIED;
291  }
292 
293  break;
294  }
297  break;
298 
300  pti->pcti->timeLastRead = EngGetTickCount32();
301  break;
302 
305  break;
306 
309  break;
311  ret = (DWORD_PTR) (GetW32ThreadInfo()->MessageQueue->CursorObject ?
312  UserHMGetHandle(GetW32ThreadInfo()->MessageQueue->CursorObject) : 0);
313  break;
316  break;
318  if (pti->spwndDefaultIme)
320  break;
322  if (pti->spDefaultImc)
324  break;
326  ret = pti->pcti->fsChangeBits;
327  break;
329  ret = pti->ppi->dwImeCompatFlags;
330  break;
332  ret = (ULONG_PTR)pti->hklPrev;
333  break;
337  break;
339  /* FIXME */
340  break;
341  }
342 
343  TRACE("Leave NtUserGetThreadState, ret=%lu\n", ret);
344  UserLeave();
345 
346  return ret;
347 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:238
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:41
struct tagIMC * spDefaultImc
Definition: win32.h:132
#define DWORD_PTR
Definition: treelist.c:76
PTHREADINFO GetW32ThreadInfo(VOID)
Definition: misc.c:801
#define TRUE
Definition: types.h:120
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
#define EngGetTickCount32()
Definition: eng.h:43
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID)
Definition: msgqueue.c:2511
#define QS_TIMER
Definition: winuser.h:872
#define QS_SMRESULT
Definition: undocuser.h:95
PPROCESSINFO ppi
Definition: win32.h:88
DWORD dwImeCompatFlags
Definition: win32.h:276
DWORD APIENTRY IntGetQueueStatus(DWORD Changes)
Definition: message.c:2086
HKL hklPrev
Definition: win32.h:133
#define QS_SENDMESSAGE
Definition: winuser.h:874
struct _WND * spwndDefaultIme
Definition: win32.h:131
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
#define QS_INPUT
Definition: winuser.h:893
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:245
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define TRACE(s)
Definition: solgame.cpp:4
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
CHAR Message[80]
Definition: alive.c:5
int ret
uint32_t DWORD_PTR
Definition: typedefs.h:65
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
#define QS_POSTMESSAGE
Definition: winuser.h:871
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
#define QS_MOUSEBUTTON
Definition: winuser.h:870
#define QS_PAINT
Definition: winuser.h:873
#define ULONG_PTR
Definition: config.h:101
#define QS_KEY
Definition: winuser.h:868
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
#define LOWORD(l)
Definition: pedump.c:82
HANDLE gpidLogon
Definition: simplecall.c:15

Referenced by CheckThreadState(), DIALOG_CreateIndirect(), DoTest_BUTTON(), DoTest_EDIT(), GetActiveWindow(), GetCapture(), GetCursor(), GetFocus(), GetInputState(), GetMessageTime(), GetProgmanWindow(), GetTaskmanWindow(), GetW32ThreadInfo(), ImeWnd_OnImeSetContext(), Imm32CurrentPti(), Imm32ImeNonImeToggle(), Imm32InquireIme(), ImmCreateContext(), ImmDllInitialize(), ImmGetDefaultIMEWnd(), ImmGetSaveContext(), ImmLockClientImc(), ImmWINNLSEnableIME(), InSendMessage(), InSendMessageEx(), IsGUIThread(), NtUserxGetMessageExtraInfo(), and PeekMessageWorker().

◆ NtUserSetThreadState()

DWORD APIENTRY NtUserSetThreadState ( DWORD  Set,
DWORD  Flags 
)

Definition at line 351 of file misc.c.

354 {
355  PTHREADINFO pti;
356  DWORD Ret = 0;
357  // Test the only flags user can change.
362  if (pti->MessageQueue)
363  {
364  Ret = pti->MessageQueue->QF_flags; // Get the queue flags.
365  if (Set)
366  pti->MessageQueue->QF_flags |= (Set&Flags); // Set the queue flags.
367  else
368  {
369  if (Flags) pti->MessageQueue->QF_flags &= ~Flags; // Clr the queue flags.
370  }
371  }
372  UserLeave();
373  return Ret;
374 }
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
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:245
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96

Referenced by DEFDLG_Proc().

◆ UserDbgAssertThreadInfo()

void UserDbgAssertThreadInfo ( BOOL  showCaller)

Definition at line 728 of file misc.c.

729 {
730  PTEB Teb;
731  PPROCESSINFO ppi;
732  PCLIENTINFO pci;
733  PTHREADINFO pti;
734 
737  Teb = NtCurrentTeb();
738  pci = GetWin32ClientInfo();
739 
740  ASSERT(Teb);
741  ASSERT(pti);
742  ASSERT(pti->ppi == ppi);
743  ASSERT(pti->pClientInfo == pci);
744  ASSERT(Teb->Win32ThreadInfo == pti);
745  ASSERT(pci->ppi == ppi);
746  ASSERT(pci->fsHooks == pti->fsHooks);
748  if (pti->pcti && pci->pDeskInfo)
749  ASSERT(pci->pClientThreadInfo == (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta));
750  if (pti->KeyboardLayout)
751  ASSERT(pci->hKL == pti->KeyboardLayout->hkl);
752  if(pti->rpdesk != NULL)
753  ASSERT(pti->pDeskInfo == pti->rpdesk->pDeskInfo);
754 
755  /*too bad we still get this assertion*/
756 
757  // Why? Not all flags are passed to the user and doing so could crash the system........
758 
759  /* ASSERT(pci->dwTIFlags == pti->TIF_flags); */
760 /* if(pci->dwTIFlags != pti->TIF_flags)
761  {
762  ERR("pci->dwTIFlags(0x%x) doesn't match pti->TIF_flags(0x%x)\n", pci->dwTIFlags, pti->TIF_flags);
763  if(showCaller)
764  {
765  DbgPrint("Caller:\n");
766  KeRosDumpStackFrames(NULL, 10);
767  }
768  pci->dwTIFlags = pti->TIF_flags;
769  }
770 */
771 }
ULONG fsHooks
Definition: ntuser.h:323
PVOID Win32ThreadInfo
Definition: compat.h:846
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define GetWin32ClientInfo()
Definition: ntuser.h:347
struct _DESKTOP * rpdesk
Definition: win32.h:92
PCLIENTTHREADINFO pClientThreadInfo
Definition: ntuser.h:327
PPROCESSINFO ppi
Definition: win32.h:88
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
ULONG_PTR ulClientDelta
Definition: ntuser.h:321
ULONG fsHooks
Definition: win32.h:117
#define ASSERT(a)
Definition: mode.c:44
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
HKL hKL
Definition: ntuser.h:334
PDESKTOPINFO pDeskInfo
Definition: ntuser.h:320
struct tagKL * KeyboardLayout
Definition: win32.h:90
Definition: compat.h:835
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
static __inline ULONG_PTR DesktopHeapGetUserDelta(VOID)
Definition: desktop.h:272
#define NULL
Definition: types.h:112
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
struct _PROCESSINFO * ppi
Definition: ntuser.h:341

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

◆ UserDbgPostServiceHook()

ULONG_PTR NTAPI UserDbgPostServiceHook ( ULONG  ulSyscallId,
ULONG_PTR  ulResult 
)

Definition at line 782 of file misc.c.

783 {
784  /* Make sure that the first syscall is NtUserInitialize */
785  /* too bad this fails */
786  // ASSERT(gpepCSRSS);
787 
789 
790  return ulResult;
791 }
#define TRUE
Definition: types.h:120
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:728

◆ UserDbgPreServiceHook()

void NTAPI UserDbgPreServiceHook ( ULONG  ulSyscallId,
PULONG_PTR  pulArguments 
)

Definition at line 775 of file misc.c.

776 {
778 }
#define FALSE
Definition: types.h:117
void UserDbgAssertThreadInfo(BOOL showCaller)
Definition: misc.c:728

◆ UserGetLanguageID()

USHORT FASTCALL UserGetLanguageID ( VOID  )

Definition at line 97 of file misc.c.

98 {
100  OBJECT_ATTRIBUTES ObAttr;
101 // http://support.microsoft.com/kb/324097
105  UNICODE_STRING Language;
106 
107  RtlInitUnicodeString( &Language,
108  L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Language");
109 
111  &Language,
113  NULL,
114  NULL);
115 
116  if ( NT_SUCCESS(ZwOpenKey(&KeyHandle, KEY_READ, &ObAttr)))
117  {
119  if ( pKeyInfo )
120  {
121  RtlInitUnicodeString(&Language, L"Default");
122 
123  if ( NT_SUCCESS(ZwQueryValueKey( KeyHandle,
124  &Language,
126  pKeyInfo,
127  Size,
128  &Size)) )
129  {
130  RtlInitUnicodeString(&Language, (PWSTR)pKeyInfo->Data);
131  if (!NT_SUCCESS(RtlUnicodeStringToInteger(&Language, 16, &Ret)))
132  {
134  }
135  }
136  ExFreePoolWithTag(pKeyInfo, TAG_STRING);
137  }
139  }
140  TRACE("Language ID = %x\n",Ret);
141  return (USHORT) Ret;
142 }
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:56
#define SUBLANG_DEFAULT
Definition: nls.h:168
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define L(x)
Definition: ntvdm.h:50
#define TAG_STRING
Definition: oslist.h:22
#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:34
#define LANG_ENGLISH
Definition: nls.h:52
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned short USHORT
Definition: pedump.c:61
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define NULL
Definition: types.h:112
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

Referenced by DriverEntry().

◆ UserGetLanguageToggle()

DWORD FASTCALL UserGetLanguageToggle ( VOID  )

Definition at line 81 of file misc.c.

82 {
84  DWORD dwValue = 0;
85 
86  Status = RegReadUserSetting(L"Keyboard Layout\\Toggle", L"Layout Hotkey", REG_SZ, &dwValue, sizeof(dwValue));
87  if (NT_SUCCESS(Status))
88  {
89  dwValue = atoi((char *)&dwValue);
90  TRACE("Layout Hotkey %d\n",dwValue);
91  }
92  return dwValue;
93 }
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by SpiGetSet(), and SpiUpdatePerUserSystemParameters().