Scsi Rewind Failing - Error "Access is Denied"

hemanth_hp

What is this storage?
Joined
Mar 21, 2007
Messages
16
Location
India
Hi
I am issuing the scsi commands to the Tape device \\\\.\\Tape0 using SCSI_PASS_THROUGH interface but the DeviceIoControl() is failing and returning the error code as 5 which is "Access is Denied" the code is here. Can you let me know is anything wrong in it?

memset(&stScsiCmd, 0, sizeof(stScsiCmd));
memset(bRqBuf, 0, sizeof(bRqBuf));
memset(bCdb, 0, sizeof(bCdb));

bCdb[0] = MTU_REWIND; // Rewind command 01h
bCdb[1] = IMMMODE; // Immed bit=0

stScsiCmd.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
stScsiCmd.sptd.CdbLength = CDB_GROUP0;
stScsiCmd.sptd.DataIn = SCSI_IOCTL_DATA_IN;
stScsiCmd.sptd.SenseInfoLength = sizeof(stScsiCmd.ucSenseBuf); //RQLEN;
stScsiCmd.sptd.DataTransferLength = sizeof(bRqBuf);
stScsiCmd.sptd.TimeOutValue = g_stDeviceData.uiScsiTimeOut;
stScsiCmd.sptd.DataBuffer = bRqBuf;
stScsiCmd.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
memcpy(stScsiCmd.sptd.Cdb, bCdb, CDB_GROUP0);

//length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);

iResult = DeviceIoControl(hDevHndl,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&stScsiCmd,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&stScsiCmd,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&returned,
FALSE);

errCode = GetLastError();
//0 is for failure
if ((iResult == 0) || (stScsiCmd.sptd.ScsiStatus != 0))
{
return -1;
}
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,637
Location
I am omnipresent
Er...
Did you do any of the usual sorts of SCSI troubleshooting?

Check cabling? Termination? Isolate the drive on your SCSI bus?
 

hemanth_hp

What is this storage?
Joined
Mar 21, 2007
Messages
16
Location
India
Scsi Rewind

Scsi troubleshooting in the sense. I didnt get you.

Cabling is fine. Terminattion means?

Er...
Did you do any of the usual sorts of SCSI troubleshooting?

Check cabling? Termination? Isolate the drive on your SCSI bus?
 

hemanth_hp

What is this storage?
Joined
Mar 21, 2007
Messages
16
Location
India
Here is the code

hDevHandle = CreateFile( szDevPath,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
i was using only the GENERIC_READ, FILE_SHARE_READ parameters
 
Top