Hi all,
I am trying to send IOCTL request to my Storport miniport driver from user application with a proprietary defined IOCTL code in Win7. According MSDN, SRB_FUNCTION_IO_CONTROL is the function for this purpose. However, I never see the request come in my miniport driver. Even though I verified device handle to the storage (E drive) with CreateFile and IOCTL code like IOCTL_STORAGE_QUERY_PROPERTY. Could somebody shed some light on this ?
Thanks a lot in advance.
How exactly are you formatting and sending this IOCTL? In particular are you
using IOCTL_SCSI_MINIPORT?
Mark Roddy
On Mon, Apr 26, 2010 at 3:37 PM, wrote:
> Hi all,
>
> I am trying to send IOCTL request to my Storport miniport driver from user
> application with a proprietary defined IOCTL code in Win7. According MSDN,
> SRB_FUNCTION_IO_CONTROL is the function for this purpose. However, I never
> see the request come in my miniport driver. Even though I verified device
> handle to the storage (E drive) with CreateFile and IOCTL code like
> IOCTL_STORAGE_QUERY_PROPERTY. Could somebody shed some light on this ?
>
> Thanks a lot in advance.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Yes, I did try IOCTL_SCSI_MINIPORT. And others, too. They all return errcode as 1.
The only mechanism that works is the IOCTL_SCSI_MINIPORT mechanism, however
it is rather easy to get that wrong. Perhaps you might want to post the code
you are using to send an IOCTL to your miniport.
Also - try sending the request to the Adapter device, not a disk or volume
device, e.g… \.\Scsi0
Mark Roddy
On Mon, Apr 26, 2010 at 5:03 PM, wrote:
> Yes, I did try IOCTL_SCSI_MINIPORT. And others, too. They all return
> errcode as 1.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Do you have the information for the IOCTL_SCSI_MINIPORT to be accepted. Just
sending an ISM without the private info for the miniport to accept it, is by
definition meant to fail.
Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Monday, April 26, 2010 4:03 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] SRB_FUNCTION_IO_CONTROL
Yes, I did try IOCTL_SCSI_MINIPORT. And others, too. They all return errcode
as 1.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
__________ Information from ESET Smart Security, version of virus signature
database 5063 (20100426) __________
The message was checked by ESET Smart Security.
http://www.eset.com
__________ Information from ESET Smart Security, version of virus signature
database 5063 (20100426) __________
The message was checked by ESET Smart Security.
http://www.eset.com
I assume the you mean last error code and not the value DeviceIoControl returns.
Check this link:
http://www.osronline.com/showthread.cfm?link=153136
If the fails to help post the code for CreateFile and DeviceIoControl.
Phil
Sorry for the late reply.
I changed it from WDK sample code under ioctl. CreateFile succeeds, but DeviceIoControl reutrns 1 still. Thanks.
if ((hDevice = CreateFile(“\\.\Scsi0:”,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL)) == INVALID_HANDLE_VALUE) {
errNum = GetLastError();
if (errNum != ERROR_FILE_NOT_FOUND) {
printf(“CreateFile failed! ERROR_FILE_NOT_FOUND = %d\n”, errNum);
return ;
}
}
memset(&SrbIoCtrl, 0, sizeof(SRB_IO_CONTROL));
strncpy((void*)SrbIoCtrl.Signature, "IDTIO ", 8);
SrbIoCtrl.HeaderLength = sizeof (SRB_IO_CONTROL);
SrbIoCtrl.ControlCode = (ULONG) IOCTL_IDT_READ_SECTOR;
bRc = DeviceIoControl ( hDevice,
(DWORD)IOCTL_SCSI_MINIPORT,
&SrbIoCtrl,
sizeof( SRB_IO_CONTROL ),
OutputBuffer,
512,
&bytesReturned,
NULL
);
if ( !bRc ) {
printf ( “Error in DeviceIoControl : %d\n”, GetLastError());
}
else {
printf(“Bytes returned (%d)\n”, bytesReturned);
}
Likely your problem is still back with CreateFile, the code allows the GetLastError value of ERROR_FILE_NOT_FOUND to continue with calling DeviceIoControl. You will need to get the “real” device name for your storport miniport driver.
Possibly a better check whether the CreateFile has succeeded is to check the handle, then call GetLastError if needed.
if (hDevice == INVALID_HANDLE_VALUE)
{
errNum = GetLastError();
printf(“CreateFile failed! GetLastError = %d\n”, errNum);
return;
}
Phil