SCSI Pass-Through Interface

Hi!

I hope someone can help me with a problem accessing SCSI drives via the
Windows NT Pass-Through Interface under Windows 2000.

After calling DeviceIoControl, I get a sense key telling me that I have an
invalid field in my CDB. This happens with almost all commands that require
some data to be returned.

typedef struct _NT_SCSI_REQUEST_DIRECT
{
SCSI_PASS_THROUGH_DIRECT sPass;
SENSE_DATA sSense;
} NT_SCSI_REQUEST_DIRECT;

hDrive = ::CreateFile (
strDeviceName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);

CDVD_CAPABILITIES_PAGE sCapabilities;

// Set up CDB
memset (&sCDB.MODE_SENSE10, 0, sizeof (sCDB.MODE_SENSE10));
sCDB.MODE_SENSE10.Pc = 0;
sCDB.MODE_SENSE10.PageCode = 0x2A;
sCDB.MODE_SENSE10.AllocationLength [1] = sizeof (sCapabilities);

// Clear Mode Page
memset (&sCapabilities, 0, sizeof (sCapabilities));

// Set up structure for DeviceIoControl
memset (&sScsiRequest, 0, sizeof (sScsiRequest));
sScsiRequest.sPass.Length = sizeof (sScsiRequest.sPass);
// SCSI Address
sScsiRequest.sPass.PathId = psDeviceInfo->sScsiAddress.PathId;
sScsiRequest.sPass.TargetId = psDeviceInfo->sScsiAddress.TargetId;
sScsiRequest.sPass.Lun = psDeviceInfo->sScsiAddress.Lun;
// CDB Information
memcpy (sScsiRequest.sPass.Cdb, &sCDB.MODE_SENSE10, sizeof
(sCDB.MODE_SENSE10));
sScsiRequest.sPass.CdbLength = sizeof (sCDB.MODE_SENSE10);
// Data
sScsiRequest.sPass.DataBuffer = &sCapabilities;
sScsiRequest.sPass.DataTransferLength = sizeof (sCapabilities);
sScsiRequest.sPass.DataIn = SCSI_IOCTL_DATA_IN;
// Sense Information
sScsiRequest.sPass.SenseInfoOffset = offsetof (NT_SCSI_REQUEST_DIRECT,
sSense);
sScsiRequest.sPass.SenseInfoLength = sizeof (sScsiRequest.sSense);
// Timeout
sScsiRequest.sPass.TimeOutValue = 30; // 15s

// Sending command
bResult = ::DeviceIoControl (
hDrive,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&sScsiRequest,
sizeof (sScsiRequest),
&sScsiRequest,
sizeof (sScsiRequest),
&dwBytesReturned,
NULL);

Regards,

Ren?


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> “JUNG, Rene” wrote in message news:xxxxx@ntfsd…
> I hope someone can help me with a problem accessing SCSI drives via the
> Windows NT Pass-Through Interface under Windows 2000.

OT. Try the NTDEV mailing list. Someone there is sure to be able to help.

Peter
OSR


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com