Microsoft KB Archive/241374

{|
 * width="100%"|

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

 * }

Q241374

-

The information in this article applies to:


 * Microsoft Windows NT Server versions 4.0, 4.0 SP4
 * Microsoft Windows NT Workstation versions 4.0, 4.0 SP4

-

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 kbOSWin2000 kbStorageDev kbOSWinNT400sp4 _IK kbGrpDSNTDDK

Issue type : kbinfo

Technology : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT400xsearch kbWinNTW400sp4 kbWinNTSsearch kbWinNTS400sp4 kbWinNTS400xsearch kbWinNTS400