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