Last session size limiting range of readable sectors

vbimport

#1

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…???

:doh:


#2

hi,
i am able to access primary volume descriptor in vc++6.0(for path table,root directory )for a single session disc which is described in sixteenth block of cd…but i am unable to access volume descriptor(for path table,root directory) for last session of a multisession cd which is described in first track of last session…how can i access it…???
plz help …


#3

hi,
i am able to access primary volume descriptor in vc++6.0:doh:(for path table,root directory )for a single session disc which is described in sixteenth block of cd…but i am unable to access volume descriptor(for path table,root directory) for last session of a multisession cd which is described in first track of last session…how can i access it…???
plz help …


#4

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…???

:o


#5

Merged threads. No need to start new thread.

Please respect CD Freaks by respecting our rules and do not cross-post.


#6

hi,
i get stuck in a problem …the prob is that i want to set file pointer to the last session of the multisession cd…problem is like this…

//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); //pointer is on the begining of first session
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 createfile function takes the size of last session…and last session size is 925 blocks and it only reads 925 blocks from the first session…how it is possible…“take size of last session but file pointer is on first session” …how overcome this problem…???
:o