Article ID: 241374 - Last Review: July 22, 2004 - Revision: 3.1

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

This article was previously published under Q241374
Expand all | Collapse all

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;
    }

				

APPLIES TO
  • Microsoft Windows NT Server 4.0 Standard Edition
  • Microsoft Windows NT 4.0 Service Pack 4
  • Microsoft Windows NT Workstation 4.0 Developer Edition
Keywords: 
kbinfo kbstoragedev KB241374
 

Article Translations