hemanth_hp
What is this storage?
Hi
I am issuing the scsi commands to the Tape device \\\\.\\Tape0 using SCSI_PASS_THROUGH interface but the DeviceIoControl() for Tape Erase 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] = SCSIOP_ERASE; // Erase command 19h
bCDB[1] = bEraseType;
sptdwb.sptd.Length= sizeof(SCSI_PASS_THROUGH_DIRECT);
sptdwb.sptd.CdbLength= CDB6GENERIC_LENGTH;
sptdwb.sptd.DataIn= SCSI_IOCTL_DATA_UNSPECIFIED;
sptdwb.sptd.SenseInfoLength= sizeof(sptdwb.ucSenseBuf);
sptdwb.sptd.DataTransferLength= 0;
sptdwb.sptd.TimeOutValue= 5;
sptdwb.sptd.DataBuffer= NULL;
sptdwb.sptd.SenseInfoOffset=
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
memcpy(sptdwb.sptd.Cdb, bCDB, CDB6GENERIC_LENGTH);
status = DeviceIoControl(hTapehandle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&sptdwb,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&sptdwb,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&returned,
FALSE);
errCode = GetLastError();
//0 is for failure
if ((iResult == 0) || (stScsiCmd.sptd.ScsiStatus != 0))
{
return -1;
}
I am issuing the scsi commands to the Tape device \\\\.\\Tape0 using SCSI_PASS_THROUGH interface but the DeviceIoControl() for Tape Erase 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] = SCSIOP_ERASE; // Erase command 19h
bCDB[1] = bEraseType;
sptdwb.sptd.Length= sizeof(SCSI_PASS_THROUGH_DIRECT);
sptdwb.sptd.CdbLength= CDB6GENERIC_LENGTH;
sptdwb.sptd.DataIn= SCSI_IOCTL_DATA_UNSPECIFIED;
sptdwb.sptd.SenseInfoLength= sizeof(sptdwb.ucSenseBuf);
sptdwb.sptd.DataTransferLength= 0;
sptdwb.sptd.TimeOutValue= 5;
sptdwb.sptd.DataBuffer= NULL;
sptdwb.sptd.SenseInfoOffset=
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
memcpy(sptdwb.sptd.Cdb, bCDB, CDB6GENERIC_LENGTH);
status = DeviceIoControl(hTapehandle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&sptdwb,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&sptdwb,
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&returned,
FALSE);
errCode = GetLastError();
//0 is for failure
if ((iResult == 0) || (stScsiCmd.sptd.ScsiStatus != 0))
{
return -1;
}