#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.
17{
19
22 {
23 skip(
"OpenThread() has failed to open the current process' thread (error code: %lu)\n",
GetLastError());
25 }
26
28}
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentThreadId(void)
Referenced by START_TEST().
◆ ImpersonateTokenWithEveryoneOrWithout()
static VOID ImpersonateTokenWithEveryoneOrWithout |
( |
_In_ DWORD |
Value | ) |
|
|
static |
Definition at line 32 of file NtImpersonateAnonymousToken.c.
33{
36
38 L"SYSTEM\\CurrentControlSet\\Control\\Lsa",
39 0,
43 {
44 skip(
"RegOpenKeyExW() has failed to open the key (error code: %li)\n",
Result);
45 return;
46 }
47
49 L"EveryoneIncludesAnonymous",
50 0,
55 {
56 skip(
"RegSetValueExW() has failed to set the value (error code: %li)\n",
Result);
58 return;
59 }
60
62}
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define HKEY_LOCAL_MACHINE
_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
Referenced by START_TEST().
◆ START_TEST()
Definition at line 64 of file NtImpersonateAnonymousToken.c.
65{
69
71
72
75
76
78
79
82
83
86
87
89
90
93
94
97
98
99
100
101
102
105
106
109
110
112}
static HANDLE GetThreadFromCurrentProcess(_In_ DWORD DesiredAccess)
#define TOKEN_WITHOUT_EVERYONE_GROUP
#define TOKEN_WITH_EVERYONE_GROUP
static VOID ImpersonateTokenWithEveryoneOrWithout(_In_ DWORD Value)
#define ok_hex(expression, result)
#define THREAD_IMPERSONATE
NTSTATUS NTAPI NtImpersonateAnonymousToken(_In_ HANDLE ThreadHandle)
Allows the calling thread to impersonate the system's anonymous logon token.
#define STATUS_INVALID_HANDLE
#define STATUS_ACCESS_DENIED
BOOL WINAPI RevertToSelf(void)