I am working on a project where i have to read the data from cd-rom through
USB and Firewire,I tried to read the data using the SCSI_PASS_THROUHGH, but
it is not working, when i issue the scsi read command, the data buffer is not
being filled with data, it just stays empty.Does any body know what is wrong
with my code(i have pasted the code below) or is there any other way to get
the Data From cd-rom throgh USB and Fire wire, any help would be appreciated.
// read
ZeroMemory( &szBuffer, 2052 );
ZeroMemory( szPassThroughStruct, 256 );
pswb= (PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER)szPassThrou ghStruct;
pswb->spt.Length= sizeof(SCSI_PASS_THROUGH);
pswb->spt.CdbLength= 10;
pswb->spt.SenseInfoLength= 24;
pswb->spt.DataIn= SCSI_IOCTL_DATA_IN;
pswb->spt.DataTransferLength = 2052;//read raw sector
pswb->spt.TimeOutValue= 2;
pswb->spt.DataBuffer= pMem;
pswb->spt.SenseInfoOffset=
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSe nseBuf );
pswb->spt.Cdb[0]= 0x28;
DWORD dwSector=sectorNum;
pswb->spt.Cdb[2]= (BYTE)(dwSector >> 24);
pswb->spt.Cdb[3]= (BYTE)((dwSector >> 16) & 0xFF);
pswb->spt.Cdb[4]= (BYTE)((dwSector >> 8) & 0xFF);
pswb->spt.Cdb[5]= (BYTE)(dwSector & 0xFF);
WORD transferLength=dataLength;
pswb->spt.Cdb[7]= (BYTE) ((transferLength>>8) & 0xFF);
pswb->spt.Cdb[8]= (BYTE) (transferLength & 0xFF);
returned = 0;
length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
dwReturn = DeviceIoControl( hDevice,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
pswb,
length,
pswb,
length,
&returned,
NULL );
--
imran