ReactOS  0.4.13-dev-235-g7373cb3
smutil.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Windows-Compatible Session Manager
3  * LICENSE: BSD 2-Clause License
4  * FILE: base/system/smss/smutil.c
5  * PURPOSE: Main SMSS Code
6  * PROGRAMMERS: Alex Ionescu
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "smss.h"
12 
13 #include <ndk/sefuncs.h>
14 
15 #define NDEBUG
16 #include <debug.h>
17 
18 /* GLOBALS ********************************************************************/
19 
20 //
21 // Taken from an ASSERT
22 //
23 #define VALUE_BUFFER_SIZE (sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 512)
24 
25 typedef struct _SMP_PRIVILEGE_STATE
26 {
33 
35 
36 /* FUNCTIONS ******************************************************************/
37 
39 NTAPI
41  OUT PVOID *PrivilegeState)
42 {
44  ULONG Size;
46 
47  /* Assume failure */
48  *PrivilegeState = NULL;
49 
50  /* Acquire the state structure to hold everything we need */
52  0,
53  sizeof(SMP_PRIVILEGE_STATE) +
54  sizeof(TOKEN_PRIVILEGES) +
55  sizeof(LUID_AND_ATTRIBUTES));
56  if (!State) return STATUS_NO_MEMORY;
57 
58  /* Open our token */
61  &State->TokenHandle);
62  if (!NT_SUCCESS(Status))
63  {
64  /* Fail */
66  return Status;
67  }
68 
69  /* Set one privilege in the enabled state */
70  State->NewPrivileges = &State->NewBuffer;
71  State->OldPrivileges = (PTOKEN_PRIVILEGES)&State->OldBuffer;
72  State->NewPrivileges->PrivilegeCount = 1;
73  State->NewPrivileges->Privileges[0].Luid = RtlConvertUlongToLuid(Privilege);
74  State->NewPrivileges->Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
75 
76  /* Adjust the privileges in the token */
77  Size = sizeof(State->OldBuffer);
78  Status = NtAdjustPrivilegesToken(State->TokenHandle,
79  FALSE,
80  State->NewPrivileges,
81  Size,
82  State->OldPrivileges,
83  &Size);
85  {
86  /* Our static buffer is not big enough, allocate a bigger one */
87  State->OldPrivileges = RtlAllocateHeap(SmpHeap, 0, Size);
88  if (!State->OldPrivileges)
89  {
90  /* Out of memory, fail */
92  goto Quickie;
93  }
94 
95  /* Now try again */
96  Status = NtAdjustPrivilegesToken(State->TokenHandle,
97  FALSE,
98  State->NewPrivileges,
99  Size,
100  State->OldPrivileges,
101  &Size);
102  }
103 
104  /* Normalize failure code and check for success */
106  if (NT_SUCCESS(Status))
107  {
108  /* We got the privilege, return */
109  *PrivilegeState = State;
110  return STATUS_SUCCESS;
111  }
112 
113 Quickie:
114  /* Check if we used a dynamic buffer */
115  if (State->OldPrivileges != (PTOKEN_PRIVILEGES)&State->OldBuffer)
116  {
117  /* Free it */
118  RtlFreeHeap(SmpHeap, 0, State->OldPrivileges);
119  }
120 
121  /* Close the token handle and free the state structure */
122  NtClose(State->TokenHandle);
124  return Status;
125 }
126 
127 VOID
128 NTAPI
130 {
132 
133  /* Adjust the privileges in the token */
134  NtAdjustPrivilegesToken(State->TokenHandle,
135  FALSE,
136  State->OldPrivileges,
137  0,
138  NULL,
139  NULL);
140 
141  /* Check if we used a dynamic buffer */
142  if (State->OldPrivileges != (PTOKEN_PRIVILEGES)&State->OldBuffer)
143  {
144  /* Free it */
145  RtlFreeHeap(SmpHeap, 0, State->OldPrivileges);
146  }
147 
148  /* Close the token handle and free the state structure */
149  NtClose(State->TokenHandle);
151 }
152 
153 NTSTATUS
154 NTAPI
156  IN BOOLEAN SecondPass,
158 {
159  PWCHAR p, pp;
160  ULONG Length, TokenLength, InputLength;
161 
162  /* Initialize to NULL to start with */
164 
165  /* Save the input length */
166  InputLength = Input->Length;
167 
168  /* If the input string is empty, just return */
169  if (InputLength == 0) return STATUS_SUCCESS;
170 
171  /* Parse the buffer until the first character */
172  p = Input->Buffer;
173  Length = 0;
174  while (Length < InputLength)
175  {
176  if (*p > L' ' ) break;
177  ++p;
178  Length += sizeof(WCHAR);
179  }
180 
181  /* Are we being called for argument pick-up? */
182  if (SecondPass)
183  {
184  /* Then assume everything else is an argument */
185  TokenLength = InputLength - Length * sizeof(WCHAR);
186  pp = (PWSTR)((ULONG_PTR)p + TokenLength);
187  }
188  else
189  {
190  /* No -- so loop until the next space */
191  pp = p;
192  while (Length < InputLength)
193  {
194  if (*pp <= L' ' ) break;
195  ++pp;
196  Length += sizeof(WCHAR);
197  }
198 
199  /* Now compute how long this token is, and loop until the next char */
201  while (Length < InputLength)
202  {
203  if (*pp > L' ' ) break;
204  ++pp;
205  Length += sizeof(WCHAR);
206  }
207  }
208 
209  /* Did we find a token? */
210  if (TokenLength)
211  {
212  /* Allocate a buffer for it */
214  SmBaseTag,
215  TokenLength + sizeof(UNICODE_NULL));
216  if (!Token->Buffer) return STATUS_NO_MEMORY;
217 
218  /* Fill in the unicode string to hold it */
222  Token->Buffer[TokenLength / sizeof(WCHAR)] = UNICODE_NULL;
223  }
224 
225  /* Modify the input string with the position of where the next token begins */
226  Input->Length -= (USHORT)((ULONG_PTR)pp - (ULONG_PTR)Input->Buffer);
227  Input->Buffer = pp;
228  return STATUS_SUCCESS;
229 }
230 
231 NTSTATUS
232 NTAPI
234  OUT PULONG Flags,
237  OUT PUNICODE_STRING Arguments)
238 {
239  ULONG Length;
240  UNICODE_STRING EnvString, PathString, CmdLineCopy, Token;
241  WCHAR PathBuffer[MAX_PATH];
242  PWCHAR FilePart;
244  UNICODE_STRING FullPathString;
245 
246  /* Initialize output arguments to NULL */
248  RtlInitUnicodeString(Arguments, NULL);
250 
251  /* Check if we haven't yet built a full default path or system root yet */
252  if (!SmpSystemRoot.Length)
253  {
254  /* Initialize it based on shared user data string */
256 
257  /* Allocate an empty string for the path */
259  sizeof(L"\\system32;");
260  RtlInitEmptyUnicodeString(&FullPathString,
262  (USHORT)Length);
263  if (FullPathString.Buffer)
264  {
265  /* Append the root, system32;, and then the current library path */
267  RtlAppendUnicodeToString(&FullPathString, L"\\system32;");
270  SmpDefaultLibPath = FullPathString;
271  }
272  }
273 
274  /* Consume the command line */
275  CmdLineCopy = *CommandLine;
276  while (TRUE)
277  {
278  /* Parse the first token and check for modifiers/specifiers */
279  Status = SmpParseToken(&CmdLineCopy, FALSE, &Token);
280  if (!(NT_SUCCESS(Status)) || !(Token.Buffer)) return STATUS_UNSUCCESSFUL;
281  if (!Flags) break;
282 
283  /* Debug requested? */
285  {
286  /* Convert into a flag */
287  *Flags |= SMP_DEBUG_FLAG;
288  }
290  {
291  /* Asynch requested, convert into a flag */
292  *Flags |= SMP_ASYNC_FLAG;
293  }
295  {
296  /* Autochk requested, convert into a flag */
298  }
299  else
300  {
301  /* No specifier found, keep going */
302  break;
303  }
304 
305  /* Get rid of this token and get the next */
307  }
308 
309  /* Initialize a string to hold the current path */
310  RtlInitUnicodeString(&EnvString, L"Path");
311  Length = PAGE_SIZE;
312  RtlInitEmptyUnicodeString(&PathString,
314  (USHORT)Length);
315  if (!PathString.Buffer)
316  {
317  /* Fail if we have no memory for this */
320  }
321 
322  /* Query the path from the environment */
324  &EnvString,
325  &PathString);
327  {
328  /* Our buffer was too small, free it */
329  RtlFreeHeap(SmpHeap, 0, PathString.Buffer);
330 
331  /* And allocate one big enough */
332  Length = PathString.Length + sizeof(UNICODE_NULL);
333  RtlInitEmptyUnicodeString(&PathString,
335  (USHORT)Length);
336  if (!PathString.Buffer)
337  {
338  /* Fail if we have no memory for this */
341  }
342 
343  /* Now try again, this should work */
345  &EnvString,
346  &PathString);
347  }
348  if (!NT_SUCCESS(Status))
349  {
350  /* Another failure means that the kernel hasn't passed the path correctly */
351  DPRINT1("SMSS: %wZ environment variable not defined.\n", &EnvString);
353  }
354  else
355  {
356  /* Check if the caller expects any flags out of here */
357  if (Flags)
358  {
359  /* We can return the image not found flag -- so does the image exist */
360  if (!(RtlDosSearchPath_U(PathString.Buffer,
361  Token.Buffer,
362  L".exe",
363  sizeof(PathBuffer),
364  PathBuffer,
365  &FilePart)) &&
367  Token.Buffer,
368  L".exe",
369  sizeof(PathBuffer),
370  PathBuffer,
371  &FilePart)))
372  {
373  /* It doesn't, let the caller know about it and exit */
375  *FileName = Token;
376  RtlFreeHeap(SmpHeap, 0, PathString.Buffer);
377  return STATUS_SUCCESS;
378  }
379  }
380  else
381  {
382  /* Caller doesn't want flags, probably wants the image itself */
383  wcscpy(PathBuffer, Token.Buffer);
384  }
385  }
386 
387  /* Free tokens and such, all that's left is to convert the image name */
389  RtlFreeHeap(SmpHeap, 0, PathString.Buffer);
390  if (!NT_SUCCESS(Status)) return Status;
391 
392  /* Convert it and bail out if this failed */
393  if (!RtlDosPathNameToNtPathName_U(PathBuffer, FileName, NULL, NULL))
394  {
395  DPRINT1("SMSS: Unable to translate %ws into an NT File Name\n",
396  &PathBuffer);
398  }
399  if (!NT_SUCCESS(Status)) return Status;
400 
401  /* Finally, check if the caller also wanted the directory */
402  if (Directory)
403  {
404  /* Is the file a relative name with no directory? */
405  if (FilePart <= PathBuffer)
406  {
407  /* Clear it */
409  }
410  else
411  {
412  /* There is a directory, and a filename -- separate those two */
413  *--FilePart = UNICODE_NULL;
414  RtlCreateUnicodeString(Directory, PathBuffer);
415  }
416  }
417 
418  /* We are done -- move on to the second pass to get the arguments */
419  return SmpParseToken(&CmdLineCopy, TRUE, Arguments);
420 }
421 
422 BOOLEAN
423 NTAPI
425 {
430  WCHAR ValueBuffer[VALUE_BUFFER_SIZE];
431  PKEY_VALUE_PARTIAL_INFORMATION PartialInfo = (PVOID)ValueBuffer;
432  ULONG Length;
433 
434  /* Open the key */
436  L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
438  &KeyName,
440  NULL,
441  NULL);
443  if (!NT_SUCCESS(Status))
444  {
445  DPRINT1("SMSS: can't open control key: 0x%x\n", Status);
446  return FALSE;
447  }
448 
449  /* Query the value */
450  RtlInitUnicodeString(&ValueName, L"SystemStartOptions");
452  &ValueName,
454  PartialInfo,
455  sizeof(ValueBuffer),
456  &Length);
459  if (!NT_SUCCESS(Status))
460  {
461  DPRINT1("SMSS: can't query value key: 0x%x\n", Status);
462  return FALSE;
463  }
464 
465  /* Check if it's set to SOS or sos */
466  if (!(wcsstr((PWCHAR)PartialInfo->Data, L"SOS")) ||
467  (wcsstr((PWCHAR)PartialInfo->Data, L"sos")))
468  {
469  /* It's not set, return FALSE */
470  return FALSE;
471  }
472 
473  /* It's set, return TRUE */
474  return TRUE;
475 }
476 
477 BOOLEAN
478 NTAPI
480  OUT PBOOLEAN ShutdownOkay)
481 {
483  BOOLEAN Value = TRUE;
484  PVOID BootStatusDataHandle;
485 
486  /* Assume failure */
487  *BootOkay = FALSE;
488  *ShutdownOkay = FALSE;
489 
490  /* Lock the BSD and fail if we couldn't */
491  Status = RtlLockBootStatusData(&BootStatusDataHandle);
492  if (!NT_SUCCESS(Status)) return FALSE;
493 
494  /* Read the old settings */
495  RtlGetSetBootStatusData(BootStatusDataHandle,
496  TRUE,
498  BootOkay,
499  sizeof(BOOLEAN),
500  NULL);
501  RtlGetSetBootStatusData(BootStatusDataHandle,
502  TRUE,
504  ShutdownOkay,
505  sizeof(BOOLEAN),
506  NULL);
507 
508  /* Set new ones indicating we got at least this far */
509  RtlGetSetBootStatusData(BootStatusDataHandle,
510  FALSE,
512  &Value,
513  sizeof(Value),
514  NULL);
515  RtlGetSetBootStatusData(BootStatusDataHandle,
516  FALSE,
518  &Value,
519  sizeof(Value),
520  NULL);
521 
522  /* Unlock the BSD and return */
523  RtlUnlockBootStatusData(BootStatusDataHandle);
524  return TRUE;
525 }
526 
527 VOID
528 NTAPI
530  IN BOOLEAN ShutdownOkay)
531 {
533  PVOID BootState;
534 
535  /* Lock the BSD */
536  Status = RtlLockBootStatusData(&BootState);
537  if (NT_SUCCESS(Status))
538  {
539  /* Write the bootokay and bootshutdown values */
540  RtlGetSetBootStatusData(BootState,
541  FALSE,
543  &BootOkay,
544  sizeof(BootOkay),
545  NULL);
546  RtlGetSetBootStatusData(BootState,
547  FALSE,
549  &ShutdownOkay,
550  sizeof(ShutdownOkay),
551  NULL);
552 
553  /* Unlock the BSD and return */
554  RtlUnlockBootStatusData(BootState);
555  }
556 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define STATUS_NOT_ALL_ASSIGNED
Definition: ntstatus.h:85
#define IN
Definition: typedefs.h:38
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSTATUS NTAPI RtlLockBootStatusData(_Out_ PHANDLE FileHandle)
Definition: bootdata.c:231
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define SMP_AUTOCHK_FLAG
Definition: smss.h:41
VOID NTAPI SmpRestoreBootStatusData(IN BOOLEAN BootOkay, IN BOOLEAN ShutdownOkay)
Definition: smutil.c:529
UNICODE_STRING SmpDebugKeyword
Definition: smutil.c:34
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
USHORT MaximumLength
Definition: env_spec_w32.h:370
UNICODE_STRING SmpDefaultLibPath
Definition: sminit.c:28
#define KEY_READ
Definition: nt_native.h:1023
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS NTAPI SmpParseCommandLine(IN PUNICODE_STRING CommandLine, OUT PULONG Flags, OUT PUNICODE_STRING FileName, OUT PUNICODE_STRING Directory, OUT PUNICODE_STRING Arguments)
Definition: smutil.c:233
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
_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
Definition: arc.h:84
NTSTATUS NTAPI NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle)
Definition: security.c:342
NTSTATUS NTAPI RtlUnlockBootStatusData(_In_ HANDLE FileHandle)
Definition: bootdata.c:267
#define VALUE_BUFFER_SIZE
Definition: smutil.c:23
uint16_t * PWCHAR
Definition: typedefs.h:54
PTOKEN_PRIVILEGES OldPrivileges
Definition: smutil.c:28
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
UCHAR OldBuffer[1024]
Definition: smutil.c:30
NTSYSAPI ULONG NTAPI RtlDosSearchPath_U(_In_ PCWSTR Path, _In_ PCWSTR FileName, _In_ PCWSTR Extension, _In_ ULONG BufferSize, _Out_ PWSTR Buffer, _Out_ PWSTR *PartName)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
PWCHAR SmpDefaultEnvironment
Definition: sminit.c:27
PVOID SmpHeap
Definition: sminit.c:24
NTSTATUS NTAPI SmpAcquirePrivilege(IN ULONG Privilege, OUT PVOID *PrivilegeState)
Definition: smutil.c:40
#define pp
Definition: hlsl.yy.c:978
NTSTATUS NTAPI SmpParseToken(IN PUNICODE_STRING Input, IN BOOLEAN SecondPass, OUT PUNICODE_STRING Token)
Definition: smutil.c:155
unsigned char BOOLEAN
NTSYSAPI NTSTATUS NTAPI RtlQueryEnvironmentVariable_U(_In_opt_ PWSTR Environment, _In_ PCUNICODE_STRING Name, _Out_ PUNICODE_STRING Value)
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
#define NtCurrentProcess()
Definition: nt_native.h:1657
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
UNICODE_STRING SmpASyncKeyword
Definition: smutil.c:34
BOOLEAN NTAPI SmpQueryRegistrySosOption(VOID)
Definition: smutil.c:424
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define TOKEN_QUERY
Definition: setypes.h:874
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UNICODE_STRING SmpSystemRoot
Definition: smss.c:20
FORCEINLINE LUID NTAPI_INLINE RtlConvertUlongToLuid(_In_ ULONG Val)
Definition: rtlfuncs.h:3543
USHORT Length
Definition: ntsecapi.h:172
ULONG SmBaseTag
Definition: sminit.c:25
#define MAX_PATH
Definition: compat.h:26
PCHAR Buffer
Definition: ntsecapi.h:174
BOOL Privilege(LPTSTR pszPrivilege, BOOL bEnable)
Definition: user_lib.cpp:531
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
VOID NTAPI SmpReleasePrivilege(IN PVOID PrivState)
Definition: smutil.c:129
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
UNICODE_STRING SmpAutoChkKeyword
Definition: smutil.c:34
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define SMP_ASYNC_FLAG
Definition: smss.h:40
#define SharedUserData
unsigned char UCHAR
Definition: xmlstorage.h:181
char * PBOOLEAN
Definition: retypes.h:11
struct _TOKEN_PRIVILEGES * PTOKEN_PRIVILEGES
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
HANDLE TokenHandle
Definition: smutil.c:27
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define SMP_INVALID_PATH
Definition: smss.h:43
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PTOKEN_PRIVILEGES NewPrivileges
Definition: smutil.c:29
Status
Definition: gdiplustypes.h:24
USHORT MaximumLength
Definition: ntsecapi.h:173
enum State_ State
Definition: pofuncs.h:54
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
int TokenLength(char *pc)
Definition: spec2def.c:163
unsigned short USHORT
Definition: pedump.c:61
struct _SMP_PRIVILEGE_STATE SMP_PRIVILEGE_STATE
#define SMP_DEBUG_FLAG
Definition: smss.h:39
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
BOOLEAN NTAPI SmpSaveAndClearBootStatusData(OUT PBOOLEAN BootOkay, OUT PBOOLEAN ShutdownOkay)
Definition: smutil.c:479
TOKEN_PRIVILEGES NewBuffer
Definition: smutil.c:31
unsigned int * PULONG
Definition: retypes.h:1
#define STATUS_OBJECT_PATH_INVALID
Definition: ntstatus.h:279
struct _SMP_PRIVILEGE_STATE * PSMP_PRIVILEGE_STATE
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSTATUS NTAPI RtlGetSetBootStatusData(_In_ HANDLE FileHandle, _In_ BOOLEAN Read, _In_ RTL_BSD_ITEM_TYPE DataClass, _In_ PVOID Buffer, _In_ ULONG BufferSize, _Out_opt_ PULONG ReturnLength)
Definition: bootdata.c:161
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
base for all directory entries
Definition: entries.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ULONG_PTR
Definition: config.h:101
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
GLfloat GLfloat p
Definition: glext.h:8902
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtAdjustPrivilegesToken(_In_ HANDLE TokenHandle, _In_ BOOLEAN DisableAllPrivileges, _In_opt_ PTOKEN_PRIVILEGES NewState, _In_ ULONG BufferLength, _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState, _When_(PreviousState!=NULL, _Out_) PULONG ReturnLength)
Definition: token.c:3219
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)