User-Mode IOCTLs to Storport Miniport driver

Hello All,
I am trying to writing an application to send IOCTLs to my Storport miniport driver for a SAS HBA.
The Storport miniport driver is written for Windows 7. So, the driver’s HW_INITIALIZATION_DATA structure does not support HwProcessServiceRequest field.
In the application, if I use:

  1. The code IOCTL_MINIPORT_PROCESS_SERVICE_IRP in the DeviceIoControl() call, it does not reach the driver.
  2. The code IOCTL_SCSI_PASSTHROUGH in the DeviceIoControl() call, it does not reach the driver.
  3. With IOCTL_SCSI_MINIPORT, the call reaches the HwBuildIo() function in the driver. I can reader the header but the payload is ignored. Please see below for how I setup the call.

But if I use, the control code IOCTL_SCSI_MINIPORT, it does reach the driver’s HwBuildIO. I have an issue with this:
I am setting up a structure as below and passing it to the driver.:

typedef struct _DRIVER_CMD {
SRB_IO_CONTROL header;
SCSI_REQUEST_BLOCK srbPayload;
} driver_cmd;

driver_cmd cmd;

retCode = DeviceIoControl(SPDriverHandle,IOCTL_SCSI_MINIPORT,&cmd,sizeof(cmd),&cmd,sizeof(cmd),&bytesReturned,NULL);

  1. Can you please let me know how we can send an IOCTL_SCSI_MINIPORT code and also send an SRB with it, so it can reach the storport miniport driver?
  2. Also, is there any special setting to be done in driver to allow IOCTL_SCSI_PASSTHROUGH?

Thanks.