Added prototype for IoInitializeWorkerThreads, possibly temporary.
[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.33 2002/09/08 10:47:44 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
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 VOID
828 STDCALL
829 IoRaiseHardError (
830 PIRP Irp,
831 PVPB Vpb,
832 PDEVICE_OBJECT RealDeviceObject
833 );
834 BOOLEAN
835 STDCALL
836 IoRaiseInformationalHardError (
837 NTSTATUS ErrorStatus,
838 PUNICODE_STRING String,
839 struct _KTHREAD* Thread
840 );
841 VOID
842 STDCALL
843 IoRegisterDriverReinitialization (
844 PDRIVER_OBJECT DriverObject,
845 PDRIVER_REINITIALIZE ReinitRoutine,
846 PVOID Context
847 );
848 VOID
849 STDCALL
850 IoRegisterFileSystem (
851 PDEVICE_OBJECT DeviceObject
852 );
853 #if (_WIN32_WINNT >= 0x0400)
854 NTSTATUS
855 STDCALL
856 IoRegisterFsRegistrationChange (
857 IN PDRIVER_OBJECT DriverObject,
858 IN PFSDNOTIFICATIONPROC FSDNotificationProc
859 );
860 #endif // (_WIN32_WINNT >= 0x0400)
861 NTSTATUS
862 STDCALL
863 IoRegisterShutdownNotification (
864 PDEVICE_OBJECT DeviceObject
865 );
866 VOID
867 STDCALL
868 IoReleaseCancelSpinLock (
869 IN KIRQL Irql
870 );
871 VOID
872 STDCALL
873 IoReleaseVpbSpinLock (
874 IN KIRQL Irql
875 );
876 VOID
877 STDCALL
878 IoRemoveShareAccess (
879 PFILE_OBJECT FileObject,
880 PSHARE_ACCESS ShareAccess
881 );
882 NTSTATUS
883 STDCALL
884 IoReportHalResourceUsage (
885 IN PUNICODE_STRING HalDescription,
886 IN PCM_RESOURCE_LIST RawList,
887 IN PCM_RESOURCE_LIST TranslatedList,
888 IN ULONG ListSize
889 );
890 NTSTATUS
891 STDCALL
892 IoReportResourceUsage (
893 PUNICODE_STRING DriverClassName,
894 PDRIVER_OBJECT DriverObject,
895 PCM_RESOURCE_LIST DriverList,
896 ULONG DriverListSize,
897 PDEVICE_OBJECT DeviceObject,
898 PCM_RESOURCE_LIST DeviceList,
899 ULONG DeviceListSize,
900 BOOLEAN OverrideConflict,
901 PBOOLEAN ConflictDetected
902 );
903
904 #define IoRequestDpc(DeviceObject,Irp,Context) \
905 (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
906
907 #define IoSetCancelRoutine(Irp,NewCancelRoutine) \
908 ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
909 (ULONG)(NewCancelRoutine)));
910
911 #define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
912 { \
913 PIO_STACK_LOCATION param; \
914 assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
915 param = IoGetNextIrpStackLocation((Irp)); \
916 param->CompletionRoutine=(Routine); \
917 param->CompletionContext=(Context); \
918 param->Control = 0; \
919 if ((Success)) \
920 param->Control = SL_INVOKE_ON_SUCCESS; \
921 if ((Error)) \
922 param->Control |= SL_INVOKE_ON_ERROR; \
923 if ((Cancel)) \
924 param->Control |= SL_INVOKE_ON_CANCEL; \
925 }
926
927 VOID STDCALL
928 IoSetDeviceToVerify (IN struct _ETHREAD* Thread,
929 IN PDEVICE_OBJECT DeviceObject);
930 VOID
931 STDCALL
932 IoSetHardErrorOrVerifyDevice (
933 IN PIRP Irp,
934 IN PDEVICE_OBJECT DeviceObject
935 );
936 NTSTATUS
937 STDCALL
938 IoSetInformation (
939 IN PFILE_OBJECT FileObject,
940 IN FILE_INFORMATION_CLASS FileInformationClass,
941 IN ULONG Length,
942 OUT PVOID FileInformation
943 );
944
945 #define IoSetNextIrpStackLocation(Irp) \
946 { \
947 (Irp)->CurrentLocation--; \
948 (Irp)->Tail.Overlay.CurrentStackLocation--; \
949 }
950
951 VOID
952 STDCALL
953 IoSetShareAccess (
954 ACCESS_MASK DesiredAccess,
955 ULONG DesiredShareAccess,
956 PFILE_OBJECT FileObject,
957 PSHARE_ACCESS ShareAccess
958 );
959 BOOLEAN
960 STDCALL
961 IoSetThreadHardErrorMode (
962 IN BOOLEAN HardErrorEnabled
963 );
964 VOID
965 STDCALL
966 IoSetTopLevelIrp (
967 IN PIRP Irp
968 );
969
970 /*
971 * FUNCTION: Determines the size of an IRP
972 * ARGUMENTS:
973 * StackSize = number of stack locations in the IRP
974 * RETURNS: The size of the IRP in bytes
975 USHORT
976 IoSizeOfIrp (CCHAR StackSize)
977 */
978 #define IoSizeOfIrp(StackSize) \
979 ((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
980
981 /* original macro */
982 /*
983 #define IoSizeOfIrp(StackSize) \
984 ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
985 */
986
987 /*
988 * FUNCTION: Dequeues the next IRP from the device's associated queue and
989 * calls its StartIo routine
990 * ARGUMENTS:
991 * DeviceObject = Device object
992 * Cancelable = True if IRPs in the queue can be cancelled
993 */
994 VOID
995 STDCALL
996 IoStartNextPacket (
997 PDEVICE_OBJECT DeviceObject,
998 BOOLEAN Cancelable
999 );
1000 VOID
1001 STDCALL
1002 IoStartNextPacketByKey (
1003 PDEVICE_OBJECT DeviceObject,
1004 BOOLEAN Cancelable,
1005 ULONG Key
1006 );
1007 /*
1008 * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
1009 * the device is busy
1010 * ARGUMENTS:
1011 * DeviceObject = Device to pass the IRP to
1012 * Irp = Irp to be processed
1013 * Key = Optional value for where to insert the IRP
1014 * CancelFunction = Entry point for a driver supplied cancel function
1015 */
1016 VOID
1017 STDCALL
1018 IoStartPacket (
1019 PDEVICE_OBJECT DeviceObject,
1020 PIRP Irp,
1021 PULONG Key,
1022 PDRIVER_CANCEL CancelFunction
1023 );
1024 VOID
1025 STDCALL
1026 IoStartTimer (
1027 PDEVICE_OBJECT DeviceObject
1028 );
1029 VOID
1030 STDCALL
1031 IoStopTimer (
1032 PDEVICE_OBJECT DeviceObject
1033 );
1034
1035 NTSTATUS STDCALL
1036 IoPageRead(PFILE_OBJECT FileObject,
1037 PMDL Mdl,
1038 PLARGE_INTEGER Offset,
1039 PKEVENT Event,
1040 PIO_STATUS_BLOCK StatusBlock);
1041
1042 NTSTATUS STDCALL
1043 IoSynchronousPageWrite (PFILE_OBJECT FileObject,
1044 PMDL Mdl,
1045 PLARGE_INTEGER Offset,
1046 PKEVENT Event,
1047 PIO_STATUS_BLOCK StatusBlock);
1048
1049 struct _EPROCESS* STDCALL IoThreadToProcess (struct _ETHREAD* Thread);
1050 VOID
1051 STDCALL
1052 IoUnregisterFileSystem (
1053 IN PDEVICE_OBJECT DeviceObject
1054 );
1055 #if (_WIN32_WINNT >= 0x0400)
1056 VOID
1057 STDCALL
1058 IoUnregisterFsRegistrationChange (
1059 IN PDRIVER_OBJECT DriverObject,
1060 IN PFSDNOTIFICATIONPROC FSDNotificationProc
1061 );
1062 #endif // (_WIN32_WINNT >= 0x0400)
1063 VOID
1064 STDCALL
1065 IoUnregisterShutdownNotification (
1066 IN PDEVICE_OBJECT DeviceObject
1067 );
1068 VOID
1069 STDCALL
1070 IoUpdateShareAccess (
1071 IN PFILE_OBJECT FileObject,
1072 IN PSHARE_ACCESS ShareAccess
1073 );
1074 NTSTATUS
1075 STDCALL
1076 IoVerifyVolume (
1077 IN PDEVICE_OBJECT DeviceObject,
1078 IN BOOLEAN AllowRawMount
1079 );
1080 VOID
1081 STDCALL
1082 IoWriteErrorLogEntry (
1083 PVOID ElEntry
1084 );
1085 /*
1086 * FUNCTION: Sends an irp to the next lower driver
1087 */
1088 NTSTATUS
1089 FASTCALL
1090 IofCallDriver (
1091 PDEVICE_OBJECT DeviceObject,
1092 PIRP Irp
1093 );
1094 /*
1095 * FUNCTION: Indicates the caller has finished all processing for a given
1096 * I/O request and is returning the given IRP to the I/O manager
1097 * ARGUMENTS:
1098 * Irp = Irp to be cancelled
1099 * PriorityBoost = Increment by which to boost the priority of the
1100 * thread making the request
1101 */
1102 VOID
1103 FASTCALL
1104 IofCompleteRequest (
1105 PIRP Irp,
1106 CCHAR PriorityBoost
1107 );
1108
1109 /* --- EXPORTED BY HAL --- */
1110
1111 VOID
1112 STDCALL
1113 IoAssignDriveLetters (
1114 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1115 IN PSTRING NtDeviceName,
1116 OUT PUCHAR NtSystemPath,
1117 OUT PSTRING NtSystemPathString
1118 );
1119
1120 BOOLEAN
1121 STDCALL
1122 IoFlushAdapterBuffers (
1123 PADAPTER_OBJECT AdapterObject,
1124 PMDL Mdl,
1125 PVOID MapRegisterBase,
1126 PVOID CurrentVa,
1127 ULONG Length,
1128 BOOLEAN WriteToDevice
1129 );
1130
1131 VOID
1132 STDCALL
1133 IoFreeAdapterChannel (
1134 PADAPTER_OBJECT AdapterObject
1135 );
1136
1137 VOID
1138 STDCALL
1139 IoFreeMapRegisters (
1140 PADAPTER_OBJECT AdapterObject,
1141 PVOID MapRegisterBase,
1142 ULONG NumberOfMapRegisters
1143 );
1144
1145 PHYSICAL_ADDRESS
1146 STDCALL
1147 IoMapTransfer (
1148 PADAPTER_OBJECT AdapterObject,
1149 PMDL Mdl,
1150 PVOID MapRegisterBase,
1151 PVOID CurrentVa,
1152 PULONG Length,
1153 BOOLEAN WriteToDevice
1154 );
1155
1156 NTSTATUS
1157 STDCALL
1158 IoReadPartitionTable (
1159 PDEVICE_OBJECT DeviceObject,
1160 ULONG SectorSize,
1161 BOOLEAN ReturnedRecognizedPartitions,
1162 PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
1163 );
1164
1165 NTSTATUS
1166 STDCALL
1167 IoSetPartitionInformation (
1168 PDEVICE_OBJECT DeviceObject,
1169 ULONG SectorSize,
1170 ULONG PartitionNumber,
1171 ULONG PartitionType
1172 );
1173
1174 NTSTATUS
1175 STDCALL
1176 IoWritePartitionTable (
1177 PDEVICE_OBJECT DeviceObject,
1178 ULONG SectorSize,
1179 ULONG SectorsPerTrack,
1180 ULONG NumberOfHeads,
1181 PDRIVE_LAYOUT_INFORMATION PartitionBuffer
1182 );
1183
1184
1185 /* --- --- --- INTERNAL or REACTOS ONLY --- --- --- */
1186
1187 /*
1188 * FUNCTION: Registers the driver with WMI
1189 * ARGUMENTS:
1190 * DeviceObject = Device to register
1191 * Action = Action to take
1192 * RETURNS: Status (?)
1193 */
1194 /*
1195 NTSTATUS
1196 IoWMIRegistrationControl (
1197 PDEVICE_OBJECT DeviceObject,
1198 WMIREGACTION Action);
1199 */
1200
1201 BOOLEAN
1202 IoIsTotalDeviceFailure (
1203 NTSTATUS Status
1204 );
1205
1206
1207 #endif /* ndef _INCLUDE_DDK_IOFUNCS_H */