6 #define SE_MIN_WELL_KNOWN_PRIVILEGE (2L)
7 #define SE_CREATE_TOKEN_PRIVILEGE (2L)
8 #define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE (3L)
9 #define SE_LOCK_MEMORY_PRIVILEGE (4L)
10 #define SE_INCREASE_QUOTA_PRIVILEGE (5L)
12 #define SE_MACHINE_ACCOUNT_PRIVILEGE (6L)
13 #define SE_TCB_PRIVILEGE (7L)
14 #define SE_SECURITY_PRIVILEGE (8L)
15 #define SE_TAKE_OWNERSHIP_PRIVILEGE (9L)
16 #define SE_LOAD_DRIVER_PRIVILEGE (10L)
17 #define SE_SYSTEM_PROFILE_PRIVILEGE (11L)
18 #define SE_SYSTEMTIME_PRIVILEGE (12L)
19 #define SE_PROF_SINGLE_PROCESS_PRIVILEGE (13L)
20 #define SE_INC_BASE_PRIORITY_PRIVILEGE (14L)
21 #define SE_CREATE_PAGEFILE_PRIVILEGE (15L)
22 #define SE_CREATE_PERMANENT_PRIVILEGE (16L)
23 #define SE_BACKUP_PRIVILEGE (17L)
24 #define SE_RESTORE_PRIVILEGE (18L)
25 #define SE_SHUTDOWN_PRIVILEGE (19L)
26 #define SE_DEBUG_PRIVILEGE (20L)
27 #define SE_AUDIT_PRIVILEGE (21L)
28 #define SE_SYSTEM_ENVIRONMENT_PRIVILEGE (22L)
29 #define SE_CHANGE_NOTIFY_PRIVILEGE (23L)
30 #define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L)
31 #define SE_UNDOCK_PRIVILEGE (25L)
32 #define SE_SYNC_AGENT_PRIVILEGE (26L)
33 #define SE_ENABLE_DELEGATION_PRIVILEGE (27L)
34 #define SE_MANAGE_VOLUME_PRIVILEGE (28L)
35 #define SE_IMPERSONATE_PRIVILEGE (29L)
36 #define SE_CREATE_GLOBAL_PRIVILEGE (30L)
37 #define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE (31L)
38 #define SE_RELABEL_PRIVILEGE (32L)
39 #define SE_INC_WORKING_SET_PRIVILEGE (33L)
40 #define SE_TIME_ZONE_PRIVILEGE (34L)
41 #define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE (35L)
42 #define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_SYMBOLIC_LINK_PRIVILEGE
51 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_INVALID 0x00
52 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_INT64 0x01
53 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_UINT64 0x02
54 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_STRING 0x03
55 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_FQBN 0x04
56 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_SID 0x05
57 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_BOOLEAN 0x06
58 #define TOKEN_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING 0x10
62 #define TOKEN_SECURITY_ATTRIBUTE_NON_INHERITABLE 0x0001
63 #define TOKEN_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE 0x0002
64 #define TOKEN_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY 0x0004
65 #define TOKEN_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT 0x0008
66 #define TOKEN_SECURITY_ATTRIBUTE_DISABLED 0x0010
67 #define TOKEN_SECURITY_ATTRIBUTE_MANDATORY 0x0020
69 #define TOKEN_SECURITY_ATTRIBUTE_VALID_FLAGS ( \
70 TOKEN_SECURITY_ATTRIBUTE_NON_INHERITABLE | \
71 TOKEN_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | \
72 TOKEN_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY | \
73 TOKEN_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | \
74 TOKEN_SECURITY_ATTRIBUTE_DISABLED | \
75 TOKEN_SECURITY_ATTRIBUTE_MANDATORY)
77 #define TOKEN_SECURITY_ATTRIBUTE_CUSTOM_FLAGS 0xffff0000
108 PTOKEN_SECURITY_ATTRIBUTE_FQBN_VALUE
pFqbn;
114 #define TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1 1
116 #define TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1
136 _Out_ PHANDLE TokenHandle,
137 _In_ ACCESS_MASK DesiredAccess,
139 _In_ TOKEN_TYPE TokenType,
140 _In_ PLUID AuthenticationId,
141 _In_ PLARGE_INTEGER ExpirationTime,
142 _In_ PTOKEN_USER User,
143 _In_ PTOKEN_GROUPS Groups,
144 _In_ PTOKEN_PRIVILEGES Privileges,
145 _In_opt_ PTOKEN_OWNER Owner,
146 _In_ PTOKEN_PRIMARY_GROUP PrimaryGroup,
147 _In_opt_ PTOKEN_DEFAULT_DACL DefaultDacl,
148 _In_ PTOKEN_SOURCE TokenSource
151 #if (PHNT_VERSION >= PHNT_WIN8)
156 _Out_ PHANDLE TokenHandle,
157 _In_ HANDLE ExistingTokenHandle,
158 _In_ ACCESS_MASK DesiredAccess,
160 _In_ PSID PackageSid,
161 _In_ ULONG CapabilityCount,
162 _In_reads_opt_(CapabilityCount) PSID_AND_ATTRIBUTES Capabilities,
163 _In_ ULONG HandleCount,
164 _In_reads_opt_(HandleCount) HANDLE *Handles
168 #if (PHNT_VERSION >= PHNT_WIN8)
173 _Out_ PHANDLE TokenHandle,
174 _In_ ACCESS_MASK DesiredAccess,
176 _In_ TOKEN_TYPE TokenType,
177 _In_ PLUID AuthenticationId,
178 _In_ PLARGE_INTEGER ExpirationTime,
179 _In_ PTOKEN_USER User,
180 _In_ PTOKEN_GROUPS Groups,
181 _In_ PTOKEN_PRIVILEGES Privileges,
182 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION UserAttributes,
183 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION DeviceAttributes,
184 _In_opt_ PTOKEN_GROUPS DeviceGroups,
185 _In_opt_ PTOKEN_MANDATORY_POLICY TokenMandatoryPolicy,
186 _In_opt_ PTOKEN_OWNER Owner,
187 _In_ PTOKEN_PRIMARY_GROUP PrimaryGroup,
188 _In_opt_ PTOKEN_DEFAULT_DACL DefaultDacl,
189 _In_ PTOKEN_SOURCE TokenSource
197 _In_ HANDLE ProcessHandle,
198 _In_ ACCESS_MASK DesiredAccess,
199 _Out_ PHANDLE TokenHandle
206 _In_ HANDLE ProcessHandle,
207 _In_ ACCESS_MASK DesiredAccess,
208 _In_ ULONG HandleAttributes,
209 _Out_ PHANDLE TokenHandle
216 _In_ HANDLE ThreadHandle,
217 _In_ ACCESS_MASK DesiredAccess,
218 _In_ BOOLEAN OpenAsSelf,
219 _Out_ PHANDLE TokenHandle
226 _In_ HANDLE ThreadHandle,
227 _In_ ACCESS_MASK DesiredAccess,
228 _In_ BOOLEAN OpenAsSelf,
229 _In_ ULONG HandleAttributes,
230 _Out_ PHANDLE TokenHandle
233 #if (PHNT_VERSION >= PHNT_WIN8)
238 _In_ HANDLE JobHandle,
239 _In_ ACCESS_MASK DesiredAccess,
240 _Out_ PHANDLE TokenHandle
248 _In_ HANDLE ExistingTokenHandle,
249 _In_ ACCESS_MASK DesiredAccess,
251 _In_ BOOLEAN EffectiveOnly,
252 _In_ TOKEN_TYPE TokenType,
253 _Out_ PHANDLE NewTokenHandle
260 _In_ HANDLE TokenHandle,
261 _In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
262 _Out_writes_bytes_(TokenInformationLength) PVOID TokenInformation,
263 _In_ ULONG TokenInformationLength,
264 _Out_ PULONG ReturnLength
271 _In_ HANDLE TokenHandle,
272 _In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
273 _In_reads_bytes_(TokenInformationLength) PVOID TokenInformation,
274 _In_ ULONG TokenInformationLength
281 _In_ HANDLE TokenHandle,
282 _In_ BOOLEAN DisableAllPrivileges,
283 _In_opt_ PTOKEN_PRIVILEGES NewState,
284 _In_ ULONG BufferLength,
285 _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState,
286 _Out_
_When_(PreviousState == NULL, _Out_opt_) PULONG ReturnLength
293 _In_ HANDLE TokenHandle,
294 _In_ BOOLEAN ResetToDefault,
295 _In_opt_ PTOKEN_GROUPS NewState,
296 _In_opt_ ULONG BufferLength,
297 _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_GROUPS PreviousState,
298 _Out_ PULONG ReturnLength
301 #if (PHNT_VERSION >= PHNT_WIN8)
306 _In_ HANDLE TokenHandle,
307 _In_ BOOLEAN UserResetToDefault,
308 _In_ BOOLEAN DeviceResetToDefault,
309 _In_ BOOLEAN DeviceGroupsResetToDefault,
310 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION NewUserState,
311 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION NewDeviceState,
312 _In_opt_ PTOKEN_GROUPS NewDeviceGroupsState,
313 _In_ ULONG UserBufferLength,
314 _Out_writes_bytes_to_opt_(UserBufferLength, *UserReturnLength) PTOKEN_SECURITY_ATTRIBUTES_INFORMATION PreviousUserState,
315 _In_ ULONG DeviceBufferLength,
316 _Out_writes_bytes_to_opt_(DeviceBufferLength, *DeviceReturnLength) PTOKEN_SECURITY_ATTRIBUTES_INFORMATION PreviousDeviceState,
317 _In_ ULONG DeviceGroupsBufferLength,
318 _Out_writes_bytes_to_opt_(DeviceGroupsBufferLength, *DeviceGroupsReturnBufferLength) PTOKEN_GROUPS PreviousDeviceGroups,
319 _Out_opt_ PULONG UserReturnLength,
320 _Out_opt_ PULONG DeviceReturnLength,
321 _Out_opt_ PULONG DeviceGroupsReturnBufferLength
329 _In_ HANDLE ExistingTokenHandle,
331 _In_opt_ PTOKEN_GROUPS SidsToDisable,
332 _In_opt_ PTOKEN_PRIVILEGES PrivilegesToDelete,
333 _In_opt_ PTOKEN_GROUPS RestrictedSids,
334 _Out_ PHANDLE NewTokenHandle
337 #if (PHNT_VERSION >= PHNT_WIN8)
342 _In_ HANDLE ExistingTokenHandle,
344 _In_opt_ PTOKEN_GROUPS SidsToDisable,
345 _In_opt_ PTOKEN_PRIVILEGES PrivilegesToDelete,
346 _In_opt_ PTOKEN_GROUPS RestrictedSids,
347 _In_ ULONG DisableUserClaimsCount,
349 _In_ ULONG DisableDeviceClaimsCount,
351 _In_opt_ PTOKEN_GROUPS DeviceGroupsToDisable,
352 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION RestrictedUserAttributes,
353 _In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION RestrictedDeviceAttributes,
354 _In_opt_ PTOKEN_GROUPS RestrictedDeviceGroups,
355 _Out_ PHANDLE NewTokenHandle
363 _In_ HANDLE FirstTokenHandle,
364 _In_ HANDLE SecondTokenHandle,
372 _In_ HANDLE ClientToken,
373 _Inout_ PPRIVILEGE_SET RequiredPrivileges,
374 _Out_ PBOOLEAN Result
381 _In_ HANDLE ThreadHandle
384 #if (PHNT_VERSION >= PHNT_WIN7)
390 _In_ HANDLE TokenHandle,
392 _In_ ULONG NumberOfAttributes,
393 _Out_writes_bytes_(Length) PVOID Buffer,
395 _Out_ PULONG ReturnLength
405 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
406 _In_ HANDLE ClientToken,
407 _In_ ACCESS_MASK DesiredAccess,
408 _In_ PGENERIC_MAPPING GenericMapping,
409 _Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
410 _Inout_ PULONG PrivilegeSetLength,
411 _Out_ PACCESS_MASK GrantedAccess,
419 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
420 _In_opt_ PSID PrincipalSelfSid,
421 _In_ HANDLE ClientToken,
422 _In_ ACCESS_MASK DesiredAccess,
423 _In_reads_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
424 _In_ ULONG ObjectTypeListLength,
425 _In_ PGENERIC_MAPPING GenericMapping,
426 _Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
427 _Inout_ PULONG PrivilegeSetLength,
428 _Out_ PACCESS_MASK GrantedAccess,
436 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
437 _In_opt_ PSID PrincipalSelfSid,
438 _In_ HANDLE ClientToken,
439 _In_ ACCESS_MASK DesiredAccess,
440 _In_reads_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
441 _In_ ULONG ObjectTypeListLength,
442 _In_ PGENERIC_MAPPING GenericMapping,
443 _Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
444 _Inout_ PULONG PrivilegeSetLength,
445 _Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
446 _Out_writes_(ObjectTypeListLength)
PNTSTATUS AccessStatus
454 #if (PHNT_VERSION >= PHNT_THRESHOLD)
461 _In_ SE_SIGNING_LEVEL InputSigningLevel,
462 _In_reads_(SourceFileCount) PHANDLE SourceFiles,
463 _In_ ULONG SourceFileCount,
464 _In_opt_ HANDLE TargetFile
473 _Out_ PSE_SIGNING_LEVEL SigningLevel,
474 _Out_writes_bytes_to_opt_(*ThumbprintSize, *ThumbprintSize) PUCHAR Thumbprint,
475 _Inout_opt_ PULONG ThumbprintSize,
476 _Out_opt_ PULONG ThumbprintAlgorithm
488 _In_opt_ PVOID HandleId,
491 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
492 _In_ ACCESS_MASK DesiredAccess,
493 _In_ PGENERIC_MAPPING GenericMapping,
494 _In_ BOOLEAN ObjectCreation,
495 _Out_ PACCESS_MASK GrantedAccess,
497 _Out_ PBOOLEAN GenerateOnClose
505 _In_opt_ PVOID HandleId,
508 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
509 _In_opt_ PSID PrincipalSelfSid,
510 _In_ ACCESS_MASK DesiredAccess,
511 _In_ AUDIT_EVENT_TYPE AuditType,
513 _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
514 _In_ ULONG ObjectTypeListLength,
515 _In_ PGENERIC_MAPPING GenericMapping,
516 _In_ BOOLEAN ObjectCreation,
517 _Out_ PACCESS_MASK GrantedAccess,
519 _Out_ PBOOLEAN GenerateOnClose
527 _In_opt_ PVOID HandleId,
530 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
531 _In_opt_ PSID PrincipalSelfSid,
532 _In_ ACCESS_MASK DesiredAccess,
533 _In_ AUDIT_EVENT_TYPE AuditType,
535 _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
536 _In_ ULONG ObjectTypeListLength,
537 _In_ PGENERIC_MAPPING GenericMapping,
538 _In_ BOOLEAN ObjectCreation,
539 _Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
540 _Out_writes_(ObjectTypeListLength)
PNTSTATUS AccessStatus,
541 _Out_ PBOOLEAN GenerateOnClose
549 _In_opt_ PVOID HandleId,
550 _In_ HANDLE ClientToken,
553 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
554 _In_opt_ PSID PrincipalSelfSid,
555 _In_ ACCESS_MASK DesiredAccess,
556 _In_ AUDIT_EVENT_TYPE AuditType,
558 _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
559 _In_ ULONG ObjectTypeListLength,
560 _In_ PGENERIC_MAPPING GenericMapping,
561 _In_ BOOLEAN ObjectCreation,
562 _Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
563 _Out_writes_(ObjectTypeListLength)
PNTSTATUS AccessStatus,
564 _Out_ PBOOLEAN GenerateOnClose
572 _In_opt_ PVOID HandleId,
575 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor,
576 _In_ HANDLE ClientToken,
577 _In_ ACCESS_MASK DesiredAccess,
578 _In_ ACCESS_MASK GrantedAccess,
579 _In_opt_ PPRIVILEGE_SET Privileges,
580 _In_ BOOLEAN ObjectCreation,
581 _In_ BOOLEAN AccessGranted,
582 _Out_ PBOOLEAN GenerateOnClose
590 _In_opt_ PVOID HandleId,
591 _In_ HANDLE ClientToken,
592 _In_ ACCESS_MASK DesiredAccess,
593 _In_ PPRIVILEGE_SET Privileges,
594 _In_ BOOLEAN AccessGranted
602 _In_opt_ PVOID HandleId,
603 _In_ BOOLEAN GenerateOnClose
611 _In_opt_ PVOID HandleId,
612 _In_ BOOLEAN GenerateOnClose
621 _In_ HANDLE ClientToken,
622 _In_ PPRIVILEGE_SET Privileges,
623 _In_ BOOLEAN AccessGranted
636 #if (PHNT_VERSION >= PHNT_THRESHOLD)
642 _In_ ULONG ObjectType,
643 _In_ ULONG ElementType,
644 _In_reads_bytes_opt_(DataSize) PVOID Data,