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