mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Changed the detection of the last session from IOCTL_CDROM_READ_TOC to IOCTL_CDROM_GET_LAST_SESSION.
Fixed the calculation of the VolumeOffset. svn path=/trunk/; revision=3512
This commit is contained in:
parent
fe3896a798
commit
60457afcdc
1 changed files with 20 additions and 32 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: fsctl.c,v 1.10 2002/09/15 22:25:05 hbirr Exp $
|
/* $Id: fsctl.c,v 1.11 2002/09/17 20:42:59 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -185,27 +185,32 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Sector;
|
ULONG Sector;
|
||||||
PVD_HEADER VdHeader;
|
PVD_HEADER VdHeader;
|
||||||
PCDROM_TOC Toc;
|
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PTRACK_DATA TrackData;
|
struct
|
||||||
|
{
|
||||||
|
UCHAR Length[2];
|
||||||
|
UCHAR FirstSession;
|
||||||
|
UCHAR LastSession;
|
||||||
|
TRACK_DATA TrackData;
|
||||||
|
}
|
||||||
|
Toc;
|
||||||
|
|
||||||
DPRINT("CdfsGetVolumeData\n");
|
DPRINT("CdfsGetVolumeData\n");
|
||||||
|
|
||||||
Buffer = ExAllocatePool(NonPagedPool,
|
Buffer = ExAllocatePool(NonPagedPool,
|
||||||
max (CDFS_BASIC_SECTOR, CDROM_TOC_SIZE));
|
CDFS_BASIC_SECTOR);
|
||||||
|
|
||||||
if (Buffer == NULL)
|
if (Buffer == NULL)
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
|
||||||
Toc = (PCDROM_TOC)Buffer;
|
Size = sizeof(Toc);
|
||||||
Size = sizeof(CDROM_TOC);
|
|
||||||
Status = CdfsDeviceIoControl(DeviceObject,
|
Status = CdfsDeviceIoControl(DeviceObject,
|
||||||
IOCTL_CDROM_READ_TOC,
|
IOCTL_CDROM_GET_LAST_SESSION,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
Toc,
|
&Toc,
|
||||||
&Size);
|
&Size);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -213,34 +218,17 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKPOINT;
|
DPRINT("FirstSession %d, LastSession %d, FirstTrack %d\n",
|
||||||
if (Toc->FirstTrack == 0xaa)
|
Toc.FirstSession, Toc.LastSession, Toc.TrackData.TrackNumber);
|
||||||
{
|
|
||||||
ExFreePool(Buffer);
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = Toc->LastTrack; i >= Toc->FirstTrack; i--)
|
Offset = 0;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
TrackData = &Toc->TrackData[i - 1];
|
Offset = (Offset << 8) + Toc.TrackData.Address[i];
|
||||||
if (TrackData->Control & 0x4)
|
|
||||||
{
|
|
||||||
/* we have found the last data session */
|
|
||||||
CHECKPOINT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
CdInfo->VolumeOffset = Offset;
|
||||||
|
|
||||||
if (i < Toc->FirstTrack)
|
DPRINT("Offset of first track in last session %d\n", Offset);
|
||||||
{
|
|
||||||
/* there is no data session on the cd */
|
|
||||||
CHECKPOINT;
|
|
||||||
ExFreePool(Buffer);
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset = msf_to_lba(TrackData->Address[1], TrackData->Address[2], TrackData->Address[3]);
|
|
||||||
CdInfo->VolumeOffset = Offset * BLOCKSIZE;
|
|
||||||
|
|
||||||
CdInfo->JolietLevel = 0;
|
CdInfo->JolietLevel = 0;
|
||||||
VdHeader = (PVD_HEADER)Buffer;
|
VdHeader = (PVD_HEADER)Buffer;
|
||||||
|
|
Loading…
Reference in a new issue