DeviceIoControl keep failing for scsi hard drive?

Hi Folks,
I call the below code to extract information about the scsi hard drive, it
consistently return me an error code of 1 (invalid function). Any hint on
how to debug or fix this error?
Thanks,
Huy

typedef struct IO_CONTROL
{
ULONG HeaderLength;
UCHAR Signature[8];
ULONG Timeout;
ULONG ControlCode;
ULONG ReturnCode;
ULONG Length;
} IO_CONTROL, *IO_CONTROL;

#define IOCTL_SCSI_MINIPORT 0x0004D008

if (DeviceIoControl ( ScsiDrive,
IOCTL_SCSI_MINIPORT,
buffer,
sizeof(IO_CONTROL)+ sizeof(SENDCMDINPARAMS)- 1,
buffer,
sizeof (IO_CONTROL) + SENDIDLENGTH,
&dummy, NULL))

Hi,

are you sure that miniport (?) you’re sending this IOCTL to does really
support IOCTL_SCSI_MINIPORT? This IOCTL is optional.

Anton Kolomyeytsev

Hi Folks,
I call the below code to extract information about the scsi hard drive, it
consistently return me an error code of 1 (invalid function). Any hint on
how to debug or fix this error?
Thanks,
Huy

typedef struct IO_CONTROL
{
ULONG HeaderLength;
UCHAR Signature[8];
ULONG Timeout;
ULONG ControlCode;
ULONG ReturnCode;
ULONG Length;
} IO_CONTROL, *IO_CONTROL;

#define IOCTL_SCSI_MINIPORT 0x0004D008

if (DeviceIoControl ( ScsiDrive,
IOCTL_SCSI_MINIPORT,
buffer,
sizeof(IO_CONTROL)+ sizeof(SENDCMDINPARAMS)- 1,
buffer,
sizeof (IO_CONTROL) + SENDIDLENGTH,
&dummy, NULL))

I think Anton has the answer. Your SCSI miniport may not support that
function. Besides are you sure that that is th e correct value?


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105

“Anton Kolomyeytsev” wrote in message
news:xxxxx@ntdev…
>
> Hi,
>
> are you sure that miniport (?) you’re sending this IOCTL to does really
> support IOCTL_SCSI_MINIPORT? This IOCTL is optional.
>
> Anton Kolomyeytsev
>
> > Hi Folks,
> > I call the below code to extract information about the scsi hard drive,
it
> > consistently return me an error code of 1 (invalid function). Any hint
on
> > how to debug or fix this error?
> > Thanks,
> > Huy
> >
> > typedef struct IO_CONTROL
> > {
> > ULONG HeaderLength;
> > UCHAR Signature[8];
> > ULONG Timeout;
> > ULONG ControlCode;
> > ULONG ReturnCode;
> > ULONG Length;
> > } IO_CONTROL, *IO_CONTROL;
> >
> > #define IOCTL_SCSI_MINIPORT 0x0004D008
> >
> > if (DeviceIoControl ( ScsiDrive,
> > IOCTL_SCSI_MINIPORT,
> > buffer,
> > sizeof(IO_CONTROL)+ sizeof(SENDCMDINPARAMS)- 1,
> > buffer,
> > sizeof (IO_CONTROL) + SENDIDLENGTH,
> > &dummy, NULL))
>
>

How would I find out which option does the miniport supports?
Thanks,
Huy

Read the docs that came with the application development system. Call tech
support and ask. Where did you get the driver?


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105

“Huy Nguyen” wrote in message
news:xxxxx@ntdev…
>
> How would I find out which option does the miniport supports?
> Thanks,
> Huy
>
>

Oh … something else … your code fragment does not show the Signature
field being set. You must know what the signuature is for THAT version of
the miniport or it will be summarily rejected.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105

“Gary G. Little” wrote in message
news:xxxxx@ntdev…
>
> Read the docs that came with the application development system. Call tech
> support and ask. Where did you get the driver?
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
>
> “Huy Nguyen” wrote in message
> news:xxxxx@ntdev…
> >
> > How would I find out which option does the miniport supports?
> > Thanks,
> > Huy
> >
> >
>
>
>
>

>> strncpy ((char *) p -> Signature, “SCSIDISK”, 8);
I initialized the signature with the above argument. I forgot to mention
that we used the standard Windows 2K driver.
Thanks,
Huy

Oh … something else … your code fragment does not show the Signature
field being set. You must know what the signuature is for THAT version
of the miniport or it will be summarily rejected.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105

“Gary G. Little” wrote in message
> news:xxxxx@ntdev…
>>
>> Read the docs that came with the application development system. Call
>> tech support and ask. Where did you get the driver?
>>
>> –
>> Gary G. Little
>> Have Computer, Will Travel …
>> 909-698-3191
>> 909-551-2105
>>
>> “Huy Nguyen” wrote in message
>> news:xxxxx@ntdev…
>> >
>> > How would I find out which option does the miniport supports?
>> > Thanks,
>> > Huy
>> >
>> >
>>
>>
>>
>>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dslextreme.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com

Hmmmm “Standard Windows 2K driver”? Would that by any chance be controlling
the “standard Windows 2K HBA?”

:slight_smile:


Gary G. Little
Have Computer, will travel …
909-698-3191
909-551-2105

wrote in message news:xxxxx@ntdev…
>
> >> strncpy ((char *) p -> Signature, “SCSIDISK”, 8);
> I initialized the signature with the above argument. I forgot to mention
> that we used the standard Windows 2K driver.
> Thanks,
> Huy
> > Oh … something else … your code fragment does not show the Signature
> > field being set. You must know what the signuature is for THAT version
> > of the miniport or it will be summarily rejected.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> >
> > “Gary G. Little” wrote in message
> > news:xxxxx@ntdev…
> >>
> >> Read the docs that came with the application development system. Call
> >> tech support and ask. Where did you get the driver?
> >>
> >> –
> >> Gary G. Little
> >> Have Computer, Will Travel …
> >> 909-698-3191
> >> 909-551-2105
> >>
> >> “Huy Nguyen” wrote in message
> >> news:xxxxx@ntdev…
> >> >
> >> > How would I find out which option does the miniport supports?
> >> > Thanks,
> >> > Huy
> >> >
> >> >
> >>
> >>
> >>
> >>
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@dslextreme.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>

Huy,

You’ll probably get more help if you tell us what you hope to achieve by
doing this. From what you’ve said it sounds like you don’t know what
driver your’re running against or which miniport IOCTLs (if any) it
supports.

It’s also not clear whether you’ve opened a handle to one of the devices
or to the adapter itself. I suspect miniport IOCTLs need to be directed
at the adapter (but I no longer remember) so you could also have the
same handle.

In any case - if you tell us what you want to accomplish we’ll be able
to tell you if this if miniport IOCTLs are the right mechanism or not
and go from there.

-p

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Tuesday, January 21, 2003 3:25 PM
To: NT Developers Interest List

Hmmmm “Standard Windows 2K driver”? Would that by any chance be
controlling the “standard Windows 2K HBA?”

:slight_smile:


Gary G. Little
Have Computer, will travel …
909-698-3191
909-551-2105

wrote in message news:xxxxx@ntdev…
>
> >> strncpy ((char *) p -> Signature, “SCSIDISK”, 8);
> I initialized the signature with the above argument. I forgot to
> mention that we used the standard Windows 2K driver.
> Thanks,
> Huy
> > Oh … something else … your code fragment does not show the
> > Signature field being set. You must know what the signuature is for
> > THAT version of the miniport or it will be summarily rejected.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> >
> > “Gary G. Little” wrote in message
> > news:xxxxx@ntdev…
> >>
> >> Read the docs that came with the application development system.
> >> Call tech support and ask. Where did you get the driver?
> >>
> >> –
> >> Gary G. Little
> >> Have Computer, Will Travel …
> >> 909-698-3191
> >> 909-551-2105
> >>
> >> “Huy Nguyen” wrote in message
> >> news:xxxxx@ntdev…
> >> >
> >> > How would I find out which option does the miniport supports?
> >> > Thanks,
> >> > Huy
> >> >
> >> >
> >>
> >>
> >>
> >>
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@dslextreme.com

> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Peter is right. IOCTL_SCSI_MINIPORT must be sent to the adapter and not
to the device itself. We used to be lax on this but for the sake of
tighter security, IOCTLs not recognized by the PDO are no longer forwarded
to the FDO. They are failed w/ STATUS_INVALID_DEVICE_REQUEST.

Hi Peter,
You are right! I have to implement the sysInfo Mib for the agent which we
are implementing. Two of the scsi system that I have, have the default
installation without the manufacturers driver (just plain Windows 2K
installed). This is my first time writing device driver code to access
system information. Below is the code I used to create a handler to the
scsi device.

sprintf (driveName, “\\.\Scsi%d:”, controller);

hScsiDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING,
0,
NULL);
thank so much,
Huy

Huy,

You’ll probably get more help if you tell us what you hope to achieve by
doing this. From what you’ve said it sounds like you don’t know what
driver your’re running against or which miniport IOCTLs (if any) it
supports.

It’s also not clear whether you’ve opened a handle to one of the devices
or to the adapter itself. I suspect miniport IOCTLs need to be directed
at the adapter (but I no longer remember) so you could also have the
same handle.

In any case - if you tell us what you want to accomplish we’ll be able
to tell you if this if miniport IOCTLs are the right mechanism or not
and go from there.

-p

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Tuesday, January 21, 2003 3:25 PM
To: NT Developers Interest List

Hmmmm “Standard Windows 2K driver”? Would that by any chance be
controlling the “standard Windows 2K HBA?”

:slight_smile:


Gary G. Little
Have Computer, will travel …
909-698-3191
909-551-2105

wrote in message news:xxxxx@ntdev…
>>
>> >> strncpy ((char *) p -> Signature, “SCSIDISK”, 8);
>> I initialized the signature with the above argument. I forgot to
>> mention that we used the standard Windows 2K driver.
>> Thanks,
>> Huy
>> > Oh … something else … your code fragment does not show the
>> Signature field being set. You must know what the signuature is for
>> THAT version of the miniport or it will be summarily rejected.
>> >
>> > –
>> > Gary G. Little
>> > Have Computer, Will Travel …
>> > 909-698-3191
>> > 909-551-2105
>> >
>> > “Gary G. Little” wrote in message
>> > news:xxxxx@ntdev…
>> >>
>> >> Read the docs that came with the application development system.
>> Call tech support and ask. Where did you get the driver?
>> >>
>> >> –
>> >> Gary G. Little
>> >> Have Computer, Will Travel …
>> >> 909-698-3191
>> >> 909-551-2105
>> >>
>> >> “Huy Nguyen” wrote in message
>> >> news:xxxxx@ntdev…
>> >> >
>> >> > How would I find out which option does the miniport supports?
>> Thanks,
>> >> > Huy
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > —
>> > You are currently subscribed to ntdev as: xxxxx@dslextreme.com
>
>> > To unsubscribe send a blank email to
>> xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@dslextreme.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com