IoAllocateController

VOID
IoAllocateController(

IN PCONTROLLER_OBJECT ControllerObject,
IN PDEVICE_OBJECT DeviceObject,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context
);

IoAllocateController sets up the call to a driver-supplied ControllerControl routine as soon as the device controller, represented by the given controller object, is available to carry out an I/O operation for the target device, represented by the given device object.

Parameters

ControllerObject

Points to a driver-created controller object, usually representing a physical controller to be allocated for an I/O operation on an attached device.

DeviceObject

Points to the device object, representing the target device of the current IRP.

ExecutionRoutine

Points to the driver-supplied ControllerControl routine. This routine is declared as follows:

IO_ALLOCATION_ACTION

(*PDRIVER_CONTROL)(

    IN PDEVICE_OBJECT DeviceObject,

    IN PIRP Irp,

    IN PVOID MapRegisterBase,

    IN PVOID Context

    );

The MapRegisterBase pointer is a system-reserved value.

Context

Points to a driver-determined context, passed to the driver’s ControllerControl routine when it is called.

Comments

This routine reserves exclusive access to the hardware controller for the specified device.

The ControllerControl routine returns a value indicating whether the controller remains allocated to the device, either DeallocateObject or KeepObject. If it returns KeepObject, the driver must subsequently call IoFreeController to release the controller object.

Callers of IoAllocateController must be running at IRQL DISPATCH_LEVEL.

See Also

IoCreateController, IoDeleteController, IoFreeController