Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


SCSI_PASS_THROUGH

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Q1: Does SCSI_PASS_THROUGH still work under Win2000?

If yes, why does this initial INQ cmd (after successfully opening
'scsi2:') fail with INCORRECT_FUNCTION?

// prepare SPTI for Inquiry command
psptdwb->sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
psptdwb->sptd.PathId = 0;
psptdwb->sptd.CdbLength = CDB6GENERIC_LENGTH;
psptdwb->sptd.SenseInfoLength = 32;
psptdwb->sptd.DataIn = SCSI_IOCTL_DATA_IN;
psptdwb->sptd.DataTransferLength = sizeof(InqData);
psptdwb->sptd.TimeOutValue = 2;
psptdwb->sptd.DataBuffer = InqData;
psptdwb->sptd.SenseInfoOffset = offsetof
(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
ZeroMemory(&psptdwb->sptd.Cdb[0], 16);
psptdwb->sptd.Cdb[0] = 0x12;
psptdwb->sptd.Cdb[1] = psptdwb->sptd.Lun << 5;
psptdwb->sptd.Cdb[4] = sizeof(InqData);

length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
status = DeviceIoControl(
fileHandle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
psptdwb,
length,
psptdwb,
length,
&returned,
FALSE
);

>>> FAILS WITH INCORRECT FUNCTION - ???

Bill Casey

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    The difference is in access flags when opening a scsi port.

    ----------
    ??: Bill Casey[SMTP:[email protected]]
    ?????: NT Developers Interest List
    ??????????: 26 ??? 2000 ?. 21:09
    ????: NT Developers Interest List
    ????: [ntdev] SCSI_PASS_THROUGH

    Q1: Does SCSI_PASS_THROUGH still work under Win2000?

    If yes, why does this initial INQ cmd (after successfully opening
    'scsi2:') fail with INCORRECT_FUNCTION?

    // prepare SPTI for Inquiry command
    psptdwb->sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
    psptdwb->sptd.PathId = 0;
    psptdwb->sptd.CdbLength = CDB6GENERIC_LENGTH;
    psptdwb->sptd.SenseInfoLength = 32;
    psptdwb->sptd.DataIn = SCSI_IOCTL_DATA_IN;
    psptdwb->sptd.DataTransferLength = sizeof(InqData);
    psptdwb->sptd.TimeOutValue = 2;
    psptdwb->sptd.DataBuffer = InqData;
    psptdwb->sptd.SenseInfoOffset = offsetof
    (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
    ZeroMemory(&psptdwb->sptd.Cdb[0], 16);
    psptdwb->sptd.Cdb[0] = 0x12;
    psptdwb->sptd.Cdb[1] = psptdwb->sptd.Lun << 5;
    psptdwb->sptd.Cdb[4] = sizeof(InqData);

    length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
    status = DeviceIoControl(
    fileHandle,
    IOCTL_SCSI_PASS_THROUGH_DIRECT,
    psptdwb,
    length,
    psptdwb,
    length,
    &returned,
    FALSE
    );

    >>> FAILS WITH INCORRECT FUNCTION - ???

    Bill Casey


    ---
    You are currently subscribed to ntdev as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Hi:

    Yes is still works under windows 2000. The first thing to check
    is the access level you choose when creating the handle. Windows 2000
    scsi pass through must have a specific access level set. Both
    GENERIC_READ and GENERIC_WRITE must be set.

    > -----Original Message-----
    > From: Bill Casey [SMTP:[email protected]]
    > Sent: Friday, May 26, 2000 10:21 AM
    > To: David Jones; Wyler Furgeson
    > Subject: [ntdev] SCSI_PASS_THROUGH
    >
    > Q1: Does SCSI_PASS_THROUGH still work under Win2000?
    >
    > If yes, why does this initial INQ cmd (after successfully opening
    > 'scsi2:') fail with INCORRECT_FUNCTION?
    >
    > // prepare SPTI for Inquiry command
    > psptdwb->sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
    > psptdwb->sptd.PathId = 0;
    > psptdwb->sptd.CdbLength = CDB6GENERIC_LENGTH;
    > psptdwb->sptd.SenseInfoLength = 32;
    > psptdwb->sptd.DataIn = SCSI_IOCTL_DATA_IN;
    > psptdwb->sptd.DataTransferLength = sizeof(InqData);
    > psptdwb->sptd.TimeOutValue = 2;
    > psptdwb->sptd.DataBuffer = InqData;
    > psptdwb->sptd.SenseInfoOffset = offsetof
    > (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
    > ZeroMemory(&psptdwb->sptd.Cdb[0], 16);
    > psptdwb->sptd.Cdb[0] = 0x12;
    > psptdwb->sptd.Cdb[1] = psptdwb->sptd.Lun << 5;
    > psptdwb->sptd.Cdb[4] = sizeof(InqData);
    >
    > length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
    > status = DeviceIoControl(
    > fileHandle,
    > IOCTL_SCSI_PASS_THROUGH_DIRECT,
    > psptdwb,
    > length,
    > psptdwb,
    > length,
    > &returned,
    > FALSE
    > );
    >
    > >>> FAILS WITH INCORRECT FUNCTION - ???
    >
    > Bill Casey
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Writing WDF Drivers TBD 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online