Sync with trunk (r48545)
[reactos.git] / include / xdk / iofuncs.h
1 /******************************************************************************
2 * I/O Manager Functions *
3 ******************************************************************************/
4
5 $if (_WDMDDK_)
6 /*
7 * NTSTATUS
8 * IoAcquireRemoveLock(
9 * IN PIO_REMOVE_LOCK RemoveLock,
10 * IN OPTIONAL PVOID Tag)
11 */
12 #if DBG
13 #define IoAcquireRemoveLock(RemoveLock, Tag) \
14 IoAcquireRemoveLockEx(RemoveLock, Tag, __FILE__, __LINE__, sizeof (IO_REMOVE_LOCK))
15 #else
16 #define IoAcquireRemoveLock(RemoveLock, Tag) \
17 IoAcquireRemoveLockEx(RemoveLock, Tag, "", 1, sizeof (IO_REMOVE_LOCK))
18 #endif
19
20 /*
21 * VOID
22 * IoAdjustPagingPathCount(
23 * IN PLONG Count,
24 * IN BOOLEAN Increment)
25 */
26 #define IoAdjustPagingPathCount(_Count, \
27 _Increment) \
28 { \
29 if (_Increment) \
30 { \
31 InterlockedIncrement(_Count); \
32 } \
33 else \
34 { \
35 InterlockedDecrement(_Count); \
36 } \
37 }
38
39 #if !defined(_M_AMD64)
40 NTHALAPI
41 VOID
42 NTAPI
43 READ_PORT_BUFFER_UCHAR(
44 IN PUCHAR Port,
45 IN PUCHAR Buffer,
46 IN ULONG Count);
47
48 NTHALAPI
49 VOID
50 NTAPI
51 READ_PORT_BUFFER_ULONG(
52 IN PULONG Port,
53 IN PULONG Buffer,
54 IN ULONG Count);
55
56 NTHALAPI
57 VOID
58 NTAPI
59 READ_PORT_BUFFER_USHORT(
60 IN PUSHORT Port,
61 IN PUSHORT Buffer,
62 IN ULONG Count);
63
64 NTHALAPI
65 UCHAR
66 NTAPI
67 READ_PORT_UCHAR(
68 IN PUCHAR Port);
69
70 NTHALAPI
71 ULONG
72 NTAPI
73 READ_PORT_ULONG(
74 IN PULONG Port);
75
76 NTHALAPI
77 USHORT
78 NTAPI
79 READ_PORT_USHORT(
80 IN PUSHORT Port);
81
82 NTKERNELAPI
83 VOID
84 NTAPI
85 READ_REGISTER_BUFFER_UCHAR(
86 IN PUCHAR Register,
87 IN PUCHAR Buffer,
88 IN ULONG Count);
89
90 NTKERNELAPI
91 VOID
92 NTAPI
93 READ_REGISTER_BUFFER_ULONG(
94 IN PULONG Register,
95 IN PULONG Buffer,
96 IN ULONG Count);
97
98 NTKERNELAPI
99 VOID
100 NTAPI
101 READ_REGISTER_BUFFER_USHORT(
102 IN PUSHORT Register,
103 IN PUSHORT Buffer,
104 IN ULONG Count);
105
106 NTKERNELAPI
107 UCHAR
108 NTAPI
109 READ_REGISTER_UCHAR(
110 IN PUCHAR Register);
111
112 NTKERNELAPI
113 ULONG
114 NTAPI
115 READ_REGISTER_ULONG(
116 IN PULONG Register);
117
118 NTKERNELAPI
119 USHORT
120 NTAPI
121 READ_REGISTER_USHORT(
122 IN PUSHORT Register);
123
124 NTHALAPI
125 VOID
126 NTAPI
127 WRITE_PORT_BUFFER_UCHAR(
128 IN PUCHAR Port,
129 IN PUCHAR Buffer,
130 IN ULONG Count);
131
132 NTHALAPI
133 VOID
134 NTAPI
135 WRITE_PORT_BUFFER_ULONG(
136 IN PULONG Port,
137 IN PULONG Buffer,
138 IN ULONG Count);
139
140 NTHALAPI
141 VOID
142 NTAPI
143 WRITE_PORT_BUFFER_USHORT(
144 IN PUSHORT Port,
145 IN PUSHORT Buffer,
146 IN ULONG Count);
147
148 NTHALAPI
149 VOID
150 NTAPI
151 WRITE_PORT_UCHAR(
152 IN PUCHAR Port,
153 IN UCHAR Value);
154
155 NTHALAPI
156 VOID
157 NTAPI
158 WRITE_PORT_ULONG(
159 IN PULONG Port,
160 IN ULONG Value);
161
162 NTHALAPI
163 VOID
164 NTAPI
165 WRITE_PORT_USHORT(
166 IN PUSHORT Port,
167 IN USHORT Value);
168
169 NTKERNELAPI
170 VOID
171 NTAPI
172 WRITE_REGISTER_BUFFER_UCHAR(
173 IN PUCHAR Register,
174 IN PUCHAR Buffer,
175 IN ULONG Count);
176
177 NTKERNELAPI
178 VOID
179 NTAPI
180 WRITE_REGISTER_BUFFER_ULONG(
181 IN PULONG Register,
182 IN PULONG Buffer,
183 IN ULONG Count);
184
185 NTKERNELAPI
186 VOID
187 NTAPI
188 WRITE_REGISTER_BUFFER_USHORT(
189 IN PUSHORT Register,
190 IN PUSHORT Buffer,
191 IN ULONG Count);
192
193 NTKERNELAPI
194 VOID
195 NTAPI
196 WRITE_REGISTER_UCHAR(
197 IN PUCHAR Register,
198 IN UCHAR Value);
199
200 NTKERNELAPI
201 VOID
202 NTAPI
203 WRITE_REGISTER_ULONG(
204 IN PULONG Register,
205 IN ULONG Value);
206
207 NTKERNELAPI
208 VOID
209 NTAPI
210 WRITE_REGISTER_USHORT(
211 IN PUSHORT Register,
212 IN USHORT Value);
213
214 #else
215
216 FORCEINLINE
217 VOID
218 READ_PORT_BUFFER_UCHAR(
219 IN PUCHAR Port,
220 IN PUCHAR Buffer,
221 IN ULONG Count)
222 {
223 __inbytestring((USHORT)(ULONG_PTR)Port, Buffer, Count);
224 }
225
226 FORCEINLINE
227 VOID
228 READ_PORT_BUFFER_ULONG(
229 IN PULONG Port,
230 IN PULONG Buffer,
231 IN ULONG Count)
232 {
233 __indwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count);
234 }
235
236 FORCEINLINE
237 VOID
238 READ_PORT_BUFFER_USHORT(
239 IN PUSHORT Port,
240 IN PUSHORT Buffer,
241 IN ULONG Count)
242 {
243 __inwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count);
244 }
245
246 FORCEINLINE
247 UCHAR
248 READ_PORT_UCHAR(
249 IN PUCHAR Port)
250 {
251 return __inbyte((USHORT)(ULONG_PTR)Port);
252 }
253
254 FORCEINLINE
255 ULONG
256 READ_PORT_ULONG(
257 IN PULONG Port)
258 {
259 return __indword((USHORT)(ULONG_PTR)Port);
260 }
261
262 FORCEINLINE
263 USHORT
264 READ_PORT_USHORT(
265 IN PUSHORT Port)
266 {
267 return __inword((USHORT)(ULONG_PTR)Port);
268 }
269
270 FORCEINLINE
271 VOID
272 READ_REGISTER_BUFFER_UCHAR(
273 IN PUCHAR Register,
274 IN PUCHAR Buffer,
275 IN ULONG Count)
276 {
277 __movsb(Register, Buffer, Count);
278 }
279
280 FORCEINLINE
281 VOID
282 READ_REGISTER_BUFFER_ULONG(
283 IN PULONG Register,
284 IN PULONG Buffer,
285 IN ULONG Count)
286 {
287 __movsd(Register, Buffer, Count);
288 }
289
290 FORCEINLINE
291 VOID
292 READ_REGISTER_BUFFER_USHORT(
293 IN PUSHORT Register,
294 IN PUSHORT Buffer,
295 IN ULONG Count)
296 {
297 __movsw(Register, Buffer, Count);
298 }
299
300 FORCEINLINE
301 UCHAR
302 READ_REGISTER_UCHAR(
303 IN volatile UCHAR *Register)
304 {
305 return *Register;
306 }
307
308 FORCEINLINE
309 ULONG
310 READ_REGISTER_ULONG(
311 IN volatile ULONG *Register)
312 {
313 return *Register;
314 }
315
316 FORCEINLINE
317 USHORT
318 READ_REGISTER_USHORT(
319 IN volatile USHORT *Register)
320 {
321 return *Register;
322 }
323
324 FORCEINLINE
325 VOID
326 WRITE_PORT_BUFFER_UCHAR(
327 IN PUCHAR Port,
328 IN PUCHAR Buffer,
329 IN ULONG Count)
330 {
331 __outbytestring((USHORT)(ULONG_PTR)Port, Buffer, Count);
332 }
333
334 FORCEINLINE
335 VOID
336 WRITE_PORT_BUFFER_ULONG(
337 IN PULONG Port,
338 IN PULONG Buffer,
339 IN ULONG Count)
340 {
341 __outdwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count);
342 }
343
344 FORCEINLINE
345 VOID
346 WRITE_PORT_BUFFER_USHORT(
347 IN PUSHORT Port,
348 IN PUSHORT Buffer,
349 IN ULONG Count)
350 {
351 __outwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count);
352 }
353
354 FORCEINLINE
355 VOID
356 WRITE_PORT_UCHAR(
357 IN PUCHAR Port,
358 IN UCHAR Value)
359 {
360 __outbyte((USHORT)(ULONG_PTR)Port, Value);
361 }
362
363 FORCEINLINE
364 VOID
365 WRITE_PORT_ULONG(
366 IN PULONG Port,
367 IN ULONG Value)
368 {
369 __outdword((USHORT)(ULONG_PTR)Port, Value);
370 }
371
372 FORCEINLINE
373 VOID
374 WRITE_PORT_USHORT(
375 IN PUSHORT Port,
376 IN USHORT Value)
377 {
378 __outword((USHORT)(ULONG_PTR)Port, Value);
379 }
380
381 FORCEINLINE
382 VOID
383 WRITE_REGISTER_BUFFER_UCHAR(
384 IN PUCHAR Register,
385 IN PUCHAR Buffer,
386 IN ULONG Count)
387 {
388 LONG Synch;
389 __movsb(Register, Buffer, Count);
390 InterlockedOr(&Synch, 1);
391 }
392
393 FORCEINLINE
394 VOID
395 WRITE_REGISTER_BUFFER_ULONG(
396 IN PULONG Register,
397 IN PULONG Buffer,
398 IN ULONG Count)
399 {
400 LONG Synch;
401 __movsd(Register, Buffer, Count);
402 InterlockedOr(&Synch, 1);
403 }
404
405 FORCEINLINE
406 VOID
407 WRITE_REGISTER_BUFFER_USHORT(
408 IN PUSHORT Register,
409 IN PUSHORT Buffer,
410 IN ULONG Count)
411 {
412 LONG Synch;
413 __movsw(Register, Buffer, Count);
414 InterlockedOr(&Synch, 1);
415 }
416
417 FORCEINLINE
418 VOID
419 WRITE_REGISTER_UCHAR(
420 IN volatile UCHAR *Register,
421 IN UCHAR Value)
422 {
423 LONG Synch;
424 *Register = Value;
425 InterlockedOr(&Synch, 1);
426 }
427
428 FORCEINLINE
429 VOID
430 WRITE_REGISTER_ULONG(
431 IN volatile ULONG *Register,
432 IN ULONG Value)
433 {
434 LONG Synch;
435 *Register = Value;
436 InterlockedOr(&Synch, 1);
437 }
438
439 FORCEINLINE
440 VOID
441 WRITE_REGISTER_USHORT(
442 IN volatile USHORT *Register,
443 IN USHORT Value)
444 {
445 LONG Sync;
446 *Register = Value;
447 InterlockedOr(&Sync, 1);
448 }
449 #endif
450
451 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && \
452 (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
453
454 #define DMA_MACROS_DEFINED
455
456 FORCEINLINE
457 NTSTATUS
458 IoAllocateAdapterChannel(
459 IN PDMA_ADAPTER DmaAdapter,
460 IN PDEVICE_OBJECT DeviceObject,
461 IN ULONG NumberOfMapRegisters,
462 IN PDRIVER_CONTROL ExecutionRoutine,
463 IN PVOID Context)
464 {
465 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
466 AllocateAdapterChannel =
467 *(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
468 ASSERT(AllocateAdapterChannel);
469 return AllocateAdapterChannel(DmaAdapter,
470 DeviceObject,
471 NumberOfMapRegisters,
472 ExecutionRoutine,
473 Context );
474 }
475
476 FORCEINLINE
477 BOOLEAN
478 NTAPI
479 IoFlushAdapterBuffers(
480 IN PDMA_ADAPTER DmaAdapter,
481 IN PMDL Mdl,
482 IN PVOID MapRegisterBase,
483 IN PVOID CurrentVa,
484 IN ULONG Length,
485 IN BOOLEAN WriteToDevice)
486 {
487 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
488 FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
489 ASSERT(FlushAdapterBuffers);
490 return FlushAdapterBuffers(DmaAdapter,
491 Mdl,
492 MapRegisterBase,
493 CurrentVa,
494 Length,
495 WriteToDevice);
496 }
497
498 FORCEINLINE
499 VOID
500 NTAPI
501 IoFreeAdapterChannel(
502 IN PDMA_ADAPTER DmaAdapter)
503 {
504 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
505 FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
506 ASSERT(FreeAdapterChannel);
507 FreeAdapterChannel(DmaAdapter);
508 }
509
510 FORCEINLINE
511 VOID
512 NTAPI
513 IoFreeMapRegisters(
514 IN PDMA_ADAPTER DmaAdapter,
515 IN PVOID MapRegisterBase,
516 IN ULONG NumberOfMapRegisters)
517 {
518 PFREE_MAP_REGISTERS FreeMapRegisters;
519 FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
520 ASSERT(FreeMapRegisters);
521 FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters);
522 }
523
524 FORCEINLINE
525 PHYSICAL_ADDRESS
526 NTAPI
527 IoMapTransfer(
528 IN PDMA_ADAPTER DmaAdapter,
529 IN PMDL Mdl,
530 IN PVOID MapRegisterBase,
531 IN PVOID CurrentVa,
532 IN OUT PULONG Length,
533 IN BOOLEAN WriteToDevice)
534 {
535 PMAP_TRANSFER MapTransfer;
536
537 MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
538 ASSERT(MapTransfer);
539 return MapTransfer(DmaAdapter,
540 Mdl,
541 MapRegisterBase,
542 CurrentVa,
543 Length,
544 WriteToDevice);
545 }
546 #endif
547
548 $endif (_WDMDDK_)
549 $if (_NTDDK_)
550 /*
551 * VOID IoAssignArcName(
552 * IN PUNICODE_STRING ArcName,
553 * IN PUNICODE_STRING DeviceName);
554 */
555 #define IoAssignArcName(_ArcName, _DeviceName) ( \
556 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
557
558 /*
559 * VOID
560 * IoDeassignArcName(
561 * IN PUNICODE_STRING ArcName)
562 */
563 #define IoDeassignArcName IoDeleteSymbolicLink
564
565 FORCEINLINE
566 VOID
567 NTAPI
568 IoInitializeDriverCreateContext(
569 PIO_DRIVER_CREATE_CONTEXT DriverContext)
570 {
571 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT));
572 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT);
573 }
574
575 $endif (_NTDDK_)
576 $if (_NTIFS_)
577 #define IoIsFileOpenedExclusively(FileObject) ( \
578 (BOOLEAN) !( \
579 (FileObject)->SharedRead || \
580 (FileObject)->SharedWrite || \
581 (FileObject)->SharedDelete \
582 ) \
583 )
584
585 #if (NTDDI_VERSION == NTDDI_WIN2K)
586 NTKERNELAPI
587 NTSTATUS
588 NTAPI
589 IoRegisterFsRegistrationChangeEx(
590 IN PDRIVER_OBJECT DriverObject,
591 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
592 #endif
593 $endif (_NTIFS_)
594 #if (NTDDI_VERSION >= NTDDI_WIN2K)
595
596 $if (_WDMDDK_)
597 NTKERNELAPI
598 VOID
599 NTAPI
600 IoAcquireCancelSpinLock(
601 OUT PKIRQL Irql);
602
603 NTKERNELAPI
604 NTSTATUS
605 NTAPI
606 IoAcquireRemoveLockEx(
607 IN PIO_REMOVE_LOCK RemoveLock,
608 IN PVOID Tag OPTIONAL,
609 IN PCSTR File,
610 IN ULONG Line,
611 IN ULONG RemlockSize);
612 NTKERNELAPI
613 NTSTATUS
614 NTAPI
615 IoAllocateDriverObjectExtension(
616 IN PDRIVER_OBJECT DriverObject,
617 IN PVOID ClientIdentificationAddress,
618 IN ULONG DriverObjectExtensionSize,
619 OUT PVOID *DriverObjectExtension);
620
621 NTKERNELAPI
622 PVOID
623 NTAPI
624 IoAllocateErrorLogEntry(
625 IN PVOID IoObject,
626 IN UCHAR EntrySize);
627
628 NTKERNELAPI
629 PIRP
630 NTAPI
631 IoAllocateIrp(
632 IN CCHAR StackSize,
633 IN BOOLEAN ChargeQuota);
634
635 NTKERNELAPI
636 PMDL
637 NTAPI
638 IoAllocateMdl(
639 IN PVOID VirtualAddress OPTIONAL,
640 IN ULONG Length,
641 IN BOOLEAN SecondaryBuffer,
642 IN BOOLEAN ChargeQuota,
643 IN OUT PIRP Irp OPTIONAL);
644
645 NTKERNELAPI
646 PIO_WORKITEM
647 NTAPI
648 IoAllocateWorkItem(
649 IN PDEVICE_OBJECT DeviceObject);
650
651 NTKERNELAPI
652 NTSTATUS
653 NTAPI
654 IoAttachDevice(
655 IN PDEVICE_OBJECT SourceDevice,
656 IN PUNICODE_STRING TargetDevice,
657 OUT PDEVICE_OBJECT *AttachedDevice);
658
659 NTKERNELAPI
660 PDEVICE_OBJECT
661 NTAPI
662 IoAttachDeviceToDeviceStack(
663 IN PDEVICE_OBJECT SourceDevice,
664 IN PDEVICE_OBJECT TargetDevice);
665
666 NTKERNELAPI
667 PIRP
668 NTAPI
669 IoBuildAsynchronousFsdRequest(
670 IN ULONG MajorFunction,
671 IN PDEVICE_OBJECT DeviceObject,
672 IN OUT PVOID Buffer OPTIONAL,
673 IN ULONG Length OPTIONAL,
674 IN PLARGE_INTEGER StartingOffset OPTIONAL,
675 IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL);
676
677 NTKERNELAPI
678 PIRP
679 NTAPI
680 IoBuildDeviceIoControlRequest(
681 IN ULONG IoControlCode,
682 IN PDEVICE_OBJECT DeviceObject,
683 IN PVOID InputBuffer OPTIONAL,
684 IN ULONG InputBufferLength,
685 OUT PVOID OutputBuffer OPTIONAL,
686 IN ULONG OutputBufferLength,
687 IN BOOLEAN InternalDeviceIoControl,
688 IN PKEVENT Event,
689 OUT PIO_STATUS_BLOCK IoStatusBlock);
690
691 NTKERNELAPI
692 VOID
693 NTAPI
694 IoBuildPartialMdl(
695 IN PMDL SourceMdl,
696 IN OUT PMDL TargetMdl,
697 IN PVOID VirtualAddress,
698 IN ULONG Length);
699
700 NTKERNELAPI
701 PIRP
702 NTAPI
703 IoBuildSynchronousFsdRequest(
704 IN ULONG MajorFunction,
705 IN PDEVICE_OBJECT DeviceObject,
706 IN OUT PVOID Buffer OPTIONAL,
707 IN ULONG Length OPTIONAL,
708 IN PLARGE_INTEGER StartingOffset OPTIONAL,
709 IN PKEVENT Event,
710 OUT PIO_STATUS_BLOCK IoStatusBlock);
711
712 NTKERNELAPI
713 NTSTATUS
714 FASTCALL
715 IofCallDriver(
716 IN PDEVICE_OBJECT DeviceObject,
717 IN OUT PIRP Irp);
718 #define IoCallDriver IofCallDriver
719
720 NTKERNELAPI
721 VOID
722 FASTCALL
723 IofCompleteRequest(
724 IN PIRP Irp,
725 IN CCHAR PriorityBoost);
726 #define IoCompleteRequest IofCompleteRequest
727
728 NTKERNELAPI
729 BOOLEAN
730 NTAPI
731 IoCancelIrp(
732 IN PIRP Irp);
733
734 NTKERNELAPI
735 NTSTATUS
736 NTAPI
737 IoCheckShareAccess(
738 IN ACCESS_MASK DesiredAccess,
739 IN ULONG DesiredShareAccess,
740 IN OUT PFILE_OBJECT FileObject,
741 IN OUT PSHARE_ACCESS ShareAccess,
742 IN BOOLEAN Update);
743
744 NTKERNELAPI
745 VOID
746 FASTCALL
747 IofCompleteRequest(
748 IN PIRP Irp,
749 IN CCHAR PriorityBoost);
750
751 NTKERNELAPI
752 NTSTATUS
753 NTAPI
754 IoConnectInterrupt(
755 OUT PKINTERRUPT *InterruptObject,
756 IN PKSERVICE_ROUTINE ServiceRoutine,
757 IN PVOID ServiceContext OPTIONAL,
758 IN PKSPIN_LOCK SpinLock OPTIONAL,
759 IN ULONG Vector,
760 IN KIRQL Irql,
761 IN KIRQL SynchronizeIrql,
762 IN KINTERRUPT_MODE InterruptMode,
763 IN BOOLEAN ShareVector,
764 IN KAFFINITY ProcessorEnableMask,
765 IN BOOLEAN FloatingSave);
766
767 NTKERNELAPI
768 NTSTATUS
769 NTAPI
770 IoCreateDevice(
771 IN PDRIVER_OBJECT DriverObject,
772 IN ULONG DeviceExtensionSize,
773 IN PUNICODE_STRING DeviceName OPTIONAL,
774 IN DEVICE_TYPE DeviceType,
775 IN ULONG DeviceCharacteristics,
776 IN BOOLEAN Exclusive,
777 OUT PDEVICE_OBJECT *DeviceObject);
778
779 NTKERNELAPI
780 NTSTATUS
781 NTAPI
782 IoCreateFile(
783 OUT PHANDLE FileHandle,
784 IN ACCESS_MASK DesiredAccess,
785 IN POBJECT_ATTRIBUTES ObjectAttributes,
786 OUT PIO_STATUS_BLOCK IoStatusBlock,
787 IN PLARGE_INTEGER AllocationSize OPTIONAL,
788 IN ULONG FileAttributes,
789 IN ULONG ShareAccess,
790 IN ULONG Disposition,
791 IN ULONG CreateOptions,
792 IN PVOID EaBuffer OPTIONAL,
793 IN ULONG EaLength,
794 IN CREATE_FILE_TYPE CreateFileType,
795 IN PVOID InternalParameters OPTIONAL,
796 IN ULONG Options);
797
798 NTKERNELAPI
799 PKEVENT
800 NTAPI
801 IoCreateNotificationEvent(
802 IN PUNICODE_STRING EventName,
803 OUT PHANDLE EventHandle);
804
805 NTKERNELAPI
806 NTSTATUS
807 NTAPI
808 IoCreateSymbolicLink(
809 IN PUNICODE_STRING SymbolicLinkName,
810 IN PUNICODE_STRING DeviceName);
811
812 NTKERNELAPI
813 PKEVENT
814 NTAPI
815 IoCreateSynchronizationEvent(
816 IN PUNICODE_STRING EventName,
817 OUT PHANDLE EventHandle);
818
819 NTKERNELAPI
820 NTSTATUS
821 NTAPI
822 IoCreateUnprotectedSymbolicLink(
823 IN PUNICODE_STRING SymbolicLinkName,
824 IN PUNICODE_STRING DeviceName);
825
826 NTKERNELAPI
827 VOID
828 NTAPI
829 IoDeleteDevice(
830 IN PDEVICE_OBJECT DeviceObject);
831
832 NTKERNELAPI
833 NTSTATUS
834 NTAPI
835 IoDeleteSymbolicLink(
836 IN PUNICODE_STRING SymbolicLinkName);
837
838 NTKERNELAPI
839 VOID
840 NTAPI
841 IoDetachDevice(
842 IN OUT PDEVICE_OBJECT TargetDevice);
843
844 NTKERNELAPI
845 VOID
846 NTAPI
847 IoDisconnectInterrupt(
848 IN PKINTERRUPT InterruptObject);
849
850 NTKERNELAPI
851 VOID
852 NTAPI
853 IoFreeIrp(
854 IN PIRP Irp);
855
856 NTKERNELAPI
857 VOID
858 NTAPI
859 IoFreeMdl(
860 IN PMDL Mdl);
861
862 NTKERNELAPI
863 VOID
864 NTAPI
865 IoFreeWorkItem(
866 IN PIO_WORKITEM IoWorkItem);
867
868 NTKERNELAPI
869 PDEVICE_OBJECT
870 NTAPI
871 IoGetAttachedDevice(
872 IN PDEVICE_OBJECT DeviceObject);
873
874 NTKERNELAPI
875 PDEVICE_OBJECT
876 NTAPI
877 IoGetAttachedDeviceReference(
878 IN PDEVICE_OBJECT DeviceObject);
879
880 NTKERNELAPI
881 NTSTATUS
882 NTAPI
883 IoGetBootDiskInformation(
884 IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
885 IN ULONG Size);
886
887 NTKERNELAPI
888 NTSTATUS
889 NTAPI
890 IoGetDeviceInterfaceAlias(
891 IN PUNICODE_STRING SymbolicLinkName,
892 IN CONST GUID *AliasInterfaceClassGuid,
893 OUT PUNICODE_STRING AliasSymbolicLinkName);
894
895 NTKERNELAPI
896 PEPROCESS
897 NTAPI
898 IoGetCurrentProcess(VOID);
899
900 NTKERNELAPI
901 NTSTATUS
902 NTAPI
903 IoGetDeviceInterfaces(
904 IN CONST GUID *InterfaceClassGuid,
905 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
906 IN ULONG Flags,
907 OUT PWSTR *SymbolicLinkList);
908
909 NTKERNELAPI
910 NTSTATUS
911 NTAPI
912 IoGetDeviceObjectPointer(
913 IN PUNICODE_STRING ObjectName,
914 IN ACCESS_MASK DesiredAccess,
915 OUT PFILE_OBJECT *FileObject,
916 OUT PDEVICE_OBJECT *DeviceObject);
917
918 NTKERNELAPI
919 NTSTATUS
920 NTAPI
921 IoGetDeviceProperty(
922 IN PDEVICE_OBJECT DeviceObject,
923 IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
924 IN ULONG BufferLength,
925 OUT PVOID PropertyBuffer,
926 OUT PULONG ResultLength);
927
928 NTKERNELAPI
929 PDMA_ADAPTER
930 NTAPI
931 IoGetDmaAdapter(
932 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
933 IN PDEVICE_DESCRIPTION DeviceDescription,
934 IN OUT PULONG NumberOfMapRegisters);
935
936 NTKERNELAPI
937 PVOID
938 NTAPI
939 IoGetDriverObjectExtension(
940 IN PDRIVER_OBJECT DriverObject,
941 IN PVOID ClientIdentificationAddress);
942
943 NTKERNELAPI
944 PVOID
945 NTAPI
946 IoGetInitialStack(VOID);
947
948 NTKERNELAPI
949 PDEVICE_OBJECT
950 NTAPI
951 IoGetRelatedDeviceObject(
952 IN PFILE_OBJECT FileObject);
953
954 NTKERNELAPI
955 VOID
956 NTAPI
957 IoQueueWorkItem(
958 IN PIO_WORKITEM IoWorkItem,
959 IN PIO_WORKITEM_ROUTINE WorkerRoutine,
960 IN WORK_QUEUE_TYPE QueueType,
961 IN PVOID Context OPTIONAL);
962
963 NTKERNELAPI
964 VOID
965 NTAPI
966 IoInitializeIrp(
967 IN OUT PIRP Irp,
968 IN USHORT PacketSize,
969 IN CCHAR StackSize);
970
971 NTKERNELAPI
972 VOID
973 NTAPI
974 IoInitializeRemoveLockEx(
975 IN PIO_REMOVE_LOCK Lock,
976 IN ULONG AllocateTag,
977 IN ULONG MaxLockedMinutes,
978 IN ULONG HighWatermark,
979 IN ULONG RemlockSize);
980
981 NTKERNELAPI
982 NTSTATUS
983 NTAPI
984 IoInitializeTimer(
985 IN PDEVICE_OBJECT DeviceObject,
986 IN PIO_TIMER_ROUTINE TimerRoutine,
987 IN PVOID Context OPTIONAL);
988
989 NTKERNELAPI
990 VOID
991 NTAPI
992 IoInvalidateDeviceRelations(
993 IN PDEVICE_OBJECT DeviceObject,
994 IN DEVICE_RELATION_TYPE Type);
995
996 NTKERNELAPI
997 VOID
998 NTAPI
999 IoInvalidateDeviceState(
1000 IN PDEVICE_OBJECT PhysicalDeviceObject);
1001
1002 NTKERNELAPI
1003 BOOLEAN
1004 NTAPI
1005 IoIsWdmVersionAvailable(
1006 IN UCHAR MajorVersion,
1007 IN UCHAR MinorVersion);
1008
1009 NTKERNELAPI
1010 NTSTATUS
1011 NTAPI
1012 IoOpenDeviceInterfaceRegistryKey(
1013 IN PUNICODE_STRING SymbolicLinkName,
1014 IN ACCESS_MASK DesiredAccess,
1015 OUT PHANDLE DeviceInterfaceKey);
1016
1017 NTKERNELAPI
1018 NTSTATUS
1019 NTAPI
1020 IoOpenDeviceRegistryKey(
1021 IN PDEVICE_OBJECT DeviceObject,
1022 IN ULONG DevInstKeyType,
1023 IN ACCESS_MASK DesiredAccess,
1024 OUT PHANDLE DevInstRegKey);
1025
1026 NTKERNELAPI
1027 NTSTATUS
1028 NTAPI
1029 IoRegisterDeviceInterface(
1030 IN PDEVICE_OBJECT PhysicalDeviceObject,
1031 IN CONST GUID *InterfaceClassGuid,
1032 IN PUNICODE_STRING ReferenceString OPTIONAL,
1033 OUT PUNICODE_STRING SymbolicLinkName);
1034
1035 NTKERNELAPI
1036 NTSTATUS
1037 NTAPI
1038 IoRegisterPlugPlayNotification(
1039 IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
1040 IN ULONG EventCategoryFlags,
1041 IN PVOID EventCategoryData OPTIONAL,
1042 IN PDRIVER_OBJECT DriverObject,
1043 IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
1044 IN OUT PVOID Context OPTIONAL,
1045 OUT PVOID *NotificationEntry);
1046
1047 NTKERNELAPI
1048 NTSTATUS
1049 NTAPI
1050 IoRegisterShutdownNotification(
1051 IN PDEVICE_OBJECT DeviceObject);
1052
1053 NTKERNELAPI
1054 VOID
1055 NTAPI
1056 IoReleaseCancelSpinLock(
1057 IN KIRQL Irql);
1058
1059 NTKERNELAPI
1060 VOID
1061 NTAPI
1062 IoReleaseRemoveLockAndWaitEx(
1063 IN PIO_REMOVE_LOCK RemoveLock,
1064 IN PVOID Tag OPTIONAL,
1065 IN ULONG RemlockSize);
1066
1067 NTKERNELAPI
1068 VOID
1069 NTAPI
1070 IoReleaseRemoveLockEx(
1071 IN PIO_REMOVE_LOCK RemoveLock,
1072 IN PVOID Tag OPTIONAL,
1073 IN ULONG RemlockSize);
1074
1075 NTKERNELAPI
1076 VOID
1077 NTAPI
1078 IoRemoveShareAccess(
1079 IN PFILE_OBJECT FileObject,
1080 IN OUT PSHARE_ACCESS ShareAccess);
1081
1082 NTKERNELAPI
1083 NTSTATUS
1084 NTAPI
1085 IoReportTargetDeviceChange(
1086 IN PDEVICE_OBJECT PhysicalDeviceObject,
1087 IN PVOID NotificationStructure);
1088
1089 NTKERNELAPI
1090 NTSTATUS
1091 NTAPI
1092 IoReportTargetDeviceChangeAsynchronous(
1093 IN PDEVICE_OBJECT PhysicalDeviceObject,
1094 IN PVOID NotificationStructure,
1095 IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
1096 IN PVOID Context OPTIONAL);
1097
1098 NTKERNELAPI
1099 VOID
1100 NTAPI
1101 IoRequestDeviceEject(
1102 IN PDEVICE_OBJECT PhysicalDeviceObject);
1103
1104 NTKERNELAPI
1105 VOID
1106 NTAPI
1107 IoReuseIrp(
1108 IN OUT PIRP Irp,
1109 IN NTSTATUS Status);
1110
1111 NTKERNELAPI
1112 NTSTATUS
1113 NTAPI
1114 IoSetDeviceInterfaceState(
1115 IN PUNICODE_STRING SymbolicLinkName,
1116 IN BOOLEAN Enable);
1117
1118 NTKERNELAPI
1119 VOID
1120 NTAPI
1121 IoSetShareAccess(
1122 IN ACCESS_MASK DesiredAccess,
1123 IN ULONG DesiredShareAccess,
1124 IN OUT PFILE_OBJECT FileObject,
1125 OUT PSHARE_ACCESS ShareAccess);
1126
1127 NTKERNELAPI
1128 VOID
1129 NTAPI
1130 IoStartNextPacket(
1131 IN PDEVICE_OBJECT DeviceObject,
1132 IN BOOLEAN Cancelable);
1133
1134 NTKERNELAPI
1135 VOID
1136 NTAPI
1137 IoStartNextPacketByKey(
1138 IN PDEVICE_OBJECT DeviceObject,
1139 IN BOOLEAN Cancelable,
1140 IN ULONG Key);
1141
1142 NTKERNELAPI
1143 VOID
1144 NTAPI
1145 IoStartPacket(
1146 IN PDEVICE_OBJECT DeviceObject,
1147 IN PIRP Irp,
1148 IN PULONG Key OPTIONAL,
1149 IN PDRIVER_CANCEL CancelFunction OPTIONAL);
1150
1151 NTKERNELAPI
1152 VOID
1153 NTAPI
1154 IoStartTimer(
1155 IN PDEVICE_OBJECT DeviceObject);
1156
1157 NTKERNELAPI
1158 VOID
1159 NTAPI
1160 IoStopTimer(
1161 IN PDEVICE_OBJECT DeviceObject);
1162
1163 NTKERNELAPI
1164 NTSTATUS
1165 NTAPI
1166 IoUnregisterPlugPlayNotification(
1167 IN PVOID NotificationEntry);
1168
1169 NTKERNELAPI
1170 VOID
1171 NTAPI
1172 IoUnregisterShutdownNotification(
1173 IN PDEVICE_OBJECT DeviceObject);
1174
1175 NTKERNELAPI
1176 VOID
1177 NTAPI
1178 IoUpdateShareAccess(
1179 IN PFILE_OBJECT FileObject,
1180 IN OUT PSHARE_ACCESS ShareAccess);
1181
1182 NTKERNELAPI
1183 NTSTATUS
1184 NTAPI
1185 IoWMIAllocateInstanceIds(
1186 IN GUID *Guid,
1187 IN ULONG InstanceCount,
1188 OUT ULONG *FirstInstanceId);
1189
1190 NTKERNELAPI
1191 NTSTATUS
1192 NTAPI
1193 IoWMIQuerySingleInstanceMultiple(
1194 IN PVOID *DataBlockObjectList,
1195 IN PUNICODE_STRING InstanceNames,
1196 IN ULONG ObjectCount,
1197 IN OUT ULONG *InOutBufferSize,
1198 OUT PVOID OutBuffer);
1199
1200 NTKERNELAPI
1201 NTSTATUS
1202 NTAPI
1203 IoWMIRegistrationControl(
1204 IN PDEVICE_OBJECT DeviceObject,
1205 IN ULONG Action);
1206
1207 NTKERNELAPI
1208 NTSTATUS
1209 NTAPI
1210 IoWMISuggestInstanceName(
1211 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
1212 IN PUNICODE_STRING SymbolicLinkName OPTIONAL,
1213 IN BOOLEAN CombineNames,
1214 OUT PUNICODE_STRING SuggestedInstanceName);
1215
1216 NTKERNELAPI
1217 NTSTATUS
1218 NTAPI
1219 IoWMIWriteEvent(
1220 IN OUT PVOID WnodeEventItem);
1221
1222 NTKERNELAPI
1223 VOID
1224 NTAPI
1225 IoWriteErrorLogEntry(
1226 IN PVOID ElEntry);
1227
1228 NTKERNELAPI
1229 PIRP
1230 NTAPI
1231 IoGetTopLevelIrp(VOID);
1232
1233 NTKERNELAPI
1234 NTSTATUS
1235 NTAPI
1236 IoRegisterLastChanceShutdownNotification(
1237 IN PDEVICE_OBJECT DeviceObject);
1238
1239 NTKERNELAPI
1240 VOID
1241 NTAPI
1242 IoSetTopLevelIrp(
1243 IN PIRP Irp OPTIONAL);
1244
1245 $endif (_WDMDDK_)
1246 $if (_NTDDK_)
1247 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_))
1248 NTKERNELAPI
1249 NTSTATUS
1250 NTAPI
1251 IoAllocateAdapterChannel(
1252 IN PADAPTER_OBJECT AdapterObject,
1253 IN PDEVICE_OBJECT DeviceObject,
1254 IN ULONG NumberOfMapRegisters,
1255 IN PDRIVER_CONTROL ExecutionRoutine,
1256 IN PVOID Context);
1257 #endif
1258
1259 #if !defined(DMA_MACROS_DEFINED)
1260 //DECLSPEC_DEPRECATED_DDK
1261 NTHALAPI
1262 PHYSICAL_ADDRESS
1263 NTAPI
1264 IoMapTransfer(
1265 IN PADAPTER_OBJECT AdapterObject,
1266 IN PMDL Mdl,
1267 IN PVOID MapRegisterBase,
1268 IN PVOID CurrentVa,
1269 IN OUT PULONG Length,
1270 IN BOOLEAN WriteToDevice);
1271 #endif
1272
1273 NTKERNELAPI
1274 VOID
1275 NTAPI
1276 IoAllocateController(
1277 IN PCONTROLLER_OBJECT ControllerObject,
1278 IN PDEVICE_OBJECT DeviceObject,
1279 IN PDRIVER_CONTROL ExecutionRoutine,
1280 IN PVOID Context OPTIONAL);
1281
1282 NTKERNELAPI
1283 PCONTROLLER_OBJECT
1284 NTAPI
1285 IoCreateController(
1286 IN ULONG Size);
1287
1288 NTKERNELAPI
1289 VOID
1290 NTAPI
1291 IoDeleteController(
1292 IN PCONTROLLER_OBJECT ControllerObject);
1293
1294 NTKERNELAPI
1295 VOID
1296 NTAPI
1297 IoFreeController(
1298 IN PCONTROLLER_OBJECT ControllerObject);
1299
1300 NTKERNELAPI
1301 PCONFIGURATION_INFORMATION
1302 NTAPI
1303 IoGetConfigurationInformation(VOID);
1304
1305 NTKERNELAPI
1306 PDEVICE_OBJECT
1307 NTAPI
1308 IoGetDeviceToVerify(
1309 IN PETHREAD Thread);
1310
1311 NTKERNELAPI
1312 VOID
1313 NTAPI
1314 IoCancelFileOpen(
1315 IN PDEVICE_OBJECT DeviceObject,
1316 IN PFILE_OBJECT FileObject);
1317
1318 NTKERNELAPI
1319 PGENERIC_MAPPING
1320 NTAPI
1321 IoGetFileObjectGenericMapping(VOID);
1322
1323 NTKERNELAPI
1324 PIRP
1325 NTAPI
1326 IoMakeAssociatedIrp(
1327 IN PIRP Irp,
1328 IN CCHAR StackSize);
1329
1330 NTKERNELAPI
1331 NTSTATUS
1332 NTAPI
1333 IoQueryDeviceDescription(
1334 IN PINTERFACE_TYPE BusType OPTIONAL,
1335 IN PULONG BusNumber OPTIONAL,
1336 IN PCONFIGURATION_TYPE ControllerType OPTIONAL,
1337 IN PULONG ControllerNumber OPTIONAL,
1338 IN PCONFIGURATION_TYPE PeripheralType OPTIONAL,
1339 IN PULONG PeripheralNumber OPTIONAL,
1340 IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
1341 IN OUT PVOID Context OPTIONAL);
1342
1343 NTKERNELAPI
1344 VOID
1345 NTAPI
1346 IoRaiseHardError(
1347 IN PIRP Irp,
1348 IN PVPB Vpb OPTIONAL,
1349 IN PDEVICE_OBJECT RealDeviceObject);
1350
1351 NTKERNELAPI
1352 BOOLEAN
1353 NTAPI
1354 IoRaiseInformationalHardError(
1355 IN NTSTATUS ErrorStatus,
1356 IN PUNICODE_STRING String OPTIONAL,
1357 IN PKTHREAD Thread OPTIONAL);
1358
1359 NTKERNELAPI
1360 VOID
1361 NTAPI
1362 IoRegisterBootDriverReinitialization(
1363 IN PDRIVER_OBJECT DriverObject,
1364 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
1365 IN PVOID Context OPTIONAL);
1366
1367 NTKERNELAPI
1368 VOID
1369 NTAPI
1370 IoRegisterDriverReinitialization(
1371 IN PDRIVER_OBJECT DriverObject,
1372 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
1373 IN PVOID Context OPTIONAL);
1374
1375 NTKERNELAPI
1376 NTSTATUS
1377 NTAPI
1378 IoAttachDeviceByPointer(
1379 IN PDEVICE_OBJECT SourceDevice,
1380 IN PDEVICE_OBJECT TargetDevice);
1381
1382 NTKERNELAPI
1383 NTSTATUS
1384 NTAPI
1385 IoReportDetectedDevice(
1386 IN PDRIVER_OBJECT DriverObject,
1387 IN INTERFACE_TYPE LegacyBusType,
1388 IN ULONG BusNumber,
1389 IN ULONG SlotNumber,
1390 IN PCM_RESOURCE_LIST ResourceList OPTIONAL,
1391 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
1392 IN BOOLEAN ResourceAssigned,
1393 IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
1394
1395 NTKERNELAPI
1396 NTSTATUS
1397 NTAPI
1398 IoReportResourceForDetection(
1399 IN PDRIVER_OBJECT DriverObject,
1400 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
1401 IN ULONG DriverListSize OPTIONAL,
1402 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
1403 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
1404 IN ULONG DeviceListSize OPTIONAL,
1405 OUT PBOOLEAN ConflictDetected);
1406
1407 NTKERNELAPI
1408 NTSTATUS
1409 NTAPI
1410 IoReportResourceUsage(
1411 IN PUNICODE_STRING DriverClassName OPTIONAL,
1412 IN PDRIVER_OBJECT DriverObject,
1413 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
1414 IN ULONG DriverListSize OPTIONAL,
1415 IN PDEVICE_OBJECT DeviceObject,
1416 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
1417 IN ULONG DeviceListSize OPTIONAL,
1418 IN BOOLEAN OverrideConflict,
1419 OUT PBOOLEAN ConflictDetected);
1420
1421 NTKERNELAPI
1422 VOID
1423 NTAPI
1424 IoSetHardErrorOrVerifyDevice(
1425 IN PIRP Irp,
1426 IN PDEVICE_OBJECT DeviceObject);
1427
1428 NTKERNELAPI
1429 NTSTATUS
1430 NTAPI
1431 IoAssignResources(
1432 IN PUNICODE_STRING RegistryPath,
1433 IN PUNICODE_STRING DriverClassName OPTIONAL,
1434 IN PDRIVER_OBJECT DriverObject,
1435 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
1436 IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources OPTIONAL,
1437 IN OUT PCM_RESOURCE_LIST *AllocatedResources);
1438
1439 NTKERNELAPI
1440 BOOLEAN
1441 NTAPI
1442 IoSetThreadHardErrorMode(
1443 IN BOOLEAN EnableHardErrors);
1444
1445 $endif (_NTDDK_)
1446 $if (_NTIFS_)
1447
1448 NTKERNELAPI
1449 VOID
1450 NTAPI
1451 IoAcquireVpbSpinLock(
1452 OUT PKIRQL Irql);
1453
1454 NTKERNELAPI
1455 NTSTATUS
1456 NTAPI
1457 IoCheckDesiredAccess(
1458 IN OUT PACCESS_MASK DesiredAccess,
1459 IN ACCESS_MASK GrantedAccess);
1460
1461 NTKERNELAPI
1462 NTSTATUS
1463 NTAPI
1464 IoCheckEaBufferValidity(
1465 IN PFILE_FULL_EA_INFORMATION EaBuffer,
1466 IN ULONG EaLength,
1467 OUT PULONG ErrorOffset);
1468
1469 NTKERNELAPI
1470 NTSTATUS
1471 NTAPI
1472 IoCheckFunctionAccess(
1473 IN ACCESS_MASK GrantedAccess,
1474 IN UCHAR MajorFunction,
1475 IN UCHAR MinorFunction,
1476 IN ULONG IoControlCode,
1477 IN PVOID Argument1 OPTIONAL,
1478 IN PVOID Argument2 OPTIONAL);
1479
1480 NTKERNELAPI
1481 NTSTATUS
1482 NTAPI
1483 IoCheckQuerySetFileInformation(
1484 IN FILE_INFORMATION_CLASS FileInformationClass,
1485 IN ULONG Length,
1486 IN BOOLEAN SetOperation);
1487
1488 NTKERNELAPI
1489 NTSTATUS
1490 NTAPI
1491 IoCheckQuerySetVolumeInformation(
1492 IN FS_INFORMATION_CLASS FsInformationClass,
1493 IN ULONG Length,
1494 IN BOOLEAN SetOperation);
1495
1496 NTKERNELAPI
1497 NTSTATUS
1498 NTAPI
1499 IoCheckQuotaBufferValidity(
1500 IN PFILE_QUOTA_INFORMATION QuotaBuffer,
1501 IN ULONG QuotaLength,
1502 OUT PULONG ErrorOffset);
1503
1504 NTKERNELAPI
1505 PFILE_OBJECT
1506 NTAPI
1507 IoCreateStreamFileObject(
1508 IN PFILE_OBJECT FileObject OPTIONAL,
1509 IN PDEVICE_OBJECT DeviceObject OPTIONAL);
1510
1511 NTKERNELAPI
1512 PFILE_OBJECT
1513 NTAPI
1514 IoCreateStreamFileObjectLite(
1515 IN PFILE_OBJECT FileObject OPTIONAL,
1516 IN PDEVICE_OBJECT DeviceObject OPTIONAL);
1517
1518 NTKERNELAPI
1519 BOOLEAN
1520 NTAPI
1521 IoFastQueryNetworkAttributes(
1522 IN POBJECT_ATTRIBUTES ObjectAttributes,
1523 IN ACCESS_MASK DesiredAccess,
1524 IN ULONG OpenOptions,
1525 OUT PIO_STATUS_BLOCK IoStatus,
1526 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer);
1527
1528 NTKERNELAPI
1529 NTSTATUS
1530 NTAPI
1531 IoPageRead(
1532 IN PFILE_OBJECT FileObject,
1533 IN PMDL Mdl,
1534 IN PLARGE_INTEGER Offset,
1535 IN PKEVENT Event,
1536 OUT PIO_STATUS_BLOCK IoStatusBlock);
1537
1538 NTKERNELAPI
1539 PDEVICE_OBJECT
1540 NTAPI
1541 IoGetBaseFileSystemDeviceObject(
1542 IN PFILE_OBJECT FileObject);
1543
1544 NTKERNELAPI
1545 PCONFIGURATION_INFORMATION
1546 NTAPI
1547 IoGetConfigurationInformation(VOID);
1548
1549 NTKERNELAPI
1550 ULONG
1551 NTAPI
1552 IoGetRequestorProcessId(
1553 IN PIRP Irp);
1554
1555 NTKERNELAPI
1556 PEPROCESS
1557 NTAPI
1558 IoGetRequestorProcess(
1559 IN PIRP Irp);
1560
1561 NTKERNELAPI
1562 PIRP
1563 NTAPI
1564 IoGetTopLevelIrp(VOID);
1565
1566 NTKERNELAPI
1567 BOOLEAN
1568 NTAPI
1569 IoIsOperationSynchronous(
1570 IN PIRP Irp);
1571
1572 NTKERNELAPI
1573 BOOLEAN
1574 NTAPI
1575 IoIsSystemThread(
1576 IN PETHREAD Thread);
1577
1578 NTKERNELAPI
1579 BOOLEAN
1580 NTAPI
1581 IoIsValidNameGraftingBuffer(
1582 IN PIRP Irp,
1583 IN PREPARSE_DATA_BUFFER ReparseBuffer);
1584
1585 NTKERNELAPI
1586 NTSTATUS
1587 NTAPI
1588 IoQueryFileInformation(
1589 IN PFILE_OBJECT FileObject,
1590 IN FILE_INFORMATION_CLASS FileInformationClass,
1591 IN ULONG Length,
1592 OUT PVOID FileInformation,
1593 OUT PULONG ReturnedLength);
1594
1595 NTKERNELAPI
1596 NTSTATUS
1597 NTAPI
1598 IoQueryVolumeInformation(
1599 IN PFILE_OBJECT FileObject,
1600 IN FS_INFORMATION_CLASS FsInformationClass,
1601 IN ULONG Length,
1602 OUT PVOID FsInformation,
1603 OUT PULONG ReturnedLength);
1604
1605 NTKERNELAPI
1606 VOID
1607 NTAPI
1608 IoQueueThreadIrp(
1609 IN PIRP Irp);
1610
1611 NTKERNELAPI
1612 VOID
1613 NTAPI
1614 IoRegisterFileSystem(
1615 IN PDEVICE_OBJECT DeviceObject);
1616
1617 NTKERNELAPI
1618 NTSTATUS
1619 NTAPI
1620 IoRegisterFsRegistrationChange(
1621 IN PDRIVER_OBJECT DriverObject,
1622 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
1623
1624 NTKERNELAPI
1625 VOID
1626 NTAPI
1627 IoReleaseVpbSpinLock(
1628 IN KIRQL Irql);
1629
1630 NTKERNELAPI
1631 VOID
1632 NTAPI
1633 IoSetDeviceToVerify(
1634 IN PETHREAD Thread,
1635 IN PDEVICE_OBJECT DeviceObject OPTIONAL);
1636
1637 NTKERNELAPI
1638 NTSTATUS
1639 NTAPI
1640 IoSetInformation(
1641 IN PFILE_OBJECT FileObject,
1642 IN FILE_INFORMATION_CLASS FileInformationClass,
1643 IN ULONG Length,
1644 IN PVOID FileInformation);
1645
1646 NTKERNELAPI
1647 VOID
1648 NTAPI
1649 IoSetTopLevelIrp(
1650 IN PIRP Irp OPTIONAL);
1651
1652 NTKERNELAPI
1653 NTSTATUS
1654 NTAPI
1655 IoSynchronousPageWrite(
1656 IN PFILE_OBJECT FileObject,
1657 IN PMDL Mdl,
1658 IN PLARGE_INTEGER FileOffset,
1659 IN PKEVENT Event,
1660 OUT PIO_STATUS_BLOCK IoStatusBlock);
1661
1662 NTKERNELAPI
1663 PEPROCESS
1664 NTAPI
1665 IoThreadToProcess(
1666 IN PETHREAD Thread);
1667
1668 NTKERNELAPI
1669 VOID
1670 NTAPI
1671 IoUnregisterFileSystem(
1672 IN PDEVICE_OBJECT DeviceObject);
1673
1674 NTKERNELAPI
1675 VOID
1676 NTAPI
1677 IoUnregisterFsRegistrationChange(
1678 IN PDRIVER_OBJECT DriverObject,
1679 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
1680
1681 NTKERNELAPI
1682 NTSTATUS
1683 NTAPI
1684 IoVerifyVolume(
1685 IN PDEVICE_OBJECT DeviceObject,
1686 IN BOOLEAN AllowRawMount);
1687
1688 NTKERNELAPI
1689 NTSTATUS
1690 NTAPI
1691 IoGetRequestorSessionId(
1692 IN PIRP Irp,
1693 OUT PULONG pSessionId);
1694 $endif (_NTIFS_)
1695
1696 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
1697
1698 $if (_NTDDK_)
1699 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3)
1700
1701 NTKERNELAPI
1702 BOOLEAN
1703 NTAPI
1704 IoIsFileOriginRemote(
1705 IN PFILE_OBJECT FileObject);
1706
1707 NTKERNELAPI
1708 NTSTATUS
1709 NTAPI
1710 IoSetFileOrigin(
1711 IN PFILE_OBJECT FileObject,
1712 IN BOOLEAN Remote);
1713
1714 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP3) */
1715 $endif (_NTDDK_)
1716
1717 #if (NTDDI_VERSION >= NTDDI_WINXP)
1718
1719 $if (_WDMDDK_)
1720 NTKERNELAPI
1721 NTSTATUS
1722 NTAPI
1723 IoCsqInitialize(
1724 IN PIO_CSQ Csq,
1725 IN PIO_CSQ_INSERT_IRP CsqInsertIrp,
1726 IN PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
1727 IN PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
1728 IN PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
1729 IN PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
1730 IN PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
1731
1732 NTKERNELAPI
1733 VOID
1734 NTAPI
1735 IoCsqInsertIrp(
1736 IN PIO_CSQ Csq,
1737 IN PIRP Irp,
1738 IN PIO_CSQ_IRP_CONTEXT Context OPTIONAL);
1739
1740 NTKERNELAPI
1741 PIRP
1742 NTAPI
1743 IoCsqRemoveIrp(
1744 IN PIO_CSQ Csq,
1745 IN PIO_CSQ_IRP_CONTEXT Context);
1746
1747 NTKERNELAPI
1748 PIRP
1749 NTAPI
1750 IoCsqRemoveNextIrp(
1751 IN PIO_CSQ Csq,
1752 IN PVOID PeekContext OPTIONAL);
1753
1754 NTKERNELAPI
1755 BOOLEAN
1756 NTAPI
1757 IoForwardIrpSynchronously(
1758 IN PDEVICE_OBJECT DeviceObject,
1759 IN PIRP Irp);
1760
1761 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
1762
1763 NTKERNELAPI
1764 VOID
1765 NTAPI
1766 IoFreeErrorLogEntry(
1767 PVOID ElEntry);
1768
1769 NTKERNELAPI
1770 NTSTATUS
1771 NTAPI
1772 IoSetCompletionRoutineEx(
1773 IN PDEVICE_OBJECT DeviceObject,
1774 IN PIRP Irp,
1775 IN PIO_COMPLETION_ROUTINE CompletionRoutine,
1776 IN PVOID Context,
1777 IN BOOLEAN InvokeOnSuccess,
1778 IN BOOLEAN InvokeOnError,
1779 IN BOOLEAN InvokeOnCancel);
1780
1781 VOID
1782 NTAPI
1783 IoSetStartIoAttributes(
1784 IN PDEVICE_OBJECT DeviceObject,
1785 IN BOOLEAN DeferredStartIo,
1786 IN BOOLEAN NonCancelable);
1787
1788 NTKERNELAPI
1789 NTSTATUS
1790 NTAPI
1791 IoWMIDeviceObjectToInstanceName(
1792 IN PVOID DataBlockObject,
1793 IN PDEVICE_OBJECT DeviceObject,
1794 OUT PUNICODE_STRING InstanceName);
1795
1796 NTKERNELAPI
1797 NTSTATUS
1798 NTAPI
1799 IoWMIExecuteMethod(
1800 IN PVOID DataBlockObject,
1801 IN PUNICODE_STRING InstanceName,
1802 IN ULONG MethodId,
1803 IN ULONG InBufferSize,
1804 IN OUT PULONG OutBufferSize,
1805 IN OUT PUCHAR InOutBuffer);
1806
1807 NTKERNELAPI
1808 NTSTATUS
1809 NTAPI
1810 IoWMIHandleToInstanceName(
1811 IN PVOID DataBlockObject,
1812 IN HANDLE FileHandle,
1813 OUT PUNICODE_STRING InstanceName);
1814
1815 NTKERNELAPI
1816 NTSTATUS
1817 NTAPI
1818 IoWMIOpenBlock(
1819 IN GUID *DataBlockGuid,
1820 IN ULONG DesiredAccess,
1821 OUT PVOID *DataBlockObject);
1822
1823 NTKERNELAPI
1824 NTSTATUS
1825 NTAPI
1826 IoWMIQueryAllData(
1827 IN PVOID DataBlockObject,
1828 IN OUT ULONG *InOutBufferSize,
1829 OUT PVOID OutBuffer);
1830
1831 NTKERNELAPI
1832 NTSTATUS
1833 NTAPI
1834 IoWMIQueryAllDataMultiple(
1835 IN PVOID *DataBlockObjectList,
1836 IN ULONG ObjectCount,
1837 IN OUT ULONG *InOutBufferSize,
1838 OUT PVOID OutBuffer);
1839
1840 NTKERNELAPI
1841 NTSTATUS
1842 NTAPI
1843 IoWMIQuerySingleInstance(
1844 IN PVOID DataBlockObject,
1845 IN PUNICODE_STRING InstanceName,
1846 IN OUT ULONG *InOutBufferSize,
1847 OUT PVOID OutBuffer);
1848
1849 NTKERNELAPI
1850 NTSTATUS
1851 NTAPI
1852 IoWMISetNotificationCallback(
1853 IN OUT PVOID Object,
1854 IN WMI_NOTIFICATION_CALLBACK Callback,
1855 IN PVOID Context OPTIONAL);
1856
1857 NTKERNELAPI
1858 NTSTATUS
1859 NTAPI
1860 IoWMISetSingleInstance(
1861 IN PVOID DataBlockObject,
1862 IN PUNICODE_STRING InstanceName,
1863 IN ULONG Version,
1864 IN ULONG ValueBufferSize,
1865 IN PVOID ValueBuffer);
1866
1867 NTKERNELAPI
1868 NTSTATUS
1869 NTAPI
1870 IoWMISetSingleItem(
1871 IN PVOID DataBlockObject,
1872 IN PUNICODE_STRING InstanceName,
1873 IN ULONG DataItemId,
1874 IN ULONG Version,
1875 IN ULONG ValueBufferSize,
1876 IN PVOID ValueBuffer);
1877 $endif (_WDMDDK_)
1878 $if (_NTDDK_)
1879 NTKERNELAPI
1880 NTSTATUS
1881 FASTCALL
1882 IoReadPartitionTable(
1883 IN PDEVICE_OBJECT DeviceObject,
1884 IN ULONG SectorSize,
1885 IN BOOLEAN ReturnRecognizedPartitions,
1886 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
1887
1888 NTKERNELAPI
1889 NTSTATUS
1890 FASTCALL
1891 IoSetPartitionInformation(
1892 IN PDEVICE_OBJECT DeviceObject,
1893 IN ULONG SectorSize,
1894 IN ULONG PartitionNumber,
1895 IN ULONG PartitionType);
1896
1897 NTKERNELAPI
1898 NTSTATUS
1899 FASTCALL
1900 IoWritePartitionTable(
1901 IN PDEVICE_OBJECT DeviceObject,
1902 IN ULONG SectorSize,
1903 IN ULONG SectorsPerTrack,
1904 IN ULONG NumberOfHeads,
1905 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
1906
1907 NTKERNELAPI
1908 NTSTATUS
1909 NTAPI
1910 IoCreateDisk(
1911 IN PDEVICE_OBJECT DeviceObject,
1912 IN struct _CREATE_DISK* Disk OPTIONAL);
1913
1914 NTKERNELAPI
1915 NTSTATUS
1916 NTAPI
1917 IoReadDiskSignature(
1918 IN PDEVICE_OBJECT DeviceObject,
1919 IN ULONG BytesPerSector,
1920 OUT PDISK_SIGNATURE Signature);
1921
1922 NTKERNELAPI
1923 NTSTATUS
1924 NTAPI
1925 IoReadPartitionTableEx(
1926 IN PDEVICE_OBJECT DeviceObject,
1927 OUT struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
1928
1929 NTKERNELAPI
1930 NTSTATUS
1931 NTAPI
1932 IoSetPartitionInformationEx(
1933 IN PDEVICE_OBJECT DeviceObject,
1934 IN ULONG PartitionNumber,
1935 IN struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
1936
1937 NTKERNELAPI
1938 NTSTATUS
1939 NTAPI
1940 IoSetSystemPartition(
1941 IN PUNICODE_STRING VolumeNameString);
1942
1943 NTKERNELAPI
1944 NTSTATUS
1945 NTAPI
1946 IoVerifyPartitionTable(
1947 IN PDEVICE_OBJECT DeviceObject,
1948 IN BOOLEAN FixErrors);
1949
1950 NTKERNELAPI
1951 NTSTATUS
1952 NTAPI
1953 IoVolumeDeviceToDosName(
1954 IN PVOID VolumeDeviceObject,
1955 OUT PUNICODE_STRING DosName);
1956
1957 NTKERNELAPI
1958 NTSTATUS
1959 NTAPI
1960 IoWritePartitionTableEx(
1961 IN PDEVICE_OBJECT DeviceObject,
1962 IN struct _DRIVE_LAYOUT_INFORMATION_EX *DriveLayout);
1963
1964 NTKERNELAPI
1965 NTSTATUS
1966 NTAPI
1967 IoCreateFileSpecifyDeviceObjectHint(
1968 OUT PHANDLE FileHandle,
1969 IN ACCESS_MASK DesiredAccess,
1970 IN POBJECT_ATTRIBUTES ObjectAttributes,
1971 OUT PIO_STATUS_BLOCK IoStatusBlock,
1972 IN PLARGE_INTEGER AllocationSize OPTIONAL,
1973 IN ULONG FileAttributes,
1974 IN ULONG ShareAccess,
1975 IN ULONG Disposition,
1976 IN ULONG CreateOptions,
1977 IN PVOID EaBuffer OPTIONAL,
1978 IN ULONG EaLength,
1979 IN CREATE_FILE_TYPE CreateFileType,
1980 IN PVOID InternalParameters OPTIONAL,
1981 IN ULONG Options,
1982 IN PVOID DeviceObject OPTIONAL);
1983
1984 NTKERNELAPI
1985 NTSTATUS
1986 NTAPI
1987 IoAttachDeviceToDeviceStackSafe(
1988 IN PDEVICE_OBJECT SourceDevice,
1989 IN PDEVICE_OBJECT TargetDevice,
1990 OUT PDEVICE_OBJECT *AttachedToDeviceObject);
1991
1992 $endif (_NTDDK_)
1993 $if (_NTIFS_)
1994
1995 NTKERNELAPI
1996 PFILE_OBJECT
1997 NTAPI
1998 IoCreateStreamFileObjectEx(
1999 IN PFILE_OBJECT FileObject OPTIONAL,
2000 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
2001 OUT PHANDLE FileObjectHandle OPTIONAL);
2002
2003 NTKERNELAPI
2004 NTSTATUS
2005 NTAPI
2006 IoQueryFileDosDeviceName(
2007 IN PFILE_OBJECT FileObject,
2008 OUT POBJECT_NAME_INFORMATION *ObjectNameInformation);
2009
2010 NTKERNELAPI
2011 NTSTATUS
2012 NTAPI
2013 IoEnumerateDeviceObjectList(
2014 IN PDRIVER_OBJECT DriverObject,
2015 OUT PDEVICE_OBJECT *DeviceObjectList,
2016 IN ULONG DeviceObjectListSize,
2017 OUT PULONG ActualNumberDeviceObjects);
2018
2019 NTKERNELAPI
2020 PDEVICE_OBJECT
2021 NTAPI
2022 IoGetLowerDeviceObject(
2023 IN PDEVICE_OBJECT DeviceObject);
2024
2025 NTKERNELAPI
2026 PDEVICE_OBJECT
2027 NTAPI
2028 IoGetDeviceAttachmentBaseRef(
2029 IN PDEVICE_OBJECT DeviceObject);
2030
2031 NTKERNELAPI
2032 NTSTATUS
2033 NTAPI
2034 IoGetDiskDeviceObject(
2035 IN PDEVICE_OBJECT FileSystemDeviceObject,
2036 OUT PDEVICE_OBJECT *DiskDeviceObject);
2037 $endif (_NTIFS_)
2038
2039 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
2040
2041 $if (_WDMDDK_)
2042 #if (NTDDI_VERSION >= NTDDI_WINXPSP1)
2043 NTKERNELAPI
2044 NTSTATUS
2045 NTAPI
2046 IoValidateDeviceIoControlAccess(
2047 IN PIRP Irp,
2048 IN ULONG RequiredAccess);
2049 #endif
2050
2051 $endif (_WDMDDK_)
2052 $if (_WDMDDK_ || _NTDDK_)
2053 #if (NTDDI_VERSION >= NTDDI_WS03)
2054 $endif
2055 $if (_NTDDK_)
2056 NTKERNELAPI
2057 IO_PAGING_PRIORITY
2058 FASTCALL
2059 IoGetPagingIoPriority(
2060 IN PIRP Irp);
2061
2062 $endif (_NTDDK_)
2063 $if (_WDMDDK_)
2064 NTKERNELAPI
2065 NTSTATUS
2066 NTAPI
2067 IoCsqInitializeEx(
2068 IN PIO_CSQ Csq,
2069 IN PIO_CSQ_INSERT_IRP_EX CsqInsertIrp,
2070 IN PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
2071 IN PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
2072 IN PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
2073 IN PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
2074 IN PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
2075
2076 NTKERNELAPI
2077 NTSTATUS
2078 NTAPI
2079 IoCsqInsertIrpEx(
2080 IN PIO_CSQ Csq,
2081 IN PIRP Irp,
2082 IN PIO_CSQ_IRP_CONTEXT Context OPTIONAL,
2083 IN PVOID InsertContext OPTIONAL);
2084 $endif (_WDMDDK_)
2085 $if (_WDMDDK_ || _NTDDK_)
2086 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
2087 $endif
2088 $if (_NTDDK_ || _NTIFS_)
2089 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
2090 $endif
2091
2092 $if (_NTDDK_)
2093 BOOLEAN
2094 NTAPI
2095 IoTranslateBusAddress(
2096 IN INTERFACE_TYPE InterfaceType,
2097 IN ULONG BusNumber,
2098 IN PHYSICAL_ADDRESS BusAddress,
2099 IN OUT PULONG AddressSpace,
2100 OUT PPHYSICAL_ADDRESS TranslatedAddress);
2101 $endif (_NTDDK_)
2102 $if (_NTIFS_)
2103
2104 NTKERNELAPI
2105 NTSTATUS
2106 NTAPI
2107 IoEnumerateRegisteredFiltersList(
2108 OUT PDRIVER_OBJECT *DriverObjectList,
2109 IN ULONG DriverObjectListSize,
2110 OUT PULONG ActualNumberDriverObjects);
2111 $endif (_NTIFS_)
2112 $if (_NTDDK_ || _NTIFS_)
2113 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */
2114 $endif
2115
2116 #if (NTDDI_VERSION >= NTDDI_VISTA)
2117 $if (_WDMDDK_)
2118 NTKERNELAPI
2119 NTSTATUS
2120 NTAPI
2121 IoGetBootDiskInformationLite(
2122 OUT PBOOTDISK_INFORMATION_LITE *BootDiskInformation);
2123
2124 NTKERNELAPI
2125 NTSTATUS
2126 NTAPI
2127 IoCheckShareAccessEx(
2128 IN ACCESS_MASK DesiredAccess,
2129 IN ULONG DesiredShareAccess,
2130 IN OUT PFILE_OBJECT FileObject,
2131 IN OUT PSHARE_ACCESS ShareAccess,
2132 IN BOOLEAN Update,
2133 IN PBOOLEAN WritePermission);
2134
2135 NTKERNELAPI
2136 NTSTATUS
2137 NTAPI
2138 IoConnectInterruptEx(
2139 IN OUT PIO_CONNECT_INTERRUPT_PARAMETERS Parameters);
2140
2141 NTKERNELAPI
2142 VOID
2143 NTAPI
2144 IoDisconnectInterruptEx(
2145 IN PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters);
2146
2147 LOGICAL
2148 NTAPI
2149 IoWithinStackLimits(
2150 IN ULONG_PTR RegionStart,
2151 IN SIZE_T RegionSize);
2152
2153 NTKERNELAPI
2154 VOID
2155 NTAPI
2156 IoSetShareAccessEx(
2157 IN ACCESS_MASK DesiredAccess,
2158 IN ULONG DesiredShareAccess,
2159 IN OUT PFILE_OBJECT FileObject,
2160 OUT PSHARE_ACCESS ShareAccess,
2161 IN PBOOLEAN WritePermission);
2162
2163 ULONG
2164 NTAPI
2165 IoSizeofWorkItem(VOID);
2166
2167 VOID
2168 NTAPI
2169 IoInitializeWorkItem(
2170 IN PVOID IoObject,
2171 IN PIO_WORKITEM IoWorkItem);
2172
2173 VOID
2174 NTAPI
2175 IoUninitializeWorkItem(
2176 IN PIO_WORKITEM IoWorkItem);
2177
2178 VOID
2179 NTAPI
2180 IoQueueWorkItemEx(
2181 IN PIO_WORKITEM IoWorkItem,
2182 IN PIO_WORKITEM_ROUTINE_EX WorkerRoutine,
2183 IN WORK_QUEUE_TYPE QueueType,
2184 IN PVOID Context OPTIONAL);
2185
2186 IO_PRIORITY_HINT
2187 NTAPI
2188 IoGetIoPriorityHint(
2189 IN PIRP Irp);
2190
2191 NTSTATUS
2192 NTAPI
2193 IoSetIoPriorityHint(
2194 IN PIRP Irp,
2195 IN IO_PRIORITY_HINT PriorityHint);
2196
2197 NTSTATUS
2198 NTAPI
2199 IoAllocateSfioStreamIdentifier(
2200 IN PFILE_OBJECT FileObject,
2201 IN ULONG Length,
2202 IN PVOID Signature,
2203 OUT PVOID *StreamIdentifier);
2204
2205 PVOID
2206 NTAPI
2207 IoGetSfioStreamIdentifier(
2208 IN PFILE_OBJECT FileObject,
2209 IN PVOID Signature);
2210
2211 NTSTATUS
2212 NTAPI
2213 IoFreeSfioStreamIdentifier(
2214 IN PFILE_OBJECT FileObject,
2215 IN PVOID Signature);
2216
2217 NTKERNELAPI
2218 NTSTATUS
2219 NTAPI
2220 IoRequestDeviceEjectEx(
2221 IN PDEVICE_OBJECT PhysicalDeviceObject,
2222 IN PIO_DEVICE_EJECT_CALLBACK Callback OPTIONAL,
2223 IN PVOID Context OPTIONAL,
2224 IN PDRIVER_OBJECT DriverObject OPTIONAL);
2225
2226 NTKERNELAPI
2227 NTSTATUS
2228 NTAPI
2229 IoSetDevicePropertyData(
2230 IN PDEVICE_OBJECT Pdo,
2231 IN CONST DEVPROPKEY *PropertyKey,
2232 IN LCID Lcid,
2233 IN ULONG Flags,
2234 IN DEVPROPTYPE Type,
2235 IN ULONG Size,
2236 IN PVOID Data OPTIONAL);
2237
2238 NTKERNELAPI
2239 NTSTATUS
2240 NTAPI
2241 IoGetDevicePropertyData(
2242 PDEVICE_OBJECT Pdo,
2243 CONST DEVPROPKEY *PropertyKey,
2244 LCID Lcid,
2245 ULONG Flags,
2246 ULONG Size,
2247 PVOID Data,
2248 PULONG RequiredSize,
2249 PDEVPROPTYPE Type);
2250
2251 $endif (_WDMDDK_)
2252 $if (_NTDDK_)
2253 NTKERNELAPI
2254 NTSTATUS
2255 NTAPI
2256 IoUpdateDiskGeometry(
2257 IN PDEVICE_OBJECT DeviceObject,
2258 IN struct _DISK_GEOMETRY_EX* OldDiskGeometry,
2259 IN struct _DISK_GEOMETRY_EX* NewDiskGeometry);
2260
2261 PTXN_PARAMETER_BLOCK
2262 NTAPI
2263 IoGetTransactionParameterBlock(
2264 IN PFILE_OBJECT FileObject);
2265
2266 NTKERNELAPI
2267 NTSTATUS
2268 NTAPI
2269 IoCreateFileEx(
2270 OUT PHANDLE FileHandle,
2271 IN ACCESS_MASK DesiredAccess,
2272 IN POBJECT_ATTRIBUTES ObjectAttributes,
2273 OUT PIO_STATUS_BLOCK IoStatusBlock,
2274 IN PLARGE_INTEGER AllocationSize OPTIONAL,
2275 IN ULONG FileAttributes,
2276 IN ULONG ShareAccess,
2277 IN ULONG Disposition,
2278 IN ULONG CreateOptions,
2279 IN PVOID EaBuffer OPTIONAL,
2280 IN ULONG EaLength,
2281 IN CREATE_FILE_TYPE CreateFileType,
2282 IN PVOID InternalParameters OPTIONAL,
2283 IN ULONG Options,
2284 IN PIO_DRIVER_CREATE_CONTEXT DriverContext OPTIONAL);
2285
2286 NTSTATUS
2287 NTAPI
2288 IoSetIrpExtraCreateParameter(
2289 IN OUT PIRP Irp,
2290 IN struct _ECP_LIST *ExtraCreateParameter);
2291
2292 VOID
2293 NTAPI
2294 IoClearIrpExtraCreateParameter(
2295 IN OUT PIRP Irp);
2296
2297 NTSTATUS
2298 NTAPI
2299 IoGetIrpExtraCreateParameter(
2300 IN PIRP Irp,
2301 OUT struct _ECP_LIST **ExtraCreateParameter OPTIONAL);
2302
2303 BOOLEAN
2304 NTAPI
2305 IoIsFileObjectIgnoringSharing(
2306 IN PFILE_OBJECT FileObject);
2307
2308 $endif (_NTDDK_)
2309 $if (_NTIFS_)
2310
2311 FORCEINLINE
2312 VOID
2313 NTAPI
2314 IoInitializePriorityInfo(
2315 IN PIO_PRIORITY_INFO PriorityInfo)
2316 {
2317 PriorityInfo->Size = sizeof(IO_PRIORITY_INFO);
2318 PriorityInfo->ThreadPriority = 0xffff;
2319 PriorityInfo->IoPriority = IoPriorityNormal;
2320 PriorityInfo->PagePriority = 0;
2321 }
2322 $endif (_NTIFS_)
2323 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
2324
2325 $if (_WDMDDK_)
2326 #define IoCallDriverStackSafeDefault(a, b) IoCallDriver(a, b)
2327
2328 #if (NTDDI_VERSION >= NTDDI_WS08)
2329 NTKERNELAPI
2330 NTSTATUS
2331 NTAPI
2332 IoReplacePartitionUnit(
2333 IN PDEVICE_OBJECT TargetPdo,
2334 IN PDEVICE_OBJECT SparePdo,
2335 IN ULONG Flags);
2336 #endif
2337
2338 $endif (_WDMDDK_)
2339 #if (NTDDI_VERSION >= NTDDI_WIN7)
2340
2341 $if (_WDMDDK_)
2342 NTKERNELAPI
2343 NTSTATUS
2344 NTAPI
2345 IoGetAffinityInterrupt(
2346 IN PKINTERRUPT InterruptObject,
2347 OUT PGROUP_AFFINITY GroupAffinity);
2348
2349 NTSTATUS
2350 NTAPI
2351 IoGetContainerInformation(
2352 IN IO_CONTAINER_INFORMATION_CLASS InformationClass,
2353 IN PVOID ContainerObject OPTIONAL,
2354 IN OUT PVOID Buffer OPTIONAL,
2355 IN ULONG BufferLength);
2356
2357 NTSTATUS
2358 NTAPI
2359 IoRegisterContainerNotification(
2360 IN IO_CONTAINER_NOTIFICATION_CLASS NotificationClass,
2361 IN PIO_CONTAINER_NOTIFICATION_FUNCTION CallbackFunction,
2362 IN PVOID NotificationInformation OPTIONAL,
2363 IN ULONG NotificationInformationLength,
2364 OUT PVOID CallbackRegistration);
2365
2366 VOID
2367 NTAPI
2368 IoUnregisterContainerNotification(
2369 IN PVOID CallbackRegistration);
2370
2371 NTKERNELAPI
2372 NTSTATUS
2373 NTAPI
2374 IoUnregisterPlugPlayNotificationEx(
2375 IN PVOID NotificationEntry);
2376
2377 NTKERNELAPI
2378 NTSTATUS
2379 NTAPI
2380 IoGetDeviceNumaNode(
2381 IN PDEVICE_OBJECT Pdo,
2382 OUT PUSHORT NodeNumber);
2383
2384 $endif (_WDMDDK_)
2385 $if (_NTDDK_)
2386 NTSTATUS
2387 NTAPI
2388 IoSetFileObjectIgnoreSharing(
2389 IN PFILE_OBJECT FileObject);
2390
2391 $endif (_NTDDK_)
2392 $if (_NTIFS_)
2393
2394 NTKERNELAPI
2395 NTSTATUS
2396 NTAPI
2397 IoRegisterFsRegistrationChangeMountAware(
2398 IN PDRIVER_OBJECT DriverObject,
2399 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine,
2400 IN BOOLEAN SynchronizeWithMounts);
2401
2402 NTKERNELAPI
2403 NTSTATUS
2404 NTAPI
2405 IoReplaceFileObjectName(
2406 IN PFILE_OBJECT FileObject,
2407 IN PWSTR NewFileName,
2408 IN USHORT FileNameLength);
2409 $endif (_NTIFS_)
2410 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
2411
2412 $if (_WDMDDK_)
2413 #if defined(_WIN64)
2414 NTKERNELAPI
2415 ULONG
2416 NTAPI
2417 IoWMIDeviceObjectToProviderId(
2418 IN PDEVICE_OBJECT DeviceObject);
2419 #else
2420 #define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject))
2421 #endif
2422
2423 /*
2424 * USHORT
2425 * IoSizeOfIrp(
2426 * IN CCHAR StackSize)
2427 */
2428 #define IoSizeOfIrp(_StackSize) \
2429 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
2430
2431 FORCEINLINE
2432 VOID
2433 IoSkipCurrentIrpStackLocation(
2434 IN OUT PIRP Irp)
2435 {
2436 ASSERT(Irp->CurrentLocation <= Irp->StackCount);
2437 Irp->CurrentLocation++;
2438 #ifdef NONAMELESSUNION
2439 Irp->Tail.Overlay.s.u.CurrentStackLocation++;
2440 #else
2441 Irp->Tail.Overlay.CurrentStackLocation++;
2442 #endif
2443 }
2444
2445 FORCEINLINE
2446 VOID
2447 IoSetNextIrpStackLocation(
2448 IN OUT PIRP Irp)
2449 {
2450 ASSERT(Irp->CurrentLocation > 0);
2451 Irp->CurrentLocation--;
2452 #ifdef NONAMELESSUNION
2453 Irp->Tail.Overlay.s.u.CurrentStackLocation--;
2454 #else
2455 Irp->Tail.Overlay.CurrentStackLocation--;
2456 #endif
2457 }
2458
2459 FORCEINLINE
2460 PIO_STACK_LOCATION
2461 IoGetNextIrpStackLocation(
2462 IN PIRP Irp)
2463 {
2464 ASSERT(Irp->CurrentLocation > 0);
2465 #ifdef NONAMELESSUNION
2466 return ((Irp)->Tail.Overlay.s.u.CurrentStackLocation - 1 );
2467 #else
2468 return ((Irp)->Tail.Overlay.CurrentStackLocation - 1 );
2469 #endif
2470 }
2471
2472 FORCEINLINE
2473 VOID
2474 IoSetCompletionRoutine(
2475 IN PIRP Irp,
2476 IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
2477 IN PVOID Context OPTIONAL,
2478 IN BOOLEAN InvokeOnSuccess,
2479 IN BOOLEAN InvokeOnError,
2480 IN BOOLEAN InvokeOnCancel)
2481 {
2482 PIO_STACK_LOCATION irpSp;
2483 ASSERT( (InvokeOnSuccess || InvokeOnError || InvokeOnCancel) ? (CompletionRoutine != NULL) : TRUE );
2484 irpSp = IoGetNextIrpStackLocation(Irp);
2485 irpSp->CompletionRoutine = CompletionRoutine;
2486 irpSp->Context = Context;
2487 irpSp->Control = 0;
2488
2489 if (InvokeOnSuccess) {
2490 irpSp->Control = SL_INVOKE_ON_SUCCESS;
2491 }
2492
2493 if (InvokeOnError) {
2494 irpSp->Control |= SL_INVOKE_ON_ERROR;
2495 }
2496
2497 if (InvokeOnCancel) {
2498 irpSp->Control |= SL_INVOKE_ON_CANCEL;
2499 }
2500 }
2501
2502 /*
2503 * PDRIVER_CANCEL
2504 * IoSetCancelRoutine(
2505 * IN PIRP Irp,
2506 * IN PDRIVER_CANCEL CancelRoutine)
2507 */
2508 #define IoSetCancelRoutine(_Irp, \
2509 _CancelRoutine) \
2510 ((PDRIVER_CANCEL) (ULONG_PTR) InterlockedExchangePointer( \
2511 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (ULONG_PTR) (_CancelRoutine)))
2512
2513 /*
2514 * VOID
2515 * IoRequestDpc(
2516 * IN PDEVICE_OBJECT DeviceObject,
2517 * IN PIRP Irp,
2518 * IN PVOID Context);
2519 */
2520 #define IoRequestDpc(DeviceObject, Irp, Context)( \
2521 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
2522
2523 /*
2524 * VOID
2525 * IoReleaseRemoveLock(
2526 * IN PIO_REMOVE_LOCK RemoveLock,
2527 * IN PVOID Tag)
2528 */
2529 #define IoReleaseRemoveLock(_RemoveLock, \
2530 _Tag) \
2531 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2532
2533 /*
2534 * VOID
2535 * IoReleaseRemoveLockAndWait(
2536 * IN PIO_REMOVE_LOCK RemoveLock,
2537 * IN PVOID Tag)
2538 */
2539 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
2540 _Tag) \
2541 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2542
2543 #if defined(_WIN64)
2544 NTKERNELAPI
2545 BOOLEAN
2546 IoIs32bitProcess(
2547 IN PIRP Irp OPTIONAL);
2548 #endif
2549
2550 #define PLUGPLAY_REGKEY_DEVICE 1
2551 #define PLUGPLAY_REGKEY_DRIVER 2
2552 #define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4
2553
2554 FORCEINLINE
2555 PIO_STACK_LOCATION
2556 IoGetCurrentIrpStackLocation(
2557 IN PIRP Irp)
2558 {
2559 ASSERT(Irp->CurrentLocation <= Irp->StackCount + 1);
2560 #ifdef NONAMELESSUNION
2561 return Irp->Tail.Overlay.s.u.CurrentStackLocation;
2562 #else
2563 return Irp->Tail.Overlay.CurrentStackLocation;
2564 #endif
2565 }
2566
2567 FORCEINLINE
2568 VOID
2569 IoMarkIrpPending(
2570 IN OUT PIRP Irp)
2571 {
2572 IoGetCurrentIrpStackLocation( (Irp) )->Control |= SL_PENDING_RETURNED;
2573 }
2574
2575 /*
2576 * BOOLEAN
2577 * IoIsErrorUserInduced(
2578 * IN NTSTATUS Status);
2579 */
2580 #define IoIsErrorUserInduced(Status) \
2581 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
2582 ((Status) == STATUS_IO_TIMEOUT) || \
2583 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
2584 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
2585 ((Status) == STATUS_VERIFY_REQUIRED) || \
2586 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
2587 ((Status) == STATUS_WRONG_VOLUME)))
2588
2589 /* VOID
2590 * IoInitializeRemoveLock(
2591 * IN PIO_REMOVE_LOCK Lock,
2592 * IN ULONG AllocateTag,
2593 * IN ULONG MaxLockedMinutes,
2594 * IN ULONG HighWatermark)
2595 */
2596 #define IoInitializeRemoveLock( \
2597 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
2598 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
2599 HighWatermark, sizeof(IO_REMOVE_LOCK))
2600
2601 FORCEINLINE
2602 VOID
2603 IoInitializeDpcRequest(
2604 IN PDEVICE_OBJECT DeviceObject,
2605 IN PIO_DPC_ROUTINE DpcRoutine)
2606 {
2607 KeInitializeDpc( &DeviceObject->Dpc,
2608 (PKDEFERRED_ROUTINE) DpcRoutine,
2609 DeviceObject );
2610 }
2611
2612 #define DEVICE_INTERFACE_INCLUDE_NONACTIVE 0x00000001
2613
2614 /*
2615 * ULONG
2616 * IoGetFunctionCodeFromCtlCode(
2617 * IN ULONG ControlCode)
2618 */
2619 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
2620 (((_ControlCode) >> 2) & 0x00000FFF)
2621
2622 FORCEINLINE
2623 VOID
2624 IoCopyCurrentIrpStackLocationToNext(
2625 IN OUT PIRP Irp)
2626 {
2627 PIO_STACK_LOCATION irpSp;
2628 PIO_STACK_LOCATION nextIrpSp;
2629 irpSp = IoGetCurrentIrpStackLocation(Irp);
2630 nextIrpSp = IoGetNextIrpStackLocation(Irp);
2631 RtlCopyMemory( nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine));
2632 nextIrpSp->Control = 0;
2633 }
2634
2635 NTKERNELAPI
2636 VOID
2637 NTAPI
2638 IoGetStackLimits(
2639 OUT PULONG_PTR LowLimit,
2640 OUT PULONG_PTR HighLimit);
2641
2642 FORCEINLINE
2643 ULONG_PTR
2644 IoGetRemainingStackSize(VOID)
2645 {
2646 ULONG_PTR End, Begin;
2647 ULONG_PTR Result;
2648
2649 IoGetStackLimits(&Begin, &End);
2650 Result = (ULONG_PTR)(&End) - Begin;
2651 return Result;
2652 }
2653
2654 #if (NTDDI_VERSION >= NTDDI_WS03)
2655 FORCEINLINE
2656 VOID
2657 IoInitializeThreadedDpcRequest(
2658 IN PDEVICE_OBJECT DeviceObject,
2659 IN PIO_DPC_ROUTINE DpcRoutine)
2660 {
2661 KeInitializeThreadedDpc(&DeviceObject->Dpc,
2662 (PKDEFERRED_ROUTINE) DpcRoutine,
2663 DeviceObject );
2664 }
2665 #endif
2666
2667 $endif (_WDMDDK_)