Implementing IOCTLs for a SAN Service Provider

If a SAN service provider sends I/O control (IOCTL) requests to the proxy driver, the driver should implement an IRP_MJ_DEVICE_CONTROL dispatch routine to process these requests. An IOCTL request can be a request to retrieve the list of IP addresses assigned to the driver's NICs, for example, or a request to allocate or release memory. The DriverEntry routine must specify an entry point for the dispatch routine.

The proxy driver's device control routine calls the IoGetCurrentIrpStackLocation function, in which the device control routine passes a pointer to the IRP that was passed to the routine. The device control routine then determines which IOCTL request was received and processes the request accordingly.

After the current IOCTL request completes, the device control routine calls the IoCompleteRequest function and passes the status of the operation. This status is returned to the SAN service provider.