Hi, im trying to get SPTI working, and it work well enough everry scsi
command except mode select, even when i try mode sensing a page and
sending
it straight back it gives me an additional sense of ASC:26 ASQ:00
“invalid
field in paramter list”, my code looks a bit like this, any help anyone
please!!
fileHandle = CreateFile(“\\.\G:”,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE ,
NULL,
OPEN_EXISTING,
0,
NULL);
ZeroMemory(&sptwb,sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.spt.PathId = 0;
sptwb.spt.TargetId = 0;
sptwb.spt.Lun = 0;
sptwb.spt.CdbLength = CDB6GENERIC_LENGTH;
sptwb.spt.SenseInfoLength = 159;
sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN;
sptwb.spt.DataTransferLength = 192;
sptwb.spt.TimeOutValue = 2;
sptwb.spt.DataBufferOffset
=offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf);
sptwb.spt.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucSenseBuf);
sptwb.spt.Cdb[0] = SCSIOP_MODE_SENSE;
sptwb.spt.Cdb[1] = (3<<5);
sptwb.spt.Cdb[2] = 0x02;
sptwb.spt.Cdb[3] = 0;
sptwb.spt.Cdb[4] = 192;
sptwb.spt.Cdb[5] = 0;
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf) +
sptwb.spt.DataTransferLength;
status = DeviceIoControl(fileHandle,
IOCTL_SCSI_PASS_THROUGH,
&sptwb,
sizeof(SCSI_PASS_THROUGH),
&sptwb,
length,
&returned,
FALSE);
// sptwb.ucDataBuf[12]=0x03;
printf(“%02x\n”,sptwb.ucDataBuf[12]);
if (!status ) {
printf( “Error in io control(cdb); error was %d\n”,
errorCode = GetLastError() );
}
cout < printf(“Scsi status: %02Xh\n\n”,sptwb.spt.ScsiStatus);
if (sptwb.spt.ScsiStatus ==0x02){
cout <<“Check Condition”< }
if (sptwb.spt.ScsiStatus ==0x00){
cout <<“Good”< }
sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.spt.PathId = 0;
sptwb.spt.TargetId = 0;
sptwb.spt.Lun = 0;
sptwb.spt.CdbLength = CDB6GENERIC_LENGTH;
sptwb.spt.SenseInfoLength = 159;
sptwb.spt.DataIn = SCSI_IOCTL_DATA_OUT;
sptwb.spt.DataTransferLength = sptwb.ucDataBuf[0];
sptwb.spt.TimeOutValue = 2;
sptwb.spt.DataBufferOffset
=offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf);
sptwb.spt.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucSenseBuf);
sptwb.spt.Cdb[0] = SCSIOP_MODE_SELECT;
sptwb.spt.Cdb[1] = 1+(3<<5);
sptwb.spt.Cdb[2] = 0;
sptwb.spt.Cdb[3] = 0;
sptwb.spt.Cdb[4] = sptwb.ucDataBuf[0];
sptwb.spt.Cdb[5] = 0;
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf) +
sptwb.spt.DataTransferLength;
status = DeviceIoControl(fileHandle,
IOCTL_SCSI_PASS_THROUGH,
&sptwb,
length,
&sptwb,
length,
&returned,
FALSE);
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com