d6ed41cd7aabc792d907c461d9e28d440e0ab86e
[reactos.git] / reactos / include / ddk / ntifs.h
1 /*
2 * ntifs.h
3 *
4 * Windows NT Filesystem Driver Developer Kit
5 *
6 * This file is part of the ReactOS DDK package.
7 *
8 * Contributors:
9 * Amine Khaldi
10 * Timo Kreuzer (timo.kreuzer@reactos.org)
11 *
12 * THIS SOFTWARE IS NOT COPYRIGHTED
13 *
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
16 *
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAIMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 */
23
24 #pragma once
25
26 #define _NTIFS_INCLUDED_
27 #define _GNU_NTIFS_
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33
34 /* Dependencies */
35 #include <ntddk.h>
36 #include <excpt.h>
37 #include <ntdef.h>
38 #include <ntnls.h>
39 #include <ntstatus.h>
40 #include <bugcodes.h>
41 #include <ntiologc.h>
42
43
44 #ifndef FlagOn
45 #define FlagOn(_F,_SF) ((_F) & (_SF))
46 #endif
47
48 #ifndef BooleanFlagOn
49 #define BooleanFlagOn(F,SF) ((BOOLEAN)(((F) & (SF)) != 0))
50 #endif
51
52 #ifndef SetFlag
53 #define SetFlag(_F,_SF) ((_F) |= (_SF))
54 #endif
55
56 #ifndef ClearFlag
57 #define ClearFlag(_F,_SF) ((_F) &= ~(_SF))
58 #endif
59
60 typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
61 typedef STRING LSA_STRING, *PLSA_STRING;
62 typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
63
64 /******************************************************************************
65 * Security Manager Types *
66 ******************************************************************************/
67
68 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
69 #define SID_IDENTIFIER_AUTHORITY_DEFINED
70 typedef struct _SID_IDENTIFIER_AUTHORITY {
71 UCHAR Value[6];
72 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
73 #endif
74
75 #ifndef SID_DEFINED
76 #define SID_DEFINED
77 typedef struct _SID {
78 UCHAR Revision;
79 UCHAR SubAuthorityCount;
80 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
81 #ifdef MIDL_PASS
82 [size_is(SubAuthorityCount)] ULONG SubAuthority[*];
83 #else
84 ULONG SubAuthority[ANYSIZE_ARRAY];
85 #endif
86 } SID, *PISID;
87 #endif
88
89 #define SID_REVISION 1
90 #define SID_MAX_SUB_AUTHORITIES 15
91 #define SID_RECOMMENDED_SUB_AUTHORITIES 1
92
93 #ifndef MIDL_PASS
94 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(ULONG) + (SID_MAX_SUB_AUTHORITIES * sizeof(ULONG)))
95 #endif
96
97 typedef enum _SID_NAME_USE {
98 SidTypeUser = 1,
99 SidTypeGroup,
100 SidTypeDomain,
101 SidTypeAlias,
102 SidTypeWellKnownGroup,
103 SidTypeDeletedAccount,
104 SidTypeInvalid,
105 SidTypeUnknown,
106 SidTypeComputer,
107 SidTypeLabel
108 } SID_NAME_USE, *PSID_NAME_USE;
109
110 typedef struct _SID_AND_ATTRIBUTES {
111 #ifdef MIDL_PASS
112 PISID Sid;
113 #else
114 PSID Sid;
115 #endif
116 ULONG Attributes;
117 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
118 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
119 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
120
121 #define SID_HASH_SIZE 32
122 typedef ULONG_PTR SID_HASH_ENTRY, *PSID_HASH_ENTRY;
123
124 typedef struct _SID_AND_ATTRIBUTES_HASH {
125 ULONG SidCount;
126 PSID_AND_ATTRIBUTES SidAttr;
127 SID_HASH_ENTRY Hash[SID_HASH_SIZE];
128 } SID_AND_ATTRIBUTES_HASH, *PSID_AND_ATTRIBUTES_HASH;
129
130 /* Universal well-known SIDs */
131
132 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
133
134 /* S-1-1 */
135 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
136
137 /* S-1-2 */
138 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
139
140 /* S-1-3 */
141 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
142
143 /* S-1-4 */
144 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
145
146 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
147
148 #define SECURITY_NULL_RID (0x00000000L)
149 #define SECURITY_WORLD_RID (0x00000000L)
150 #define SECURITY_LOCAL_RID (0x00000000L)
151 #define SECURITY_LOCAL_LOGON_RID (0x00000001L)
152
153 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
154 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
155 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
156 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
157 #define SECURITY_CREATOR_OWNER_RIGHTS_RID (0x00000004L)
158
159 /* NT well-known SIDs */
160
161 /* S-1-5 */
162 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
163
164 #define SECURITY_DIALUP_RID (0x00000001L)
165 #define SECURITY_NETWORK_RID (0x00000002L)
166 #define SECURITY_BATCH_RID (0x00000003L)
167 #define SECURITY_INTERACTIVE_RID (0x00000004L)
168 #define SECURITY_LOGON_IDS_RID (0x00000005L)
169 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
170 #define SECURITY_SERVICE_RID (0x00000006L)
171 #define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L)
172 #define SECURITY_PROXY_RID (0x00000008L)
173 #define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L)
174 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
175 #define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL)
176 #define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL)
177 #define SECURITY_RESTRICTED_CODE_RID (0x0000000CL)
178 #define SECURITY_TERMINAL_SERVER_RID (0x0000000DL)
179 #define SECURITY_REMOTE_LOGON_RID (0x0000000EL)
180 #define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL)
181 #define SECURITY_IUSER_RID (0x00000011L)
182 #define SECURITY_LOCAL_SYSTEM_RID (0x00000012L)
183 #define SECURITY_LOCAL_SERVICE_RID (0x00000013L)
184 #define SECURITY_NETWORK_SERVICE_RID (0x00000014L)
185 #define SECURITY_NT_NON_UNIQUE (0x00000015L)
186 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L)
187 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L)
188
189 #define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L)
190 #define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L)
191
192
193 #define SECURITY_PACKAGE_BASE_RID (0x00000040L)
194 #define SECURITY_PACKAGE_RID_COUNT (2L)
195 #define SECURITY_PACKAGE_NTLM_RID (0x0000000AL)
196 #define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL)
197 #define SECURITY_PACKAGE_DIGEST_RID (0x00000015L)
198
199 #define SECURITY_CRED_TYPE_BASE_RID (0x00000041L)
200 #define SECURITY_CRED_TYPE_RID_COUNT (2L)
201 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID (0x00000001L)
202
203 #define SECURITY_MIN_BASE_RID (0x00000050L)
204 #define SECURITY_SERVICE_ID_BASE_RID (0x00000050L)
205 #define SECURITY_SERVICE_ID_RID_COUNT (6L)
206 #define SECURITY_RESERVED_ID_BASE_RID (0x00000051L)
207 #define SECURITY_APPPOOL_ID_BASE_RID (0x00000052L)
208 #define SECURITY_APPPOOL_ID_RID_COUNT (6L)
209 #define SECURITY_VIRTUALSERVER_ID_BASE_RID (0x00000053L)
210 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT (6L)
211 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID (0x00000054L)
212 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT (6L)
213 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID (0x00000055L)
214 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT (6L)
215 #define SECURITY_WMIHOST_ID_BASE_RID (0x00000056L)
216 #define SECURITY_WMIHOST_ID_RID_COUNT (6L)
217 #define SECURITY_TASK_ID_BASE_RID (0x00000057L)
218 #define SECURITY_NFS_ID_BASE_RID (0x00000058L)
219 #define SECURITY_COM_ID_BASE_RID (0x00000059L)
220 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT (6L)
221
222 #define SECURITY_MAX_BASE_RID (0x0000006FL)
223
224 #define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L)
225 #define SECURITY_MIN_NEVER_FILTERED (0x000003E8L)
226
227 #define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L)
228
229 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID (0x00000070L)
230
231 /* Well-known domain relative sub-authority values (RIDs) */
232
233 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS (0x000001F2L)
234
235 #define FOREST_USER_RID_MAX (0x000001F3L)
236
237 /* Well-known users */
238
239 #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
240 #define DOMAIN_USER_RID_GUEST (0x000001F5L)
241 #define DOMAIN_USER_RID_KRBTGT (0x000001F6L)
242
243 #define DOMAIN_USER_RID_MAX (0x000003E7L)
244
245 /* Well-known groups */
246
247 #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
248 #define DOMAIN_GROUP_RID_USERS (0x00000201L)
249 #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
250 #define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L)
251 #define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L)
252 #define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L)
253 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L)
254 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L)
255 #define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L)
256 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L)
257
258 /* Well-known aliases */
259
260 #define DOMAIN_ALIAS_RID_ADMINS (0x00000220L)
261 #define DOMAIN_ALIAS_RID_USERS (0x00000221L)
262 #define DOMAIN_ALIAS_RID_GUESTS (0x00000222L)
263 #define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L)
264
265 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
266 #define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
267 #define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L)
268 #define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
269
270 #define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L)
271 #define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L)
272 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL)
273 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL)
274 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL)
275 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL)
276
277 #define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL)
278 #define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL)
279 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L)
280 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L)
281 #define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L)
282
283 #define DOMAIN_ALIAS_RID_IUSERS (0x00000238L)
284 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L)
285 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL)
286 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL)
287 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL)
288 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP (0x0000023EL)
289
290 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
291 #define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L)
292 #define SECURITY_MANDATORY_LOW_RID (0x00001000L)
293 #define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L)
294 #define SECURITY_MANDATORY_HIGH_RID (0x00003000L)
295 #define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L)
296 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L)
297
298 /* SECURITY_MANDATORY_MAXIMUM_USER_RID is the highest RID that
299 can be set by a usermode caller.*/
300
301 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
302
303 #define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000)
304
305 /* Allocate the System Luid. The first 1000 LUIDs are reserved.
306 Use #999 here (0x3e7 = 999) */
307
308 #define SYSTEM_LUID {0x3e7, 0x0}
309 #define ANONYMOUS_LOGON_LUID {0x3e6, 0x0}
310 #define LOCALSERVICE_LUID {0x3e5, 0x0}
311 #define NETWORKSERVICE_LUID {0x3e4, 0x0}
312 #define IUSER_LUID {0x3e3, 0x0}
313
314 typedef struct _ACE_HEADER {
315 UCHAR AceType;
316 UCHAR AceFlags;
317 USHORT AceSize;
318 } ACE_HEADER, *PACE_HEADER;
319
320 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
321 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
322 #define ACCESS_DENIED_ACE_TYPE (0x1)
323 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
324 #define SYSTEM_ALARM_ACE_TYPE (0x3)
325 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
326 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
327 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
328 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
329 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
330 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
331 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
332 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
333 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
334 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
335 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
336 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
337 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
338 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
339 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
340 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
341 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
342 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
343 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
344 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x11)
345 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11)
346
347 /* The following are the inherit flags that go into the AceFlags field
348 of an Ace header. */
349
350 #define OBJECT_INHERIT_ACE (0x1)
351 #define CONTAINER_INHERIT_ACE (0x2)
352 #define NO_PROPAGATE_INHERIT_ACE (0x4)
353 #define INHERIT_ONLY_ACE (0x8)
354 #define INHERITED_ACE (0x10)
355 #define VALID_INHERIT_FLAGS (0x1F)
356
357 #define SUCCESSFUL_ACCESS_ACE_FLAG (0x40)
358 #define FAILED_ACCESS_ACE_FLAG (0x80)
359
360 typedef struct _ACCESS_ALLOWED_ACE {
361 ACE_HEADER Header;
362 ACCESS_MASK Mask;
363 ULONG SidStart;
364 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
365
366 typedef struct _ACCESS_DENIED_ACE {
367 ACE_HEADER Header;
368 ACCESS_MASK Mask;
369 ULONG SidStart;
370 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
371
372 typedef struct _SYSTEM_AUDIT_ACE {
373 ACE_HEADER Header;
374 ACCESS_MASK Mask;
375 ULONG SidStart;
376 } SYSTEM_AUDIT_ACE, *PSYSTEM_AUDIT_ACE;
377
378 typedef struct _SYSTEM_ALARM_ACE {
379 ACE_HEADER Header;
380 ACCESS_MASK Mask;
381 ULONG SidStart;
382 } SYSTEM_ALARM_ACE, *PSYSTEM_ALARM_ACE;
383
384 typedef struct _SYSTEM_MANDATORY_LABEL_ACE {
385 ACE_HEADER Header;
386 ACCESS_MASK Mask;
387 ULONG SidStart;
388 } SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE;
389
390 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
391 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
392 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
393 #define SYSTEM_MANDATORY_LABEL_VALID_MASK (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP | \
394 SYSTEM_MANDATORY_LABEL_NO_READ_UP | \
395 SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
396
397 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
398
399 typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
400
401 #define SE_OWNER_DEFAULTED 0x0001
402 #define SE_GROUP_DEFAULTED 0x0002
403 #define SE_DACL_PRESENT 0x0004
404 #define SE_DACL_DEFAULTED 0x0008
405 #define SE_SACL_PRESENT 0x0010
406 #define SE_SACL_DEFAULTED 0x0020
407 #define SE_DACL_UNTRUSTED 0x0040
408 #define SE_SERVER_SECURITY 0x0080
409 #define SE_DACL_AUTO_INHERIT_REQ 0x0100
410 #define SE_SACL_AUTO_INHERIT_REQ 0x0200
411 #define SE_DACL_AUTO_INHERITED 0x0400
412 #define SE_SACL_AUTO_INHERITED 0x0800
413 #define SE_DACL_PROTECTED 0x1000
414 #define SE_SACL_PROTECTED 0x2000
415 #define SE_RM_CONTROL_VALID 0x4000
416 #define SE_SELF_RELATIVE 0x8000
417
418 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
419 UCHAR Revision;
420 UCHAR Sbz1;
421 SECURITY_DESCRIPTOR_CONTROL Control;
422 ULONG Owner;
423 ULONG Group;
424 ULONG Sacl;
425 ULONG Dacl;
426 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
427
428 typedef struct _SECURITY_DESCRIPTOR {
429 UCHAR Revision;
430 UCHAR Sbz1;
431 SECURITY_DESCRIPTOR_CONTROL Control;
432 PSID Owner;
433 PSID Group;
434 PACL Sacl;
435 PACL Dacl;
436 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
437
438 typedef struct _OBJECT_TYPE_LIST {
439 USHORT Level;
440 USHORT Sbz;
441 GUID *ObjectType;
442 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
443
444 #define ACCESS_OBJECT_GUID 0
445 #define ACCESS_PROPERTY_SET_GUID 1
446 #define ACCESS_PROPERTY_GUID 2
447 #define ACCESS_MAX_LEVEL 4
448
449 typedef enum _AUDIT_EVENT_TYPE {
450 AuditEventObjectAccess,
451 AuditEventDirectoryServiceAccess
452 } AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE;
453
454 #define AUDIT_ALLOW_NO_PRIVILEGE 0x1
455
456 #define ACCESS_DS_SOURCE_A "DS"
457 #define ACCESS_DS_SOURCE_W L"DS"
458 #define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object"
459 #define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object"
460
461 #define ACCESS_REASON_TYPE_MASK 0xffff0000
462 #define ACCESS_REASON_DATA_MASK 0x0000ffff
463
464 typedef enum _ACCESS_REASON_TYPE {
465 AccessReasonNone = 0x00000000,
466 AccessReasonAllowedAce = 0x00010000,
467 AccessReasonDeniedAce = 0x00020000,
468 AccessReasonAllowedParentAce = 0x00030000,
469 AccessReasonDeniedParentAce = 0x00040000,
470 AccessReasonMissingPrivilege = 0x00100000,
471 AccessReasonFromPrivilege = 0x00200000,
472 AccessReasonIntegrityLevel = 0x00300000,
473 AccessReasonOwnership = 0x00400000,
474 AccessReasonNullDacl = 0x00500000,
475 AccessReasonEmptyDacl = 0x00600000,
476 AccessReasonNoSD = 0x00700000,
477 AccessReasonNoGrant = 0x00800000
478 } ACCESS_REASON_TYPE;
479
480 typedef ULONG ACCESS_REASON;
481
482 typedef struct _ACCESS_REASONS {
483 ACCESS_REASON Data[32];
484 } ACCESS_REASONS, *PACCESS_REASONS;
485
486 #define SE_SECURITY_DESCRIPTOR_FLAG_NO_OWNER_ACE 0x00000001
487 #define SE_SECURITY_DESCRIPTOR_FLAG_NO_LABEL_ACE 0x00000002
488 #define SE_SECURITY_DESCRIPTOR_VALID_FLAGS 0x00000003
489
490 typedef struct _SE_SECURITY_DESCRIPTOR {
491 ULONG Size;
492 ULONG Flags;
493 PSECURITY_DESCRIPTOR SecurityDescriptor;
494 } SE_SECURITY_DESCRIPTOR, *PSE_SECURITY_DESCRIPTOR;
495
496 typedef struct _SE_ACCESS_REQUEST {
497 ULONG Size;
498 PSE_SECURITY_DESCRIPTOR SeSecurityDescriptor;
499 ACCESS_MASK DesiredAccess;
500 ACCESS_MASK PreviouslyGrantedAccess;
501 PSID PrincipalSelfSid;
502 PGENERIC_MAPPING GenericMapping;
503 ULONG ObjectTypeListCount;
504 POBJECT_TYPE_LIST ObjectTypeList;
505 } SE_ACCESS_REQUEST, *PSE_ACCESS_REQUEST;
506
507 #define TOKEN_ASSIGN_PRIMARY (0x0001)
508 #define TOKEN_DUPLICATE (0x0002)
509 #define TOKEN_IMPERSONATE (0x0004)
510 #define TOKEN_QUERY (0x0008)
511 #define TOKEN_QUERY_SOURCE (0x0010)
512 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
513 #define TOKEN_ADJUST_GROUPS (0x0040)
514 #define TOKEN_ADJUST_DEFAULT (0x0080)
515 #define TOKEN_ADJUST_SESSIONID (0x0100)
516
517 #define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED |\
518 TOKEN_ASSIGN_PRIMARY |\
519 TOKEN_DUPLICATE |\
520 TOKEN_IMPERSONATE |\
521 TOKEN_QUERY |\
522 TOKEN_QUERY_SOURCE |\
523 TOKEN_ADJUST_PRIVILEGES |\
524 TOKEN_ADJUST_GROUPS |\
525 TOKEN_ADJUST_DEFAULT)
526
527 #if ((defined(_WIN32_WINNT) && (_WIN32_WINNT > 0x0400)) || (!defined(_WIN32_WINNT)))
528 #define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID)
529 #else
530 #define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P)
531 #endif
532
533 #define TOKEN_READ (STANDARD_RIGHTS_READ | TOKEN_QUERY)
534
535 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
536 TOKEN_ADJUST_PRIVILEGES |\
537 TOKEN_ADJUST_GROUPS |\
538 TOKEN_ADJUST_DEFAULT)
539
540 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
541
542 typedef enum _TOKEN_TYPE {
543 TokenPrimary = 1,
544 TokenImpersonation
545 } TOKEN_TYPE, *PTOKEN_TYPE;
546
547 typedef enum _TOKEN_INFORMATION_CLASS {
548 TokenUser = 1,
549 TokenGroups,
550 TokenPrivileges,
551 TokenOwner,
552 TokenPrimaryGroup,
553 TokenDefaultDacl,
554 TokenSource,
555 TokenType,
556 TokenImpersonationLevel,
557 TokenStatistics,
558 TokenRestrictedSids,
559 TokenSessionId,
560 TokenGroupsAndPrivileges,
561 TokenSessionReference,
562 TokenSandBoxInert,
563 TokenAuditPolicy,
564 TokenOrigin,
565 TokenElevationType,
566 TokenLinkedToken,
567 TokenElevation,
568 TokenHasRestrictions,
569 TokenAccessInformation,
570 TokenVirtualizationAllowed,
571 TokenVirtualizationEnabled,
572 TokenIntegrityLevel,
573 TokenUIAccess,
574 TokenMandatoryPolicy,
575 TokenLogonSid,
576 MaxTokenInfoClass
577 } TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS;
578
579 typedef struct _TOKEN_USER {
580 SID_AND_ATTRIBUTES User;
581 } TOKEN_USER, *PTOKEN_USER;
582
583 typedef struct _TOKEN_GROUPS {
584 ULONG GroupCount;
585 #ifdef MIDL_PASS
586 [size_is(GroupCount)] SID_AND_ATTRIBUTES Groups[*];
587 #else
588 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
589 #endif
590 } TOKEN_GROUPS, *PTOKEN_GROUPS, *LPTOKEN_GROUPS;
591
592 typedef struct _TOKEN_PRIVILEGES {
593 ULONG PrivilegeCount;
594 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
595 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES, *LPTOKEN_PRIVILEGES;
596
597 typedef struct _TOKEN_OWNER {
598 PSID Owner;
599 } TOKEN_OWNER, *PTOKEN_OWNER;
600
601 typedef struct _TOKEN_PRIMARY_GROUP {
602 PSID PrimaryGroup;
603 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
604
605 typedef struct _TOKEN_DEFAULT_DACL {
606 PACL DefaultDacl;
607 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
608
609 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
610 ULONG SidCount;
611 ULONG SidLength;
612 PSID_AND_ATTRIBUTES Sids;
613 ULONG RestrictedSidCount;
614 ULONG RestrictedSidLength;
615 PSID_AND_ATTRIBUTES RestrictedSids;
616 ULONG PrivilegeCount;
617 ULONG PrivilegeLength;
618 PLUID_AND_ATTRIBUTES Privileges;
619 LUID AuthenticationId;
620 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
621
622 typedef struct _TOKEN_LINKED_TOKEN {
623 HANDLE LinkedToken;
624 } TOKEN_LINKED_TOKEN, *PTOKEN_LINKED_TOKEN;
625
626 typedef struct _TOKEN_ELEVATION {
627 ULONG TokenIsElevated;
628 } TOKEN_ELEVATION, *PTOKEN_ELEVATION;
629
630 typedef struct _TOKEN_MANDATORY_LABEL {
631 SID_AND_ATTRIBUTES Label;
632 } TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL;
633
634 #define TOKEN_MANDATORY_POLICY_OFF 0x0
635 #define TOKEN_MANDATORY_POLICY_NO_WRITE_UP 0x1
636 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
637
638 #define TOKEN_MANDATORY_POLICY_VALID_MASK (TOKEN_MANDATORY_POLICY_NO_WRITE_UP | \
639 TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN)
640
641 #define POLICY_AUDIT_SUBCATEGORY_COUNT (56)
642
643 typedef struct _TOKEN_AUDIT_POLICY {
644 UCHAR PerUserPolicy[((POLICY_AUDIT_SUBCATEGORY_COUNT) >> 1) + 1];
645 } TOKEN_AUDIT_POLICY, *PTOKEN_AUDIT_POLICY;
646
647 #define TOKEN_SOURCE_LENGTH 8
648
649 typedef struct _TOKEN_SOURCE {
650 CHAR SourceName[TOKEN_SOURCE_LENGTH];
651 LUID SourceIdentifier;
652 } TOKEN_SOURCE, *PTOKEN_SOURCE;
653
654 #include <pshpack4.h>
655 typedef struct _TOKEN_STATISTICS {
656 LUID TokenId;
657 LUID AuthenticationId;
658 LARGE_INTEGER ExpirationTime;
659 TOKEN_TYPE TokenType;
660 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
661 ULONG DynamicCharged;
662 ULONG DynamicAvailable;
663 ULONG GroupCount;
664 ULONG PrivilegeCount;
665 LUID ModifiedId;
666 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
667 #include <poppack.h>
668
669 typedef struct _TOKEN_CONTROL {
670 LUID TokenId;
671 LUID AuthenticationId;
672 LUID ModifiedId;
673 TOKEN_SOURCE TokenSource;
674 } TOKEN_CONTROL, *PTOKEN_CONTROL;
675
676 typedef struct _TOKEN_ORIGIN {
677 LUID OriginatingLogonSession;
678 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
679
680 typedef enum _MANDATORY_LEVEL {
681 MandatoryLevelUntrusted = 0,
682 MandatoryLevelLow,
683 MandatoryLevelMedium,
684 MandatoryLevelHigh,
685 MandatoryLevelSystem,
686 MandatoryLevelSecureProcess,
687 MandatoryLevelCount
688 } MANDATORY_LEVEL, *PMANDATORY_LEVEL;
689
690
691 typedef struct _SE_ACCESS_REPLY {
692 ULONG Size;
693 ULONG ResultListCount;
694 PACCESS_MASK GrantedAccess;
695 PNTSTATUS AccessStatus;
696 PACCESS_REASONS AccessReason;
697 PPRIVILEGE_SET* Privileges;
698 } SE_ACCESS_REPLY, *PSE_ACCESS_REPLY;
699
700 typedef enum _SE_AUDIT_OPERATION {
701 AuditPrivilegeObject,
702 AuditPrivilegeService,
703 AuditAccessCheck,
704 AuditOpenObject,
705 AuditOpenObjectWithTransaction,
706 AuditCloseObject,
707 AuditDeleteObject,
708 AuditOpenObjectForDelete,
709 AuditOpenObjectForDeleteWithTransaction,
710 AuditCloseNonObject,
711 AuditOpenNonObject,
712 AuditObjectReference,
713 AuditHandleCreation,
714 } SE_AUDIT_OPERATION, *PSE_AUDIT_OPERATION;
715
716 typedef struct _SE_AUDIT_INFO {
717 ULONG Size;
718 AUDIT_EVENT_TYPE AuditType;
719 SE_AUDIT_OPERATION AuditOperation;
720 ULONG AuditFlags;
721 UNICODE_STRING SubsystemName;
722 UNICODE_STRING ObjectTypeName;
723 UNICODE_STRING ObjectName;
724 PVOID HandleId;
725 GUID* TransactionId;
726 LUID* OperationId;
727 BOOLEAN ObjectCreation;
728 BOOLEAN GenerateOnClose;
729 } SE_AUDIT_INFO, *PSE_AUDIT_INFO;
730
731 typedef struct _TOKEN_MANDATORY_POLICY {
732 ULONG Policy;
733 } TOKEN_MANDATORY_POLICY, *PTOKEN_MANDATORY_POLICY;
734
735 typedef struct _TOKEN_ACCESS_INFORMATION {
736 PSID_AND_ATTRIBUTES_HASH SidHash;
737 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash;
738 PTOKEN_PRIVILEGES Privileges;
739 LUID AuthenticationId;
740 TOKEN_TYPE TokenType;
741 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
742 TOKEN_MANDATORY_POLICY MandatoryPolicy;
743 ULONG Flags;
744 } TOKEN_ACCESS_INFORMATION, *PTOKEN_ACCESS_INFORMATION;
745
746 #define TOKEN_HAS_TRAVERSE_PRIVILEGE 0x0001
747 #define TOKEN_HAS_BACKUP_PRIVILEGE 0x0002
748 #define TOKEN_HAS_RESTORE_PRIVILEGE 0x0004
749 #define TOKEN_WRITE_RESTRICTED 0x0008
750 #define TOKEN_IS_RESTRICTED 0x0010
751 #define TOKEN_SESSION_NOT_REFERENCED 0x0020
752 #define TOKEN_SANDBOX_INERT 0x0040
753 #define TOKEN_HAS_IMPERSONATE_PRIVILEGE 0x0080
754 #define SE_BACKUP_PRIVILEGES_CHECKED 0x0100
755 #define TOKEN_VIRTUALIZE_ALLOWED 0x0200
756 #define TOKEN_VIRTUALIZE_ENABLED 0x0400
757 #define TOKEN_IS_FILTERED 0x0800
758 #define TOKEN_UIACCESS 0x1000
759 #define TOKEN_NOT_LOW 0x2000
760
761 typedef struct _SE_EXPORTS {
762 LUID SeCreateTokenPrivilege;
763 LUID SeAssignPrimaryTokenPrivilege;
764 LUID SeLockMemoryPrivilege;
765 LUID SeIncreaseQuotaPrivilege;
766 LUID SeUnsolicitedInputPrivilege;
767 LUID SeTcbPrivilege;
768 LUID SeSecurityPrivilege;
769 LUID SeTakeOwnershipPrivilege;
770 LUID SeLoadDriverPrivilege;
771 LUID SeCreatePagefilePrivilege;
772 LUID SeIncreaseBasePriorityPrivilege;
773 LUID SeSystemProfilePrivilege;
774 LUID SeSystemtimePrivilege;
775 LUID SeProfileSingleProcessPrivilege;
776 LUID SeCreatePermanentPrivilege;
777 LUID SeBackupPrivilege;
778 LUID SeRestorePrivilege;
779 LUID SeShutdownPrivilege;
780 LUID SeDebugPrivilege;
781 LUID SeAuditPrivilege;
782 LUID SeSystemEnvironmentPrivilege;
783 LUID SeChangeNotifyPrivilege;
784 LUID SeRemoteShutdownPrivilege;
785 PSID SeNullSid;
786 PSID SeWorldSid;
787 PSID SeLocalSid;
788 PSID SeCreatorOwnerSid;
789 PSID SeCreatorGroupSid;
790 PSID SeNtAuthoritySid;
791 PSID SeDialupSid;
792 PSID SeNetworkSid;
793 PSID SeBatchSid;
794 PSID SeInteractiveSid;
795 PSID SeLocalSystemSid;
796 PSID SeAliasAdminsSid;
797 PSID SeAliasUsersSid;
798 PSID SeAliasGuestsSid;
799 PSID SeAliasPowerUsersSid;
800 PSID SeAliasAccountOpsSid;
801 PSID SeAliasSystemOpsSid;
802 PSID SeAliasPrintOpsSid;
803 PSID SeAliasBackupOpsSid;
804 PSID SeAuthenticatedUsersSid;
805 PSID SeRestrictedSid;
806 PSID SeAnonymousLogonSid;
807 LUID SeUndockPrivilege;
808 LUID SeSyncAgentPrivilege;
809 LUID SeEnableDelegationPrivilege;
810 PSID SeLocalServiceSid;
811 PSID SeNetworkServiceSid;
812 LUID SeManageVolumePrivilege;
813 LUID SeImpersonatePrivilege;
814 LUID SeCreateGlobalPrivilege;
815 LUID SeTrustedCredManAccessPrivilege;
816 LUID SeRelabelPrivilege;
817 LUID SeIncreaseWorkingSetPrivilege;
818 LUID SeTimeZonePrivilege;
819 LUID SeCreateSymbolicLinkPrivilege;
820 PSID SeIUserSid;
821 PSID SeUntrustedMandatorySid;
822 PSID SeLowMandatorySid;
823 PSID SeMediumMandatorySid;
824 PSID SeHighMandatorySid;
825 PSID SeSystemMandatorySid;
826 PSID SeOwnerRightsSid;
827 } SE_EXPORTS, *PSE_EXPORTS;
828
829 typedef NTSTATUS
830 (NTAPI *PSE_LOGON_SESSION_TERMINATED_ROUTINE)(
831 IN PLUID LogonId);
832
833 typedef struct _SECURITY_CLIENT_CONTEXT {
834 SECURITY_QUALITY_OF_SERVICE SecurityQos;
835 PACCESS_TOKEN ClientToken;
836 BOOLEAN DirectlyAccessClientToken;
837 BOOLEAN DirectAccessEffectiveOnly;
838 BOOLEAN ServerIsRemote;
839 TOKEN_CONTROL ClientTokenControl;
840 } SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
841
842 /******************************************************************************
843 * Object Manager Types *
844 ******************************************************************************/
845
846 typedef enum _OBJECT_INFORMATION_CLASS {
847 ObjectBasicInformation = 0,
848 ObjectTypeInformation = 2,
849 /* Not for public use */
850 ObjectNameInformation = 1,
851 ObjectTypesInformation = 3,
852 ObjectHandleFlagInformation = 4,
853 ObjectSessionInformation = 5,
854 MaxObjectInfoClass
855 } OBJECT_INFORMATION_CLASS;
856
857
858 /******************************************************************************
859 * Runtime Library Types *
860 ******************************************************************************/
861
862
863 #define RTL_SYSTEM_VOLUME_INFORMATION_FOLDER L"System Volume Information"
864
865 _Function_class_(RTL_ALLOCATE_STRING_ROUTINE)
866 _IRQL_requires_max_(PASSIVE_LEVEL)
867 __drv_allocatesMem(Mem)
868 typedef PVOID
869 (NTAPI *PRTL_ALLOCATE_STRING_ROUTINE)(
870 _In_ SIZE_T NumberOfBytes);
871
872 #if _WIN32_WINNT >= 0x0600
873 _Function_class_(RTL_REALLOCATE_STRING_ROUTINE)
874 _IRQL_requires_max_(PASSIVE_LEVEL)
875 __drv_allocatesMem(Mem)
876 typedef PVOID
877 (NTAPI *PRTL_REALLOCATE_STRING_ROUTINE)(
878 _In_ SIZE_T NumberOfBytes,
879 IN PVOID Buffer);
880 #endif
881
882 typedef VOID
883 (NTAPI *PRTL_FREE_STRING_ROUTINE)(
884 _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer);
885
886 extern NTKERNELAPI const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine;
887 extern NTKERNELAPI const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine;
888
889 #if _WIN32_WINNT >= 0x0600
890 extern NTKERNELAPI const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine;
891 #endif
892
893 _Function_class_(RTL_HEAP_COMMIT_ROUTINE)
894 _IRQL_requires_same_
895 typedef NTSTATUS
896 (NTAPI *PRTL_HEAP_COMMIT_ROUTINE) (
897 _In_ PVOID Base,
898 _Inout_ PVOID *CommitAddress,
899 _Inout_ PSIZE_T CommitSize);
900
901 typedef struct _RTL_HEAP_PARAMETERS {
902 ULONG Length;
903 SIZE_T SegmentReserve;
904 SIZE_T SegmentCommit;
905 SIZE_T DeCommitFreeBlockThreshold;
906 SIZE_T DeCommitTotalFreeThreshold;
907 SIZE_T MaximumAllocationSize;
908 SIZE_T VirtualMemoryThreshold;
909 SIZE_T InitialCommit;
910 SIZE_T InitialReserve;
911 PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
912 SIZE_T Reserved[2];
913 } RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
914
915 #if (NTDDI_VERSION >= NTDDI_WIN2K)
916
917 typedef struct _GENERATE_NAME_CONTEXT {
918 USHORT Checksum;
919 BOOLEAN CheckSumInserted;
920 _Field_range_(<=, 8) UCHAR NameLength;
921 WCHAR NameBuffer[8];
922 _Field_range_(<=, 4) ULONG ExtensionLength;
923 WCHAR ExtensionBuffer[4];
924 ULONG LastIndexValue;
925 } GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
926
927 typedef struct _PREFIX_TABLE_ENTRY {
928 CSHORT NodeTypeCode;
929 CSHORT NameLength;
930 struct _PREFIX_TABLE_ENTRY *NextPrefixTree;
931 RTL_SPLAY_LINKS Links;
932 PSTRING Prefix;
933 } PREFIX_TABLE_ENTRY, *PPREFIX_TABLE_ENTRY;
934
935 typedef struct _PREFIX_TABLE {
936 CSHORT NodeTypeCode;
937 CSHORT NameLength;
938 PPREFIX_TABLE_ENTRY NextPrefixTree;
939 } PREFIX_TABLE, *PPREFIX_TABLE;
940
941 typedef struct _UNICODE_PREFIX_TABLE_ENTRY {
942 CSHORT NodeTypeCode;
943 CSHORT NameLength;
944 struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
945 struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
946 RTL_SPLAY_LINKS Links;
947 PUNICODE_STRING Prefix;
948 } UNICODE_PREFIX_TABLE_ENTRY, *PUNICODE_PREFIX_TABLE_ENTRY;
949
950 typedef struct _UNICODE_PREFIX_TABLE {
951 CSHORT NodeTypeCode;
952 CSHORT NameLength;
953 PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
954 PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
955 } UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
956
957 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
958
959 #if (NTDDI_VERSION >= NTDDI_WINXP)
960 typedef struct _COMPRESSED_DATA_INFO {
961 USHORT CompressionFormatAndEngine;
962 UCHAR CompressionUnitShift;
963 UCHAR ChunkShift;
964 UCHAR ClusterShift;
965 UCHAR Reserved;
966 USHORT NumberOfChunks;
967 ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
968 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
969 #endif
970 /******************************************************************************
971 * Runtime Library Functions *
972 ******************************************************************************/
973
974
975 #if (NTDDI_VERSION >= NTDDI_WIN2K)
976
977
978 _Must_inspect_result_
979 _Ret_maybenull_
980 _Post_writable_byte_size_(Size)
981 NTSYSAPI
982 PVOID
983 NTAPI
984 RtlAllocateHeap(
985 _In_ HANDLE HeapHandle,
986 _In_opt_ ULONG Flags,
987 _In_ SIZE_T Size);
988
989 _Success_(return != 0)
990 NTSYSAPI
991 BOOLEAN
992 NTAPI
993 RtlFreeHeap(
994 _In_ PVOID HeapHandle,
995 _In_opt_ ULONG Flags,
996 _In_ _Post_invalid_ PVOID BaseAddress);
997
998 NTSYSAPI
999 VOID
1000 NTAPI
1001 RtlCaptureContext(
1002 _Out_ PCONTEXT ContextRecord);
1003
1004 _Ret_range_(<, MAXLONG)
1005 NTSYSAPI
1006 ULONG
1007 NTAPI
1008 RtlRandom(
1009 _Inout_ PULONG Seed);
1010
1011 _IRQL_requires_max_(APC_LEVEL)
1012 _Success_(return != 0)
1013 _Must_inspect_result_
1014 NTSYSAPI
1015 BOOLEAN
1016 NTAPI
1017 RtlCreateUnicodeString(
1018 _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem))
1019 PUNICODE_STRING DestinationString,
1020 _In_z_ PCWSTR SourceString);
1021
1022 _IRQL_requires_max_(PASSIVE_LEVEL)
1023 _Must_inspect_result_
1024 NTSYSAPI
1025 BOOLEAN
1026 NTAPI
1027 RtlPrefixString(
1028 _In_ const STRING *String1,
1029 _In_ const STRING *String2,
1030 _In_ BOOLEAN CaseInsensitive);
1031
1032 _IRQL_requires_max_(APC_LEVEL)
1033 NTSYSAPI
1034 NTSTATUS
1035 NTAPI
1036 RtlAppendStringToString(
1037 _Inout_ PSTRING Destination,
1038 _In_ const STRING *Source);
1039
1040 _IRQL_requires_max_(PASSIVE_LEVEL)
1041 _Must_inspect_result_
1042 NTSYSAPI
1043 NTSTATUS
1044 NTAPI
1045 RtlOemStringToUnicodeString(
1046 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1047 _When_(!AllocateDestinationString, _Inout_)
1048 PUNICODE_STRING DestinationString,
1049 _In_ PCOEM_STRING SourceString,
1050 _In_ BOOLEAN AllocateDestinationString);
1051
1052 _IRQL_requires_max_(PASSIVE_LEVEL)
1053 _Must_inspect_result_
1054 NTSYSAPI
1055 NTSTATUS
1056 NTAPI
1057 RtlUnicodeStringToOemString(
1058 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1059 _When_(!AllocateDestinationString, _Inout_)
1060 POEM_STRING DestinationString,
1061 _In_ PCUNICODE_STRING SourceString,
1062 _In_ BOOLEAN AllocateDestinationString);
1063
1064 _IRQL_requires_max_(PASSIVE_LEVEL)
1065 _Must_inspect_result_
1066 NTSYSAPI
1067 NTSTATUS
1068 NTAPI
1069 RtlUpcaseUnicodeStringToOemString(
1070 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1071 _When_(!AllocateDestinationString, _Inout_)
1072 POEM_STRING DestinationString,
1073 _In_ PCUNICODE_STRING SourceString,
1074 _In_ BOOLEAN AllocateDestinationString);
1075
1076 _IRQL_requires_max_(PASSIVE_LEVEL)
1077 _Must_inspect_result_
1078 NTSYSAPI
1079 NTSTATUS
1080 NTAPI
1081 RtlOemStringToCountedUnicodeString(
1082 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1083 _When_(!AllocateDestinationString, _Inout_)
1084 PUNICODE_STRING DestinationString,
1085 _In_ PCOEM_STRING SourceString,
1086 _In_ BOOLEAN AllocateDestinationString);
1087
1088 _IRQL_requires_max_(PASSIVE_LEVEL)
1089 _Must_inspect_result_
1090 NTSYSAPI
1091 NTSTATUS
1092 NTAPI
1093 RtlUnicodeStringToCountedOemString(
1094 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1095 _When_(!AllocateDestinationString, _Inout_)
1096 POEM_STRING DestinationString,
1097 _In_ PCUNICODE_STRING SourceString,
1098 _In_ BOOLEAN AllocateDestinationString);
1099
1100 _IRQL_requires_max_(PASSIVE_LEVEL)
1101 _Must_inspect_result_
1102 NTSYSAPI
1103 NTSTATUS
1104 NTAPI
1105 RtlUpcaseUnicodeStringToCountedOemString(
1106 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1107 _When_(!AllocateDestinationString, _Inout_)
1108 POEM_STRING DestinationString,
1109 _In_ PCUNICODE_STRING SourceString,
1110 _In_ BOOLEAN AllocateDestinationString);
1111
1112 _IRQL_requires_max_(PASSIVE_LEVEL)
1113 _When_(AllocateDestinationString, _Must_inspect_result_)
1114 NTSYSAPI
1115 NTSTATUS
1116 NTAPI
1117 RtlDowncaseUnicodeString(
1118 _When_(AllocateDestinationString, _Out_ _At_(UniDest->Buffer, __drv_allocatesMem(Mem)))
1119 _When_(!AllocateDestinationString, _Inout_)
1120 PUNICODE_STRING UniDest,
1121 _In_ PCUNICODE_STRING UniSource,
1122 _In_ BOOLEAN AllocateDestinationString);
1123
1124 _IRQL_requires_max_(PASSIVE_LEVEL)
1125 NTSYSAPI
1126 VOID
1127 NTAPI
1128 RtlFreeOemString(
1129 _Inout_ _At_(OemString->Buffer, __drv_freesMem(Mem)) POEM_STRING OemString);
1130
1131 _IRQL_requires_max_(PASSIVE_LEVEL)
1132 NTSYSAPI
1133 ULONG
1134 NTAPI
1135 RtlxUnicodeStringToOemSize(
1136 _In_ PCUNICODE_STRING UnicodeString);
1137
1138 _IRQL_requires_max_(PASSIVE_LEVEL)
1139 NTSYSAPI
1140 ULONG
1141 NTAPI
1142 RtlxOemStringToUnicodeSize(
1143 _In_ PCOEM_STRING OemString);
1144
1145 _IRQL_requires_max_(PASSIVE_LEVEL)
1146 NTSYSAPI
1147 NTSTATUS
1148 NTAPI
1149 RtlMultiByteToUnicodeN(
1150 _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString,
1151 _In_ ULONG MaxBytesInUnicodeString,
1152 _Out_opt_ PULONG BytesInUnicodeString,
1153 _In_reads_bytes_(BytesInMultiByteString) const CHAR *MultiByteString,
1154 _In_ ULONG BytesInMultiByteString);
1155
1156 _IRQL_requires_max_(PASSIVE_LEVEL)
1157 NTSYSAPI
1158 NTSTATUS
1159 NTAPI
1160 RtlMultiByteToUnicodeSize(
1161 _Out_ PULONG BytesInUnicodeString,
1162 _In_reads_bytes_(BytesInMultiByteString) const CHAR *MultiByteString,
1163 _In_ ULONG BytesInMultiByteString);
1164
1165 _IRQL_requires_max_(PASSIVE_LEVEL)
1166 NTSYSAPI
1167 NTSTATUS
1168 NTAPI
1169 RtlUnicodeToMultiByteSize(
1170 _Out_ PULONG BytesInMultiByteString,
1171 _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
1172 _In_ ULONG BytesInUnicodeString);
1173
1174 _IRQL_requires_max_(PASSIVE_LEVEL)
1175 NTSYSAPI
1176 NTSTATUS
1177 NTAPI
1178 RtlUnicodeToMultiByteN(
1179 _Out_writes_bytes_to_(MaxBytesInMultiByteString, *BytesInMultiByteString) PCHAR MultiByteString,
1180 _In_ ULONG MaxBytesInMultiByteString,
1181 _Out_opt_ PULONG BytesInMultiByteString,
1182 _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
1183 _In_ ULONG BytesInUnicodeString);
1184
1185 _IRQL_requires_max_(PASSIVE_LEVEL)
1186 NTSYSAPI
1187 NTSTATUS
1188 NTAPI
1189 RtlUpcaseUnicodeToMultiByteN(
1190 _Out_writes_bytes_to_(MaxBytesInMultiByteString, *BytesInMultiByteString) PCHAR MultiByteString,
1191 _In_ ULONG MaxBytesInMultiByteString,
1192 _Out_opt_ PULONG BytesInMultiByteString,
1193 _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
1194 _In_ ULONG BytesInUnicodeString);
1195
1196 _IRQL_requires_max_(PASSIVE_LEVEL)
1197 NTSYSAPI
1198 NTSTATUS
1199 NTAPI
1200 RtlOemToUnicodeN(
1201 _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) PWSTR UnicodeString,
1202 _In_ ULONG MaxBytesInUnicodeString,
1203 _Out_opt_ PULONG BytesInUnicodeString,
1204 _In_reads_bytes_(BytesInOemString) PCCH OemString,
1205 _In_ ULONG BytesInOemString);
1206
1207 _IRQL_requires_max_(PASSIVE_LEVEL)
1208 NTSYSAPI
1209 NTSTATUS
1210 NTAPI
1211 RtlUnicodeToOemN(
1212 _Out_writes_bytes_to_(MaxBytesInOemString, *BytesInOemString) PCHAR OemString,
1213 _In_ ULONG MaxBytesInOemString,
1214 _Out_opt_ PULONG BytesInOemString,
1215 _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
1216 _In_ ULONG BytesInUnicodeString);
1217
1218 _IRQL_requires_max_(PASSIVE_LEVEL)
1219 NTSYSAPI
1220 NTSTATUS
1221 NTAPI
1222 RtlUpcaseUnicodeToOemN(
1223 _Out_writes_bytes_to_(MaxBytesInOemString, *BytesInOemString) PCHAR OemString,
1224 _In_ ULONG MaxBytesInOemString,
1225 _Out_opt_ PULONG BytesInOemString,
1226 _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
1227 _In_ ULONG BytesInUnicodeString);
1228
1229 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
1230 _IRQL_requires_max_(PASSIVE_LEVEL)
1231 NTSYSAPI
1232 NTSTATUS
1233 NTAPI
1234 RtlGenerate8dot3Name(
1235 _In_ PCUNICODE_STRING Name,
1236 _In_ BOOLEAN AllowExtendedCharacters,
1237 _Inout_ PGENERATE_NAME_CONTEXT Context,
1238 _Inout_ PUNICODE_STRING Name8dot3);
1239 #else
1240 _IRQL_requires_max_(PASSIVE_LEVEL)
1241 NTSYSAPI
1242 VOID
1243 NTAPI
1244 RtlGenerate8dot3Name(
1245 _In_ PCUNICODE_STRING Name,
1246 _In_ BOOLEAN AllowExtendedCharacters,
1247 _Inout_ PGENERATE_NAME_CONTEXT Context,
1248 _Inout_ PUNICODE_STRING Name8dot3);
1249 #endif
1250
1251 _IRQL_requires_max_(PASSIVE_LEVEL)
1252 _Must_inspect_result_
1253 NTSYSAPI
1254 BOOLEAN
1255 NTAPI
1256 RtlIsNameLegalDOS8Dot3(
1257 _In_ PCUNICODE_STRING Name,
1258 _Inout_opt_ POEM_STRING OemName,
1259 _Out_opt_ PBOOLEAN NameContainsSpaces);
1260
1261 _IRQL_requires_max_(PASSIVE_LEVEL)
1262 _Must_inspect_result_
1263 NTSYSAPI
1264 BOOLEAN
1265 NTAPI
1266 RtlIsValidOemCharacter(
1267 _Inout_ PWCHAR Char);
1268
1269 _IRQL_requires_max_(PASSIVE_LEVEL)
1270 NTSYSAPI
1271 VOID
1272 NTAPI
1273 PfxInitialize(
1274 _Out_ PPREFIX_TABLE PrefixTable);
1275
1276 _IRQL_requires_max_(PASSIVE_LEVEL)
1277 NTSYSAPI
1278 BOOLEAN
1279 NTAPI
1280 PfxInsertPrefix(
1281 _In_ PPREFIX_TABLE PrefixTable,
1282 _In_ __drv_aliasesMem PSTRING Prefix,
1283 _Out_ PPREFIX_TABLE_ENTRY PrefixTableEntry);
1284
1285 _IRQL_requires_max_(PASSIVE_LEVEL)
1286 NTSYSAPI
1287 VOID
1288 NTAPI
1289 PfxRemovePrefix(
1290 _In_ PPREFIX_TABLE PrefixTable,
1291 _In_ PPREFIX_TABLE_ENTRY PrefixTableEntry);
1292
1293 _IRQL_requires_max_(PASSIVE_LEVEL)
1294 _Must_inspect_result_
1295 NTSYSAPI
1296 PPREFIX_TABLE_ENTRY
1297 NTAPI
1298 PfxFindPrefix(
1299 _In_ PPREFIX_TABLE PrefixTable,
1300 _In_ PSTRING FullName);
1301
1302 _IRQL_requires_max_(PASSIVE_LEVEL)
1303 NTSYSAPI
1304 VOID
1305 NTAPI
1306 RtlInitializeUnicodePrefix(
1307 _Out_ PUNICODE_PREFIX_TABLE PrefixTable);
1308
1309 _IRQL_requires_max_(PASSIVE_LEVEL)
1310 NTSYSAPI
1311 BOOLEAN
1312 NTAPI
1313 RtlInsertUnicodePrefix(
1314 _In_ PUNICODE_PREFIX_TABLE PrefixTable,
1315 _In_ __drv_aliasesMem PUNICODE_STRING Prefix,
1316 _Out_ PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry);
1317
1318 _IRQL_requires_max_(PASSIVE_LEVEL)
1319 NTSYSAPI
1320 VOID
1321 NTAPI
1322 RtlRemoveUnicodePrefix(
1323 _In_ PUNICODE_PREFIX_TABLE PrefixTable,
1324 _In_ PUNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry);
1325
1326 _IRQL_requires_max_(PASSIVE_LEVEL)
1327 _Must_inspect_result_
1328 NTSYSAPI
1329 PUNICODE_PREFIX_TABLE_ENTRY
1330 NTAPI
1331 RtlFindUnicodePrefix(
1332 _In_ PUNICODE_PREFIX_TABLE PrefixTable,
1333 _In_ PUNICODE_STRING FullName,
1334 _In_ ULONG CaseInsensitiveIndex);
1335
1336 _IRQL_requires_max_(PASSIVE_LEVEL)
1337 _Must_inspect_result_
1338 NTSYSAPI
1339 PUNICODE_PREFIX_TABLE_ENTRY
1340 NTAPI
1341 RtlNextUnicodePrefix(
1342 _In_ PUNICODE_PREFIX_TABLE PrefixTable,
1343 _In_ BOOLEAN Restart);
1344
1345 _Must_inspect_result_
1346 NTSYSAPI
1347 SIZE_T
1348 NTAPI
1349 RtlCompareMemoryUlong(
1350 _In_reads_bytes_(Length) PVOID Source,
1351 _In_ SIZE_T Length,
1352 _In_ ULONG Pattern);
1353
1354 _Success_(return != 0)
1355 NTSYSAPI
1356 BOOLEAN
1357 NTAPI
1358 RtlTimeToSecondsSince1980(
1359 _In_ PLARGE_INTEGER Time,
1360 _Out_ PULONG ElapsedSeconds);
1361
1362 NTSYSAPI
1363 VOID
1364 NTAPI
1365 RtlSecondsSince1980ToTime(
1366 _In_ ULONG ElapsedSeconds,
1367 _Out_ PLARGE_INTEGER Time);
1368
1369 _Success_(return != 0)
1370 _Must_inspect_result_
1371 NTSYSAPI
1372 BOOLEAN
1373 NTAPI
1374 RtlTimeToSecondsSince1970(
1375 _In_ PLARGE_INTEGER Time,
1376 _Out_ PULONG ElapsedSeconds);
1377
1378 NTSYSAPI
1379 VOID
1380 NTAPI
1381 RtlSecondsSince1970ToTime(
1382 _In_ ULONG ElapsedSeconds,
1383 _Out_ PLARGE_INTEGER Time);
1384
1385 _IRQL_requires_max_(APC_LEVEL)
1386 _Must_inspect_result_
1387 NTSYSAPI
1388 BOOLEAN
1389 NTAPI
1390 RtlValidSid(
1391 _In_ PSID Sid);
1392
1393 _Must_inspect_result_
1394 NTSYSAPI
1395 BOOLEAN
1396 NTAPI
1397 RtlEqualSid(
1398 _In_ PSID Sid1,
1399 _In_ PSID Sid2);
1400
1401 _IRQL_requires_max_(APC_LEVEL)
1402 _Must_inspect_result_
1403 NTSYSAPI
1404 BOOLEAN
1405 NTAPI
1406 RtlEqualPrefixSid(
1407 _In_ PSID Sid1,
1408 _In_ PSID Sid2);
1409
1410 _IRQL_requires_max_(APC_LEVEL)
1411 NTSYSAPI
1412 ULONG
1413 NTAPI
1414 RtlLengthRequiredSid(
1415 _In_ ULONG SubAuthorityCount);
1416
1417 NTSYSAPI
1418 PVOID
1419 NTAPI
1420 RtlFreeSid(
1421 _In_ _Post_invalid_ PSID Sid);
1422
1423 _Must_inspect_result_
1424 NTSYSAPI
1425 NTSTATUS
1426 NTAPI
1427 RtlAllocateAndInitializeSid(
1428 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1429 _In_ UCHAR SubAuthorityCount,
1430 _In_ ULONG SubAuthority0,
1431 _In_ ULONG SubAuthority1,
1432 _In_ ULONG SubAuthority2,
1433 _In_ ULONG SubAuthority3,
1434 _In_ ULONG SubAuthority4,
1435 _In_ ULONG SubAuthority5,
1436 _In_ ULONG SubAuthority6,
1437 _In_ ULONG SubAuthority7,
1438 _Outptr_ PSID *Sid);
1439
1440 _IRQL_requires_max_(APC_LEVEL)
1441 NTSYSAPI
1442 NTSTATUS
1443 NTAPI
1444 RtlInitializeSid(
1445 _Out_ PSID Sid,
1446 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1447 _In_ UCHAR SubAuthorityCount);
1448
1449 NTSYSAPI
1450 PULONG
1451 NTAPI
1452 RtlSubAuthoritySid(
1453 _In_ PSID Sid,
1454 _In_ ULONG SubAuthority);
1455
1456 _Post_satisfies_(return >= 8 && return <= SECURITY_MAX_SID_SIZE)
1457 NTSYSAPI
1458 ULONG
1459 NTAPI
1460 RtlLengthSid(
1461 _In_ PSID Sid);
1462
1463 _IRQL_requires_max_(APC_LEVEL)
1464 NTSYSAPI
1465 NTSTATUS
1466 NTAPI
1467 RtlCopySid(
1468 _In_ ULONG DestinationSidLength,
1469 _Out_writes_bytes_(DestinationSidLength) PSID DestinationSid,
1470 _In_ PSID SourceSid);
1471
1472 _IRQL_requires_max_(APC_LEVEL)
1473 NTSYSAPI
1474 NTSTATUS
1475 NTAPI
1476 RtlConvertSidToUnicodeString(
1477 _Inout_ PUNICODE_STRING UnicodeString,
1478 _In_ PSID Sid,
1479 _In_ BOOLEAN AllocateDestinationString);
1480
1481 _IRQL_requires_max_(APC_LEVEL)
1482 NTSYSAPI
1483 VOID
1484 NTAPI
1485 RtlCopyLuid(
1486 _Out_ PLUID DestinationLuid,
1487 _In_ PLUID SourceLuid);
1488
1489 _IRQL_requires_max_(APC_LEVEL)
1490 NTSYSAPI
1491 NTSTATUS
1492 NTAPI
1493 RtlCreateAcl(
1494 _Out_writes_bytes_(AclLength) PACL Acl,
1495 _In_ ULONG AclLength,
1496 _In_ ULONG AclRevision);
1497
1498 _IRQL_requires_max_(APC_LEVEL)
1499 NTSYSAPI
1500 NTSTATUS
1501 NTAPI
1502 RtlAddAce(
1503 _Inout_ PACL Acl,
1504 _In_ ULONG AceRevision,
1505 _In_ ULONG StartingAceIndex,
1506 _In_reads_bytes_(AceListLength) PVOID AceList,
1507 _In_ ULONG AceListLength);
1508
1509 _IRQL_requires_max_(APC_LEVEL)
1510 NTSYSAPI
1511 NTSTATUS
1512 NTAPI
1513 RtlDeleteAce(
1514 _Inout_ PACL Acl,
1515 _In_ ULONG AceIndex);
1516
1517 NTSYSAPI
1518 NTSTATUS
1519 NTAPI
1520 RtlGetAce(
1521 _In_ PACL Acl,
1522 _In_ ULONG AceIndex,
1523 _Outptr_ PVOID *Ace);
1524
1525 _IRQL_requires_max_(APC_LEVEL)
1526 NTSYSAPI
1527 NTSTATUS
1528 NTAPI
1529 RtlAddAccessAllowedAce(
1530 _Inout_ PACL Acl,
1531 _In_ ULONG AceRevision,
1532 _In_ ACCESS_MASK AccessMask,
1533 _In_ PSID Sid);
1534
1535 _IRQL_requires_max_(APC_LEVEL)
1536 NTSYSAPI
1537 NTSTATUS
1538 NTAPI
1539 RtlAddAccessAllowedAceEx(
1540 _Inout_ PACL Acl,
1541 _In_ ULONG AceRevision,
1542 _In_ ULONG AceFlags,
1543 _In_ ACCESS_MASK AccessMask,
1544 _In_ PSID Sid);
1545
1546 _IRQL_requires_max_(APC_LEVEL)
1547 NTSYSAPI
1548 NTSTATUS
1549 NTAPI
1550 RtlCreateSecurityDescriptorRelative(
1551 _Out_ PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
1552 _In_ ULONG Revision);
1553
1554 NTSYSAPI
1555 NTSTATUS
1556 NTAPI
1557 RtlGetDaclSecurityDescriptor(
1558 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1559 _Out_ PBOOLEAN DaclPresent,
1560 _Out_ PACL *Dacl,
1561 _Out_ PBOOLEAN DaclDefaulted);
1562
1563 _IRQL_requires_max_(APC_LEVEL)
1564 NTSYSAPI
1565 NTSTATUS
1566 NTAPI
1567 RtlSetOwnerSecurityDescriptor(
1568 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1569 _In_opt_ PSID Owner,
1570 _In_opt_ BOOLEAN OwnerDefaulted);
1571
1572 _IRQL_requires_max_(APC_LEVEL)
1573 NTSYSAPI
1574 NTSTATUS
1575 NTAPI
1576 RtlGetOwnerSecurityDescriptor(
1577 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1578 _Out_ PSID *Owner,
1579 _Out_ PBOOLEAN OwnerDefaulted);
1580
1581 _IRQL_requires_max_(APC_LEVEL)
1582 _When_(Status < 0, _Out_range_(>, 0))
1583 _When_(Status >= 0, _Out_range_(==, 0))
1584 NTSYSAPI
1585 ULONG
1586 NTAPI
1587 RtlNtStatusToDosError(
1588 _In_ NTSTATUS Status);
1589
1590 _IRQL_requires_max_(PASSIVE_LEVEL)
1591 NTSYSAPI
1592 NTSTATUS
1593 NTAPI
1594 RtlCustomCPToUnicodeN(
1595 _In_ PCPTABLEINFO CustomCP,
1596 _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString,
1597 _In_ ULONG MaxBytesInUnicodeString,
1598 _Out_opt_ PULONG BytesInUnicodeString,
1599 _In_reads_bytes_(BytesInCustomCPString) PCH CustomCPString,
1600 _In_ ULONG BytesInCustomCPString);
1601
1602 _IRQL_requires_max_(PASSIVE_LEVEL)
1603 NTSYSAPI
1604 NTSTATUS
1605 NTAPI
1606 RtlUnicodeToCustomCPN(
1607 _In_ PCPTABLEINFO CustomCP,
1608 _Out_writes_bytes_to_(MaxBytesInCustomCPString, *BytesInCustomCPString) PCH CustomCPString,
1609 _In_ ULONG MaxBytesInCustomCPString,
1610 _Out_opt_ PULONG BytesInCustomCPString,
1611 _In_reads_bytes_(BytesInUnicodeString) PWCH UnicodeString,
1612 _In_ ULONG BytesInUnicodeString);
1613
1614 _IRQL_requires_max_(PASSIVE_LEVEL)
1615 NTSYSAPI
1616 NTSTATUS
1617 NTAPI
1618 RtlUpcaseUnicodeToCustomCPN(
1619 _In_ PCPTABLEINFO CustomCP,
1620 _Out_writes_bytes_to_(MaxBytesInCustomCPString, *BytesInCustomCPString) PCH CustomCPString,
1621 _In_ ULONG MaxBytesInCustomCPString,
1622 _Out_opt_ PULONG BytesInCustomCPString,
1623 _In_reads_bytes_(BytesInUnicodeString) PWCH UnicodeString,
1624 _In_ ULONG BytesInUnicodeString);
1625
1626 _IRQL_requires_max_(PASSIVE_LEVEL)
1627 NTSYSAPI
1628 VOID
1629 NTAPI
1630 RtlInitCodePageTable(
1631 _In_ PUSHORT TableBase,
1632 _Out_ PCPTABLEINFO CodePageTable);
1633
1634
1635 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
1636
1637
1638 #if (NTDDI_VERSION >= NTDDI_WINXP)
1639
1640
1641
1642 _Must_inspect_result_
1643 NTSYSAPI
1644 PVOID
1645 NTAPI
1646 RtlCreateHeap(
1647 _In_ ULONG Flags,
1648 _In_opt_ PVOID HeapBase,
1649 _In_opt_ SIZE_T ReserveSize,
1650 _In_opt_ SIZE_T CommitSize,
1651 _In_opt_ PVOID Lock,
1652 _In_opt_ PRTL_HEAP_PARAMETERS Parameters);
1653
1654 NTSYSAPI
1655 PVOID
1656 NTAPI
1657 RtlDestroyHeap(
1658 _In_ _Post_invalid_ PVOID HeapHandle);
1659
1660 NTSYSAPI
1661 USHORT
1662 NTAPI
1663 RtlCaptureStackBackTrace(
1664 _In_ ULONG FramesToSkip,
1665 _In_ ULONG FramesToCapture,
1666 _Out_writes_to_(FramesToCapture, return) PVOID *BackTrace,
1667 _Out_opt_ PULONG BackTraceHash);
1668
1669 _Ret_range_(<, MAXLONG)
1670 NTSYSAPI
1671 ULONG
1672 NTAPI
1673 RtlRandomEx(
1674 _Inout_ PULONG Seed);
1675
1676 _IRQL_requires_max_(DISPATCH_LEVEL)
1677 NTSYSAPI
1678 NTSTATUS
1679 NTAPI
1680 RtlInitUnicodeStringEx(
1681 _Out_ PUNICODE_STRING DestinationString,
1682 _In_opt_z_ __drv_aliasesMem PCWSTR SourceString);
1683
1684 _Must_inspect_result_
1685 NTSYSAPI
1686 NTSTATUS
1687 NTAPI
1688 RtlValidateUnicodeString(
1689 _In_ ULONG Flags,
1690 _In_ PCUNICODE_STRING String);
1691
1692 _IRQL_requires_max_(PASSIVE_LEVEL)
1693 _Must_inspect_result_
1694 NTSYSAPI
1695 NTSTATUS
1696 NTAPI
1697 RtlDuplicateUnicodeString(
1698 _In_ ULONG Flags,
1699 _In_ PCUNICODE_STRING SourceString,
1700 _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)) PUNICODE_STRING DestinationString);
1701
1702 NTSYSAPI
1703 NTSTATUS
1704 NTAPI
1705 RtlGetCompressionWorkSpaceSize(
1706 _In_ USHORT CompressionFormatAndEngine,
1707 _Out_ PULONG CompressBufferWorkSpaceSize,
1708 _Out_ PULONG CompressFragmentWorkSpaceSize);
1709
1710 NTSYSAPI
1711 NTSTATUS
1712 NTAPI
1713 RtlCompressBuffer(
1714 _In_ USHORT CompressionFormatAndEngine,
1715 _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
1716 _In_ ULONG UncompressedBufferSize,
1717 _Out_writes_bytes_to_(CompressedBufferSize, *FinalCompressedSize) PUCHAR CompressedBuffer,
1718 _In_ ULONG CompressedBufferSize,
1719 _In_ ULONG UncompressedChunkSize,
1720 _Out_ PULONG FinalCompressedSize,
1721 _In_ PVOID WorkSpace);
1722
1723 _IRQL_requires_max_(APC_LEVEL)
1724 NTSYSAPI
1725 NTSTATUS
1726 NTAPI
1727 RtlDecompressBuffer(
1728 _In_ USHORT CompressionFormat,
1729 _Out_writes_bytes_to_(UncompressedBufferSize, *FinalUncompressedSize) PUCHAR UncompressedBuffer,
1730 _In_ ULONG UncompressedBufferSize,
1731 _In_reads_bytes_(CompressedBufferSize) PUCHAR CompressedBuffer,
1732 _In_ ULONG CompressedBufferSize,
1733 _Out_ PULONG FinalUncompressedSize);
1734
1735 _IRQL_requires_max_(APC_LEVEL)
1736 NTSYSAPI
1737 NTSTATUS
1738 NTAPI
1739 RtlDecompressFragment(
1740 _In_ USHORT CompressionFormat,
1741 _Out_writes_bytes_to_(UncompressedFragmentSize, *FinalUncompressedSize) PUCHAR UncompressedFragment,
1742 _In_ ULONG UncompressedFragmentSize,
1743 _In_reads_bytes_(CompressedBufferSize) PUCHAR CompressedBuffer,
1744 _In_ ULONG CompressedBufferSize,
1745 _In_range_(<, CompressedBufferSize) ULONG FragmentOffset,
1746 _Out_ PULONG FinalUncompressedSize,
1747 _In_ PVOID WorkSpace);
1748
1749 _IRQL_requires_max_(APC_LEVEL)
1750 NTSYSAPI
1751 NTSTATUS
1752 NTAPI
1753 RtlDescribeChunk(
1754 _In_ USHORT CompressionFormat,
1755 _Inout_ PUCHAR *CompressedBuffer,
1756 _In_ PUCHAR EndOfCompressedBufferPlus1,
1757 _Out_ PUCHAR *ChunkBuffer,
1758 _Out_ PULONG ChunkSize);
1759
1760 _IRQL_requires_max_(APC_LEVEL)
1761 NTSYSAPI
1762 NTSTATUS
1763 NTAPI
1764 RtlReserveChunk(
1765 _In_ USHORT CompressionFormat,
1766 _Inout_ PUCHAR *CompressedBuffer,
1767 _In_ PUCHAR EndOfCompressedBufferPlus1,
1768 _Out_ PUCHAR *ChunkBuffer,
1769 _In_ ULONG ChunkSize);
1770
1771 _IRQL_requires_max_(APC_LEVEL)
1772 NTSYSAPI
1773 NTSTATUS
1774 NTAPI
1775 RtlDecompressChunks(
1776 _Out_writes_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
1777 _In_ ULONG UncompressedBufferSize,
1778 _In_reads_bytes_(CompressedBufferSize) PUCHAR CompressedBuffer,
1779 _In_ ULONG CompressedBufferSize,
1780 _In_reads_bytes_(CompressedTailSize) PUCHAR CompressedTail,
1781 _In_ ULONG CompressedTailSize,
1782 _In_ PCOMPRESSED_DATA_INFO CompressedDataInfo);
1783
1784 _IRQL_requires_max_(APC_LEVEL)
1785 NTSYSAPI
1786 NTSTATUS
1787 NTAPI
1788 RtlCompressChunks(
1789 _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
1790 _In_ ULONG UncompressedBufferSize,
1791 _Out_writes_bytes_(CompressedBufferSize) PUCHAR CompressedBuffer,
1792 _In_range_(>=, (UncompressedBufferSize - (UncompressedBufferSize / 16))) ULONG CompressedBufferSize,
1793 _Inout_updates_bytes_(CompressedDataInfoLength) PCOMPRESSED_DATA_INFO CompressedDataInfo,
1794 _In_range_(>, sizeof(COMPRESSED_DATA_INFO)) ULONG CompressedDataInfoLength,
1795 _In_ PVOID WorkSpace);
1796
1797 _IRQL_requires_max_(APC_LEVEL)
1798 NTSYSAPI
1799 PSID_IDENTIFIER_AUTHORITY
1800 NTAPI
1801 RtlIdentifierAuthoritySid(
1802 _In_ PSID Sid);
1803
1804 NTSYSAPI
1805 PUCHAR
1806 NTAPI
1807 RtlSubAuthorityCountSid(
1808 _In_ PSID Sid);
1809
1810 _When_(Status < 0, _Out_range_(>, 0))
1811 _When_(Status >= 0, _Out_range_(==, 0))
1812 NTSYSAPI
1813 ULONG
1814 NTAPI
1815 RtlNtStatusToDosErrorNoTeb(
1816 _In_ NTSTATUS Status);
1817
1818 _IRQL_requires_max_(PASSIVE_LEVEL)
1819 NTSYSAPI
1820 NTSTATUS
1821 NTAPI
1822 RtlCreateSystemVolumeInformationFolder(
1823 _In_ PCUNICODE_STRING VolumeRootPath);
1824
1825 #if defined(_M_AMD64)
1826
1827 FORCEINLINE
1828 VOID
1829 RtlFillMemoryUlong(
1830 _Out_writes_bytes_all_(Length) PVOID Destination,
1831 _In_ SIZE_T Length,
1832 _In_ ULONG Pattern)
1833 {
1834 PULONG Address = (PULONG)Destination;
1835 if ((Length /= 4) != 0) {
1836 if (((ULONG64)Address & 4) != 0) {
1837 *Address = Pattern;
1838 if ((Length -= 1) == 0) {
1839 return;
1840 }
1841 Address += 1;
1842 }
1843 __stosq((PULONG64)(Address), Pattern | ((ULONG64)Pattern << 32), Length / 2);
1844 if ((Length & 1) != 0) Address[Length - 1] = Pattern;
1845 }
1846 return;
1847 }
1848
1849 #define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
1850 __stosq((PULONG64)(Destination), Pattern, (Length) / 8)
1851
1852 #else
1853
1854 NTSYSAPI
1855 VOID
1856 NTAPI
1857 RtlFillMemoryUlong(
1858 OUT PVOID Destination,
1859 IN SIZE_T Length,
1860 IN ULONG Pattern);
1861
1862 NTSYSAPI
1863 VOID
1864 NTAPI
1865 RtlFillMemoryUlonglong(
1866 _Out_writes_bytes_all_(Length) PVOID Destination,
1867 _In_ SIZE_T Length,
1868 _In_ ULONGLONG Pattern);
1869
1870 #endif /* defined(_M_AMD64) */
1871
1872 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
1873
1874 #if (NTDDI_VERSION >= NTDDI_WS03)
1875 _IRQL_requires_max_(DISPATCH_LEVEL)
1876 NTSYSAPI
1877 NTSTATUS
1878 NTAPI
1879 RtlInitAnsiStringEx(
1880 _Out_ PANSI_STRING DestinationString,
1881 _In_opt_z_ __drv_aliasesMem PCSZ SourceString);
1882 #endif
1883
1884 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
1885
1886 _IRQL_requires_max_(APC_LEVEL)
1887 NTSYSAPI
1888 NTSTATUS
1889 NTAPI
1890 RtlGetSaclSecurityDescriptor(
1891 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1892 _Out_ PBOOLEAN SaclPresent,
1893 _Out_ PACL *Sacl,
1894 _Out_ PBOOLEAN SaclDefaulted);
1895
1896 _IRQL_requires_max_(APC_LEVEL)
1897 NTSYSAPI
1898 NTSTATUS
1899 NTAPI
1900 RtlSetGroupSecurityDescriptor(
1901 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1902 _In_opt_ PSID Group,
1903 _In_opt_ BOOLEAN GroupDefaulted);
1904
1905 _IRQL_requires_max_(APC_LEVEL)
1906 NTSYSAPI
1907 NTSTATUS
1908 NTAPI
1909 RtlGetGroupSecurityDescriptor(
1910 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1911 _Out_ PSID *Group,
1912 _Out_ PBOOLEAN GroupDefaulted);
1913
1914 _IRQL_requires_max_(APC_LEVEL)
1915 NTSYSAPI
1916 NTSTATUS
1917 NTAPI
1918 RtlAbsoluteToSelfRelativeSD(
1919 _In_ PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
1920 _Out_writes_bytes_to_opt_(*BufferLength, *BufferLength) PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
1921 _Inout_ PULONG BufferLength);
1922
1923 _IRQL_requires_max_(APC_LEVEL)
1924 NTSYSAPI
1925 NTSTATUS
1926 NTAPI
1927 RtlSelfRelativeToAbsoluteSD(
1928 _In_ PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
1929 _Out_writes_bytes_to_opt_(*AbsoluteSecurityDescriptorSize, *AbsoluteSecurityDescriptorSize) PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
1930 _Inout_ PULONG AbsoluteSecurityDescriptorSize,
1931 _Out_writes_bytes_to_opt_(*DaclSize, *DaclSize) PACL Dacl,
1932 _Inout_ PULONG DaclSize,
1933 _Out_writes_bytes_to_opt_(*SaclSize, *SaclSize) PACL Sacl,
1934 _Inout_ PULONG SaclSize,
1935 _Out_writes_bytes_to_opt_(*OwnerSize, *OwnerSize) PSID Owner,
1936 _Inout_ PULONG OwnerSize,
1937 _Out_writes_bytes_to_opt_(*PrimaryGroupSize, *PrimaryGroupSize) PSID PrimaryGroup,
1938 _Inout_ PULONG PrimaryGroupSize);
1939
1940 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */
1941
1942 #if (NTDDI_VERSION >= NTDDI_VISTA)
1943
1944 NTSYSAPI
1945 NTSTATUS
1946 NTAPI
1947 RtlNormalizeString(
1948 _In_ ULONG NormForm,
1949 _In_ PCWSTR SourceString,
1950 _In_ LONG SourceStringLength,
1951 _Out_writes_to_(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString,
1952 _Inout_ PLONG DestinationStringLength);
1953
1954 NTSYSAPI
1955 NTSTATUS
1956 NTAPI
1957 RtlIsNormalizedString(
1958 _In_ ULONG NormForm,
1959 _In_ PCWSTR SourceString,
1960 _In_ LONG SourceStringLength,
1961 _Out_ PBOOLEAN Normalized);
1962
1963 NTSYSAPI
1964 NTSTATUS
1965 NTAPI
1966 RtlIdnToAscii(
1967 _In_ ULONG Flags,
1968 _In_ PCWSTR SourceString,
1969 _In_ LONG SourceStringLength,
1970 _Out_writes_to_(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString,
1971 _Inout_ PLONG DestinationStringLength);
1972
1973 NTSYSAPI
1974 NTSTATUS
1975 NTAPI
1976 RtlIdnToUnicode(
1977 IN ULONG Flags,
1978 IN PCWSTR SourceString,
1979 IN LONG SourceStringLength,
1980 OUT PWSTR DestinationString,
1981 IN OUT PLONG DestinationStringLength);
1982
1983 NTSYSAPI
1984 NTSTATUS
1985 NTAPI
1986 RtlIdnToNameprepUnicode(
1987 _In_ ULONG Flags,
1988 _In_ PCWSTR SourceString,
1989 _In_ LONG SourceStringLength,
1990 _Out_writes_to_(*DestinationStringLength, *DestinationStringLength) PWSTR DestinationString,
1991 _Inout_ PLONG DestinationStringLength);
1992
1993 NTSYSAPI
1994 NTSTATUS
1995 NTAPI
1996 RtlCreateServiceSid(
1997 _In_ PUNICODE_STRING ServiceName,
1998 _Out_writes_bytes_opt_(*ServiceSidLength) PSID ServiceSid,
1999 _Inout_ PULONG ServiceSidLength);
2000
2001 NTSYSAPI
2002 LONG
2003 NTAPI
2004 RtlCompareAltitudes(
2005 _In_ PCUNICODE_STRING Altitude1,
2006 _In_ PCUNICODE_STRING Altitude2);
2007
2008
2009 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
2010
2011 #if (NTDDI_VERSION >= NTDDI_WIN7)
2012
2013 _IRQL_requires_max_(PASSIVE_LEVEL)
2014 _Must_inspect_result_
2015 NTSYSAPI
2016 NTSTATUS
2017 NTAPI
2018 RtlUnicodeToUTF8N(
2019 _Out_writes_bytes_to_(UTF8StringMaxByteCount, *UTF8StringActualByteCount) PCHAR UTF8StringDestination,
2020 _In_ ULONG UTF8StringMaxByteCount,
2021 _Out_ PULONG UTF8StringActualByteCount,
2022 _In_reads_bytes_(UnicodeStringByteCount) PCWCH UnicodeStringSource,
2023 _In_ ULONG UnicodeStringByteCount);
2024
2025 _IRQL_requires_max_(PASSIVE_LEVEL)
2026 _Must_inspect_result_
2027 NTSYSAPI
2028 NTSTATUS
2029 NTAPI
2030 RtlUTF8ToUnicodeN(
2031 _Out_writes_bytes_to_(UnicodeStringMaxByteCount, *UnicodeStringActualByteCount) PWSTR UnicodeStringDestination,
2032 _In_ ULONG UnicodeStringMaxByteCount,
2033 _Out_ PULONG UnicodeStringActualByteCount,
2034 _In_reads_bytes_(UTF8StringByteCount) PCCH UTF8StringSource,
2035 _In_ ULONG UTF8StringByteCount);
2036
2037 _IRQL_requires_max_(APC_LEVEL)
2038 NTSYSAPI
2039 NTSTATUS
2040 NTAPI
2041 RtlReplaceSidInSd(
2042 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2043 _In_ PSID OldSid,
2044 _In_ PSID NewSid,
2045 _Out_ ULONG *NumChanges);
2046
2047 NTSYSAPI
2048 NTSTATUS
2049 NTAPI
2050 RtlCreateVirtualAccountSid(
2051 _In_ PCUNICODE_STRING Name,
2052 _In_ ULONG BaseSubAuthority,
2053 _Out_writes_bytes_(*SidLength) PSID Sid,
2054 _Inout_ PULONG SidLength);
2055
2056 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
2057
2058
2059 #if defined(_AMD64_) || defined(_IA64_)
2060
2061
2062
2063 #endif /* defined(_AMD64_) || defined(_IA64_) */
2064
2065
2066
2067 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
2068 #define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
2069
2070 #define RtlUnicodeStringToOemSize(STRING) (NLS_MB_OEM_CODE_PAGE_TAG ? \
2071 RtlxUnicodeStringToOemSize(STRING) : \
2072 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
2073 )
2074
2075 #define RtlOemStringToUnicodeSize(STRING) ( \
2076 NLS_MB_OEM_CODE_PAGE_TAG ? \
2077 RtlxOemStringToUnicodeSize(STRING) : \
2078 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2079 )
2080
2081 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
2082 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
2083 )
2084
2085 #define RtlOffsetToPointer(B,O) ((PCHAR)(((PCHAR)(B)) + ((ULONG_PTR)(O))))
2086 #define RtlPointerToOffset(B,P) ((ULONG)(((PCHAR)(P)) - ((PCHAR)(B))))
2087
2088 _IRQL_requires_max_(PASSIVE_LEVEL)
2089 __kernel_entry
2090 NTSYSCALLAPI
2091 NTSTATUS
2092 NTAPI
2093 NtQueryObject(
2094 _In_opt_ HANDLE Handle,
2095 _In_ OBJECT_INFORMATION_CLASS ObjectInformationClass,
2096 _Out_writes_bytes_opt_(ObjectInformationLength) PVOID ObjectInformation,
2097 _In_ ULONG ObjectInformationLength,
2098 _Out_opt_ PULONG ReturnLength);
2099
2100 #if (NTDDI_VERSION >= NTDDI_WIN2K)
2101
2102 _Must_inspect_result_
2103 __kernel_entry
2104 NTSYSCALLAPI
2105 NTSTATUS
2106 NTAPI
2107 NtOpenThreadToken(
2108 _In_ HANDLE ThreadHandle,
2109 _In_ ACCESS_MASK DesiredAccess,
2110 _In_ BOOLEAN OpenAsSelf,
2111 _Out_ PHANDLE TokenHandle);
2112
2113 _Must_inspect_result_
2114 __kernel_entry
2115 NTSYSCALLAPI
2116 NTSTATUS
2117 NTAPI
2118 NtOpenProcessToken(
2119 _In_ HANDLE ProcessHandle,
2120 _In_ ACCESS_MASK DesiredAccess,
2121 _Out_ PHANDLE TokenHandle);
2122
2123 _When_(TokenInformationClass == TokenAccessInformation,
2124 _At_(TokenInformationLength,
2125 _In_range_(>=, sizeof(TOKEN_ACCESS_INFORMATION))))
2126 _Must_inspect_result_
2127 __kernel_entry
2128 NTSYSCALLAPI
2129 NTSTATUS
2130 NTAPI
2131 NtQueryInformationToken(
2132 _In_ HANDLE TokenHandle,
2133 _In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
2134 _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation,
2135 _In_ ULONG TokenInformationLength,
2136 _Out_ PULONG ReturnLength);
2137
2138 _Must_inspect_result_
2139 __kernel_entry
2140 NTSYSCALLAPI
2141 NTSTATUS
2142 NTAPI
2143 NtAdjustPrivilegesToken(
2144 _In_ HANDLE TokenHandle,
2145 _In_ BOOLEAN DisableAllPrivileges,
2146 _In_opt_ PTOKEN_PRIVILEGES NewState,
2147 _In_ ULONG BufferLength,
2148 _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState,
2149 _When_(PreviousState != NULL, _Out_) PULONG ReturnLength);
2150
2151 __kernel_entry
2152 NTSYSCALLAPI
2153 NTSTATUS
2154 NTAPI
2155 NtCreateFile(
2156 _Out_ PHANDLE FileHandle,
2157 _In_ ACCESS_MASK DesiredAccess,
2158 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
2159 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2160 _In_opt_ PLARGE_INTEGER AllocationSize,
2161 _In_ ULONG FileAttributes,
2162 _In_ ULONG ShareAccess,
2163 _In_ ULONG CreateDisposition,
2164 _In_ ULONG CreateOptions,
2165 _In_reads_bytes_opt_(EaLength) PVOID EaBuffer,
2166 _In_ ULONG EaLength);
2167
2168 __kernel_entry
2169 NTSYSCALLAPI
2170 NTSTATUS
2171 NTAPI
2172 NtDeviceIoControlFile(
2173 _In_ HANDLE FileHandle,
2174 _In_opt_ HANDLE Event,
2175 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2176 _In_opt_ PVOID ApcContext,
2177 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2178 _In_ ULONG IoControlCode,
2179 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
2180 _In_ ULONG InputBufferLength,
2181 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
2182 _In_ ULONG OutputBufferLength);
2183
2184 __kernel_entry
2185 NTSYSCALLAPI
2186 NTSTATUS
2187 NTAPI
2188 NtFsControlFile(
2189 _In_ HANDLE FileHandle,
2190 _In_opt_ HANDLE Event,
2191 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2192 _In_opt_ PVOID ApcContext,
2193 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2194 _In_ ULONG FsControlCode,
2195 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
2196 _In_ ULONG InputBufferLength,
2197 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
2198 _In_ ULONG OutputBufferLength);
2199
2200 __kernel_entry
2201 NTSYSCALLAPI
2202 NTSTATUS
2203 NTAPI
2204 NtLockFile(
2205 _In_ HANDLE FileHandle,
2206 _In_opt_ HANDLE Event,
2207 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2208 _In_opt_ PVOID ApcContext,
2209 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2210 _In_ PLARGE_INTEGER ByteOffset,
2211 _In_ PLARGE_INTEGER Length,
2212 _In_ ULONG Key,
2213 _In_ BOOLEAN FailImmediately,
2214 _In_ BOOLEAN ExclusiveLock);
2215
2216 __kernel_entry
2217 NTSYSCALLAPI
2218 NTSTATUS
2219 NTAPI
2220 NtOpenFile(
2221 _Out_ PHANDLE FileHandle,
2222 _In_ ACCESS_MASK DesiredAccess,
2223 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
2224 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2225 _In_ ULONG ShareAccess,
2226 _In_ ULONG OpenOptions);
2227
2228 __kernel_entry
2229 NTSYSCALLAPI
2230 NTSTATUS
2231 NTAPI
2232 NtQueryDirectoryFile(
2233 _In_ HANDLE FileHandle,
2234 _In_opt_ HANDLE Event,
2235 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2236 _In_opt_ PVOID ApcContext,
2237 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2238 _Out_writes_bytes_(Length) PVOID FileInformation,
2239 _In_ ULONG Length,
2240 _In_ FILE_INFORMATION_CLASS FileInformationClass,
2241 _In_ BOOLEAN ReturnSingleEntry,
2242 _In_opt_ PUNICODE_STRING FileName,
2243 _In_ BOOLEAN RestartScan);
2244
2245 __kernel_entry
2246 NTSYSCALLAPI
2247 NTSTATUS
2248 NTAPI
2249 NtQueryInformationFile(
2250 _In_ HANDLE FileHandle,
2251 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2252 _Out_writes_bytes_(Length) PVOID FileInformation,
2253 _In_ ULONG Length,
2254 _In_ FILE_INFORMATION_CLASS FileInformationClass);
2255
2256 __kernel_entry
2257 NTSYSCALLAPI
2258 NTSTATUS
2259 NTAPI
2260 NtQueryQuotaInformationFile(
2261 _In_ HANDLE FileHandle,
2262 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2263 _Out_writes_bytes_(Length) PVOID Buffer,
2264 _In_ ULONG Length,
2265 _In_ BOOLEAN ReturnSingleEntry,
2266 _In_reads_bytes_opt_(SidListLength) PVOID SidList,
2267 _In_ ULONG SidListLength,
2268 _In_reads_bytes_opt_((8 + (4 * ((SID *)StartSid)->SubAuthorityCount))) PSID StartSid,
2269 _In_ BOOLEAN RestartScan);
2270
2271 __kernel_entry
2272 NTSYSCALLAPI
2273 NTSTATUS
2274 NTAPI
2275 NtQueryVolumeInformationFile(
2276 _In_ HANDLE FileHandle,
2277 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2278 _Out_writes_bytes_(Length) PVOID FsInformation,
2279 _In_ ULONG Length,
2280 _In_ FS_INFORMATION_CLASS FsInformationClass);
2281
2282 __kernel_entry
2283 NTSYSCALLAPI
2284 NTSTATUS
2285 NTAPI
2286 NtReadFile(
2287 _In_ HANDLE FileHandle,
2288 _In_opt_ HANDLE Event,
2289 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2290 _In_opt_ PVOID ApcContext,
2291 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2292 _Out_writes_bytes_(Length) PVOID Buffer,
2293 _In_ ULONG Length,
2294 _In_opt_ PLARGE_INTEGER ByteOffset,
2295 _In_opt_ PULONG Key);
2296
2297 __kernel_entry
2298 NTSYSCALLAPI
2299 NTSTATUS
2300 NTAPI
2301 NtSetInformationFile(
2302 _In_ HANDLE FileHandle,
2303 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2304 _In_reads_bytes_(Length) PVOID FileInformation,
2305 _In_ ULONG Length,
2306 _In_ FILE_INFORMATION_CLASS FileInformationClass);
2307
2308 __kernel_entry
2309 NTSYSCALLAPI
2310 NTSTATUS
2311 NTAPI
2312 NtSetQuotaInformationFile(
2313 _In_ HANDLE FileHandle,
2314 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2315 _In_reads_bytes_(Length) PVOID Buffer,
2316 _In_ ULONG Length);
2317
2318 __kernel_entry
2319 NTSYSCALLAPI
2320 NTSTATUS
2321 NTAPI
2322 NtSetVolumeInformationFile(
2323 _In_ HANDLE FileHandle,
2324 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2325 _In_reads_bytes_(Length) PVOID FsInformation,
2326 _In_ ULONG Length,
2327 _In_ FS_INFORMATION_CLASS FsInformationClass);
2328
2329 __kernel_entry
2330 NTSYSCALLAPI
2331 NTSTATUS
2332 NTAPI
2333 NtWriteFile(
2334 _In_ HANDLE FileHandle,
2335 _In_opt_ HANDLE Event,
2336 _In_opt_ PIO_APC_ROUTINE ApcRoutine,
2337 _In_opt_ PVOID ApcContext,
2338 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2339 _In_reads_bytes_(Length) PVOID Buffer,
2340 _In_ ULONG Length,
2341 _In_opt_ PLARGE_INTEGER ByteOffset,
2342 _In_opt_ PULONG Key);
2343
2344 __kernel_entry
2345 NTSYSCALLAPI
2346 NTSTATUS
2347 NTAPI
2348 NtUnlockFile(
2349 _In_ HANDLE FileHandle,
2350 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2351 _In_ PLARGE_INTEGER ByteOffset,
2352 _In_ PLARGE_INTEGER Length,
2353 _In_ ULONG Key);
2354
2355 _IRQL_requires_max_(PASSIVE_LEVEL)
2356 __kernel_entry
2357 NTSYSCALLAPI
2358 NTSTATUS
2359 NTAPI
2360 NtSetSecurityObject(
2361 _In_ HANDLE Handle,
2362 _In_ SECURITY_INFORMATION SecurityInformation,
2363 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor);
2364
2365 _IRQL_requires_max_(PASSIVE_LEVEL)
2366 __kernel_entry
2367 NTSYSCALLAPI
2368 NTSTATUS
2369 NTAPI
2370 NtQuerySecurityObject(
2371 _In_ HANDLE Handle,
2372 _In_ SECURITY_INFORMATION SecurityInformation,
2373 _Out_writes_bytes_opt_(Length) PSECURITY_DESCRIPTOR SecurityDescriptor,
2374 _In_ ULONG Length,
2375 _Out_ PULONG LengthNeeded);
2376
2377 _IRQL_requires_max_(PASSIVE_LEVEL)
2378 __kernel_entry
2379 NTSYSCALLAPI
2380 NTSTATUS
2381 NTAPI
2382 NtClose(
2383 _In_ HANDLE Handle);
2384
2385 #endif
2386
2387 #if (NTDDI_VERSION >= NTDDI_WINXP)
2388
2389 _Must_inspect_result_
2390 __kernel_entry
2391 NTSYSCALLAPI
2392 NTSTATUS
2393 NTAPI
2394 NtOpenThreadTokenEx(
2395 _In_ HANDLE ThreadHandle,
2396 _In_ ACCESS_MASK DesiredAccess,
2397 _In_ BOOLEAN OpenAsSelf,
2398 _In_ ULONG HandleAttributes,
2399 _Out_ PHANDLE TokenHandle);
2400
2401 _Must_inspect_result_
2402 __kernel_entry
2403 NTSYSCALLAPI
2404 NTSTATUS
2405 NTAPI
2406 NtOpenProcessTokenEx(
2407 _In_ HANDLE ProcessHandle,
2408 _In_ ACCESS_MASK DesiredAccess,
2409 _In_ ULONG HandleAttributes,
2410 _Out_ PHANDLE TokenHandle);
2411
2412 _Must_inspect_result_
2413 NTSYSAPI
2414 NTSTATUS
2415 NTAPI
2416 NtOpenJobObjectToken(
2417 _In_ HANDLE JobHandle,
2418 _In_ ACCESS_MASK DesiredAccess,
2419 _Out_ PHANDLE TokenHandle);
2420
2421 _Must_inspect_result_
2422 __kernel_entry
2423 NTSYSCALLAPI
2424 NTSTATUS
2425 NTAPI
2426 NtDuplicateToken(
2427 _In_ HANDLE ExistingTokenHandle,
2428 _In_ ACCESS_MASK DesiredAccess,
2429 _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
2430 _In_ BOOLEAN EffectiveOnly,
2431 _In_ TOKEN_TYPE TokenType,
2432 _Out_ PHANDLE NewTokenHandle);
2433
2434 _Must_inspect_result_
2435 __kernel_entry
2436 NTSYSCALLAPI
2437 NTSTATUS
2438 NTAPI
2439 NtFilterToken(
2440 _In_ HANDLE ExistingTokenHandle,
2441 _In_ ULONG Flags,
2442 _In_opt_ PTOKEN_GROUPS SidsToDisable,
2443 _In_opt_ PTOKEN_PRIVILEGES PrivilegesToDelete,
2444 _In_opt_ PTOKEN_GROUPS RestrictedSids,
2445 _Out_ PHANDLE NewTokenHandle);
2446
2447 _Must_inspect_result_
2448 __kernel_entry
2449 NTSYSCALLAPI
2450 NTSTATUS
2451 NTAPI
2452 NtImpersonateAnonymousToken(
2453 _In_ HANDLE ThreadHandle);
2454
2455 _Must_inspect_result_
2456 __kernel_entry
2457 NTSYSCALLAPI
2458 NTSTATUS
2459 NTAPI
2460 NtSetInformationToken(
2461 _In_ HANDLE TokenHandle,
2462 _In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
2463 _In_reads_bytes_(TokenInformationLength) PVOID TokenInformation,
2464 _In_ ULONG TokenInformationLength);
2465
2466 _Must_inspect_result_
2467 __kernel_entry
2468 NTSYSCALLAPI
2469 NTSTATUS
2470 NTAPI
2471 NtAdjustGroupsToken(
2472 _In_ HANDLE TokenHandle,
2473 _In_ BOOLEAN ResetToDefault,
2474 _In_opt_ PTOKEN_GROUPS NewState,
2475 _In_opt_ ULONG BufferLength,
2476 _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_GROUPS PreviousState,
2477 _Out_ PULONG ReturnLength);
2478
2479 _Must_inspect_result_
2480 __kernel_entry
2481 NTSYSCALLAPI
2482 NTSTATUS
2483 NTAPI
2484 NtPrivilegeCheck(
2485 _In_ HANDLE ClientToken,
2486 _Inout_ PPRIVILEGE_SET RequiredPrivileges,
2487 _Out_ PBOOLEAN Result);
2488
2489 _Must_inspect_result_
2490 __kernel_entry
2491 NTSYSCALLAPI
2492 NTSTATUS
2493 NTAPI
2494 NtAccessCheckAndAuditAlarm(
2495 _In_ PUNICODE_STRING SubsystemName,
2496 _In_opt_ PVOID HandleId,
2497 _In_ PUNICODE_STRING ObjectTypeName,
2498 _In_ PUNICODE_STRING ObjectName,
2499 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2500 _In_ ACCESS_MASK DesiredAccess,
2501 _In_ PGENERIC_MAPPING GenericMapping,
2502 _In_ BOOLEAN ObjectCreation,
2503 _Out_ PACCESS_MASK GrantedAccess,
2504 _Out_ PNTSTATUS AccessStatus,
2505 _Out_ PBOOLEAN GenerateOnClose);
2506
2507 _Must_inspect_result_
2508 __kernel_entry
2509 NTSYSCALLAPI
2510 NTSTATUS
2511 NTAPI
2512 NtAccessCheckByTypeAndAuditAlarm(
2513 _In_ PUNICODE_STRING SubsystemName,
2514 _In_opt_ PVOID HandleId,
2515 _In_ PUNICODE_STRING ObjectTypeName,
2516 _In_ PUNICODE_STRING ObjectName,
2517 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2518 _In_opt_ PSID PrincipalSelfSid,
2519 _In_ ACCESS_MASK DesiredAccess,
2520 _In_ AUDIT_EVENT_TYPE AuditType,
2521 _In_ ULONG Flags,
2522 _In_reads_opt_(ObjectTypeLength) POBJECT_TYPE_LIST ObjectTypeList,
2523 _In_ ULONG ObjectTypeLength,
2524 _In_ PGENERIC_MAPPING GenericMapping,
2525 _In_ BOOLEAN ObjectCreation,
2526 _Out_ PACCESS_MASK GrantedAccess,
2527 _Out_ PNTSTATUS AccessStatus,
2528 _Out_ PBOOLEAN GenerateOnClose);
2529
2530 _Must_inspect_result_
2531 __kernel_entry
2532 NTSYSCALLAPI
2533 NTSTATUS
2534 NTAPI
2535 NtAccessCheckByTypeResultListAndAuditAlarm(
2536 _In_ PUNICODE_STRING SubsystemName,
2537 _In_opt_ PVOID HandleId,
2538 _In_ PUNICODE_STRING ObjectTypeName,
2539 _In_ PUNICODE_STRING ObjectName,
2540 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2541 _In_opt_ PSID PrincipalSelfSid,
2542 _In_ ACCESS_MASK DesiredAccess,
2543 _In_ AUDIT_EVENT_TYPE AuditType,
2544 _In_ ULONG Flags,
2545 _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
2546 _In_ ULONG ObjectTypeListLength,
2547 _In_ PGENERIC_MAPPING GenericMapping,
2548 _In_ BOOLEAN ObjectCreation,
2549 _Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
2550 _Out_writes_(ObjectTypeListLength) PNTSTATUS AccessStatus,
2551 _Out_ PBOOLEAN GenerateOnClose);
2552
2553 _Must_inspect_result_
2554 __kernel_entry
2555 NTSYSCALLAPI
2556 NTSTATUS
2557 NTAPI
2558 NtAccessCheckByTypeResultListAndAuditAlarmByHandle(
2559 _In_ PUNICODE_STRING SubsystemName,
2560 _In_opt_ PVOID HandleId,
2561 _In_ HANDLE ClientToken,
2562 _In_ PUNICODE_STRING ObjectTypeName,
2563 _In_ PUNICODE_STRING ObjectName,
2564 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2565 _In_opt_ PSID PrincipalSelfSid,
2566 _In_ ACCESS_MASK DesiredAccess,
2567 _In_ AUDIT_EVENT_TYPE AuditType,
2568 _In_ ULONG Flags,
2569 _In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
2570 _In_ ULONG ObjectTypeListLength,
2571 _In_ PGENERIC_MAPPING GenericMapping,
2572 _In_ BOOLEAN ObjectCreation,
2573 _Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
2574 _Out_writes_(ObjectTypeListLength) PNTSTATUS AccessStatus,
2575 _Out_ PBOOLEAN GenerateOnClose);
2576
2577 __kernel_entry
2578 NTSYSCALLAPI
2579 NTSTATUS
2580 NTAPI
2581 NtOpenObjectAuditAlarm(
2582 _In_ PUNICODE_STRING SubsystemName,
2583 _In_opt_ PVOID HandleId,
2584 _In_ PUNICODE_STRING ObjectTypeName,
2585 _In_ PUNICODE_STRING ObjectName,
2586 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2587 _In_ HANDLE ClientToken,
2588 _In_ ACCESS_MASK DesiredAccess,
2589 _In_ ACCESS_MASK GrantedAccess,
2590 _In_opt_ PPRIVILEGE_SET Privileges,
2591 _In_ BOOLEAN ObjectCreation,
2592 _In_ BOOLEAN AccessGranted,
2593 _Out_ PBOOLEAN GenerateOnClose);
2594
2595 __kernel_entry
2596 NTSYSCALLAPI
2597 NTSTATUS
2598 NTAPI
2599 NtPrivilegeObjectAuditAlarm(
2600 _In_ PUNICODE_STRING SubsystemName,
2601 _In_opt_ PVOID HandleId,
2602 _In_ HANDLE ClientToken,
2603 _In_ ACCESS_MASK DesiredAccess,
2604 _In_ PPRIVILEGE_SET Privileges,
2605 _In_ BOOLEAN AccessGranted);
2606
2607 __kernel_entry
2608 NTSYSCALLAPI
2609 NTSTATUS
2610 NTAPI
2611 NtCloseObjectAuditAlarm(
2612 _In_ PUNICODE_STRING SubsystemName,
2613 _In_opt_ PVOID HandleId,
2614 _In_ BOOLEAN GenerateOnClose);
2615
2616 __kernel_entry
2617 NTSYSCALLAPI
2618 NTSTATUS
2619 NTAPI
2620 NtDeleteObjectAuditAlarm(
2621 _In_ PUNICODE_STRING SubsystemName,
2622 _In_opt_ PVOID HandleId,
2623 _In_ BOOLEAN GenerateOnClose);
2624
2625 __kernel_entry
2626 NTSYSCALLAPI
2627 NTSTATUS
2628 NTAPI
2629 NtPrivilegedServiceAuditAlarm(
2630 _In_ PUNICODE_STRING SubsystemName,
2631 _In_ PUNICODE_STRING ServiceName,
2632 _In_ HANDLE ClientToken,
2633 _In_ PPRIVILEGE_SET Privileges,
2634 _In_ BOOLEAN AccessGranted);
2635
2636 __kernel_entry
2637 NTSYSCALLAPI
2638 NTSTATUS
2639 NTAPI
2640 NtSetInformationThread(
2641 _In_ HANDLE ThreadHandle,
2642 _In_ THREADINFOCLASS ThreadInformationClass,
2643 _In_reads_bytes_(ThreadInformationLength) PVOID ThreadInformation,
2644 _In_ ULONG ThreadInformationLength);
2645
2646 _Must_inspect_result_
2647 __kernel_entry
2648 NTSYSCALLAPI
2649 NTSTATUS
2650 NTAPI
2651 NtCreateSection(
2652 _Out_ PHANDLE SectionHandle,
2653 _In_ ACCESS_MASK DesiredAccess,
2654 _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
2655 _In_opt_ PLARGE_INTEGER MaximumSize,
2656 _In_ ULONG SectionPageProtection,
2657 _In_ ULONG AllocationAttributes,
2658 _In_opt_ HANDLE FileHandle);
2659
2660 #endif
2661
2662 #define COMPRESSION_FORMAT_NONE (0x0000)
2663 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
2664 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
2665 #define COMPRESSION_ENGINE_STANDARD (0x0000)
2666 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
2667 #define COMPRESSION_ENGINE_HIBER (0x0200)
2668
2669 #define MAX_UNICODE_STACK_BUFFER_LENGTH 256
2670
2671 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
2672
2673 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2674 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2675
2676 typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
2677
2678 typedef enum _SECURITY_LOGON_TYPE {
2679 UndefinedLogonType = 0,
2680 Interactive = 2,
2681 Network,
2682 Batch,
2683 Service,
2684 Proxy,
2685 Unlock,
2686 NetworkCleartext,
2687 NewCredentials,
2688 #if (_WIN32_WINNT >= 0x0501)
2689 RemoteInteractive,
2690 CachedInteractive,
2691 #endif
2692 #if (_WIN32_WINNT >= 0x0502)
2693 CachedRemoteInteractive,
2694 CachedUnlock
2695 #endif
2696 } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
2697
2698 #ifndef _NTLSA_AUDIT_
2699 #define _NTLSA_AUDIT_
2700
2701 #ifndef GUID_DEFINED
2702 #include <guiddef.h>
2703 #endif
2704
2705 #endif /* _NTLSA_AUDIT_ */
2706
2707 _IRQL_requires_same_
2708 _IRQL_requires_max_(PASSIVE_LEVEL)
2709 NTSTATUS
2710 NTAPI
2711 LsaRegisterLogonProcess(
2712 _In_ PLSA_STRING LogonProcessName,
2713 _Out_ PHANDLE LsaHandle,
2714 _Out_ PLSA_OPERATIONAL_MODE SecurityMode);
2715
2716 _IRQL_requires_same_
2717 _IRQL_requires_max_(PASSIVE_LEVEL)
2718 NTSTATUS
2719 NTAPI
2720 LsaLogonUser(
2721 _In_ HANDLE LsaHandle,
2722 _In_ PLSA_STRING OriginName,
2723 _In_ SECURITY_LOGON_TYPE LogonType,
2724 _In_ ULONG AuthenticationPackage,
2725 _In_reads_bytes_(AuthenticationInformationLength) PVOID AuthenticationInformation,
2726 _In_ ULONG AuthenticationInformationLength,
2727 _In_opt_ PTOKEN_GROUPS LocalGroups,
2728 _In_ PTOKEN_SOURCE SourceContext,
2729 _Out_ PVOID *ProfileBuffer,
2730 _Out_ PULONG ProfileBufferLength,
2731 _Inout_ PLUID LogonId,
2732 _Out_ PHANDLE Token,
2733 _Out_ PQUOTA_LIMITS Quotas,
2734 _Out_ PNTSTATUS SubStatus);
2735
2736 _IRQL_requires_same_
2737 NTSTATUS
2738 NTAPI
2739 LsaFreeReturnBuffer(
2740 _In_ PVOID Buffer);
2741
2742 #ifndef _NTLSA_IFS_
2743 #define _NTLSA_IFS_
2744 #endif
2745
2746 #define MSV1_0_PACKAGE_NAME "MICROSOFT_AUTHENTICATION_PACKAGE_V1_0"
2747 #define MSV1_0_PACKAGE_NAMEW L"MICROSOFT_AUTHENTICATION_PACKAGE_V1_0"
2748 #define MSV1_0_PACKAGE_NAMEW_LENGTH sizeof(MSV1_0_PACKAGE_NAMEW) - sizeof(WCHAR)
2749
2750 #define MSV1_0_SUBAUTHENTICATION_KEY "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0"
2751 #define MSV1_0_SUBAUTHENTICATION_VALUE "Auth"
2752
2753 #define MSV1_0_CHALLENGE_LENGTH 8
2754 #define MSV1_0_USER_SESSION_KEY_LENGTH 16
2755 #define MSV1_0_LANMAN_SESSION_KEY_LENGTH 8
2756
2757 #define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x02
2758 #define MSV1_0_UPDATE_LOGON_STATISTICS 0x04
2759 #define MSV1_0_RETURN_USER_PARAMETERS 0x08
2760 #define MSV1_0_DONT_TRY_GUEST_ACCOUNT 0x10
2761 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x20
2762 #define MSV1_0_RETURN_PASSWORD_EXPIRY 0x40
2763 #define MSV1_0_USE_CLIENT_CHALLENGE 0x80
2764 #define MSV1_0_TRY_GUEST_ACCOUNT_ONLY 0x100
2765 #define MSV1_0_RETURN_PROFILE_PATH 0x200
2766 #define MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY 0x400
2767 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x800
2768
2769 #define MSV1_0_DISABLE_PERSONAL_FALLBACK 0x00001000
2770 #define MSV1_0_ALLOW_FORCE_GUEST 0x00002000
2771
2772 #if (_WIN32_WINNT >= 0x0502)
2773 #define MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED 0x00004000
2774 #define MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY 0x00008000
2775 #endif
2776
2777 #define MSV1_0_SUBAUTHENTICATION_DLL_EX 0x00100000
2778 #define MSV1_0_ALLOW_MSVCHAPV2 0x00010000
2779
2780 #if (_WIN32_WINNT >= 0x0600)
2781 #define MSV1_0_S4U2SELF 0x00020000
2782 #define MSV1_0_CHECK_LOGONHOURS_FOR_S4U 0x00040000
2783 #endif
2784
2785 #define MSV1_0_SUBAUTHENTICATION_DLL 0xFF000000
2786 #define MSV1_0_SUBAUTHENTICATION_DLL_SHIFT 24
2787 #define MSV1_0_MNS_LOGON 0x01000000
2788
2789 #define MSV1_0_SUBAUTHENTICATION_DLL_RAS 2
2790 #define MSV1_0_SUBAUTHENTICATION_DLL_IIS 132
2791
2792 #define LOGON_GUEST 0x01
2793 #define LOGON_NOENCRYPTION 0x02
2794 #define LOGON_CACHED_ACCOUNT 0x04
2795 #define LOGON_USED_LM_PASSWORD 0x08
2796 #define LOGON_EXTRA_SIDS 0x20
2797 #define LOGON_SUBAUTH_SESSION_KEY 0x40
2798 #define LOGON_SERVER_TRUST_ACCOUNT 0x80
2799 #define LOGON_NTLMV2_ENABLED 0x100
2800 #define LOGON_RESOURCE_GROUPS 0x200
2801 #define LOGON_PROFILE_PATH_RETURNED 0x400
2802 #define LOGON_NT_V2 0x800
2803 #define LOGON_LM_V2 0x1000
2804 #define LOGON_NTLM_V2 0x2000
2805
2806 #if (_WIN32_WINNT >= 0x0600)
2807
2808 #define LOGON_OPTIMIZED 0x4000
2809 #define LOGON_WINLOGON 0x8000
2810 #define LOGON_PKINIT 0x10000
2811 #define LOGON_NO_OPTIMIZED 0x20000
2812
2813 #endif
2814
2815 #define MSV1_0_SUBAUTHENTICATION_FLAGS 0xFF000000
2816
2817 #define LOGON_GRACE_LOGON 0x01000000
2818
2819 #define MSV1_0_OWF_PASSWORD_LENGTH 16
2820 #define MSV1_0_CRED_LM_PRESENT 0x1
2821 #define MSV1_0_CRED_NT_PRESENT 0x2
2822 #define MSV1_0_CRED_VERSION 0
2823
2824 #define MSV1_0_NTLM3_RESPONSE_LENGTH 16
2825 #define MSV1_0_NTLM3_OWF_LENGTH 16
2826
2827 #if (_WIN32_WINNT == 0x0500)
2828 #define MSV1_0_MAX_NTLM3_LIFE 1800
2829 #else
2830 #define MSV1_0_MAX_NTLM3_LIFE 129600
2831 #endif
2832 #define MSV1_0_MAX_AVL_SIZE 64000
2833
2834 #if (_WIN32_WINNT >= 0x0501)
2835
2836 #define MSV1_0_AV_FLAG_FORCE_GUEST 0x00000001
2837
2838 #if (_WIN32_WINNT >= 0x0600)
2839 #define MSV1_0_AV_FLAG_MIC_HANDSHAKE_MESSAGES 0x00000002
2840 #endif
2841
2842 #endif
2843
2844 #define MSV1_0_NTLM3_INPUT_LENGTH (sizeof(MSV1_0_NTLM3_RESPONSE) - MSV1_0_NTLM3_RESPONSE_LENGTH)
2845
2846 #if(_WIN32_WINNT >= 0x0502)
2847 #define MSV1_0_NTLM3_MIN_NT_RESPONSE_LENGTH RTL_SIZEOF_THROUGH_FIELD(MSV1_0_NTLM3_RESPONSE, AvPairsOff)
2848 #endif
2849
2850 #define USE_PRIMARY_PASSWORD 0x01
2851 #define RETURN_PRIMARY_USERNAME 0x02
2852 #define RETURN_PRIMARY_LOGON_DOMAINNAME 0x04
2853 #define RETURN_NON_NT_USER_SESSION_KEY 0x08
2854 #define GENERATE_CLIENT_CHALLENGE 0x10
2855 #define GCR_NTLM3_PARMS 0x20
2856 #define GCR_TARGET_INFO 0x40
2857 #define RETURN_RESERVED_PARAMETER 0x80
2858 #define GCR_ALLOW_NTLM 0x100
2859 #define GCR_USE_OEM_SET 0x200
2860 #define GCR_MACHINE_CREDENTIAL 0x400
2861 #define GCR_USE_OWF_PASSWORD 0x800
2862 #define GCR_ALLOW_LM 0x1000
2863 #define GCR_ALLOW_NO_TARGET 0x2000
2864
2865 typedef enum _MSV1_0_LOGON_SUBMIT_TYPE {
2866 MsV1_0InteractiveLogon = 2,
2867 MsV1_0Lm20Logon,
2868 MsV1_0NetworkLogon,
2869 MsV1_0SubAuthLogon,
2870 MsV1_0WorkstationUnlockLogon = 7,
2871 MsV1_0S4ULogon = 12,
2872 MsV1_0VirtualLogon = 82
2873 } MSV1_0_LOGON_SUBMIT_TYPE, *PMSV1_0_LOGON_SUBMIT_TYPE;
2874
2875 typedef enum _MSV1_0_PROFILE_BUFFER_TYPE {
2876 MsV1_0InteractiveProfile = 2,
2877 MsV1_0Lm20LogonProfile,
2878 MsV1_0SmartCardProfile
2879 } MSV1_0_PROFILE_BUFFER_TYPE, *PMSV1_0_PROFILE_BUFFER_TYPE;
2880
2881 typedef struct _MSV1_0_INTERACTIVE_LOGON {
2882 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2883 UNICODE_STRING LogonDomainName;
2884 UNICODE_STRING UserName;
2885 UNICODE_STRING Password;
2886 } MSV1_0_INTERACTIVE_LOGON, *PMSV1_0_INTERACTIVE_LOGON;
2887
2888 typedef struct _MSV1_0_INTERACTIVE_PROFILE {
2889 MSV1_0_PROFILE_BUFFER_TYPE MessageType;
2890 USHORT LogonCount;
2891 USHORT BadPasswordCount;
2892 LARGE_INTEGER LogonTime;
2893 LARGE_INTEGER LogoffTime;
2894 LARGE_INTEGER KickOffTime;
2895 LARGE_INTEGER PasswordLastSet;
2896 LARGE_INTEGER PasswordCanChange;
2897 LARGE_INTEGER PasswordMustChange;
2898 UNICODE_STRING LogonScript;
2899 UNICODE_STRING HomeDirectory;
2900 UNICODE_STRING FullName;
2901 UNICODE_STRING ProfilePath;
2902 UNICODE_STRING HomeDirectoryDrive;
2903 UNICODE_STRING LogonServer;
2904 ULONG UserFlags;
2905 } MSV1_0_INTERACTIVE_PROFILE, *PMSV1_0_INTERACTIVE_PROFILE;
2906
2907 typedef struct _MSV1_0_LM20_LOGON {
2908 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2909 UNICODE_STRING LogonDomainName;
2910 UNICODE_STRING UserName;
2911 UNICODE_STRING Workstation;
2912 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2913 STRING CaseSensitiveChallengeResponse;
2914 STRING CaseInsensitiveChallengeResponse;
2915 ULONG ParameterControl;
2916 } MSV1_0_LM20_LOGON, * PMSV1_0_LM20_LOGON;
2917
2918 typedef struct _MSV1_0_SUBAUTH_LOGON {
2919 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2920 UNICODE_STRING LogonDomainName;
2921 UNICODE_STRING UserName;
2922 UNICODE_STRING Workstation;
2923 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2924 STRING AuthenticationInfo1;
2925 STRING AuthenticationInfo2;
2926 ULONG ParameterControl;
2927 ULONG SubAuthPackageId;
2928 } MSV1_0_SUBAUTH_LOGON, * PMSV1_0_SUBAUTH_LOGON;
2929
2930 #if (_WIN32_WINNT >= 0x0600)
2931
2932 #define MSV1_0_S4U_LOGON_FLAG_CHECK_LOGONHOURS 0x2
2933
2934 typedef struct _MSV1_0_S4U_LOGON {
2935 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2936 ULONG Flags;
2937 UNICODE_STRING UserPrincipalName;
2938 UNICODE_STRING DomainName;
2939 } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
2940
2941 #endif
2942
2943 typedef struct _MSV1_0_LM20_LOGON_PROFILE {
2944 MSV1_0_PROFILE_BUFFER_TYPE MessageType;
2945 LARGE_INTEGER KickOffTime;
2946 LARGE_INTEGER LogoffTime;
2947 ULONG UserFlags;
2948 UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH];
2949 UNICODE_STRING LogonDomainName;
2950 UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH];
2951 UNICODE_STRING LogonServer;
2952 UNICODE_STRING UserParameters;
2953 } MSV1_0_LM20_LOGON_PROFILE, * PMSV1_0_LM20_LOGON_PROFILE;
2954
2955 typedef struct _MSV1_0_SUPPLEMENTAL_CREDENTIAL {
2956 ULONG Version;
2957 ULONG Flags;
2958 UCHAR LmPassword[MSV1_0_OWF_PASSWORD_LENGTH];
2959 UCHAR NtPassword[MSV1_0_OWF_PASSWORD_LENGTH];
2960 } MSV1_0_SUPPLEMENTAL_CREDENTIAL, *PMSV1_0_SUPPLEMENTAL_CREDENTIAL;
2961
2962 typedef struct _MSV1_0_NTLM3_RESPONSE {
2963 UCHAR Response[MSV1_0_NTLM3_RESPONSE_LENGTH];
2964 UCHAR RespType;
2965 UCHAR HiRespType;
2966 USHORT Flags;
2967 ULONG MsgWord;
2968 ULONGLONG TimeStamp;
2969 UCHAR ChallengeFromClient[MSV1_0_CHALLENGE_LENGTH];
2970 ULONG AvPairsOff;
2971 UCHAR Buffer[1];
2972 } MSV1_0_NTLM3_RESPONSE, *PMSV1_0_NTLM3_RESPONSE;
2973
2974 typedef enum _MSV1_0_AVID {
2975 MsvAvEOL,
2976 MsvAvNbComputerName,
2977 MsvAvNbDomainName,
2978 MsvAvDnsComputerName,
2979 MsvAvDnsDomainName,
2980 #if (_WIN32_WINNT >= 0x0501)
2981 MsvAvDnsTreeName,
2982 MsvAvFlags,
2983 #if (_WIN32_WINNT >= 0x0600)
2984 MsvAvTimestamp,
2985 MsvAvRestrictions,
2986 MsvAvTargetName,
2987 MsvAvChannelBindings,
2988 #endif
2989 #endif
2990 } MSV1_0_AVID;
2991
2992 typedef struct _MSV1_0_AV_PAIR {
2993 USHORT AvId;
2994 USHORT AvLen;
2995 } MSV1_0_AV_PAIR, *PMSV1_0_AV_PAIR;
2996
2997 typedef enum _MSV1_0_PROTOCOL_MESSAGE_TYPE {
2998 MsV1_0Lm20ChallengeRequest = 0,
2999 MsV1_0Lm20GetChallengeResponse,
3000 MsV1_0EnumerateUsers,
3001 MsV1_0GetUserInfo,
3002 MsV1_0ReLogonUsers,
3003 MsV1_0ChangePassword,
3004 MsV1_0ChangeCachedPassword,
3005 MsV1_0GenericPassthrough,
3006 MsV1_0CacheLogon,
3007 MsV1_0SubAuth,
3008 MsV1_0DeriveCredential,
3009 MsV1_0CacheLookup,
3010 #if (_WIN32_WINNT >= 0x0501)
3011 MsV1_0SetProcessOption,
3012 #endif
3013 #if (_WIN32_WINNT >= 0x0600)
3014 MsV1_0ConfigLocalAliases,
3015 MsV1_0ClearCachedCredentials,
3016 #endif
3017 } MSV1_0_PROTOCOL_MESSAGE_TYPE, *PMSV1_0_PROTOCOL_MESSAGE_TYPE;
3018
3019 typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST {
3020 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3021 } MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST;
3022
3023 typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE {
3024 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3025 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
3026 } MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE;
3027
3028 typedef struct _MSV1_0_GETCHALLENRESP_REQUEST_V1 {
3029 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3030 ULONG ParameterControl;
3031 LUID LogonId;
3032 UNICODE_STRING Password;
3033 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
3034 } MSV1_0_GETCHALLENRESP_REQUEST_V1, *PMSV1_0_GETCHALLENRESP_REQUEST_V1;
3035
3036 typedef struct _MSV1_0_GETCHALLENRESP_REQUEST {
3037 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3038 ULONG ParameterControl;
3039 LUID LogonId;
3040 UNICODE_STRING Password;
3041 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
3042 UNICODE_STRING UserName;
3043 UNICODE_STRING LogonDomainName;
3044 UNICODE_STRING ServerName;
3045 } MSV1_0_GETCHALLENRESP_REQUEST, *PMSV1_0_GETCHALLENRESP_REQUEST;
3046
3047 typedef struct _MSV1_0_GETCHALLENRESP_RESPONSE {
3048 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3049 STRING CaseSensitiveChallengeResponse;
3050 STRING CaseInsensitiveChallengeResponse;
3051 UNICODE_STRING UserName;
3052 UNICODE_STRING LogonDomainName;
3053 UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH];
3054 UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH];
3055 } MSV1_0_GETCHALLENRESP_RESPONSE, *PMSV1_0_GETCHALLENRESP_RESPONSE;
3056
3057 typedef struct _MSV1_0_ENUMUSERS_REQUEST {
3058 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3059 } MSV1_0_ENUMUSERS_REQUEST, *PMSV1_0_ENUMUSERS_REQUEST;
3060
3061 typedef struct _MSV1_0_ENUMUSERS_RESPONSE {
3062 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3063 ULONG NumberOfLoggedOnUsers;
3064 PLUID LogonIds;
3065 PULONG EnumHandles;
3066 } MSV1_0_ENUMUSERS_RESPONSE, *PMSV1_0_ENUMUSERS_RESPONSE;
3067
3068 typedef struct _MSV1_0_GETUSERINFO_REQUEST {
3069 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3070 LUID LogonId;
3071 } MSV1_0_GETUSERINFO_REQUEST, *PMSV1_0_GETUSERINFO_REQUEST;
3072
3073 typedef struct _MSV1_0_GETUSERINFO_RESPONSE {
3074 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
3075 PSID UserSid;
3076 UNICODE_STRING UserName;
3077 UNICODE_STRING LogonDomainName;
3078 UNICODE_STRING LogonServer;
3079 SECURITY_LOGON_TYPE LogonType;
3080 } MSV1_0_GETUSERINFO_RESPONSE, *PMSV1_0_GETUSERINFO_RESPONSE;
3081
3082
3083
3084 #define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007
3085 #define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008
3086 #define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009
3087
3088 /* also in winnt.h */
3089 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3090 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3091 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
3092 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3093 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3094 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3095 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3096 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3097 #define FILE_NOTIFY_CHANGE_EA 0x00000080
3098 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3099 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
3100 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
3101 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
3102 #define FILE_NOTIFY_VALID_MASK 0x00000fff
3103
3104 #define FILE_ACTION_ADDED 0x00000001
3105 #define FILE_ACTION_REMOVED 0x00000002
3106 #define FILE_ACTION_MODIFIED 0x00000003
3107 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3108 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3109 #define FILE_ACTION_ADDED_STREAM 0x00000006
3110 #define FILE_ACTION_REMOVED_STREAM 0x00000007
3111 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
3112 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
3113 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
3114 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
3115 /* end winnt.h */
3116
3117 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
3118 #define FILE_PIPE_MESSAGE_TYPE 0x00000001
3119
3120 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
3121 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002
3122
3123 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
3124 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002
3125 #define FILE_PIPE_TYPE_VALID_MASK 0x00000003
3126
3127 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
3128 #define FILE_PIPE_MESSAGE_MODE 0x00000001
3129
3130 #define FILE_PIPE_QUEUE_OPERATION 0x00000000
3131 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001
3132
3133 #define FILE_PIPE_INBOUND 0x00000000
3134 #define FILE_PIPE_OUTBOUND 0x00000001
3135 #define FILE_PIPE_FULL_DUPLEX 0x00000002
3136
3137 #define FILE_PIPE_DISCONNECTED_STATE 0x00000001
3138 #define FILE_PIPE_LISTENING_STATE 0x00000002
3139 #define FILE_PIPE_CONNECTED_STATE 0x00000003
3140 #define FILE_PIPE_CLOSING_STATE 0x00000004
3141
3142 #define FILE_PIPE_CLIENT_END 0x00000000
3143 #define FILE_PIPE_SERVER_END 0x00000001
3144
3145 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3146 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3147 #define FILE_UNICODE_ON_DISK 0x00000004
3148 #define FILE_PERSISTENT_ACLS 0x00000008
3149 #define FILE_FILE_COMPRESSION 0x00000010
3150 #define FILE_VOLUME_QUOTAS 0x00000020
3151 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
3152 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
3153 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
3154 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3155 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
3156 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
3157 #define FILE_NAMED_STREAMS 0x00040000
3158 #define FILE_READ_ONLY_VOLUME 0x00080000
3159 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
3160 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
3161 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
3162 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
3163 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
3164 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
3165
3166 #define FILE_NEED_EA 0x00000080
3167
3168 #define FILE_EA_TYPE_BINARY 0xfffe
3169 #define FILE_EA_TYPE_ASCII 0xfffd
3170 #define FILE_EA_TYPE_BITMAP 0xfffb
3171 #define FILE_EA_TYPE_METAFILE 0xfffa
3172 #define FILE_EA_TYPE_ICON 0xfff9
3173 #define FILE_EA_TYPE_EA 0xffee
3174 #define FILE_EA_TYPE_MVMT 0xffdf
3175 #define FILE_EA_TYPE_MVST 0xffde
3176 #define FILE_EA_TYPE_ASN1 0xffdd
3177 #define FILE_EA_TYPE_FAMILY_IDS 0xff01
3178
3179 typedef struct _FILE_NOTIFY_INFORMATION {
3180 ULONG NextEntryOffset;
3181 ULONG Action;
3182 ULONG FileNameLength;
3183 WCHAR FileName[1];
3184 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
3185
3186 typedef struct _FILE_DIRECTORY_INFORMATION {
3187 ULONG NextEntryOffset;
3188 ULONG FileIndex;
3189 LARGE_INTEGER CreationTime;
3190 LARGE_INTEGER LastAccessTime;
3191 LARGE_INTEGER LastWriteTime;
3192 LARGE_INTEGER ChangeTime;
3193 LARGE_INTEGER EndOfFile;
3194 LARGE_INTEGER AllocationSize;
3195 ULONG FileAttributes;
3196 ULONG FileNameLength;
3197 WCHAR FileName[1];
3198 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
3199
3200 typedef struct _FILE_FULL_DIR_INFORMATION {
3201 ULONG NextEntryOffset;
3202 ULONG FileIndex;
3203 LARGE_INTEGER CreationTime;
3204 LARGE_INTEGER LastAccessTime;
3205 LARGE_INTEGER LastWriteTime;
3206 LARGE_INTEGER ChangeTime;
3207 LARGE_INTEGER EndOfFile;
3208 LARGE_INTEGER AllocationSize;
3209 ULONG FileAttributes;
3210 ULONG FileNameLength;
3211 ULONG EaSize;
3212 WCHAR FileName[1];
3213 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
3214
3215 typedef struct _FILE_ID_FULL_DIR_INFORMATION {
3216 ULONG NextEntryOffset;
3217 ULONG FileIndex;
3218 LARGE_INTEGER CreationTime;
3219 LARGE_INTEGER LastAccessTime;
3220 LARGE_INTEGER LastWriteTime;
3221 LARGE_INTEGER ChangeTime;
3222 LARGE_INTEGER EndOfFile;
3223 LARGE_INTEGER AllocationSize;
3224 ULONG FileAttributes;
3225 ULONG FileNameLength;
3226 ULONG EaSize;
3227 LARGE_INTEGER FileId;
3228 WCHAR FileName[1];
3229 } FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION;
3230
3231 typedef struct _FILE_BOTH_DIR_INFORMATION {
3232 ULONG NextEntryOffset;
3233 ULONG FileIndex;
3234 LARGE_INTEGER CreationTime;
3235 LARGE_INTEGER LastAccessTime;
3236 LARGE_INTEGER LastWriteTime;
3237 LARGE_INTEGER ChangeTime;
3238 LARGE_INTEGER EndOfFile;
3239 LARGE_INTEGER AllocationSize;
3240 ULONG FileAttributes;
3241 ULONG FileNameLength;
3242 ULONG EaSize;
3243 CCHAR ShortNameLength;
3244 WCHAR ShortName[12];
3245 WCHAR FileName[1];
3246 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
3247
3248 typedef struct _FILE_ID_BOTH_DIR_INFORMATION {
3249 ULONG NextEntryOffset;
3250 ULONG FileIndex;
3251 LARGE_INTEGER CreationTime;
3252 LARGE_INTEGER LastAccessTime;
3253 LARGE_INTEGER LastWriteTime;
3254 LARGE_INTEGER ChangeTime;
3255 LARGE_INTEGER EndOfFile;
3256 LARGE_INTEGER AllocationSize;
3257 ULONG FileAttributes;
3258 ULONG FileNameLength;
3259 ULONG EaSize;
3260 CCHAR ShortNameLength;
3261 WCHAR ShortName[12];
3262 LARGE_INTEGER FileId;
3263 WCHAR FileName[1];
3264 } FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
3265
3266 typedef struct _FILE_NAMES_INFORMATION {
3267 ULONG NextEntryOffset;
3268 ULONG FileIndex;
3269 ULONG FileNameLength;
3270 WCHAR FileName[1];
3271 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
3272
3273 typedef struct _FILE_ID_GLOBAL_TX_DIR_INFORMATION {
3274 ULONG NextEntryOffset;
3275 ULONG FileIndex;
3276 LARGE_INTEGER CreationTime;
3277 LARGE_INTEGER LastAccessTime;
3278 LARGE_INTEGER LastWriteTime;
3279 LARGE_INTEGER ChangeTime;
3280 LARGE_INTEGER EndOfFile;
3281 LARGE_INTEGER AllocationSize;
3282 ULONG FileAttributes;
3283 ULONG FileNameLength;
3284 LARGE_INTEGER FileId;
3285 GUID LockingTransactionId;
3286 ULONG TxInfoFlags;
3287 WCHAR FileName[1];
3288 } FILE_ID_GLOBAL_TX_DIR_INFORMATION, *PFILE_ID_GLOBAL_TX_DIR_INFORMATION;
3289
3290 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_WRITELOCKED 0x00000001
3291 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_TO_TX 0x00000002
3292 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_OUTSIDE_TX 0x00000004
3293
3294 typedef struct _FILE_OBJECTID_INFORMATION {
3295 LONGLONG FileReference;
3296 UCHAR ObjectId[16];
3297 _ANONYMOUS_UNION union {
3298 _ANONYMOUS_STRUCT struct {
3299 UCHAR BirthVolumeId[16];
3300 UCHAR BirthObjectId[16];
3301 UCHAR DomainId[16];
3302 } DUMMYSTRUCTNAME;
3303 UCHAR ExtendedInfo[48];
3304 } DUMMYUNIONNAME;
3305 } FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;
3306
3307 #define ANSI_DOS_STAR ('<')
3308 #define ANSI_DOS_QM ('>')
3309 #define ANSI_DOS_DOT ('"')
3310
3311 #define DOS_STAR (L'<')
3312 #define DOS_QM (L'>')
3313 #define DOS_DOT (L'"')
3314
3315 typedef struct _FILE_INTERNAL_INFORMATION {
3316 LARGE_INTEGER IndexNumber;
3317 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
3318
3319 typedef struct _FILE_EA_INFORMATION {
3320 ULONG EaSize;
3321 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
3322
3323 typedef struct _FILE_ACCESS_INFORMATION {
3324 ACCESS_MASK AccessFlags;
3325 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
3326
3327 typedef struct _FILE_MODE_INFORMATION {
3328 ULONG Mode;
3329 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
3330
3331 typedef struct _FILE_ALL_INFORMATION {
3332 FILE_BASIC_INFORMATION BasicInformation;
3333 FILE_STANDARD_INFORMATION StandardInformation;
3334 FILE_INTERNAL_INFORMATION InternalInformation;
3335 FILE_EA_INFORMATION EaInformation;
3336 FILE_ACCESS_INFORMATION AccessInformation;
3337 FILE_POSITION_INFORMATION PositionInformation;
3338 FILE_MODE_INFORMATION ModeInformation;
3339 FILE_ALIGNMENT_INFORMATION AlignmentInformation;
3340 FILE_NAME_INFORMATION NameInformation;
3341 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
3342
3343 typedef struct _FILE_ALLOCATION_INFORMATION {
3344 LARGE_INTEGER AllocationSize;
3345 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
3346
3347 typedef struct _FILE_COMPRESSION_INFORMATION {
3348 LARGE_INTEGER CompressedFileSize;
3349 USHORT CompressionFormat;
3350 UCHAR CompressionUnitShift;
3351 UCHAR ChunkShift;
3352 UCHAR ClusterShift;
3353 UCHAR Reserved[3];
3354 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
3355
3356 typedef struct _FILE_LINK_INFORMATION {
3357 BOOLEAN ReplaceIfExists;
3358 HANDLE RootDirectory;
3359 ULONG FileNameLength;
3360 WCHAR FileName[1];
3361 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
3362
3363 typedef struct _FILE_MOVE_CLUSTER_INFORMATION {
3364 ULONG ClusterCount;
3365 HANDLE RootDirectory;
3366 ULONG FileNameLength;
3367 WCHAR FileName[1];
3368 } FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION;
3369
3370 typedef struct _FILE_RENAME_INFORMATION {
3371 BOOLEAN ReplaceIfExists;
3372 HANDLE RootDirectory;
3373 ULONG FileNameLength;
3374 WCHAR FileName[1];
3375 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
3376
3377 typedef struct _FILE_STREAM_INFORMATION {
3378 ULONG NextEntryOffset;
3379 ULONG StreamNameLength;
3380 LARGE_INTEGER StreamSize;
3381 LARGE_INTEGER StreamAllocationSize;
3382 WCHAR StreamName[1];
3383 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
3384
3385 typedef struct _FILE_TRACKING_INFORMATION {
3386 HANDLE DestinationFile;
3387 ULONG ObjectInformationLength;
3388 CHAR ObjectInformation[1];
3389 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
3390
3391 typedef struct _FILE_COMPLETION_INFORMATION {
3392 HANDLE Port;
3393 PVOID Key;
3394 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
3395
3396 typedef struct _FILE_PIPE_INFORMATION {
3397 ULONG ReadMode;
3398 ULONG CompletionMode;
3399 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
3400
3401 typedef struct _FILE_PIPE_LOCAL_INFORMATION {
3402 ULONG NamedPipeType;
3403 ULONG NamedPipeConfiguration;
3404 ULONG MaximumInstances;
3405 ULONG CurrentInstances;
3406 ULONG InboundQuota;
3407 ULONG ReadDataAvailable;
3408 ULONG OutboundQuota;
3409 ULONG WriteQuotaAvailable;
3410 ULONG NamedPipeState;
3411 ULONG NamedPipeEnd;
3412 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
3413
3414 typedef struct _FILE_PIPE_REMOTE_INFORMATION {
3415 LARGE_INTEGER CollectDataTime;
3416 ULONG MaximumCollectionCount;
3417 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
3418
3419 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
3420 ULONG MaximumMessageSize;
3421 ULONG MailslotQuota;
3422 ULONG NextMessageSize;
3423 ULONG MessagesAvailable;
3424 LARGE_INTEGER ReadTimeout;
3425 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
3426
3427 typedef struct _FILE_MAILSLOT_SET_INFORMATION {
3428 PLARGE_INTEGER ReadTimeout;
3429 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
3430
3431 typedef struct _FILE_REPARSE_POINT_INFORMATION {
3432 LONGLONG FileReference;
3433 ULONG Tag;
3434 } FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION;
3435
3436 typedef struct _FILE_LINK_ENTRY_INFORMATION {
3437 ULONG NextEntryOffset;
3438 LONGLONG ParentFileId;
3439 ULONG FileNameLength;
3440 WCHAR FileName[1];
3441 } FILE_LINK_ENTRY_INFORMATION, *PFILE_LINK_ENTRY_INFORMATION;
3442
3443 typedef struct _FILE_LINKS_INFORMATION {
3444 ULONG BytesNeeded;
3445 ULONG EntriesReturned;
3446 FILE_LINK_ENTRY_INFORMATION Entry;
3447 } FILE_LINKS_INFORMATION, *PFILE_LINKS_INFORMATION;
3448
3449 typedef struct _FILE_NETWORK_PHYSICAL_NAME_INFORMATION {
3450 ULONG FileNameLength;
3451 WCHAR FileName[1];
3452 } FILE_NETWORK_PHYSICAL_NAME_INFORMATION, *PFILE_NETWORK_PHYSICAL_NAME_INFORMATION;
3453
3454 typedef struct _FILE_STANDARD_LINK_INFORMATION {
3455 ULONG NumberOfAccessibleLinks;
3456 ULONG TotalNumberOfLinks;
3457 BOOLEAN DeletePending;
3458 BOOLEAN Directory;
3459 } FILE_STANDARD_LINK_INFORMATION, *PFILE_STANDARD_LINK_INFORMATION;
3460
3461 typedef struct _FILE_GET_EA_INFORMATION {
3462 ULONG NextEntryOffset;
3463 UCHAR EaNameLength;
3464 CHAR EaName[1];
3465 } FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
3466
3467 #define REMOTE_PROTOCOL_FLAG_LOOPBACK 0x00000001
3468 #define REMOTE_PROTOCOL_FLAG_OFFLINE 0x00000002
3469
3470 typedef struct _FILE_REMOTE_PROTOCOL_INFORMATION {
3471 USHORT StructureVersion;
3472 USHORT StructureSize;
3473 ULONG Protocol;
3474 USHORT ProtocolMajorVersion;
3475 USHORT ProtocolMinorVersion;
3476 USHORT ProtocolRevision;
3477 USHORT Reserved;
3478 ULONG Flags;
3479 struct {
3480 ULONG Reserved[8];
3481 } GenericReserved;
3482 struct {
3483 ULONG Reserved[16];
3484 } ProtocolSpecificReserved;
3485 } FILE_REMOTE_PROTOCOL_INFORMATION, *PFILE_REMOTE_PROTOCOL_INFORMATION;
3486
3487 typedef struct _FILE_GET_QUOTA_INFORMATION {
3488 ULONG NextEntryOffset;
3489 ULONG SidLength;
3490 SID Sid;
3491 } FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
3492
3493 typedef struct _FILE_QUOTA_INFORMATION {
3494 ULONG NextEntryOffset;
3495 ULONG SidLength;
3496 LARGE_INTEGER ChangeTime;
3497 LARGE_INTEGER QuotaUsed;
3498 LARGE_INTEGER QuotaThreshold;
3499 LARGE_INTEGER QuotaLimit;
3500 SID Sid;
3501 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
3502
3503 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
3504 ULONG FileSystemAttributes;
3505 ULONG MaximumComponentNameLength;
3506 ULONG FileSystemNameLength;
3507 WCHAR FileSystemName[1];
3508 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
3509
3510 typedef struct _FILE_FS_DRIVER_PATH_INFORMATION {
3511 BOOLEAN DriverInPath;
3512 ULONG DriverNameLength;
3513 WCHAR DriverName[1];
3514 } FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION;
3515
3516 typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION {
3517 ULONG Flags;
3518 } FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION;
3519
3520 #define FILE_VC_QUOTA_NONE 0x00000000
3521 #define FILE_VC_QUOTA_TRACK 0x00000001
3522 #define FILE_VC_QUOTA_ENFORCE 0x00000002
3523 #define FILE_VC_QUOTA_MASK 0x00000003
3524 #define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
3525 #define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
3526 #define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
3527 #define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
3528 #define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
3529 #define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
3530 #define FILE_VC_QUOTAS_REBUILDING 0x00000200
3531 #define FILE_VC_VALID_MASK 0x000003ff
3532
3533 typedef struct _FILE_FS_CONTROL_INFORMATION {
3534 LARGE_INTEGER FreeSpaceStartFiltering;
3535 LARGE_INTEGER FreeSpaceThreshold;
3536 LARGE_INTEGER FreeSpaceStopFiltering;
3537 LARGE_INTEGER DefaultQuotaThreshold;
3538 LARGE_INTEGER DefaultQuotaLimit;
3539 ULONG FileSystemControlFlags;
3540 } FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
3541
3542 #ifndef _FILESYSTEMFSCTL_
3543 #define _FILESYSTEMFSCTL_
3544
3545 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
3546 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
3547 #define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
3548 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
3549 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
3550 #define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
3551 #define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
3552 #define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
3553 #define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
3554 #define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
3555 #define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
3556 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
3557 #define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
3558 #define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
3559 #define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3560 #define FSCTL_SET_BOOTLOADER_ACCESSED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS)
3561
3562 #define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
3563 #define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
3564 #define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
3565 #define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
3566 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
3567
3568 #if (_WIN32_WINNT >= 0x0400)
3569
3570 #define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
3571 #define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
3572 #define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS)
3573 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS)
3574 #define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3575 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
3576 #define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS)
3577
3578 #endif
3579
3580 #if (_WIN32_WINNT >= 0x0500)
3581
3582 #define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
3583 #define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3584 #define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
3585 #define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3586 #define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3587 #define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
3588 #define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3589 #define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_ANY_ACCESS)
3590 #define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA)
3591 #define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_ANY_ACCESS)
3592 #define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3593 #define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
3594 #define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3595 #define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
3596 #define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA)
3597 #define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
3598 #define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, FILE_ANY_ACCESS)
3599 #define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS)
3600 #define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_SPECIAL_ACCESS)
3601 #define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_SPECIAL_ACCESS)
3602 #define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_ANY_ACCESS)
3603 #define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_ANY_ACCESS)
3604 #define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_ANY_ACCESS)
3605 #define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
3606 #define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)
3607 #define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS)
3608 #define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)
3609 #define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
3610 #define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3611 #define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
3612 #define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA)
3613 #define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3614
3615 #endif
3616
3617 #if (_WIN32_WINNT >= 0x0600)
3618
3619 #define FSCTL_MAKE_MEDIA_COMPATIBLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 76, METHOD_BUFFERED, FILE_WRITE_DATA)
3620 #define FSCTL_SET_DEFECT_MANAGEMENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, METHOD_BUFFERED, FILE_WRITE_DATA)
3621 #define FSCTL_QUERY_SPARING_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS)
3622 #define FSCTL_QUERY_ON_DISK_VOLUME_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS)
3623 #define FSCTL_SET_VOLUME_COMPRESSION_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 80, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3624 #define FSCTL_TXFS_MODIFY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, FILE_WRITE_DATA)
3625 #define FSCTL_TXFS_QUERY_RM_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 82, METHOD_BUFFERED, FILE_READ_DATA)
3626 #define FSCTL_TXFS_ROLLFORWARD_REDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 84, METHOD_BUFFERED, FILE_WRITE_DATA)
3627 #define FSCTL_TXFS_ROLLFORWARD_UNDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 85, METHOD_BUFFERED, FILE_WRITE_DATA)
3628 #define FSCTL_TXFS_START_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, FILE_WRITE_DATA)
3629 #define FSCTL_TXFS_SHUTDOWN_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, FILE_WRITE_DATA)
3630 #define FSCTL_TXFS_READ_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 88, METHOD_BUFFERED, FILE_READ_DATA)
3631 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 89, METHOD_BUFFERED, FILE_WRITE_DATA)
3632 #define FSCTL_TXFS_CREATE_SECONDARY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 90, METHOD_BUFFERED, FILE_WRITE_DATA)
3633 #define FSCTL_TXFS_GET_METADATA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 91, METHOD_BUFFERED, FILE_READ_DATA)
3634 #define FSCTL_TXFS_GET_TRANSACTED_VERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 92, METHOD_BUFFERED, FILE_READ_DATA)
3635 #define FSCTL_TXFS_SAVEPOINT_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 94, METHOD_BUFFERED, FILE_WRITE_DATA)
3636 #define FSCTL_TXFS_CREATE_MINIVERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 95, METHOD_BUFFERED, FILE_WRITE_DATA)
3637 #define FSCTL_TXFS_TRANSACTION_ACTIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 99, METHOD_BUFFERED, FILE_READ_DATA)
3638 #define FSCTL_SET_ZERO_ON_DEALLOCATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3639 #define FSCTL_SET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS)
3640 #define FSCTL_GET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS)
3641 #define FSCTL_WAIT_FOR_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS)
3642 #define FSCTL_INITIATE_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS)
3643 #define FSCTL_CSC_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, FILE_ANY_ACCESS)
3644 #define FSCTL_SHRINK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3645 #define FSCTL_SET_SHORT_NAME_BEHAVIOR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS)
3646 #define FSCTL_DFSR_SET_GHOST_HANDLE_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 110, METHOD_BUFFERED, FILE_ANY_ACCESS)
3647 #define FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES \
3648 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_READ_DATA)
3649 #define FSCTL_TXFS_LIST_TRANSACTIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 121, METHOD_BUFFERED, FILE_READ_DATA)
3650 #define FSCTL_QUERY_PAGEFILE_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 122, METHOD_BUFFERED, FILE_ANY_ACCESS)
3651 #define FSCTL_RESET_VOLUME_ALLOCATION_HINTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 123, METHOD_BUFFERED, FILE_ANY_ACCESS)
3652 #define FSCTL_TXFS_READ_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 126, METHOD_BUFFERED, FILE_ANY_ACCESS)
3653
3654 #endif
3655
3656 #if (_WIN32_WINNT >= 0x0601)
3657
3658 #define FSCTL_QUERY_DEPENDENT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 124, METHOD_BUFFERED, FILE_ANY_ACCESS)
3659 #define FSCTL_SD_GLOBAL_CHANGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 125, METHOD_BUFFERED, FILE_ANY_ACCESS)
3660 #define FSCTL_LOOKUP_STREAM_FROM_CLUSTER CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 127, METHOD_BUFFERED, FILE_ANY_ACCESS)
3661 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 128, METHOD_BUFFERED, FILE_ANY_ACCESS)
3662 #define FSCTL_FILE_TYPE_NOTIFICATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 129, METHOD_BUFFERED, FILE_ANY_ACCESS)
3663 #define FSCTL_GET_BOOT_AREA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 140, METHOD_BUFFERED, FILE_ANY_ACCESS)
3664 #define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 141, METHOD_BUFFERED, FILE_ANY_ACCESS)
3665 #define FSCTL_SET_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS)
3666 #define FSCTL_QUERY_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 143, METHOD_BUFFERED, FILE_ANY_ACCESS)
3667 #define FSCTL_REQUEST_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, FILE_ANY_ACCESS)
3668 #define FSCTL_CSV_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 145, METHOD_BUFFERED, FILE_ANY_ACCESS)
3669 #define FSCTL_IS_CSV_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, FILE_ANY_ACCESS)
3670 #define FSCTL_QUERY_FILE_SYSTEM_RECOGNITION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 147, METHOD_BUFFERED, FILE_ANY_ACCESS)
3671 #define FSCTL_CSV_GET_VOLUME_PATH_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 148, METHOD_BUFFERED, FILE_ANY_ACCESS)
3672 #define FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS)
3673 #define FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS)
3674 #define FSCTL_IS_FILE_ON_CSV_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 151, METHOD_BUFFERED, FILE_ANY_ACCESS)
3675 #define FSCTL_CSV_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 155, METHOD_BUFFERED, FILE_ANY_ACCESS)
3676
3677 typedef struct _CSV_NAMESPACE_INFO {
3678 ULONG Version;
3679 ULONG DeviceNumber;
3680 LARGE_INTEGER StartingOffset;
3681 ULONG SectorSize;
3682 } CSV_NAMESPACE_INFO, *PCSV_NAMESPACE_INFO;
3683
3684 #define CSV_NAMESPACE_INFO_V1 (sizeof(CSV_NAMESPACE_INFO))
3685 #define CSV_INVALID_DEVICE_NUMBER 0xFFFFFFFF
3686
3687 #endif
3688
3689 #if (_WIN32_WINNT >= 0x0602)
3690
3691 #define FSCTL_FILE_LEVEL_TRIM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 130, METHOD_BUFFERED, FILE_WRITE_DATA)
3692 #define FSCTL_CORRUPTION_HANDLING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 152, METHOD_BUFFERED, FILE_ANY_ACCESS)
3693 #define FSCTL_OFFLOAD_READ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 153, METHOD_BUFFERED, FILE_READ_ACCESS)
3694 #define FSCTL_OFFLOAD_WRITE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 154, METHOD_BUFFERED, FILE_WRITE_ACCESS)
3695 #define FSCTL_SET_PURGE_FAILURE_MODE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 156, METHOD_BUFFERED, FILE_ANY_ACCESS)
3696 #define FSCTL_QUERY_FILE_LAYOUT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 157, METHOD_NEITHER, FILE_ANY_ACCESS)
3697 #define FSCTL_IS_VOLUME_OWNED_BYCSVFS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 158, METHOD_BUFFERED, FILE_ANY_ACCESS)
3698 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
3699 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3700 #define FSCTL_QUERY_FILE_REGIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 161, METHOD_BUFFERED, FILE_ANY_ACCESS)
3701 #define FSCTL_DEDUP_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 165, METHOD_BUFFERED, FILE_ANY_ACCESS)
3702 #define FSCTL_DEDUP_QUERY_FILE_HASHES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 166, METHOD_NEITHER, FILE_READ_DATA)
3703 #define FSCTL_RKF_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 171, METHOD_NEITHER, FILE_ANY_ACCESS)
3704 #define FSCTL_SCRUB_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 172, METHOD_BUFFERED, FILE_ANY_ACCESS)
3705 #define FSCTL_REPAIR_COPIES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 173, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3706 #define FSCTL_DISABLE_LOCAL_BUFFERING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 174, METHOD_BUFFERED, FILE_ANY_ACCESS)
3707 #define FSCTL_CSV_MGMT_LOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 175, METHOD_BUFFERED, FILE_ANY_ACCESS)
3708 #define FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS \
3709 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 176, METHOD_BUFFERED, FILE_ANY_ACCESS)
3710 #define FSCTL_ADVANCE_FILE_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 177, METHOD_BUFFERED, FILE_ANY_ACCESS)
3711 #define FSCTL_CSV_SYNC_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 178, METHOD_BUFFERED, FILE_ANY_ACCESS)
3712 #define FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 179, METHOD_BUFFERED, FILE_ANY_ACCESS)
3713 #define FSCTL_WRITE_USN_REASON CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 180, METHOD_BUFFERED, FILE_ANY_ACCESS)
3714 #define FSCTL_CSV_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, FILE_ANY_ACCESS)
3715 #define FSCTL_GET_REFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 182, METHOD_BUFFERED, FILE_ANY_ACCESS)
3716
3717 #endif
3718
3719 #define FSCTL_MARK_AS_SYSTEM_HIVE FSCTL_SET_BOOTLOADER_ACCESSED
3720
3721 typedef struct _PATHNAME_BUFFER {
3722 ULONG PathNameLength;
3723 WCHAR Name[1];
3724 } PATHNAME_BUFFER, *PPATHNAME_BUFFER;
3725
3726 typedef struct _FSCTL_QUERY_FAT_BPB_BUFFER {
3727 UCHAR First0x24BytesOfBootSector[0x24];
3728 } FSCTL_QUERY_FAT_BPB_BUFFER, *PFSCTL_QUERY_FAT_BPB_BUFFER;
3729
3730 #if (_WIN32_WINNT >= 0x0400)
3731
3732 typedef struct _NTFS_VOLUME_DATA_BUFFER {
3733 LARGE_INTEGER VolumeSerialNumber;
3734 LARGE_INTEGER NumberSectors;
3735 LARGE_INTEGER TotalClusters;
3736 LARGE_INTEGER FreeClusters;
3737 LARGE_INTEGER TotalReserved;
3738 ULONG BytesPerSector;
3739 ULONG BytesPerCluster;
3740 ULONG BytesPerFileRecordSegment;
3741 ULONG ClustersPerFileRecordSegment;
3742 LARGE_INTEGER MftValidDataLength;
3743 LARGE_INTEGER MftStartLcn;
3744 LARGE_INTEGER Mft2StartLcn;
3745 LARGE_INTEGER MftZoneStart;
3746 LARGE_INTEGER MftZoneEnd;
3747 } NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER;
3748
3749 typedef struct _NTFS_EXTENDED_VOLUME_DATA {
3750 ULONG ByteCount;
3751 USHORT MajorVersion;
3752 USHORT MinorVersion;
3753 } NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA;
3754
3755 typedef struct _STARTING_LCN_INPUT_BUFFER {
3756 LARGE_INTEGER StartingLcn;
3757 } STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER;
3758
3759 typedef struct _VOLUME_BITMAP_BUFFER {
3760 LARGE_INTEGER StartingLcn;
3761 LARGE_INTEGER BitmapSize;
3762 UCHAR Buffer[1];
3763 } VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER;
3764
3765 typedef struct _STARTING_VCN_INPUT_BUFFER {
3766 LARGE_INTEGER StartingVcn;
3767 } STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER;
3768
3769 typedef struct _RETRIEVAL_POINTERS_BUFFER {
3770 ULONG ExtentCount;
3771 LARGE_INTEGER StartingVcn;
3772 struct {
3773 LARGE_INTEGER NextVcn;
3774 LARGE_INTEGER Lcn;
3775 } Extents[1];
3776 } RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER;
3777
3778 typedef struct _NTFS_FILE_RECORD_INPUT_BUFFER {
3779 LARGE_INTEGER FileReferenceNumber;
3780 } NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER;
3781
3782 typedef struct _NTFS_FILE_RECORD_OUTPUT_BUFFER {
3783 LARGE_INTEGER FileReferenceNumber;
3784 ULONG FileRecordLength;
3785 UCHAR FileRecordBuffer[1];
3786 } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER;
3787
3788 typedef struct _MOVE_FILE_DATA {
3789 HANDLE FileHandle;
3790 LARGE_INTEGER StartingVcn;
3791 LARGE_INTEGER StartingLcn;
3792 ULONG ClusterCount;
3793 } MOVE_FILE_DATA, *PMOVE_FILE_DATA;
3794
3795 typedef struct _MOVE_FILE_RECORD_DATA {
3796 HANDLE FileHandle;
3797 LARGE_INTEGER SourceFileRecord;
3798 LARGE_INTEGER TargetFileRecord;
3799 } MOVE_FILE_RECORD_DATA, *PMOVE_FILE_RECORD_DATA;
3800
3801 #if defined(_WIN64)
3802 typedef struct _MOVE_FILE_DATA32 {
3803 UINT32 FileHandle;
3804 LARGE_INTEGER StartingVcn;
3805 LARGE_INTEGER StartingLcn;
3806 ULONG ClusterCount;
3807 } MOVE_FILE_DATA32, *PMOVE_FILE_DATA32;
3808 #endif
3809
3810 #endif /* (_WIN32_WINNT >= 0x0400) */
3811
3812 #if (_WIN32_WINNT >= 0x0500)
3813
3814 typedef struct _FIND_BY_SID_DATA {
3815 ULONG Restart;
3816 SID Sid;
3817 } FIND_BY_SID_DATA, *PFIND_BY_SID_DATA;
3818
3819 typedef struct _FIND_BY_SID_OUTPUT {
3820 ULONG NextEntryOffset;
3821 ULONG FileIndex;
3822 ULONG FileNameLength;
3823 WCHAR FileName[1];
3824 } FIND_BY_SID_OUTPUT, *PFIND_BY_SID_OUTPUT;
3825
3826 typedef struct _MFT_ENUM_DATA {
3827 ULONGLONG StartFileReferenceNumber;
3828 USN LowUsn;
3829 USN HighUsn;
3830 } MFT_ENUM_DATA, *PMFT_ENUM_DATA;
3831
3832 typedef struct _CREATE_USN_JOURNAL_DATA {
3833 ULONGLONG MaximumSize;
3834 ULONGLONG AllocationDelta;
3835 } CREATE_USN_JOURNAL_DATA, *PCREATE_USN_JOURNAL_DATA;
3836
3837 typedef struct _READ_USN_JOURNAL_DATA {
3838 USN StartUsn;
3839 ULONG ReasonMask;
3840 ULONG ReturnOnlyOnClose;
3841 ULONGLONG Timeout;
3842 ULONGLONG BytesToWaitFor;
3843 ULONGLONG UsnJournalID;
3844 } READ_USN_JOURNAL_DATA, *PREAD_USN_JOURNAL_DATA;
3845
3846 typedef struct _USN_RECORD {
3847 ULONG RecordLength;
3848 USHORT MajorVersion;
3849 USHORT MinorVersion;
3850 ULONGLONG FileReferenceNumber;
3851 ULONGLONG ParentFileReferenceNumber;
3852 USN Usn;
3853 LARGE_INTEGER TimeStamp;
3854 ULONG Reason;
3855 ULONG SourceInfo;
3856 ULONG SecurityId;
3857 ULONG FileAttributes;
3858 USHORT FileNameLength;
3859 USHORT FileNameOffset;
3860 WCHAR FileName[1];
3861 } USN_RECORD, *PUSN_RECORD;
3862
3863 #define USN_PAGE_SIZE (0x1000)
3864
3865 #define USN_REASON_DATA_OVERWRITE (0x00000001)
3866 #define USN_REASON_DATA_EXTEND (0x00000002)
3867 #define USN_REASON_DATA_TRUNCATION (0x00000004)
3868 #define USN_REASON_NAMED_DATA_OVERWRITE (0x00000010)
3869 #define USN_REASON_NAMED_DATA_EXTEND (0x00000020)
3870 #define USN_REASON_NAMED_DATA_TRUNCATION (0x00000040)
3871 #define USN_REASON_FILE_CREATE (0x00000100)
3872 #define USN_REASON_FILE_DELETE (0x00000200)
3873 #define USN_REASON_EA_CHANGE (0x00000400)
3874 #define USN_REASON_SECURITY_CHANGE (0x00000800)
3875 #define USN_REASON_RENAME_OLD_NAME (0x00001000)
3876 #define USN_REASON_RENAME_NEW_NAME (0x00002000)
3877 #define USN_REASON_INDEXABLE_CHANGE (0x00004000)
3878 #define USN_REASON_BASIC_INFO_CHANGE (0x00008000)
3879 #define USN_REASON_HARD_LINK_CHANGE (0x00010000)
3880 #define USN_REASON_COMPRESSION_CHANGE (0x00020000)
3881 #define USN_REASON_ENCRYPTION_CHANGE (0x00040000)
3882 #define USN_REASON_OBJECT_ID_CHANGE (0x00080000)
3883 #define USN_REASON_REPARSE_POINT_CHANGE (0x00100000)
3884 #define USN_REASON_STREAM_CHANGE (0x00200000)
3885 #define USN_REASON_TRANSACTED_CHANGE (0x00400000)
3886 #define USN_REASON_CLOSE (0x80000000)
3887
3888 typedef struct _USN_JOURNAL_DATA {
3889 ULONGLONG UsnJournalID;
3890 USN FirstUsn;
3891 USN NextUsn;
3892 USN LowestValidUsn;
3893 USN MaxUsn;
3894 ULONGLONG MaximumSize;
3895 ULONGLONG AllocationDelta;
3896 } USN_JOURNAL_DATA, *PUSN_JOURNAL_DATA;
3897
3898 typedef struct _DELETE_USN_JOURNAL_DATA {
3899 ULONGLONG UsnJournalID;
3900 ULONG DeleteFlags;
3901 } DELETE_USN_JOURNAL_DATA, *PDELETE_USN_JOURNAL_DATA;
3902
3903 #define USN_DELETE_FLAG_DELETE (0x00000001)
3904 #define USN_DELETE_FLAG_NOTIFY (0x00000002)
3905 #define USN_DELETE_VALID_FLAGS (0x00000003)
3906
3907 typedef struct _MARK_HANDLE_INFO {
3908 ULONG UsnSourceInfo;
3909 HANDLE VolumeHandle;
3910 ULONG HandleInfo;
3911 } MARK_HANDLE_INFO, *PMARK_HANDLE_INFO;
3912
3913 #if defined(_WIN64)
3914 typedef struct _MARK_HANDLE_INFO32 {
3915 ULONG UsnSourceInfo;
3916 UINT32 VolumeHandle;
3917 ULONG HandleInfo;
3918 } MARK_HANDLE_INFO32, *PMARK_HANDLE_INFO32;
3919 #endif
3920
3921 #define USN_SOURCE_DATA_MANAGEMENT (0x00000001)
3922 #define USN_SOURCE_AUXILIARY_DATA (0x00000002)
3923 #define USN_SOURCE_REPLICATION_MANAGEMENT (0x00000004)
3924
3925 #define MARK_HANDLE_PROTECT_CLUSTERS (0x00000001)
3926 #define MARK_HANDLE_TXF_SYSTEM_LOG (0x00000004)
3927 #define MARK_HANDLE_NOT_TXF_SYSTEM_LOG (0x00000008)
3928
3929 typedef struct _BULK_SECURITY_TEST_DATA {
3930 ACCESS_MASK DesiredAccess;
3931 ULONG SecurityIds[1];
3932 } BULK_SECURITY_TEST_DATA, *PBULK_SECURITY_TEST_DATA;
3933
3934 #define VOLUME_IS_DIRTY (0x00000001)
3935 #define VOLUME_UPGRADE_SCHEDULED (0x00000002)
3936 #define VOLUME_SESSION_OPEN (0x00000004)
3937
3938 typedef struct _FILE_PREFETCH {
3939 ULONG Type;
3940 ULONG Count;
3941 ULONGLONG Prefetch[1];
3942 } FILE_PREFETCH, *PFILE_PREFETCH;
3943
3944 typedef struct _FILE_PREFETCH_EX {
3945 ULONG Type;
3946 ULONG Count;
3947 PVOID Context;
3948 ULONGLONG Prefetch[1];
3949 } FILE_PREFETCH_EX, *PFILE_PREFETCH_EX;
3950
3951 #define FILE_PREFETCH_TYPE_FOR_CREATE 0x1
3952 #define FILE_PREFETCH_TYPE_FOR_DIRENUM 0x2
3953 #define FILE_PREFETCH_TYPE_FOR_CREATE_EX 0x3
3954 #define FILE_PREFETCH_TYPE_FOR_DIRENUM_EX 0x4
3955
3956 #define FILE_PREFETCH_TYPE_MAX 0x4
3957
3958 typedef struct _FILE_OBJECTID_BUFFER {
3959 UCHAR ObjectId[16];
3960 _ANONYMOUS_UNION union {
3961 _ANONYMOUS_STRUCT struct {
3962 UCHAR BirthVolumeId[16];
3963 UCHAR BirthObjectId[16];
3964 UCHAR DomainId[16];
3965 } DUMMYSTRUCTNAME;
3966 UCHAR ExtendedInfo[48];
3967 } DUMMYUNIONNAME;
3968 } FILE_OBJECTID_BUFFER, *PFILE_OBJECTID_BUFFER;
3969
3970 typedef struct _FILE_SET_SPARSE_BUFFER {
3971 BOOLEAN SetSparse;
3972 } FILE_SET_SPARSE_BUFFER, *PFILE_SET_SPARSE_BUFFER;
3973
3974 typedef struct _FILE_ZERO_DATA_INFORMATION {
3975 LARGE_INTEGER FileOffset;
3976 LARGE_INTEGER BeyondFinalZero;
3977 } FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION;
3978
3979 typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
3980 LARGE_INTEGER FileOffset;
3981 LARGE_INTEGER Length;
3982 } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
3983
3984 typedef struct _ENCRYPTION_BUFFER {
3985 ULONG EncryptionOperation;
3986 UCHAR Private[1];
3987 } ENCRYPTION_BUFFER, *PENCRYPTION_BUFFER;
3988
3989 #define FILE_SET_ENCRYPTION 0x00000001
3990 #define FILE_CLEAR_ENCRYPTION 0x00000002
3991 #define STREAM_SET_ENCRYPTION 0x00000003
3992 #define STREAM_CLEAR_ENCRYPTION 0x00000004
3993
3994 #define MAXIMUM_ENCRYPTION_VALUE 0x00000004
3995
3996 typedef struct _DECRYPTION_STATUS_BUFFER {
3997 BOOLEAN NoEncryptedStreams;
3998 } DECRYPTION_STATUS_BUFFER, *PDECRYPTION_STATUS_BUFFER;
3999
4000 #define ENCRYPTION_FORMAT_DEFAULT (0x01)
4001
4002 #define COMPRESSION_FORMAT_SPARSE (0x4000)
4003
4004 typedef struct _REQUEST_RAW_ENCRYPTED_DATA {
4005 LONGLONG FileOffset;
4006 ULONG Length;
4007 } REQUEST_RAW_ENCRYPTED_DATA, *PREQUEST_RAW_ENCRYPTED_DATA;
4008
4009 typedef struct _ENCRYPTED_DATA_INFO {
4010 ULONGLONG StartingFileOffset;
4011 ULONG OutputBufferOffset;
4012 ULONG BytesWithinFileSize;
4013 ULONG BytesWithinValidDataLength;
4014 USHORT CompressionFormat;
4015 UCHAR DataUnitShift;
4016 UCHAR ChunkShift;
4017 UCHAR ClusterShift;
4018 UCHAR EncryptionFormat;
4019 USHORT NumberOfDataBlocks;
4020 ULONG DataBlockSize[ANYSIZE_ARRAY];
4021 } ENCRYPTED_DATA_INFO, *PENCRYPTED_DATA_INFO;
4022
4023 typedef struct _PLEX_READ_DATA_REQUEST {
4024 LARGE_INTEGER ByteOffset;
4025 ULONG ByteLength;
4026 ULONG PlexNumber;
4027 } PLEX_READ_DATA_REQUEST, *PPLEX_READ_DATA_REQUEST;
4028
4029 typedef struct _SI_COPYFILE {
4030 ULONG SourceFileNameLength;
4031 ULONG DestinationFileNameLength;
4032 ULONG Flags;
4033 WCHAR FileNameBuffer[1];
4034 } SI_COPYFILE, *PSI_COPYFILE;
4035
4036 #define COPYFILE_SIS_LINK 0x0001
4037 #define COPYFILE_SIS_REPLACE 0x0002
4038 #define COPYFILE_SIS_FLAGS 0x0003
4039
4040 #endif /* (_WIN32_WINNT >= 0x0500) */
4041
4042 #if (_WIN32_WINNT >= 0x0600)
4043
4044 typedef struct _FILE_MAKE_COMPATIBLE_BUFFER {
4045 BOOLEAN CloseDisc;
4046 } FILE_MAKE_COMPATIBLE_BUFFER, *PFILE_MAKE_COMPATIBLE_BUFFER;
4047
4048 typedef struct _FILE_SET_DEFECT_MGMT_BUFFER {
4049 BOOLEAN Disable;
4050 } FILE_SET_DEFECT_MGMT_BUFFER, *PFILE_SET_DEFECT_MGMT_BUFFER;
4051
4052 typedef struct _FILE_QUERY_SPARING_BUFFER {
4053 ULONG SparingUnitBytes;
4054 BOOLEAN SoftwareSparing;
4055 ULONG TotalSpareBlocks;
4056 ULONG FreeSpareBlocks;
4057 } FILE_QUERY_SPARING_BUFFER, *PFILE_QUERY_SPARING_BUFFER;
4058
4059 typedef struct _FILE_QUERY_ON_DISK_VOL_INFO_BUFFER {
4060 LARGE_INTEGER DirectoryCount;
4061 LARGE_INTEGER FileCount;
4062 USHORT FsFormatMajVersion;
4063 USHORT FsFormatMinVersion;
4064 WCHAR FsFormatName[12];
4065 LARGE_INTEGER FormatTime;
4066 LARGE_INTEGER LastUpdateTime;
4067 WCHAR CopyrightInfo[34];
4068 WCHAR AbstractInfo[34];
4069 WCHAR FormattingImplementationInfo[34];
4070 WCHAR LastModifyingImplementationInfo[34];
4071 } FILE_QUERY_ON_DISK_VOL_INFO_BUFFER, *PFILE_QUERY_ON_DISK_VOL_INFO_BUFFER;
4072
4073 #define SET_REPAIR_ENABLED (0x00000001)
4074 #define SET_REPAIR_VOLUME_BITMAP_SCAN (0x00000002)
4075 #define SET_REPAIR_DELETE_CROSSLINK (0x00000004)
4076 #define SET_REPAIR_WARN_ABOUT_DATA_LOSS (0x00000008)
4077 #define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT (0x00000010)
4078 #define SET_REPAIR_VALID_MASK (0x0000001F)
4079
4080 typedef enum _SHRINK_VOLUME_REQUEST_TYPES {
4081 ShrinkPrepare = 1,
4082 ShrinkCommit,
4083 ShrinkAbort
4084 } SHRINK_VOLUME_REQUEST_TYPES, *PSHRINK_VOLUME_REQUEST_TYPES;
4085
4086 typedef struct _SHRINK_VOLUME_INFORMATION {
4087 SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType;
4088 ULONGLONG Flags;
4089 LONGLONG NewNumberOfSectors;
4090 } SHRINK_VOLUME_INFORMATION, *PSHRINK_VOLUME_INFORMATION;
4091
4092 #define TXFS_RM_FLAG_LOGGING_MODE 0x00000001
4093 #define TXFS_RM_FLAG_RENAME_RM 0x00000002
4094 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000004
4095 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000008
4096 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000010
4097 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000020
4098 #define TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000040
4099 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000080
4100 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000100
4101 #define TXFS_RM_FLAG_GROW_LOG 0x00000400
4102 #define TXFS_RM_FLAG_SHRINK_LOG 0x00000800
4103 #define TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE 0x00001000
4104 #define TXFS_RM_FLAG_PRESERVE_CHANGES 0x00002000
4105 #define TXFS_RM_FLAG_RESET_RM_AT_NEXT_START 0x00004000
4106 #define TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START 0x00008000
4107 #define TXFS_RM_FLAG_PREFER_CONSISTENCY 0x00010000
4108 #define TXFS_RM_FLAG_PREFER_AVAILABILITY 0x00020000
4109
4110 #define TXFS_LOGGING_MODE_SIMPLE (0x0001)
4111 #define TXFS_LOGGING_MODE_FULL (0x0002)
4112
4113 #define TXFS_TRANSACTION_STATE_NONE 0x00
4114 #define TXFS_TRANSACTION_STATE_ACTIVE 0x01
4115 #define TXFS_TRANSACTION_STATE_PREPARED 0x02
4116 #define TXFS_TRANSACTION_STATE_NOTACTIVE 0x03
4117
4118 #define TXFS_MODIFY_RM_VALID_FLAGS (TXFS_RM_FLAG_LOGGING_MODE | \
4119 TXFS_RM_FLAG_RENAME_RM | \
4120 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \
4121 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \
4122 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
4123 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
4124 TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \
4125 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
4126 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
4127 TXFS_RM_FLAG_SHRINK_LOG | \
4128 TXFS_RM_FLAG_GROW_LOG | \
4129 TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE | \
4130 TXFS_RM_FLAG_PRESERVE_CHANGES | \
4131 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
4132 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
4133 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
4134 TXFS_RM_FLAG_PREFER_AVAILABILITY)
4135
4136 typedef struct _TXFS_MODIFY_RM {
4137 ULONG Flags;
4138 ULONG LogContainerCountMax;
4139 ULONG LogContainerCountMin;
4140 ULONG LogContainerCount;
4141 ULONG LogGrowthIncrement;
4142 ULONG LogAutoShrinkPercentage;
4143 ULONGLONG Reserved;
4144 USHORT LoggingMode;
4145 } TXFS_MODIFY_RM, *PTXFS_MODIFY_RM;
4146
4147 #define TXFS_RM_STATE_NOT_STARTED 0
4148 #define TXFS_RM_STATE_STARTING 1
4149 #define TXFS_RM_STATE_ACTIVE 2
4150 #define TXFS_RM_STATE_SHUTTING_DOWN 3
4151
4152 #define TXFS_QUERY_RM_INFORMATION_VALID_FLAGS \
4153 (TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
4154 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
4155 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
4156 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
4157 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
4158 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
4159 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
4160 TXFS_RM_FLAG_PREFER_AVAILABILITY)
4161
4162 typedef struct _TXFS_QUERY_RM_INFORMATION {
4163 ULONG BytesRequired;
4164 ULONGLONG TailLsn;
4165 ULONGLONG CurrentLsn;
4166 ULONGLONG ArchiveTailLsn;
4167 ULONGLONG LogContainerSize;
4168 LARGE_INTEGER HighestVirtualClock;
4169 ULONG LogContainerCount;
4170 ULONG LogContainerCountMax;
4171 ULONG LogContainerCountMin;
4172 ULONG LogGrowthIncrement;
4173 ULONG LogAutoShrinkPercentage;
4174 ULONG Flags;
4175 USHORT LoggingMode;
4176 USHORT Reserved;
4177 ULONG RmState;
4178 ULONGLONG LogCapacity;
4179 ULONGLONG LogFree;
4180 ULONGLONG TopsSize;
4181 ULONGLONG TopsUsed;
4182 ULONGLONG TransactionCount;
4183 ULONGLONG OnePCCount;
4184 ULONGLONG TwoPCCount;
4185 ULONGLONG NumberLogFileFull;
4186 ULONGLONG OldestTransactionAge;
4187 GUID RMName;
4188 ULONG TmLogPathOffset;
4189 } TXFS_QUERY_RM_INFORMATION, *PTXFS_QUERY_RM_INFORMATION;
4190
4191 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN 0x01
4192 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK 0x02
4193
4194 #define TXFS_ROLLFORWARD_REDO_VALID_FLAGS \
4195 (TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN | \
4196 TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK)
4197
4198 typedef struct _TXFS_ROLLFORWARD_REDO_INFORMATION {
4199 LARGE_INTEGER LastVirtualClock;
4200 ULONGLONG LastRedoLsn;
4201 ULONGLONG HighestRecoveryLsn;
4202 ULONG Flags;
4203 } TXFS_ROLLFORWARD_REDO_INFORMATION, *PTXFS_ROLLFORWARD_REDO_INFORMATION;
4204
4205 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000001
4206 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000002
4207 #define TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE 0x00000004
4208 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000008
4209 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000010
4210 #define TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000020
4211 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000040
4212 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000080
4213
4214 #define TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT 0x00000200
4215 #define TXFS_START_RM_FLAG_LOGGING_MODE 0x00000400
4216 #define TXFS_START_RM_FLAG_PRESERVE_CHANGES 0x00000800
4217
4218 #define TXFS_START_RM_FLAG_PREFER_CONSISTENCY 0x00001000
4219 #define TXFS_START_RM_FLAG_PREFER_AVAILABILITY 0x00002000
4220
4221 #define TXFS_START_RM_VALID_FLAGS \
4222 (TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \
4223 TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \
4224 TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE | \
4225 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
4226 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
4227 TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \
4228 TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT | \
4229 TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
4230 TXFS_START_RM_FLAG_LOGGING_MODE | \
4231 TXFS_START_RM_FLAG_PRESERVE_CHANGES | \
4232 TXFS_START_RM_FLAG_PREFER_CONSISTENCY | \
4233 TXFS_START_RM_FLAG_PREFER_AVAILABILITY)
4234
4235 typedef struct _TXFS_START_RM_INFORMATION {
4236 ULONG Flags;
4237 ULONGLONG LogContainerSize;
4238 ULONG LogContainerCountMin;
4239 ULONG LogContainerCountMax;
4240 ULONG LogGrowthIncrement;
4241 ULONG LogAutoShrinkPercentage;
4242 ULONG TmLogPathOffset;
4243 USHORT TmLogPathLength;
4244 USHORT LoggingMode;
4245 USHORT LogPathLength;
4246 USHORT Reserved;
4247 WCHAR LogPath[1];
4248 } TXFS_START_RM_INFORMATION, *PTXFS_START_RM_INFORMATION;
4249
4250 typedef struct _TXFS_GET_METADATA_INFO_OUT {
4251 struct {
4252 LONGLONG LowPart;
4253 LONGLONG HighPart;
4254 } TxfFileId;
4255 GUID LockingTransaction;
4256 ULONGLONG LastLsn;
4257 ULONG TransactionState;
4258 } TXFS_GET_METADATA_INFO_OUT, *PTXFS_GET_METADATA_INFO_OUT;
4259
4260 #define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_CREATED 0x00000001
4261 #define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_DELETED 0x00000002
4262
4263 typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY {
4264 ULONGLONG Offset;
4265 ULONG NameFlags;
4266 LONGLONG FileId;
4267 ULONG Reserved1;
4268 ULONG Reserved2;
4269 LONGLONG Reserved3;
4270 WCHAR FileName[1];
4271 } TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY, *PTXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY;
4272
4273 typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES {
4274 GUID KtmTransaction;
4275 ULONGLONG NumberOfFiles;
4276 ULONGLONG BufferSizeRequired;
4277 ULONGLONG Offset;
4278 } TXFS_LIST_TRANSACTION_LOCKED_FILES, *PTXFS_LIST_TRANSACTION_LOCKED_FILES;
4279
4280 typedef struct _TXFS_LIST_TRANSACTIONS_ENTRY {
4281 GUID TransactionId;
4282 ULONG TransactionState;
4283 ULONG Reserved1;
4284 ULONG Reserved2;
4285 LONGLONG Reserved3;
4286 } TXFS_LIST_TRANSACTIONS_ENTRY, *PTXFS_LIST_TRANSACTIONS_ENTRY;
4287
4288 typedef struct _TXFS_LIST_TRANSACTIONS {
4289 ULONGLONG NumberOfTransactions;
4290 ULONGLONG BufferSizeRequired;
4291 } TXFS_LIST_TRANSACTIONS, *PTXFS_LIST_TRANSACTIONS;
4292
4293 typedef struct _TXFS_READ_BACKUP_INFORMATION_OUT {
4294 _ANONYMOUS_UNION union {
4295 ULONG BufferLength;
4296 UCHAR Buffer[1];
4297 } DUMMYUNIONNAME;
4298 } TXFS_READ_BACKUP_INFORMATION_OUT, *PTXFS_READ_BACKUP_INFORMATION_OUT;
4299
4300 typedef struct _TXFS_WRITE_BACKUP_INFORMATION {
4301 UCHAR Buffer[1];
4302 } TXFS_WRITE_BACKUP_INFORMATION, *PTXFS_WRITE_BACKUP_INFORMATION;
4303
4304 #define TXFS_TRANSACTED_VERSION_NONTRANSACTED 0xFFFFFFFE
4305 #define TXFS_TRANSACTED_VERSION_UNCOMMITTED 0xFFFFFFFF
4306
4307 typedef struct _TXFS_GET_TRANSACTED_VERSION {
4308 ULONG ThisBaseVersion;
4309 ULONG LatestVersion;
4310 USHORT ThisMiniVersion;
4311 USHORT FirstMiniVersion;
4312 USHORT LatestMiniVersion;
4313 } TXFS_GET_TRANSACTED_VERSION, *PTXFS_GET_TRANSACTED_VERSION;
4314
4315 #define TXFS_SAVEPOINT_SET 0x00000001
4316 #define TXFS_SAVEPOINT_ROLLBACK 0x00000002
4317 #define TXFS_SAVEPOINT_CLEAR 0x00000004
4318 #define TXFS_SAVEPOINT_CLEAR_ALL 0x00000010
4319
4320 typedef struct _TXFS_SAVEPOINT_INFORMATION {
4321 HANDLE KtmTransaction;
4322 ULONG ActionCode;
4323 ULONG SavepointId;
4324 } TXFS_SAVEPOINT_INFORMATION, *PTXFS_SAVEPOINT_INFORMATION;
4325
4326 typedef struct _TXFS_CREATE_MINIVERSION_INFO {
4327 USHORT StructureVersion;
4328 USHORT StructureLength;
4329 ULONG BaseVersion;
4330 USHORT MiniVersion;
4331 } TXFS_CREATE_MINIVERSION_INFO, *PTXFS_CREATE_MINIVERSION_INFO;
4332
4333 typedef struct _TXFS_TRANSACTION_ACTIVE_INFO {
4334 BOOLEAN TransactionsActiveAtSnapshot;
4335 } TXFS_TRANSACTION_ACTIVE_INFO, *PTXFS_TRANSACTION_ACTIVE_INFO;
4336
4337 #endif /* (_WIN32_WINNT >= 0x0600) */
4338
4339 #if (_WIN32_WINNT >= 0x0601)
4340
4341 #define MARK_HANDLE_REALTIME (0x00000020)
4342 #define MARK_HANDLE_NOT_REALTIME (0x00000040)
4343
4344 #define NO_8DOT3_NAME_PRESENT (0x00000001)
4345 #define REMOVED_8DOT3_NAME (0x00000002)
4346
4347 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED (0x00000001)
4348
4349 typedef struct _BOOT_AREA_INFO {
4350 ULONG BootSectorCount;
4351 struct {
4352 LARGE_INTEGER Offset;
4353 } BootSectors[2];
4354 } BOOT_AREA_INFO, *PBOOT_AREA_INFO;
4355
4356 typedef struct _RETRIEVAL_POINTER_BASE {
4357 LARGE_INTEGER FileAreaOffset;
4358 } RETRIEVAL_POINTER_BASE, *PRETRIEVAL_POINTER_BASE;
4359
4360 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION {
4361 ULONG VolumeFlags;
4362 ULONG FlagMask;
4363 ULONG Version;
4364 ULONG Reserved;
4365 } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION;
4366
4367 typedef struct _FILE_SYSTEM_RECOGNITION_INFORMATION {
4368 CHAR FileSystem[9];
4369 } FILE_SYSTEM_RECOGNITION_INFORMATION, *PFILE_SYSTEM_RECOGNITION_INFORMATION;
4370
4371 #define OPLOCK_LEVEL_CACHE_READ (0x00000001)
4372 #define OPLOCK_LEVEL_CACHE_HANDLE (0x00000002)
4373 #define OPLOCK_LEVEL_CACHE_WRITE (0x00000004)
4374
4375 #define REQUEST_OPLOCK_INPUT_FLAG_REQUEST (0x00000001)
4376 #define REQUEST_OPLOCK_INPUT_FLAG_ACK (0x00000002)
4377 #define REQUEST_OPLOCK_INPUT_FLAG_COMPLETE_ACK_ON_CLOSE (0x00000004)
4378
4379 #define REQUEST_OPLOCK_CURRENT_VERSION 1
4380
4381 typedef struct _REQUEST_OPLOCK_INPUT_BUFFER {
4382 USHORT StructureVersion;
4383 USHORT StructureLength;
4384 ULONG RequestedOplockLevel;
4385 ULONG Flags;
4386 } REQUEST_OPLOCK_INPUT_BUFFER, *PREQUEST_OPLOCK_INPUT_BUFFER;
4387
4388 #define REQUEST_OPLOCK_OUTPUT_FLAG_ACK_REQUIRED (0x00000001)
4389 #define REQUEST_OPLOCK_OUTPUT_FLAG_MODES_PROVIDED (0x00000002)
4390
4391 typedef struct _REQUEST_OPLOCK_OUTPUT_BUFFER {
4392 USHORT StructureVersion;
4393 USHORT StructureLength;
4394 ULONG OriginalOplockLevel;
4395 ULONG NewOplockLevel;
4396 ULONG Flags;
4397 ACCESS_MASK AccessMode;
4398 USHORT ShareMode;
4399 } REQUEST_OPLOCK_OUTPUT_BUFFER, *PREQUEST_OPLOCK_OUTPUT_BUFFER;
4400
4401 #define SD_GLOBAL_CHANGE_TYPE_MACHINE_SID 1
4402
4403 typedef struct _SD_CHANGE_MACHINE_SID_INPUT {
4404 USHORT CurrentMachineSIDOffset;
4405 USHORT CurrentMachineSIDLength;
4406 USHORT NewMachineSIDOffset;
4407 USHORT NewMachineSIDLength;
4408 } SD_CHANGE_MACHINE_SID_INPUT, *PSD_CHANGE_MACHINE_SID_INPUT;
4409
4410 typedef struct _SD_CHANGE_MACHINE_SID_OUTPUT {
4411 ULONGLONG NumSDChangedSuccess;
4412 ULONGLONG NumSDChangedFail;
4413 ULONGLONG NumSDUnused;
4414 ULONGLONG NumSDTotal;
4415 ULONGLONG NumMftSDChangedSuccess;
4416 ULONGLONG NumMftSDChangedFail;
4417 ULONGLONG NumMftSDTotal;
4418 } SD_CHANGE_MACHINE_SID_OUTPUT, *PSD_CHANGE_MACHINE_SID_OUTPUT;
4419
4420 typedef struct _SD_GLOBAL_CHANGE_INPUT {
4421 ULONG Flags;
4422 ULONG ChangeType;
4423 _ANONYMOUS_UNION union {
4424 SD_CHANGE_MACHINE_SID_INPUT SdChange;
4425 } DUMMYUNIONNAME;
4426 } SD_GLOBAL_CHANGE_INPUT, *PSD_GLOBAL_CHANGE_INPUT;
4427
4428 typedef struct _SD_GLOBAL_CHANGE_OUTPUT {
4429 ULONG Flags;
4430 ULONG ChangeType;
4431 _ANONYMOUS_UNION union {
4432 SD_CHANGE_MACHINE_SID_OUTPUT SdChange;
4433 } DUMMYUNIONNAME;
4434 } SD_GLOBAL_CHANGE_OUTPUT, *PSD_GLOBAL_CHANGE_OUTPUT;
4435
4436 #define ENCRYPTED_DATA_INFO_SPARSE_FILE 1
4437
4438 typedef struct _EXTENDED_ENCRYPTED_DATA_INFO {
4439 ULONG ExtendedCode;
4440 ULONG Length;
4441 ULONG Flags;
4442 ULONG Reserved;
4443 } EXTENDED_ENCRYPTED_DATA_INFO, *PEXTENDED_ENCRYPTED_DATA_INFO;
4444
4445 typedef struct _LOOKUP_STREAM_FROM_CLUSTER_INPUT {
4446 ULONG Flags;
4447 ULONG NumberOfClusters;
4448 LARGE_INTEGER Cluster[1];
4449 } LOOKUP_STREAM_FROM_CLUSTER_INPUT, *PLOOKUP_STREAM_FROM_CLUSTER_INPUT;
4450
4451 typedef struct _LOOKUP_STREAM_FROM_CLUSTER_OUTPUT {
4452 ULONG Offset;
4453 ULONG NumberOfMatches;