hi,
i have a problem with my application…the problem is that my vc++ program take size of only last session of a mutisession cd…and work according to it…suppose size of last session is 925 blocks then it only reads 925 blocks from firstsession…however size of first session is 4402 blocks…how can i read the remaining portion of cd…???
//create handle for cdrom f:
hCD = CreateFile("\\.\F:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hCD != INVALID_HANDLE_VALUE)
{
DISK_GEOMETRY dgCDROM;
PREVENT_MEDIA_REMOVAL pmrLockCDROM;
if (DeviceIoControl (hCD, IOCTL_CDROM_GET_DRIVE_GEOMETRY,
NULL, 0, &dgCDROM, sizeof(dgCDROM),
&dwNotUsed, NULL))
{ SetFilePointer(hCD, dgCDROM.BytesPerSector *16,
NULL, FILE_BEGIN);
ReadFile (hCD, &buf, 2048, &dwNotUsed, NULL);//buf is pvd
}
}
above code is work well…but problem in below code…
suppose if we want to take pvd of last session which is at 94536 block…then i set file pointer to dgCDROM.BytesPerSector *94536 then it can’t work…readfile function returns 1 but dwNotUsed is 0.
i know why it is happened because the last session size is 925 blocks…how overcome this problem…???