INFO: Read and Write Access Required for SCSI Pass Through Requests

ID: Q241374


The information in this article applies to:
  • Microsoft Windows NT, versions 4.0, 4.0 SP4, 5.0


SUMMARY

Starting with Windows NT 4.0 Service Pack 4 and beyond (including Windows 2000), there are new access requirements for SCSI (small computer system interface) pass through requests. For SCSI pass through requests, both GENERIC_READ and GENERIC_WRITE access must be specified in the dwDesiredAccess parameter of the CreateFile call.

If both read and write access are not specified, the DeviceIoControl call will fail with ERROR_ACCESS_DENIED (5L).

Note that only members of the administrator's group have the correct authority to send SCSI pass through requests. Users without administrator authority typically fail either CreateFile or DeviceIoControl with ERROR_ACCESS_DENIED (5L).


MORE INFORMATION

Following is a code snippet showing a proper call to CreateFile.



    // Open the device for SCSI pass through requests.  Make
    // sure to specify both GENERIC_READ and GENERIC_WRITE
    // or the SCSI pass through request will fail.

    hDevice = CreateFile("\\\\.\\F:,
                         GENERIC_READ | GENERIC_WRITE,
                         FILE_SHARE_READ | FILE_SHARE_WRITE,
                         NULL, 
                         OPEN_EXISTING, 
                         FILE_ATTRIBUTE_NORMAL,
                         NULL
                         );

    // Check that CreateFile worked.  If it fails, it returns
    // an invalid handle.

    if (INVALID_HANDLE_VALUE == hDevice) {
    
        dwErrorCode = GetLastError();
        printf("CreateFile failed.  Error %d \n", dwErrorCode);
        return dwErrorCode;
    }
 

Additional query words: spti IOCTL_SCSI_PASS_THROUGH IOCTL_SCSI_PASS_THROUGH_DIRECT

Keywords : kbDDK kbWinOS2000 kbStorageDev kbNTOS400sp4 kbDSupport kbGrpNTDDK
Version : winnt:4.0,4.0 SP4,5.0
Platform : winnt
Issue type : kbinfo


Last Reviewed: September 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.