5ef584790a9467cbaf03a0c78754c1dff2e13be7
[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.23 2001/05/01 23:08:17 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 IoCopyCurrentIrpStackLocationToNext(Irp) { \
629 PIO_STACK_LOCATION IrpSp; \
630 PIO_STACK_LOCATION NextIrpSp; \
631 IrpSp = IoGetCurrentIrpStackLocation((Irp)); \
632 NextIrpSp = IoGetNextIrpStackLocation((Irp)); \
633 RtlCopyMemory(NextIrpSp, IrpSp, \
634 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
635 NextIrpSp->Control = 0; }
636
637 struct _EPROCESS*
638 STDCALL
639 IoGetCurrentProcess (
640 VOID
641 );
642 NTSTATUS
643 STDCALL
644 IoGetDeviceObjectPointer (
645 PUNICODE_STRING ObjectName,
646 ACCESS_MASK DesiredAccess,
647 PFILE_OBJECT * FileObject,
648 PDEVICE_OBJECT * DeviceObject
649 );
650 PDEVICE_OBJECT
651 STDCALL
652 IoGetDeviceToVerify (
653 struct _ETHREAD* Thread
654 );
655 PGENERIC_MAPPING
656 STDCALL
657 IoGetFileObjectGenericMapping (
658 VOID
659 );
660
661 #define IoGetFunctionCodeFromCtlCode(ControlCode) \
662 ((ControlCode >> 2) & 0x00000FFF)
663
664 PVOID
665 STDCALL
666 IoGetInitialStack (
667 VOID
668 );
669
670 /*
671 * FUNCTION: Gives a higher level driver access to the next lower driver's
672 * I/O stack location
673 * ARGUMENTS:
674 * Irp = points to the irp
675 * RETURNS: A pointer to the stack location
676 *
677 * NOTES:
678 * PIO_STACK_LOCATION
679 * IoGetNextIrpStackLocation (PIRP Irp)
680 */
681 #define IoGetNextIrpStackLocation(Irp) \
682 (&(Irp)->Stack[(Irp)->CurrentLocation-1])
683
684 /* original macro */
685 /*
686 #define IoGetNextIrpStackLocation(Irp) \
687 ((Irp)->Tail.Overlay.CurrentStackLocation-1)
688 */
689
690 PDEVICE_OBJECT
691 STDCALL
692 IoGetRelatedDeviceObject (
693 PFILE_OBJECT FileObject
694 );
695 struct _EPROCESS*
696 STDCALL
697 IoGetRequestorProcess (
698 IN PIRP Irp
699 );
700
701 VOID
702 STDCALL
703 IoGetStackLimits (
704 PULONG LowLimit,
705 PULONG HighLimit
706 );
707
708 PIRP
709 STDCALL
710 IoGetTopLevelIrp (
711 VOID
712 );
713
714 #define IoInitializeDpcRequest(DeviceObject,DpcRoutine) \
715 (KeInitializeDpc(&(DeviceObject)->Dpc, \
716 (PKDEFERRED_ROUTINE)(DpcRoutine), \
717 (DeviceObject)))
718
719 /*
720 * FUNCTION: Initalizes an irp allocated by the caller
721 * ARGUMENTS:
722 * Irp = IRP to initalize
723 * PacketSize = Size in bytes of the IRP
724 * StackSize = Number of stack locations in the IRP
725 */
726 VOID
727 STDCALL
728 IoInitializeIrp (
729 PIRP Irp,
730 USHORT PacketSize,
731 CCHAR StackSize
732 );
733 NTSTATUS
734 STDCALL
735 IoInitializeTimer (
736 PDEVICE_OBJECT DeviceObject,
737 PIO_TIMER_ROUTINE TimerRoutine,
738 PVOID Context
739 );
740
741 /*
742 * NOTES:
743 * BOOLEAN
744 * IsErrorUserInduced (NTSTATUS Status)
745 */
746 #define IoIsErrorUserInduced(Status) \
747 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
748 ((Status) == STATUS_IO_TIMEOUT) || \
749 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
750 ((Status) == STATUS_NO_MEDIA_IN_DRIVE) || \
751 ((Status) == STATUS_VERIFY_REQUIRED) || \
752 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
753 ((Status) == STATUS_WRONG_VOLUME)))
754
755 BOOLEAN
756 STDCALL
757 IoIsOperationSynchronous (
758 IN PIRP Irp
759 );
760 BOOLEAN
761 STDCALL
762 IoIsSystemThread (
763 PVOID Unknown0
764 );
765 PIRP
766 STDCALL
767 IoMakeAssociatedIrp (
768 PIRP Irp,
769 CCHAR StackSize
770 );
771
772 /*
773 * FUNCTION: Marks the specified irp, indicating further processing will
774 * be required by other driver routines
775 * ARGUMENTS:
776 * Irp = Irp to mark
777 * NOTES:
778 * VOID
779 * IoMarkIrpPending (PIRP Irp)
780 */
781 #define IoMarkIrpPending(Irp) \
782 (IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED)
783
784
785 NTSTATUS
786 STDCALL
787 IoOpenDeviceInstanceKey (
788 DWORD Unknown0,
789 DWORD Unknown1,
790 DWORD Unknown2,
791 DWORD Unknown3,
792 DWORD Unknown4
793 );
794 NTSTATUS
795 STDCALL
796 IoQueryDeviceDescription (
797 PINTERFACE_TYPE BusType,
798 PULONG BusNumber,
799 PCONFIGURATION_TYPE ControllerType,
800 PULONG ControllerNumber,
801 PCONFIGURATION_TYPE PeripheralType,
802 PULONG PeripheralNumber,
803 PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
804 PVOID Context
805 );
806 DWORD
807 STDCALL
808 IoQueryDeviceEnumInfo (
809 DWORD Unknown0,
810 DWORD Unknown1
811 );
812 // IoQueryFileInformation: confirmed - Undocumented because it does not require a valid file handle
813 NTSTATUS
814 STDCALL
815 IoQueryFileInformation (
816 IN PFILE_OBJECT FileObject,
817 IN FILE_INFORMATION_CLASS FileInformationClass,
818 IN ULONG Length,
819 OUT PVOID FileInformation,
820 OUT PULONG ReturnedLength
821 );
822 NTSTATUS
823 STDCALL
824 IoQueryVolumeInformation (
825 IN PFILE_OBJECT FileObject,
826 IN FS_INFORMATION_CLASS FsInformationClass,
827 IN ULONG Length,
828 OUT PVOID FsInformation,
829 OUT PULONG ReturnedLength
830 );
831 VOID
832 STDCALL
833 IoQueueThreadIrp (
834 PVOID Unknown0
835 );
836 VOID
837 STDCALL
838 IoRaiseHardError (
839 PIRP Irp,
840 PVPB Vpb,
841 PDEVICE_OBJECT RealDeviceObject
842 );
843 BOOLEAN
844 STDCALL
845 IoRaiseInformationalHardError (
846 NTSTATUS ErrorStatus,
847 PUNICODE_STRING String,
848 struct _KTHREAD* Thread
849 );
850 VOID
851 STDCALL
852 IoRegisterDriverReinitialization (
853 PDRIVER_OBJECT DriverObject,
854 PDRIVER_REINITIALIZE ReinitRoutine,
855 PVOID Context
856 );
857 VOID
858 STDCALL
859 IoRegisterFileSystem (
860 PDEVICE_OBJECT DeviceObject
861 );
862 #if (_WIN32_WINNT >= 0x0400)
863 NTSTATUS
864 STDCALL
865 IoRegisterFsRegistrationChange (
866 IN PDRIVER_OBJECT DriverObject,
867 IN PFSDNOTIFICATIONPROC FSDNotificationProc
868 );
869 #endif // (_WIN32_WINNT >= 0x0400)
870 NTSTATUS
871 STDCALL
872 IoRegisterShutdownNotification (
873 PDEVICE_OBJECT DeviceObject
874 );
875 VOID
876 STDCALL
877 IoReleaseCancelSpinLock (
878 IN KIRQL Irql
879 );
880 VOID
881 STDCALL
882 IoReleaseVpbSpinLock (
883 IN KIRQL Irql
884 );
885 VOID
886 STDCALL
887 IoRemoveShareAccess (
888 PFILE_OBJECT FileObject,
889 PSHARE_ACCESS ShareAccess
890 );
891 NTSTATUS
892 STDCALL
893 IoReportHalResourceUsage (
894 PUNICODE_STRING HalDescription,
895 ULONG Unknown1,
896 ULONG Unknown2,
897 ULONG Unknown3
898 );
899 NTSTATUS
900 STDCALL
901 IoReportResourceUsage (
902 PUNICODE_STRING DriverClassName,
903 PDRIVER_OBJECT DriverObject,
904 PCM_RESOURCE_LIST DriverList,
905 ULONG DriverListSize,
906 PDEVICE_OBJECT DeviceObject,
907 PCM_RESOURCE_LIST DeviceList,
908 ULONG DeviceListSize,
909 BOOLEAN OverrideConflict,
910 PBOOLEAN ConflictDetected
911 );
912
913 #define IoRequestDpc(DeviceObject,Irp,Context) \
914 (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
915
916 #define IoSetCancelRoutine(Irp,NewCancelRoutine) \
917 ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
918 (ULONG)(NewCancelRoutine)));
919
920 #define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
921 { \
922 PIO_STACK_LOCATION param; \
923 assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
924 param = IoGetNextIrpStackLocation((Irp)); \
925 param->CompletionRoutine=(Routine); \
926 param->CompletionContext=(Context); \
927 param->Control = 0; \
928 if ((Success)) \
929 param->Control = SL_INVOKE_ON_SUCCESS; \
930 if ((Error)) \
931 param->Control |= SL_INVOKE_ON_ERROR; \
932 if ((Cancel)) \
933 param->Control |= SL_INVOKE_ON_CANCEL; \
934 }
935
936 VOID STDCALL
937 IoSetDeviceToVerify (IN struct _ETHREAD* Thread,
938 IN PDEVICE_OBJECT DeviceObject);
939 VOID
940 STDCALL
941 IoSetHardErrorOrVerifyDevice (
942 IN PIRP Irp,
943 IN PDEVICE_OBJECT DeviceObject
944 );
945 NTSTATUS
946 STDCALL
947 IoSetInformation (
948 IN PFILE_OBJECT FileObject,
949 IN FILE_INFORMATION_CLASS FileInformationClass,
950 IN ULONG Length,
951 OUT PVOID FileInformation
952 );
953
954 #define IoSetNextIrpStackLocation(Irp) \
955 { \
956 (Irp)->CurrentLocation--; \
957 (Irp)->Tail.Overlay.CurrentStackLocation--; \
958 }
959
960 VOID
961 STDCALL
962 IoSetShareAccess (
963 ACCESS_MASK DesiredAccess,
964 ULONG DesiredShareAccess,
965 PFILE_OBJECT FileObject,
966 PSHARE_ACCESS ShareAccess
967 );
968 BOOLEAN
969 STDCALL
970 IoSetThreadHardErrorMode (
971 IN BOOLEAN HardErrorEnabled
972 );
973 VOID
974 STDCALL
975 IoSetTopLevelIrp (
976 IN PIRP Irp
977 );
978
979 /*
980 * FUNCTION: Determines the size of an IRP
981 * ARGUMENTS:
982 * StackSize = number of stack locations in the IRP
983 * RETURNS: The size of the IRP in bytes
984 USHORT
985 IoSizeOfIrp (CCHAR StackSize)
986 */
987 #define IoSizeOfIrp(StackSize) \
988 ((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
989
990 /* original macro */
991 /*
992 #define IoSizeOfIrp(StackSize) \
993 ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
994 */
995
996 /*
997 * FUNCTION: Dequeues the next IRP from the device's associated queue and
998 * calls its StartIo routine
999 * ARGUMENTS:
1000 * DeviceObject = Device object
1001 * Cancelable = True if IRPs in the queue can be cancelled
1002 */
1003 VOID
1004 STDCALL
1005 IoStartNextPacket (
1006 PDEVICE_OBJECT DeviceObject,
1007 BOOLEAN Cancelable
1008 );
1009 VOID
1010 STDCALL
1011 IoStartNextPacketByKey (
1012 PDEVICE_OBJECT DeviceObject,
1013 BOOLEAN Cancelable,
1014 ULONG Key
1015 );
1016 /*
1017 * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
1018 * the device is busy
1019 * ARGUMENTS:
1020 * DeviceObject = Device to pass the IRP to
1021 * Irp = Irp to be processed
1022 * Key = Optional value for where to insert the IRP
1023 * CancelFunction = Entry point for a driver supplied cancel function
1024 */
1025 VOID
1026 STDCALL
1027 IoStartPacket (
1028 PDEVICE_OBJECT DeviceObject,
1029 PIRP Irp,
1030 PULONG Key,
1031 PDRIVER_CANCEL CancelFunction
1032 );
1033 VOID
1034 STDCALL
1035 IoStartTimer (
1036 PDEVICE_OBJECT DeviceObject
1037 );
1038 VOID
1039 STDCALL
1040 IoStopTimer (
1041 PDEVICE_OBJECT DeviceObject
1042 );
1043 NTSTATUS
1044 STDCALL
1045 IoSynchronousPageWrite (
1046 DWORD Unknown0,
1047 DWORD Unknown1,
1048 DWORD Unknown2,
1049 DWORD Unknown3,
1050 DWORD Unknown4
1051 );
1052 struct _EPROCESS* STDCALL IoThreadToProcess (struct _ETHREAD* Thread);
1053 VOID
1054 STDCALL
1055 IoUnregisterFileSystem (
1056 IN PDEVICE_OBJECT DeviceObject
1057 );
1058 #if (_WIN32_WINNT >= 0x0400)
1059 VOID
1060 STDCALL
1061 IoUnregisterFsRegistrationChange (
1062 DWORD Unknown0,
1063 DWORD Unknown1
1064 );
1065 #endif // (_WIN32_WINNT >= 0x0400)
1066 VOID
1067 STDCALL
1068 IoUnregisterShutdownNotification (
1069 PDEVICE_OBJECT DeviceObject
1070 );
1071 VOID
1072 STDCALL
1073 IoUpdateShareAccess (
1074 IN PFILE_OBJECT FileObject,
1075 IN PSHARE_ACCESS ShareAccess
1076 );
1077 NTSTATUS
1078 STDCALL
1079 IoVerifyVolume (
1080 IN PDEVICE_OBJECT DeviceObject,
1081 IN BOOLEAN AllowRawMount
1082 );
1083 VOID
1084 STDCALL
1085 IoWriteErrorLogEntry (
1086 PVOID ElEntry
1087 );
1088 /*
1089 * FUNCTION: Sends an irp to the next lower driver
1090 */
1091 NTSTATUS
1092 FASTCALL
1093 IofCallDriver (
1094 PDEVICE_OBJECT DeviceObject,
1095 PIRP Irp
1096 );
1097 /*
1098 * FUNCTION: Indicates the caller has finished all processing for a given
1099 * I/O request and is returning the given IRP to the I/O manager
1100 * ARGUMENTS:
1101 * Irp = Irp to be cancelled
1102 * PriorityBoost = Increment by which to boost the priority of the
1103 * thread making the request
1104 */
1105 VOID
1106 FASTCALL
1107 IofCompleteRequest (
1108 PIRP Irp,
1109 CCHAR PriorityBoost
1110 );
1111
1112 /* --- EXPORTED BY HAL --- */
1113
1114 VOID
1115 STDCALL
1116 IoAssignDriveLetters (
1117 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1118 IN PSTRING NtDeviceName,
1119 OUT PUCHAR NtSystemPath,
1120 OUT PSTRING NtSystemPathString
1121 );
1122
1123 BOOLEAN
1124 STDCALL
1125 IoFlushAdapterBuffers (
1126 PADAPTER_OBJECT AdapterObject,
1127 PMDL Mdl,
1128 PVOID MapRegisterBase,
1129 PVOID CurrentVa,
1130 ULONG Length,
1131 BOOLEAN WriteToDevice
1132 );
1133
1134 VOID
1135 STDCALL
1136 IoFreeAdapterChannel (
1137 PADAPTER_OBJECT AdapterObject
1138 );
1139
1140 VOID
1141 STDCALL
1142 IoFreeMapRegisters (
1143 PADAPTER_OBJECT AdapterObject,
1144 PVOID MapRegisterBase,
1145 ULONG NumberOfMapRegisters
1146 );
1147
1148 PHYSICAL_ADDRESS
1149 STDCALL
1150 IoMapTransfer (
1151 PADAPTER_OBJECT AdapterObject,
1152 PMDL Mdl,
1153 PVOID MapRegisterBase,
1154 PVOID CurrentVa,
1155 PULONG Length,
1156 BOOLEAN WriteToDevice
1157 );
1158
1159 NTSTATUS
1160 STDCALL
1161 IoReadPartitionTable (
1162 PDEVICE_OBJECT DeviceObject,
1163 ULONG SectorSize,
1164 BOOLEAN ReturnedRecognizedPartitions,
1165 PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
1166 );
1167
1168 NTSTATUS
1169 STDCALL
1170 IoSetPartitionInformation (
1171 PDEVICE_OBJECT DeviceObject,
1172 ULONG SectorSize,
1173 ULONG PartitionNumber,
1174 ULONG PartitionType
1175 );
1176
1177 NTSTATUS
1178 STDCALL
1179 IoWritePartitionTable (
1180 PDEVICE_OBJECT DeviceObject,
1181 ULONG SectorSize,
1182 ULONG SectorsPerTrack,
1183 ULONG NumberOfHeads,
1184 PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
1185 );
1186
1187
1188 /* --- --- --- INTERNAL or REACTOS ONLY --- --- --- */
1189
1190 /*
1191 * FUNCTION: Registers the driver with WMI
1192 * ARGUMENTS:
1193 * DeviceObject = Device to register
1194 * Action = Action to take
1195 * RETURNS: Status (?)
1196 */
1197 /*
1198 NTSTATUS
1199 IoWMIRegistrationControl (
1200 PDEVICE_OBJECT DeviceObject,
1201 WMIREGACTION Action);
1202 */
1203
1204 BOOLEAN
1205 IoIsTotalDeviceFailure (
1206 NTSTATUS Status
1207 );
1208
1209
1210 #endif /* ndef _INCLUDE_DDK_IOFUNCS_H */