Added required defines and typedefs for ntoskrnl/io modules.
[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.34 2002/10/03 19:26:46 robd 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
380 NTSTATUS STDCALL
381 IoCheckDesiredAccess(IN OUT PACCESS_MASK DesiredAccess,
382 IN ACCESS_MASK GrantedAccess);
383
384 NTSTATUS STDCALL
385 IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer,
386 IN ULONG EaLength,
387 OUT PULONG ErrorOffset);
388
389 NTSTATUS STDCALL
390 IoCheckFunctionAccess(IN ACCESS_MASK GrantedAccess,
391 IN UCHAR MajorFunction,
392 IN UCHAR MinorFunction,
393 IN ULONG IoControlCode,
394 IN PFILE_INFORMATION_CLASS FileInformationClass OPTIONAL,
395 IN PFS_INFORMATION_CLASS FsInformationClass OPTIONAL);
396
397 NTSTATUS
398 STDCALL
399 IoCheckShareAccess (
400 ACCESS_MASK DesiredAccess,
401 ULONG DesiredShareAccess,
402 PFILE_OBJECT FileObject,
403 PSHARE_ACCESS ShareAccess,
404 BOOLEAN Update
405 );
406 VOID
407 STDCALL
408 IoCompleteRequest (
409 PIRP Irp,
410 CCHAR PriorityBoost
411 );
412 NTSTATUS
413 STDCALL
414 IoConnectInterrupt (
415 PKINTERRUPT * InterruptObject,
416 PKSERVICE_ROUTINE ServiceRoutine,
417 PVOID ServiceContext,
418 PKSPIN_LOCK SpinLock,
419 ULONG Vector,
420 KIRQL Irql,
421 KIRQL SynchronizeIrql,
422 KINTERRUPT_MODE InterruptMode,
423 BOOLEAN ShareVector,
424 KAFFINITY ProcessorEnableMask,
425 BOOLEAN FloatingSave
426 );
427
428 PCONTROLLER_OBJECT
429 STDCALL
430 IoCreateController (
431 ULONG Size
432 );
433 /*
434 * FUNCTION: Allocates memory for and intializes a device object for use for
435 * a driver
436 * ARGUMENTS:
437 * DriverObject : Driver object passed by iomgr when the driver was
438 * loaded
439 * DeviceExtensionSize : Number of bytes for the device extension
440 * DeviceName : Unicode name of device
441 * DeviceType : Device type
442 * DeviceCharacteristics : Bit mask of device characteristics
443 * Exclusive : True if only one thread can access the device at a
444 * time
445 * RETURNS:
446 * Success or failure
447 * DeviceObject : Contains a pointer to allocated device object
448 * if the call succeeded
449 * NOTES: See the DDK documentation for more information
450 */
451 NTSTATUS
452 STDCALL
453 IoCreateDevice (
454 PDRIVER_OBJECT DriverObject,
455 ULONG DeviceExtensionSize,
456 PUNICODE_STRING DeviceName,
457 DEVICE_TYPE DeviceType,
458 ULONG DeviceCharacteristics,
459 BOOLEAN Exclusive,
460 PDEVICE_OBJECT * DeviceObject
461 );
462 NTSTATUS
463 STDCALL
464 IoCreateFile (
465 OUT PHANDLE FileHandle,
466 IN ACCESS_MASK DesiredAccess,
467 IN POBJECT_ATTRIBUTES ObjectAttributes,
468 OUT PIO_STATUS_BLOCK IoStatusBlock,
469 IN PLARGE_INTEGER AllocationSize OPTIONAL,
470 IN ULONG FileAttributes,
471 IN ULONG ShareAccess,
472 IN ULONG CreateDisposition,
473 IN ULONG CreateOptions,
474 IN PVOID EaBuffer OPTIONAL,
475 IN ULONG EaLength,
476 IN CREATE_FILE_TYPE CreateFileType,
477 IN PVOID ExtraCreateParameters OPTIONAL,
478 IN ULONG Options
479 );
480 PKEVENT
481 STDCALL
482 IoCreateNotificationEvent (
483 PUNICODE_STRING EventName,
484 PHANDLE EventHandle
485 );
486 PFILE_OBJECT
487 STDCALL
488 IoCreateStreamFileObject (
489 PFILE_OBJECT FileObject,
490 PDEVICE_OBJECT DeviceObject
491 );
492 NTSTATUS
493 STDCALL
494 IoCreateSymbolicLink (
495 PUNICODE_STRING SymbolicLinkName,
496 PUNICODE_STRING DeviceName
497 );
498 PKEVENT
499 STDCALL
500 IoCreateSynchronizationEvent (
501 PUNICODE_STRING EventName,
502 PHANDLE EventHandle
503 );
504 NTSTATUS
505 STDCALL
506 IoCreateUnprotectedSymbolicLink (
507 PUNICODE_STRING SymbolicLinkName,
508 PUNICODE_STRING DeviceName
509 );
510
511 /*
512 * FUNCTION:
513 * Deletes a symbolic link between the ARC name of a physical
514 * device and the name of the corresponding device object
515 *
516 * ARGUMENTS:
517 * ArcName = ARC name of the device
518 *
519 * NOTES:
520 * VOID
521 * IoDeassignArcName (
522 * PUNICODE_STRING ArcName
523 * );
524 */
525 #define IoDeassignArcName(ArcName) \
526 (IoDeleteSymbolicLink((ArcName)))
527
528 VOID
529 STDCALL
530 IoDeleteController (
531 PCONTROLLER_OBJECT ControllerObject
532 );
533 VOID
534 STDCALL
535 IoDeleteDevice (
536 PDEVICE_OBJECT DeviceObject
537 );
538 NTSTATUS
539 STDCALL
540 IoDeleteSymbolicLink (
541 PUNICODE_STRING SymbolicLinkName
542 );
543 VOID
544 STDCALL
545 IoDetachDevice (
546 PDEVICE_OBJECT TargetDevice
547 );
548 VOID
549 STDCALL
550 IoDisconnectInterrupt (
551 PKINTERRUPT InterruptObject
552 );
553 VOID
554 STDCALL
555 IoEnqueueIrp (
556 PIRP Irp
557 );
558
559 BOOLEAN STDCALL
560 IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes,
561 IN ACCESS_MASK DesiredAccess,
562 IN ULONG OpenOptions,
563 OUT PIO_STATUS_BLOCK IoStatus,
564 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer);
565
566 VOID
567 STDCALL
568 IoFreeController (
569 PCONTROLLER_OBJECT ControllerObject
570 );
571 VOID
572 STDCALL
573 IoFreeIrp (
574 PIRP Irp
575 );
576 VOID
577 STDCALL
578 IoFreeMdl (
579 PMDL Mdl
580 );
581 PDEVICE_OBJECT
582 STDCALL
583 IoGetAttachedDevice (
584 PDEVICE_OBJECT DeviceObject
585 );
586 PDEVICE_OBJECT
587 STDCALL
588 IoGetAttachedDeviceReference (
589 PDEVICE_OBJECT DeviceObject
590 );
591 PDEVICE_OBJECT
592 STDCALL
593 IoGetBaseFileSystemDeviceObject (
594 IN PFILE_OBJECT FileObject
595 );
596 PCONFIGURATION_INFORMATION
597 STDCALL
598 IoGetConfigurationInformation (
599 VOID
600 );
601
602 /*
603 * FUNCTION: Gets a pointer to the callers location in the I/O stack in
604 * the given IRP
605 * ARGUMENTS:
606 * Irp = Points to the IRP
607 * RETURNS: A pointer to the stack location
608 *
609 * NOTES:
610 * PIO_STACK_LOCATION
611 * IoGetCurrentIrpStackLocation (PIRP Irp)
612 */
613 #define IoGetCurrentIrpStackLocation(Irp) \
614 ((Irp)->Tail.Overlay.CurrentStackLocation)
615
616 #define IoSetNextIrpStackLocation(Irp) { \
617 (Irp)->CurrentLocation--; \
618 (Irp)->Tail.Overlay.CurrentStackLocation--; }
619
620 #define IoCopyCurrentIrpStackLocationToNext(Irp) { \
621 PIO_STACK_LOCATION IrpSp; \
622 PIO_STACK_LOCATION NextIrpSp; \
623 IrpSp = IoGetCurrentIrpStackLocation((Irp)); \
624 NextIrpSp = IoGetNextIrpStackLocation((Irp)); \
625 RtlCopyMemory(NextIrpSp, IrpSp, \
626 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
627 NextIrpSp->Control = 0; }
628
629 #define IoSkipCurrentIrpStackLocation(Irp) \
630 (Irp)->CurrentLocation++; \
631 (Irp)->Tail.Overlay.CurrentStackLocation++;
632
633 struct _EPROCESS*
634 STDCALL
635 IoGetCurrentProcess (
636 VOID
637 );
638 NTSTATUS
639 STDCALL
640 IoGetDeviceObjectPointer (
641 PUNICODE_STRING ObjectName,
642 ACCESS_MASK DesiredAccess,
643 PFILE_OBJECT * FileObject,
644 PDEVICE_OBJECT * DeviceObject
645 );
646 PDEVICE_OBJECT
647 STDCALL
648 IoGetDeviceToVerify (
649 struct _ETHREAD* Thread
650 );
651 PGENERIC_MAPPING
652 STDCALL
653 IoGetFileObjectGenericMapping (
654 VOID
655 );
656
657 #define IoGetFunctionCodeFromCtlCode(ControlCode) \
658 ((ControlCode >> 2) & 0x00000FFF)
659
660 PVOID
661 STDCALL
662 IoGetInitialStack (
663 VOID
664 );
665
666 /*
667 * FUNCTION: Gives a higher level driver access to the next lower driver's
668 * I/O stack location
669 * ARGUMENTS:
670 * Irp = points to the irp
671 * RETURNS: A pointer to the stack location
672 *
673 * NOTES:
674 * PIO_STACK_LOCATION
675 * IoGetNextIrpStackLocation (PIRP Irp)
676 */
677 #define IoGetNextIrpStackLocation(Irp) \
678 ((Irp)->Tail.Overlay.CurrentStackLocation-1)
679
680
681 PDEVICE_OBJECT
682 STDCALL
683 IoGetRelatedDeviceObject (
684 PFILE_OBJECT FileObject
685 );
686 struct _EPROCESS*
687 STDCALL
688 IoGetRequestorProcess (
689 IN PIRP Irp
690 );
691
692 VOID
693 STDCALL
694 IoGetStackLimits (
695 PULONG LowLimit,
696 PULONG HighLimit
697 );
698
699 PIRP
700 STDCALL
701 IoGetTopLevelIrp (
702 VOID
703 );
704
705 #define IoInitializeDpcRequest(DeviceObject,DpcRoutine) \
706 (KeInitializeDpc(&(DeviceObject)->Dpc, \
707 (PKDEFERRED_ROUTINE)(DpcRoutine), \
708 (DeviceObject)))
709
710 /*
711 * FUNCTION: Initalizes an irp allocated by the caller
712 * ARGUMENTS:
713 * Irp = IRP to initalize
714 * PacketSize = Size in bytes of the IRP
715 * StackSize = Number of stack locations in the IRP
716 */
717 VOID
718 STDCALL
719 IoInitializeIrp (
720 PIRP Irp,
721 USHORT PacketSize,
722 CCHAR StackSize
723 );
724 NTSTATUS
725 STDCALL
726 IoInitializeTimer (
727 PDEVICE_OBJECT DeviceObject,
728 PIO_TIMER_ROUTINE TimerRoutine,
729 PVOID Context
730 );
731
732 /*
733 * NOTES:
734 * BOOLEAN
735 * IsErrorUserInduced (NTSTATUS Status)
736 */
737 #define IoIsErrorUserInduced(Status) \
738 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
739 ((Status) == STATUS_IO_TIMEOUT) || \
740 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
741 ((Status) == STATUS_NO_MEDIA_IN_DRIVE) || \
742 ((Status) == STATUS_VERIFY_REQUIRED) || \
743 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
744 ((Status) == STATUS_WRONG_VOLUME)))
745
746 BOOLEAN
747 STDCALL
748 IoIsOperationSynchronous (
749 IN PIRP Irp
750 );
751 BOOLEAN
752 STDCALL
753 IoIsSystemThread (
754 PVOID Unknown0
755 );
756 PIRP
757 STDCALL
758 IoMakeAssociatedIrp (
759 PIRP Irp,
760 CCHAR StackSize
761 );
762
763 /*
764 * FUNCTION: Marks the specified irp, indicating further processing will
765 * be required by other driver routines
766 * ARGUMENTS:
767 * Irp = Irp to mark
768 * NOTES:
769 * VOID
770 * IoMarkIrpPending (PIRP Irp)
771 */
772 #define IoMarkIrpPending(Irp) \
773 (IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED)
774
775
776 NTSTATUS
777 STDCALL
778 IoOpenDeviceInstanceKey (
779 DWORD Unknown0,
780 DWORD Unknown1,
781 DWORD Unknown2,
782 DWORD Unknown3,
783 DWORD Unknown4
784 );
785 NTSTATUS
786 STDCALL
787 IoQueryDeviceDescription (
788 PINTERFACE_TYPE BusType,
789 PULONG BusNumber,
790 PCONFIGURATION_TYPE ControllerType,
791 PULONG ControllerNumber,
792 PCONFIGURATION_TYPE PeripheralType,
793 PULONG PeripheralNumber,
794 PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
795 PVOID Context
796 );
797 DWORD
798 STDCALL
799 IoQueryDeviceEnumInfo (
800 DWORD Unknown0,
801 DWORD Unknown1
802 );
803 // IoQueryFileInformation: confirmed - Undocumented because it does not require a valid file handle
804 NTSTATUS
805 STDCALL
806 IoQueryFileInformation (
807 IN PFILE_OBJECT FileObject,
808 IN FILE_INFORMATION_CLASS FileInformationClass,
809 IN ULONG Length,
810 OUT PVOID FileInformation,
811 OUT PULONG ReturnedLength
812 );
813 NTSTATUS
814 STDCALL
815 IoQueryVolumeInformation (
816 IN PFILE_OBJECT FileObject,
817 IN FS_INFORMATION_CLASS FsInformationClass,
818 IN ULONG Length,
819 OUT PVOID FsInformation,
820 OUT PULONG ReturnedLength
821 );
822 VOID
823 STDCALL
824 IoQueueThreadIrp (
825 IN PIRP Irp
826 );
827
828 typedef struct _IO_WORKITEM *PIO_WORKITEM;
829 typedef VOID (*PIO_WORKITEM_ROUTINE)(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context);
830
831 VOID
832 STDCALL
833 IoQueueWorkItem(
834 IN PIO_WORKITEM IoWorkItem,
835 IN PIO_WORKITEM_ROUTINE WorkerRoutine,
836 IN WORK_QUEUE_TYPE QueueType,
837 IN PVOID Context
838 );
839
840 VOID
841 STDCALL
842 IoFreeWorkItem(
843 PIO_WORKITEM IoWorkItem
844 );
845
846 PIO_WORKITEM
847 STDCALL
848 IoAllocateWorkItem(
849 PDEVICE_OBJECT DeviceObject
850 );
851
852 VOID
853 STDCALL
854 IoRaiseHardError (
855 PIRP Irp,
856 PVPB Vpb,
857 PDEVICE_OBJECT RealDeviceObject
858 );
859 BOOLEAN
860 STDCALL
861 IoRaiseInformationalHardError (
862 NTSTATUS ErrorStatus,
863 PUNICODE_STRING String,
864 struct _KTHREAD* Thread
865 );
866 VOID
867 STDCALL
868 IoRegisterDriverReinitialization (
869 PDRIVER_OBJECT DriverObject,
870 PDRIVER_REINITIALIZE ReinitRoutine,
871 PVOID Context
872 );
873 VOID
874 STDCALL
875 IoRegisterFileSystem (
876 PDEVICE_OBJECT DeviceObject
877 );
878 #if (_WIN32_WINNT >= 0x0400)
879 NTSTATUS
880 STDCALL
881 IoRegisterFsRegistrationChange (
882 IN PDRIVER_OBJECT DriverObject,
883 IN PFSDNOTIFICATIONPROC FSDNotificationProc
884 );
885 #endif // (_WIN32_WINNT >= 0x0400)
886 NTSTATUS
887 STDCALL
888 IoRegisterShutdownNotification (
889 PDEVICE_OBJECT DeviceObject
890 );
891 VOID
892 STDCALL
893 IoReleaseCancelSpinLock (
894 IN KIRQL Irql
895 );
896 VOID
897 STDCALL
898 IoReleaseVpbSpinLock (
899 IN KIRQL Irql
900 );
901 VOID
902 STDCALL
903 IoRemoveShareAccess (
904 PFILE_OBJECT FileObject,
905 PSHARE_ACCESS ShareAccess
906 );
907 NTSTATUS
908 STDCALL
909 IoReportHalResourceUsage (
910 IN PUNICODE_STRING HalDescription,
911 IN PCM_RESOURCE_LIST RawList,
912 IN PCM_RESOURCE_LIST TranslatedList,
913 IN ULONG ListSize
914 );
915 NTSTATUS
916 STDCALL
917 IoReportResourceUsage (
918 PUNICODE_STRING DriverClassName,
919 PDRIVER_OBJECT DriverObject,
920 PCM_RESOURCE_LIST DriverList,
921 ULONG DriverListSize,
922 PDEVICE_OBJECT DeviceObject,
923 PCM_RESOURCE_LIST DeviceList,
924 ULONG DeviceListSize,
925 BOOLEAN OverrideConflict,
926 PBOOLEAN ConflictDetected
927 );
928
929 #define IoRequestDpc(DeviceObject,Irp,Context) \
930 (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
931
932 #define IoSetCancelRoutine(Irp,NewCancelRoutine) \
933 ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
934 (ULONG)(NewCancelRoutine)));
935
936 #define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
937 { \
938 PIO_STACK_LOCATION param; \
939 assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
940 param = IoGetNextIrpStackLocation((Irp)); \
941 param->CompletionRoutine=(Routine); \
942 param->CompletionContext=(Context); \
943 param->Control = 0; \
944 if ((Success)) \
945 param->Control = SL_INVOKE_ON_SUCCESS; \
946 if ((Error)) \
947 param->Control |= SL_INVOKE_ON_ERROR; \
948 if ((Cancel)) \
949 param->Control |= SL_INVOKE_ON_CANCEL; \
950 }
951
952 VOID STDCALL
953 IoSetDeviceToVerify (IN struct _ETHREAD* Thread,
954 IN PDEVICE_OBJECT DeviceObject);
955 VOID
956 STDCALL
957 IoSetHardErrorOrVerifyDevice (
958 IN PIRP Irp,
959 IN PDEVICE_OBJECT DeviceObject
960 );
961 NTSTATUS
962 STDCALL
963 IoSetInformation (
964 IN PFILE_OBJECT FileObject,
965 IN FILE_INFORMATION_CLASS FileInformationClass,
966 IN ULONG Length,
967 OUT PVOID FileInformation
968 );
969
970 #define IoSetNextIrpStackLocation(Irp) \
971 { \
972 (Irp)->CurrentLocation--; \
973 (Irp)->Tail.Overlay.CurrentStackLocation--; \
974 }
975
976 VOID
977 STDCALL
978 IoSetShareAccess (
979 ACCESS_MASK DesiredAccess,
980 ULONG DesiredShareAccess,
981 PFILE_OBJECT FileObject,
982 PSHARE_ACCESS ShareAccess
983 );
984 BOOLEAN
985 STDCALL
986 IoSetThreadHardErrorMode (
987 IN BOOLEAN HardErrorEnabled
988 );
989 VOID
990 STDCALL
991 IoSetTopLevelIrp (
992 IN PIRP Irp
993 );
994
995 /*
996 * FUNCTION: Determines the size of an IRP
997 * ARGUMENTS:
998 * StackSize = number of stack locations in the IRP
999 * RETURNS: The size of the IRP in bytes
1000 USHORT
1001 IoSizeOfIrp (CCHAR StackSize)
1002 */
1003 #define IoSizeOfIrp(StackSize) \
1004 ((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
1005
1006 /* original macro */
1007 /*
1008 #define IoSizeOfIrp(StackSize) \
1009 ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
1010 */
1011
1012 /*
1013 * FUNCTION: Dequeues the next IRP from the device's associated queue and
1014 * calls its StartIo routine
1015 * ARGUMENTS:
1016 * DeviceObject = Device object
1017 * Cancelable = True if IRPs in the queue can be cancelled
1018 */
1019 VOID
1020 STDCALL
1021 IoStartNextPacket (
1022 PDEVICE_OBJECT DeviceObject,
1023 BOOLEAN Cancelable
1024 );
1025 VOID
1026 STDCALL
1027 IoStartNextPacketByKey (
1028 PDEVICE_OBJECT DeviceObject,
1029 BOOLEAN Cancelable,
1030 ULONG Key
1031 );
1032 /*
1033 * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
1034 * the device is busy
1035 * ARGUMENTS:
1036 * DeviceObject = Device to pass the IRP to
1037 * Irp = Irp to be processed
1038 * Key = Optional value for where to insert the IRP
1039 * CancelFunction = Entry point for a driver supplied cancel function
1040 */
1041 VOID
1042 STDCALL
1043 IoStartPacket (
1044 PDEVICE_OBJECT DeviceObject,
1045 PIRP Irp,
1046 PULONG Key,
1047 PDRIVER_CANCEL CancelFunction
1048 );
1049 VOID
1050 STDCALL
1051 IoStartTimer (
1052 PDEVICE_OBJECT DeviceObject
1053 );
1054 VOID
1055 STDCALL
1056 IoStopTimer (
1057 PDEVICE_OBJECT DeviceObject
1058 );
1059
1060 NTSTATUS STDCALL
1061 IoPageRead(PFILE_OBJECT FileObject,
1062 PMDL Mdl,
1063 PLARGE_INTEGER Offset,
1064 PKEVENT Event,
1065 PIO_STATUS_BLOCK StatusBlock);
1066
1067 NTSTATUS STDCALL
1068 IoSynchronousPageWrite (PFILE_OBJECT FileObject,
1069 PMDL Mdl,
1070 PLARGE_INTEGER Offset,
1071 PKEVENT Event,
1072 PIO_STATUS_BLOCK StatusBlock);
1073
1074 struct _EPROCESS* STDCALL IoThreadToProcess (struct _ETHREAD* Thread);
1075 VOID
1076 STDCALL
1077 IoUnregisterFileSystem (
1078 IN PDEVICE_OBJECT DeviceObject
1079 );
1080 #if (_WIN32_WINNT >= 0x0400)
1081 VOID
1082 STDCALL
1083 IoUnregisterFsRegistrationChange (
1084 IN PDRIVER_OBJECT DriverObject,
1085 IN PFSDNOTIFICATIONPROC FSDNotificationProc
1086 );
1087 #endif // (_WIN32_WINNT >= 0x0400)
1088 VOID
1089 STDCALL
1090 IoUnregisterShutdownNotification (
1091 IN PDEVICE_OBJECT DeviceObject
1092 );
1093 VOID
1094 STDCALL
1095 IoUpdateShareAccess (
1096 IN PFILE_OBJECT FileObject,
1097 IN PSHARE_ACCESS ShareAccess
1098 );
1099 NTSTATUS
1100 STDCALL
1101 IoVerifyVolume (
1102 IN PDEVICE_OBJECT DeviceObject,
1103 IN BOOLEAN AllowRawMount
1104 );
1105 VOID
1106 STDCALL
1107 IoWriteErrorLogEntry (
1108 PVOID ElEntry
1109 );
1110 /*
1111 * FUNCTION: Sends an irp to the next lower driver
1112 */
1113 NTSTATUS
1114 FASTCALL
1115 IofCallDriver (
1116 PDEVICE_OBJECT DeviceObject,
1117 PIRP Irp
1118 );
1119 /*
1120 * FUNCTION: Indicates the caller has finished all processing for a given
1121 * I/O request and is returning the given IRP to the I/O manager
1122 * ARGUMENTS:
1123 * Irp = Irp to be cancelled
1124 * PriorityBoost = Increment by which to boost the priority of the
1125 * thread making the request
1126 */
1127 VOID
1128 FASTCALL
1129 IofCompleteRequest (
1130 PIRP Irp,
1131 CCHAR PriorityBoost
1132 );
1133
1134 /* --- EXPORTED BY HAL --- */
1135
1136 VOID
1137 STDCALL
1138 IoAssignDriveLetters (
1139 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1140 IN PSTRING NtDeviceName,
1141 OUT PUCHAR NtSystemPath,
1142 OUT PSTRING NtSystemPathString
1143 );
1144
1145 BOOLEAN
1146 STDCALL
1147 IoFlushAdapterBuffers (
1148 PADAPTER_OBJECT AdapterObject,
1149 PMDL Mdl,
1150 PVOID MapRegisterBase,
1151 PVOID CurrentVa,
1152 ULONG Length,
1153 BOOLEAN WriteToDevice
1154 );
1155
1156 VOID
1157 STDCALL
1158 IoFreeAdapterChannel (
1159 PADAPTER_OBJECT AdapterObject
1160 );
1161
1162 VOID
1163 STDCALL
1164 IoFreeMapRegisters (
1165 PADAPTER_OBJECT AdapterObject,
1166 PVOID MapRegisterBase,
1167 ULONG NumberOfMapRegisters
1168 );
1169
1170 PHYSICAL_ADDRESS
1171 STDCALL
1172 IoMapTransfer (
1173 PADAPTER_OBJECT AdapterObject,
1174 PMDL Mdl,
1175 PVOID MapRegisterBase,
1176 PVOID CurrentVa,
1177 PULONG Length,
1178 BOOLEAN WriteToDevice
1179 );
1180
1181 NTSTATUS
1182 STDCALL
1183 IoReadPartitionTable (
1184 PDEVICE_OBJECT DeviceObject,
1185 ULONG SectorSize,
1186 BOOLEAN ReturnedRecognizedPartitions,
1187 PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
1188 );
1189
1190 NTSTATUS
1191 STDCALL
1192 IoSetPartitionInformation (
1193 PDEVICE_OBJECT DeviceObject,
1194 ULONG SectorSize,
1195 ULONG PartitionNumber,
1196 ULONG PartitionType
1197 );
1198
1199 NTSTATUS
1200 STDCALL
1201 IoWritePartitionTable (
1202 PDEVICE_OBJECT DeviceObject,
1203 ULONG SectorSize,
1204 ULONG SectorsPerTrack,
1205 ULONG NumberOfHeads,
1206 PDRIVE_LAYOUT_INFORMATION PartitionBuffer
1207 );
1208
1209
1210 /* --- --- --- INTERNAL or REACTOS ONLY --- --- --- */
1211
1212 /*
1213 * FUNCTION: Registers the driver with WMI
1214 * ARGUMENTS:
1215 * DeviceObject = Device to register
1216 * Action = Action to take
1217 * RETURNS: Status (?)
1218 */
1219 /*
1220 NTSTATUS
1221 IoWMIRegistrationControl (
1222 PDEVICE_OBJECT DeviceObject,
1223 WMIREGACTION Action);
1224 */
1225
1226 BOOLEAN
1227 IoIsTotalDeviceFailure (
1228 NTSTATUS Status
1229 );
1230
1231
1232 #endif /* ndef _INCLUDE_DDK_IOFUNCS_H */