[MMIXER_TEST] Fix build (Use %Iu for dwUser)
[reactos.git] / sdk / 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 _IRQL_requires_max_(DISPATCH_LEVEL)
457 _IRQL_requires_min_(DISPATCH_LEVEL)
458 FORCEINLINE
459 NTSTATUS
460 IoAllocateAdapterChannel(
461 _In_ PDMA_ADAPTER DmaAdapter,
462 _In_ PDEVICE_OBJECT DeviceObject,
463 _In_ ULONG NumberOfMapRegisters,
464 _In_ PDRIVER_CONTROL ExecutionRoutine,
465 _In_ PVOID Context)
466 {
467 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
468 AllocateAdapterChannel =
469 *(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
470 ASSERT(AllocateAdapterChannel);
471 return AllocateAdapterChannel(DmaAdapter,
472 DeviceObject,
473 NumberOfMapRegisters,
474 ExecutionRoutine,
475 Context);
476 }
477
478 FORCEINLINE
479 BOOLEAN
480 NTAPI
481 IoFlushAdapterBuffers(
482 _In_ PDMA_ADAPTER DmaAdapter,
483 _In_ PMDL Mdl,
484 _In_ PVOID MapRegisterBase,
485 _In_ PVOID CurrentVa,
486 _In_ ULONG Length,
487 _In_ BOOLEAN WriteToDevice)
488 {
489 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
490 FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
491 ASSERT(FlushAdapterBuffers);
492 return FlushAdapterBuffers(DmaAdapter,
493 Mdl,
494 MapRegisterBase,
495 CurrentVa,
496 Length,
497 WriteToDevice);
498 }
499
500 FORCEINLINE
501 VOID
502 NTAPI
503 IoFreeAdapterChannel(
504 _In_ PDMA_ADAPTER DmaAdapter)
505 {
506 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
507 FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
508 ASSERT(FreeAdapterChannel);
509 FreeAdapterChannel(DmaAdapter);
510 }
511
512 FORCEINLINE
513 VOID
514 NTAPI
515 IoFreeMapRegisters(
516 _In_ PDMA_ADAPTER DmaAdapter,
517 _In_ PVOID MapRegisterBase,
518 _In_ ULONG NumberOfMapRegisters)
519 {
520 PFREE_MAP_REGISTERS FreeMapRegisters;
521 FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
522 ASSERT(FreeMapRegisters);
523 FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters);
524 }
525
526 FORCEINLINE
527 PHYSICAL_ADDRESS
528 NTAPI
529 IoMapTransfer(
530 _In_ PDMA_ADAPTER DmaAdapter,
531 _In_ PMDL Mdl,
532 _In_ PVOID MapRegisterBase,
533 _In_ PVOID CurrentVa,
534 _Inout_ PULONG Length,
535 _In_ BOOLEAN WriteToDevice)
536 {
537 PMAP_TRANSFER MapTransfer;
538
539 MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
540 ASSERT(MapTransfer);
541 return MapTransfer(DmaAdapter,
542 Mdl,
543 MapRegisterBase,
544 CurrentVa,
545 Length,
546 WriteToDevice);
547 }
548 #endif
549
550 $endif (_WDMDDK_)
551 $if (_NTDDK_)
552 /*
553 * VOID IoAssignArcName(
554 * IN PUNICODE_STRING ArcName,
555 * IN PUNICODE_STRING DeviceName);
556 */
557 #define IoAssignArcName(_ArcName, _DeviceName) ( \
558 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
559
560 /*
561 * VOID
562 * IoDeassignArcName(
563 * IN PUNICODE_STRING ArcName)
564 */
565 #define IoDeassignArcName IoDeleteSymbolicLink
566
567 FORCEINLINE
568 VOID
569 NTAPI
570 IoInitializeDriverCreateContext(
571 PIO_DRIVER_CREATE_CONTEXT DriverContext)
572 {
573 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT));
574 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT);
575 }
576
577 $endif (_NTDDK_)
578 $if (_NTIFS_)
579 #define IoIsFileOpenedExclusively(FileObject) ( \
580 (BOOLEAN) !( \
581 (FileObject)->SharedRead || \
582 (FileObject)->SharedWrite || \
583 (FileObject)->SharedDelete \
584 ) \
585 )
586
587 #if (NTDDI_VERSION == NTDDI_WIN2K)
588 NTKERNELAPI
589 NTSTATUS
590 NTAPI
591 IoRegisterFsRegistrationChangeEx(
592 _In_ PDRIVER_OBJECT DriverObject,
593 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
594 #endif
595 $endif (_NTIFS_)
596 #if (NTDDI_VERSION >= NTDDI_WIN2K)
597
598 $if (_WDMDDK_)
599 _Acquires_lock_(_Global_cancel_spin_lock_)
600 _Requires_lock_not_held_(_Global_cancel_spin_lock_)
601 _IRQL_requires_max_(DISPATCH_LEVEL)
602 _IRQL_raises_(DISPATCH_LEVEL)
603 NTKERNELAPI
604 VOID
605 NTAPI
606 IoAcquireCancelSpinLock(
607 _Out_ _At_(*Irql, _IRQL_saves_) PKIRQL Irql);
608
609 _IRQL_requires_max_(DISPATCH_LEVEL)
610 NTKERNELAPI
611 NTSTATUS
612 NTAPI
613 IoAcquireRemoveLockEx(
614 _Inout_ PIO_REMOVE_LOCK RemoveLock,
615 _In_opt_ PVOID Tag,
616 _In_ PCSTR File,
617 _In_ ULONG Line,
618 _In_ ULONG RemlockSize);
619
620 _IRQL_requires_max_(DISPATCH_LEVEL)
621 _Ret_range_(<=, 0)
622 NTKERNELAPI
623 NTSTATUS
624 NTAPI
625 IoAllocateDriverObjectExtension(
626 _In_ PDRIVER_OBJECT DriverObject,
627 _In_ PVOID ClientIdentificationAddress,
628 _In_ ULONG DriverObjectExtensionSize,
629 _Post_ _At_(*DriverObjectExtension, _When_(return==0,
630 __drv_aliasesMem __drv_allocatesMem(Mem) _Post_notnull_))
631 _When_(return == 0, _Outptr_result_bytebuffer_(DriverObjectExtensionSize))
632 PVOID *DriverObjectExtension);
633
634 _IRQL_requires_max_(DISPATCH_LEVEL)
635 NTKERNELAPI
636 PVOID
637 NTAPI
638 IoAllocateErrorLogEntry(
639 _In_ PVOID IoObject,
640 _In_ UCHAR EntrySize);
641
642 _Must_inspect_result_
643 _IRQL_requires_max_(DISPATCH_LEVEL)
644 NTKERNELAPI
645 PIRP
646 NTAPI
647 IoAllocateIrp(
648 _In_ CCHAR StackSize,
649 _In_ BOOLEAN ChargeQuota);
650
651 _IRQL_requires_max_(DISPATCH_LEVEL)
652 NTKERNELAPI
653 PMDL
654 NTAPI
655 IoAllocateMdl(
656 _In_opt_ __drv_aliasesMem PVOID VirtualAddress,
657 _In_ ULONG Length,
658 _In_ BOOLEAN SecondaryBuffer,
659 _In_ BOOLEAN ChargeQuota,
660 _Inout_opt_ PIRP Irp);
661
662 __drv_allocatesMem(Mem)
663 _IRQL_requires_max_(DISPATCH_LEVEL)
664 NTKERNELAPI
665 PIO_WORKITEM
666 NTAPI
667 IoAllocateWorkItem(
668 _In_ PDEVICE_OBJECT DeviceObject);
669
670 _IRQL_requires_max_(APC_LEVEL)
671 _Ret_range_(<=, 0)
672 NTKERNELAPI
673 NTSTATUS
674 NTAPI
675 IoAttachDevice(
676 _In_ _Kernel_requires_resource_held_(Memory) _When_(return==0, __drv_aliasesMem)
677 PDEVICE_OBJECT SourceDevice,
678 _In_ PUNICODE_STRING TargetDevice,
679 _Out_ PDEVICE_OBJECT *AttachedDevice);
680
681 _Must_inspect_result_
682 _IRQL_requires_max_(DISPATCH_LEVEL)
683 NTKERNELAPI
684 PDEVICE_OBJECT
685 NTAPI
686 IoAttachDeviceToDeviceStack(
687 _In_ _Kernel_requires_resource_held_(Memory) _When_(return!=0, __drv_aliasesMem)
688 PDEVICE_OBJECT SourceDevice,
689 _In_ PDEVICE_OBJECT TargetDevice);
690
691 _Must_inspect_result_
692 __drv_aliasesMem
693 _IRQL_requires_max_(DISPATCH_LEVEL)
694 NTKERNELAPI
695 PIRP
696 NTAPI
697 IoBuildAsynchronousFsdRequest(
698 _In_ ULONG MajorFunction,
699 _In_ PDEVICE_OBJECT DeviceObject,
700 _Inout_opt_ PVOID Buffer,
701 _In_opt_ ULONG Length,
702 _In_opt_ PLARGE_INTEGER StartingOffset,
703 _In_opt_ PIO_STATUS_BLOCK IoStatusBlock);
704
705 _Must_inspect_result_
706 __drv_aliasesMem
707 _IRQL_requires_max_(PASSIVE_LEVEL)
708 NTKERNELAPI
709 PIRP
710 NTAPI
711 IoBuildDeviceIoControlRequest(
712 _In_ ULONG IoControlCode,
713 _In_ PDEVICE_OBJECT DeviceObject,
714 _In_opt_ PVOID InputBuffer,
715 _In_ ULONG InputBufferLength,
716 _Out_opt_ PVOID OutputBuffer,
717 _In_ ULONG OutputBufferLength,
718 _In_ BOOLEAN InternalDeviceIoControl,
719 _In_opt_ PKEVENT Event,
720 _Out_ PIO_STATUS_BLOCK IoStatusBlock);
721
722 _IRQL_requires_max_(DISPATCH_LEVEL)
723 NTKERNELAPI
724 VOID
725 NTAPI
726 IoBuildPartialMdl(
727 _In_ PMDL SourceMdl,
728 _Inout_ PMDL TargetMdl,
729 _In_ PVOID VirtualAddress,
730 _In_ ULONG Length);
731
732 _Must_inspect_result_
733 __drv_aliasesMem
734 _IRQL_requires_max_(PASSIVE_LEVEL)
735 NTKERNELAPI
736 PIRP
737 NTAPI
738 IoBuildSynchronousFsdRequest(
739 _In_ ULONG MajorFunction,
740 _In_ PDEVICE_OBJECT DeviceObject,
741 _Inout_opt_ PVOID Buffer,
742 _In_opt_ ULONG Length,
743 _In_opt_ PLARGE_INTEGER StartingOffset,
744 _In_ PKEVENT Event,
745 _Out_ PIO_STATUS_BLOCK IoStatusBlock);
746
747 _IRQL_requires_max_(DISPATCH_LEVEL)
748 _Success_(TRUE)
749 NTKERNELAPI
750 NTSTATUS
751 FASTCALL
752 IofCallDriver(
753 _In_ PDEVICE_OBJECT DeviceObject,
754 _Inout_ __drv_aliasesMem PIRP Irp);
755 #define IoCallDriver IofCallDriver
756
757 _IRQL_requires_max_(DISPATCH_LEVEL)
758 NTKERNELAPI
759 VOID
760 FASTCALL
761 IofCompleteRequest(
762 _In_ PIRP Irp,
763 _In_ CCHAR PriorityBoost);
764 #define IoCompleteRequest IofCompleteRequest
765
766 _IRQL_requires_max_(DISPATCH_LEVEL)
767 NTKERNELAPI
768 BOOLEAN
769 NTAPI
770 IoCancelIrp(
771 _In_ PIRP Irp);
772
773 _IRQL_requires_max_(PASSIVE_LEVEL)
774 NTKERNELAPI
775 NTSTATUS
776 NTAPI
777 IoCheckShareAccess(
778 _In_ ACCESS_MASK DesiredAccess,
779 _In_ ULONG DesiredShareAccess,
780 _Inout_ PFILE_OBJECT FileObject,
781 _Inout_ PSHARE_ACCESS ShareAccess,
782 _In_ BOOLEAN Update);
783
784 _IRQL_requires_max_(DISPATCH_LEVEL)
785 NTKERNELAPI
786 VOID
787 FASTCALL
788 IofCompleteRequest(
789 _In_ PIRP Irp,
790 _In_ CCHAR PriorityBoost);
791
792 _IRQL_requires_max_(PASSIVE_LEVEL)
793 NTKERNELAPI
794 NTSTATUS
795 NTAPI
796 IoConnectInterrupt(
797 _Out_ PKINTERRUPT *InterruptObject,
798 _In_ PKSERVICE_ROUTINE ServiceRoutine,
799 _In_opt_ PVOID ServiceContext,
800 _In_opt_ PKSPIN_LOCK SpinLock,
801 _In_ ULONG Vector,
802 _In_ KIRQL Irql,
803 _In_ KIRQL SynchronizeIrql,
804 _In_ KINTERRUPT_MODE InterruptMode,
805 _In_ BOOLEAN ShareVector,
806 _In_ KAFFINITY ProcessorEnableMask,
807 _In_ BOOLEAN FloatingSave);
808
809 _IRQL_requires_max_(APC_LEVEL)
810 _Ret_range_(<=, 0)
811 NTKERNELAPI
812 NTSTATUS
813 NTAPI
814 IoCreateDevice(
815 _In_ PDRIVER_OBJECT DriverObject,
816 _In_ ULONG DeviceExtensionSize,
817 _In_opt_ PUNICODE_STRING DeviceName,
818 _In_ DEVICE_TYPE DeviceType,
819 _In_ ULONG DeviceCharacteristics,
820 _In_ BOOLEAN Exclusive,
821 _Outptr_result_nullonfailure_
822 _At_(*DeviceObject,
823 __drv_allocatesMem(Mem)
824 _When_(((_In_function_class_(DRIVER_INITIALIZE))
825 ||(_In_function_class_(DRIVER_DISPATCH))),
826 __drv_aliasesMem))
827 PDEVICE_OBJECT *DeviceObject);
828
829 _IRQL_requires_max_(PASSIVE_LEVEL)
830 NTKERNELAPI
831 NTSTATUS
832 NTAPI
833 IoCreateFile(
834 _Out_ PHANDLE FileHandle,
835 _In_ ACCESS_MASK DesiredAccess,
836 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
837 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
838 _In_opt_ PLARGE_INTEGER AllocationSize,
839 _In_ ULONG FileAttributes,
840 _In_ ULONG ShareAccess,
841 _In_ ULONG Disposition,
842 _In_ ULONG CreateOptions,
843 _In_opt_ PVOID EaBuffer,
844 _In_ ULONG EaLength,
845 _In_ CREATE_FILE_TYPE CreateFileType,
846 _In_opt_ PVOID InternalParameters,
847 _In_ ULONG Options);
848
849 _IRQL_requires_max_(PASSIVE_LEVEL)
850 NTKERNELAPI
851 PKEVENT
852 NTAPI
853 IoCreateNotificationEvent(
854 _In_ PUNICODE_STRING EventName,
855 _Out_ PHANDLE EventHandle);
856
857 _IRQL_requires_max_(PASSIVE_LEVEL)
858 NTKERNELAPI
859 NTSTATUS
860 NTAPI
861 IoCreateSymbolicLink(
862 _In_ PUNICODE_STRING SymbolicLinkName,
863 _In_ PUNICODE_STRING DeviceName);
864
865 _IRQL_requires_max_(PASSIVE_LEVEL)
866 NTKERNELAPI
867 PKEVENT
868 NTAPI
869 IoCreateSynchronizationEvent(
870 _In_ PUNICODE_STRING EventName,
871 _Out_ PHANDLE EventHandle);
872
873 _IRQL_requires_max_(PASSIVE_LEVEL)
874 NTKERNELAPI
875 NTSTATUS
876 NTAPI
877 IoCreateUnprotectedSymbolicLink(
878 _In_ PUNICODE_STRING SymbolicLinkName,
879 _In_ PUNICODE_STRING DeviceName);
880
881 _IRQL_requires_max_(APC_LEVEL)
882 _Kernel_clear_do_init_(__yes)
883 NTKERNELAPI
884 VOID
885 NTAPI
886 IoDeleteDevice(
887 _In_ _Kernel_requires_resource_held_(Memory) __drv_freesMem(Mem)
888 PDEVICE_OBJECT DeviceObject);
889
890 _IRQL_requires_max_(PASSIVE_LEVEL)
891 NTKERNELAPI
892 NTSTATUS
893 NTAPI
894 IoDeleteSymbolicLink(
895 _In_ PUNICODE_STRING SymbolicLinkName);
896
897 _IRQL_requires_max_(PASSIVE_LEVEL)
898 NTKERNELAPI
899 VOID
900 NTAPI
901 IoDetachDevice(
902 _Inout_ PDEVICE_OBJECT TargetDevice);
903
904 _IRQL_requires_max_(PASSIVE_LEVEL)
905 NTKERNELAPI
906 VOID
907 NTAPI
908 IoDisconnectInterrupt(
909 _In_ PKINTERRUPT InterruptObject);
910
911 __drv_freesMem(Mem)
912 _IRQL_requires_max_(DISPATCH_LEVEL)
913 NTKERNELAPI
914 VOID
915 NTAPI
916 IoFreeIrp(
917 _In_ PIRP Irp);
918
919 _IRQL_requires_max_(DISPATCH_LEVEL)
920 NTKERNELAPI
921 VOID
922 NTAPI
923 IoFreeMdl(
924 PMDL Mdl);
925
926 _IRQL_requires_max_(DISPATCH_LEVEL)
927 NTKERNELAPI
928 VOID
929 NTAPI
930 IoFreeWorkItem(
931 _In_ __drv_freesMem(Mem) PIO_WORKITEM IoWorkItem);
932
933 NTKERNELAPI
934 PDEVICE_OBJECT
935 NTAPI
936 IoGetAttachedDevice(
937 IN PDEVICE_OBJECT DeviceObject);
938
939 _IRQL_requires_max_(DISPATCH_LEVEL)
940 NTKERNELAPI
941 PDEVICE_OBJECT
942 NTAPI
943 IoGetAttachedDeviceReference(
944 _In_ PDEVICE_OBJECT DeviceObject);
945
946 NTKERNELAPI
947 NTSTATUS
948 NTAPI
949 IoGetBootDiskInformation(
950 _Inout_ PBOOTDISK_INFORMATION BootDiskInformation,
951 _In_ ULONG Size);
952
953 _IRQL_requires_max_(PASSIVE_LEVEL)
954 _Must_inspect_result_
955 NTKERNELAPI
956 NTSTATUS
957 NTAPI
958 IoGetDeviceInterfaceAlias(
959 _In_ PUNICODE_STRING SymbolicLinkName,
960 _In_ CONST GUID *AliasInterfaceClassGuid,
961 _Out_
962 _When_(return==0, _At_(AliasSymbolicLinkName->Buffer, __drv_allocatesMem(Mem)))
963 PUNICODE_STRING AliasSymbolicLinkName);
964
965 NTKERNELAPI
966 PEPROCESS
967 NTAPI
968 IoGetCurrentProcess(VOID);
969
970 _IRQL_requires_max_(PASSIVE_LEVEL)
971 _Must_inspect_result_
972 NTKERNELAPI
973 NTSTATUS
974 NTAPI
975 IoGetDeviceInterfaces(
976 _In_ CONST GUID *InterfaceClassGuid,
977 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
978 _In_ ULONG Flags,
979 _Outptr_result_nullonfailure_
980 _At_(*SymbolicLinkList, _When_(return==0, __drv_allocatesMem(Mem)))
981 PZZWSTR *SymbolicLinkList);
982
983 _IRQL_requires_max_(PASSIVE_LEVEL)
984 NTKERNELAPI
985 NTSTATUS
986 NTAPI
987 IoGetDeviceObjectPointer(
988 _In_ PUNICODE_STRING ObjectName,
989 _In_ ACCESS_MASK DesiredAccess,
990 _Out_ PFILE_OBJECT *FileObject,
991 _Out_ PDEVICE_OBJECT *DeviceObject);
992
993 _IRQL_requires_max_(PASSIVE_LEVEL)
994 _When_((DeviceProperty & __string_type),
995 _At_(PropertyBuffer, _Post_z_))
996 _When_((DeviceProperty & __multiString_type),
997 _At_(PropertyBuffer, _Post_ _NullNull_terminated_))
998 NTKERNELAPI
999 NTSTATUS
1000 NTAPI
1001 IoGetDeviceProperty(
1002 _In_ PDEVICE_OBJECT DeviceObject,
1003 _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty,
1004 _In_ ULONG BufferLength,
1005 _Out_writes_bytes_opt_(BufferLength) PVOID PropertyBuffer,
1006 _Deref_out_range_(<=, BufferLength) PULONG ResultLength);
1007
1008 _Must_inspect_result_
1009 _IRQL_requires_max_(PASSIVE_LEVEL)
1010 NTKERNELAPI
1011 PDMA_ADAPTER
1012 NTAPI
1013 IoGetDmaAdapter(
1014 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
1015 _In_ PDEVICE_DESCRIPTION DeviceDescription,
1016 _Out_ _When_(return!=0, _Kernel_IoGetDmaAdapter_ _At_(*NumberOfMapRegisters, _Must_inspect_result_))
1017 PULONG NumberOfMapRegisters);
1018
1019 __drv_aliasesMem
1020 _IRQL_requires_max_(DISPATCH_LEVEL)
1021 NTKERNELAPI
1022 PVOID
1023 NTAPI
1024 IoGetDriverObjectExtension(
1025 _In_ PDRIVER_OBJECT DriverObject,
1026 _In_ PVOID ClientIdentificationAddress);
1027
1028 _IRQL_requires_max_(APC_LEVEL)
1029 NTKERNELAPI
1030 PVOID
1031 NTAPI
1032 IoGetInitialStack(VOID);
1033
1034 NTKERNELAPI
1035 PDEVICE_OBJECT
1036 NTAPI
1037 IoGetRelatedDeviceObject(
1038 _In_ PFILE_OBJECT FileObject);
1039
1040 _IRQL_requires_max_(DISPATCH_LEVEL)
1041 NTKERNELAPI
1042 VOID
1043 NTAPI
1044 IoQueueWorkItem(
1045 _Inout_ PIO_WORKITEM IoWorkItem,
1046 _In_ PIO_WORKITEM_ROUTINE WorkerRoutine,
1047 _In_ WORK_QUEUE_TYPE QueueType,
1048 _In_opt_ __drv_aliasesMem PVOID Context);
1049
1050 _IRQL_requires_max_(DISPATCH_LEVEL)
1051 NTKERNELAPI
1052 VOID
1053 NTAPI
1054 IoInitializeIrp(
1055 _Inout_ PIRP Irp,
1056 _In_ USHORT PacketSize,
1057 _In_ CCHAR StackSize);
1058
1059 _IRQL_requires_max_(PASSIVE_LEVEL)
1060 NTKERNELAPI
1061 VOID
1062 NTAPI
1063 IoInitializeRemoveLockEx(
1064 _Out_ PIO_REMOVE_LOCK Lock,
1065 _In_ ULONG AllocateTag,
1066 _In_ ULONG MaxLockedMinutes,
1067 _In_ ULONG HighWatermark,
1068 _In_ ULONG RemlockSize);
1069
1070 _IRQL_requires_max_(PASSIVE_LEVEL)
1071 NTKERNELAPI
1072 NTSTATUS
1073 NTAPI
1074 IoInitializeTimer(
1075 _In_ PDEVICE_OBJECT DeviceObject,
1076 _In_ PIO_TIMER_ROUTINE TimerRoutine,
1077 _In_opt_ __drv_aliasesMem PVOID Context);
1078
1079 _IRQL_requires_max_(DISPATCH_LEVEL)
1080 NTKERNELAPI
1081 VOID
1082 NTAPI
1083 IoInvalidateDeviceRelations(
1084 _In_ PDEVICE_OBJECT DeviceObject,
1085 _In_ DEVICE_RELATION_TYPE Type);
1086
1087 _IRQL_requires_max_(DISPATCH_LEVEL)
1088 NTKERNELAPI
1089 VOID
1090 NTAPI
1091 IoInvalidateDeviceState(
1092 _In_ PDEVICE_OBJECT PhysicalDeviceObject);
1093
1094 _IRQL_requires_max_(PASSIVE_LEVEL)
1095 NTKERNELAPI
1096 BOOLEAN
1097 NTAPI
1098 IoIsWdmVersionAvailable(
1099 _When_(MajorVersion!=1&&MajorVersion!=6, _In_ __drv_reportError("MajorVersion must be 1 or 6"))
1100 UCHAR MajorVersion,
1101 _In_ _When_(MinorVersion!=0 && MinorVersion!=5 &&
1102 MinorVersion!=16 && MinorVersion!=32 &&
1103 MinorVersion!=48, __drv_reportError("MinorVersion must be 0, 0x5, 0x10, 0x20, or 0x30"))
1104 UCHAR MinorVersion);
1105
1106 _IRQL_requires_max_(PASSIVE_LEVEL)
1107 _Must_inspect_result_
1108 NTKERNELAPI
1109 NTSTATUS
1110 NTAPI
1111 IoOpenDeviceInterfaceRegistryKey(
1112 _In_ PUNICODE_STRING SymbolicLinkName,
1113 _In_ ACCESS_MASK DesiredAccess,
1114 _Out_ PHANDLE DeviceInterfaceKey);
1115
1116 _IRQL_requires_max_(PASSIVE_LEVEL)
1117 _Must_inspect_result_
1118 NTKERNELAPI
1119 NTSTATUS
1120 NTAPI
1121 IoOpenDeviceRegistryKey(
1122 _In_ PDEVICE_OBJECT DeviceObject,
1123 _In_ ULONG DevInstKeyType,
1124 _In_ ACCESS_MASK DesiredAccess,
1125 _Out_ PHANDLE DevInstRegKey);
1126
1127 _IRQL_requires_max_(PASSIVE_LEVEL)
1128 _Must_inspect_result_
1129 NTKERNELAPI
1130 NTSTATUS
1131 NTAPI
1132 IoRegisterDeviceInterface(
1133 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
1134 _In_ CONST GUID *InterfaceClassGuid,
1135 _In_opt_ PUNICODE_STRING ReferenceString,
1136 _Out_ _When_(return==0, _At_(SymbolicLinkName->Buffer, __drv_allocatesMem(Mem)))
1137 PUNICODE_STRING SymbolicLinkName);
1138
1139 _IRQL_requires_max_(PASSIVE_LEVEL)
1140 _Must_inspect_result_
1141 NTKERNELAPI
1142 NTSTATUS
1143 NTAPI
1144 IoRegisterPlugPlayNotification(
1145 _In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
1146 _In_ ULONG EventCategoryFlags,
1147 _In_opt_ PVOID EventCategoryData,
1148 _In_ PDRIVER_OBJECT DriverObject,
1149 _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
1150 _Inout_opt_ __drv_aliasesMem PVOID Context,
1151 _Outptr_result_nullonfailure_
1152 _At_(*NotificationEntry, _When_(return==0, __drv_allocatesMem(Mem)))
1153 PVOID *NotificationEntry);
1154
1155 _IRQL_requires_max_(PASSIVE_LEVEL)
1156 NTKERNELAPI
1157 NTSTATUS
1158 NTAPI
1159 IoRegisterShutdownNotification(
1160 _In_ PDEVICE_OBJECT DeviceObject);
1161
1162 _Requires_lock_held_(_Global_cancel_spin_lock_)
1163 _Releases_lock_(_Global_cancel_spin_lock_)
1164 _IRQL_requires_max_(DISPATCH_LEVEL)
1165 _IRQL_requires_min_(DISPATCH_LEVEL)
1166 NTKERNELAPI
1167 VOID
1168 NTAPI
1169 IoReleaseCancelSpinLock(
1170 _In_ _IRQL_restores_ _IRQL_uses_cancel_ KIRQL Irql);
1171
1172 _IRQL_requires_max_(PASSIVE_LEVEL)
1173 NTKERNELAPI
1174 VOID
1175 NTAPI
1176 IoReleaseRemoveLockAndWaitEx(
1177 _Inout_ PIO_REMOVE_LOCK RemoveLock,
1178 _In_opt_ PVOID Tag,
1179 _In_ ULONG RemlockSize);
1180
1181 NTKERNELAPI
1182 VOID
1183 NTAPI
1184 IoReleaseRemoveLockEx(
1185 _Inout_ PIO_REMOVE_LOCK RemoveLock,
1186 _In_opt_ PVOID Tag,
1187 _In_ ULONG RemlockSize);
1188
1189 _IRQL_requires_max_(PASSIVE_LEVEL)
1190 NTKERNELAPI
1191 VOID
1192 NTAPI
1193 IoRemoveShareAccess(
1194 _In_ PFILE_OBJECT FileObject,
1195 _Inout_ PSHARE_ACCESS ShareAccess);
1196
1197 _IRQL_requires_max_(PASSIVE_LEVEL)
1198 NTKERNELAPI
1199 NTSTATUS
1200 NTAPI
1201 IoReportTargetDeviceChange(
1202 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
1203 _In_ PVOID NotificationStructure);
1204
1205 _IRQL_requires_max_(DISPATCH_LEVEL)
1206 NTKERNELAPI
1207 NTSTATUS
1208 NTAPI
1209 IoReportTargetDeviceChangeAsynchronous(
1210 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
1211 _In_ PVOID NotificationStructure,
1212 _In_opt_ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback,
1213 _In_opt_ PVOID Context);
1214
1215 _IRQL_requires_max_(DISPATCH_LEVEL)
1216 NTKERNELAPI
1217 VOID
1218 NTAPI
1219 IoRequestDeviceEject(
1220 _In_ PDEVICE_OBJECT PhysicalDeviceObject);
1221
1222 _IRQL_requires_max_(DISPATCH_LEVEL)
1223 NTKERNELAPI
1224 VOID
1225 NTAPI
1226 IoReuseIrp(
1227 _Inout_ PIRP Irp,
1228 _In_ NTSTATUS Status);
1229
1230 _IRQL_requires_max_(PASSIVE_LEVEL)
1231 _Must_inspect_result_
1232 NTKERNELAPI
1233 NTSTATUS
1234 NTAPI
1235 IoSetDeviceInterfaceState(
1236 _In_ PUNICODE_STRING SymbolicLinkName,
1237 _In_ BOOLEAN Enable);
1238
1239 NTKERNELAPI
1240 VOID
1241 NTAPI
1242 IoSetShareAccess(
1243 _In_ ACCESS_MASK DesiredAccess,
1244 _In_ ULONG DesiredShareAccess,
1245 _Inout_ PFILE_OBJECT FileObject,
1246 _Out_ PSHARE_ACCESS ShareAccess);
1247
1248 _IRQL_requires_max_(DISPATCH_LEVEL)
1249 _IRQL_requires_min_(DISPATCH_LEVEL)
1250 NTKERNELAPI
1251 VOID
1252 NTAPI
1253 IoStartNextPacket(
1254 _In_ PDEVICE_OBJECT DeviceObject,
1255 _In_ BOOLEAN Cancelable);
1256
1257 _IRQL_requires_max_(DISPATCH_LEVEL)
1258 NTKERNELAPI
1259 VOID
1260 NTAPI
1261 IoStartNextPacketByKey(
1262 _In_ PDEVICE_OBJECT DeviceObject,
1263 _In_ BOOLEAN Cancelable,
1264 _In_ ULONG Key);
1265
1266 _IRQL_requires_max_(DISPATCH_LEVEL)
1267 NTKERNELAPI
1268 VOID
1269 NTAPI
1270 IoStartPacket(
1271 _In_ PDEVICE_OBJECT DeviceObject,
1272 _In_ PIRP Irp,
1273 _In_opt_ PULONG Key,
1274 _In_opt_ PDRIVER_CANCEL CancelFunction);
1275
1276 _IRQL_requires_max_(DISPATCH_LEVEL)
1277 NTKERNELAPI
1278 VOID
1279 NTAPI
1280 IoStartTimer(
1281 _In_ PDEVICE_OBJECT DeviceObject);
1282
1283 _IRQL_requires_max_(DISPATCH_LEVEL)
1284 NTKERNELAPI
1285 VOID
1286 NTAPI
1287 IoStopTimer(
1288 _In_ PDEVICE_OBJECT DeviceObject);
1289
1290 _IRQL_requires_max_(PASSIVE_LEVEL)
1291 __drv_freesMem(Pool)
1292 NTKERNELAPI
1293 NTSTATUS
1294 NTAPI
1295 IoUnregisterPlugPlayNotification(
1296 _In_ PVOID NotificationEntry);
1297
1298 _IRQL_requires_max_(PASSIVE_LEVEL)
1299 NTKERNELAPI
1300 VOID
1301 NTAPI
1302 IoUnregisterShutdownNotification(
1303 _In_ PDEVICE_OBJECT DeviceObject);
1304
1305 _IRQL_requires_max_(PASSIVE_LEVEL)
1306 NTKERNELAPI
1307 VOID
1308 NTAPI
1309 IoUpdateShareAccess(
1310 _In_ PFILE_OBJECT FileObject,
1311 _Inout_ PSHARE_ACCESS ShareAccess);
1312
1313 _IRQL_requires_max_(PASSIVE_LEVEL)
1314 NTKERNELAPI
1315 NTSTATUS
1316 NTAPI
1317 IoWMIAllocateInstanceIds(
1318 _In_ GUID *Guid,
1319 _In_ ULONG InstanceCount,
1320 _Out_ ULONG *FirstInstanceId);
1321
1322 NTKERNELAPI
1323 NTSTATUS
1324 NTAPI
1325 IoWMIQuerySingleInstanceMultiple(
1326 _In_reads_(ObjectCount) PVOID *DataBlockObjectList,
1327 _In_reads_(ObjectCount) PUNICODE_STRING InstanceNames,
1328 _In_ ULONG ObjectCount,
1329 _Inout_ ULONG *InOutBufferSize,
1330 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer);
1331
1332 _IRQL_requires_max_(PASSIVE_LEVEL)
1333 NTKERNELAPI
1334 NTSTATUS
1335 NTAPI
1336 IoWMIRegistrationControl(
1337 _In_ PDEVICE_OBJECT DeviceObject,
1338 _In_ ULONG Action);
1339
1340 NTKERNELAPI
1341 NTSTATUS
1342 NTAPI
1343 IoWMISuggestInstanceName(
1344 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
1345 _In_opt_ PUNICODE_STRING SymbolicLinkName,
1346 _In_ BOOLEAN CombineNames,
1347 _Out_ PUNICODE_STRING SuggestedInstanceName);
1348
1349 _Must_inspect_result_
1350 _IRQL_requires_max_(DISPATCH_LEVEL)
1351 _Ret_range_(<=, 0)
1352 NTKERNELAPI
1353 NTSTATUS
1354 NTAPI
1355 IoWMIWriteEvent(
1356 _Inout_ _When_(return==0, __drv_aliasesMem) PVOID WnodeEventItem);
1357
1358 _IRQL_requires_max_(DISPATCH_LEVEL)
1359 NTKERNELAPI
1360 VOID
1361 NTAPI
1362 IoWriteErrorLogEntry(
1363 _In_ PVOID ElEntry);
1364
1365 NTKERNELAPI
1366 PIRP
1367 NTAPI
1368 IoGetTopLevelIrp(VOID);
1369
1370 _IRQL_requires_max_(PASSIVE_LEVEL)
1371 NTKERNELAPI
1372 NTSTATUS
1373 NTAPI
1374 IoRegisterLastChanceShutdownNotification(
1375 _In_ PDEVICE_OBJECT DeviceObject);
1376
1377 NTKERNELAPI
1378 VOID
1379 NTAPI
1380 IoSetTopLevelIrp(
1381 _In_opt_ PIRP Irp);
1382
1383 $endif (_WDMDDK_)
1384 $if (_NTDDK_)
1385 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_))
1386 _IRQL_requires_max_(DISPATCH_LEVEL)
1387 _IRQL_requires_min_(DISPATCH_LEVEL)
1388 NTKERNELAPI
1389 NTSTATUS
1390 NTAPI
1391 IoAllocateAdapterChannel(
1392 _In_ PADAPTER_OBJECT AdapterObject,
1393 _In_ PDEVICE_OBJECT DeviceObject,
1394 _In_ ULONG NumberOfMapRegisters,
1395 _In_ PDRIVER_CONTROL ExecutionRoutine,
1396 _In_ PVOID Context);
1397 #endif
1398
1399 #if !defined(DMA_MACROS_DEFINED)
1400 //DECLSPEC_DEPRECATED_DDK
1401 NTHALAPI
1402 PHYSICAL_ADDRESS
1403 NTAPI
1404 IoMapTransfer(
1405 _In_ PADAPTER_OBJECT AdapterObject,
1406 _In_ PMDL Mdl,
1407 _In_ PVOID MapRegisterBase,
1408 _In_ PVOID CurrentVa,
1409 _Inout_ PULONG Length,
1410 _In_ BOOLEAN WriteToDevice);
1411 #endif
1412
1413 _IRQL_requires_max_(DISPATCH_LEVEL)
1414 _IRQL_requires_min_(DISPATCH_LEVEL)
1415 NTKERNELAPI
1416 VOID
1417 NTAPI
1418 IoAllocateController(
1419 _In_ PCONTROLLER_OBJECT ControllerObject,
1420 _In_ PDEVICE_OBJECT DeviceObject,
1421 _In_ PDRIVER_CONTROL ExecutionRoutine,
1422 _In_opt_ PVOID Context);
1423
1424 _IRQL_requires_max_(PASSIVE_LEVEL)
1425 NTKERNELAPI
1426 PCONTROLLER_OBJECT
1427 NTAPI
1428 IoCreateController(
1429 _In_ ULONG Size);
1430
1431 _IRQL_requires_max_(PASSIVE_LEVEL)
1432 NTKERNELAPI
1433 VOID
1434 NTAPI
1435 IoDeleteController(
1436 _In_ PCONTROLLER_OBJECT ControllerObject);
1437
1438 _IRQL_requires_max_(DISPATCH_LEVEL)
1439 _IRQL_requires_min_(DISPATCH_LEVEL)
1440 NTKERNELAPI
1441 VOID
1442 NTAPI
1443 IoFreeController(
1444 _In_ PCONTROLLER_OBJECT ControllerObject);
1445
1446 _IRQL_requires_max_(PASSIVE_LEVEL)
1447 NTKERNELAPI
1448 PCONFIGURATION_INFORMATION
1449 NTAPI
1450 IoGetConfigurationInformation(VOID);
1451
1452 _IRQL_requires_max_(PASSIVE_LEVEL)
1453 NTKERNELAPI
1454 PDEVICE_OBJECT
1455 NTAPI
1456 IoGetDeviceToVerify(
1457 _In_ PETHREAD Thread);
1458
1459 NTKERNELAPI
1460 VOID
1461 NTAPI
1462 IoCancelFileOpen(
1463 _In_ PDEVICE_OBJECT DeviceObject,
1464 _In_ PFILE_OBJECT FileObject);
1465
1466 _IRQL_requires_max_(PASSIVE_LEVEL)
1467 NTKERNELAPI
1468 PGENERIC_MAPPING
1469 NTAPI
1470 IoGetFileObjectGenericMapping(VOID);
1471
1472 _IRQL_requires_max_(DISPATCH_LEVEL)
1473 NTKERNELAPI
1474 PIRP
1475 NTAPI
1476 IoMakeAssociatedIrp(
1477 _In_ PIRP Irp,
1478 _In_ CCHAR StackSize);
1479
1480 NTKERNELAPI
1481 NTSTATUS
1482 NTAPI
1483 IoQueryDeviceDescription(
1484 _In_opt_ PINTERFACE_TYPE BusType,
1485 _In_opt_ PULONG BusNumber,
1486 _In_opt_ PCONFIGURATION_TYPE ControllerType,
1487 _In_opt_ PULONG ControllerNumber,
1488 _In_opt_ PCONFIGURATION_TYPE PeripheralType,
1489 _In_opt_ PULONG PeripheralNumber,
1490 _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
1491 _Inout_opt_ PVOID Context);
1492
1493 _IRQL_requires_max_(APC_LEVEL)
1494 NTKERNELAPI
1495 VOID
1496 NTAPI
1497 IoRaiseHardError(
1498 _In_ PIRP Irp,
1499 _In_opt_ PVPB Vpb,
1500 _In_ PDEVICE_OBJECT RealDeviceObject);
1501
1502 _IRQL_requires_max_(APC_LEVEL)
1503 NTKERNELAPI
1504 BOOLEAN
1505 NTAPI
1506 IoRaiseInformationalHardError(
1507 _In_ NTSTATUS ErrorStatus,
1508 _In_opt_ PUNICODE_STRING String,
1509 _In_opt_ PKTHREAD Thread);
1510
1511 _IRQL_requires_max_(PASSIVE_LEVEL)
1512 NTKERNELAPI
1513 VOID
1514 NTAPI
1515 IoRegisterBootDriverReinitialization(
1516 _In_ PDRIVER_OBJECT DriverObject,
1517 _In_ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
1518 _In_opt_ PVOID Context);
1519
1520 _IRQL_requires_max_(PASSIVE_LEVEL)
1521 NTKERNELAPI
1522 VOID
1523 NTAPI
1524 IoRegisterDriverReinitialization(
1525 _In_ PDRIVER_OBJECT DriverObject,
1526 _In_ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
1527 _In_opt_ PVOID Context);
1528
1529 NTKERNELAPI
1530 NTSTATUS
1531 NTAPI
1532 IoAttachDeviceByPointer(
1533 _In_ PDEVICE_OBJECT SourceDevice,
1534 _In_ PDEVICE_OBJECT TargetDevice);
1535
1536 _IRQL_requires_max_(PASSIVE_LEVEL)
1537 _Must_inspect_result_
1538 NTKERNELAPI
1539 NTSTATUS
1540 NTAPI
1541 IoReportDetectedDevice(
1542 _In_ PDRIVER_OBJECT DriverObject,
1543 _In_ INTERFACE_TYPE LegacyBusType,
1544 _In_ ULONG BusNumber,
1545 _In_ ULONG SlotNumber,
1546 _In_opt_ PCM_RESOURCE_LIST ResourceList,
1547 _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements,
1548 _In_ BOOLEAN ResourceAssigned,
1549 _Inout_ PDEVICE_OBJECT *DeviceObject);
1550
1551 NTKERNELAPI
1552 NTSTATUS
1553 NTAPI
1554 IoReportResourceForDetection(
1555 _In_ PDRIVER_OBJECT DriverObject,
1556 _In_reads_bytes_opt_(DriverListSize) PCM_RESOURCE_LIST DriverList,
1557 _In_opt_ ULONG DriverListSize,
1558 _In_opt_ PDEVICE_OBJECT DeviceObject,
1559 _In_reads_bytes_opt_(DeviceListSize) PCM_RESOURCE_LIST DeviceList,
1560 _In_opt_ ULONG DeviceListSize,
1561 _Out_ PBOOLEAN ConflictDetected);
1562
1563 NTKERNELAPI
1564 NTSTATUS
1565 NTAPI
1566 IoReportResourceUsage(
1567 _In_opt_ PUNICODE_STRING DriverClassName,
1568 _In_ PDRIVER_OBJECT DriverObject,
1569 _In_reads_bytes_opt_(DriverListSize) PCM_RESOURCE_LIST DriverList,
1570 _In_opt_ ULONG DriverListSize,
1571 _In_opt_ PDEVICE_OBJECT DeviceObject,
1572 _In_reads_bytes_opt_(DeviceListSize) PCM_RESOURCE_LIST DeviceList,
1573 _In_opt_ ULONG DeviceListSize,
1574 _In_ BOOLEAN OverrideConflict,
1575 _Out_ PBOOLEAN ConflictDetected);
1576
1577 _IRQL_requires_max_(DISPATCH_LEVEL)
1578 NTKERNELAPI
1579 VOID
1580 NTAPI
1581 IoSetHardErrorOrVerifyDevice(
1582 _In_ PIRP Irp,
1583 _In_ PDEVICE_OBJECT DeviceObject);
1584
1585 NTKERNELAPI
1586 NTSTATUS
1587 NTAPI
1588 IoAssignResources(
1589 _In_ PUNICODE_STRING RegistryPath,
1590 _In_opt_ PUNICODE_STRING DriverClassName,
1591 _In_ PDRIVER_OBJECT DriverObject,
1592 _In_opt_ PDEVICE_OBJECT DeviceObject,
1593 _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
1594 _Inout_ PCM_RESOURCE_LIST *AllocatedResources);
1595
1596 _IRQL_requires_max_(DISPATCH_LEVEL)
1597 NTKERNELAPI
1598 BOOLEAN
1599 NTAPI
1600 IoSetThreadHardErrorMode(
1601 _In_ BOOLEAN EnableHardErrors);
1602
1603 $endif (_NTDDK_)
1604 $if (_NTIFS_)
1605
1606 NTKERNELAPI
1607 VOID
1608 NTAPI
1609 IoAcquireVpbSpinLock(
1610 _Out_ PKIRQL Irql);
1611
1612 NTKERNELAPI
1613 NTSTATUS
1614 NTAPI
1615 IoCheckDesiredAccess(
1616 _Inout_ PACCESS_MASK DesiredAccess,
1617 _In_ ACCESS_MASK GrantedAccess);
1618
1619 NTKERNELAPI
1620 NTSTATUS
1621 NTAPI
1622 IoCheckEaBufferValidity(
1623 _In_ PFILE_FULL_EA_INFORMATION EaBuffer,
1624 _In_ ULONG EaLength,
1625 _Out_ PULONG ErrorOffset);
1626
1627 NTKERNELAPI
1628 NTSTATUS
1629 NTAPI
1630 IoCheckFunctionAccess(
1631 _In_ ACCESS_MASK GrantedAccess,
1632 _In_ UCHAR MajorFunction,
1633 _In_ UCHAR MinorFunction,
1634 _In_ ULONG IoControlCode,
1635 _In_opt_ PVOID Argument1,
1636 _In_opt_ PVOID Argument2);
1637
1638 NTKERNELAPI
1639 NTSTATUS
1640 NTAPI
1641 IoCheckQuerySetFileInformation(
1642 _In_ FILE_INFORMATION_CLASS FileInformationClass,
1643 _In_ ULONG Length,
1644 _In_ BOOLEAN SetOperation);
1645
1646 NTKERNELAPI
1647 NTSTATUS
1648 NTAPI
1649 IoCheckQuerySetVolumeInformation(
1650 _In_ FS_INFORMATION_CLASS FsInformationClass,
1651 _In_ ULONG Length,
1652 _In_ BOOLEAN SetOperation);
1653
1654 NTKERNELAPI
1655 NTSTATUS
1656 NTAPI
1657 IoCheckQuotaBufferValidity(
1658 _In_ PFILE_QUOTA_INFORMATION QuotaBuffer,
1659 _In_ ULONG QuotaLength,
1660 _Out_ PULONG ErrorOffset);
1661
1662 NTKERNELAPI
1663 PFILE_OBJECT
1664 NTAPI
1665 IoCreateStreamFileObject(
1666 _In_opt_ PFILE_OBJECT FileObject,
1667 _In_opt_ PDEVICE_OBJECT DeviceObject);
1668
1669 NTKERNELAPI
1670 PFILE_OBJECT
1671 NTAPI
1672 IoCreateStreamFileObjectLite(
1673 _In_opt_ PFILE_OBJECT FileObject,
1674 _In_opt_ PDEVICE_OBJECT DeviceObject);
1675
1676 NTKERNELAPI
1677 BOOLEAN
1678 NTAPI
1679 IoFastQueryNetworkAttributes(
1680 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
1681 _In_ ACCESS_MASK DesiredAccess,
1682 _In_ ULONG OpenOptions,
1683 _Out_ PIO_STATUS_BLOCK IoStatus,
1684 _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer);
1685
1686 NTKERNELAPI
1687 NTSTATUS
1688 NTAPI
1689 IoPageRead(
1690 _In_ PFILE_OBJECT FileObject,
1691 _In_ PMDL Mdl,
1692 _In_ PLARGE_INTEGER Offset,
1693 _In_ PKEVENT Event,
1694 _Out_ PIO_STATUS_BLOCK IoStatusBlock);
1695
1696 NTKERNELAPI
1697 PDEVICE_OBJECT
1698 NTAPI
1699 IoGetBaseFileSystemDeviceObject(
1700 _In_ PFILE_OBJECT FileObject);
1701
1702 _IRQL_requires_max_(PASSIVE_LEVEL)
1703 NTKERNELAPI
1704 PCONFIGURATION_INFORMATION
1705 NTAPI
1706 IoGetConfigurationInformation(VOID);
1707
1708 NTKERNELAPI
1709 ULONG
1710 NTAPI
1711 IoGetRequestorProcessId(
1712 _In_ PIRP Irp);
1713
1714 NTKERNELAPI
1715 PEPROCESS
1716 NTAPI
1717 IoGetRequestorProcess(
1718 _In_ PIRP Irp);
1719
1720 NTKERNELAPI
1721 PIRP
1722 NTAPI
1723 IoGetTopLevelIrp(VOID);
1724
1725 NTKERNELAPI
1726 BOOLEAN
1727 NTAPI
1728 IoIsOperationSynchronous(
1729 _In_ PIRP Irp);
1730
1731 NTKERNELAPI
1732 BOOLEAN
1733 NTAPI
1734 IoIsSystemThread(
1735 _In_ PETHREAD Thread);
1736
1737 NTKERNELAPI
1738 BOOLEAN
1739 NTAPI
1740 IoIsValidNameGraftingBuffer(
1741 _In_ PIRP Irp,
1742 _In_ PREPARSE_DATA_BUFFER ReparseBuffer);
1743
1744 NTKERNELAPI
1745 NTSTATUS
1746 NTAPI
1747 IoQueryFileInformation(
1748 _In_ PFILE_OBJECT FileObject,
1749 _In_ FILE_INFORMATION_CLASS FileInformationClass,
1750 _In_ ULONG Length,
1751 _Out_ PVOID FileInformation,
1752 _Out_ PULONG ReturnedLength);
1753
1754 NTKERNELAPI
1755 NTSTATUS
1756 NTAPI
1757 IoQueryVolumeInformation(
1758 _In_ PFILE_OBJECT FileObject,
1759 _In_ FS_INFORMATION_CLASS FsInformationClass,
1760 _In_ ULONG Length,
1761 _Out_ PVOID FsInformation,
1762 _Out_ PULONG ReturnedLength);
1763
1764 NTKERNELAPI
1765 VOID
1766 NTAPI
1767 IoQueueThreadIrp(
1768 _In_ PIRP Irp);
1769
1770 NTKERNELAPI
1771 VOID
1772 NTAPI
1773 IoRegisterFileSystem(
1774 _In_ __drv_aliasesMem PDEVICE_OBJECT DeviceObject);
1775
1776 NTKERNELAPI
1777 NTSTATUS
1778 NTAPI
1779 IoRegisterFsRegistrationChange(
1780 _In_ PDRIVER_OBJECT DriverObject,
1781 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
1782
1783 NTKERNELAPI
1784 VOID
1785 NTAPI
1786 IoReleaseVpbSpinLock(
1787 _In_ KIRQL Irql);
1788
1789 NTKERNELAPI
1790 VOID
1791 NTAPI
1792 IoSetDeviceToVerify(
1793 _In_ PETHREAD Thread,
1794 _In_opt_ PDEVICE_OBJECT DeviceObject);
1795
1796 NTKERNELAPI
1797 NTSTATUS
1798 NTAPI
1799 IoSetInformation(
1800 _In_ PFILE_OBJECT FileObject,
1801 _In_ FILE_INFORMATION_CLASS FileInformationClass,
1802 _In_ ULONG Length,
1803 _In_ PVOID FileInformation);
1804
1805 NTKERNELAPI
1806 VOID
1807 NTAPI
1808 IoSetTopLevelIrp(
1809 _In_opt_ PIRP Irp);
1810
1811 NTKERNELAPI
1812 NTSTATUS
1813 NTAPI
1814 IoSynchronousPageWrite(
1815 _In_ PFILE_OBJECT FileObject,
1816 _In_ PMDL Mdl,
1817 _In_ PLARGE_INTEGER FileOffset,
1818 _In_ PKEVENT Event,
1819 _Out_ PIO_STATUS_BLOCK IoStatusBlock);
1820
1821 NTKERNELAPI
1822 PEPROCESS
1823 NTAPI
1824 IoThreadToProcess(
1825 _In_ PETHREAD Thread);
1826
1827 NTKERNELAPI
1828 VOID
1829 NTAPI
1830 IoUnregisterFileSystem(
1831 _In_ PDEVICE_OBJECT DeviceObject);
1832
1833 NTKERNELAPI
1834 VOID
1835 NTAPI
1836 IoUnregisterFsRegistrationChange(
1837 _In_ PDRIVER_OBJECT DriverObject,
1838 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine);
1839
1840 NTKERNELAPI
1841 NTSTATUS
1842 NTAPI
1843 IoVerifyVolume(
1844 _In_ PDEVICE_OBJECT DeviceObject,
1845 _In_ BOOLEAN AllowRawMount);
1846
1847 NTKERNELAPI
1848 NTSTATUS
1849 NTAPI
1850 IoGetRequestorSessionId(
1851 _In_ PIRP Irp,
1852 _Out_ PULONG pSessionId);
1853 $endif (_NTIFS_)
1854
1855 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
1856
1857 $if (_NTDDK_)
1858 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3)
1859
1860 NTKERNELAPI
1861 BOOLEAN
1862 NTAPI
1863 IoIsFileOriginRemote(
1864 _In_ PFILE_OBJECT FileObject);
1865
1866 NTKERNELAPI
1867 NTSTATUS
1868 NTAPI
1869 IoSetFileOrigin(
1870 _In_ PFILE_OBJECT FileObject,
1871 _In_ BOOLEAN Remote);
1872
1873 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP3) */
1874 $endif (_NTDDK_)
1875
1876 #if (NTDDI_VERSION >= NTDDI_WINXP)
1877
1878 $if (_WDMDDK_)
1879 NTKERNELAPI
1880 NTSTATUS
1881 NTAPI
1882 IoCsqInitialize(
1883 _Out_ PIO_CSQ Csq,
1884 _In_ PIO_CSQ_INSERT_IRP CsqInsertIrp,
1885 _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
1886 _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
1887 _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
1888 _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
1889 _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
1890
1891 NTKERNELAPI
1892 VOID
1893 NTAPI
1894 IoCsqInsertIrp(
1895 _Inout_ PIO_CSQ Csq,
1896 _Inout_ PIRP Irp,
1897 _Out_opt_ PIO_CSQ_IRP_CONTEXT Context);
1898
1899 NTKERNELAPI
1900 PIRP
1901 NTAPI
1902 IoCsqRemoveIrp(
1903 _Inout_ PIO_CSQ Csq,
1904 _Inout_ PIO_CSQ_IRP_CONTEXT Context);
1905
1906 NTKERNELAPI
1907 PIRP
1908 NTAPI
1909 IoCsqRemoveNextIrp(
1910 _Inout_ PIO_CSQ Csq,
1911 _In_opt_ PVOID PeekContext);
1912
1913 NTKERNELAPI
1914 BOOLEAN
1915 NTAPI
1916 IoForwardIrpSynchronously(
1917 _In_ PDEVICE_OBJECT DeviceObject,
1918 _In_ PIRP Irp);
1919
1920 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
1921
1922 NTKERNELAPI
1923 VOID
1924 NTAPI
1925 IoFreeErrorLogEntry(
1926 _In_ PVOID ElEntry);
1927
1928 _IRQL_requires_max_(DISPATCH_LEVEL)
1929 _Must_inspect_result_
1930 NTKERNELAPI
1931 NTSTATUS
1932 NTAPI
1933 IoSetCompletionRoutineEx(
1934 _In_ PDEVICE_OBJECT DeviceObject,
1935 _In_ PIRP Irp,
1936 _In_ PIO_COMPLETION_ROUTINE CompletionRoutine,
1937 _In_opt_ PVOID Context,
1938 _In_ BOOLEAN InvokeOnSuccess,
1939 _In_ BOOLEAN InvokeOnError,
1940 _In_ BOOLEAN InvokeOnCancel);
1941
1942 VOID
1943 NTAPI
1944 IoSetStartIoAttributes(
1945 _In_ PDEVICE_OBJECT DeviceObject,
1946 _In_ BOOLEAN DeferredStartIo,
1947 _In_ BOOLEAN NonCancelable);
1948
1949 NTKERNELAPI
1950 NTSTATUS
1951 NTAPI
1952 IoWMIDeviceObjectToInstanceName(
1953 _In_ PVOID DataBlockObject,
1954 _In_ PDEVICE_OBJECT DeviceObject,
1955 _Out_ PUNICODE_STRING InstanceName);
1956
1957 NTKERNELAPI
1958 NTSTATUS
1959 NTAPI
1960 IoWMIExecuteMethod(
1961 _In_ PVOID DataBlockObject,
1962 _In_ PUNICODE_STRING InstanceName,
1963 _In_ ULONG MethodId,
1964 _In_ ULONG InBufferSize,
1965 _Inout_ PULONG OutBufferSize,
1966 _Inout_updates_bytes_to_opt_(*OutBufferSize, InBufferSize) PUCHAR InOutBuffer);
1967
1968 NTKERNELAPI
1969 NTSTATUS
1970 NTAPI
1971 IoWMIHandleToInstanceName(
1972 _In_ PVOID DataBlockObject,
1973 _In_ HANDLE FileHandle,
1974 _Out_ PUNICODE_STRING InstanceName);
1975
1976 NTKERNELAPI
1977 NTSTATUS
1978 NTAPI
1979 IoWMIOpenBlock(
1980 _In_ LPCGUID DataBlockGuid,
1981 _In_ ULONG DesiredAccess,
1982 _Out_ PVOID *DataBlockObject);
1983
1984 NTKERNELAPI
1985 NTSTATUS
1986 NTAPI
1987 IoWMIQueryAllData(
1988 _In_ PVOID DataBlockObject,
1989 _Inout_ ULONG *InOutBufferSize,
1990 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer);
1991
1992 NTKERNELAPI
1993 NTSTATUS
1994 NTAPI
1995 IoWMIQueryAllDataMultiple(
1996 _In_reads_(ObjectCount) PVOID *DataBlockObjectList,
1997 _In_ ULONG ObjectCount,
1998 _Inout_ ULONG *InOutBufferSize,
1999 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer);
2000
2001 NTKERNELAPI
2002 NTSTATUS
2003 NTAPI
2004 IoWMIQuerySingleInstance(
2005 _In_ PVOID DataBlockObject,
2006 _In_ PUNICODE_STRING InstanceName,
2007 _Inout_ ULONG *InOutBufferSize,
2008 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer);
2009
2010 NTKERNELAPI
2011 NTSTATUS
2012 NTAPI
2013 IoWMISetNotificationCallback(
2014 _Inout_ PVOID Object,
2015 _In_ WMI_NOTIFICATION_CALLBACK Callback,
2016 _In_opt_ PVOID Context);
2017
2018 NTKERNELAPI
2019 NTSTATUS
2020 NTAPI
2021 IoWMISetSingleInstance(
2022 _In_ PVOID DataBlockObject,
2023 _In_ PUNICODE_STRING InstanceName,
2024 _In_ ULONG Version,
2025 _In_ ULONG ValueBufferSize,
2026 _In_reads_bytes_(ValueBufferSize) PVOID ValueBuffer);
2027
2028 NTKERNELAPI
2029 NTSTATUS
2030 NTAPI
2031 IoWMISetSingleItem(
2032 _In_ PVOID DataBlockObject,
2033 _In_ PUNICODE_STRING InstanceName,
2034 _In_ ULONG DataItemId,
2035 _In_ ULONG Version,
2036 _In_ ULONG ValueBufferSize,
2037 _In_reads_bytes_(ValueBufferSize) PVOID ValueBuffer);
2038 $endif (_WDMDDK_)
2039 $if (_NTDDK_)
2040 _IRQL_requires_max_(PASSIVE_LEVEL)
2041 NTKERNELAPI
2042 NTSTATUS
2043 FASTCALL
2044 IoReadPartitionTable(
2045 _In_ PDEVICE_OBJECT DeviceObject,
2046 _In_ ULONG SectorSize,
2047 _In_ BOOLEAN ReturnRecognizedPartitions,
2048 _Out_ struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
2049
2050 _IRQL_requires_max_(PASSIVE_LEVEL)
2051 NTKERNELAPI
2052 NTSTATUS
2053 FASTCALL
2054 IoSetPartitionInformation(
2055 _In_ PDEVICE_OBJECT DeviceObject,
2056 _In_ ULONG SectorSize,
2057 _In_ ULONG PartitionNumber,
2058 _In_ ULONG PartitionType);
2059
2060 _IRQL_requires_max_(PASSIVE_LEVEL)
2061 NTKERNELAPI
2062 NTSTATUS
2063 FASTCALL
2064 IoWritePartitionTable(
2065 _In_ PDEVICE_OBJECT DeviceObject,
2066 _In_ ULONG SectorSize,
2067 _In_ ULONG SectorsPerTrack,
2068 _In_ ULONG NumberOfHeads,
2069 _In_ struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
2070
2071 NTKERNELAPI
2072 NTSTATUS
2073 NTAPI
2074 IoCreateDisk(
2075 _In_ PDEVICE_OBJECT DeviceObject,
2076 _In_opt_ struct _CREATE_DISK* Disk);
2077
2078 NTKERNELAPI
2079 NTSTATUS
2080 NTAPI
2081 IoReadDiskSignature(
2082 _In_ PDEVICE_OBJECT DeviceObject,
2083 _In_ ULONG BytesPerSector,
2084 _Out_ PDISK_SIGNATURE Signature);
2085
2086 _IRQL_requires_max_(PASSIVE_LEVEL)
2087 NTKERNELAPI
2088 NTSTATUS
2089 NTAPI
2090 IoReadPartitionTableEx(
2091 _In_ PDEVICE_OBJECT DeviceObject,
2092 _Out_ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
2093
2094 _IRQL_requires_max_(PASSIVE_LEVEL)
2095 NTKERNELAPI
2096 NTSTATUS
2097 NTAPI
2098 IoSetPartitionInformationEx(
2099 _In_ PDEVICE_OBJECT DeviceObject,
2100 _In_ ULONG PartitionNumber,
2101 _In_ struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
2102
2103 NTKERNELAPI
2104 NTSTATUS
2105 NTAPI
2106 IoSetSystemPartition(
2107 _In_ PUNICODE_STRING VolumeNameString);
2108
2109 NTKERNELAPI
2110 NTSTATUS
2111 NTAPI
2112 IoVerifyPartitionTable(
2113 _In_ PDEVICE_OBJECT DeviceObject,
2114 _In_ BOOLEAN FixErrors);
2115
2116 NTKERNELAPI
2117 NTSTATUS
2118 NTAPI
2119 IoVolumeDeviceToDosName(
2120 _In_ PVOID VolumeDeviceObject,
2121 _Out_ _When_(return==0,
2122 _At_(DosName->Buffer, __drv_allocatesMem(Mem)))
2123 PUNICODE_STRING DosName);
2124
2125 _IRQL_requires_max_(PASSIVE_LEVEL)
2126 NTKERNELAPI
2127 NTSTATUS
2128 NTAPI
2129 IoWritePartitionTableEx(
2130 _In_ PDEVICE_OBJECT DeviceObject,
2131 _In_reads_(_Inexpressible_(FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry[0])))
2132 struct _DRIVE_LAYOUT_INFORMATION_EX *DriveLayout);
2133
2134 NTKERNELAPI
2135 NTSTATUS
2136 NTAPI
2137 IoCreateFileSpecifyDeviceObjectHint(
2138 _Out_ PHANDLE FileHandle,
2139 _In_ ACCESS_MASK DesiredAccess,
2140 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
2141 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2142 _In_opt_ PLARGE_INTEGER AllocationSize,
2143 _In_ ULONG FileAttributes,
2144 _In_ ULONG ShareAccess,
2145 _In_ ULONG Disposition,
2146 _In_ ULONG CreateOptions,
2147 _In_opt_ PVOID EaBuffer,
2148 _In_ ULONG EaLength,
2149 _In_ CREATE_FILE_TYPE CreateFileType,
2150 _In_opt_ PVOID InternalParameters,
2151 _In_ ULONG Options,
2152 _In_opt_ PVOID DeviceObject);
2153
2154 NTKERNELAPI
2155 NTSTATUS
2156 NTAPI
2157 IoAttachDeviceToDeviceStackSafe(
2158 _In_ PDEVICE_OBJECT SourceDevice,
2159 _In_ PDEVICE_OBJECT TargetDevice,
2160 _Outptr_ PDEVICE_OBJECT *AttachedToDeviceObject);
2161
2162 $endif (_NTDDK_)
2163 $if (_NTIFS_)
2164
2165 NTKERNELAPI
2166 PFILE_OBJECT
2167 NTAPI
2168 IoCreateStreamFileObjectEx(
2169 _In_opt_ PFILE_OBJECT FileObject,
2170 _In_opt_ PDEVICE_OBJECT DeviceObject,
2171 _Out_opt_ PHANDLE FileObjectHandle);
2172
2173 NTKERNELAPI
2174 NTSTATUS
2175 NTAPI
2176 IoQueryFileDosDeviceName(
2177 _In_ PFILE_OBJECT FileObject,
2178 _Out_ POBJECT_NAME_INFORMATION *ObjectNameInformation);
2179
2180 NTKERNELAPI
2181 NTSTATUS
2182 NTAPI
2183 IoEnumerateDeviceObjectList(
2184 _In_ PDRIVER_OBJECT DriverObject,
2185 _Out_writes_bytes_to_opt_(DeviceObjectListSize,(*ActualNumberDeviceObjects)*sizeof(PDEVICE_OBJECT))
2186 PDEVICE_OBJECT *DeviceObjectList,
2187 _In_ ULONG DeviceObjectListSize,
2188 _Out_ PULONG ActualNumberDeviceObjects);
2189
2190 NTKERNELAPI
2191 PDEVICE_OBJECT
2192 NTAPI
2193 IoGetLowerDeviceObject(
2194 _In_ PDEVICE_OBJECT DeviceObject);
2195
2196 NTKERNELAPI
2197 PDEVICE_OBJECT
2198 NTAPI
2199 IoGetDeviceAttachmentBaseRef(
2200 _In_ PDEVICE_OBJECT DeviceObject);
2201
2202 NTKERNELAPI
2203 NTSTATUS
2204 NTAPI
2205 IoGetDiskDeviceObject(
2206 _In_ PDEVICE_OBJECT FileSystemDeviceObject,
2207 _Out_ PDEVICE_OBJECT *DiskDeviceObject);
2208 $endif (_NTIFS_)
2209
2210 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
2211
2212 $if (_WDMDDK_)
2213 #if (NTDDI_VERSION >= NTDDI_WINXPSP1)
2214 NTKERNELAPI
2215 NTSTATUS
2216 NTAPI
2217 IoValidateDeviceIoControlAccess(
2218 _In_ PIRP Irp,
2219 _In_ ULONG RequiredAccess);
2220 #endif
2221
2222 $endif (_WDMDDK_)
2223 $if (_WDMDDK_ || _NTDDK_)
2224 #if (NTDDI_VERSION >= NTDDI_WS03)
2225 $endif (_WDMDDK_ || _NTDDK_)
2226 $if (_NTDDK_)
2227 NTKERNELAPI
2228 IO_PAGING_PRIORITY
2229 FASTCALL
2230 IoGetPagingIoPriority(
2231 _In_ PIRP Irp);
2232
2233 $endif (_NTDDK_)
2234 $if (_WDMDDK_)
2235 NTKERNELAPI
2236 NTSTATUS
2237 NTAPI
2238 IoCsqInitializeEx(
2239 _Out_ PIO_CSQ Csq,
2240 _In_ PIO_CSQ_INSERT_IRP_EX CsqInsertIrp,
2241 _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
2242 _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
2243 _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
2244 _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
2245 _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
2246
2247 NTKERNELAPI
2248 NTSTATUS
2249 NTAPI
2250 IoCsqInsertIrpEx(
2251 _Inout_ PIO_CSQ Csq,
2252 _Inout_ PIRP Irp,
2253 _Out_opt_ PIO_CSQ_IRP_CONTEXT Context,
2254 _In_opt_ PVOID InsertContext);
2255 $endif (_WDMDDK_)
2256 $if (_WDMDDK_ || _NTDDK_)
2257 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
2258 $endif (_WDMDDK_ || _NTDDK_)
2259 $if (_NTDDK_ || _NTIFS_)
2260 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
2261 $endif (_NTDDK_ || _NTIFS_)
2262
2263 $if (_NTDDK_)
2264 BOOLEAN
2265 NTAPI
2266 IoTranslateBusAddress(
2267 _In_ INTERFACE_TYPE InterfaceType,
2268 _In_ ULONG BusNumber,
2269 _In_ PHYSICAL_ADDRESS BusAddress,
2270 _Inout_ PULONG AddressSpace,
2271 _Out_ PPHYSICAL_ADDRESS TranslatedAddress);
2272 $endif (_NTDDK_)
2273 $if (_NTIFS_)
2274
2275 NTKERNELAPI
2276 NTSTATUS
2277 NTAPI
2278 IoEnumerateRegisteredFiltersList(
2279 _Out_writes_bytes_to_opt_(DriverObjectListSize,(*ActualNumberDriverObjects)*sizeof(PDRIVER_OBJECT))
2280 PDRIVER_OBJECT *DriverObjectList,
2281 _In_ ULONG DriverObjectListSize,
2282 _Out_ PULONG ActualNumberDriverObjects);
2283 $endif (_NTIFS_)
2284 $if (_NTDDK_ || _NTIFS_)
2285 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */
2286 $endif (_NTDDK_ || _NTIFS_)
2287
2288 #if (NTDDI_VERSION >= NTDDI_VISTA)
2289 $if (_WDMDDK_)
2290 NTKERNELAPI
2291 NTSTATUS
2292 NTAPI
2293 IoGetBootDiskInformationLite(
2294 _Outptr_ PBOOTDISK_INFORMATION_LITE *BootDiskInformation);
2295
2296 NTKERNELAPI
2297 NTSTATUS
2298 NTAPI
2299 IoCheckShareAccessEx(
2300 _In_ ACCESS_MASK DesiredAccess,
2301 _In_ ULONG DesiredShareAccess,
2302 _Inout_ PFILE_OBJECT FileObject,
2303 _Inout_ PSHARE_ACCESS ShareAccess,
2304 _In_ BOOLEAN Update,
2305 _In_ PBOOLEAN WritePermission);
2306
2307 NTKERNELAPI
2308 NTSTATUS
2309 NTAPI
2310 IoConnectInterruptEx(
2311 _Inout_ PIO_CONNECT_INTERRUPT_PARAMETERS Parameters);
2312
2313 NTKERNELAPI
2314 VOID
2315 NTAPI
2316 IoDisconnectInterruptEx(
2317 _In_ PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters);
2318
2319 LOGICAL
2320 NTAPI
2321 IoWithinStackLimits(
2322 _In_ ULONG_PTR RegionStart,
2323 _In_ SIZE_T RegionSize);
2324
2325 NTKERNELAPI
2326 VOID
2327 NTAPI
2328 IoSetShareAccessEx(
2329 _In_ ACCESS_MASK DesiredAccess,
2330 _In_ ULONG DesiredShareAccess,
2331 _Inout_ PFILE_OBJECT FileObject,
2332 _Out_ PSHARE_ACCESS ShareAccess,
2333 _In_ PBOOLEAN WritePermission);
2334
2335 ULONG
2336 NTAPI
2337 IoSizeofWorkItem(VOID);
2338
2339 VOID
2340 NTAPI
2341 IoInitializeWorkItem(
2342 _In_ PVOID IoObject,
2343 _Out_ PIO_WORKITEM IoWorkItem);
2344
2345 VOID
2346 NTAPI
2347 IoUninitializeWorkItem(
2348 _Inout_ PIO_WORKITEM IoWorkItem);
2349
2350 _IRQL_requires_max_(DISPATCH_LEVEL)
2351 VOID
2352 NTAPI
2353 IoQueueWorkItemEx(
2354 _Inout_ PIO_WORKITEM IoWorkItem,
2355 _In_ PIO_WORKITEM_ROUTINE_EX WorkerRoutine,
2356 _In_ WORK_QUEUE_TYPE QueueType,
2357 _In_opt_ __drv_aliasesMem PVOID Context);
2358
2359 IO_PRIORITY_HINT
2360 NTAPI
2361 IoGetIoPriorityHint(
2362 _In_ PIRP Irp);
2363
2364 NTSTATUS
2365 NTAPI
2366 IoSetIoPriorityHint(
2367 _In_ PIRP Irp,
2368 _In_ IO_PRIORITY_HINT PriorityHint);
2369
2370 NTSTATUS
2371 NTAPI
2372 IoAllocateSfioStreamIdentifier(
2373 _In_ PFILE_OBJECT FileObject,
2374 _In_ ULONG Length,
2375 _In_ PVOID Signature,
2376 _Out_ PVOID *StreamIdentifier);
2377
2378 PVOID
2379 NTAPI
2380 IoGetSfioStreamIdentifier(
2381 _In_ PFILE_OBJECT FileObject,
2382 _In_ PVOID Signature);
2383
2384 NTSTATUS
2385 NTAPI
2386 IoFreeSfioStreamIdentifier(
2387 _In_ PFILE_OBJECT FileObject,
2388 _In_ PVOID Signature);
2389
2390 _IRQL_requires_max_(DISPATCH_LEVEL)
2391 _Must_inspect_result_
2392 NTKERNELAPI
2393 NTSTATUS
2394 NTAPI
2395 IoRequestDeviceEjectEx(
2396 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
2397 _In_opt_ PIO_DEVICE_EJECT_CALLBACK Callback,
2398 _In_opt_ PVOID Context,
2399 _In_opt_ PDRIVER_OBJECT DriverObject);
2400
2401 _IRQL_requires_max_(PASSIVE_LEVEL)
2402 _Must_inspect_result_
2403 NTKERNELAPI
2404 NTSTATUS
2405 NTAPI
2406 IoSetDevicePropertyData(
2407 _In_ PDEVICE_OBJECT Pdo,
2408 _In_ CONST DEVPROPKEY *PropertyKey,
2409 _In_ LCID Lcid,
2410 _In_ ULONG Flags,
2411 _In_ DEVPROPTYPE Type,
2412 _In_ ULONG Size,
2413 _In_opt_ PVOID Data);
2414
2415 _IRQL_requires_max_(PASSIVE_LEVEL)
2416 _Must_inspect_result_
2417 NTKERNELAPI
2418 NTSTATUS
2419 NTAPI
2420 IoGetDevicePropertyData(
2421 _In_ PDEVICE_OBJECT Pdo,
2422 _In_ CONST DEVPROPKEY *PropertyKey,
2423 _In_ LCID Lcid,
2424 _Reserved_ ULONG Flags,
2425 _In_ ULONG Size,
2426 _Out_ PVOID Data,
2427 _Out_ PULONG RequiredSize,
2428 _Out_ PDEVPROPTYPE Type);
2429
2430 $endif (_WDMDDK_)
2431 $if (_NTDDK_)
2432 NTKERNELAPI
2433 NTSTATUS
2434 NTAPI
2435 IoUpdateDiskGeometry(
2436 _In_ PDEVICE_OBJECT DeviceObject,
2437 _In_ struct _DISK_GEOMETRY_EX* OldDiskGeometry,
2438 _In_ struct _DISK_GEOMETRY_EX* NewDiskGeometry);
2439
2440 PTXN_PARAMETER_BLOCK
2441 NTAPI
2442 IoGetTransactionParameterBlock(
2443 _In_ PFILE_OBJECT FileObject);
2444
2445 NTKERNELAPI
2446 NTSTATUS
2447 NTAPI
2448 IoCreateFileEx(
2449 _Out_ PHANDLE FileHandle,
2450 _In_ ACCESS_MASK DesiredAccess,
2451 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
2452 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
2453 _In_opt_ PLARGE_INTEGER AllocationSize,
2454 _In_ ULONG FileAttributes,
2455 _In_ ULONG ShareAccess,
2456 _In_ ULONG Disposition,
2457 _In_ ULONG CreateOptions,
2458 _In_opt_ PVOID EaBuffer,
2459 _In_ ULONG EaLength,
2460 _In_ CREATE_FILE_TYPE CreateFileType,
2461 _In_opt_ PVOID InternalParameters,
2462 _In_ ULONG Options,
2463 _In_opt_ PIO_DRIVER_CREATE_CONTEXT DriverContext);
2464
2465 NTSTATUS
2466 NTAPI
2467 IoSetIrpExtraCreateParameter(
2468 _Inout_ PIRP Irp,
2469 _In_ struct _ECP_LIST *ExtraCreateParameter);
2470
2471 VOID
2472 NTAPI
2473 IoClearIrpExtraCreateParameter(
2474 _Inout_ PIRP Irp);
2475
2476 NTSTATUS
2477 NTAPI
2478 IoGetIrpExtraCreateParameter(
2479 _In_ PIRP Irp,
2480 _Outptr_result_maybenull_ struct _ECP_LIST **ExtraCreateParameter);
2481
2482 BOOLEAN
2483 NTAPI
2484 IoIsFileObjectIgnoringSharing(
2485 _In_ PFILE_OBJECT FileObject);
2486
2487 $endif (_NTDDK_)
2488 $if (_NTIFS_)
2489
2490 FORCEINLINE
2491 VOID
2492 NTAPI
2493 IoInitializePriorityInfo(
2494 _In_ PIO_PRIORITY_INFO PriorityInfo)
2495 {
2496 PriorityInfo->Size = sizeof(IO_PRIORITY_INFO);
2497 PriorityInfo->ThreadPriority = 0xffff;
2498 PriorityInfo->IoPriority = IoPriorityNormal;
2499 PriorityInfo->PagePriority = 0;
2500 }
2501 $endif (_NTIFS_)
2502 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
2503
2504 $if (_WDMDDK_)
2505 #define IoCallDriverStackSafeDefault(a, b) IoCallDriver(a, b)
2506
2507 #if (NTDDI_VERSION >= NTDDI_WS08)
2508 _IRQL_requires_max_(PASSIVE_LEVEL)
2509 _Must_inspect_result_
2510 NTKERNELAPI
2511 NTSTATUS
2512 NTAPI
2513 IoReplacePartitionUnit(
2514 _In_ PDEVICE_OBJECT TargetPdo,
2515 _In_ PDEVICE_OBJECT SparePdo,
2516 _In_ ULONG Flags);
2517 #endif
2518
2519 $endif (_WDMDDK_)
2520 #if (NTDDI_VERSION >= NTDDI_WIN7)
2521
2522 $if (_WDMDDK_)
2523 NTKERNELAPI
2524 NTSTATUS
2525 NTAPI
2526 IoGetAffinityInterrupt(
2527 _In_ PKINTERRUPT InterruptObject,
2528 _Out_ PGROUP_AFFINITY GroupAffinity);
2529
2530 NTSTATUS
2531 NTAPI
2532 IoGetContainerInformation(
2533 _In_ IO_CONTAINER_INFORMATION_CLASS InformationClass,
2534 _In_opt_ PVOID ContainerObject,
2535 _Inout_updates_bytes_opt_(BufferLength) PVOID Buffer,
2536 _In_ ULONG BufferLength);
2537
2538 NTSTATUS
2539 NTAPI
2540 IoRegisterContainerNotification(
2541 _In_ IO_CONTAINER_NOTIFICATION_CLASS NotificationClass,
2542 _In_ PIO_CONTAINER_NOTIFICATION_FUNCTION CallbackFunction,
2543 _In_reads_bytes_opt_(NotificationInformationLength) PVOID NotificationInformation,
2544 _In_ ULONG NotificationInformationLength,
2545 _Out_ PVOID CallbackRegistration);
2546
2547 VOID
2548 NTAPI
2549 IoUnregisterContainerNotification(
2550 _In_ PVOID CallbackRegistration);
2551
2552 _IRQL_requires_max_(PASSIVE_LEVEL)
2553 __drv_freesMem(Pool)
2554 NTKERNELAPI
2555 NTSTATUS
2556 NTAPI
2557 IoUnregisterPlugPlayNotificationEx(
2558 _In_ PVOID NotificationEntry);
2559
2560 _IRQL_requires_max_(PASSIVE_LEVEL)
2561 _Must_inspect_result_
2562 NTKERNELAPI
2563 NTSTATUS
2564 NTAPI
2565 IoGetDeviceNumaNode(
2566 _In_ PDEVICE_OBJECT Pdo,
2567 _Out_ PUSHORT NodeNumber);
2568
2569 $endif (_WDMDDK_)
2570 $if (_NTDDK_)
2571 NTSTATUS
2572 NTAPI
2573 IoSetFileObjectIgnoreSharing(
2574 _In_ PFILE_OBJECT FileObject);
2575
2576 $endif (_NTDDK_)
2577 $if (_NTIFS_)
2578
2579 NTKERNELAPI
2580 NTSTATUS
2581 NTAPI
2582 IoRegisterFsRegistrationChangeMountAware(
2583 _In_ PDRIVER_OBJECT DriverObject,
2584 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine,
2585 _In_ BOOLEAN SynchronizeWithMounts);
2586
2587 NTKERNELAPI
2588 NTSTATUS
2589 NTAPI
2590 IoReplaceFileObjectName(
2591 _In_ PFILE_OBJECT FileObject,
2592 _In_reads_bytes_(FileNameLength) PWSTR NewFileName,
2593 _In_ USHORT FileNameLength);
2594 $endif (_NTIFS_)
2595 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
2596
2597 $if (_WDMDDK_)
2598 #if defined(_WIN64)
2599 NTKERNELAPI
2600 ULONG
2601 NTAPI
2602 IoWMIDeviceObjectToProviderId(
2603 _In_ PDEVICE_OBJECT DeviceObject);
2604 #else
2605 #define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject))
2606 #endif
2607
2608 /*
2609 * USHORT
2610 * IoSizeOfIrp(
2611 * IN CCHAR StackSize)
2612 */
2613 #define IoSizeOfIrp(_StackSize) \
2614 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
2615
2616 FORCEINLINE
2617 VOID
2618 IoSkipCurrentIrpStackLocation(
2619 _Inout_ PIRP Irp)
2620 {
2621 ASSERT(Irp->CurrentLocation <= Irp->StackCount);
2622 Irp->CurrentLocation++;
2623 #ifdef NONAMELESSUNION
2624 Irp->Tail.Overlay.s.u.CurrentStackLocation++;
2625 #else
2626 Irp->Tail.Overlay.CurrentStackLocation++;
2627 #endif
2628 }
2629
2630 FORCEINLINE
2631 VOID
2632 IoSetNextIrpStackLocation(
2633 _Inout_ PIRP Irp)
2634 {
2635 ASSERT(Irp->CurrentLocation > 0);
2636 Irp->CurrentLocation--;
2637 #ifdef NONAMELESSUNION
2638 Irp->Tail.Overlay.s.u.CurrentStackLocation--;
2639 #else
2640 Irp->Tail.Overlay.CurrentStackLocation--;
2641 #endif
2642 }
2643
2644 __drv_aliasesMem
2645 FORCEINLINE
2646 PIO_STACK_LOCATION
2647 IoGetNextIrpStackLocation(
2648 _In_ PIRP Irp)
2649 {
2650 ASSERT(Irp->CurrentLocation > 0);
2651 #ifdef NONAMELESSUNION
2652 return ((Irp)->Tail.Overlay.s.u.CurrentStackLocation - 1 );
2653 #else
2654 return ((Irp)->Tail.Overlay.CurrentStackLocation - 1 );
2655 #endif
2656 }
2657
2658 _IRQL_requires_max_(DISPATCH_LEVEL)
2659 FORCEINLINE
2660 VOID
2661 IoSetCompletionRoutine(
2662 _In_ PIRP Irp,
2663 _In_opt_ PIO_COMPLETION_ROUTINE CompletionRoutine,
2664 _In_opt_ __drv_aliasesMem PVOID Context,
2665 _In_ BOOLEAN InvokeOnSuccess,
2666 _In_ BOOLEAN InvokeOnError,
2667 _In_ BOOLEAN InvokeOnCancel)
2668 {
2669 PIO_STACK_LOCATION irpSp;
2670 ASSERT( (InvokeOnSuccess || InvokeOnError || InvokeOnCancel) ? (CompletionRoutine != NULL) : TRUE );
2671 irpSp = IoGetNextIrpStackLocation(Irp);
2672 irpSp->CompletionRoutine = CompletionRoutine;
2673 irpSp->Context = Context;
2674 irpSp->Control = 0;
2675
2676 if (InvokeOnSuccess) {
2677 irpSp->Control = SL_INVOKE_ON_SUCCESS;
2678 }
2679
2680 if (InvokeOnError) {
2681 irpSp->Control |= SL_INVOKE_ON_ERROR;
2682 }
2683
2684 if (InvokeOnCancel) {
2685 irpSp->Control |= SL_INVOKE_ON_CANCEL;
2686 }
2687 }
2688
2689 _IRQL_requires_max_(DISPATCH_LEVEL)
2690 _Ret_maybenull_
2691 FORCEINLINE
2692 PDRIVER_CANCEL
2693 IoSetCancelRoutine(
2694 _Inout_ PIRP Irp,
2695 _In_opt_ PDRIVER_CANCEL CancelRoutine)
2696 {
2697 return (PDRIVER_CANCEL)(ULONG_PTR) InterlockedExchangePointer((PVOID *)&(Irp)->CancelRoutine, (PVOID)(ULONG_PTR)(CancelRoutine));
2698 }
2699
2700 FORCEINLINE
2701 VOID
2702 IoRequestDpc(
2703 _Inout_ PDEVICE_OBJECT DeviceObject,
2704 _In_opt_ PIRP Irp,
2705 _In_opt_ __drv_aliasesMem PVOID Context)
2706 {
2707 KeInsertQueueDpc(&DeviceObject->Dpc, Irp, Context);
2708 }
2709
2710 /*
2711 * VOID
2712 * IoReleaseRemoveLock(
2713 * IN PIO_REMOVE_LOCK RemoveLock,
2714 * IN PVOID Tag)
2715 */
2716 #define IoReleaseRemoveLock(_RemoveLock, \
2717 _Tag) \
2718 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2719
2720 /*
2721 * VOID
2722 * IoReleaseRemoveLockAndWait(
2723 * IN PIO_REMOVE_LOCK RemoveLock,
2724 * IN PVOID Tag)
2725 */
2726 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
2727 _Tag) \
2728 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2729
2730 #if defined(_WIN64)
2731 _IRQL_requires_max_(DISPATCH_LEVEL)
2732 NTKERNELAPI
2733 BOOLEAN
2734 IoIs32bitProcess(
2735 _In_opt_ PIRP Irp);
2736 #endif
2737
2738 #define PLUGPLAY_REGKEY_DEVICE 1
2739 #define PLUGPLAY_REGKEY_DRIVER 2
2740 #define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4
2741
2742 __drv_aliasesMem
2743 FORCEINLINE
2744 PIO_STACK_LOCATION
2745 IoGetCurrentIrpStackLocation(
2746 _In_ PIRP Irp)
2747 {
2748 ASSERT(Irp->CurrentLocation <= Irp->StackCount + 1);
2749 #ifdef NONAMELESSUNION
2750 return Irp->Tail.Overlay.s.u.CurrentStackLocation;
2751 #else
2752 return Irp->Tail.Overlay.CurrentStackLocation;
2753 #endif
2754 }
2755
2756 FORCEINLINE
2757 VOID
2758 IoMarkIrpPending(
2759 _Inout_ PIRP Irp)
2760 {
2761 IoGetCurrentIrpStackLocation((Irp))->Control |= SL_PENDING_RETURNED;
2762 }
2763
2764 /*
2765 * BOOLEAN
2766 * IoIsErrorUserInduced(
2767 * IN NTSTATUS Status);
2768 */
2769 #define IoIsErrorUserInduced(Status) \
2770 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
2771 ((Status) == STATUS_IO_TIMEOUT) || \
2772 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
2773 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
2774 ((Status) == STATUS_VERIFY_REQUIRED) || \
2775 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
2776 ((Status) == STATUS_WRONG_VOLUME)))
2777
2778 /* VOID
2779 * IoInitializeRemoveLock(
2780 * IN PIO_REMOVE_LOCK Lock,
2781 * IN ULONG AllocateTag,
2782 * IN ULONG MaxLockedMinutes,
2783 * IN ULONG HighWatermark)
2784 */
2785 #define IoInitializeRemoveLock( \
2786 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
2787 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
2788 HighWatermark, sizeof(IO_REMOVE_LOCK))
2789
2790 FORCEINLINE
2791 VOID
2792 IoInitializeDpcRequest(
2793 _In_ PDEVICE_OBJECT DeviceObject,
2794 _In_ PIO_DPC_ROUTINE DpcRoutine)
2795 {
2796 #ifdef _MSC_VER
2797 #pragma warning(push)
2798 #pragma warning(disable:28024)
2799 #endif
2800 KeInitializeDpc(&DeviceObject->Dpc,
2801 (PKDEFERRED_ROUTINE) DpcRoutine,
2802 DeviceObject);
2803 #ifdef _MSC_VER
2804 #pragma warning(pop)
2805 #endif
2806 }
2807
2808 #define DEVICE_INTERFACE_INCLUDE_NONACTIVE 0x00000001
2809
2810 /*
2811 * ULONG
2812 * IoGetFunctionCodeFromCtlCode(
2813 * IN ULONG ControlCode)
2814 */
2815 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
2816 (((_ControlCode) >> 2) & 0x00000FFF)
2817
2818 FORCEINLINE
2819 VOID
2820 IoCopyCurrentIrpStackLocationToNext(
2821 _Inout_ PIRP Irp)
2822 {
2823 PIO_STACK_LOCATION irpSp;
2824 PIO_STACK_LOCATION nextIrpSp;
2825 irpSp = IoGetCurrentIrpStackLocation(Irp);
2826 nextIrpSp = IoGetNextIrpStackLocation(Irp);
2827 RtlCopyMemory(nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine));
2828 nextIrpSp->Control = 0;
2829 }
2830
2831 _IRQL_requires_max_(APC_LEVEL)
2832 NTKERNELAPI
2833 VOID
2834 NTAPI
2835 IoGetStackLimits(
2836 _Out_ PULONG_PTR LowLimit,
2837 _Out_ PULONG_PTR HighLimit);
2838
2839 _IRQL_requires_max_(APC_LEVEL)
2840 FORCEINLINE
2841 ULONG_PTR
2842 IoGetRemainingStackSize(VOID)
2843 {
2844 ULONG_PTR End, Begin;
2845 ULONG_PTR Result;
2846
2847 IoGetStackLimits(&Begin, &End);
2848 Result = (ULONG_PTR)(&End) - Begin;
2849 return Result;
2850 }
2851
2852 #if (NTDDI_VERSION >= NTDDI_WS03)
2853 FORCEINLINE
2854 VOID
2855 IoInitializeThreadedDpcRequest(
2856 _In_ PDEVICE_OBJECT DeviceObject,
2857 _In_ PIO_DPC_ROUTINE DpcRoutine)
2858 {
2859 #ifdef _MSC_VER
2860 #pragma warning(push)
2861 #pragma warning(disable:28024)
2862 #pragma warning(disable:28128)
2863 #endif
2864 KeInitializeThreadedDpc(&DeviceObject->Dpc,
2865 (PKDEFERRED_ROUTINE) DpcRoutine,
2866 DeviceObject );
2867 #ifdef _MSC_VER
2868 #pragma warning(pop)
2869 #endif
2870 }
2871 #endif
2872
2873 $endif (_WDMDDK_)