[NTIFS]
[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 DEVICE_TYPE ULONG
2418
2419 #define CTL_CODE(DeviceType, Function, Method, Access) \
2420 (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
2421
2422 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
2423
2424 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
2425
2426 #define METHOD_BUFFERED 0
2427 #define METHOD_IN_DIRECT 1
2428 #define METHOD_OUT_DIRECT 2
2429 #define METHOD_NEITHER 3
2430 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2431 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2432
2433 #define FILE_ANY_ACCESS 0x00000000
2434 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
2435 #define FILE_READ_ACCESS 0x00000001
2436 #define FILE_WRITE_ACCESS 0x00000002
2437
2438 typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
2439
2440 typedef enum _SECURITY_LOGON_TYPE {
2441 UndefinedLogonType = 0,
2442 Interactive = 2,
2443 Network,
2444 Batch,
2445 Service,
2446 Proxy,
2447 Unlock,
2448 NetworkCleartext,
2449 NewCredentials,
2450 #if (_WIN32_WINNT >= 0x0501)
2451 RemoteInteractive,
2452 CachedInteractive,
2453 #endif
2454 #if (_WIN32_WINNT >= 0x0502)
2455 CachedRemoteInteractive,
2456 CachedUnlock
2457 #endif
2458 } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
2459
2460 #ifndef _NTLSA_AUDIT_
2461 #define _NTLSA_AUDIT_
2462
2463 #ifndef GUID_DEFINED
2464 #include <guiddef.h>
2465 #endif
2466
2467 #endif /* _NTLSA_AUDIT_ */
2468
2469 NTSTATUS
2470 NTAPI
2471 LsaRegisterLogonProcess(
2472 IN PLSA_STRING LogonProcessName,
2473 OUT PHANDLE LsaHandle,
2474 OUT PLSA_OPERATIONAL_MODE SecurityMode);
2475
2476 NTSTATUS
2477 NTAPI
2478 LsaLogonUser(
2479 IN HANDLE LsaHandle,
2480 IN PLSA_STRING OriginName,
2481 IN SECURITY_LOGON_TYPE LogonType,
2482 IN ULONG AuthenticationPackage,
2483 IN PVOID AuthenticationInformation,
2484 IN ULONG AuthenticationInformationLength,
2485 IN PTOKEN_GROUPS LocalGroups OPTIONAL,
2486 IN PTOKEN_SOURCE SourceContext,
2487 OUT PVOID *ProfileBuffer,
2488 OUT PULONG ProfileBufferLength,
2489 OUT PLUID LogonId,
2490 OUT PHANDLE Token,
2491 OUT PQUOTA_LIMITS Quotas,
2492 OUT PNTSTATUS SubStatus);
2493
2494 NTSTATUS
2495 NTAPI
2496 LsaFreeReturnBuffer(
2497 IN PVOID Buffer);
2498
2499 #ifndef _NTLSA_IFS_
2500 #define _NTLSA_IFS_
2501 #endif
2502
2503 #define MSV1_0_PACKAGE_NAME "MICROSOFT_AUTHENTICATION_PACKAGE_V1_0"
2504 #define MSV1_0_PACKAGE_NAMEW L"MICROSOFT_AUTHENTICATION_PACKAGE_V1_0"
2505 #define MSV1_0_PACKAGE_NAMEW_LENGTH sizeof(MSV1_0_PACKAGE_NAMEW) - sizeof(WCHAR)
2506
2507 #define MSV1_0_SUBAUTHENTICATION_KEY "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0"
2508 #define MSV1_0_SUBAUTHENTICATION_VALUE "Auth"
2509
2510 #define MSV1_0_CHALLENGE_LENGTH 8
2511 #define MSV1_0_USER_SESSION_KEY_LENGTH 16
2512 #define MSV1_0_LANMAN_SESSION_KEY_LENGTH 8
2513
2514 #define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED 0x02
2515 #define MSV1_0_UPDATE_LOGON_STATISTICS 0x04
2516 #define MSV1_0_RETURN_USER_PARAMETERS 0x08
2517 #define MSV1_0_DONT_TRY_GUEST_ACCOUNT 0x10
2518 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x20
2519 #define MSV1_0_RETURN_PASSWORD_EXPIRY 0x40
2520 #define MSV1_0_USE_CLIENT_CHALLENGE 0x80
2521 #define MSV1_0_TRY_GUEST_ACCOUNT_ONLY 0x100
2522 #define MSV1_0_RETURN_PROFILE_PATH 0x200
2523 #define MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY 0x400
2524 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x800
2525
2526 #define MSV1_0_DISABLE_PERSONAL_FALLBACK 0x00001000
2527 #define MSV1_0_ALLOW_FORCE_GUEST 0x00002000
2528
2529 #if (_WIN32_WINNT >= 0x0502)
2530 #define MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED 0x00004000
2531 #define MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY 0x00008000
2532 #endif
2533
2534 #define MSV1_0_SUBAUTHENTICATION_DLL_EX 0x00100000
2535 #define MSV1_0_ALLOW_MSVCHAPV2 0x00010000
2536
2537 #if (_WIN32_WINNT >= 0x0600)
2538 #define MSV1_0_S4U2SELF 0x00020000
2539 #define MSV1_0_CHECK_LOGONHOURS_FOR_S4U 0x00040000
2540 #endif
2541
2542 #define MSV1_0_SUBAUTHENTICATION_DLL 0xFF000000
2543 #define MSV1_0_SUBAUTHENTICATION_DLL_SHIFT 24
2544 #define MSV1_0_MNS_LOGON 0x01000000
2545
2546 #define MSV1_0_SUBAUTHENTICATION_DLL_RAS 2
2547 #define MSV1_0_SUBAUTHENTICATION_DLL_IIS 132
2548
2549 #define LOGON_GUEST 0x01
2550 #define LOGON_NOENCRYPTION 0x02
2551 #define LOGON_CACHED_ACCOUNT 0x04
2552 #define LOGON_USED_LM_PASSWORD 0x08
2553 #define LOGON_EXTRA_SIDS 0x20
2554 #define LOGON_SUBAUTH_SESSION_KEY 0x40
2555 #define LOGON_SERVER_TRUST_ACCOUNT 0x80
2556 #define LOGON_NTLMV2_ENABLED 0x100
2557 #define LOGON_RESOURCE_GROUPS 0x200
2558 #define LOGON_PROFILE_PATH_RETURNED 0x400
2559 #define LOGON_NT_V2 0x800
2560 #define LOGON_LM_V2 0x1000
2561 #define LOGON_NTLM_V2 0x2000
2562
2563 #if (_WIN32_WINNT >= 0x0600)
2564
2565 #define LOGON_OPTIMIZED 0x4000
2566 #define LOGON_WINLOGON 0x8000
2567 #define LOGON_PKINIT 0x10000
2568 #define LOGON_NO_OPTIMIZED 0x20000
2569
2570 #endif
2571
2572 #define MSV1_0_SUBAUTHENTICATION_FLAGS 0xFF000000
2573
2574 #define LOGON_GRACE_LOGON 0x01000000
2575
2576 #define MSV1_0_OWF_PASSWORD_LENGTH 16
2577 #define MSV1_0_CRED_LM_PRESENT 0x1
2578 #define MSV1_0_CRED_NT_PRESENT 0x2
2579 #define MSV1_0_CRED_VERSION 0
2580
2581 #define MSV1_0_NTLM3_RESPONSE_LENGTH 16
2582 #define MSV1_0_NTLM3_OWF_LENGTH 16
2583
2584 #if (_WIN32_WINNT == 0x0500)
2585 #define MSV1_0_MAX_NTLM3_LIFE 1800
2586 #else
2587 #define MSV1_0_MAX_NTLM3_LIFE 129600
2588 #endif
2589 #define MSV1_0_MAX_AVL_SIZE 64000
2590
2591 #if (_WIN32_WINNT >= 0x0501)
2592
2593 #define MSV1_0_AV_FLAG_FORCE_GUEST 0x00000001
2594
2595 #if (_WIN32_WINNT >= 0x0600)
2596 #define MSV1_0_AV_FLAG_MIC_HANDSHAKE_MESSAGES 0x00000002
2597 #endif
2598
2599 #endif
2600
2601 #define MSV1_0_NTLM3_INPUT_LENGTH (sizeof(MSV1_0_NTLM3_RESPONSE) - MSV1_0_NTLM3_RESPONSE_LENGTH)
2602
2603 #if(_WIN32_WINNT >= 0x0502)
2604 #define MSV1_0_NTLM3_MIN_NT_RESPONSE_LENGTH RTL_SIZEOF_THROUGH_FIELD(MSV1_0_NTLM3_RESPONSE, AvPairsOff)
2605 #endif
2606
2607 #define USE_PRIMARY_PASSWORD 0x01
2608 #define RETURN_PRIMARY_USERNAME 0x02
2609 #define RETURN_PRIMARY_LOGON_DOMAINNAME 0x04
2610 #define RETURN_NON_NT_USER_SESSION_KEY 0x08
2611 #define GENERATE_CLIENT_CHALLENGE 0x10
2612 #define GCR_NTLM3_PARMS 0x20
2613 #define GCR_TARGET_INFO 0x40
2614 #define RETURN_RESERVED_PARAMETER 0x80
2615 #define GCR_ALLOW_NTLM 0x100
2616 #define GCR_USE_OEM_SET 0x200
2617 #define GCR_MACHINE_CREDENTIAL 0x400
2618 #define GCR_USE_OWF_PASSWORD 0x800
2619 #define GCR_ALLOW_LM 0x1000
2620 #define GCR_ALLOW_NO_TARGET 0x2000
2621
2622 typedef enum _MSV1_0_LOGON_SUBMIT_TYPE {
2623 MsV1_0InteractiveLogon = 2,
2624 MsV1_0Lm20Logon,
2625 MsV1_0NetworkLogon,
2626 MsV1_0SubAuthLogon,
2627 MsV1_0WorkstationUnlockLogon = 7,
2628 MsV1_0S4ULogon = 12,
2629 MsV1_0VirtualLogon = 82
2630 } MSV1_0_LOGON_SUBMIT_TYPE, *PMSV1_0_LOGON_SUBMIT_TYPE;
2631
2632 typedef enum _MSV1_0_PROFILE_BUFFER_TYPE {
2633 MsV1_0InteractiveProfile = 2,
2634 MsV1_0Lm20LogonProfile,
2635 MsV1_0SmartCardProfile
2636 } MSV1_0_PROFILE_BUFFER_TYPE, *PMSV1_0_PROFILE_BUFFER_TYPE;
2637
2638 typedef struct _MSV1_0_INTERACTIVE_LOGON {
2639 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2640 UNICODE_STRING LogonDomainName;
2641 UNICODE_STRING UserName;
2642 UNICODE_STRING Password;
2643 } MSV1_0_INTERACTIVE_LOGON, *PMSV1_0_INTERACTIVE_LOGON;
2644
2645 typedef struct _MSV1_0_INTERACTIVE_PROFILE {
2646 MSV1_0_PROFILE_BUFFER_TYPE MessageType;
2647 USHORT LogonCount;
2648 USHORT BadPasswordCount;
2649 LARGE_INTEGER LogonTime;
2650 LARGE_INTEGER LogoffTime;
2651 LARGE_INTEGER KickOffTime;
2652 LARGE_INTEGER PasswordLastSet;
2653 LARGE_INTEGER PasswordCanChange;
2654 LARGE_INTEGER PasswordMustChange;
2655 UNICODE_STRING LogonScript;
2656 UNICODE_STRING HomeDirectory;
2657 UNICODE_STRING FullName;
2658 UNICODE_STRING ProfilePath;
2659 UNICODE_STRING HomeDirectoryDrive;
2660 UNICODE_STRING LogonServer;
2661 ULONG UserFlags;
2662 } MSV1_0_INTERACTIVE_PROFILE, *PMSV1_0_INTERACTIVE_PROFILE;
2663
2664 typedef struct _MSV1_0_LM20_LOGON {
2665 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2666 UNICODE_STRING LogonDomainName;
2667 UNICODE_STRING UserName;
2668 UNICODE_STRING Workstation;
2669 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2670 STRING CaseSensitiveChallengeResponse;
2671 STRING CaseInsensitiveChallengeResponse;
2672 ULONG ParameterControl;
2673 } MSV1_0_LM20_LOGON, * PMSV1_0_LM20_LOGON;
2674
2675 typedef struct _MSV1_0_SUBAUTH_LOGON {
2676 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2677 UNICODE_STRING LogonDomainName;
2678 UNICODE_STRING UserName;
2679 UNICODE_STRING Workstation;
2680 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2681 STRING AuthenticationInfo1;
2682 STRING AuthenticationInfo2;
2683 ULONG ParameterControl;
2684 ULONG SubAuthPackageId;
2685 } MSV1_0_SUBAUTH_LOGON, * PMSV1_0_SUBAUTH_LOGON;
2686
2687 #if (_WIN32_WINNT >= 0x0600)
2688
2689 #define MSV1_0_S4U_LOGON_FLAG_CHECK_LOGONHOURS 0x2
2690
2691 typedef struct _MSV1_0_S4U_LOGON {
2692 MSV1_0_LOGON_SUBMIT_TYPE MessageType;
2693 ULONG Flags;
2694 UNICODE_STRING UserPrincipalName;
2695 UNICODE_STRING DomainName;
2696 } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON;
2697
2698 #endif
2699
2700 typedef struct _MSV1_0_LM20_LOGON_PROFILE {
2701 MSV1_0_PROFILE_BUFFER_TYPE MessageType;
2702 LARGE_INTEGER KickOffTime;
2703 LARGE_INTEGER LogoffTime;
2704 ULONG UserFlags;
2705 UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH];
2706 UNICODE_STRING LogonDomainName;
2707 UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH];
2708 UNICODE_STRING LogonServer;
2709 UNICODE_STRING UserParameters;
2710 } MSV1_0_LM20_LOGON_PROFILE, * PMSV1_0_LM20_LOGON_PROFILE;
2711
2712 typedef struct _MSV1_0_SUPPLEMENTAL_CREDENTIAL {
2713 ULONG Version;
2714 ULONG Flags;
2715 UCHAR LmPassword[MSV1_0_OWF_PASSWORD_LENGTH];
2716 UCHAR NtPassword[MSV1_0_OWF_PASSWORD_LENGTH];
2717 } MSV1_0_SUPPLEMENTAL_CREDENTIAL, *PMSV1_0_SUPPLEMENTAL_CREDENTIAL;
2718
2719 typedef struct _MSV1_0_NTLM3_RESPONSE {
2720 UCHAR Response[MSV1_0_NTLM3_RESPONSE_LENGTH];
2721 UCHAR RespType;
2722 UCHAR HiRespType;
2723 USHORT Flags;
2724 ULONG MsgWord;
2725 ULONGLONG TimeStamp;
2726 UCHAR ChallengeFromClient[MSV1_0_CHALLENGE_LENGTH];
2727 ULONG AvPairsOff;
2728 UCHAR Buffer[1];
2729 } MSV1_0_NTLM3_RESPONSE, *PMSV1_0_NTLM3_RESPONSE;
2730
2731 typedef enum _MSV1_0_AVID {
2732 MsvAvEOL,
2733 MsvAvNbComputerName,
2734 MsvAvNbDomainName,
2735 MsvAvDnsComputerName,
2736 MsvAvDnsDomainName,
2737 #if (_WIN32_WINNT >= 0x0501)
2738 MsvAvDnsTreeName,
2739 MsvAvFlags,
2740 #if (_WIN32_WINNT >= 0x0600)
2741 MsvAvTimestamp,
2742 MsvAvRestrictions,
2743 MsvAvTargetName,
2744 MsvAvChannelBindings,
2745 #endif
2746 #endif
2747 } MSV1_0_AVID;
2748
2749 typedef struct _MSV1_0_AV_PAIR {
2750 USHORT AvId;
2751 USHORT AvLen;
2752 } MSV1_0_AV_PAIR, *PMSV1_0_AV_PAIR;
2753
2754 typedef enum _MSV1_0_PROTOCOL_MESSAGE_TYPE {
2755 MsV1_0Lm20ChallengeRequest = 0,
2756 MsV1_0Lm20GetChallengeResponse,
2757 MsV1_0EnumerateUsers,
2758 MsV1_0GetUserInfo,
2759 MsV1_0ReLogonUsers,
2760 MsV1_0ChangePassword,
2761 MsV1_0ChangeCachedPassword,
2762 MsV1_0GenericPassthrough,
2763 MsV1_0CacheLogon,
2764 MsV1_0SubAuth,
2765 MsV1_0DeriveCredential,
2766 MsV1_0CacheLookup,
2767 #if (_WIN32_WINNT >= 0x0501)
2768 MsV1_0SetProcessOption,
2769 #endif
2770 #if (_WIN32_WINNT >= 0x0600)
2771 MsV1_0ConfigLocalAliases,
2772 MsV1_0ClearCachedCredentials,
2773 #endif
2774 } MSV1_0_PROTOCOL_MESSAGE_TYPE, *PMSV1_0_PROTOCOL_MESSAGE_TYPE;
2775
2776 typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST {
2777 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2778 } MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST;
2779
2780 typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE {
2781 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2782 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2783 } MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE;
2784
2785 typedef struct _MSV1_0_GETCHALLENRESP_REQUEST_V1 {
2786 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2787 ULONG ParameterControl;
2788 LUID LogonId;
2789 UNICODE_STRING Password;
2790 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2791 } MSV1_0_GETCHALLENRESP_REQUEST_V1, *PMSV1_0_GETCHALLENRESP_REQUEST_V1;
2792
2793 typedef struct _MSV1_0_GETCHALLENRESP_REQUEST {
2794 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2795 ULONG ParameterControl;
2796 LUID LogonId;
2797 UNICODE_STRING Password;
2798 UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
2799 UNICODE_STRING UserName;
2800 UNICODE_STRING LogonDomainName;
2801 UNICODE_STRING ServerName;
2802 } MSV1_0_GETCHALLENRESP_REQUEST, *PMSV1_0_GETCHALLENRESP_REQUEST;
2803
2804 typedef struct _MSV1_0_GETCHALLENRESP_RESPONSE {
2805 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2806 STRING CaseSensitiveChallengeResponse;
2807 STRING CaseInsensitiveChallengeResponse;
2808 UNICODE_STRING UserName;
2809 UNICODE_STRING LogonDomainName;
2810 UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH];
2811 UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH];
2812 } MSV1_0_GETCHALLENRESP_RESPONSE, *PMSV1_0_GETCHALLENRESP_RESPONSE;
2813
2814 typedef struct _MSV1_0_ENUMUSERS_REQUEST {
2815 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2816 } MSV1_0_ENUMUSERS_REQUEST, *PMSV1_0_ENUMUSERS_REQUEST;
2817
2818 typedef struct _MSV1_0_ENUMUSERS_RESPONSE {
2819 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2820 ULONG NumberOfLoggedOnUsers;
2821 PLUID LogonIds;
2822 PULONG EnumHandles;
2823 } MSV1_0_ENUMUSERS_RESPONSE, *PMSV1_0_ENUMUSERS_RESPONSE;
2824
2825 typedef struct _MSV1_0_GETUSERINFO_REQUEST {
2826 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2827 LUID LogonId;
2828 } MSV1_0_GETUSERINFO_REQUEST, *PMSV1_0_GETUSERINFO_REQUEST;
2829
2830 typedef struct _MSV1_0_GETUSERINFO_RESPONSE {
2831 MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
2832 PSID UserSid;
2833 UNICODE_STRING UserName;
2834 UNICODE_STRING LogonDomainName;
2835 UNICODE_STRING LogonServer;
2836 SECURITY_LOGON_TYPE LogonType;
2837 } MSV1_0_GETUSERINFO_RESPONSE, *PMSV1_0_GETUSERINFO_RESPONSE;
2838
2839 #define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007
2840 #define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008
2841 #define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009
2842
2843 /* also in winnt.h */
2844 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
2845 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
2846 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
2847 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
2848 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
2849 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
2850 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
2851 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
2852 #define FILE_NOTIFY_CHANGE_EA 0x00000080
2853 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
2854 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
2855 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
2856 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
2857 #define FILE_NOTIFY_VALID_MASK 0x00000fff
2858
2859 #define FILE_ACTION_ADDED 0x00000001
2860 #define FILE_ACTION_REMOVED 0x00000002
2861 #define FILE_ACTION_MODIFIED 0x00000003
2862 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
2863 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
2864 #define FILE_ACTION_ADDED_STREAM 0x00000006
2865 #define FILE_ACTION_REMOVED_STREAM 0x00000007
2866 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
2867 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
2868 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
2869 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
2870 /* end winnt.h */
2871
2872 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
2873 #define FILE_PIPE_MESSAGE_TYPE 0x00000001
2874
2875 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
2876 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002
2877
2878 #define FILE_PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
2879 #define FILE_PIPE_REJECT_REMOTE_CLIENTS 0x00000002
2880 #define FILE_PIPE_TYPE_VALID_MASK 0x00000003
2881
2882 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
2883 #define FILE_PIPE_MESSAGE_MODE 0x00000001
2884
2885 #define FILE_PIPE_QUEUE_OPERATION 0x00000000
2886 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001
2887
2888 #define FILE_PIPE_INBOUND 0x00000000
2889 #define FILE_PIPE_OUTBOUND 0x00000001
2890 #define FILE_PIPE_FULL_DUPLEX 0x00000002
2891
2892 #define FILE_PIPE_DISCONNECTED_STATE 0x00000001
2893 #define FILE_PIPE_LISTENING_STATE 0x00000002
2894 #define FILE_PIPE_CONNECTED_STATE 0x00000003
2895 #define FILE_PIPE_CLOSING_STATE 0x00000004
2896
2897 #define FILE_PIPE_CLIENT_END 0x00000000
2898 #define FILE_PIPE_SERVER_END 0x00000001
2899
2900 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
2901 #define FILE_CASE_PRESERVED_NAMES 0x00000002
2902 #define FILE_UNICODE_ON_DISK 0x00000004
2903 #define FILE_PERSISTENT_ACLS 0x00000008
2904 #define FILE_FILE_COMPRESSION 0x00000010
2905 #define FILE_VOLUME_QUOTAS 0x00000020
2906 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
2907 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
2908 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
2909 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
2910 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
2911 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
2912 #define FILE_NAMED_STREAMS 0x00040000
2913 #define FILE_READ_ONLY_VOLUME 0x00080000
2914 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
2915 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
2916 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
2917 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
2918 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
2919 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
2920
2921 #define FILE_NEED_EA 0x00000080
2922
2923 #define FILE_EA_TYPE_BINARY 0xfffe
2924 #define FILE_EA_TYPE_ASCII 0xfffd
2925 #define FILE_EA_TYPE_BITMAP 0xfffb
2926 #define FILE_EA_TYPE_METAFILE 0xfffa
2927 #define FILE_EA_TYPE_ICON 0xfff9
2928 #define FILE_EA_TYPE_EA 0xffee
2929 #define FILE_EA_TYPE_MVMT 0xffdf
2930 #define FILE_EA_TYPE_MVST 0xffde
2931 #define FILE_EA_TYPE_ASN1 0xffdd
2932 #define FILE_EA_TYPE_FAMILY_IDS 0xff01
2933
2934 typedef struct _FILE_NOTIFY_INFORMATION {
2935 ULONG NextEntryOffset;
2936 ULONG Action;
2937 ULONG FileNameLength;
2938 WCHAR FileName[1];
2939 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
2940
2941 typedef struct _FILE_DIRECTORY_INFORMATION {
2942 ULONG NextEntryOffset;
2943 ULONG FileIndex;
2944 LARGE_INTEGER CreationTime;
2945 LARGE_INTEGER LastAccessTime;
2946 LARGE_INTEGER LastWriteTime;
2947 LARGE_INTEGER ChangeTime;
2948 LARGE_INTEGER EndOfFile;
2949 LARGE_INTEGER AllocationSize;
2950 ULONG FileAttributes;
2951 ULONG FileNameLength;
2952 WCHAR FileName[1];
2953 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
2954
2955 typedef struct _FILE_FULL_DIR_INFORMATION {
2956 ULONG NextEntryOffset;
2957 ULONG FileIndex;
2958 LARGE_INTEGER CreationTime;
2959 LARGE_INTEGER LastAccessTime;
2960 LARGE_INTEGER LastWriteTime;
2961 LARGE_INTEGER ChangeTime;
2962 LARGE_INTEGER EndOfFile;
2963 LARGE_INTEGER AllocationSize;
2964 ULONG FileAttributes;
2965 ULONG FileNameLength;
2966 ULONG EaSize;
2967 WCHAR FileName[1];
2968 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
2969
2970 typedef struct _FILE_ID_FULL_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 LARGE_INTEGER FileId;
2983 WCHAR FileName[1];
2984 } FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION;
2985
2986 typedef struct _FILE_BOTH_DIR_INFORMATION {
2987 ULONG NextEntryOffset;
2988 ULONG FileIndex;
2989 LARGE_INTEGER CreationTime;
2990 LARGE_INTEGER LastAccessTime;
2991 LARGE_INTEGER LastWriteTime;
2992 LARGE_INTEGER ChangeTime;
2993 LARGE_INTEGER EndOfFile;
2994 LARGE_INTEGER AllocationSize;
2995 ULONG FileAttributes;
2996 ULONG FileNameLength;
2997 ULONG EaSize;
2998 CCHAR ShortNameLength;
2999 WCHAR ShortName[12];
3000 WCHAR FileName[1];
3001 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
3002
3003 typedef struct _FILE_ID_BOTH_DIR_INFORMATION {
3004 ULONG NextEntryOffset;
3005 ULONG FileIndex;
3006 LARGE_INTEGER CreationTime;
3007 LARGE_INTEGER LastAccessTime;
3008 LARGE_INTEGER LastWriteTime;
3009 LARGE_INTEGER ChangeTime;
3010 LARGE_INTEGER EndOfFile;
3011 LARGE_INTEGER AllocationSize;
3012 ULONG FileAttributes;
3013 ULONG FileNameLength;
3014 ULONG EaSize;
3015 CCHAR ShortNameLength;
3016 WCHAR ShortName[12];
3017 LARGE_INTEGER FileId;
3018 WCHAR FileName[1];
3019 } FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
3020
3021 typedef struct _FILE_NAMES_INFORMATION {
3022 ULONG NextEntryOffset;
3023 ULONG FileIndex;
3024 ULONG FileNameLength;
3025 WCHAR FileName[1];
3026 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
3027
3028 typedef struct _FILE_ID_GLOBAL_TX_DIR_INFORMATION {
3029 ULONG NextEntryOffset;
3030 ULONG FileIndex;
3031 LARGE_INTEGER CreationTime;
3032 LARGE_INTEGER LastAccessTime;
3033 LARGE_INTEGER LastWriteTime;
3034 LARGE_INTEGER ChangeTime;
3035 LARGE_INTEGER EndOfFile;
3036 LARGE_INTEGER AllocationSize;
3037 ULONG FileAttributes;
3038 ULONG FileNameLength;
3039 LARGE_INTEGER FileId;
3040 GUID LockingTransactionId;
3041 ULONG TxInfoFlags;
3042 WCHAR FileName[1];
3043 } FILE_ID_GLOBAL_TX_DIR_INFORMATION, *PFILE_ID_GLOBAL_TX_DIR_INFORMATION;
3044
3045 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_WRITELOCKED 0x00000001
3046 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_TO_TX 0x00000002
3047 #define FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_OUTSIDE_TX 0x00000004
3048
3049 typedef struct _FILE_OBJECTID_INFORMATION {
3050 LONGLONG FileReference;
3051 UCHAR ObjectId[16];
3052 _ANONYMOUS_UNION union {
3053 __GNU_EXTENSION struct {
3054 UCHAR BirthVolumeId[16];
3055 UCHAR BirthObjectId[16];
3056 UCHAR DomainId[16];
3057 };
3058 UCHAR ExtendedInfo[48];
3059 } DUMMYUNIONNAME;
3060 } FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;
3061
3062 #define ANSI_DOS_STAR ('<')
3063 #define ANSI_DOS_QM ('>')
3064 #define ANSI_DOS_DOT ('"')
3065
3066 #define DOS_STAR (L'<')
3067 #define DOS_QM (L'>')
3068 #define DOS_DOT (L'"')
3069
3070 typedef struct _FILE_INTERNAL_INFORMATION {
3071 LARGE_INTEGER IndexNumber;
3072 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
3073
3074 typedef struct _FILE_EA_INFORMATION {
3075 ULONG EaSize;
3076 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
3077
3078 typedef struct _FILE_ACCESS_INFORMATION {
3079 ACCESS_MASK AccessFlags;
3080 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
3081
3082 typedef struct _FILE_MODE_INFORMATION {
3083 ULONG Mode;
3084 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
3085
3086 typedef struct _FILE_ALL_INFORMATION {
3087 FILE_BASIC_INFORMATION BasicInformation;
3088 FILE_STANDARD_INFORMATION StandardInformation;
3089 FILE_INTERNAL_INFORMATION InternalInformation;
3090 FILE_EA_INFORMATION EaInformation;
3091 FILE_ACCESS_INFORMATION AccessInformation;
3092 FILE_POSITION_INFORMATION PositionInformation;
3093 FILE_MODE_INFORMATION ModeInformation;
3094 FILE_ALIGNMENT_INFORMATION AlignmentInformation;
3095 FILE_NAME_INFORMATION NameInformation;
3096 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
3097
3098 typedef struct _FILE_ALLOCATION_INFORMATION {
3099 LARGE_INTEGER AllocationSize;
3100 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
3101
3102 typedef struct _FILE_COMPRESSION_INFORMATION {
3103 LARGE_INTEGER CompressedFileSize;
3104 USHORT CompressionFormat;
3105 UCHAR CompressionUnitShift;
3106 UCHAR ChunkShift;
3107 UCHAR ClusterShift;
3108 UCHAR Reserved[3];
3109 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
3110
3111 typedef struct _FILE_LINK_INFORMATION {
3112 BOOLEAN ReplaceIfExists;
3113 HANDLE RootDirectory;
3114 ULONG FileNameLength;
3115 WCHAR FileName[1];
3116 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
3117
3118 typedef struct _FILE_MOVE_CLUSTER_INFORMATION {
3119 ULONG ClusterCount;
3120 HANDLE RootDirectory;
3121 ULONG FileNameLength;
3122 WCHAR FileName[1];
3123 } FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION;
3124
3125 typedef struct _FILE_RENAME_INFORMATION {
3126 BOOLEAN ReplaceIfExists;
3127 HANDLE RootDirectory;
3128 ULONG FileNameLength;
3129 WCHAR FileName[1];
3130 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
3131
3132 typedef struct _FILE_STREAM_INFORMATION {
3133 ULONG NextEntryOffset;
3134 ULONG StreamNameLength;
3135 LARGE_INTEGER StreamSize;
3136 LARGE_INTEGER StreamAllocationSize;
3137 WCHAR StreamName[1];
3138 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
3139
3140 typedef struct _FILE_TRACKING_INFORMATION {
3141 HANDLE DestinationFile;
3142 ULONG ObjectInformationLength;
3143 CHAR ObjectInformation[1];
3144 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
3145
3146 typedef struct _FILE_COMPLETION_INFORMATION {
3147 HANDLE Port;
3148 PVOID Key;
3149 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
3150
3151 typedef struct _FILE_PIPE_INFORMATION {
3152 ULONG ReadMode;
3153 ULONG CompletionMode;
3154 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
3155
3156 typedef struct _FILE_PIPE_LOCAL_INFORMATION {
3157 ULONG NamedPipeType;
3158 ULONG NamedPipeConfiguration;
3159 ULONG MaximumInstances;
3160 ULONG CurrentInstances;
3161 ULONG InboundQuota;
3162 ULONG ReadDataAvailable;
3163 ULONG OutboundQuota;
3164 ULONG WriteQuotaAvailable;
3165 ULONG NamedPipeState;
3166 ULONG NamedPipeEnd;
3167 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
3168
3169 typedef struct _FILE_PIPE_REMOTE_INFORMATION {
3170 LARGE_INTEGER CollectDataTime;
3171 ULONG MaximumCollectionCount;
3172 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
3173
3174 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
3175 ULONG MaximumMessageSize;
3176 ULONG MailslotQuota;
3177 ULONG NextMessageSize;
3178 ULONG MessagesAvailable;
3179 LARGE_INTEGER ReadTimeout;
3180 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
3181
3182 typedef struct _FILE_MAILSLOT_SET_INFORMATION {
3183 PLARGE_INTEGER ReadTimeout;
3184 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
3185
3186 typedef struct _FILE_REPARSE_POINT_INFORMATION {
3187 LONGLONG FileReference;
3188 ULONG Tag;
3189 } FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION;
3190
3191 typedef struct _FILE_LINK_ENTRY_INFORMATION {
3192 ULONG NextEntryOffset;
3193 LONGLONG ParentFileId;
3194 ULONG FileNameLength;
3195 WCHAR FileName[1];
3196 } FILE_LINK_ENTRY_INFORMATION, *PFILE_LINK_ENTRY_INFORMATION;
3197
3198 typedef struct _FILE_LINKS_INFORMATION {
3199 ULONG BytesNeeded;
3200 ULONG EntriesReturned;
3201 FILE_LINK_ENTRY_INFORMATION Entry;
3202 } FILE_LINKS_INFORMATION, *PFILE_LINKS_INFORMATION;
3203
3204 typedef struct _FILE_NETWORK_PHYSICAL_NAME_INFORMATION {
3205 ULONG FileNameLength;
3206 WCHAR FileName[1];
3207 } FILE_NETWORK_PHYSICAL_NAME_INFORMATION, *PFILE_NETWORK_PHYSICAL_NAME_INFORMATION;
3208
3209 typedef struct _FILE_STANDARD_LINK_INFORMATION {
3210 ULONG NumberOfAccessibleLinks;
3211 ULONG TotalNumberOfLinks;
3212 BOOLEAN DeletePending;
3213 BOOLEAN Directory;
3214 } FILE_STANDARD_LINK_INFORMATION, *PFILE_STANDARD_LINK_INFORMATION;
3215
3216 typedef struct _FILE_GET_EA_INFORMATION {
3217 ULONG NextEntryOffset;
3218 UCHAR EaNameLength;
3219 CHAR EaName[1];
3220 } FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
3221
3222 #define REMOTE_PROTOCOL_FLAG_LOOPBACK 0x00000001
3223 #define REMOTE_PROTOCOL_FLAG_OFFLINE 0x00000002
3224
3225 typedef struct _FILE_REMOTE_PROTOCOL_INFORMATION {
3226 USHORT StructureVersion;
3227 USHORT StructureSize;
3228 ULONG Protocol;
3229 USHORT ProtocolMajorVersion;
3230 USHORT ProtocolMinorVersion;
3231 USHORT ProtocolRevision;
3232 USHORT Reserved;
3233 ULONG Flags;
3234 struct {
3235 ULONG Reserved[8];
3236 } GenericReserved;
3237 struct {
3238 ULONG Reserved[16];
3239 } ProtocolSpecificReserved;
3240 } FILE_REMOTE_PROTOCOL_INFORMATION, *PFILE_REMOTE_PROTOCOL_INFORMATION;
3241
3242 typedef struct _FILE_GET_QUOTA_INFORMATION {
3243 ULONG NextEntryOffset;
3244 ULONG SidLength;
3245 SID Sid;
3246 } FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
3247
3248 typedef struct _FILE_QUOTA_INFORMATION {
3249 ULONG NextEntryOffset;
3250 ULONG SidLength;
3251 LARGE_INTEGER ChangeTime;
3252 LARGE_INTEGER QuotaUsed;
3253 LARGE_INTEGER QuotaThreshold;
3254 LARGE_INTEGER QuotaLimit;
3255 SID Sid;
3256 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
3257
3258 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
3259 ULONG FileSystemAttributes;
3260 ULONG MaximumComponentNameLength;
3261 ULONG FileSystemNameLength;
3262 WCHAR FileSystemName[1];
3263 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
3264
3265 typedef struct _FILE_FS_DRIVER_PATH_INFORMATION {
3266 BOOLEAN DriverInPath;
3267 ULONG DriverNameLength;
3268 WCHAR DriverName[1];
3269 } FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION;
3270
3271 typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION {
3272 ULONG Flags;
3273 } FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION;
3274
3275 #define FILE_VC_QUOTA_NONE 0x00000000
3276 #define FILE_VC_QUOTA_TRACK 0x00000001
3277 #define FILE_VC_QUOTA_ENFORCE 0x00000002
3278 #define FILE_VC_QUOTA_MASK 0x00000003
3279 #define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
3280 #define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
3281 #define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
3282 #define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
3283 #define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
3284 #define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
3285 #define FILE_VC_QUOTAS_REBUILDING 0x00000200
3286 #define FILE_VC_VALID_MASK 0x000003ff
3287
3288 typedef struct _FILE_FS_CONTROL_INFORMATION {
3289 LARGE_INTEGER FreeSpaceStartFiltering;
3290 LARGE_INTEGER FreeSpaceThreshold;
3291 LARGE_INTEGER FreeSpaceStopFiltering;
3292 LARGE_INTEGER DefaultQuotaThreshold;
3293 LARGE_INTEGER DefaultQuotaLimit;
3294 ULONG FileSystemControlFlags;
3295 } FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
3296
3297 #ifndef _FILESYSTEMFSCTL_
3298 #define _FILESYSTEMFSCTL_
3299
3300 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
3301 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
3302 #define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
3303 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
3304 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
3305 #define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
3306 #define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
3307 #define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
3308 #define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
3309 #define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
3310 #define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
3311 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
3312 #define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
3313 #define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
3314 #define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3315 #define FSCTL_SET_BOOTLOADER_ACCESSED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS)
3316
3317 #define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
3318 #define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
3319 #define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
3320 #define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
3321 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
3322
3323 #if (_WIN32_WINNT >= 0x0400)
3324
3325 #define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
3326 #define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
3327 #define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS)
3328 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS)
3329 #define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
3330 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
3331 #define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS)
3332
3333 #endif
3334
3335 #if (_WIN32_WINNT >= 0x0500)
3336
3337 #define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
3338 #define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_WRITE_DATA)
3339 #define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
3340 #define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_WRITE_DATA)
3341 #define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_WRITE_DATA)
3342 #define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
3343 #define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_WRITE_DATA)
3344 #define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_READ_DATA)
3345 #define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA)
3346 #define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_READ_DATA)
3347 #define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_WRITE_DATA)
3348 #define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
3349 #define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA)
3350 #define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
3351 #define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA)
3352 #define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
3353 #define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
3354 #define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS)
3355 #define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_ANY_ACCESS)
3356 #define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_ANY_ACCESS)
3357 #define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_READ_DATA)
3358 #define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_READ_DATA)
3359 #define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_READ_DATA)
3360 #define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
3361 #define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)
3362 #define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS)
3363 #define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)
3364 #define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
3365 #define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
3366 #define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
3367 #define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA)
3368 #define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3369
3370 #endif
3371
3372 #if (_WIN32_WINNT >= 0x0600)
3373
3374 #define FSCTL_MAKE_MEDIA_COMPATIBLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 76, METHOD_BUFFERED, FILE_WRITE_DATA)
3375 #define FSCTL_SET_DEFECT_MANAGEMENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, METHOD_BUFFERED, FILE_WRITE_DATA)
3376 #define FSCTL_QUERY_SPARING_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS)
3377 #define FSCTL_QUERY_ON_DISK_VOLUME_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS)
3378 #define FSCTL_SET_VOLUME_COMPRESSION_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 80, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3379 #define FSCTL_TXFS_MODIFY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, FILE_WRITE_DATA)
3380 #define FSCTL_TXFS_QUERY_RM_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 82, METHOD_BUFFERED, FILE_READ_DATA)
3381 #define FSCTL_TXFS_ROLLFORWARD_REDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 84, METHOD_BUFFERED, FILE_WRITE_DATA)
3382 #define FSCTL_TXFS_ROLLFORWARD_UNDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 85, METHOD_BUFFERED, FILE_WRITE_DATA)
3383 #define FSCTL_TXFS_START_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, FILE_WRITE_DATA)
3384 #define FSCTL_TXFS_SHUTDOWN_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, FILE_WRITE_DATA)
3385 #define FSCTL_TXFS_READ_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 88, METHOD_BUFFERED, FILE_READ_DATA)
3386 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 89, METHOD_BUFFERED, FILE_WRITE_DATA)
3387 #define FSCTL_TXFS_CREATE_SECONDARY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 90, METHOD_BUFFERED, FILE_WRITE_DATA)
3388 #define FSCTL_TXFS_GET_METADATA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 91, METHOD_BUFFERED, FILE_READ_DATA)
3389 #define FSCTL_TXFS_GET_TRANSACTED_VERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 92, METHOD_BUFFERED, FILE_READ_DATA)
3390 #define FSCTL_TXFS_SAVEPOINT_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 94, METHOD_BUFFERED, FILE_WRITE_DATA)
3391 #define FSCTL_TXFS_CREATE_MINIVERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 95, METHOD_BUFFERED, FILE_WRITE_DATA)
3392 #define FSCTL_TXFS_TRANSACTION_ACTIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 99, METHOD_BUFFERED, FILE_READ_DATA)
3393 #define FSCTL_SET_ZERO_ON_DEALLOCATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3394 #define FSCTL_SET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS)
3395 #define FSCTL_GET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS)
3396 #define FSCTL_WAIT_FOR_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS)
3397 #define FSCTL_INITIATE_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS)
3398 #define FSCTL_CSC_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, FILE_ANY_ACCESS)
3399 #define FSCTL_SHRINK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
3400 #define FSCTL_SET_SHORT_NAME_BEHAVIOR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS)
3401 #define FSCTL_DFSR_SET_GHOST_HANDLE_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 110, METHOD_BUFFERED, FILE_ANY_ACCESS)
3402
3403 #define FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES \
3404 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_READ_DATA)
3405 #define FSCTL_TXFS_LIST_TRANSACTIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 121, METHOD_BUFFERED, FILE_READ_DATA)
3406 #define FSCTL_QUERY_PAGEFILE_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 122, METHOD_BUFFERED, FILE_ANY_ACCESS)
3407 #define FSCTL_RESET_VOLUME_ALLOCATION_HINTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 123, METHOD_BUFFERED, FILE_ANY_ACCESS)
3408 #define FSCTL_TXFS_READ_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 126, METHOD_BUFFERED, FILE_ANY_ACCESS)
3409
3410 #endif
3411
3412 #if (_WIN32_WINNT >= 0x0601)
3413
3414 #define FSCTL_QUERY_DEPENDENT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 124, METHOD_BUFFERED, FILE_ANY_ACCESS)
3415 #define FSCTL_SD_GLOBAL_CHANGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 125, METHOD_BUFFERED, FILE_ANY_ACCESS)
3416 #define FSCTL_LOOKUP_STREAM_FROM_CLUSTER CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 127, METHOD_BUFFERED, FILE_ANY_ACCESS)
3417 #define FSCTL_TXFS_WRITE_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 128, METHOD_BUFFERED, FILE_ANY_ACCESS)
3418 #define FSCTL_FILE_TYPE_NOTIFICATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 129, METHOD_BUFFERED, FILE_ANY_ACCESS)
3419 #define FSCTL_GET_BOOT_AREA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 140, METHOD_BUFFERED, FILE_ANY_ACCESS)
3420 #define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 141, METHOD_BUFFERED, FILE_ANY_ACCESS)
3421 #define FSCTL_SET_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS)
3422 #define FSCTL_QUERY_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 143, METHOD_BUFFERED, FILE_ANY_ACCESS)
3423
3424 #define FSCTL_REQUEST_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, FILE_ANY_ACCESS)
3425
3426 #define FSCTL_CSV_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 145, METHOD_BUFFERED, FILE_ANY_ACCESS)
3427 #define FSCTL_IS_CSV_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, FILE_ANY_ACCESS)
3428
3429 #define FSCTL_QUERY_FILE_SYSTEM_RECOGNITION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 147, METHOD_BUFFERED, FILE_ANY_ACCESS)
3430 #define FSCTL_CSV_GET_VOLUME_PATH_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 148, METHOD_BUFFERED, FILE_ANY_ACCESS)
3431 #define FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS)
3432 #define FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS)
3433 #define FSCTL_IS_FILE_ON_CSV_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 151, METHOD_BUFFERED, FILE_ANY_ACCESS)
3434
3435 typedef struct _CSV_NAMESPACE_INFO {
3436 ULONG Version;
3437 ULONG DeviceNumber;
3438 LARGE_INTEGER StartingOffset;
3439 ULONG SectorSize;
3440 } CSV_NAMESPACE_INFO, *PCSV_NAMESPACE_INFO;
3441
3442 #define CSV_NAMESPACE_INFO_V1 (sizeof(CSV_NAMESPACE_INFO))
3443 #define CSV_INVALID_DEVICE_NUMBER 0xFFFFFFFF
3444
3445 #endif
3446
3447 #define FSCTL_MARK_AS_SYSTEM_HIVE FSCTL_SET_BOOTLOADER_ACCESSED
3448
3449 typedef struct _PATHNAME_BUFFER {
3450 ULONG PathNameLength;
3451 WCHAR Name[1];
3452 } PATHNAME_BUFFER, *PPATHNAME_BUFFER;
3453
3454 typedef struct _FSCTL_QUERY_FAT_BPB_BUFFER {
3455 UCHAR First0x24BytesOfBootSector[0x24];
3456 } FSCTL_QUERY_FAT_BPB_BUFFER, *PFSCTL_QUERY_FAT_BPB_BUFFER;
3457
3458 #if (_WIN32_WINNT >= 0x0400)
3459
3460 typedef struct _NTFS_VOLUME_DATA_BUFFER {
3461 LARGE_INTEGER VolumeSerialNumber;
3462 LARGE_INTEGER NumberSectors;
3463 LARGE_INTEGER TotalClusters;
3464 LARGE_INTEGER FreeClusters;
3465 LARGE_INTEGER TotalReserved;
3466 ULONG BytesPerSector;
3467 ULONG BytesPerCluster;
3468 ULONG BytesPerFileRecordSegment;
3469 ULONG ClustersPerFileRecordSegment;
3470 LARGE_INTEGER MftValidDataLength;
3471 LARGE_INTEGER MftStartLcn;
3472 LARGE_INTEGER Mft2StartLcn;
3473 LARGE_INTEGER MftZoneStart;
3474 LARGE_INTEGER MftZoneEnd;
3475 } NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER;
3476
3477 typedef struct _NTFS_EXTENDED_VOLUME_DATA {
3478 ULONG ByteCount;
3479 USHORT MajorVersion;
3480 USHORT MinorVersion;
3481 } NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA;
3482
3483 typedef struct _STARTING_LCN_INPUT_BUFFER {
3484 LARGE_INTEGER StartingLcn;
3485 } STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER;
3486
3487 typedef struct _VOLUME_BITMAP_BUFFER {
3488 LARGE_INTEGER StartingLcn;
3489 LARGE_INTEGER BitmapSize;
3490 UCHAR Buffer[1];
3491 } VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER;
3492
3493 typedef struct _STARTING_VCN_INPUT_BUFFER {
3494 LARGE_INTEGER StartingVcn;
3495 } STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER;
3496
3497 typedef struct _RETRIEVAL_POINTERS_BUFFER {
3498 ULONG ExtentCount;
3499 LARGE_INTEGER StartingVcn;
3500 struct {
3501 LARGE_INTEGER NextVcn;
3502 LARGE_INTEGER Lcn;
3503 } Extents[1];
3504 } RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER;
3505
3506 typedef struct _NTFS_FILE_RECORD_INPUT_BUFFER {
3507 LARGE_INTEGER FileReferenceNumber;
3508 } NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER;
3509
3510 typedef struct _NTFS_FILE_RECORD_OUTPUT_BUFFER {
3511 LARGE_INTEGER FileReferenceNumber;
3512 ULONG FileRecordLength;
3513 UCHAR FileRecordBuffer[1];
3514 } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER;
3515
3516 typedef struct _MOVE_FILE_DATA {
3517 HANDLE FileHandle;
3518 LARGE_INTEGER StartingVcn;
3519 LARGE_INTEGER StartingLcn;
3520 ULONG ClusterCount;
3521 } MOVE_FILE_DATA, *PMOVE_FILE_DATA;
3522
3523 typedef struct _MOVE_FILE_RECORD_DATA {
3524 HANDLE FileHandle;
3525 LARGE_INTEGER SourceFileRecord;
3526 LARGE_INTEGER TargetFileRecord;
3527 } MOVE_FILE_RECORD_DATA, *PMOVE_FILE_RECORD_DATA;
3528
3529 #if defined(_WIN64)
3530 typedef struct _MOVE_FILE_DATA32 {
3531 UINT32 FileHandle;
3532 LARGE_INTEGER StartingVcn;
3533 LARGE_INTEGER StartingLcn;
3534 ULONG ClusterCount;
3535 } MOVE_FILE_DATA32, *PMOVE_FILE_DATA32;
3536 #endif
3537
3538 #endif /* (_WIN32_WINNT >= 0x0400) */
3539
3540 #if (_WIN32_WINNT >= 0x0500)
3541
3542 typedef struct _FIND_BY_SID_DATA {
3543 ULONG Restart;
3544 SID Sid;
3545 } FIND_BY_SID_DATA, *PFIND_BY_SID_DATA;
3546
3547 typedef struct _FIND_BY_SID_OUTPUT {
3548 ULONG NextEntryOffset;
3549 ULONG FileIndex;
3550 ULONG FileNameLength;
3551 WCHAR FileName[1];
3552 } FIND_BY_SID_OUTPUT, *PFIND_BY_SID_OUTPUT;
3553
3554 typedef struct _MFT_ENUM_DATA {
3555 ULONGLONG StartFileReferenceNumber;
3556 USN LowUsn;
3557 USN HighUsn;
3558 } MFT_ENUM_DATA, *PMFT_ENUM_DATA;
3559
3560 typedef struct _CREATE_USN_JOURNAL_DATA {
3561 ULONGLONG MaximumSize;
3562 ULONGLONG AllocationDelta;
3563 } CREATE_USN_JOURNAL_DATA, *PCREATE_USN_JOURNAL_DATA;
3564
3565 typedef struct _READ_USN_JOURNAL_DATA {
3566 USN StartUsn;
3567 ULONG ReasonMask;
3568 ULONG ReturnOnlyOnClose;
3569 ULONGLONG Timeout;
3570 ULONGLONG BytesToWaitFor;
3571 ULONGLONG UsnJournalID;
3572 } READ_USN_JOURNAL_DATA, *PREAD_USN_JOURNAL_DATA;
3573
3574 typedef struct _USN_RECORD {
3575 ULONG RecordLength;
3576 USHORT MajorVersion;
3577 USHORT MinorVersion;
3578 ULONGLONG FileReferenceNumber;
3579 ULONGLONG ParentFileReferenceNumber;
3580 USN Usn;
3581 LARGE_INTEGER TimeStamp;
3582 ULONG Reason;
3583 ULONG SourceInfo;
3584 ULONG SecurityId;
3585 ULONG FileAttributes;
3586 USHORT FileNameLength;
3587 USHORT FileNameOffset;
3588 WCHAR FileName[1];
3589 } USN_RECORD, *PUSN_RECORD;
3590
3591 #define USN_PAGE_SIZE (0x1000)
3592
3593 #define USN_REASON_DATA_OVERWRITE (0x00000001)
3594 #define USN_REASON_DATA_EXTEND (0x00000002)
3595 #define USN_REASON_DATA_TRUNCATION (0x00000004)
3596 #define USN_REASON_NAMED_DATA_OVERWRITE (0x00000010)
3597 #define USN_REASON_NAMED_DATA_EXTEND (0x00000020)
3598 #define USN_REASON_NAMED_DATA_TRUNCATION (0x00000040)
3599 #define USN_REASON_FILE_CREATE (0x00000100)
3600 #define USN_REASON_FILE_DELETE (0x00000200)
3601 #define USN_REASON_EA_CHANGE (0x00000400)
3602 #define USN_REASON_SECURITY_CHANGE (0x00000800)
3603 #define USN_REASON_RENAME_OLD_NAME (0x00001000)
3604 #define USN_REASON_RENAME_NEW_NAME (0x00002000)
3605 #define USN_REASON_INDEXABLE_CHANGE (0x00004000)
3606 #define USN_REASON_BASIC_INFO_CHANGE (0x00008000)
3607 #define USN_REASON_HARD_LINK_CHANGE (0x00010000)
3608 #define USN_REASON_COMPRESSION_CHANGE (0x00020000)
3609 #define USN_REASON_ENCRYPTION_CHANGE (0x00040000)
3610 #define USN_REASON_OBJECT_ID_CHANGE (0x00080000)
3611 #define USN_REASON_REPARSE_POINT_CHANGE (0x00100000)
3612 #define USN_REASON_STREAM_CHANGE (0x00200000)
3613 #define USN_REASON_TRANSACTED_CHANGE (0x00400000)
3614 #define USN_REASON_CLOSE (0x80000000)
3615
3616 typedef struct _USN_JOURNAL_DATA {
3617 ULONGLONG UsnJournalID;
3618 USN FirstUsn;
3619 USN NextUsn;
3620 USN LowestValidUsn;
3621 USN MaxUsn;
3622 ULONGLONG MaximumSize;
3623 ULONGLONG AllocationDelta;
3624 } USN_JOURNAL_DATA, *PUSN_JOURNAL_DATA;
3625
3626 typedef struct _DELETE_USN_JOURNAL_DATA {
3627 ULONGLONG UsnJournalID;
3628 ULONG DeleteFlags;
3629 } DELETE_USN_JOURNAL_DATA, *PDELETE_USN_JOURNAL_DATA;
3630
3631 #define USN_DELETE_FLAG_DELETE (0x00000001)
3632 #define USN_DELETE_FLAG_NOTIFY (0x00000002)
3633 #define USN_DELETE_VALID_FLAGS (0x00000003)
3634
3635 typedef struct _MARK_HANDLE_INFO {
3636 ULONG UsnSourceInfo;
3637 HANDLE VolumeHandle;
3638 ULONG HandleInfo;
3639 } MARK_HANDLE_INFO, *PMARK_HANDLE_INFO;
3640
3641 #if defined(_WIN64)
3642 typedef struct _MARK_HANDLE_INFO32 {
3643 ULONG UsnSourceInfo;
3644 UINT32 VolumeHandle;
3645 ULONG HandleInfo;
3646 } MARK_HANDLE_INFO32, *PMARK_HANDLE_INFO32;
3647 #endif
3648
3649 #define USN_SOURCE_DATA_MANAGEMENT (0x00000001)
3650 #define USN_SOURCE_AUXILIARY_DATA (0x00000002)
3651 #define USN_SOURCE_REPLICATION_MANAGEMENT (0x00000004)
3652
3653 #define MARK_HANDLE_PROTECT_CLUSTERS (0x00000001)
3654 #define MARK_HANDLE_TXF_SYSTEM_LOG (0x00000004)
3655 #define MARK_HANDLE_NOT_TXF_SYSTEM_LOG (0x00000008)
3656
3657 typedef struct _BULK_SECURITY_TEST_DATA {
3658 ACCESS_MASK DesiredAccess;
3659 ULONG SecurityIds[1];
3660 } BULK_SECURITY_TEST_DATA, *PBULK_SECURITY_TEST_DATA;
3661
3662 #define VOLUME_IS_DIRTY (0x00000001)
3663 #define VOLUME_UPGRADE_SCHEDULED (0x00000002)
3664 #define VOLUME_SESSION_OPEN (0x00000004)
3665
3666 typedef struct _FILE_PREFETCH {
3667 ULONG Type;
3668 ULONG Count;
3669 ULONGLONG Prefetch[1];
3670 } FILE_PREFETCH, *PFILE_PREFETCH;
3671
3672 typedef struct _FILE_PREFETCH_EX {
3673 ULONG Type;
3674 ULONG Count;
3675 PVOID Context;
3676 ULONGLONG Prefetch[1];
3677 } FILE_PREFETCH_EX, *PFILE_PREFETCH_EX;
3678
3679 #define FILE_PREFETCH_TYPE_FOR_CREATE 0x1
3680 #define FILE_PREFETCH_TYPE_FOR_DIRENUM 0x2
3681 #define FILE_PREFETCH_TYPE_FOR_CREATE_EX 0x3
3682 #define FILE_PREFETCH_TYPE_FOR_DIRENUM_EX 0x4
3683
3684 #define FILE_PREFETCH_TYPE_MAX 0x4
3685
3686 typedef struct _FILE_OBJECTID_BUFFER {
3687 UCHAR ObjectId[16];
3688 union {
3689 struct {
3690 UCHAR BirthVolumeId[16];
3691 UCHAR BirthObjectId[16];
3692 UCHAR DomainId[16];
3693 } DUMMYSTRUCTNAME;
3694 UCHAR ExtendedInfo[48];
3695 } DUMMYUNIONNAME;
3696 } FILE_OBJECTID_BUFFER, *PFILE_OBJECTID_BUFFER;
3697
3698 typedef struct _FILE_SET_SPARSE_BUFFER {
3699 BOOLEAN SetSparse;
3700 } FILE_SET_SPARSE_BUFFER, *PFILE_SET_SPARSE_BUFFER;
3701
3702 typedef struct _FILE_ZERO_DATA_INFORMATION {
3703 LARGE_INTEGER FileOffset;
3704 LARGE_INTEGER BeyondFinalZero;
3705 } FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION;
3706
3707 typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
3708 LARGE_INTEGER FileOffset;
3709 LARGE_INTEGER Length;
3710 } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
3711
3712 typedef struct _ENCRYPTION_BUFFER {
3713 ULONG EncryptionOperation;
3714 UCHAR Private[1];
3715 } ENCRYPTION_BUFFER, *PENCRYPTION_BUFFER;
3716
3717 #define FILE_SET_ENCRYPTION 0x00000001
3718 #define FILE_CLEAR_ENCRYPTION 0x00000002
3719 #define STREAM_SET_ENCRYPTION 0x00000003
3720 #define STREAM_CLEAR_ENCRYPTION 0x00000004
3721
3722 #define MAXIMUM_ENCRYPTION_VALUE 0x00000004
3723
3724 typedef struct _DECRYPTION_STATUS_BUFFER {
3725 BOOLEAN NoEncryptedStreams;
3726 } DECRYPTION_STATUS_BUFFER, *PDECRYPTION_STATUS_BUFFER;
3727
3728 #define ENCRYPTION_FORMAT_DEFAULT (0x01)
3729
3730 #define COMPRESSION_FORMAT_SPARSE (0x4000)
3731
3732 typedef struct _REQUEST_RAW_ENCRYPTED_DATA {
3733 LONGLONG FileOffset;
3734 ULONG Length;
3735 } REQUEST_RAW_ENCRYPTED_DATA, *PREQUEST_RAW_ENCRYPTED_DATA;
3736
3737 typedef struct _ENCRYPTED_DATA_INFO {
3738 ULONGLONG StartingFileOffset;
3739 ULONG OutputBufferOffset;
3740 ULONG BytesWithinFileSize;
3741 ULONG BytesWithinValidDataLength;
3742 USHORT CompressionFormat;
3743 UCHAR DataUnitShift;
3744 UCHAR ChunkShift;
3745 UCHAR ClusterShift;
3746 UCHAR EncryptionFormat;
3747 USHORT NumberOfDataBlocks;
3748 ULONG DataBlockSize[ANYSIZE_ARRAY];
3749 } ENCRYPTED_DATA_INFO, *PENCRYPTED_DATA_INFO;
3750
3751 typedef struct _PLEX_READ_DATA_REQUEST {
3752 LARGE_INTEGER ByteOffset;
3753 ULONG ByteLength;
3754 ULONG PlexNumber;
3755 } PLEX_READ_DATA_REQUEST, *PPLEX_READ_DATA_REQUEST;
3756
3757 typedef struct _SI_COPYFILE {
3758 ULONG SourceFileNameLength;
3759 ULONG DestinationFileNameLength;
3760 ULONG Flags;
3761 WCHAR FileNameBuffer[1];
3762 } SI_COPYFILE, *PSI_COPYFILE;
3763
3764 #define COPYFILE_SIS_LINK 0x0001
3765 #define COPYFILE_SIS_REPLACE 0x0002
3766 #define COPYFILE_SIS_FLAGS 0x0003
3767
3768 #endif /* (_WIN32_WINNT >= 0x0500) */
3769
3770 #if (_WIN32_WINNT >= 0x0600)
3771
3772 typedef struct _FILE_MAKE_COMPATIBLE_BUFFER {
3773 BOOLEAN CloseDisc;
3774 } FILE_MAKE_COMPATIBLE_BUFFER, *PFILE_MAKE_COMPATIBLE_BUFFER;
3775
3776 typedef struct _FILE_SET_DEFECT_MGMT_BUFFER {
3777 BOOLEAN Disable;
3778 } FILE_SET_DEFECT_MGMT_BUFFER, *PFILE_SET_DEFECT_MGMT_BUFFER;
3779
3780 typedef struct _FILE_QUERY_SPARING_BUFFER {
3781 ULONG SparingUnitBytes;
3782 BOOLEAN SoftwareSparing;
3783 ULONG TotalSpareBlocks;
3784 ULONG FreeSpareBlocks;
3785 } FILE_QUERY_SPARING_BUFFER, *PFILE_QUERY_SPARING_BUFFER;
3786
3787 typedef struct _FILE_QUERY_ON_DISK_VOL_INFO_BUFFER {
3788 LARGE_INTEGER DirectoryCount;
3789 LARGE_INTEGER FileCount;
3790 USHORT FsFormatMajVersion;
3791 USHORT FsFormatMinVersion;
3792 WCHAR FsFormatName[12];
3793 LARGE_INTEGER FormatTime;
3794 LARGE_INTEGER LastUpdateTime;
3795 WCHAR CopyrightInfo[34];
3796 WCHAR AbstractInfo[34];
3797 WCHAR FormattingImplementationInfo[34];
3798 WCHAR LastModifyingImplementationInfo[34];
3799 } FILE_QUERY_ON_DISK_VOL_INFO_BUFFER, *PFILE_QUERY_ON_DISK_VOL_INFO_BUFFER;
3800
3801 #define SET_REPAIR_ENABLED (0x00000001)
3802 #define SET_REPAIR_VOLUME_BITMAP_SCAN (0x00000002)
3803 #define SET_REPAIR_DELETE_CROSSLINK (0x00000004)
3804 #define SET_REPAIR_WARN_ABOUT_DATA_LOSS (0x00000008)
3805 #define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT (0x00000010)
3806 #define SET_REPAIR_VALID_MASK (0x0000001F)
3807
3808 typedef enum _SHRINK_VOLUME_REQUEST_TYPES {
3809 ShrinkPrepare = 1,
3810 ShrinkCommit,
3811 ShrinkAbort
3812 } SHRINK_VOLUME_REQUEST_TYPES, *PSHRINK_VOLUME_REQUEST_TYPES;
3813
3814 typedef struct _SHRINK_VOLUME_INFORMATION {
3815 SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType;
3816 ULONGLONG Flags;
3817 LONGLONG NewNumberOfSectors;
3818 } SHRINK_VOLUME_INFORMATION, *PSHRINK_VOLUME_INFORMATION;
3819
3820 #define TXFS_RM_FLAG_LOGGING_MODE 0x00000001
3821 #define TXFS_RM_FLAG_RENAME_RM 0x00000002
3822 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000004
3823 #define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000008
3824 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000010
3825 #define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000020
3826 #define TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000040
3827 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000080
3828 #define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000100
3829 #define TXFS_RM_FLAG_GROW_LOG 0x00000400
3830 #define TXFS_RM_FLAG_SHRINK_LOG 0x00000800
3831 #define TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE 0x00001000
3832 #define TXFS_RM_FLAG_PRESERVE_CHANGES 0x00002000
3833 #define TXFS_RM_FLAG_RESET_RM_AT_NEXT_START 0x00004000
3834 #define TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START 0x00008000
3835 #define TXFS_RM_FLAG_PREFER_CONSISTENCY 0x00010000
3836 #define TXFS_RM_FLAG_PREFER_AVAILABILITY 0x00020000
3837
3838 #define TXFS_LOGGING_MODE_SIMPLE (0x0001)
3839 #define TXFS_LOGGING_MODE_FULL (0x0002)
3840
3841 #define TXFS_TRANSACTION_STATE_NONE 0x00
3842 #define TXFS_TRANSACTION_STATE_ACTIVE 0x01
3843 #define TXFS_TRANSACTION_STATE_PREPARED 0x02
3844 #define TXFS_TRANSACTION_STATE_NOTACTIVE 0x03
3845
3846 #define TXFS_MODIFY_RM_VALID_FLAGS \
3847 (TXFS_RM_FLAG_LOGGING_MODE | \
3848 TXFS_RM_FLAG_RENAME_RM | \
3849 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \
3850 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \
3851 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
3852 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
3853 TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \
3854 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
3855 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
3856 TXFS_RM_FLAG_SHRINK_LOG | \
3857 TXFS_RM_FLAG_GROW_LOG | \
3858 TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE | \
3859 TXFS_RM_FLAG_PRESERVE_CHANGES | \
3860 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
3861 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
3862 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
3863 TXFS_RM_FLAG_PREFER_AVAILABILITY)
3864
3865 typedef struct _TXFS_MODIFY_RM {
3866 ULONG Flags;
3867 ULONG LogContainerCountMax;
3868 ULONG LogContainerCountMin;
3869 ULONG LogContainerCount;
3870 ULONG LogGrowthIncrement;
3871 ULONG LogAutoShrinkPercentage;
3872 ULONGLONG Reserved;
3873 USHORT LoggingMode;
3874 } TXFS_MODIFY_RM, *PTXFS_MODIFY_RM;
3875
3876 #define TXFS_RM_STATE_NOT_STARTED 0
3877 #define TXFS_RM_STATE_STARTING 1
3878 #define TXFS_RM_STATE_ACTIVE 2
3879 #define TXFS_RM_STATE_SHUTTING_DOWN 3
3880
3881 #define TXFS_QUERY_RM_INFORMATION_VALID_FLAGS \
3882 (TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
3883 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
3884 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
3885 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
3886 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
3887 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
3888 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
3889 TXFS_RM_FLAG_PREFER_AVAILABILITY)
3890
3891 typedef struct _TXFS_QUERY_RM_INFORMATION {
3892 ULONG BytesRequired;
3893 ULONGLONG TailLsn;
3894 ULONGLONG CurrentLsn;
3895 ULONGLONG ArchiveTailLsn;
3896 ULONGLONG LogContainerSize;
3897 LARGE_INTEGER HighestVirtualClock;
3898 ULONG LogContainerCount;
3899 ULONG LogContainerCountMax;
3900 ULONG LogContainerCountMin;
3901 ULONG LogGrowthIncrement;
3902 ULONG LogAutoShrinkPercentage;
3903 ULONG Flags;
3904 USHORT LoggingMode;
3905 USHORT Reserved;
3906 ULONG RmState;
3907 ULONGLONG LogCapacity;
3908 ULONGLONG LogFree;
3909 ULONGLONG TopsSize;
3910 ULONGLONG TopsUsed;
3911 ULONGLONG TransactionCount;
3912 ULONGLONG OnePCCount;
3913 ULONGLONG TwoPCCount;
3914 ULONGLONG NumberLogFileFull;
3915 ULONGLONG OldestTransactionAge;
3916 GUID RMName;
3917 ULONG TmLogPathOffset;
3918 } TXFS_QUERY_RM_INFORMATION, *PTXFS_QUERY_RM_INFORMATION;
3919
3920 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN 0x01
3921 #define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK 0x02
3922
3923 #define TXFS_ROLLFORWARD_REDO_VALID_FLAGS \
3924 (TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN | \
3925 TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK)
3926
3927 typedef struct _TXFS_ROLLFORWARD_REDO_INFORMATION {
3928 LARGE_INTEGER LastVirtualClock;
3929 ULONGLONG LastRedoLsn;
3930 ULONGLONG HighestRecoveryLsn;
3931 ULONG Flags;
3932 } TXFS_ROLLFORWARD_REDO_INFORMATION, *PTXFS_ROLLFORWARD_REDO_INFORMATION;
3933
3934 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000001
3935 #define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000002
3936 #define TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE 0x00000004
3937 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000008
3938 #define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000010
3939 #define TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000020
3940 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000040
3941 #define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000080
3942
3943 #define TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT 0x00000200