#include "precomp.h"
#include <winreg.h>
Go to the source code of this file.
◆ TOKEN_WITH_EVERYONE_GROUP
#define TOKEN_WITH_EVERYONE_GROUP 1 |
◆ TOKEN_WITHOUT_EVERYONE_GROUP
#define TOKEN_WITHOUT_EVERYONE_GROUP 0 |
◆ GetThreadFromCurrentProcess()
Definition at line 16 of file NtImpersonateAnonymousToken.c.
23 skip(
"OpenThread() has failed to open the current process' thread (error code: %lu)\n",
GetLastError());
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
DWORD WINAPI GetLastError(VOID)
DWORD WINAPI GetCurrentThreadId(VOID)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
Referenced by START_TEST().
◆ ImpersonateTokenWithEveryoneOrWithout()
static VOID ImpersonateTokenWithEveryoneOrWithout |
( |
_In_ DWORD |
Value | ) |
|
|
static |
Definition at line 32 of file NtImpersonateAnonymousToken.c.
38 L"SYSTEM\\CurrentControlSet\\Control\\Lsa",
44 skip(
"RegOpenKeyExW() has failed to open the key (error code: %li)\n",
Result);
49 L"EveryoneIncludesAnonymous",
56 skip(
"RegSetValueExW() has failed to set the value (error code: %li)\n",
Result);
_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
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFKEY * Key
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
#define RegCloseKey(hKey)
#define HKEY_LOCAL_MACHINE
Referenced by START_TEST().
◆ START_TEST()
Definition at line 64 of file NtImpersonateAnonymousToken.c.
#define TOKEN_WITHOUT_EVERYONE_GROUP
#define THREAD_IMPERSONATE
BOOL WINAPI RevertToSelf(VOID)
static VOID ImpersonateTokenWithEveryoneOrWithout(_In_ DWORD Value)
DWORD WINAPI GetLastError(VOID)
#define ok_hex(expression, result)
#define STATUS_INVALID_HANDLE
NTSTATUS NTAPI NtImpersonateAnonymousToken(_In_ HANDLE ThreadHandle)
Allows the calling thread to impersonate the system's anonymous logon token.
#define STATUS_ACCESS_DENIED
static HANDLE GetThreadFromCurrentProcess(_In_ DWORD DesiredAccess)
#define TOKEN_WITH_EVERYONE_GROUP