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