Added stubs for missing partition functions
[reactos.git] / reactos / include / ddk / iofuncs.h
index aadf762..3482c49 100644 (file)
@@ -1,57 +1,70 @@
-/* $Id: iofuncs.h,v 1.5 1999/12/26 20:21:02 ea Exp $ */
-/* IO MANAGER ***************************************************************/
-
-BOOLEAN
-IoRaiseInformationalHardError (
-       NTSTATUS        ErrorStatus,
-       PUNICODE_STRING String,
-       PKTHREAD        Thread
-       );
-
-
-/*
- * FUNCTION: Registers the driver with WMI
- * ARGUMENTS:
- *          DeviceObject = Device to register
- *          Action = Action to take
- * RETURNS: Status (?)
- */
-//NTSTATUS IoWMIRegistrationControl(DeviceObject, WMIREGACTION Action);
-/*
- * FUNCTION: Synchronizes cancelable-state transistions for IRPs in a 
- * multiprocessor-safe way
- * ARGUMENTS:
- *          Irpl = Variable to store the current IRQ level 
+#ifndef _INCLUDE_DDK_IOFUNCS_H
+#define _INCLUDE_DDK_IOFUNCS_H
+/* $Id: iofuncs.h,v 1.24 2001/06/08 15:06:51 ekohl Exp $ */
+
+/* --- EXPORTED BY NTOSKRNL --- */
+
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAcquireCancelSpinLock@4
+ *     
+ * DESCRIPTION
+ *     Synchronizes cancelable-state transistions for IRPs in a 
+ *     multiprocessor-safe way.
+ *     
+ * ARGUMENTS
+ *     Irpl
+ *             Variable to store the current IRQ level.
+ *
+ * RETURN VALUE
+ *     None.
+ *
+ * REVISIONS
+ *
  */
 VOID
+STDCALL
 IoAcquireCancelSpinLock (
        PKIRQL  Irpl
        );
-
-typedef
-IO_ALLOCATION_ACTION
-(*PDRIVER_CONTROL) (
-       PDEVICE_OBJECT  DeviceObject,
-       PIRP            irp,
-       PVOID           MapRegisterBase,
-       PVOID           Context
+VOID
+STDCALL
+IoAcquireVpbSpinLock (
+       PKIRQL  Irpl
        );
-
-/*
- * FUNCTION: Allocates an adaptor object for a DMA operation on the target
- * device
- * ARGUMENTS:
- *         Adaptor = Adapter channel or busmaster adapter to be allocated
- *         DeviceObject = Target device for DMA
- *         NumberOfMapRegisters = Number of map registers
- *         ExecutionRoutine = Routine to be called when the adaptor is 
- *                            available
- *         Context = driver defined contex that will be passed to the
- *                   execution routine
- * RETURNS: Success or failure code
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAllocateAdapterChannel@
+ *     
+ * DESCRIPTION
+ *     Allocates an adaptor object for a DMA operation on the target
+ *     device.
+ *     
+ * ARGUMENTS
+ *     Adaptor
+ *             Adapter channel or busmaster adapter to be allocated;
+ *             
+ *     DeviceObject
+ *             Target device for DMA;
+ *             
+ *     NumberOfMapRegisters
+ *             Number of map registers;
+ *             
+ *     ExecutionRoutine
+ *             Routine to be called when the adaptor is available;
+ *             
+ *     Context
+ *             Driver defined contex that will be passed to the
+ *             execution routine.
+ *             
+ * RETURN VALUE
+ *     Success or failure code.
+ *
+ * REVISIONS
+ *
  */
 NTSTATUS
+STDCALL
 IoAllocateAdapterChannel (
        PADAPTER_OBJECT AdaperObject,
        PDEVICE_OBJECT  DeviceObject,
@@ -59,101 +72,178 @@ IoAllocateAdapterChannel (
        PDRIVER_CONTROL ExecutionRoutine,
        PVOID           Context
        );
-
-/*
- * FUNCTION: Sets up a call to a driver supplied controller object as 
- * soon as it is available
- * ARGUMENTS:
- *        ControllerObject = Driver created controller object
- *        DeviceObject = target device
- *        ExecutionObject = Routine to be called
- *        Context = Driver determined context to be based to the routine
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAllocateController@16
+ *
+ * DESCRIPTION
+ *     Sets up a call to a driver supplied controller object as 
+ *     soon as it is available.
+ *
+ * ARGUMENTS
+ *     ControllerObject
+ *             Driver created controller object;
+ *
+ *     DeviceObject
+ *             Target device;
+ *
+ *     ExecutionObject
+ *             Routine to be called;
+ *
+ *     Context
+ *             Driver determined context to be based to the
+ *             routine.
+ *
+ * RETURN VALUE
+ *     None.
+ *
+ * REVISIONS
+ *
  */
 VOID
+STDCALL
 IoAllocateController (
        PCONTROLLER_OBJECT      ControllerObject,
        PDEVICE_OBJECT          DeviceObject,
        PDRIVER_CONTROL         ExecutionRoutine,
        PVOID                   Context
        );
-
-/*
- * FUNCTION: Allocates an error log packet
- * ARGUMENTS:
- *         IoObject = Object which found the error
- *         EntrySize = Size in bytes of the packet to be allocated
- * RETURNS: On success a pointer to the allocated packet
- *          On failure returns NULL
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAllocateErrorLogEntry@8
+ *     
+ * DESCRIPTION
+ *     Allocates an error log packet.
+ *
+ * ARGUMENTS
+ *     IoObject
+ *             Object which found the error;
+ *             
+ *     EntrySize
+ *             Size in bytes of the packet to be allocated.
+ *
+ * RETURN VALUE
+ *     On success, a pointer to the allocated packet.
+ *     On failure, it returns NULL.
  */
 PVOID
+STDCALL
 IoAllocateErrorLogEntry (
        PVOID   IoObject,
        UCHAR   EntrySize
        );
-
-/*
- * FUNCTION: Allocates an IRP
- * ARGUMENTS:
- *        StackSize = number of stack locations to allocate
- *        ChargeQuota = Who knows
- * RETURNS: On success the allocated IRP
- *          On failure NULL
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAllocateIrp@8
+ *     
+ * DESCRIPTION
+ *     Allocates an IRP.
+ *     
+ * ARGUMENTS
+ *     StackSize
+ *             Number of stack locations to allocate;
+ *             
+ *     ChargeQuota
+ *             Who knows.
+ *             
+ * RETURN VALUE
+ *     On success, the allocated IRP. On failure, NULL.
  */
 PIRP
+STDCALL
 IoAllocateIrp (
        CCHAR   StackSize,
        BOOLEAN ChargeQuota
        );
-
-/*
- * FUNCTION: Allocates an MDL large enough to map the supplied buffer
- * ARGUMENTS:
- *        VirtualAddress = base virtual address of the buffer to be mapped
- *        Length = length of the buffer to be mapped
- *        SecondaryBuffer = Whether the buffer is primary or secondary
- *        ChargeQuota = Charge non-paged pool quota to current thread
- *        Irp = Optional irp to be associated with the MDL
- * RETURNS: On the success the allocated MDL
- *          On failure NULL
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAllocateMdl@20
+ *
+ * DESCRIPTION
+ *     Allocates an MDL large enough to map the supplied buffer.
+ *     
+ * ARGUMENTS
+ *     VirtualAddress
+ *             Base virtual address of the buffer to be mapped;
+ *             
+ *     Length
+ *             Length of the buffer to be mapped;
+ *             
+ *     SecondaryBuffer
+ *             Whether the buffer is primary or secondary;
+ *             
+ *     ChargeQuota
+ *             Charge non-paged pool quota to current thread;
+ *             
+ *     Irp
+ *             Optional irp to be associated with the MDL.
+ *     
+ * RETURN VALUE
+ *     On success, the allocated MDL; on failure, NULL.
  */
 PMDL
+STDCALL
 IoAllocateMdl (
        PVOID   VirtualAddress,
-       ULONG   Length, 
+       ULONG   Length,
        BOOLEAN SecondaryBuffer,
        BOOLEAN ChargeQuota,
        PIRP    Irp
        );
 
-/*
- * FUNCTION: Creates a symbolic link between the ARC name of a physical
- * device and the name of the corresponding device object
- * ARGUMENTS:
- *        ArcName = ARC name of the device
- *        DeviceName = Name of the device object
+/**********************************************************************
+ * NAME                                                        MACRO
+ *     IoAssignArcName
+ *
+ * DESCRIPTION
+ *     Creates a symbolic link between the ARC name of a physical
+ *     device and the name of the corresponding device object
+ *
+ * ARGUMENTS
+ *     ArcName
+ *             ARC name of the device
+ *
+ *     DeviceName
+ *             Name of the device object
+ *
+ * NOTES
+ *     VOID
+ *     IoAssignArcName (
+ *             PUNICODE_STRING ArcName,
+ *             PUNICODE_STRING DeviceName
+ *             );
  */
-VOID
-IoAssignArcName (
-       PUNICODE_STRING ArcName,
-       PUNICODE_STRING DeviceName
-       );
-
-enum
-{
-   IO_NO_INCREMENT,
-};
-   
-/*
- * FUNCTION: Takes a list of requested hardware resources and allocates them
- * ARGUMENTS:
- *        RegisterPath = 
- *        DriverClassName = 
- *        DriverObject = Driver object passed to the DriverEntry routine
- *        DeviceObject = 
- *        RequestedResources = List of resources
- * RETURNS: 
+#define IoAssignArcName(ArcName,DeviceName) \
+       (IoCreateSymbolicLink((ArcName),(DeviceName)))
+
+/**********************************************************************
+ * NAME                                                        EXPORTED
+ *     IoAssignResources@24
+ *
+ * DESCRIPTION
+ *     Takes a list of requested hardware resources and allocates
+ *     them.
+ *
+ * ARGUMENTS
+ *     RegisterPath
+ *             ?
+ *
+ *     DriverClassName
+ *             ?
+ *
+ *     DriverObject
+ *             Driver object passed to the DriverEntry routine;
+ *
+ *     DeviceObject
+ *             ?
+ *
+ *     RequestedResources
+ *             List of resources.
+ *
+ * RETURN VALUE
  */
 NTSTATUS
+STDCALL
 IoAssignResources (
        PUNICODE_STRING                 RegistryPath,
        PUNICODE_STRING                 DriverClassName,
@@ -162,7 +252,6 @@ IoAssignResources (
        PIO_RESOURCE_REQUIREMENTS_LIST  RequestedResources,
        PCM_RESOURCE_LIST               * AllocatedResources
        );
-
 /*
  * FUNCTION: Attaches the callers device object to a named target device
  * ARGUMENTS:
@@ -173,12 +262,12 @@ IoAssignResources (
  * RETURNS: Success or failure code
  */
 NTSTATUS
+STDCALL
 IoAttachDevice (
        PDEVICE_OBJECT  SourceDevice,
        PUNICODE_STRING TargetDevice,
        PDEVICE_OBJECT  * AttachedDevice
        );
-
 /*
  * FUNCTION: Obsolete
  * ARGUMENTS:
@@ -187,11 +276,11 @@ IoAttachDevice (
  * RETURNS: Success or failure code
  */
 NTSTATUS
+STDCALL
 IoAttachDeviceByPointer (
        PDEVICE_OBJECT  SourceDevice,
        PDEVICE_OBJECT  TargetDevice
        );
-
 /*
  * FUNCTION: Attaches the callers device to the highest device in the chain
  * ARGUMENTS:
@@ -201,11 +290,11 @@ IoAttachDeviceByPointer (
  *          On failure NULL
  */
 PDEVICE_OBJECT
+STDCALL
 IoAttachDeviceToDeviceStack (
        PDEVICE_OBJECT  SourceDevice,
        PDEVICE_OBJECT  TargetDevice
        );
-
 /*
  * FUNCTION: Builds a irp to be sent to lower level drivers
  * ARGUMENTS:
@@ -219,6 +308,7 @@ IoAttachDeviceToDeviceStack (
  *          On failure NULL
  */
 PIRP
+STDCALL
 IoBuildAsynchronousFsdRequest (
        ULONG                   MajorFunction,
        PDEVICE_OBJECT          DeviceObject,
@@ -227,7 +317,6 @@ IoBuildAsynchronousFsdRequest (
        PLARGE_INTEGER          StartingOffset,
        PIO_STATUS_BLOCK        IoStatusBlock
        );
-
 /*
  * FUNCTION: Allocates and sets up an IRP for a device control request
  * ARGUMENTS:
@@ -245,6 +334,7 @@ IoBuildAsynchronousFsdRequest (
  * RETURNS: Returns the IRP created
  */
 PIRP
+STDCALL
 IoBuildDeviceIoControlRequest (
        ULONG                   IoControlCode,
        PDEVICE_OBJECT          DeviceObject,
@@ -256,17 +346,16 @@ IoBuildDeviceIoControlRequest (
        PKEVENT                 Event,
        PIO_STATUS_BLOCK        IoStatusBlock
        );
-   
-
 VOID
+STDCALL
 IoBuildPartialMdl (
        PMDL    SourceMdl,
        PMDL    TargetMdl,
        PVOID   VirtualAddress,
        ULONG   Length
        );
-
 PIRP
+STDCALL
 IoBuildSynchronousFsdRequest (
        ULONG                   MajorFunction,
        PDEVICE_OBJECT          DeviceObject,
@@ -276,22 +365,42 @@ IoBuildSynchronousFsdRequest (
        PKEVENT                 Event,
        PIO_STATUS_BLOCK        IoStatusBlock
        );
-
-/*
- * FUNCTION: Sends an irp to the next lower driver
- */
 NTSTATUS
+STDCALL
 IoCallDriver (
        PDEVICE_OBJECT  DeviceObject,
-       PIRP            irp
+       PIRP            Irp
        );
-
 BOOLEAN
+STDCALL
 IoCancelIrp (
        PIRP    Irp
        );
-
+VOID
+STDCALL
+IoCheckDesiredAccess (
+       DWORD   Unknown0,
+       DWORD   Unknown1
+       );
+NTSTATUS
+STDCALL
+IoCheckEaBufferValidity (
+       DWORD   Unknown0,
+       DWORD   Unknown1,
+       DWORD   Unknown2
+       );
+NTSTATUS
+STDCALL
+IoCheckFunctionAccess (
+       DWORD   Unknown0,
+       DWORD   Unknown1,
+       DWORD   Unknown2,
+       DWORD   Unknown3,
+       DWORD   Unknown4,
+       DWORD   Unknown5
+       );
 NTSTATUS
+STDCALL
 IoCheckShareAccess (
        ACCESS_MASK     DesiredAccess,
        ULONG           DesiredShareAccess,
@@ -299,22 +408,14 @@ IoCheckShareAccess (
        PSHARE_ACCESS   ShareAccess,
        BOOLEAN         Update
        );
-
-/*
- * FUNCTION: Indicates the caller has finished all processing for a given
- * I/O request and is returning the given IRP to the I/O manager
- * ARGUMENTS:
- *         Irp = Irp to be cancelled
- *         PriorityBoost = Increment by which to boost the priority of the
- *                         thread making the request
- */
 VOID
+STDCALL
 IoCompleteRequest (
        PIRP    Irp,
        CCHAR   PriorityBoost
        );
-
 NTSTATUS
+STDCALL
 IoConnectInterrupt (
        PKINTERRUPT             * InterruptObject,
        PKSERVICE_ROUTINE       ServiceRoutine,
@@ -330,10 +431,10 @@ IoConnectInterrupt (
        );
 
 PCONTROLLER_OBJECT
+STDCALL
 IoCreateController (
        ULONG   Size
        );
-
 /*
  * FUNCTION: Allocates memory for and intializes a device object for use for
  * a driver
@@ -353,6 +454,7 @@ IoCreateController (
  * NOTES: See the DDK documentation for more information        
  */
 NTSTATUS
+STDCALL
 IoCreateDevice (
        PDRIVER_OBJECT  DriverObject,
        ULONG           DeviceExtensionSize,
@@ -362,7 +464,6 @@ IoCreateDevice (
        BOOLEAN         Exclusive,
        PDEVICE_OBJECT  * DeviceObject
        );
-
 NTSTATUS
 STDCALL
 IoCreateFile (
@@ -378,28 +479,33 @@ IoCreateFile (
        IN      PVOID                   EaBuffer                OPTIONAL,
        IN      ULONG                   EaLength,
        IN      CREATE_FILE_TYPE        CreateFileType,
-       IN      ULONG                   ExtraCreateParameters,
+       IN      PVOID                   ExtraCreateParameters   OPTIONAL,
        IN      ULONG                   Options
        );
 PKEVENT
+STDCALL
 IoCreateNotificationEvent (
        PUNICODE_STRING EventName,
        PHANDLE EventHandle
        );
-
+PFILE_OBJECT
+STDCALL
+IoCreateStreamFileObject (
+       PFILE_OBJECT    FileObject,
+       PDEVICE_OBJECT  DeviceObject
+       );
 NTSTATUS
 STDCALL
 IoCreateSymbolicLink (
        PUNICODE_STRING SymbolicLinkName,
        PUNICODE_STRING DeviceName
        );
-
 PKEVENT
+STDCALL
 IoCreateSynchronizationEvent (
        PUNICODE_STRING EventName,
        PHANDLE EventHandle
        );
-
 NTSTATUS
 STDCALL
 IoCreateUnprotectedSymbolicLink (
@@ -407,133 +513,209 @@ IoCreateUnprotectedSymbolicLink (
        PUNICODE_STRING DeviceName
        );
 
+/*
+ * FUNCTION:
+ *     Deletes a symbolic link between the ARC name of a physical
+ *     device and the name of the corresponding device object
+ *
+ * ARGUMENTS:
+ *     ArcName = ARC name of the device
+ *
+ * NOTES:
+ *     VOID
+ *     IoDeassignArcName (
+ *             PUNICODE_STRING ArcName
+ *             );
+ */
+#define IoDeassignArcName(ArcName) \
+       (IoDeleteSymbolicLink((ArcName)))
 
 VOID
-IoDeassignArcName (
-       PUNICODE_STRING ArcName
-       );
-
-VOID
+STDCALL
 IoDeleteController (
        PCONTROLLER_OBJECT      ControllerObject
        );
-
 VOID
+STDCALL
 IoDeleteDevice (
        PDEVICE_OBJECT  DeviceObject
        );
-
 NTSTATUS
 STDCALL
 IoDeleteSymbolicLink (
        PUNICODE_STRING SymbolicLinkName
        );
-
 VOID
+STDCALL
 IoDetachDevice (
        PDEVICE_OBJECT  TargetDevice
        );
-
 VOID
+STDCALL
 IoDisconnectInterrupt (
        PKINTERRUPT     InterruptObject
        );
-
-BOOLEAN
-IoFlushAdapterBuffers (
-       PADAPTER_OBJECT AdapterObject,
-       PMDL            Mdl,
-       PVOID           MapRegisterBase,
-       PVOID           CurrentVa,
-       ULONG           Length,
-       BOOLEAN         WriteToDevice
+VOID
+STDCALL
+IoEnqueueIrp (
+       PIRP    Irp
        );
-
 VOID
-IoFreeAdapterChannel (
-       PADAPTER_OBJECT AdapterObject
+STDCALL
+IoFastQueryNetworkAttributes (
+       DWORD   Unknown0,
+       DWORD   Unknown1,
+       DWORD   Unknown2,
+       DWORD   Unknown3,
+       DWORD   Unknown4
        );
-
 VOID
+STDCALL
 IoFreeController (
        PCONTROLLER_OBJECT      ControllerObject
        );
-
 VOID
+STDCALL
 IoFreeIrp (
        PIRP    Irp
        );
-
-VOID
-IoFreeMapRegisters (
-       PADAPTER_OBJECT AdapterObject,
-       PVOID           MapRegisterBase,
-       ULONG           NumberOfMapRegisters
-       );
-
 VOID
+STDCALL
 IoFreeMdl (
        PMDL    Mdl
        );
-
+PDEVICE_OBJECT
+STDCALL
+IoGetAttachedDevice (
+       PDEVICE_OBJECT  DeviceObject
+       );
+PDEVICE_OBJECT
+STDCALL
+IoGetAttachedDeviceReference (
+       PDEVICE_OBJECT  DeviceObject
+       );
+PDEVICE_OBJECT
+STDCALL
+IoGetBaseFileSystemDeviceObject (
+       IN      PFILE_OBJECT    FileObject
+       );
 PCONFIGURATION_INFORMATION
-IoGetConfigurationInformation (VOID);
-
+STDCALL
+IoGetConfigurationInformation (
+       VOID
+       );
 
 /*
- * FUNCTION: Returns a pointer to the callers stack location in the irp 
+ * FUNCTION: Gets a pointer to the callers location in the I/O stack in
+ * the given IRP
+ * ARGUMENTS:
+ *         Irp = Points to the IRP
+ * RETURNS: A pointer to the stack location
+ *
+ * NOTES:
+ *      PIO_STACK_LOCATION
+ *      IoGetCurrentIrpStackLocation (PIRP Irp)
  */
-PIO_STACK_LOCATION
-IoGetCurrentIrpStackLocation (
-       IRP     * irp
-       );
-
-struct _EPROCESS *
-IoGetCurrentProcess (VOID);
+#define IoGetCurrentIrpStackLocation(Irp) \
+       (&(Irp)->Stack[(ULONG)((Irp)->CurrentLocation)])
 
+/* original macro */
+/*
+#define IoGetCurrentIrpStackLocation(Irp) \
+       ((Irp)->Tail.Overlay.CurrentStackLocation)
+*/
+
+#define IoCopyCurrentIrpStackLocationToNext(Irp) { \
+  PIO_STACK_LOCATION IrpSp; \
+  PIO_STACK_LOCATION NextIrpSp; \
+  IrpSp = IoGetCurrentIrpStackLocation((Irp)); \
+  NextIrpSp = IoGetNextIrpStackLocation((Irp)); \
+  RtlCopyMemory(NextIrpSp, IrpSp, \
+    FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
+  NextIrpSp->Control = 0; }
+
+struct _EPROCESS*
+STDCALL
+IoGetCurrentProcess (
+       VOID
+       );
 NTSTATUS
+STDCALL
 IoGetDeviceObjectPointer (
        PUNICODE_STRING ObjectName,
        ACCESS_MASK     DesiredAccess,
        PFILE_OBJECT    * FileObject,
        PDEVICE_OBJECT  * DeviceObject
        );
-
 PDEVICE_OBJECT
+STDCALL
 IoGetDeviceToVerify (
-       PETHREAD        Thread
+       struct _ETHREAD*        Thread
        );
-
 PGENERIC_MAPPING
-IoGetFileObjectGenericMapping (VOID);
-
-ULONG
-IoGetFunctionCodeFromCtlCode (
-       ULONG   ControlCode
+STDCALL
+IoGetFileObjectGenericMapping (
+       VOID
        );
 
+#define IoGetFunctionCodeFromCtlCode(ControlCode) \
+       ((ControlCode >> 2) & 0x00000FFF)
+
 PVOID
-IoGetInitialStack (VOID);
+STDCALL
+IoGetInitialStack (
+       VOID
+       );
 
 /*
- * FUNCTION:  
+ * FUNCTION: Gives a higher level driver access to the next lower driver's 
+ * I/O stack location
+ * ARGUMENTS: 
+ *           Irp = points to the irp
+ * RETURNS: A pointer to the stack location
+ *
+ * NOTES:
+ *      PIO_STACK_LOCATION
+ *      IoGetNextIrpStackLocation (PIRP Irp)
  */
-PIO_STACK_LOCATION
-IoGetNextIrpStackLocation (
-       IRP     * irp
-       );
+#define IoGetNextIrpStackLocation(Irp) \
+       (&(Irp)->Stack[(Irp)->CurrentLocation-1])
+
+/* original macro */
+/*
+#define IoGetNextIrpStackLocation(Irp) \
+       ((Irp)->Tail.Overlay.CurrentStackLocation-1)
+*/
 
 PDEVICE_OBJECT
+STDCALL
 IoGetRelatedDeviceObject (
        PFILE_OBJECT    FileObject
        );
+struct _EPROCESS*
+STDCALL
+IoGetRequestorProcess (
+       IN      PIRP    Irp
+       );
 
 VOID
-IoInitializeDpcRequest (
-       PDEVICE_OBJECT  DeviceObject,
-       PIO_DPC_ROUTINE DpcRoutine
+STDCALL
+IoGetStackLimits (
+       PULONG  LowLimit,
+       PULONG  HighLimit
+       );
+
+PIRP
+STDCALL
+IoGetTopLevelIrp (
+       VOID
        );
 
+#define IoInitializeDpcRequest(DeviceObject,DpcRoutine) \
+       (KeInitializeDpc(&(DeviceObject)->Dpc, \
+                        (PKDEFERRED_ROUTINE)(DpcRoutine), \
+                        (DeviceObject)))
+
 /*
  * FUNCTION: Initalizes an irp allocated by the caller
  * ARGUMENTS:
@@ -542,59 +724,75 @@ IoInitializeDpcRequest (
  *          StackSize = Number of stack locations in the IRP
  */
 VOID
+STDCALL
 IoInitializeIrp (
        PIRP    Irp,
        USHORT  PacketSize,
        CCHAR   StackSize
        );
-
 NTSTATUS
+STDCALL
 IoInitializeTimer (
        PDEVICE_OBJECT          DeviceObject,
        PIO_TIMER_ROUTINE       TimerRoutine,
        PVOID                   Context
        );
 
+/*
+ * NOTES:
+ *     BOOLEAN
+ *     IsErrorUserInduced (NTSTATUS Status)
+ */
+#define IoIsErrorUserInduced(Status) \
+       ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
+                  ((Status) == STATUS_IO_TIMEOUT) || \
+                  ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
+                  ((Status) == STATUS_NO_MEDIA_IN_DRIVE) || \
+                  ((Status) == STATUS_VERIFY_REQUIRED) || \
+                  ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
+                  ((Status) == STATUS_WRONG_VOLUME)))
+
 BOOLEAN
-IoIsErrorUserInduced (
-       NTSTATUS        Status
+STDCALL
+IoIsOperationSynchronous (
+       IN      PIRP    Irp
        );
-
 BOOLEAN
-IoIsTotalDeviceFailure (
-       NTSTATUS        Status
+STDCALL
+IoIsSystemThread (
+       PVOID   Unknown0
        );
-
 PIRP
+STDCALL
 IoMakeAssociatedIrp (
        PIRP    Irp,
        CCHAR   StackSize
        );
 
-PHYSICAL_ADDRESS
-IoMapTransfer (
-       PADAPTER_OBJECT AdapterObject,
-       PMDL            Mdl,
-       PVOID           MapRegisterBase,
-       PVOID           CurrentVa,
-       PULONG          Length,
-       BOOLEAN         WriteToDevice
-       );
-
 /*
- * FUNCTION: Marks an IRP as pending
+ * FUNCTION: Marks the specified irp, indicating further processing will
+ * be required by other driver routines
  * ARGUMENTS:
- *         Irp = Irp to mark
- * NOTE: If a driver doesn't complete the irp in its dispatch routine it
- * must mark it pending otherwise the I/O manager will complete it on
- * return from the dispatch routine.
+ *      Irp = Irp to mark
+ * NOTES:
+ *      VOID
+ *      IoMarkIrpPending (PIRP Irp)
  */
-VOID
-IoMarkIrpPending (
-       PIRP    Irp
-       );
+#define IoMarkIrpPending(Irp) \
+       (IoGetCurrentIrpStackLocation(Irp)->Control |= SL_PENDING_RETURNED)
+
 
 NTSTATUS
+STDCALL
+IoOpenDeviceInstanceKey (
+       DWORD   Unknown0,
+       DWORD   Unknown1,
+       DWORD   Unknown2,
+       DWORD   Unknown3,
+       DWORD   Unknown4
+       );
+NTSTATUS
+STDCALL
 IoQueryDeviceDescription (
        PINTERFACE_TYPE                 BusType,
        PULONG                          BusNumber,
@@ -605,53 +803,101 @@ IoQueryDeviceDescription (
        PIO_QUERY_DEVICE_ROUTINE        CalloutRoutine,
        PVOID                           Context
        );
-
+DWORD
+STDCALL
+IoQueryDeviceEnumInfo (
+       DWORD   Unknown0,
+       DWORD   Unknown1
+       );
+// IoQueryFileInformation: confirmed - Undocumented because it does not require a valid file handle 
+NTSTATUS 
+STDCALL
+IoQueryFileInformation (
+       IN      PFILE_OBJECT            FileObject,
+       IN      FILE_INFORMATION_CLASS  FileInformationClass,
+       IN      ULONG                   Length,
+       OUT     PVOID                   FileInformation,
+       OUT     PULONG                  ReturnedLength  
+       );
+NTSTATUS
+STDCALL
+IoQueryVolumeInformation (
+       IN      PFILE_OBJECT            FileObject,
+       IN      FS_INFORMATION_CLASS    FsInformationClass,
+       IN      ULONG                   Length,
+       OUT     PVOID                   FsInformation,
+       OUT     PULONG                  ReturnedLength
+       );
 VOID
+STDCALL
+IoQueueThreadIrp (
+       PVOID   Unknown0
+       );
+VOID
+STDCALL
 IoRaiseHardError (
        PIRP            Irp,
        PVPB            Vpb,
        PDEVICE_OBJECT  RealDeviceObject
        );
-
 BOOLEAN
-IoRaiseHardInformationalError (
+STDCALL
+IoRaiseInformationalHardError (
        NTSTATUS        ErrorStatus,
        PUNICODE_STRING String,
-       PKTHREAD        Thread
+       struct _KTHREAD*        Thread
        );
-
-NTSTATUS
-IoReadPartitionTable (
-       PDEVICE_OBJECT                          DeviceObject,
-       ULONG                                   SectorSize,
-       BOOLEAN                                 ReturnedRecognizedPartitions,
-       struct _DRIVE_LAYOUT_INFORMATION        ** PBuffer
-       );
-
 VOID
+STDCALL
 IoRegisterDriverReinitialization (
        PDRIVER_OBJECT          DriverObject,
        PDRIVER_REINITIALIZE    ReinitRoutine,
        PVOID                   Context
        );
-
+VOID
+STDCALL
+IoRegisterFileSystem (
+       PDEVICE_OBJECT  DeviceObject
+       );
+#if (_WIN32_WINNT >= 0x0400)
+NTSTATUS
+STDCALL
+IoRegisterFsRegistrationChange (
+       IN      PDRIVER_OBJECT          DriverObject,
+       IN      PFSDNOTIFICATIONPROC    FSDNotificationProc
+       );
+#endif // (_WIN32_WINNT >= 0x0400)
 NTSTATUS
+STDCALL
 IoRegisterShutdownNotification (
        PDEVICE_OBJECT  DeviceObject
        );
-
 VOID
+STDCALL
 IoReleaseCancelSpinLock (
-       KIRQL   Irql
+       IN      KIRQL   Irql
+       );
+VOID
+STDCALL
+IoReleaseVpbSpinLock (
+       IN      KIRQL   Irql
        );
-
 VOID
+STDCALL
 IoRemoveShareAccess (
        PFILE_OBJECT    FileObject,
        PSHARE_ACCESS   ShareAccess
        );
-
 NTSTATUS
+STDCALL
+IoReportHalResourceUsage (
+       PUNICODE_STRING HalDescription,
+       ULONG           Unknown1,
+       ULONG           Unknown2,
+       ULONG           Unknown3
+       );
+NTSTATUS
+STDCALL
 IoReportResourceUsage (
        PUNICODE_STRING         DriverClassName,
        PDRIVER_OBJECT          DriverObject,
@@ -664,66 +910,88 @@ IoReportResourceUsage (
        PBOOLEAN                ConflictDetected
        );
 
+#define IoRequestDpc(DeviceObject,Irp,Context) \
+       (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
+
+#define IoSetCancelRoutine(Irp,NewCancelRoutine) \
+       ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
+                                            (ULONG)(NewCancelRoutine)));
+
+#define IoSetCompletionRoutine(Irp,Routine,Context,Success,Error,Cancel) \
+       { \
+               PIO_STACK_LOCATION param; \
+               assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
+               param = IoGetNextIrpStackLocation((Irp)); \
+               param->CompletionRoutine=(Routine); \
+               param->CompletionContext=(Context); \
+               param->Control = 0; \
+               if ((Success)) \
+                       param->Control = SL_INVOKE_ON_SUCCESS; \
+               if ((Error)) \
+                       param->Control |= SL_INVOKE_ON_ERROR; \
+               if ((Cancel)) \
+                       param->Control |= SL_INVOKE_ON_CANCEL; \
+       } 
+
+VOID STDCALL
+IoSetDeviceToVerify (IN struct _ETHREAD* Thread,
+                    IN PDEVICE_OBJECT DeviceObject);
 VOID
-IoRequestDpc (
-       PDEVICE_OBJECT  DeviceObject,
-       PIRP            Irp,
-       PVOID           Context
-       );
-
-PDRIVER_CANCEL
-IoSetCancelRoutine (
-       PIRP            Irp,
-       PDRIVER_CANCEL  CancelRoutine
-       );
-
-VOID
-IoSetCompletionRoutine (
-       PIRP                    Irp,
-       PIO_COMPLETION_ROUTINE  CompletionRoutine,
-       PVOID                   Context,
-       BOOLEAN                 InvokeOnSuccess,
-       BOOLEAN                 InvokeOnError,
-       BOOLEAN                 InvokeOnCancel
-       );
-
-VOID
+STDCALL
 IoSetHardErrorOrVerifyDevice (
-       PIRP            Irp,
-       PDEVICE_OBJECT  DeviceObject
+       IN      PIRP            Irp,
+       IN      PDEVICE_OBJECT  DeviceObject
        );
-
-VOID
-IoSetNextIrpStackLocation (
-       PIRP    Irp
-       );
-
 NTSTATUS
-IoSetPartitionInformation (
-       PDEVICE_OBJECT  DeviceObject,
-       ULONG           SectorSize,
-       ULONG           PartitionNumber,
-       ULONG           PartitionType
+STDCALL
+IoSetInformation (
+       IN      PFILE_OBJECT            FileObject,
+       IN      FILE_INFORMATION_CLASS  FileInformationClass,
+       IN      ULONG                   Length,
+       OUT     PVOID                   FileInformation
        );
 
+#define IoSetNextIrpStackLocation(Irp) \
+{ \
+       (Irp)->CurrentLocation--; \
+       (Irp)->Tail.Overlay.CurrentStackLocation--; \
+} 
+
 VOID
+STDCALL
 IoSetShareAccess (
        ACCESS_MASK     DesiredAccess,
        ULONG           DesiredShareAccess,
        PFILE_OBJECT    FileObject,
        PSHARE_ACCESS   ShareAccess
        );
+BOOLEAN
+STDCALL
+IoSetThreadHardErrorMode (
+       IN      BOOLEAN HardErrorEnabled
+       );
+VOID
+STDCALL
+IoSetTopLevelIrp (
+       IN      PIRP    Irp
+       );
 
 /*
  * FUNCTION:  Determines the size of an IRP
  * ARGUMENTS: 
  *           StackSize = number of stack locations in the IRP
  * RETURNS: The size of the IRP in bytes 
- */
 USHORT
-IoSizeOfIrp (
-       CCHAR   StackSize
-       );
+IoSizeOfIrp (CCHAR StackSize)
+ */
+#define IoSizeOfIrp(StackSize) \
+       ((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
+
+/* original macro */
+/*
+#define IoSizeOfIrp(StackSize) \
+       ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
+*/
 
 /*
  * FUNCTION: Dequeues the next IRP from the device's associated queue and
@@ -733,18 +1001,18 @@ IoSizeOfIrp (
  *          Cancelable = True if IRPs in the queue can be cancelled
  */
 VOID
+STDCALL
 IoStartNextPacket (
        PDEVICE_OBJECT  DeviceObject,
        BOOLEAN         Cancelable
        );
-   
 VOID
+STDCALL
 IoStartNextPacketByKey (
-       PDEVICE_OBJECT  DeviceObject, 
+       PDEVICE_OBJECT  DeviceObject,
        BOOLEAN         Cancelable,
        ULONG           Key
        );
-
 /*
  * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
  * the device is busy
@@ -755,83 +1023,188 @@ IoStartNextPacketByKey (
  *         CancelFunction = Entry point for a driver supplied cancel function
  */
 VOID
+STDCALL
 IoStartPacket (
        PDEVICE_OBJECT  DeviceObject,
        PIRP            Irp,
        PULONG          Key,
        PDRIVER_CANCEL  CancelFunction
        );
-
 VOID
+STDCALL
 IoStartTimer (
        PDEVICE_OBJECT  DeviceObject
        );
-
 VOID
+STDCALL
 IoStopTimer (
        PDEVICE_OBJECT  DeviceObject
        );
-
+NTSTATUS
+STDCALL
+IoSynchronousPageWrite (
+       DWORD   Unknown0,
+       DWORD   Unknown1,
+       DWORD   Unknown2,
+       DWORD   Unknown3,
+       DWORD   Unknown4
+       );
+struct _EPROCESS* STDCALL IoThreadToProcess (struct _ETHREAD*  Thread);
 VOID
+STDCALL
+IoUnregisterFileSystem (
+       IN      PDEVICE_OBJECT  DeviceObject
+       );
+#if (_WIN32_WINNT >= 0x0400)
+VOID
+STDCALL
+IoUnregisterFsRegistrationChange (
+       DWORD   Unknown0,
+       DWORD   Unknown1
+       );
+#endif // (_WIN32_WINNT >= 0x0400)
+VOID
+STDCALL
 IoUnregisterShutdownNotification (
        PDEVICE_OBJECT  DeviceObject
        );
-
 VOID
+STDCALL
 IoUpdateShareAccess (
-       PFILE_OBJECT    FileObject,
-       PSHARE_ACCESS   ShareAccess
+       IN      PFILE_OBJECT    FileObject,
+       IN      PSHARE_ACCESS   ShareAccess
+       );
+NTSTATUS
+STDCALL
+IoVerifyVolume (
+       IN      PDEVICE_OBJECT  DeviceObject,
+       IN      BOOLEAN         AllowRawMount
        );
-
 VOID
+STDCALL
 IoWriteErrorLogEntry (
        PVOID   ElEntry
        );
-
+/*
+ * FUNCTION: Sends an irp to the next lower driver
+ */
 NTSTATUS
-IoWritePartitionTable (
+FASTCALL
+IofCallDriver (
        PDEVICE_OBJECT  DeviceObject,
-       ULONG SectorSize,
-       ULONG SectorsPerTrack,
-       ULONG NumberOfHeads,
-       struct _DRIVE_LAYOUT_INFORMATION* PBuffer
+       PIRP            Irp
+       );
+/*
+ * FUNCTION: Indicates the caller has finished all processing for a given
+ * I/O request and is returning the given IRP to the I/O manager
+ * ARGUMENTS:
+ *         Irp = Irp to be cancelled
+ *         PriorityBoost = Increment by which to boost the priority of the
+ *                         thread making the request
+ */
+VOID
+FASTCALL
+IofCompleteRequest (
+       PIRP    Irp,
+       CCHAR   PriorityBoost
        );
 
+/* --- EXPORTED BY HAL --- */
 
-// Preliminary guess
-NTKERNELAPI
-NTSTATUS
-IoQueryFileVolumeInformation (
-       IN      PFILE_OBJECT            FileObject, 
-       IN      FS_INFORMATION_CLASS    FsInformationClass, 
-       IN      ULONG                   Length, 
-       OUT     PVOID                   FsInformation, 
-       OUT     PULONG                  ReturnedLength
+VOID
+STDCALL
+IoAssignDriveLetters (
+       IN      PLOADER_PARAMETER_BLOCK LoaderBlock,
+       IN      PSTRING                 NtDeviceName,
+       OUT     PUCHAR                  NtSystemPath,
+       OUT     PSTRING                 NtSystemPathString
        );
 
-NTKERNELAPI // confirmed - Undocumented because it does not require a valid file handle 
-NTSTATUS 
-IoQueryFileInformation (
-       IN      PFILE_OBJECT            FileObject,
-       IN      FILE_INFORMATION_CLASS  FileInformationClass,
-       IN      ULONG                   Length,
-       OUT     PVOID                   FileInformation,
-       OUT     PULONG                  ReturnedLength  
+BOOLEAN
+STDCALL
+IoFlushAdapterBuffers (
+       PADAPTER_OBJECT AdapterObject,
+       PMDL            Mdl,
+       PVOID           MapRegisterBase,
+       PVOID           CurrentVa,
+       ULONG           Length,
+       BOOLEAN         WriteToDevice
        );
 
 VOID
-IoRegisterFileSystem (
-       PDEVICE_OBJECT  DeviceObject
+STDCALL
+IoFreeAdapterChannel (
+       PADAPTER_OBJECT AdapterObject
        );
 
-PDEVICE_OBJECT
-IoGetAttachedDevice (
-       PDEVICE_OBJECT  DeviceObject
+VOID
+STDCALL
+IoFreeMapRegisters (
+       PADAPTER_OBJECT AdapterObject,
+       PVOID           MapRegisterBase,
+       ULONG           NumberOfMapRegisters
        );
 
-PFILE_OBJECT
-IoCreateStreamFileObject (
-       PFILE_OBJECT    FileObject,
-       PDEVICE_OBJECT  DeviceObject
+PHYSICAL_ADDRESS
+STDCALL
+IoMapTransfer (
+       PADAPTER_OBJECT AdapterObject,
+       PMDL            Mdl,
+       PVOID           MapRegisterBase,
+       PVOID           CurrentVa,
+       PULONG          Length,
+       BOOLEAN         WriteToDevice
+       );
+
+NTSTATUS
+STDCALL
+IoReadPartitionTable (
+       PDEVICE_OBJECT                  DeviceObject,
+       ULONG                           SectorSize,
+       BOOLEAN                         ReturnedRecognizedPartitions,
+       PDRIVE_LAYOUT_INFORMATION       * PartitionBuffer
        );
 
+NTSTATUS
+STDCALL
+IoSetPartitionInformation (
+       PDEVICE_OBJECT  DeviceObject,
+       ULONG           SectorSize,
+       ULONG           PartitionNumber,
+       ULONG           PartitionType
+       );
+
+NTSTATUS
+STDCALL
+IoWritePartitionTable (
+       PDEVICE_OBJECT                  DeviceObject,
+       ULONG                           SectorSize,
+       ULONG                           SectorsPerTrack,
+       ULONG                           NumberOfHeads,
+       PDRIVE_LAYOUT_INFORMATION       PartitionBuffer
+       );
+
+
+/* --- --- --- INTERNAL or REACTOS ONLY --- --- --- */
+
+/*
+ * FUNCTION: Registers the driver with WMI
+ * ARGUMENTS:
+ *          DeviceObject = Device to register
+ *          Action = Action to take
+ * RETURNS: Status (?)
+ */
+/*
+NTSTATUS
+IoWMIRegistrationControl (
+       PDEVICE_OBJECT DeviceObject,
+       WMIREGACTION Action);
+*/
+
+BOOLEAN
+IoIsTotalDeviceFailure (
+       NTSTATUS        Status
+       );
+
+
+#endif /* ndef _INCLUDE_DDK_IOFUNCS_H */