9715dcc1808f4b463885e2a68929b8fab16a49ff
[reactos.git] / include / xdk / iofuncs.h
1 /******************************************************************************
2 * I/O Manager Functions *
3 ******************************************************************************/
4 $if (_NTDDK_)
5 /*
6 * VOID IoAssignArcName(
7 * IN PUNICODE_STRING ArcName,
8 * IN PUNICODE_STRING DeviceName);
9 */
10 #define IoAssignArcName(_ArcName, _DeviceName) ( \
11 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
12
13 /*
14 * VOID
15 * IoDeassignArcName(
16 * IN PUNICODE_STRING ArcName)
17 */
18 #define IoDeassignArcName IoDeleteSymbolicLink
19
20 VOID
21 FORCEINLINE
22 NTAPI
23 IoInitializeDriverCreateContext(
24 PIO_DRIVER_CREATE_CONTEXT DriverContext)
25 {
26 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT));
27 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT);
28 }
29 $endif
30
31
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 $endif
575
576 #if (NTDDI_VERSION >= NTDDI_WIN2K)
577 $if (_NTDDK_)
578 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_))
579 NTKERNELAPI
580 NTSTATUS
581 NTAPI
582 IoAllocateAdapterChannel(
583 IN PADAPTER_OBJECT AdapterObject,
584 IN PDEVICE_OBJECT DeviceObject,
585 IN ULONG NumberOfMapRegisters,
586 IN PDRIVER_CONTROL ExecutionRoutine,
587 IN PVOID Context);
588 #endif
589
590 //DECLSPEC_DEPRECATED_DDK
591 NTHALAPI
592 PHYSICAL_ADDRESS
593 NTAPI
594 IoMapTransfer(
595 IN PADAPTER_OBJECT AdapterObject,
596 IN PMDL Mdl,
597 IN PVOID MapRegisterBase,
598 IN PVOID CurrentVa,
599 IN OUT PULONG Length,
600 IN BOOLEAN WriteToDevice);
601
602 NTKERNELAPI
603 VOID
604 NTAPI
605 IoAllocateController(
606 IN PCONTROLLER_OBJECT ControllerObject,
607 IN PDEVICE_OBJECT DeviceObject,
608 IN PDRIVER_CONTROL ExecutionRoutine,
609 IN PVOID Context OPTIONAL);
610
611 NTKERNELAPI
612 PCONTROLLER_OBJECT
613 NTAPI
614 IoCreateController(
615 IN ULONG Size);
616
617 NTKERNELAPI
618 VOID
619 NTAPI
620 IoDeleteController(
621 IN PCONTROLLER_OBJECT ControllerObject);
622
623 NTKERNELAPI
624 VOID
625 NTAPI
626 IoFreeController(
627 IN PCONTROLLER_OBJECT ControllerObject);
628
629 NTKERNELAPI
630 PCONFIGURATION_INFORMATION
631 NTAPI
632 IoGetConfigurationInformation(VOID);
633
634 NTKERNELAPI
635 PDEVICE_OBJECT
636 NTAPI
637 IoGetDeviceToVerify(
638 IN PETHREAD Thread);
639
640 NTKERNELAPI
641 VOID
642 NTAPI
643 IoCancelFileOpen(
644 IN PDEVICE_OBJECT DeviceObject,
645 IN PFILE_OBJECT FileObject);
646
647 NTKERNELAPI
648 PGENERIC_MAPPING
649 NTAPI
650 IoGetFileObjectGenericMapping(VOID);
651
652 NTKERNELAPI
653 PIRP
654 NTAPI
655 IoMakeAssociatedIrp(
656 IN PIRP Irp,
657 IN CCHAR StackSize);
658
659 NTKERNELAPI
660 NTSTATUS
661 NTAPI
662 IoQueryDeviceDescription(
663 IN PINTERFACE_TYPE BusType OPTIONAL,
664 IN PULONG BusNumber OPTIONAL,
665 IN PCONFIGURATION_TYPE ControllerType OPTIONAL,
666 IN PULONG ControllerNumber OPTIONAL,
667 IN PCONFIGURATION_TYPE PeripheralType OPTIONAL,
668 IN PULONG PeripheralNumber OPTIONAL,
669 IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
670 IN OUT PVOID Context OPTIONAL);
671
672 NTKERNELAPI
673 VOID
674 NTAPI
675 IoRaiseHardError(
676 IN PIRP Irp,
677 IN PVPB Vpb OPTIONAL,
678 IN PDEVICE_OBJECT RealDeviceObject);
679
680 NTKERNELAPI
681 BOOLEAN
682 NTAPI
683 IoRaiseInformationalHardError(
684 IN NTSTATUS ErrorStatus,
685 IN PUNICODE_STRING String OPTIONAL,
686 IN PKTHREAD Thread OPTIONAL);
687
688 NTKERNELAPI
689 VOID
690 NTAPI
691 IoRegisterBootDriverReinitialization(
692 IN PDRIVER_OBJECT DriverObject,
693 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
694 IN PVOID Context OPTIONAL);
695
696 NTKERNELAPI
697 VOID
698 NTAPI
699 IoRegisterDriverReinitialization(
700 IN PDRIVER_OBJECT DriverObject,
701 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
702 IN PVOID Context OPTIONAL);
703
704 NTKERNELAPI
705 NTSTATUS
706 NTAPI
707 IoAttachDeviceByPointer(
708 IN PDEVICE_OBJECT SourceDevice,
709 IN PDEVICE_OBJECT TargetDevice);
710
711 NTKERNELAPI
712 NTSTATUS
713 NTAPI
714 IoReportDetectedDevice(
715 IN PDRIVER_OBJECT DriverObject,
716 IN INTERFACE_TYPE LegacyBusType,
717 IN ULONG BusNumber,
718 IN ULONG SlotNumber,
719 IN PCM_RESOURCE_LIST ResourceList OPTIONAL,
720 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
721 IN BOOLEAN ResourceAssigned,
722 IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
723
724 NTKERNELAPI
725 NTSTATUS
726 NTAPI
727 IoReportResourceForDetection(
728 IN PDRIVER_OBJECT DriverObject,
729 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
730 IN ULONG DriverListSize OPTIONAL,
731 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
732 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
733 IN ULONG DeviceListSize OPTIONAL,
734 OUT PBOOLEAN ConflictDetected);
735
736 NTKERNELAPI
737 NTSTATUS
738 NTAPI
739 IoReportResourceUsage(
740 IN PUNICODE_STRING DriverClassName OPTIONAL,
741 IN PDRIVER_OBJECT DriverObject,
742 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
743 IN ULONG DriverListSize OPTIONAL,
744 IN PDEVICE_OBJECT DeviceObject,
745 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
746 IN ULONG DeviceListSize OPTIONAL,
747 IN BOOLEAN OverrideConflict,
748 OUT PBOOLEAN ConflictDetected);
749
750 NTKERNELAPI
751 VOID
752 NTAPI
753 IoSetHardErrorOrVerifyDevice(
754 IN PIRP Irp,
755 IN PDEVICE_OBJECT DeviceObject);
756
757 NTKERNELAPI
758 NTSTATUS
759 NTAPI
760 IoAssignResources(
761 IN PUNICODE_STRING RegistryPath,
762 IN PUNICODE_STRING DriverClassName OPTIONAL,
763 IN PDRIVER_OBJECT DriverObject,
764 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
765 IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources OPTIONAL,
766 IN OUT PCM_RESOURCE_LIST *AllocatedResources);
767
768 NTKERNELAPI
769 BOOLEAN
770 NTAPI
771 IoSetThreadHardErrorMode(
772 IN BOOLEAN EnableHardErrors);
773 $endif
774
775 $if (_WDMDDK_)
776 NTKERNELAPI
777 VOID
778 NTAPI
779 IoAcquireCancelSpinLock(
780 OUT PKIRQL Irql);
781
782 NTKERNELAPI
783 NTSTATUS
784 NTAPI
785 IoAcquireRemoveLockEx(
786 IN PIO_REMOVE_LOCK RemoveLock,
787 IN PVOID Tag OPTIONAL,
788 IN PCSTR File,
789 IN ULONG Line,
790 IN ULONG RemlockSize);
791 NTKERNELAPI
792 NTSTATUS
793 NTAPI
794 IoAllocateDriverObjectExtension(
795 IN PDRIVER_OBJECT DriverObject,
796 IN PVOID ClientIdentificationAddress,
797 IN ULONG DriverObjectExtensionSize,
798 OUT PVOID *DriverObjectExtension);
799
800 NTKERNELAPI
801 PVOID
802 NTAPI
803 IoAllocateErrorLogEntry(
804 IN PVOID IoObject,
805 IN UCHAR EntrySize);
806
807 NTKERNELAPI
808 PIRP
809 NTAPI
810 IoAllocateIrp(
811 IN CCHAR StackSize,
812 IN BOOLEAN ChargeQuota);
813
814 NTKERNELAPI
815 PMDL
816 NTAPI
817 IoAllocateMdl(
818 IN PVOID VirtualAddress OPTIONAL,
819 IN ULONG Length,
820 IN BOOLEAN SecondaryBuffer,
821 IN BOOLEAN ChargeQuota,
822 IN OUT PIRP Irp OPTIONAL);
823
824 NTKERNELAPI
825 PIO_WORKITEM
826 NTAPI
827 IoAllocateWorkItem(
828 IN PDEVICE_OBJECT DeviceObject);
829
830 NTKERNELAPI
831 NTSTATUS
832 NTAPI
833 IoAttachDevice(
834 IN PDEVICE_OBJECT SourceDevice,
835 IN PUNICODE_STRING TargetDevice,
836 OUT PDEVICE_OBJECT *AttachedDevice);
837
838 NTKERNELAPI
839 PDEVICE_OBJECT
840 NTAPI
841 IoAttachDeviceToDeviceStack(
842 IN PDEVICE_OBJECT SourceDevice,
843 IN PDEVICE_OBJECT TargetDevice);
844
845 NTKERNELAPI
846 PIRP
847 NTAPI
848 IoBuildAsynchronousFsdRequest(
849 IN ULONG MajorFunction,
850 IN PDEVICE_OBJECT DeviceObject,
851 IN OUT PVOID Buffer OPTIONAL,
852 IN ULONG Length OPTIONAL,
853 IN PLARGE_INTEGER StartingOffset OPTIONAL,
854 IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL);
855
856 NTKERNELAPI
857 PIRP
858 NTAPI
859 IoBuildDeviceIoControlRequest(
860 IN ULONG IoControlCode,
861 IN PDEVICE_OBJECT DeviceObject,
862 IN PVOID InputBuffer OPTIONAL,
863 IN ULONG InputBufferLength,
864 OUT PVOID OutputBuffer OPTIONAL,
865 IN ULONG OutputBufferLength,
866 IN BOOLEAN InternalDeviceIoControl,
867 IN PKEVENT Event,
868 OUT PIO_STATUS_BLOCK IoStatusBlock);
869
870 NTKERNELAPI
871 VOID
872 NTAPI
873 IoBuildPartialMdl(
874 IN PMDL SourceMdl,
875 IN OUT PMDL TargetMdl,
876 IN PVOID VirtualAddress,
877 IN ULONG Length);
878
879 NTKERNELAPI
880 PIRP
881 NTAPI
882 IoBuildSynchronousFsdRequest(
883 IN ULONG MajorFunction,
884 IN PDEVICE_OBJECT DeviceObject,
885 IN OUT PVOID Buffer OPTIONAL,
886 IN ULONG Length OPTIONAL,
887 IN PLARGE_INTEGER StartingOffset OPTIONAL,
888 IN PKEVENT Event,
889 OUT PIO_STATUS_BLOCK IoStatusBlock);
890
891 NTKERNELAPI
892 NTSTATUS
893 FASTCALL
894 IofCallDriver(
895 IN PDEVICE_OBJECT DeviceObject,
896 IN OUT PIRP Irp);
897 #define IoCallDriver IofCallDriver
898
899 NTKERNELAPI
900 VOID
901 FASTCALL
902 IofCompleteRequest(
903 IN PIRP Irp,
904 IN CCHAR PriorityBoost);
905 #define IoCompleteRequest IofCompleteRequest
906
907 NTKERNELAPI
908 BOOLEAN
909 NTAPI
910 IoCancelIrp(
911 IN PIRP Irp);
912
913 NTKERNELAPI
914 NTSTATUS
915 NTAPI
916 IoCheckShareAccess(
917 IN ACCESS_MASK DesiredAccess,
918 IN ULONG DesiredShareAccess,
919 IN OUT PFILE_OBJECT FileObject,
920 IN OUT PSHARE_ACCESS ShareAccess,
921 IN BOOLEAN Update);
922
923 NTKERNELAPI
924 VOID
925 FASTCALL
926 IofCompleteRequest(
927 IN PIRP Irp,
928 IN CCHAR PriorityBoost);
929
930 NTKERNELAPI
931 NTSTATUS
932 NTAPI
933 IoConnectInterrupt(
934 OUT PKINTERRUPT *InterruptObject,
935 IN PKSERVICE_ROUTINE ServiceRoutine,
936 IN PVOID ServiceContext OPTIONAL,
937 IN PKSPIN_LOCK SpinLock OPTIONAL,
938 IN ULONG Vector,
939 IN KIRQL Irql,
940 IN KIRQL SynchronizeIrql,
941 IN KINTERRUPT_MODE InterruptMode,
942 IN BOOLEAN ShareVector,
943 IN KAFFINITY ProcessorEnableMask,
944 IN BOOLEAN FloatingSave);
945
946 NTKERNELAPI
947 NTSTATUS
948 NTAPI
949 IoCreateDevice(
950 IN PDRIVER_OBJECT DriverObject,
951 IN ULONG DeviceExtensionSize,
952 IN PUNICODE_STRING DeviceName OPTIONAL,
953 IN DEVICE_TYPE DeviceType,
954 IN ULONG DeviceCharacteristics,
955 IN BOOLEAN Exclusive,
956 OUT PDEVICE_OBJECT *DeviceObject);
957
958 NTKERNELAPI
959 NTSTATUS
960 NTAPI
961 IoCreateFile(
962 OUT PHANDLE FileHandle,
963 IN ACCESS_MASK DesiredAccess,
964 IN POBJECT_ATTRIBUTES ObjectAttributes,
965 OUT PIO_STATUS_BLOCK IoStatusBlock,
966 IN PLARGE_INTEGER AllocationSize OPTIONAL,
967 IN ULONG FileAttributes,
968 IN ULONG ShareAccess,
969 IN ULONG Disposition,
970 IN ULONG CreateOptions,
971 IN PVOID EaBuffer OPTIONAL,
972 IN ULONG EaLength,
973 IN CREATE_FILE_TYPE CreateFileType,
974 IN PVOID InternalParameters OPTIONAL,
975 IN ULONG Options);
976
977 NTKERNELAPI
978 PKEVENT
979 NTAPI
980 IoCreateNotificationEvent(
981 IN PUNICODE_STRING EventName,
982 OUT PHANDLE EventHandle);
983
984 NTKERNELAPI
985 NTSTATUS
986 NTAPI
987 IoCreateSymbolicLink(
988 IN PUNICODE_STRING SymbolicLinkName,
989 IN PUNICODE_STRING DeviceName);
990
991 NTKERNELAPI
992 PKEVENT
993 NTAPI
994 IoCreateSynchronizationEvent(
995 IN PUNICODE_STRING EventName,
996 OUT PHANDLE EventHandle);
997
998 NTKERNELAPI
999 NTSTATUS
1000 NTAPI
1001 IoCreateUnprotectedSymbolicLink(
1002 IN PUNICODE_STRING SymbolicLinkName,
1003 IN PUNICODE_STRING DeviceName);
1004
1005 NTKERNELAPI
1006 VOID
1007 NTAPI
1008 IoDeleteDevice(
1009 IN PDEVICE_OBJECT DeviceObject);
1010
1011 NTKERNELAPI
1012 NTSTATUS
1013 NTAPI
1014 IoDeleteSymbolicLink(
1015 IN PUNICODE_STRING SymbolicLinkName);
1016
1017 NTKERNELAPI
1018 VOID
1019 NTAPI
1020 IoDetachDevice(
1021 IN OUT PDEVICE_OBJECT TargetDevice);
1022
1023 NTKERNELAPI
1024 VOID
1025 NTAPI
1026 IoDisconnectInterrupt(
1027 IN PKINTERRUPT InterruptObject);
1028
1029 NTKERNELAPI
1030 VOID
1031 NTAPI
1032 IoFreeIrp(
1033 IN PIRP Irp);
1034
1035 NTKERNELAPI
1036 VOID
1037 NTAPI
1038 IoFreeMdl(
1039 IN PMDL Mdl);
1040
1041 NTKERNELAPI
1042 VOID
1043 NTAPI
1044 IoFreeWorkItem(
1045 IN PIO_WORKITEM IoWorkItem);
1046
1047 NTKERNELAPI
1048 PDEVICE_OBJECT
1049 NTAPI
1050 IoGetAttachedDevice(
1051 IN PDEVICE_OBJECT DeviceObject);
1052
1053 NTKERNELAPI
1054 PDEVICE_OBJECT
1055 NTAPI
1056 IoGetAttachedDeviceReference(
1057 IN PDEVICE_OBJECT DeviceObject);
1058
1059 NTKERNELAPI
1060 NTSTATUS
1061 NTAPI
1062 IoGetBootDiskInformation(
1063 IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
1064 IN ULONG Size);
1065
1066 NTKERNELAPI
1067 NTSTATUS
1068 NTAPI
1069 IoGetDeviceInterfaceAlias(
1070 IN PUNICODE_STRING SymbolicLinkName,
1071 IN CONST GUID *AliasInterfaceClassGuid,
1072 OUT PUNICODE_STRING AliasSymbolicLinkName);
1073
1074 NTKERNELAPI
1075 PEPROCESS
1076 NTAPI
1077 IoGetCurrentProcess(VOID);
1078
1079 NTKERNELAPI
1080 NTSTATUS
1081 NTAPI
1082 IoGetDeviceInterfaces(
1083 IN CONST GUID *InterfaceClassGuid,
1084 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
1085 IN ULONG Flags,
1086 OUT PWSTR *SymbolicLinkList);
1087
1088 NTKERNELAPI
1089 NTSTATUS
1090 NTAPI
1091 IoGetDeviceObjectPointer(
1092 IN PUNICODE_STRING ObjectName,
1093 IN ACCESS_MASK DesiredAccess,
1094 OUT PFILE_OBJECT *FileObject,
1095 OUT PDEVICE_OBJECT *DeviceObject);
1096
1097 NTKERNELAPI
1098 NTSTATUS
1099 NTAPI
1100 IoGetDeviceProperty(
1101 IN PDEVICE_OBJECT DeviceObject,
1102 IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
1103 IN ULONG BufferLength,
1104 OUT PVOID PropertyBuffer,
1105 OUT PULONG ResultLength);
1106
1107 NTKERNELAPI
1108 PDMA_ADAPTER
1109 NTAPI
1110 IoGetDmaAdapter(
1111 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
1112 IN PDEVICE_DESCRIPTION DeviceDescription,
1113 IN OUT PULONG NumberOfMapRegisters);
1114
1115 NTKERNELAPI
1116 PVOID
1117 NTAPI
1118 IoGetDriverObjectExtension(
1119 IN PDRIVER_OBJECT DriverObject,
1120 IN PVOID ClientIdentificationAddress);
1121
1122 NTKERNELAPI
1123 PVOID
1124 NTAPI
1125 IoGetInitialStack(VOID);
1126
1127 NTKERNELAPI
1128 PDEVICE_OBJECT
1129 NTAPI
1130 IoGetRelatedDeviceObject(
1131 IN PFILE_OBJECT FileObject);
1132
1133 NTKERNELAPI
1134 VOID
1135 NTAPI
1136 IoQueueWorkItem(
1137 IN PIO_WORKITEM IoWorkItem,
1138 IN PIO_WORKITEM_ROUTINE WorkerRoutine,
1139 IN WORK_QUEUE_TYPE QueueType,
1140 IN PVOID Context OPTIONAL);
1141
1142 NTKERNELAPI
1143 VOID
1144 NTAPI
1145 IoInitializeIrp(
1146 IN OUT PIRP Irp,
1147 IN USHORT PacketSize,
1148 IN CCHAR StackSize);
1149
1150 NTKERNELAPI
1151 VOID
1152 NTAPI
1153 IoInitializeRemoveLockEx(
1154 IN PIO_REMOVE_LOCK Lock,
1155 IN ULONG AllocateTag,
1156 IN ULONG MaxLockedMinutes,
1157 IN ULONG HighWatermark,
1158 IN ULONG RemlockSize);
1159
1160 NTKERNELAPI
1161 NTSTATUS
1162 NTAPI
1163 IoInitializeTimer(
1164 IN PDEVICE_OBJECT DeviceObject,
1165 IN PIO_TIMER_ROUTINE TimerRoutine,
1166 IN PVOID Context OPTIONAL);
1167
1168 NTKERNELAPI
1169 VOID
1170 NTAPI
1171 IoInvalidateDeviceRelations(
1172 IN PDEVICE_OBJECT DeviceObject,
1173 IN DEVICE_RELATION_TYPE Type);
1174
1175 NTKERNELAPI
1176 VOID
1177 NTAPI
1178 IoInvalidateDeviceState(
1179 IN PDEVICE_OBJECT PhysicalDeviceObject);
1180
1181 NTKERNELAPI
1182 BOOLEAN
1183 NTAPI
1184 IoIsWdmVersionAvailable(
1185 IN UCHAR MajorVersion,
1186 IN UCHAR MinorVersion);
1187
1188 NTKERNELAPI
1189 NTSTATUS
1190 NTAPI
1191 IoOpenDeviceInterfaceRegistryKey(
1192 IN PUNICODE_STRING SymbolicLinkName,
1193 IN ACCESS_MASK DesiredAccess,
1194 OUT PHANDLE DeviceInterfaceKey);
1195
1196 NTKERNELAPI
1197 NTSTATUS
1198 NTAPI
1199 IoOpenDeviceRegistryKey(
1200 IN PDEVICE_OBJECT DeviceObject,
1201 IN ULONG DevInstKeyType,
1202 IN ACCESS_MASK DesiredAccess,
1203 OUT PHANDLE DevInstRegKey);
1204
1205 NTKERNELAPI
1206 NTSTATUS
1207 NTAPI
1208 IoRegisterDeviceInterface(
1209 IN PDEVICE_OBJECT PhysicalDeviceObject,
1210 IN CONST GUID *InterfaceClassGuid,
1211 IN PUNICODE_STRING ReferenceString OPTIONAL,
1212 OUT PUNICODE_STRING SymbolicLinkName);
1213
1214 NTKERNELAPI
1215 NTSTATUS
1216 NTAPI
1217 IoRegisterPlugPlayNotification(
1218 IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
1219 IN ULONG EventCategoryFlags,
1220 IN PVOID EventCategoryData OPTIONAL,
1221 IN PDRIVER_OBJECT DriverObject,
1222 IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
1223 IN OUT PVOID Context OPTIONAL,
1224 OUT PVOID *NotificationEntry);
1225
1226 NTKERNELAPI
1227 NTSTATUS
1228 NTAPI
1229 IoRegisterShutdownNotification(
1230 IN PDEVICE_OBJECT DeviceObject);
1231
1232 NTKERNELAPI
1233 VOID
1234 NTAPI
1235 IoReleaseCancelSpinLock(
1236 IN KIRQL Irql);
1237
1238 NTKERNELAPI
1239 VOID
1240 NTAPI
1241 IoReleaseRemoveLockAndWaitEx(
1242 IN PIO_REMOVE_LOCK RemoveLock,
1243 IN PVOID Tag OPTIONAL,
1244 IN ULONG RemlockSize);
1245
1246 NTKERNELAPI
1247 VOID
1248 NTAPI
1249 IoReleaseRemoveLockEx(
1250 IN PIO_REMOVE_LOCK RemoveLock,
1251 IN PVOID Tag OPTIONAL,
1252 IN ULONG RemlockSize);
1253
1254 NTKERNELAPI
1255 VOID
1256 NTAPI
1257 IoRemoveShareAccess(
1258 IN PFILE_OBJECT FileObject,
1259 IN OUT PSHARE_ACCESS ShareAccess);
1260
1261 NTKERNELAPI
1262 NTSTATUS
1263 NTAPI
1264 IoReportTargetDeviceChange(
1265 IN PDEVICE_OBJECT PhysicalDeviceObject,
1266 IN PVOID NotificationStructure);
1267
1268 NTKERNELAPI
1269 NTSTATUS
1270 NTAPI
1271 IoReportTargetDeviceChangeAsynchronous(
1272 IN PDEVICE_OBJECT PhysicalDeviceObject,
1273 IN PVOID NotificationStructure,
1274 IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
1275 IN PVOID Context OPTIONAL);
1276
1277 NTKERNELAPI
1278 VOID
1279 NTAPI
1280 IoRequestDeviceEject(
1281 IN PDEVICE_OBJECT PhysicalDeviceObject);
1282
1283 NTKERNELAPI
1284 VOID
1285 NTAPI
1286 IoReuseIrp(
1287 IN OUT PIRP Irp,
1288 IN NTSTATUS Status);
1289
1290 NTKERNELAPI
1291 NTSTATUS
1292 NTAPI
1293 IoSetDeviceInterfaceState(
1294 IN PUNICODE_STRING SymbolicLinkName,
1295 IN BOOLEAN Enable);
1296
1297 NTKERNELAPI
1298 VOID
1299 NTAPI
1300 IoSetShareAccess(
1301 IN ACCESS_MASK DesiredAccess,
1302 IN ULONG DesiredShareAccess,
1303 IN OUT PFILE_OBJECT FileObject,
1304 OUT PSHARE_ACCESS ShareAccess);
1305
1306 NTKERNELAPI
1307 VOID
1308 NTAPI
1309 IoStartNextPacket(
1310 IN PDEVICE_OBJECT DeviceObject,
1311 IN BOOLEAN Cancelable);
1312
1313 NTKERNELAPI
1314 VOID
1315 NTAPI
1316 IoStartNextPacketByKey(
1317 IN PDEVICE_OBJECT DeviceObject,
1318 IN BOOLEAN Cancelable,
1319 IN ULONG Key);
1320
1321 NTKERNELAPI
1322 VOID
1323 NTAPI
1324 IoStartPacket(
1325 IN PDEVICE_OBJECT DeviceObject,
1326 IN PIRP Irp,
1327 IN PULONG Key OPTIONAL,
1328 IN PDRIVER_CANCEL CancelFunction OPTIONAL);
1329
1330 NTKERNELAPI
1331 VOID
1332 NTAPI
1333 IoStartTimer(
1334 IN PDEVICE_OBJECT DeviceObject);
1335
1336 NTKERNELAPI
1337 VOID
1338 NTAPI
1339 IoStopTimer(
1340 IN PDEVICE_OBJECT DeviceObject);
1341
1342 NTKERNELAPI
1343 NTSTATUS
1344 NTAPI
1345 IoUnregisterPlugPlayNotification(
1346 IN PVOID NotificationEntry);
1347
1348 NTKERNELAPI
1349 VOID
1350 NTAPI
1351 IoUnregisterShutdownNotification(
1352 IN PDEVICE_OBJECT DeviceObject);
1353
1354 NTKERNELAPI
1355 VOID
1356 NTAPI
1357 IoUpdateShareAccess(
1358 IN PFILE_OBJECT FileObject,
1359 IN OUT PSHARE_ACCESS ShareAccess);
1360
1361 NTKERNELAPI
1362 NTSTATUS
1363 NTAPI
1364 IoWMIAllocateInstanceIds(
1365 IN GUID *Guid,
1366 IN ULONG InstanceCount,
1367 OUT ULONG *FirstInstanceId);
1368
1369 NTKERNELAPI
1370 NTSTATUS
1371 NTAPI
1372 IoWMIQuerySingleInstanceMultiple(
1373 IN PVOID *DataBlockObjectList,
1374 IN PUNICODE_STRING InstanceNames,
1375 IN ULONG ObjectCount,
1376 IN OUT ULONG *InOutBufferSize,
1377 OUT PVOID OutBuffer);
1378
1379 NTKERNELAPI
1380 NTSTATUS
1381 NTAPI
1382 IoWMIRegistrationControl(
1383 IN PDEVICE_OBJECT DeviceObject,
1384 IN ULONG Action);
1385
1386 NTKERNELAPI
1387 NTSTATUS
1388 NTAPI
1389 IoWMISuggestInstanceName(
1390 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
1391 IN PUNICODE_STRING SymbolicLinkName OPTIONAL,
1392 IN BOOLEAN CombineNames,
1393 OUT PUNICODE_STRING SuggestedInstanceName);
1394
1395 NTKERNELAPI
1396 NTSTATUS
1397 NTAPI
1398 IoWMIWriteEvent(
1399 IN OUT PVOID WnodeEventItem);
1400
1401 NTKERNELAPI
1402 VOID
1403 NTAPI
1404 IoWriteErrorLogEntry(
1405 IN PVOID ElEntry);
1406
1407 NTKERNELAPI
1408 PIRP
1409 NTAPI
1410 IoGetTopLevelIrp(VOID);
1411
1412 NTKERNELAPI
1413 NTSTATUS
1414 NTAPI
1415 IoRegisterLastChanceShutdownNotification(
1416 IN PDEVICE_OBJECT DeviceObject);
1417
1418 NTKERNELAPI
1419 VOID
1420 NTAPI
1421 IoSetTopLevelIrp(
1422 IN PIRP Irp OPTIONAL);
1423
1424 $endif
1425 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
1426
1427 $if (_NTDDK_)
1428 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3)
1429
1430 NTKERNELAPI
1431 BOOLEAN
1432 NTAPI
1433 IoIsFileOriginRemote(
1434 IN PFILE_OBJECT FileObject);
1435
1436 NTKERNELAPI
1437 NTSTATUS
1438 NTAPI
1439 IoSetFileOrigin(
1440 IN PFILE_OBJECT FileObject,
1441 IN BOOLEAN Remote);
1442
1443 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP3) */
1444 $endif
1445
1446 #if (NTDDI_VERSION >= NTDDI_WINXP)
1447 $if (_NTDDK_)
1448 NTKERNELAPI
1449 NTSTATUS
1450 FASTCALL
1451 IoReadPartitionTable(
1452 IN PDEVICE_OBJECT DeviceObject,
1453 IN ULONG SectorSize,
1454 IN BOOLEAN ReturnRecognizedPartitions,
1455 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
1456
1457 NTKERNELAPI
1458 NTSTATUS
1459 FASTCALL
1460 IoSetPartitionInformation(
1461 IN PDEVICE_OBJECT DeviceObject,
1462 IN ULONG SectorSize,
1463 IN ULONG PartitionNumber,
1464 IN ULONG PartitionType);
1465
1466 NTKERNELAPI
1467 NTSTATUS
1468 FASTCALL
1469 IoWritePartitionTable(
1470 IN PDEVICE_OBJECT DeviceObject,
1471 IN ULONG SectorSize,
1472 IN ULONG SectorsPerTrack,
1473 IN ULONG NumberOfHeads,
1474 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
1475
1476 NTKERNELAPI
1477 NTSTATUS
1478 NTAPI
1479 IoCreateDisk(
1480 IN PDEVICE_OBJECT DeviceObject,
1481 IN struct _CREATE_DISK* Disk OPTIONAL);
1482
1483 NTKERNELAPI
1484 NTSTATUS
1485 NTAPI
1486 IoReadDiskSignature(
1487 IN PDEVICE_OBJECT DeviceObject,
1488 IN ULONG BytesPerSector,
1489 OUT PDISK_SIGNATURE Signature);
1490
1491 NTKERNELAPI
1492 NTSTATUS
1493 NTAPI
1494 IoReadPartitionTableEx(
1495 IN PDEVICE_OBJECT DeviceObject,
1496 OUT struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
1497
1498 NTKERNELAPI
1499 NTSTATUS
1500 NTAPI
1501 IoSetPartitionInformationEx(
1502 IN PDEVICE_OBJECT DeviceObject,
1503 IN ULONG PartitionNumber,
1504 IN struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
1505
1506 NTKERNELAPI
1507 NTSTATUS
1508 NTAPI
1509 IoSetSystemPartition(
1510 IN PUNICODE_STRING VolumeNameString);
1511
1512 NTKERNELAPI
1513 NTSTATUS
1514 NTAPI
1515 IoVerifyPartitionTable(
1516 IN PDEVICE_OBJECT DeviceObject,
1517 IN BOOLEAN FixErrors);
1518
1519 NTKERNELAPI
1520 NTSTATUS
1521 NTAPI
1522 IoVolumeDeviceToDosName(
1523 IN PVOID VolumeDeviceObject,
1524 OUT PUNICODE_STRING DosName);
1525
1526 NTKERNELAPI
1527 NTSTATUS
1528 NTAPI
1529 IoWritePartitionTableEx(
1530 IN PDEVICE_OBJECT DeviceObject,
1531 IN struct _DRIVE_LAYOUT_INFORMATION_EX *DriveLayout);
1532
1533 NTKERNELAPI
1534 NTSTATUS
1535 NTAPI
1536 IoCreateFileSpecifyDeviceObjectHint(
1537 OUT PHANDLE FileHandle,
1538 IN ACCESS_MASK DesiredAccess,
1539 IN POBJECT_ATTRIBUTES ObjectAttributes,
1540 OUT PIO_STATUS_BLOCK IoStatusBlock,
1541 IN PLARGE_INTEGER AllocationSize OPTIONAL,
1542 IN ULONG FileAttributes,
1543 IN ULONG ShareAccess,
1544 IN ULONG Disposition,
1545 IN ULONG CreateOptions,
1546 IN PVOID EaBuffer OPTIONAL,
1547 IN ULONG EaLength,
1548 IN CREATE_FILE_TYPE CreateFileType,
1549 IN PVOID InternalParameters OPTIONAL,
1550 IN ULONG Options,
1551 IN PVOID DeviceObject OPTIONAL);
1552
1553 NTKERNELAPI
1554 NTSTATUS
1555 NTAPI
1556 IoAttachDeviceToDeviceStackSafe(
1557 IN PDEVICE_OBJECT SourceDevice,
1558 IN PDEVICE_OBJECT TargetDevice,
1559 OUT PDEVICE_OBJECT *AttachedToDeviceObject);
1560 $endif
1561
1562 $if (_WDMDDK_)
1563 NTKERNELAPI
1564 NTSTATUS
1565 NTAPI
1566 IoCsqInitialize(
1567 IN PIO_CSQ Csq,
1568 IN PIO_CSQ_INSERT_IRP CsqInsertIrp,
1569 IN PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
1570 IN PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
1571 IN PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
1572 IN PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
1573 IN PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
1574
1575 NTKERNELAPI
1576 VOID
1577 NTAPI
1578 IoCsqInsertIrp(
1579 IN PIO_CSQ Csq,
1580 IN PIRP Irp,
1581 IN PIO_CSQ_IRP_CONTEXT Context OPTIONAL);
1582
1583 NTKERNELAPI
1584 PIRP
1585 NTAPI
1586 IoCsqRemoveIrp(
1587 IN PIO_CSQ Csq,
1588 IN PIO_CSQ_IRP_CONTEXT Context);
1589
1590 NTKERNELAPI
1591 PIRP
1592 NTAPI
1593 IoCsqRemoveNextIrp(
1594 IN PIO_CSQ Csq,
1595 IN PVOID PeekContext OPTIONAL);
1596
1597 NTKERNELAPI
1598 BOOLEAN
1599 NTAPI
1600 IoForwardIrpSynchronously(
1601 IN PDEVICE_OBJECT DeviceObject,
1602 IN PIRP Irp);
1603
1604 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
1605
1606 NTKERNELAPI
1607 VOID
1608 NTAPI
1609 IoFreeErrorLogEntry(
1610 PVOID ElEntry);
1611
1612 NTKERNELAPI
1613 NTSTATUS
1614 NTAPI
1615 IoSetCompletionRoutineEx(
1616 IN PDEVICE_OBJECT DeviceObject,
1617 IN PIRP Irp,
1618 IN PIO_COMPLETION_ROUTINE CompletionRoutine,
1619 IN PVOID Context,
1620 IN BOOLEAN InvokeOnSuccess,
1621 IN BOOLEAN InvokeOnError,
1622 IN BOOLEAN InvokeOnCancel);
1623
1624 VOID
1625 NTAPI
1626 IoSetStartIoAttributes(
1627 IN PDEVICE_OBJECT DeviceObject,
1628 IN BOOLEAN DeferredStartIo,
1629 IN BOOLEAN NonCancelable);
1630
1631 NTKERNELAPI
1632 NTSTATUS
1633 NTAPI
1634 IoWMIDeviceObjectToInstanceName(
1635 IN PVOID DataBlockObject,
1636 IN PDEVICE_OBJECT DeviceObject,
1637 OUT PUNICODE_STRING InstanceName);
1638
1639 NTKERNELAPI
1640 NTSTATUS
1641 NTAPI
1642 IoWMIExecuteMethod(
1643 IN PVOID DataBlockObject,
1644 IN PUNICODE_STRING InstanceName,
1645 IN ULONG MethodId,
1646 IN ULONG InBufferSize,
1647 IN OUT PULONG OutBufferSize,
1648 IN OUT PUCHAR InOutBuffer);
1649
1650 NTKERNELAPI
1651 NTSTATUS
1652 NTAPI
1653 IoWMIHandleToInstanceName(
1654 IN PVOID DataBlockObject,
1655 IN HANDLE FileHandle,
1656 OUT PUNICODE_STRING InstanceName);
1657
1658 NTKERNELAPI
1659 NTSTATUS
1660 NTAPI
1661 IoWMIOpenBlock(
1662 IN GUID *DataBlockGuid,
1663 IN ULONG DesiredAccess,
1664 OUT PVOID *DataBlockObject);
1665
1666 NTKERNELAPI
1667 NTSTATUS
1668 NTAPI
1669 IoWMIQueryAllData(
1670 IN PVOID DataBlockObject,
1671 IN OUT ULONG *InOutBufferSize,
1672 OUT PVOID OutBuffer);
1673
1674 NTKERNELAPI
1675 NTSTATUS
1676 NTAPI
1677 IoWMIQueryAllDataMultiple(
1678 IN PVOID *DataBlockObjectList,
1679 IN ULONG ObjectCount,
1680 IN OUT ULONG *InOutBufferSize,
1681 OUT PVOID OutBuffer);
1682
1683 NTKERNELAPI
1684 NTSTATUS
1685 NTAPI
1686 IoWMIQuerySingleInstance(
1687 IN PVOID DataBlockObject,
1688 IN PUNICODE_STRING InstanceName,
1689 IN OUT ULONG *InOutBufferSize,
1690 OUT PVOID OutBuffer);
1691
1692 NTKERNELAPI
1693 NTSTATUS
1694 NTAPI
1695 IoWMISetNotificationCallback(
1696 IN OUT PVOID Object,
1697 IN WMI_NOTIFICATION_CALLBACK Callback,
1698 IN PVOID Context OPTIONAL);
1699
1700 NTKERNELAPI
1701 NTSTATUS
1702 NTAPI
1703 IoWMISetSingleInstance(
1704 IN PVOID DataBlockObject,
1705 IN PUNICODE_STRING InstanceName,
1706 IN ULONG Version,
1707 IN ULONG ValueBufferSize,
1708 IN PVOID ValueBuffer);
1709
1710 NTKERNELAPI
1711 NTSTATUS
1712 NTAPI
1713 IoWMISetSingleItem(
1714 IN PVOID DataBlockObject,
1715 IN PUNICODE_STRING InstanceName,
1716 IN ULONG DataItemId,
1717 IN ULONG Version,
1718 IN ULONG ValueBufferSize,
1719 IN PVOID ValueBuffer);
1720 $endif
1721 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
1722
1723 $if (_WDMDDK_)
1724 #if (NTDDI_VERSION >= NTDDI_WINXPSP1)
1725 NTKERNELAPI
1726 NTSTATUS
1727 NTAPI
1728 IoValidateDeviceIoControlAccess(
1729 IN PIRP Irp,
1730 IN ULONG RequiredAccess);
1731 #endif
1732 $endif
1733
1734 #if (NTDDI_VERSION >= NTDDI_WS03)
1735 $if (_NTDDK_)
1736 NTKERNELAPI
1737 IO_PAGING_PRIORITY
1738 FASTCALL
1739 IoGetPagingIoPriority(
1740 IN PIRP Irp);
1741 $endif
1742
1743 $if (_WDMDDK_)
1744 NTKERNELAPI
1745 NTSTATUS
1746 NTAPI
1747 IoCsqInitializeEx(
1748 IN PIO_CSQ Csq,
1749 IN PIO_CSQ_INSERT_IRP_EX CsqInsertIrp,
1750 IN PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
1751 IN PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
1752 IN PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
1753 IN PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
1754 IN PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
1755
1756 NTKERNELAPI
1757 NTSTATUS
1758 NTAPI
1759 IoCsqInsertIrpEx(
1760 IN PIO_CSQ Csq,
1761 IN PIRP Irp,
1762 IN PIO_CSQ_IRP_CONTEXT Context OPTIONAL,
1763 IN PVOID InsertContext OPTIONAL);
1764 $endif
1765 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
1766
1767 $if (_NTDDK_)
1768 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
1769 BOOLEAN
1770 NTAPI
1771 IoTranslateBusAddress(
1772 IN INTERFACE_TYPE InterfaceType,
1773 IN ULONG BusNumber,
1774 IN PHYSICAL_ADDRESS BusAddress,
1775 IN OUT PULONG AddressSpace,
1776 OUT PPHYSICAL_ADDRESS TranslatedAddress);
1777 #endif
1778 $endif
1779
1780 #if (NTDDI_VERSION >= NTDDI_VISTA)
1781 $if (_NTDDK_)
1782 NTKERNELAPI
1783 NTSTATUS
1784 NTAPI
1785 IoUpdateDiskGeometry(
1786 IN PDEVICE_OBJECT DeviceObject,
1787 IN struct _DISK_GEOMETRY_EX* OldDiskGeometry,
1788 IN struct _DISK_GEOMETRY_EX* NewDiskGeometry);
1789
1790 PTXN_PARAMETER_BLOCK
1791 NTAPI
1792 IoGetTransactionParameterBlock(
1793 IN PFILE_OBJECT FileObject);
1794
1795 NTKERNELAPI
1796 NTSTATUS
1797 NTAPI
1798 IoCreateFileEx(
1799 OUT PHANDLE FileHandle,
1800 IN ACCESS_MASK DesiredAccess,
1801 IN POBJECT_ATTRIBUTES ObjectAttributes,
1802 OUT PIO_STATUS_BLOCK IoStatusBlock,
1803 IN PLARGE_INTEGER AllocationSize OPTIONAL,
1804 IN ULONG FileAttributes,
1805 IN ULONG ShareAccess,
1806 IN ULONG Disposition,
1807 IN ULONG CreateOptions,
1808 IN PVOID EaBuffer OPTIONAL,
1809 IN ULONG EaLength,
1810 IN CREATE_FILE_TYPE CreateFileType,
1811 IN PVOID InternalParameters OPTIONAL,
1812 IN ULONG Options,
1813 IN PIO_DRIVER_CREATE_CONTEXT DriverContext OPTIONAL);
1814
1815 NTSTATUS
1816 NTAPI
1817 IoSetIrpExtraCreateParameter(
1818 IN OUT PIRP Irp,
1819 IN struct _ECP_LIST *ExtraCreateParameter);
1820
1821 VOID
1822 NTAPI
1823 IoClearIrpExtraCreateParameter(
1824 IN OUT PIRP Irp);
1825
1826 NTSTATUS
1827 NTAPI
1828 IoGetIrpExtraCreateParameter(
1829 IN PIRP Irp,
1830 OUT struct _ECP_LIST **ExtraCreateParameter OPTIONAL);
1831
1832 BOOLEAN
1833 NTAPI
1834 IoIsFileObjectIgnoringSharing(
1835 IN PFILE_OBJECT FileObject);
1836 $endif
1837
1838 $if (_WDMDDK_)
1839 NTKERNELAPI
1840 NTSTATUS
1841 NTAPI
1842 IoGetBootDiskInformationLite(
1843 OUT PBOOTDISK_INFORMATION_LITE *BootDiskInformation);
1844
1845 NTKERNELAPI
1846 NTSTATUS
1847 NTAPI
1848 IoCheckShareAccessEx(
1849 IN ACCESS_MASK DesiredAccess,
1850 IN ULONG DesiredShareAccess,
1851 IN OUT PFILE_OBJECT FileObject,
1852 IN OUT PSHARE_ACCESS ShareAccess,
1853 IN BOOLEAN Update,
1854 IN PBOOLEAN WritePermission);
1855
1856 NTKERNELAPI
1857 NTSTATUS
1858 NTAPI
1859 IoConnectInterruptEx(
1860 IN OUT PIO_CONNECT_INTERRUPT_PARAMETERS Parameters);
1861
1862 NTKERNELAPI
1863 VOID
1864 NTAPI
1865 IoDisconnectInterruptEx(
1866 IN PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters);
1867
1868 LOGICAL
1869 NTAPI
1870 IoWithinStackLimits(
1871 IN ULONG_PTR RegionStart,
1872 IN SIZE_T RegionSize);
1873
1874 NTKERNELAPI
1875 VOID
1876 NTAPI
1877 IoSetShareAccessEx(
1878 IN ACCESS_MASK DesiredAccess,
1879 IN ULONG DesiredShareAccess,
1880 IN OUT PFILE_OBJECT FileObject,
1881 OUT PSHARE_ACCESS ShareAccess,
1882 IN PBOOLEAN WritePermission);
1883
1884 ULONG
1885 NTAPI
1886 IoSizeofWorkItem(VOID);
1887
1888 VOID
1889 NTAPI
1890 IoInitializeWorkItem(
1891 IN PVOID IoObject,
1892 IN PIO_WORKITEM IoWorkItem);
1893
1894 VOID
1895 NTAPI
1896 IoUninitializeWorkItem(
1897 IN PIO_WORKITEM IoWorkItem);
1898
1899 VOID
1900 NTAPI
1901 IoQueueWorkItemEx(
1902 IN PIO_WORKITEM IoWorkItem,
1903 IN PIO_WORKITEM_ROUTINE_EX WorkerRoutine,
1904 IN WORK_QUEUE_TYPE QueueType,
1905 IN PVOID Context OPTIONAL);
1906
1907 IO_PRIORITY_HINT
1908 NTAPI
1909 IoGetIoPriorityHint(
1910 IN PIRP Irp);
1911
1912 NTSTATUS
1913 NTAPI
1914 IoSetIoPriorityHint(
1915 IN PIRP Irp,
1916 IN IO_PRIORITY_HINT PriorityHint);
1917
1918 NTSTATUS
1919 NTAPI
1920 IoAllocateSfioStreamIdentifier(
1921 IN PFILE_OBJECT FileObject,
1922 IN ULONG Length,
1923 IN PVOID Signature,
1924 OUT PVOID *StreamIdentifier);
1925
1926 PVOID
1927 NTAPI
1928 IoGetSfioStreamIdentifier(
1929 IN PFILE_OBJECT FileObject,
1930 IN PVOID Signature);
1931
1932 NTSTATUS
1933 NTAPI
1934 IoFreeSfioStreamIdentifier(
1935 IN PFILE_OBJECT FileObject,
1936 IN PVOID Signature);
1937
1938 NTKERNELAPI
1939 NTSTATUS
1940 NTAPI
1941 IoRequestDeviceEjectEx(
1942 IN PDEVICE_OBJECT PhysicalDeviceObject,
1943 IN PIO_DEVICE_EJECT_CALLBACK Callback OPTIONAL,
1944 IN PVOID Context OPTIONAL,
1945 IN PDRIVER_OBJECT DriverObject OPTIONAL);
1946
1947 NTKERNELAPI
1948 NTSTATUS
1949 NTAPI
1950 IoSetDevicePropertyData(
1951 IN PDEVICE_OBJECT Pdo,
1952 IN CONST DEVPROPKEY *PropertyKey,
1953 IN LCID Lcid,
1954 IN ULONG Flags,
1955 IN DEVPROPTYPE Type,
1956 IN ULONG Size,
1957 IN PVOID Data OPTIONAL);
1958
1959 NTKERNELAPI
1960 NTSTATUS
1961 NTAPI
1962 IoGetDevicePropertyData(
1963 PDEVICE_OBJECT Pdo,
1964 CONST DEVPROPKEY *PropertyKey,
1965 LCID Lcid,
1966 ULONG Flags,
1967 ULONG Size,
1968 PVOID Data,
1969 PULONG RequiredSize,
1970 PDEVPROPTYPE Type);
1971 $endif
1972
1973 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1974
1975 $if (_WDMDDK_)
1976 #define IoCallDriverStackSafeDefault(a, b) IoCallDriver(a, b)
1977
1978 #if (NTDDI_VERSION >= NTDDI_WS08)
1979 NTKERNELAPI
1980 NTSTATUS
1981 NTAPI
1982 IoReplacePartitionUnit(
1983 IN PDEVICE_OBJECT TargetPdo,
1984 IN PDEVICE_OBJECT SparePdo,
1985 IN ULONG Flags);
1986 #endif
1987 $endif
1988
1989 #if (NTDDI_VERSION >= NTDDI_WIN7)
1990 $if (_NTDDK_)
1991 NTSTATUS
1992 NTAPI
1993 IoSetFileObjectIgnoreSharing(
1994 IN PFILE_OBJECT FileObject);
1995 $endif
1996
1997 $if (_WDMDDK_)
1998 NTKERNELAPI
1999 NTSTATUS
2000 NTAPI
2001 IoGetAffinityInterrupt(
2002 IN PKINTERRUPT InterruptObject,
2003 OUT PGROUP_AFFINITY GroupAffinity);
2004
2005 NTSTATUS
2006 NTAPI
2007 IoGetContainerInformation(
2008 IN IO_CONTAINER_INFORMATION_CLASS InformationClass,
2009 IN PVOID ContainerObject OPTIONAL,
2010 IN OUT PVOID Buffer OPTIONAL,
2011 IN ULONG BufferLength);
2012
2013 NTSTATUS
2014 NTAPI
2015 IoRegisterContainerNotification(
2016 IN IO_CONTAINER_NOTIFICATION_CLASS NotificationClass,
2017 IN PIO_CONTAINER_NOTIFICATION_FUNCTION CallbackFunction,
2018 IN PVOID NotificationInformation OPTIONAL,
2019 IN ULONG NotificationInformationLength,
2020 OUT PVOID CallbackRegistration);
2021
2022 VOID
2023 NTAPI
2024 IoUnregisterContainerNotification(
2025 IN PVOID CallbackRegistration);
2026
2027 NTKERNELAPI
2028 NTSTATUS
2029 NTAPI
2030 IoUnregisterPlugPlayNotificationEx(
2031 IN PVOID NotificationEntry);
2032
2033 NTKERNELAPI
2034 NTSTATUS
2035 NTAPI
2036 IoGetDeviceNumaNode(
2037 IN PDEVICE_OBJECT Pdo,
2038 OUT PUSHORT NodeNumber);
2039 $endif
2040
2041 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
2042
2043 $if (_WDMDDK_)
2044 #if defined(_WIN64)
2045 NTKERNELAPI
2046 ULONG
2047 NTAPI
2048 IoWMIDeviceObjectToProviderId(
2049 IN PDEVICE_OBJECT DeviceObject);
2050 #else
2051 #define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject))
2052 #endif
2053
2054 /*
2055 * USHORT
2056 * IoSizeOfIrp(
2057 * IN CCHAR StackSize)
2058 */
2059 #define IoSizeOfIrp(_StackSize) \
2060 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
2061
2062 FORCEINLINE
2063 VOID
2064 IoSkipCurrentIrpStackLocation(
2065 IN OUT PIRP Irp)
2066 {
2067 ASSERT(Irp->CurrentLocation <= Irp->StackCount);
2068 Irp->CurrentLocation++;
2069 Irp->Tail.Overlay.CurrentStackLocation++;
2070 }
2071
2072 FORCEINLINE
2073 VOID
2074 IoSetNextIrpStackLocation(
2075 IN OUT PIRP Irp)
2076 {
2077 ASSERT(Irp->CurrentLocation > 0);
2078 Irp->CurrentLocation--;
2079 Irp->Tail.Overlay.CurrentStackLocation--;
2080 }
2081
2082 FORCEINLINE
2083 PIO_STACK_LOCATION
2084 IoGetNextIrpStackLocation(
2085 IN PIRP Irp)
2086 {
2087 ASSERT(Irp->CurrentLocation > 0);
2088 return ((Irp)->Tail.Overlay.CurrentStackLocation - 1 );
2089 }
2090
2091 FORCEINLINE
2092 VOID
2093 IoSetCompletionRoutine(
2094 IN PIRP Irp,
2095 IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
2096 IN PVOID Context OPTIONAL,
2097 IN BOOLEAN InvokeOnSuccess,
2098 IN BOOLEAN InvokeOnError,
2099 IN BOOLEAN InvokeOnCancel)
2100 {
2101 PIO_STACK_LOCATION irpSp;
2102 ASSERT( (InvokeOnSuccess || InvokeOnError || InvokeOnCancel) ? (CompletionRoutine != NULL) : TRUE );
2103 irpSp = IoGetNextIrpStackLocation(Irp);
2104 irpSp->CompletionRoutine = CompletionRoutine;
2105 irpSp->Context = Context;
2106 irpSp->Control = 0;
2107
2108 if (InvokeOnSuccess) {
2109 irpSp->Control = SL_INVOKE_ON_SUCCESS;
2110 }
2111
2112 if (InvokeOnError) {
2113 irpSp->Control |= SL_INVOKE_ON_ERROR;
2114 }
2115
2116 if (InvokeOnCancel) {
2117 irpSp->Control |= SL_INVOKE_ON_CANCEL;
2118 }
2119 }
2120
2121 /*
2122 * PDRIVER_CANCEL
2123 * IoSetCancelRoutine(
2124 * IN PIRP Irp,
2125 * IN PDRIVER_CANCEL CancelRoutine)
2126 */
2127 #define IoSetCancelRoutine(_Irp, \
2128 _CancelRoutine) \
2129 ((PDRIVER_CANCEL) (ULONG_PTR) InterlockedExchangePointer( \
2130 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (ULONG_PTR) (_CancelRoutine)))
2131
2132 /*
2133 * VOID
2134 * IoRequestDpc(
2135 * IN PDEVICE_OBJECT DeviceObject,
2136 * IN PIRP Irp,
2137 * IN PVOID Context);
2138 */
2139 #define IoRequestDpc(DeviceObject, Irp, Context)( \
2140 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
2141
2142 /*
2143 * VOID
2144 * IoReleaseRemoveLock(
2145 * IN PIO_REMOVE_LOCK RemoveLock,
2146 * IN PVOID Tag)
2147 */
2148 #define IoReleaseRemoveLock(_RemoveLock, \
2149 _Tag) \
2150 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2151
2152 /*
2153 * VOID
2154 * IoReleaseRemoveLockAndWait(
2155 * IN PIO_REMOVE_LOCK RemoveLock,
2156 * IN PVOID Tag)
2157 */
2158 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
2159 _Tag) \
2160 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
2161
2162 #if defined(_WIN64)
2163 NTKERNELAPI
2164 BOOLEAN
2165 IoIs32bitProcess(
2166 IN PIRP Irp OPTIONAL);
2167 #endif
2168
2169 #define PLUGPLAY_REGKEY_DEVICE 1
2170 #define PLUGPLAY_REGKEY_DRIVER 2
2171 #define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4
2172
2173 FORCEINLINE
2174 PIO_STACK_LOCATION
2175 IoGetCurrentIrpStackLocation(
2176 IN PIRP Irp)
2177 {
2178 ASSERT(Irp->CurrentLocation <= Irp->StackCount + 1);
2179 return Irp->Tail.Overlay.CurrentStackLocation;
2180 }
2181
2182 FORCEINLINE
2183 VOID
2184 IoMarkIrpPending(
2185 IN OUT PIRP Irp)
2186 {
2187 IoGetCurrentIrpStackLocation( (Irp) )->Control |= SL_PENDING_RETURNED;
2188 }
2189
2190 /*
2191 * BOOLEAN
2192 * IoIsErrorUserInduced(
2193 * IN NTSTATUS Status);
2194 */
2195 #define IoIsErrorUserInduced(Status) \
2196 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
2197 ((Status) == STATUS_IO_TIMEOUT) || \
2198 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
2199 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
2200 ((Status) == STATUS_VERIFY_REQUIRED) || \
2201 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
2202 ((Status) == STATUS_WRONG_VOLUME)))
2203
2204 /* VOID
2205 * IoInitializeRemoveLock(
2206 * IN PIO_REMOVE_LOCK Lock,
2207 * IN ULONG AllocateTag,
2208 * IN ULONG MaxLockedMinutes,
2209 * IN ULONG HighWatermark)
2210 */
2211 #define IoInitializeRemoveLock( \
2212 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
2213 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
2214 HighWatermark, sizeof(IO_REMOVE_LOCK))
2215
2216 VOID
2217 FORCEINLINE
2218 IoInitializeDpcRequest(
2219 IN PDEVICE_OBJECT DeviceObject,
2220 IN PIO_DPC_ROUTINE DpcRoutine)
2221 {
2222 KeInitializeDpc( &DeviceObject->Dpc,
2223 (PKDEFERRED_ROUTINE) DpcRoutine,
2224 DeviceObject );
2225 }
2226
2227 #define DEVICE_INTERFACE_INCLUDE_NONACTIVE 0x00000001
2228
2229 /*
2230 * ULONG
2231 * IoGetFunctionCodeFromCtlCode(
2232 * IN ULONG ControlCode)
2233 */
2234 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
2235 (((_ControlCode) >> 2) & 0x00000FFF)
2236
2237 FORCEINLINE
2238 VOID
2239 IoCopyCurrentIrpStackLocationToNext(
2240 IN OUT PIRP Irp)
2241 {
2242 PIO_STACK_LOCATION irpSp;
2243 PIO_STACK_LOCATION nextIrpSp;
2244 irpSp = IoGetCurrentIrpStackLocation(Irp);
2245 nextIrpSp = IoGetNextIrpStackLocation(Irp);
2246 RtlCopyMemory( nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine));
2247 nextIrpSp->Control = 0;
2248 }
2249
2250 NTKERNELAPI
2251 VOID
2252 NTAPI
2253 IoGetStackLimits(
2254 OUT PULONG_PTR LowLimit,
2255 OUT PULONG_PTR HighLimit);
2256
2257 FORCEINLINE
2258 ULONG_PTR
2259 IoGetRemainingStackSize(VOID)
2260 {
2261 ULONG_PTR End, Begin;
2262 ULONG_PTR Result;
2263
2264 IoGetStackLimits(&Begin, &End);
2265 Result = (ULONG_PTR)(&End) - Begin;
2266 return Result;
2267 }
2268
2269 #if (NTDDI_VERSION >= NTDDI_WS03)
2270 VOID
2271 FORCEINLINE
2272 IoInitializeThreadedDpcRequest(
2273 IN PDEVICE_OBJECT DeviceObject,
2274 IN PIO_DPC_ROUTINE DpcRoutine)
2275 {
2276 KeInitializeThreadedDpc(&DeviceObject->Dpc,
2277 (PKDEFERRED_ROUTINE) DpcRoutine,
2278 DeviceObject );
2279 }
2280 #endif
2281 $endif
2282