I am sending a DeviceIoControl request from an user application with overlapped object.
DeviceIoControl(hScsiDriver, IOCTL_SCSI_MINIPORT, ScsiRequestBuffer, InputLength, ScsiReplyBuffer, OutputLength, &ReturnLength, pOverlappedObject);
Later I am checking status of the Ioctl using GetOverlappedResult.
status = GetOverlappedResult(pVMstruct->hScsiDriver[pVMstruct->activatedDrive],
pOverlappedObject , &returnLength, TRUE);
The request is completed by a storport miniport driver. The problem is if I set srbStatus in SRB as SRB_STATUS_SUCCESS or SRB_STATUS_BUSY, everything works fine. But if I set the status as anything else(like SRB_STATUS_ERROR), GetOverlappedResult never returns. This causes my application to hang. Where am I going wrong ?