Go to the source code of this file.
◆ AdjustEnableDefaultPriv()
static VOID AdjustEnableDefaultPriv |
( |
VOID |
| ) |
|
|
static |
Definition at line 36 of file NtAdjustPrivilegesToken.c.
37{
43
48 {
49 skip(
"OpenProcessToken() has failed to get the process' token (error code: %lu)!\n",
GetLastError());
50 return;
51 }
52
55 {
56 skip(
"LookupPrivilegeValueW() has failed to locate the privilege value (error code: %lu)!\n",
GetLastError());
57 return;
58 }
59
63
65 trace(
"The privilege is %s!\n",
IsEnabled ?
"enabled" :
"disabled");
66
69 &Priv,
70 0,
74
76 trace(
"The privilege is %s!\n",
IsEnabled ?
"enabled" :
"disabled");
77
79}
static BOOL IsPrivilegeEnabled(_In_ HANDLE TokenHandle, _In_ ULONG Privilege)
#define ok_hex(expression, result)
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define GetCurrentProcess()
return pProvider IsEnabled(ProviderControl)
#define SE_IMPERSONATE_PRIVILEGE
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
_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)
Removes a certain amount of privileges of a token based upon the request by the caller.
DWORD WINAPI GetLastError(void)
#define TOKEN_ADJUST_PRIVILEGES
Referenced by START_TEST().
◆ IsPrivilegeEnabled()
Definition at line 12 of file NtAdjustPrivilegesToken.c.
15{
18
23
26 {
29 }
30
32}
BOOL WINAPI PrivilegeCheck(HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]
BOOL Privilege(LPTSTR pszPrivilege, BOOL bEnable)
_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
FORCEINLINE LUID NTAPI_INLINE RtlConvertUlongToLuid(_In_ ULONG Val)
#define PRIVILEGE_SET_ALL_NECESSARY
Referenced by AdjustEnableDefaultPriv().
◆ START_TEST()