xref: /reactos/sdk/include/ndk/iotypes.h (revision 36bf934f)
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     iotypes.h
8 
9 Abstract:
10 
11     Type definitions for the I/O Manager.
12 
13 Author:
14 
15     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 #ifndef _IOTYPES_H
19 #define _IOTYPES_H
20 
21 //
22 // Dependencies
23 //
24 #include <umtypes.h>
25 #include <ifssupp.h>
26 #include <potypes.h>
27 
28 //
29 // I/O Completion Access Rights
30 //
31 #define IO_COMPLETION_QUERY_STATE               0x0001
32 #ifndef NTOS_MODE_USER
33 #define IO_COMPLETION_MODIFY_STATE              0x0002
34 #define IO_COMPLETION_ALL_ACCESS                (STANDARD_RIGHTS_REQUIRED | \
35                                                  SYNCHRONIZE | \
36                                                  0x3)
37 
38 //
39 // Kernel Exported Object Types
40 //
41 extern POBJECT_TYPE NTSYSAPI IoAdapterObjectType;
42 extern POBJECT_TYPE NTSYSAPI IoDeviceHandlerObjectType;
43 extern POBJECT_TYPE NTSYSAPI IoDeviceObjectType;
44 extern POBJECT_TYPE NTSYSAPI IoDriverObjectType;
45 
46 #else
47 
48 //
49 // Symbolic Link Access Rights
50 //
51 #define SYMBOLIC_LINK_QUERY                     0x0001
52 #define SYMBOLIC_LINK_ALL_ACCESS                STANDARD_RIGHTS_REQUIRED | 0x0001
53 #endif
54 
55 #ifdef NTOS_MODE_USER
56 
57 /* File System Attributes Flags */
58 #define FILE_READ_ONLY_VOLUME 0x00080000
59 
60 #endif
61 
62 //
63 // NtCreateFile Result Flags
64 //
65 #define FILE_SUPERSEDED                         0x00000000
66 #define FILE_OPENED                             0x00000001
67 #define FILE_CREATED                            0x00000002
68 #define FILE_OVERWRITTEN                        0x00000003
69 #define FILE_EXISTS                             0x00000004
70 #define FILE_DOES_NOT_EXIST                     0x00000005
71 
72 //
73 // Pipe Flags
74 //
75 #define FILE_PIPE_BYTE_STREAM_TYPE              0x00000000
76 #define FILE_PIPE_MESSAGE_TYPE                  0x00000001
77 #define FILE_PIPE_BYTE_STREAM_MODE              0x00000000
78 #define FILE_PIPE_MESSAGE_MODE                  0x00000001
79 #define FILE_PIPE_QUEUE_OPERATION               0x00000000
80 #define FILE_PIPE_COMPLETE_OPERATION            0x00000001
81 #define FILE_PIPE_INBOUND                       0x00000000
82 #define FILE_PIPE_OUTBOUND                      0x00000001
83 #define FILE_PIPE_FULL_DUPLEX                   0x00000002
84 #define FILE_PIPE_CLIENT_END                    0x00000000
85 #define FILE_PIPE_SERVER_END                    0x00000001
86 
87 //
88 // NtCreateFile Attributes
89 //
90 #define FILE_ATTRIBUTE_VALID_FLAGS              0x00007fb7
91 #define FILE_ATTRIBUTE_VALID_SET_FLAGS          0x000031a7
92 
93 //
94 // NtCreateFile OpenType Flags
95 //
96 #define FILE_SUPERSEDE                          0x00000000
97 #define FILE_OPEN                               0x00000001
98 #define FILE_CREATE                             0x00000002
99 #define FILE_OPEN_IF                            0x00000003
100 #define FILE_OVERWRITE                          0x00000004
101 #define FILE_OVERWRITE_IF                       0x00000005
102 #define FILE_MAXIMUM_DISPOSITION                0x00000005
103 
104 //
105 // NtCreateFile Flags
106 //
107 #define FILE_DIRECTORY_FILE                     0x00000001
108 #define FILE_WRITE_THROUGH                      0x00000002
109 #define FILE_SEQUENTIAL_ONLY                    0x00000004
110 #define FILE_NO_INTERMEDIATE_BUFFERING          0x00000008
111 #define FILE_SYNCHRONOUS_IO_ALERT               0x00000010
112 #define FILE_SYNCHRONOUS_IO_NONALERT            0x00000020
113 #define FILE_NON_DIRECTORY_FILE                 0x00000040
114 #define FILE_CREATE_TREE_CONNECTION             0x00000080
115 #define FILE_COMPLETE_IF_OPLOCKED               0x00000100
116 #define FILE_NO_EA_KNOWLEDGE                    0x00000200
117 #define FILE_OPEN_REMOTE_INSTANCE               0x00000400
118 #define FILE_RANDOM_ACCESS                      0x00000800
119 #define FILE_DELETE_ON_CLOSE                    0x00001000
120 #define FILE_OPEN_BY_FILE_ID                    0x00002000
121 #define FILE_OPEN_FOR_BACKUP_INTENT             0x00004000
122 #define FILE_NO_COMPRESSION                     0x00008000
123 #define FILE_RESERVE_OPFILTER                   0x00100000
124 #define FILE_OPEN_REPARSE_POINT                 0x00200000
125 #define FILE_OPEN_NO_RECALL                     0x00400000
126 #define FILE_OPEN_FOR_FREE_SPACE_QUERY          0x00800000
127 
128 //
129 // Device Charactertics
130 //
131 #define FILE_REMOVABLE_MEDIA                    0x00000001
132 #define FILE_READ_ONLY_DEVICE                   0x00000002
133 #define FILE_FLOPPY_DISKETTE                    0x00000004
134 #define FILE_WRITE_ONCE_MEDIA                   0x00000008
135 #define FILE_REMOTE_DEVICE                      0x00000010
136 #define FILE_DEVICE_IS_MOUNTED                  0x00000020
137 #define FILE_VIRTUAL_VOLUME                     0x00000040
138 #define FILE_AUTOGENERATED_DEVICE_NAME          0x00000080
139 #define FILE_DEVICE_SECURE_OPEN                 0x00000100
140 
141 //
142 // File Object Flags
143 //
144 #define FO_FILE_OBJECT_HAS_EXTENSION            0x00800000
145 
146 //
147 // Device Object Extension Flags
148 //
149 #define DOE_UNLOAD_PENDING                      0x1
150 #define DOE_DELETE_PENDING                      0x2
151 #define DOE_REMOVE_PENDING                      0x4
152 #define DOE_REMOVE_PROCESSED                    0x8
153 #define DOE_START_PENDING                       0x10
154 
155 //
156 // Device Object StartIo Flags
157 //
158 #define DOE_SIO_NO_KEY                          0x20
159 #define DOE_SIO_WITH_KEY                        0x40
160 #define DOE_SIO_CANCELABLE                      0x80
161 #define DOE_SIO_DEFERRED                        0x100
162 #define DOE_SIO_NO_CANCEL                       0x200
163 
164 //
165 // Device Node Flags
166 //
167 
168 // this set of flags is relevant for w2k3 and newer
169 // w2k has a completely different set of flags
170 #define DNF_MADEUP                              0x00000001
171 #define DNF_DUPLICATE                           0x00000002
172 #define DNF_HAL_NODE                            0x00000004
173 #define DNF_REENUMERATE                         0x00000008
174 #define DNF_ENUMERATED                          0x00000010
175 #define DNF_IDS_QUERIED                         0x00000020
176 #define DNF_HAS_BOOT_CONFIG                     0x00000040
177 #define DNF_BOOT_CONFIG_RESERVED                0x00000080
178 #define DNF_NO_RESOURCE_REQUIRED                0x00000100
179 #define DNF_RESOURCE_REQUIREMENTS_NEED_FILTERED 0x00000200
180 #define DNF_RESOURCE_REQUIREMENTS_CHANGED       0x00000400
181 #define DNF_NON_STOPPED_REBALANCE               0x00000800
182 #define DNF_LEGACY_DRIVER                       0x00001000
183 #define DNF_HAS_PROBLEM                         0x00002000
184 #define DNF_HAS_PRIVATE_PROBLEM                 0x00004000
185 #define DNF_HARDWARE_VERIFICATION               0x00008000
186 #define DNF_DEVICE_GONE                         0x00010000
187 #define DNF_LEGACY_RESOURCE_DEVICENODE          0x00020000
188 #define DNF_NEEDS_REBALANCE                     0x00040000
189 #define DNF_LOCKED_FOR_EJECT                    0x00080000
190 #define DNF_DRIVER_BLOCKED                      0x00100000
191 #define DNF_CHILD_WITH_INVALID_ID               0x00200000
192 
193 // these flags were added in Vista or later
194 #define DNF_ASYNC_START_NOT_SUPPORTED           0x00400000
195 #define DNF_ASYNC_ENUMERATION_NOT_SUPPORTED     0x00800000
196 #define DNF_LOCKED_FOR_REBALANCE                0x01000000
197 #define DNF_UNINSTALLED                         0x02000000
198 #define DNF_NO_LOWER_DEVICE_FILTERS             0x04000000
199 #define DNF_NO_LOWER_CLASS_FILTERS              0x08000000
200 #define DNF_NO_SERVICE                          0x10000000
201 #define DNF_NO_UPPER_DEVICE_FILTERS             0x20000000
202 #define DNF_NO_UPPER_CLASS_FILTERS              0x40000000
203 #define DNF_WAITING_FOR_FDO                     0x80000000
204 
205 //
206 // Device Node User Flags
207 //
208 #define DNUF_WILL_BE_REMOVED                    0x0001
209 #define DNUF_DONT_SHOW_IN_UI                    0x0002
210 #define DNUF_NEED_RESTART                       0x0004
211 #define DNUF_NOT_DISABLEABLE                    0x0008
212 #define DNUF_SHUTDOWN_QUERIED                   0x0010
213 #define DNUF_SHUTDOWN_SUBTREE_DONE              0x0020
214 
215 //
216 // Internal Option Flags
217 //
218 #define IO_ATTACH_DEVICE_API                    0x80000000
219 
220 //
221 // Undocumented WMI Registration Flags
222 //
223 #define WMIREG_FLAG_TRACE_PROVIDER              0x00010000
224 #define WMIREG_FLAG_TRACE_NOTIFY_MASK           0x00F00000
225 #define WMIREG_NOTIFY_DISK_IO                   0x00100000
226 #define WMIREG_NOTIFY_TDI_IO                    0x00200000
227 
228 //
229 // I/O Completion Information Class for NtQueryIoCompletionInformation
230 //
231 typedef enum _IO_COMPLETION_INFORMATION_CLASS
232 {
233     IoCompletionBasicInformation
234 } IO_COMPLETION_INFORMATION_CLASS;
235 
236 #ifdef NTOS_MODE_USER
237 
238 //
239 // Hardware Interface Type
240 //
241 typedef enum _INTERFACE_TYPE
242 {
243     InterfaceTypeUndefined = -1,
244     Internal,
245     Isa,
246     Eisa,
247     MicroChannel,
248     TurboChannel,
249     PCIBus,
250     VMEBus,
251     NuBus,
252     PCMCIABus,
253     CBus,
254     MPIBus,
255     MPSABus,
256     ProcessorInternal,
257     InternalPowerBus,
258     PNPISABus,
259     PNPBus,
260     MaximumInterfaceType
261 }INTERFACE_TYPE, *PINTERFACE_TYPE;
262 
263 typedef enum _BUS_DATA_TYPE
264 {
265     ConfigurationSpaceUndefined = -1,
266     Cmos,
267     EisaConfiguration,
268     Pos,
269     CbusConfiguration,
270     PCIConfiguration,
271     VMEConfiguration,
272     NuBusConfiguration,
273     PCMCIAConfiguration,
274     MPIConfiguration,
275     MPSAConfiguration,
276     PNPISAConfiguration,
277     SgiInternalConfiguration,
278     MaximumBusDataType
279 } BUS_DATA_TYPE, *PBUS_DATA_TYPE;
280 
281 #if defined(NT_PROCESSOR_GROUPS)
282 
283 typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY;
284 
285 enum _IRQ_DEVICE_POLICY_USHORT {
286   IrqPolicyMachineDefault = 0,
287   IrqPolicyAllCloseProcessors = 1,
288   IrqPolicyOneCloseProcessor = 2,
289   IrqPolicyAllProcessorsInMachine = 3,
290   IrqPolicyAllProcessorsInGroup = 3,
291   IrqPolicySpecifiedProcessors = 4,
292   IrqPolicySpreadMessagesAcrossAllProcessors = 5};
293 
294 #else /* defined(NT_PROCESSOR_GROUPS) */
295 
296 typedef enum _IRQ_DEVICE_POLICY {
297   IrqPolicyMachineDefault = 0,
298   IrqPolicyAllCloseProcessors,
299   IrqPolicyOneCloseProcessor,
300   IrqPolicyAllProcessorsInMachine,
301   IrqPolicySpecifiedProcessors,
302   IrqPolicySpreadMessagesAcrossAllProcessors
303 } IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY;
304 
305 #endif
306 
307 typedef enum _IRQ_PRIORITY {
308   IrqPriorityUndefined = 0,
309   IrqPriorityLow,
310   IrqPriorityNormal,
311   IrqPriorityHigh
312 } IRQ_PRIORITY, *PIRQ_PRIORITY;
313 
314 #define IO_RESOURCE_PREFERRED             0x01
315 #define IO_RESOURCE_DEFAULT               0x02
316 #define IO_RESOURCE_ALTERNATIVE           0x08
317 
318 typedef struct _IO_RESOURCE_DESCRIPTOR {
319   UCHAR Option;
320   UCHAR Type;
321   UCHAR ShareDisposition;
322   UCHAR Spare1;
323   USHORT Flags;
324   USHORT Spare2;
325   union {
326     struct {
327       ULONG Length;
328       ULONG Alignment;
329       PHYSICAL_ADDRESS MinimumAddress;
330       PHYSICAL_ADDRESS MaximumAddress;
331     } Port;
332     struct {
333       ULONG Length;
334       ULONG Alignment;
335       PHYSICAL_ADDRESS MinimumAddress;
336       PHYSICAL_ADDRESS MaximumAddress;
337     } Memory;
338     struct {
339       ULONG MinimumVector;
340       ULONG MaximumVector;
341 #if defined(NT_PROCESSOR_GROUPS)
342       IRQ_DEVICE_POLICY AffinityPolicy;
343       USHORT Group;
344 #else
345       IRQ_DEVICE_POLICY AffinityPolicy;
346 #endif
347       IRQ_PRIORITY PriorityPolicy;
348       KAFFINITY TargetedProcessors;
349     } Interrupt;
350     struct {
351       ULONG MinimumChannel;
352       ULONG MaximumChannel;
353     } Dma;
354     struct {
355       ULONG Length;
356       ULONG Alignment;
357       PHYSICAL_ADDRESS MinimumAddress;
358       PHYSICAL_ADDRESS MaximumAddress;
359     } Generic;
360     struct {
361       ULONG Data[3];
362     } DevicePrivate;
363     struct {
364       ULONG Length;
365       ULONG MinBusNumber;
366       ULONG MaxBusNumber;
367       ULONG Reserved;
368     } BusNumber;
369     struct {
370       ULONG Priority;
371       ULONG Reserved1;
372       ULONG Reserved2;
373     } ConfigData;
374   } u;
375 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
376 
377 typedef struct _IO_RESOURCE_LIST {
378   USHORT Version;
379   USHORT Revision;
380   ULONG Count;
381   IO_RESOURCE_DESCRIPTOR Descriptors[1];
382 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
383 
384 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
385   ULONG ListSize;
386   INTERFACE_TYPE InterfaceType;
387   ULONG BusNumber;
388   ULONG SlotNumber;
389   ULONG Reserved[3];
390   ULONG AlternativeLists;
391   IO_RESOURCE_LIST List[1];
392 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
393 
394 //
395 // File Information Classes for NtQueryInformationFile
396 //
397 typedef enum _FILE_INFORMATION_CLASS
398 {
399     FileDirectoryInformation = 1,
400     FileFullDirectoryInformation = 2,
401     FileBothDirectoryInformation = 3,
402     FileBasicInformation = 4,
403     FileStandardInformation = 5,
404     FileInternalInformation = 6,
405     FileEaInformation = 7,
406     FileAccessInformation = 8,
407     FileNameInformation = 9,
408     FileRenameInformation = 10,
409     FileLinkInformation = 11,
410     FileNamesInformation = 12,
411     FileDispositionInformation = 13,
412     FilePositionInformation = 14,
413     FileFullEaInformation = 15,
414     FileModeInformation = 16,
415     FileAlignmentInformation = 17,
416     FileAllInformation = 18,
417     FileAllocationInformation = 19,
418     FileEndOfFileInformation = 20,
419     FileAlternateNameInformation = 21,
420     FileStreamInformation = 22,
421     FilePipeInformation = 23,
422     FilePipeLocalInformation = 24,
423     FilePipeRemoteInformation = 25,
424     FileMailslotQueryInformation = 26,
425     FileMailslotSetInformation = 27,
426     FileCompressionInformation = 28,
427     FileObjectIdInformation = 29,
428     FileCompletionInformation = 30,
429     FileMoveClusterInformation = 31,
430     FileQuotaInformation = 32,
431     FileReparsePointInformation = 33,
432     FileNetworkOpenInformation = 34,
433     FileAttributeTagInformation = 35,
434     FileTrackingInformation = 36,
435     FileIdBothDirectoryInformation = 37,
436     FileIdFullDirectoryInformation = 38,
437     FileValidDataLengthInformation = 39,
438     FileShortNameInformation = 40,
439     FileIoCompletionNotificationInformation = 41,
440 #if (NTDDI_VERSION >= NTDDI_VISTA) || defined(__REACTOS__)
441     FileIoStatusBlockRangeInformation = 42,
442     FileIoPriorityHintInformation = 43,
443     FileSfioReserveInformation = 44,
444     FileSfioVolumeInformation = 45,
445     FileHardLinkInformation = 46,
446     FileProcessIdsUsingFileInformation = 47,
447     FileNormalizedNameInformation = 48,
448     FileNetworkPhysicalNameInformation = 49,
449 #endif
450 #if (NTDDI_VERSION >= NTDDI_WIN7) || defined(__REACTOS__)
451     FileIdGlobalTxDirectoryInformation = 50,
452     FileIsRemoteDeviceInformation = 51,
453     FileAttributeCacheInformation = 52, // FileUnusedInformation since Windows 8.1
454     FileNumaNodeInformation = 53,
455     FileStandardLinkInformation = 54,
456     FileRemoteProtocolInformation = 55,
457 #endif
458 #if (NTDDI_VERSION >= NTDDI_WIN8) || defined(__REACTOS__)
459     FileRenameInformationBypassAccessCheck = 56,
460     FileLinkInformationBypassAccessCheck = 57,
461     FileVolumeNameInformation = 58,
462     FileIdInformation = 59,
463     FileIdExtdDirectoryInformation = 60,
464 #endif
465 #if (NTDDI_VERSION >= NTDDI_WINBLUE) || defined(__REACTOS__)
466     FileReplaceCompletionInformation = 61,
467     FileHardLinkFullIdInformation = 62,
468     FileIdExtdBothDirectoryInformation = 63, // Update 1
469 #endif
470 #if (NTDDI_VERSION >= NTDDI_WIN10_RS1) || defined(__REACTOS__)
471     FileDispositionInformationEx = 64,
472     FileRenameInformationEx = 65,
473     FileRenameInformationExBypassAccessCheck = 66,
474 #endif
475 #if (NTDDI_VERSION >= NTDDI_WIN10_RS2) || defined(__REACTOS__)
476     FileDesiredStorageClassInformation = 67,
477     FileStatInformation = 68,
478 #endif
479 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3) || defined(__REACTOS__)
480     FileMemoryPartitionInformation = 69,
481 #endif
482 #if (NTDDI_VERSION >= NTDDI_WIN10_RS4) || defined(__REACTOS__)
483     FileStatLxInformation = 70,
484     FileCaseSensitiveInformation = 71,
485 #endif
486 #if (NTDDI_VERSION >= NTDDI_WIN10_RS5) || defined(__REACTOS__)
487     FileLinkInformationEx = 72,
488     FileLinkInformationExBypassAccessCheck = 73,
489     FileStorageReserveIdInformation = 74,
490     FileCaseSensitiveInformationForceAccessCheck = 75,
491 #endif
492 #if (NTDDI_VERSION >= NTDDI_WIN11) || defined(__REACTOS__) // 10.0.20150.1000
493     FileKnownFolderInformation = 76,
494 #endif
495     FileMaximumInformation
496 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
497 
498 //
499 // File Information Classes for NtQueryInformationFileSystem
500 //
501 typedef enum _FSINFOCLASS
502 {
503     FileFsVolumeInformation = 1,
504     FileFsLabelInformation,
505     FileFsSizeInformation,
506     FileFsDeviceInformation,
507     FileFsAttributeInformation,
508     FileFsControlInformation,
509     FileFsFullSizeInformation,
510     FileFsObjectIdInformation,
511     FileFsDriverPathInformation,
512     FileFsMaximumInformation
513 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
514 
515 #endif
516 
517 //
518 // Dock Profile Status
519 //
520 typedef enum _PROFILE_STATUS
521 {
522     DOCK_NOTDOCKDEVICE,
523     DOCK_QUIESCENT,
524     DOCK_ARRIVING,
525     DOCK_DEPARTING,
526     DOCK_EJECTIRP_COMPLETED
527 } PROFILE_STATUS, *PPROFILE_STATUS;
528 
529 //
530 // Device Node States
531 //
532 typedef enum _PNP_DEVNODE_STATE
533 {
534     DeviceNodeUnspecified = 0x300,
535     DeviceNodeUninitialized = 0x301,
536     DeviceNodeInitialized = 0x302,
537     DeviceNodeDriversAdded = 0x303,
538     DeviceNodeResourcesAssigned = 0x304,
539     DeviceNodeStartPending = 0x305,
540     DeviceNodeStartCompletion = 0x306,
541     DeviceNodeStartPostWork = 0x307,
542     DeviceNodeStarted = 0x308,
543     DeviceNodeQueryStopped = 0x309,
544     DeviceNodeStopped = 0x30a,
545     DeviceNodeRestartCompletion = 0x30b,
546     DeviceNodeEnumeratePending = 0x30c,
547     DeviceNodeEnumerateCompletion = 0x30d,
548     DeviceNodeAwaitingQueuedDeletion = 0x30e,
549     DeviceNodeAwaitingQueuedRemoval = 0x30f,
550     DeviceNodeQueryRemoved = 0x310,
551     DeviceNodeRemovePendingCloses = 0x311,
552     DeviceNodeRemoved = 0x312,
553     DeviceNodeDeletePendingCloses = 0x313,
554     DeviceNodeDeleted = 0x314,
555     MaxDeviceNodeState = 0x315,
556 } PNP_DEVNODE_STATE;
557 
558 #ifdef NTOS_MODE_USER
559 
560 //
561 // I/O Status Block
562 //
563 typedef struct _IO_STATUS_BLOCK
564 {
565     union
566     {
567         NTSTATUS Status;
568         PVOID Pointer;
569     };
570     ULONG_PTR Information;
571 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
572 
573 //
574 // File Information structures for NtQueryInformationFile
575 //
576 typedef struct _FILE_BASIC_INFORMATION
577 {
578     LARGE_INTEGER CreationTime;
579     LARGE_INTEGER LastAccessTime;
580     LARGE_INTEGER LastWriteTime;
581     LARGE_INTEGER ChangeTime;
582     ULONG FileAttributes;
583 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
584 
585 typedef struct _FILE_STANDARD_INFORMATION
586 {
587     LARGE_INTEGER AllocationSize;
588     LARGE_INTEGER EndOfFile;
589     ULONG NumberOfLinks;
590     BOOLEAN DeletePending;
591     BOOLEAN Directory;
592 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
593 
594 typedef struct _FILE_STREAM_INFORMATION
595 {
596     ULONG NextEntryOffset;
597     ULONG StreamNameLength;
598     LARGE_INTEGER StreamSize;
599     LARGE_INTEGER StreamAllocationSize;
600     WCHAR StreamName[1];
601 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
602 
603 typedef struct _FILE_NETWORK_OPEN_INFORMATION
604 {
605     LARGE_INTEGER CreationTime;
606     LARGE_INTEGER LastAccessTime;
607     LARGE_INTEGER LastWriteTime;
608     LARGE_INTEGER ChangeTime;
609     LARGE_INTEGER AllocationSize;
610     LARGE_INTEGER EndOfFile;
611     ULONG FileAttributes;
612 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
613 
614 typedef struct _FILE_EA_INFORMATION
615 {
616     ULONG EaSize;
617 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
618 
619 typedef struct _FILE_ACCESS_INFORMATION
620 {
621     ACCESS_MASK AccessFlags;
622 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
623 
624 typedef struct _FILE_COMPRESSION_INFORMATION
625 {
626     LARGE_INTEGER CompressedFileSize;
627     USHORT CompressionFormat;
628     UCHAR CompressionUnitShift;
629     UCHAR ChunkShift;
630     UCHAR ClusterShift;
631     UCHAR Reserved[3];
632 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
633 
634 typedef struct _FILE_POSITION_INFORMATION
635 {
636   LARGE_INTEGER CurrentByteOffset;
637 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
638 
639 typedef struct _FILE_DISPOSITION_INFORMATION
640 {
641     BOOLEAN DeleteFile;
642 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
643 
644 typedef struct _FILE_FULL_EA_INFORMATION
645 {
646     ULONG NextEntryOffset;
647     UCHAR Flags;
648     UCHAR EaNameLength;
649     USHORT EaValueLength;
650     CHAR EaName[1];
651 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
652 
653 typedef struct _FILE_QUOTA_INFORMATION
654 {
655     ULONG NextEntryOffset;
656     ULONG SidLength;
657     LARGE_INTEGER ChangeTime;
658     LARGE_INTEGER QuotaUsed;
659     LARGE_INTEGER QuotaThreshold;
660     LARGE_INTEGER QuotaLimit;
661     SID Sid;
662 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
663 
664 typedef struct _FILE_INTERNAL_INFORMATION
665 {
666     LARGE_INTEGER IndexNumber;
667 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
668 
669 typedef struct _FILE_RENAME_INFORMATION
670 {
671     BOOLEAN ReplaceIfExists;
672     HANDLE  RootDirectory;
673     ULONG FileNameLength;
674     WCHAR FileName[1];
675 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
676 
677 typedef struct _FILE_PIPE_INFORMATION
678 {
679     ULONG ReadMode;
680     ULONG CompletionMode;
681 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
682 
683 typedef struct _FILE_PIPE_LOCAL_INFORMATION
684 {
685     ULONG NamedPipeType;
686     ULONG NamedPipeConfiguration;
687     ULONG MaximumInstances;
688     ULONG CurrentInstances;
689     ULONG InboundQuota;
690     ULONG ReadDataAvailable;
691     ULONG OutboundQuota;
692     ULONG WriteQuotaAvailable;
693     ULONG NamedPipeState;
694     ULONG NamedPipeEnd;
695 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
696 
697 typedef struct _FILE_PIPE_REMOTE_INFORMATION
698 {
699     LARGE_INTEGER CollectDataTime;
700     ULONG MaximumCollectionCount;
701 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
702 
703 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION
704 {
705     ULONG MaximumMessageSize;
706     ULONG MailslotQuota;
707     ULONG NextMessageSize;
708     ULONG MessagesAvailable;
709     LARGE_INTEGER ReadTimeout;
710 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
711 
712 typedef struct _FILE_MAILSLOT_SET_INFORMATION
713 {
714     PLARGE_INTEGER ReadTimeout;
715 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
716 
717 typedef struct _FILE_FULL_DIR_INFORMATION
718 {
719     ULONG NextEntryOffset;
720     ULONG FileIndex;
721     LARGE_INTEGER CreationTime;
722     LARGE_INTEGER LastAccessTime;
723     LARGE_INTEGER LastWriteTime;
724     LARGE_INTEGER ChangeTime;
725     LARGE_INTEGER EndOfFile;
726     LARGE_INTEGER AllocationSize;
727     ULONG FileAttributes;
728     ULONG FileNameLength;
729     ULONG EaSize;
730     WCHAR FileName[1];
731 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
732 
733 typedef struct _FILE_BOTH_DIR_INFORMATION
734 {
735     ULONG NextEntryOffset;
736     ULONG FileIndex;
737     LARGE_INTEGER CreationTime;
738     LARGE_INTEGER LastAccessTime;
739     LARGE_INTEGER LastWriteTime;
740     LARGE_INTEGER ChangeTime;
741     LARGE_INTEGER EndOfFile;
742     LARGE_INTEGER AllocationSize;
743     ULONG FileAttributes;
744     ULONG FileNameLength;
745     ULONG EaSize;
746     CCHAR ShortNameLength;
747     WCHAR ShortName[12];
748     WCHAR FileName[1];
749 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
750 
751 typedef struct _FILE_COMPLETION_INFORMATION
752 {
753     HANDLE Port;
754     PVOID Key;
755 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
756 
757 typedef struct _FILE_IO_COMPLETION_NOTIFICATION_INFORMATION
758 {
759     ULONG Flags;
760 } FILE_IO_COMPLETION_NOTIFICATION_INFORMATION, *PFILE_IO_COMPLETION_NOTIFICATION_INFORMATION;
761 
762 typedef struct _FILE_LINK_INFORMATION
763 {
764     BOOLEAN ReplaceIfExists;
765     HANDLE RootDirectory;
766     ULONG FileNameLength;
767     WCHAR FileName[1];
768 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
769 
770 typedef struct _FILE_NAME_INFORMATION
771 {
772     ULONG FileNameLength;
773     WCHAR FileName[1];
774 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
775 
776 typedef struct _FILE_ALLOCATION_INFORMATION
777 {
778     LARGE_INTEGER AllocationSize;
779 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
780 
781 typedef struct _FILE_END_OF_FILE_INFORMATION
782 {
783     LARGE_INTEGER EndOfFile;
784 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
785 
786 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION
787 {
788     LARGE_INTEGER ValidDataLength;
789 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
790 
791 typedef struct _FILE_DIRECTORY_INFORMATION
792 {
793     ULONG NextEntryOffset;
794     ULONG FileIndex;
795     LARGE_INTEGER CreationTime;
796     LARGE_INTEGER LastAccessTime;
797     LARGE_INTEGER LastWriteTime;
798     LARGE_INTEGER ChangeTime;
799     LARGE_INTEGER EndOfFile;
800     LARGE_INTEGER AllocationSize;
801     ULONG FileAttributes;
802     ULONG FileNameLength;
803     WCHAR FileName[1];
804 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
805 
806 typedef struct _FILE_IO_COMPLETION_INFORMATION
807 {
808     PVOID KeyContext;
809     PVOID ApcContext;
810     IO_STATUS_BLOCK IoStatusBlock;
811 } FILE_IO_COMPLETION_INFORMATION, *PFILE_IO_COMPLETION_INFORMATION;
812 
813 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION
814 {
815     ULONG FileAttributes;
816     ULONG ReparseTag;
817 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
818 
819 typedef struct _FILE_TRACKING_INFORMATION
820 {
821     HANDLE DestinationFile;
822     ULONG ObjectInformationLength;
823     CHAR ObjectInformation[1];
824 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
825 
826 //
827 // File System Information structures for NtQueryInformationFile
828 //
829 typedef struct _FILE_FS_DEVICE_INFORMATION
830 {
831     DEVICE_TYPE DeviceType;
832     ULONG Characteristics;
833 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
834 
835 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
836 {
837     ULONG FileSystemAttributes;
838     ULONG MaximumComponentNameLength;
839     ULONG FileSystemNameLength;
840     WCHAR FileSystemName[1];
841 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
842 
843 typedef struct _FILE_FS_SIZE_INFORMATION
844 {
845     LARGE_INTEGER TotalAllocationUnits;
846     LARGE_INTEGER AvailableAllocationUnits;
847     ULONG SectorsPerAllocationUnit;
848     ULONG BytesPerSector;
849 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
850 
851 typedef struct _FILE_FS_FULL_SIZE_INFORMATION
852 {
853     LARGE_INTEGER   TotalAllocationUnits;
854     LARGE_INTEGER   CallerAvailableAllocationUnits;
855     LARGE_INTEGER   ActualAvailableAllocationUnits;
856     ULONG           SectorsPerAllocationUnit;
857     ULONG           BytesPerSector;
858 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
859 
860 typedef struct _FILE_FS_LABEL_INFORMATION
861 {
862     ULONG VolumeLabelLength;
863     WCHAR VolumeLabel[1];
864 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
865 
866 typedef struct _FILE_FS_VOLUME_INFORMATION
867 {
868     LARGE_INTEGER VolumeCreationTime;
869     ULONG VolumeSerialNumber;
870     ULONG VolumeLabelLength;
871     BOOLEAN SupportsObjects;
872     WCHAR VolumeLabel[1];
873 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
874 
875 //
876 // Pipe Structures for IOCTL_PIPE_XXX
877 //
878 typedef struct _FILE_PIPE_WAIT_FOR_BUFFER
879 {
880     LARGE_INTEGER Timeout;
881     ULONG NameLength;
882     BOOLEAN TimeoutSpecified;
883     WCHAR Name[1];
884 } FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
885 
886 typedef struct _FILE_PIPE_PEEK_BUFFER
887 {
888     ULONG NamedPipeState;
889     ULONG ReadDataAvailable;
890     ULONG NumberOfMessages;
891     ULONG MessageLength;
892     CHAR Data[1];
893 } FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
894 
895 //
896 // I/O Error Log Structures
897 //
898 typedef struct _IO_ERROR_LOG_PACKET
899 {
900     UCHAR MajorFunctionCode;
901     UCHAR RetryCount;
902     USHORT DumpDataSize;
903     USHORT NumberOfStrings;
904     USHORT StringOffset;
905     USHORT EventCategory;
906     NTSTATUS ErrorCode;
907     ULONG UniqueErrorValue;
908     NTSTATUS FinalStatus;
909     ULONG SequenceNumber;
910     ULONG IoControlCode;
911     LARGE_INTEGER DeviceOffset;
912     ULONG DumpData[1];
913 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
914 
915 typedef struct _IO_ERROR_LOG_MESSAGE
916 {
917     USHORT Type;
918     USHORT Size;
919     USHORT DriverNameLength;
920     LARGE_INTEGER TimeStamp;
921     ULONG DriverNameOffset;
922     IO_ERROR_LOG_PACKET EntryData;
923 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
924 
925 #endif
926 
927 //
928 // I/O Completion Information structures
929 //
930 typedef struct _IO_COMPLETION_BASIC_INFORMATION
931 {
932     LONG Depth;
933 } IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION;
934 
935 //
936 // Parameters for NtCreateMailslotFile/NtCreateNamedPipeFile
937 //
938 typedef struct _MAILSLOT_CREATE_PARAMETERS
939 {
940     ULONG MailslotQuota;
941     ULONG MaximumMessageSize;
942     LARGE_INTEGER ReadTimeout;
943     BOOLEAN TimeoutSpecified;
944 } MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS;
945 
946 typedef struct _NAMED_PIPE_CREATE_PARAMETERS
947 {
948     ULONG NamedPipeType;
949     ULONG ReadMode;
950     ULONG CompletionMode;
951     ULONG MaximumInstances;
952     ULONG InboundQuota;
953     ULONG OutboundQuota;
954     LARGE_INTEGER DefaultTimeout;
955     BOOLEAN TimeoutSpecified;
956 } NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS;
957 
958 #ifndef NTOS_MODE_USER
959 
960 //
961 // I/O Timer Object
962 //
963 typedef struct _IO_TIMER
964 {
965     USHORT Type;
966     USHORT TimerEnabled;
967     LIST_ENTRY IoTimerList;
968     PIO_TIMER_ROUTINE TimerRoutine;
969     PVOID Context;
970     PDEVICE_OBJECT DeviceObject;
971 } IO_TIMER;
972 
973 //
974 // Driver Extension
975 //
976 typedef struct _IO_CLIENT_EXTENSION
977 {
978     struct _IO_CLIENT_EXTENSION *NextExtension;
979     PVOID ClientIdentificationAddress;
980 } IO_CLIENT_EXTENSION, *PIO_CLIENT_EXTENSION;
981 
982 #define DEVNODE_HISTORY_SIZE 20
983 
984 //
985 // Device Node
986 //
987 typedef struct _DEVICE_NODE
988 {
989     struct _DEVICE_NODE *Sibling;
990     struct _DEVICE_NODE *Child;
991     struct _DEVICE_NODE *Parent;
992     struct _DEVICE_NODE *LastChild;
993     ULONG Level;
994     struct _PO_DEVICE_NOTIFY *Notify;
995     PO_IRP_MANAGER PoIrpManager;
996     PNP_DEVNODE_STATE State;
997     PNP_DEVNODE_STATE PreviousState;
998     PNP_DEVNODE_STATE StateHistory[DEVNODE_HISTORY_SIZE];
999     ULONG StateHistoryEntry;
1000     NTSTATUS CompletionStatus;
1001     PIRP PendingIrp;
1002     ULONG Flags;
1003     ULONG UserFlags;
1004     ULONG Problem;
1005     PDEVICE_OBJECT PhysicalDeviceObject;
1006     PCM_RESOURCE_LIST ResourceList;
1007     PCM_RESOURCE_LIST ResourceListTranslated;
1008     UNICODE_STRING InstancePath;
1009     UNICODE_STRING ServiceName;
1010     PDEVICE_OBJECT DuplicatePDO;
1011     PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements;
1012     INTERFACE_TYPE InterfaceType;
1013     ULONG BusNumber;
1014     INTERFACE_TYPE ChildInterfaceType;
1015     ULONG ChildBusNumber;
1016     USHORT ChildBusTypeIndex;
1017     UCHAR RemovalPolicy;
1018     UCHAR HardwareRemovalPolicy;
1019     LIST_ENTRY TargetDeviceNotify;
1020     LIST_ENTRY DeviceArbiterList;
1021     LIST_ENTRY DeviceTranslatorList;
1022     USHORT NoTranslatorMask;
1023     USHORT QueryTranslatorMask;
1024     USHORT NoArbiterMask;
1025     USHORT QueryArbiterMask;
1026     union
1027     {
1028         struct _DEVICE_NODE *LegacyDeviceNode;
1029         PDEVICE_RELATIONS PendingDeviceRelations;
1030     } OverUsed1;
1031     union
1032     {
1033         struct _DEVICE_NODE *NextResourceDeviceNode;
1034     } OverUsed2;
1035     PCM_RESOURCE_LIST BootResources;
1036 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1037     PCM_RESOURCE_LIST BootResourcesTranslated;
1038 #endif
1039     ULONG CapabilityFlags;
1040     struct
1041     {
1042         PROFILE_STATUS DockStatus;
1043         LIST_ENTRY ListEntry;
1044         WCHAR *SerialNumber;
1045     } DockInfo;
1046     ULONG DisableableDepends;
1047     LIST_ENTRY PendedSetInterfaceState;
1048     LIST_ENTRY LegacyBusListEntry;
1049     ULONG DriverUnloadRetryCount;
1050     struct _DEVICE_NODE *PreviousParent;
1051     ULONG DeletedChildren;
1052 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1053     ULONG NumaNodeIndex;
1054 #endif
1055 } DEVICE_NODE, *PDEVICE_NODE;
1056 
1057 //
1058 // Resource Aribtrer Entry
1059 //
1060 typedef struct _PI_RESOURCE_ARBITER_ENTRY
1061 {
1062     LIST_ENTRY DeviceArbiterList;
1063     UCHAR ResourceType;
1064     PARBITER_INTERFACE ArbiterInterface;
1065     ULONG Level;
1066     LIST_ENTRY ResourceList;
1067     LIST_ENTRY BestResourceList;
1068     LIST_ENTRY BestConfig;
1069     LIST_ENTRY ActiveArbiterList;
1070     UCHAR State;
1071     UCHAR ResourcesChanged;
1072 } PI_RESOURCE_ARBITER_ENTRY, *PPI_RESOURCE_ARBITER_ENTRY;
1073 
1074 //
1075 // Extended Device Object Extension Structure
1076 //
1077 typedef struct _EXTENDED_DEVOBJ_EXTENSION
1078 {
1079     CSHORT Type;
1080     USHORT Size;
1081     PDEVICE_OBJECT DeviceObject;
1082     ULONG PowerFlags;
1083     struct _DEVICE_OBJECT_POWER_EXTENSION *Dope;
1084     ULONG ExtensionFlags;
1085     struct _DEVICE_NODE *DeviceNode;
1086     PDEVICE_OBJECT AttachedTo;
1087     LONG StartIoCount;
1088     LONG StartIoKey;
1089     ULONG StartIoFlags;
1090     struct _VPB *Vpb;
1091 } EXTENDED_DEVOBJ_EXTENSION, *PEXTENDED_DEVOBJ_EXTENSION;
1092 
1093 //
1094 // Extended Driver Object Extension Structure
1095 //
1096 typedef struct _EXTENDED_DRIVER_EXTENSION
1097 {
1098     struct _DRIVER_OBJECT *DriverObject;
1099     PDRIVER_ADD_DEVICE AddDevice;
1100     ULONG Count;
1101     UNICODE_STRING ServiceKeyName;
1102     PIO_CLIENT_EXTENSION ClientDriverExtension;
1103     PFS_FILTER_CALLBACKS FsFilterCallbacks;
1104 } EXTENDED_DRIVER_EXTENSION, *PEXTENDED_DRIVER_EXTENSION;
1105 
1106 #endif // !NTOS_MODE_USER
1107 
1108 //
1109 // Firmware Boot File Path
1110 //
1111 typedef struct _FILE_PATH
1112 {
1113     ULONG Version;
1114     ULONG Length;
1115     ULONG Type;
1116     CHAR FilePath[1];
1117 } FILE_PATH, *PFILE_PATH;
1118 
1119 //
1120 // Firmware Boot Options
1121 //
1122 typedef struct _BOOT_OPTIONS
1123 {
1124     ULONG Version;
1125     ULONG Length;
1126     ULONG Timeout;
1127     ULONG CurrentBootEntryId;
1128     ULONG NextBootEntryId;
1129     WCHAR HeadlessRedirection[1];
1130 } BOOT_OPTIONS, *PBOOT_OPTIONS;
1131 
1132 //
1133 // Firmware Boot Entry
1134 //
1135 typedef struct _BOOT_ENTRY
1136 {
1137     ULONG Version;
1138     ULONG Length;
1139     ULONG Id;
1140     ULONG Attributes;
1141     ULONG FriendlyNameOffset;
1142     ULONG BootFilePathOffset;
1143     ULONG OsOptionsLength;
1144     CHAR OsOptions[1];
1145 } BOOT_ENTRY, *PBOOT_ENTRY;
1146 
1147 //
1148 // Firmware Driver Entry
1149 //
1150 typedef struct _EFI_DRIVER_ENTRY
1151 {
1152     ULONG Version;
1153     ULONG Length;
1154     ULONG Id;
1155     ULONG Attributes;
1156     ULONG FriendlyNameOffset;
1157     ULONG DriverFilePathOffset;
1158 } EFI_DRIVER_ENTRY, *PEFI_DRIVER_ENTRY;
1159 
1160 #ifdef NTOS_MODE_USER
1161 
1162 //
1163 // APC Callback for NtReadFile, NtWriteFile
1164 //
1165 typedef VOID
1166 (NTAPI *PIO_APC_ROUTINE)(
1167     _In_ PVOID ApcContext,
1168     _In_ PIO_STATUS_BLOCK IoStatusBlock,
1169     _In_ ULONG Reserved);
1170 
1171 //
1172 // Mailslot IOCTL Codes
1173 //
1174 #define FSCTL_MAILSLOT_PEEK             \
1175     CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
1176 
1177 //
1178 // Pipe IOCTL Codes
1179 //
1180 #define FSCTL_PIPE_ASSIGN_EVENT         \
1181     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
1182 #define FSCTL_PIPE_DISCONNECT           \
1183     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
1184 #define FSCTL_PIPE_LISTEN               \
1185     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
1186 #define FSCTL_PIPE_PEEK                 \
1187     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
1188 #define FSCTL_PIPE_QUERY_EVENT          \
1189     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
1190 #define FSCTL_PIPE_TRANSCEIVE           \
1191     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER,  FILE_READ_DATA | FILE_WRITE_DATA)
1192 #define FSCTL_PIPE_WAIT                 \
1193     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
1194 #define FSCTL_PIPE_IMPERSONATE          \
1195     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
1196 #define FSCTL_PIPE_SET_CLIENT_PROCESS   \
1197     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
1198 #define FSCTL_PIPE_QUERY_CLIENT_PROCESS \
1199     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
1200 #define FSCTL_PIPE_INTERNAL_READ        \
1201     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
1202 #define FSCTL_PIPE_INTERNAL_WRITE       \
1203     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
1204 #define FSCTL_PIPE_INTERNAL_TRANSCEIVE  \
1205     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
1206 #define FSCTL_PIPE_INTERNAL_READ_OVFLOW \
1207     CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
1208 
1209 //
1210 // Tape IOCTL Codes
1211 //
1212 #define IOCTL_TAPE_ERASE                \
1213     CTL_CODE(FILE_DEVICE_TAPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1214 #define IOCTL_TAPE_PREPARE              \
1215     CTL_CODE(FILE_DEVICE_TAPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS)
1216 #define IOCTL_TAPE_WRITE_MARKS          \
1217     CTL_CODE(FILE_DEVICE_TAPE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1218 #define IOCTL_TAPE_GET_POSITION         \
1219     CTL_CODE(FILE_DEVICE_TAPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS)
1220 #define IOCTL_TAPE_SET_POSITION         \
1221     CTL_CODE(FILE_DEVICE_TAPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS)
1222 #define IOCTL_TAPE_GET_DRIVE_PARAMS     \
1223     CTL_CODE(FILE_DEVICE_TAPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS)
1224 #define IOCTL_TAPE_SET_DRIVE_PARAMS     \
1225     CTL_CODE(FILE_DEVICE_TAPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1226 #define IOCTL_TAPE_GET_MEDIA_PARAMS     \
1227     CTL_CODE(FILE_DEVICE_TAPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS)
1228 #define IOCTL_TAPE_SET_MEDIA_PARAMS     \
1229     CTL_CODE(FILE_DEVICE_TAPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS)
1230 #define IOCTL_TAPE_GET_STATUS           \
1231     CTL_CODE(FILE_DEVICE_TAPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS)
1232 #define IOCTL_TAPE_CREATE_PARTITION     \
1233     CTL_CODE(FILE_DEVICE_TAPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1234 
1235 //
1236 // Reparse points
1237 //
1238 
1239 #define SYMLINK_FLAG_RELATIVE   1
1240 
1241 typedef struct _REPARSE_DATA_BUFFER {
1242   ULONG ReparseTag;
1243   USHORT ReparseDataLength;
1244   USHORT Reserved;
1245   _ANONYMOUS_UNION union {
1246     struct {
1247       USHORT SubstituteNameOffset;
1248       USHORT SubstituteNameLength;
1249       USHORT PrintNameOffset;
1250       USHORT PrintNameLength;
1251       ULONG Flags;
1252       WCHAR PathBuffer[1];
1253     } SymbolicLinkReparseBuffer;
1254     struct {
1255       USHORT SubstituteNameOffset;
1256       USHORT SubstituteNameLength;
1257       USHORT PrintNameOffset;
1258       USHORT PrintNameLength;
1259       WCHAR PathBuffer[1];
1260     } MountPointReparseBuffer;
1261     struct {
1262       UCHAR DataBuffer[1];
1263     } GenericReparseBuffer;
1264   } DUMMYUNIONNAME;
1265 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
1266 
1267 #endif // NTOS_MODE_USER
1268 
1269 #endif
1270