Enumerate legacy devices
[reactos.git] / reactos / include / ddk / iofuncs.h
1 #ifndef _INCLUDE_DDK_IOFUNCS_H
2 #define _INCLUDE_DDK_IOFUNCS_H
3 /* $Id: iofuncs.h,v 1.26 2001/09/16 13:19:31 chorns Exp $ */
4
5 /* --- EXPORTED BY NTOSKRNL --- */
6
7 /**********************************************************************
8 * NAME EXPORTED
9 * IoAcquireCancelSpinLock@4
10 *
11 * DESCRIPTION
12 * Synchronizes cancelable-state transistions for IRPs in a
13 * multiprocessor-safe way.
14 *
15 * ARGUMENTS
16 * Irpl
17 * Variable to store the current IRQ level.
18 *
19 * RETURN VALUE
20 * None.
21 *
22 * REVISIONS
23 *
24 */
25 VOID
26 STDCALL
27 IoAcquireCancelSpinLock (
28 PKIRQL Irpl
29 );
30 VOID
31 STDCALL
32 IoAcquireVpbSpinLock (
33 PKIRQL Irpl
34 );
35 /**********************************************************************
36 * NAME EXPORTED
37 * IoAllocateAdapterChannel@
38 *
39 * DESCRIPTION
40 * Allocates an adaptor object for a DMA operation on the target
41 * device.
42 *
43 * ARGUMENTS
44 * Adaptor
45 * Adapter channel or busmaster adapter to be allocated;
46 *
47 * DeviceObject
48 * Target device for DMA;
49 *
50 * NumberOfMapRegisters
51 * Number of map registers;
52 *
53 * ExecutionRoutine
54 * Routine to be called when the adaptor is available;
55 *
56 * Context
57 * Driver defined contex that will be passed to the
58 * execution routine.
59 *
60 * RETURN VALUE
61 * Success or failure code.
62 *
63 * REVISIONS
64 *
65 */
66 NTSTATUS
67 STDCALL
68 IoAllocateAdapterChannel (
69 PADAPTER_OBJECT AdaperObject,
70 PDEVICE_OBJECT DeviceObject,
71 ULONG NumberOfMapRegisters,
72 PDRIVER_CONTROL ExecutionRoutine,
73 PVOID Context
74 );
75 /**********************************************************************
76 * NAME EXPORTED
77 * IoAllocateController@16
78 *
79 * DESCRIPTION
80 * Sets up a call to a driver supplied controller object as
81 * soon as it is available.
82 *
83 * ARGUMENTS
84 * ControllerObject
85 * Driver created controller object;
86 *
87 * DeviceObject
88 * Target device;
89 *
90 * ExecutionObject
91 * Routine to be called;
92 *
93 * Context
94 * Driver determined context to be based to the
95 * routine.
96 *
97 * RETURN VALUE
98 * None.
99 *
100 * REVISIONS
101 *
102 */
103 VOID
104 STDCALL
105 IoAllocateController (
106 PCONTROLLER_OBJECT ControllerObject,
107 PDEVICE_OBJECT DeviceObject,
108 PDRIVER_CONTROL ExecutionRoutine,
109 PVOID Context
110 );
111 /**********************************************************************
112 * NAME EXPORTED
113 * IoAllocateErrorLogEntry@8
114 *
115 * DESCRIPTION
116 * Allocates an error log packet.
117 *
118 * ARGUMENTS
119 * IoObject
120 * Object which found the error;
121 *
122 * EntrySize
123 * Size in bytes of the packet to be allocated.
124 *
125 * RETURN VALUE
126 * On success, a pointer to the allocated packet.
127 * On failure, it returns NULL.
128 */
129 PVOID
130 STDCALL
131 IoAllocateErrorLogEntry (
132 PVOID IoObject,
133 UCHAR EntrySize
134 );
135 /**********************************************************************
136 * NAME EXPORTED
137 * IoAllocateIrp@8
138 *
139 * DESCRIPTION
140 * Allocates an IRP.
141 *
142 * ARGUMENTS
143 * StackSize
144 * Number of stack locations to allocate;
145 *
146 * ChargeQuota
147 * Who knows.
148 *
149 * RETURN VALUE
150 * On success, the allocated IRP. On failure, NULL.
151 */
152 PIRP
153 STDCALL
154 IoAllocateIrp (
155 CCHAR StackSize,
156 BOOLEAN ChargeQuota
157 );
158 /**********************************************************************
159 * NAME EXPORTED
160 * IoAllocateMdl@20
161 *
162 * DESCRIPTION
163 * Allocates an MDL large enough to map the supplied buffer.
164 *
165 * ARGUMENTS
166 * VirtualAddress
167 * Base virtual address of the buffer to be mapped;
168 *
169 * Length
170 * Length of the buffer to be mapped;
171 *
172 * SecondaryBuffer
173 * Whether the buffer is primary or secondary;
174 *
175 * ChargeQuota
176 * Charge non-paged pool quota to current thread;
177 *
178 * Irp
179 * Optional irp to be associated with the MDL.
180 *
181 * RETURN VALUE
182 * On success, the allocated MDL; on failure, NULL.
183 */
184 PMDL
185 STDCALL
186 IoAllocateMdl (
187 PVOID VirtualAddress,
188 ULONG Length,
189 BOOLEAN SecondaryBuffer,
190 BOOLEAN ChargeQuota,
191 PIRP Irp
192 );
193
194 /**********************************************************************
195 * NAME MACRO
196 * IoAssignArcName
197 *
198 * DESCRIPTION
199 * Creates a symbolic link between the ARC name of a physical
200 * device and the name of the corresponding device object
201 *
202 * ARGUMENTS
203 * ArcName
204 * ARC name of the device
205 *
206 * DeviceName
207 * Name of the device object
208 *
209 * NOTES
210 * VOID
211 * IoAssignArcName (
212 * PUNICODE_STRING ArcName,
213 * PUNICODE_STRING DeviceName
214 * );
215 */
216 #define IoAssignArcName(ArcName,DeviceName) \
217 (IoCreateSymbolicLink((ArcName),(DeviceName)))
218
219 /**********************************************************************
220 * NAME EXPORTED
221 * IoAssignResources@24
222 *
223 * DESCRIPTION
224 * Takes a list of requested hardware resources and allocates
225 * them.
226 *
227 * ARGUMENTS
228 * RegisterPath
229 * ?
230 *
231 * DriverClassName
232 * ?
233 *
234 * DriverObject
235 * Driver object passed to the DriverEntry routine;
236 *
237 * DeviceObject
238 * ?
239 *
240 * RequestedResources
241 * List of resources.
242 *
243 * RETURN VALUE
244 */
245 NTSTATUS
246 STDCALL
247 IoAssignResources (
248 PUNICODE_STRING RegistryPath,
249 PUNICODE_STRING DriverClassName,
250 PDRIVER_OBJECT DriverObject,
251 PDEVICE_OBJECT DeviceObject,
252 PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
253 PCM_RESOURCE_LIST * AllocatedResources
254 );
255 /*
256 * FUNCTION: Attaches the callers device object to a named target device
257 * ARGUMENTS:
258 * SourceDevice = caller's device
259 * TargetDevice = Name of the target device
260 * AttachedDevice = Caller allocated storage. On return contains
261 * a pointer to the target device
262 * RETURNS: Success or failure code
263 */
264 NTSTATUS
265 STDCALL
266 IoAttachDevice (
267 PDEVICE_OBJECT SourceDevice,
268 PUNICODE_STRING TargetDevice,
269 PDEVICE_OBJECT * AttachedDevice
270 );
271 /*
272 * FUNCTION: Obsolete
273 * ARGUMENTS:
274 * SourceDevice = device to attach
275 * TargetDevice = device to be attached to
276 * RETURNS: Success or failure code
277 */
278 NTSTATUS
279 STDCALL
280 IoAttachDeviceByPointer (
281 PDEVICE_OBJECT SourceDevice,
282 PDEVICE_OBJECT TargetDevice
283 );
284 /*
285 * FUNCTION: Attaches the callers device to the highest device in the chain
286 * ARGUMENTS:
287 * SourceDevice = caller's device
288 * TargetDevice = Device to attach
289 * RETURNS: On success the previously highest device
290 * On failure NULL
291 */
292 PDEVICE_OBJECT
293 STDCALL
294 IoAttachDeviceToDeviceStack (
295 PDEVICE_OBJECT SourceDevice,
296 PDEVICE_OBJECT TargetDevice
297 );
298 /*
299 * FUNCTION: Builds a irp to be sent to lower level drivers
300 * ARGUMENTS:
301 * MajorFunction = Major function code to be set in the IRP
302 * DeviceObject = Next lower device object
303 * Buffer = Buffer (only required for some major function codes)
304 * Length = Length in bytes of the buffer
305 * StartingOffset = Starting offset on the target device
306 * IoStatusBlock = Storage for status about the operation (optional)
307 * RETURNS: On success the IRP allocated
308 * On failure NULL
309 */
310 PIRP
311 STDCALL
312 IoBuildAsynchronousFsdRequest (
313 ULONG MajorFunction,
314 PDEVICE_OBJECT DeviceObject,
315 PVOID Buffer,
316 ULONG Length,
317 PLARGE_INTEGER StartingOffset,
318 PIO_STATUS_BLOCK IoStatusBlock
319 );
320 /*
321 * FUNCTION: Allocates and sets up an IRP for a device control request
322 * ARGUMENTS:
323 * IoControlCode = Type of request
324 * DeviceObject = Target device
325 * InputBuffer = Optional input buffer to the driver
326 * InputBufferLength = Length of the input buffer
327 * OutputBuffer = Optional output buffer
328 * OutputBufferLength = Length of the output buffer
329 * InternalDeviceIoControl = TRUE if the request is internal
330 * Event = Initialized event for the caller to wait for the request
331 * to be completed
332 * IoStatusBlock = I/O status block to be set when the request is
333 * completed
334 * RETURNS: Returns the IRP created
335 */
336 PIRP
337 STDCALL
338 IoBuildDeviceIoControlRequest (
339 ULONG IoControlCode,
340 PDEVICE_OBJECT DeviceObject,
341 PVOID InputBuffer,
342 ULONG InputBufferLength,
343 PVOID OutputBuffer,
344 ULONG OutputBufferLength,
345 BOOLEAN InternalDeviceIoControl,
346 PKEVENT Event,
347 PIO_STATUS_BLOCK IoStatusBlock
348 );
349 VOID
350 STDCALL
351 IoBuildPartialMdl (
352 PMDL SourceMdl,
353 PMDL TargetMdl,
354 PVOID VirtualAddress,
355 ULONG Length
356 );
357 PIRP
358 STDCALL
359 IoBuildSynchronousFsdRequest (
360 ULONG MajorFunction,
361 PDEVICE_OBJECT DeviceObject,
362 PVOID Buffer,
363 ULONG Length,
364 PLARGE_INTEGER StartingOffset,
365 PKEVENT Event,
366 PIO_STATUS_BLOCK IoStatusBlock
367 );
368 NTSTATUS
369 STDCALL
370 IoCallDriver (
371 PDEVICE_OBJECT DeviceObject,
372 PIRP Irp
373 );
374 BOOLEAN
375 STDCALL
376 IoCancelIrp (
377 PIRP Irp
378 );
379 VOID
380 STDCALL
381 IoCheckDesiredAccess (
382 DWORD Unknown0,
383 DWORD Unknown1
384 );
385 NTSTATUS
386 STDCALL
387 IoCheckEaBufferValidity (
388 DWORD Unknown0,
389 DWORD Unknown1,
390 DWORD Unknown2
391 );
392 NTSTATUS
393 STDCALL
394 IoCheckFunctionAccess (
395 DWORD Unknown0,
396 DWORD Unknown1,
397 DWORD Unknown2,
398 DWORD Unknown3,
399 DWORD Unknown4,
400 DWORD Unknown5
401 );
402 NTSTATUS
403 STDCALL
404 IoCheckShareAccess (
405 ACCESS_MASK DesiredAccess,
406 ULONG DesiredShareAccess,
407 PFILE_OBJECT FileObject,
408 PSHARE_ACCESS ShareAccess,
409 BOOLEAN Update
410 );
411 VOID
412 STDCALL
413 IoCompleteRequest (
414 PIRP Irp,
415 CCHAR PriorityBoost
416 );
417 NTSTATUS
418 STDCALL
419 IoConnectInterrupt (
420 PKINTERRUPT * InterruptObject,
421 PKSERVICE_ROUTINE ServiceRoutine,
422 PVOID ServiceContext,
423 PKSPIN_LOCK SpinLock,
424 ULONG Vector,
425 KIRQL Irql,
426 KIRQL SynchronizeIrql,
427 KINTERRUPT_MODE InterruptMode,
428 BOOLEAN ShareVector,
429 KAFFINITY ProcessorEnableMask,
430 BOOLEAN FloatingSave
431 );
432
433 PCONTROLLER_OBJECT
434 STDCALL
435 IoCreateController (
436 ULONG Size
437 );
438 /*
439 * FUNCTION: Allocates memory for and intializes a device object for use for
440 * a driver
441 * ARGUMENTS:
442 * DriverObject : Driver object passed by iomgr when the driver was
443 * loaded
444 * DeviceExtensionSize : Number of bytes for the device extension
445 * DeviceName : Unicode name of device
446 * DeviceType : Device type
447 * DeviceCharacteristics : Bit mask of device characteristics
448 * Exclusive : True if only one thread can access the device at a
449 * time
450 * RETURNS:
451 * Success or failure
452 * DeviceObject : Contains a pointer to allocated device object
453 * if the call succeeded
454 * NOTES: See the DDK documentation for more information
455 */
456 NTSTATUS
457 STDCALL
458 IoCreateDevice (
459 PDRIVER_OBJECT DriverObject,
460 ULONG DeviceExtensionSize,
461 PUNICODE_STRING DeviceName,
462 DEVICE_TYPE DeviceType,
463 ULONG DeviceCharacteristics,
464 BOOLEAN Exclusive,
465 PDEVICE_OBJECT * DeviceObject
466 );
467 NTSTATUS
468 STDCALL
469 IoCreateFile (
470 OUT PHANDLE FileHandle,
471 IN ACCESS_MASK DesiredAccess,
472 IN POBJECT_ATTRIBUTES ObjectAttributes,
473 OUT PIO_STATUS_BLOCK IoStatusBlock,
474 IN PLARGE_INTEGER AllocationSize OPTIONAL,
475 IN ULONG FileAttributes,
476 IN ULONG ShareAccess,
477 IN ULONG CreateDisposition,
478 IN ULONG CreateOptions,
479 IN PVOID EaBuffer OPTIONAL,
480 IN ULONG EaLength,
481 IN CREATE_FILE_TYPE CreateFileType,
482 IN PVOID ExtraCreateParameters OPTIONAL,
483 IN ULONG Options
484 );
485 PKEVENT
486 STDCALL
487 IoCreateNotificationEvent (
488 PUNICODE_STRING EventName,
489 PHANDLE EventHandle
490 );
491 PFILE_OBJECT
492 STDCALL
493 IoCreateStreamFileObject (
494 PFILE_OBJECT FileObject,
495 PDEVICE_OBJECT DeviceObject
496 );
497 NTSTATUS
498 STDCALL
499 IoCreateSymbolicLink (
500 PUNICODE_STRING SymbolicLinkName,
501 PUNICODE_STRING DeviceName
502 );
503 PKEVENT
504 STDCALL
505 IoCreateSynchronizationEvent (
506 PUNICODE_STRING EventName,
507 PHANDLE EventHandle
508 );
509 NTSTATUS
510 STDCALL
511 IoCreateUnprotectedSymbolicLink (
512 PUNICODE_STRING SymbolicLinkName,
513 PUNICODE_STRING DeviceName
514 );
515
516 /*
517 * FUNCTION:
518 * Deletes a symbolic link between the ARC name of a physical
519 * device and the name of the corresponding device object
520 *
521 * ARGUMENTS:
522 * ArcName = ARC name of the device
523 *
524 * NOTES:
525 * VOID
526 * IoDeassignArcName (
527 * PUNICODE_STRING ArcName
528 * );
529 */
530 #define IoDeassignArcName(ArcName) \
531 (IoDeleteSymbolicLink((ArcName)))
532
533 VOID
534 STDCALL
535 IoDeleteController (
536 PCONTROLLER_OBJECT ControllerObject
537 );
538 VOID
539 STDCALL
540 IoDeleteDevice (
541 PDEVICE_OBJECT DeviceObject
542 );
543 NTSTATUS
544 STDCALL
545 IoDeleteSymbolicLink (
546 PUNICODE_STRING SymbolicLinkName
547 );
548 VOID
549 STDCALL
550 IoDetachDevice (
551 PDEVICE_OBJECT TargetDevice
552 );
553 VOID
554 STDCALL
555 IoDisconnectInterrupt (
556 PKINTERRUPT InterruptObject
557 );
558 VOID
559 STDCALL
560 IoEnqueueIrp (
561 PIRP Irp
562 );
563 VOID
564 STDCALL
565 IoFastQueryNetworkAttributes (
566 DWORD Unknown0,
567 DWORD Unknown1,
568 DWORD Unknown2,
569 DWORD Unknown3,
570 DWORD Unknown4
571 );
572 VOID
573 STDCALL
574 IoFreeController (
575 PCONTROLLER_OBJECT ControllerObject
576 );
577 VOID
578 STDCALL
579 IoFreeIrp (
580 PIRP Irp
581 );
582 VOID
583 STDCALL
584 IoFreeMdl (
585 PMDL Mdl
586 );
587 PDEVICE_OBJECT
588 STDCALL
589 IoGetAttachedDevice (
590 PDEVICE_OBJECT DeviceObject
591 );
592 PDEVICE_OBJECT
593 STDCALL
594 IoGetAttachedDeviceReference (
595 PDEVICE_OBJECT DeviceObject
596 );
597 PDEVICE_OBJECT
598 STDCALL
599 IoGetBaseFileSystemDeviceObject (
600 IN PFILE_OBJECT FileObject
601 );
602 PCONFIGURATION_INFORMATION
603 STDCALL
604 IoGetConfigurationInformation (
605 VOID
606 );
607
608 /*
609 * FUNCTION: Gets a pointer to the callers location in the I/O stack in
610 * the given IRP
611 * ARGUMENTS:
612 * Irp = Points to the IRP
613 * RETURNS: A pointer to the stack location
614 *
615 * NOTES:
616 * PIO_STACK_LOCATION
617 * IoGetCurrentIrpStackLocation (PIRP Irp)
618 */
619 #define IoGetCurrentIrpStackLocation(Irp) \
620 (&(Irp)->Stack[(ULONG)((Irp)->CurrentLocation)])
621
622 /* original macro */
623 /*
624 #define IoGetCurrentIrpStackLocation(Irp) \
625 ((Irp)->Tail.Overlay.CurrentStackLocation)
626 */
627
628 #define IoSetNextIrpStackLocation(Irp) { \
629 (Irp)->CurrentLocation--; \
630 (Irp)->Tail.Overlay.CurrentStackLocation--; }
631
632 #define IoCopyCurrentIrpStackLocationToNext(Irp) { \
633 PIO_STACK_LOCATION IrpSp; \
634 PIO_STACK_LOCATION NextIrpSp; \
635 IrpSp = IoGetCurrentIrpStackLocation((Irp)); \
636 NextIrpSp = IoGetNextIrpStackLocation((Irp)); \
637 RtlCopyMemory(NextIrpSp, IrpSp, \
638 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
639 NextIrpSp->Control = 0; }
640
641 #define IoSkipCurrentIrpStackLocation(Irp) \
642 (Irp)->CurrentLocation++; \
643 (Irp)->Tail.Overlay.CurrentStackLocation++;
644
645 struct _EPROCESS*
646 STDCALL
647 IoGetCurrentProcess (
648 VOID
649 );
650 NTSTATUS
651 STDCALL
652 IoGetDeviceObjectPointer (
653 PUNICODE_STRING ObjectName,
654 ACCESS_MASK DesiredAccess,
655 PFILE_OBJECT * FileObject,
656 PDEVICE_OBJECT * DeviceObject
657 );
658 PDEVICE_OBJECT
659 STDCALL
660 IoGetDeviceToVerify (
661 struct _ETHREAD* Thread
662 );
663 PGENERIC_MAPPING
664 STDCALL
665 IoGetFileObjectGenericMapping (
666 VOID
667 );
668
669 #define IoGetFunctionCodeFromCtlCode(ControlCode) \
670 ((ControlCode >> 2) & 0x00000FFF)
671
672 PVOID
673 STDCALL
674 IoGetInitialStack (
675 VOID
676 );
677
678 /*
679 * FUNCTION: Gives a higher level driver access to the next lower driver's
680 * I/O stack location
681 * ARGUMENTS:
682 * Irp = points to the irp
683 * RETURNS: A pointer to the stack location
684 *
685 * NOTES:
686 * PIO_STACK_LOCATION
687 * IoGetNextIrpStackLocation (PIRP Irp)
688 */
689 #define IoGetNextIrpStackLocation(Irp) \
690 (&(Irp)->Stack[(Irp)->CurrentLocation-1])
691
692 /* original macro */
693 /*
694 #define IoGetNextIrpStackLocation(Irp) \
695 ((Irp)->Tail.Overlay.CurrentStackLocation-1)
696 */
697
698 PDEVICE_OBJECT
699 STDCALL
700 IoGetRelatedDeviceObject (
701 PFILE_OBJECT FileObject
702 );
703 struct _EPROCESS*
704 STDCALL
705 IoGetRequestorProcess (
706 IN PIRP Irp
707 );
708
709 VOID
710 STDCALL
711 IoGetStackLimits (
712 PULONG LowLimit,
713 PULONG HighLimit
714 );
715
716 PIRP
717 STDCALL
718 IoGetTopLevelIrp (
719 VOID
720 );
721
722 #define IoInitializeDpcRequest(DeviceObject,DpcRoutine) \
723 (KeInitializeDpc(&(DeviceObject)->Dpc, \
724 (PKDEFERRED_ROUTINE)(DpcRoutine), \
725 (DeviceObject)))
726
727 /*
728 * FUNCTION: Initalizes an irp allocated by the caller
729 * ARGUMENTS:
730 * Irp = IRP to initalize
731 * PacketSize = Size in bytes of the IRP
732 * StackSize = Number of stack locations in the IRP
733 */
734 VOID
735 STDCALL
736 IoInitializeIrp (
737 PIRP Irp,
738 USHORT PacketSize,
739 CCHAR StackSize
740 );
741 NTSTATUS
742 STDCALL
743 IoInitializeTimer (
744 PDEVICE_OBJECT DeviceObject,
745 PIO_TIMER_ROUTINE TimerRoutine,
746 PVOID Context
747 );
748
749 /*
750 * NOTES:
751 * BOOLEAN
752 * IsErrorUserInduced (NTSTATUS Status)
753 */
754 #define IoIsErrorUserInduced(Status) \
755 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
756 ((Status) == STATUS_IO_TIMEOUT) || \
757 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
758 ((Status) == STATUS_NO_MEDIA_IN_DRIVE) || \
759 ((Status) == STATUS_VERIFY_REQUIRED) || \
760 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
761 ((Status) == STATUS_WRONG_VOLUME)))
762
763 BOOLEAN
764 STDCALL
765 IoIsOperationSynchronous (
766 IN PIRP Irp
767 );
768 BOOLEAN
769 STDCALL
770 IoIsSystemThread (
771 PVOID Unknown0
772 );
773 PIRP
774 STDCALL
775 IoMakeAssociatedIrp (
776 PIRP Irp,
777 CCHAR StackSize
778 );
779
780 /*
781 * FUNCTION: Marks the specified irp, indicating further processing will
782 * be required by other driver routines
783 * ARGUMENTS:
784 * Irp = Irp to mark
785 * NOTES:
786 * VOID
787 * IoMarkIrpPending (PIRP Irp)
788 */
789 #define IoMarkIrpPending(Irp) \
790 (IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED)
791
792
793 NTSTATUS
794 STDCALL
795 IoOpenDeviceInstanceKey (
796 DWORD Unknown0,
797 DWORD Unknown1,
798 DWORD Unknown2,
799 DWORD Unknown3,
800 DWORD Unknown4
801 );
802 NTSTATUS
803 STDCALL
804 IoQueryDeviceDescription (
805 PINTERFACE_TYPE BusType,
806 PULONG BusNumber,
807 PCONFIGURATION_TYPE ControllerType,
808 PULONG ControllerNumber,
809 PCONFIGURATION_TYPE PeripheralType,
810 PULONG PeripheralNumber,
811 PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
812 PVOID Context
813 );
814 DWORD
815 STDCALL
816 IoQueryDeviceEnumInfo (
817 DWORD Unknown0,
818 DWORD Unknown1
819 );
820 // IoQueryFileInformation: confirmed - Undocumented because it does not require a valid file handle
821 NTSTATUS
822 STDCALL
823 IoQueryFileInformation (
824 IN PFILE_OBJECT FileObject,
825 IN FILE_INFORMATION_CLASS FileInformationClass,
826 IN ULONG Length,
827 OUT PVOID FileInformation,
828 OUT PULONG ReturnedLength
829 );
830 NTSTATUS
831 STDCALL
832 IoQueryVolumeInformation (
833 IN PFILE_OBJECT FileObject,
834 IN FS_INFORMATION_CLASS FsInformationClass,
835 IN ULONG Length,
836 OUT PVOID FsInformation,
837 OUT PULONG ReturnedLength
838 );
839 VOID
840 STDCALL
841 IoQueueThreadIrp (
842 PVOID Unknown0
843 );
844 VOID
845 STDCALL
846 IoRaiseHardError (
847 PIRP Irp,
848 PVPB Vpb,
849 PDEVICE_OBJECT RealDeviceObject
850 );
851 BOOLEAN
852 STDCALL
853 IoRaiseInformationalHardError (
854 NTSTATUS ErrorStatus,
855 PUNICODE_STRING String,
856 struct _KTHREAD* Thread
857 );
858 VOID
859 STDCALL
860 IoRegisterDriverReinitialization (
861 PDRIVER_OBJECT DriverObject,
862 PDRIVER_REINITIALIZE ReinitRoutine,
863 PVOID Context
864 );
865 VOID
866 STDCALL
867 IoRegisterFileSystem (
868 PDEVICE_OBJECT DeviceObject
869 );
870 #if (_WIN32_WINNT >= 0x0400)
871 NTSTATUS
872 STDCALL
873 IoRegisterFsRegistrationChange (
874 IN PDRIVER_OBJECT DriverObject,
875 IN PFSDNOTIFICATIONPROC FSDNotificationProc
876 );
877 #endif // (_WIN32_WINNT >= 0x0400)
878 NTSTATUS
879 STDCALL
880 IoRegisterShutdownNotification (
881 PDEVICE_OBJECT DeviceObject
882 );
883 VOID
884 STDCALL
885 IoReleaseCancelSpinLock (
886 IN KIRQL Irql
887 );
888 VOID
889 STDCALL
890 IoReleaseVpbSpinLock (
891 IN KIRQL Irql
892 );
893 VOID
894 STDCALL
895 IoRemoveShareAccess (
896 PFILE_OBJECT FileObject,
897 PSHARE_ACCESS ShareAccess
898 );
899 NTSTATUS
900 STDCALL
901 IoReportHalResourceUsage (
902 IN PUNICODE_STRING HalDescription,
903 IN PCM_RESOURCE_LIST RawList,
904 IN PCM_RESOURCE_LIST TranslatedList,
905 IN ULONG ListSize
906 );
907 NTSTATUS
908 STDCALL
909 IoReportResourceUsage (
910 PUNICODE_STRING DriverClassName,
911 PDRIVER_OBJECT DriverObject,
912 PCM_RESOURCE_LIST DriverList,
913 ULONG DriverListSize,
914 PDEVICE_OBJECT DeviceObject,
915 PCM_RESOURCE_LIST DeviceList,
916 ULONG DeviceListSize,
917 BOOLEAN OverrideConflict,
918 PBOOLEAN ConflictDetected
919 );
920
921 #define IoRequestDpc(DeviceObject,Irp,Context) \
922 (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
923
924 #define IoSetCancelRoutine(Irp,NewCancelRoutine) \
925 ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
926 (ULONG)(NewCancelRoutine)));
927
928 #define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
929 { \
930 PIO_STACK_LOCATION param; \
931 assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
932 param = IoGetNextIrpStackLocation((Irp)); \
933 param->CompletionRoutine=(Routine); \
934 param->CompletionContext=(Context); \
935 param->Control = 0; \
936 if ((Success)) \
937 param->Control = SL_INVOKE_ON_SUCCESS; \
938 if ((Error)) \
939 param->Control |= SL_INVOKE_ON_ERROR; \
940 if ((Cancel)) \
941 param->Control |= SL_INVOKE_ON_CANCEL; \
942 }
943
944 VOID STDCALL
945 IoSetDeviceToVerify (IN struct _ETHREAD* Thread,
946 IN PDEVICE_OBJECT DeviceObject);
947 VOID
948 STDCALL
949 IoSetHardErrorOrVerifyDevice (
950 IN PIRP Irp,
951 IN PDEVICE_OBJECT DeviceObject
952 );
953 NTSTATUS
954 STDCALL
955 IoSetInformation (
956 IN PFILE_OBJECT FileObject,
957 IN FILE_INFORMATION_CLASS FileInformationClass,
958 IN ULONG Length,
959 OUT PVOID FileInformation
960 );
961
962 #define IoSetNextIrpStackLocation(Irp) \
963 { \
964 (Irp)->CurrentLocation--; \
965 (Irp)->Tail.Overlay.CurrentStackLocation--; \
966 }
967
968 VOID
969 STDCALL
970 IoSetShareAccess (
971 ACCESS_MASK DesiredAccess,
972 ULONG DesiredShareAccess,
973 PFILE_OBJECT FileObject,
974 PSHARE_ACCESS ShareAccess
975 );
976 BOOLEAN
977 STDCALL
978 IoSetThreadHardErrorMode (
979 IN BOOLEAN HardErrorEnabled
980 );
981 VOID
982 STDCALL
983 IoSetTopLevelIrp (
984 IN PIRP Irp
985 );
986
987 /*
988 * FUNCTION: Determines the size of an IRP
989 * ARGUMENTS:
990 * StackSize = number of stack locations in the IRP
991 * RETURNS: The size of the IRP in bytes
992 USHORT
993 IoSizeOfIrp (CCHAR StackSize)
994 */
995 #define IoSizeOfIrp(StackSize) \
996 ((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
997
998 /* original macro */
999 /*
1000 #define IoSizeOfIrp(StackSize) \
1001 ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
1002 */
1003
1004 /*
1005 * FUNCTION: Dequeues the next IRP from the device's associated queue and
1006 * calls its StartIo routine
1007 * ARGUMENTS:
1008 * DeviceObject = Device object
1009 * Cancelable = True if IRPs in the queue can be cancelled
1010 */
1011 VOID
1012 STDCALL
1013 IoStartNextPacket (
1014 PDEVICE_OBJECT DeviceObject,
1015 BOOLEAN Cancelable
1016 );
1017 VOID
1018 STDCALL
1019 IoStartNextPacketByKey (
1020 PDEVICE_OBJECT DeviceObject,
1021 BOOLEAN Cancelable,
1022 ULONG Key
1023 );
1024 /*
1025 * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
1026 * the device is busy
1027 * ARGUMENTS:
1028 * DeviceObject = Device to pass the IRP to
1029 * Irp = Irp to be processed
1030 * Key = Optional value for where to insert the IRP
1031 * CancelFunction = Entry point for a driver supplied cancel function
1032 */
1033 VOID
1034 STDCALL
1035 IoStartPacket (
1036 PDEVICE_OBJECT DeviceObject,
1037 PIRP Irp,
1038 PULONG Key,
1039 PDRIVER_CANCEL CancelFunction
1040 );
1041 VOID
1042 STDCALL
1043 IoStartTimer (
1044 PDEVICE_OBJECT DeviceObject
1045 );
1046 VOID
1047 STDCALL
1048 IoStopTimer (
1049 PDEVICE_OBJECT DeviceObject
1050 );
1051 NTSTATUS
1052 STDCALL
1053 IoSynchronousPageWrite (
1054 DWORD Unknown0,
1055 DWORD Unknown1,
1056 DWORD Unknown2,
1057 DWORD Unknown3,
1058 DWORD Unknown4
1059 );
1060 struct _EPROCESS* STDCALL IoThreadToProcess (struct _ETHREAD* Thread);
1061 VOID
1062 STDCALL
1063 IoUnregisterFileSystem (
1064 IN PDEVICE_OBJECT DeviceObject
1065 );
1066 #if (_WIN32_WINNT >= 0x0400)
1067 VOID
1068 STDCALL
1069 IoUnregisterFsRegistrationChange (
1070 DWORD Unknown0,
1071 DWORD Unknown1
1072 );
1073 #endif // (_WIN32_WINNT >= 0x0400)
1074 VOID
1075 STDCALL
1076 IoUnregisterShutdownNotification (
1077 PDEVICE_OBJECT DeviceObject
1078 );
1079 VOID
1080 STDCALL
1081 IoUpdateShareAccess (
1082 IN PFILE_OBJECT FileObject,
1083 IN PSHARE_ACCESS ShareAccess
1084 );
1085 NTSTATUS
1086 STDCALL
1087 IoVerifyVolume (
1088 IN PDEVICE_OBJECT DeviceObject,
1089 IN BOOLEAN AllowRawMount
1090 );
1091 VOID
1092 STDCALL
1093 IoWriteErrorLogEntry (
1094 PVOID ElEntry
1095 );
1096 /*
1097 * FUNCTION: Sends an irp to the next lower driver
1098 */
1099 NTSTATUS
1100 FASTCALL
1101 IofCallDriver (
1102 PDEVICE_OBJECT DeviceObject,
1103 PIRP Irp
1104 );
1105 /*
1106 * FUNCTION: Indicates the caller has finished all processing for a given
1107 * I/O request and is returning the given IRP to the I/O manager
1108 * ARGUMENTS:
1109 * Irp = Irp to be cancelled
1110 * PriorityBoost = Increment by which to boost the priority of the
1111 * thread making the request
1112 */
1113 VOID
1114 FASTCALL
1115 IofCompleteRequest (
1116 PIRP Irp,
1117 CCHAR PriorityBoost
1118 );
1119
1120 /* --- EXPORTED BY HAL --- */
1121
1122 VOID
1123 STDCALL
1124 IoAssignDriveLetters (
1125 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1126 IN PSTRING NtDeviceName,
1127 OUT PUCHAR NtSystemPath,
1128 OUT PSTRING NtSystemPathString
1129 );
1130
1131 BOOLEAN
1132 STDCALL
1133 IoFlushAdapterBuffers (
1134 PADAPTER_OBJECT AdapterObject,
1135 PMDL Mdl,
1136 PVOID MapRegisterBase,
1137 PVOID CurrentVa,
1138 ULONG Length,
1139 BOOLEAN WriteToDevice
1140 );
1141
1142 VOID
1143 STDCALL
1144 IoFreeAdapterChannel (
1145 PADAPTER_OBJECT AdapterObject
1146 );
1147
1148 VOID
1149 STDCALL
1150 IoFreeMapRegisters (
1151 PADAPTER_OBJECT AdapterObject,
1152 PVOID MapRegisterBase,
1153 ULONG NumberOfMapRegisters
1154 );
1155
1156 PHYSICAL_ADDRESS
1157 STDCALL
1158 IoMapTransfer (
1159 PADAPTER_OBJECT AdapterObject,
1160 PMDL Mdl,
1161 PVOID MapRegisterBase,
1162 PVOID CurrentVa,
1163 PULONG Length,
1164 BOOLEAN WriteToDevice
1165 );
1166
1167 NTSTATUS
1168 STDCALL
1169 IoReadPartitionTable (
1170 PDEVICE_OBJECT DeviceObject,
1171 ULONG SectorSize,
1172 BOOLEAN ReturnedRecognizedPartitions,
1173 PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
1174 );
1175
1176 NTSTATUS
1177 STDCALL
1178 IoSetPartitionInformation (
1179 PDEVICE_OBJECT DeviceObject,
1180 ULONG SectorSize,
1181 ULONG PartitionNumber,
1182 ULONG PartitionType
1183 );
1184
1185 NTSTATUS
1186 STDCALL
1187 IoWritePartitionTable (
1188 PDEVICE_OBJECT DeviceObject,
1189 ULONG SectorSize,
1190 ULONG SectorsPerTrack,
1191 ULONG NumberOfHeads,
1192 PDRIVE_LAYOUT_INFORMATION PartitionBuffer
1193 );
1194
1195
1196 /* --- --- --- INTERNAL or REACTOS ONLY --- --- --- */
1197
1198 /*
1199 * FUNCTION: Registers the driver with WMI
1200 * ARGUMENTS:
1201 * DeviceObject = Device to register
1202 * Action = Action to take
1203 * RETURNS: Status (?)
1204 */
1205 /*
1206 NTSTATUS
1207 IoWMIRegistrationControl (
1208 PDEVICE_OBJECT DeviceObject,
1209 WMIREGACTION Action);
1210 */
1211
1212 BOOLEAN
1213 IoIsTotalDeviceFailure (
1214 NTSTATUS Status
1215 );
1216
1217
1218 #endif /* ndef _INCLUDE_DDK_IOFUNCS_H */