PATCH: Fixes problems with the cdrom driver not reporting certain data correctly

Eric Pouech eric.pouech at wanadoo.fr
Wed Jan 29 14:42:41 CST 2003


Waldeck Schutzer wrote:
> Some applications I tested failed to work correctly because of 
> incomplete/missing data received from the cdrom driver. The following 
> issues are addressed and should be fixed by this patch:
a few comments
A+

> @@ -380,15 +385,22 @@ static DWORD CDROM_GetDeviceNumber(int d
>  
>  static DWORD CDROM_GetDriveGeometry(int dev, DISK_GEOMETRY* dg)
>  {
> -#if 0
> -    dg->Cylinders.s.LowPart = 1; /* FIXME */
> -    dg->Cylinders.s.HighPart = 0; /* FIXME */
> -    dg->MediaType = 1; /* FIXME */
> -    dg->TracksPerCylinder = 1; /* FIXME */
> -    dg->SectorsPerTrack = 1; /* FIXME */
> -    dg->BytesPerSector= 1; /* FIXME */
> -#endif
> -    return STATUS_NOT_SUPPORTED;
> +  CDROM_TOC   toc;
> +  DWORD ret = 0;
> +  int fsize=0;
> +
> +  if ((ret = CDROM_ReadTOC(dev, &toc)) != 0) return ret;
> +
> +  fsize = FRAME_OF_TOC(toc, toc.LastTrack+1)
> +        - FRAME_OF_TOC(toc, 1); /* Total size in frames */
> +  
> +  dg->Cylinders.s.LowPart = fsize / (64 * 32); 
> +  dg->Cylinders.s.HighPart = 0; 
> +  dg->MediaType = RemovableMedia;  
> +  dg->TracksPerCylinder = 64; 
> +  dg->SectorsPerTrack = 32;  
> +  dg->BytesPerSector= 2048; 
> +  return ret;
>  }
I wonder if the bytes per sector doesn't depend on the mode (XA, CDDA...)


> +    tsz = sizeof(toc->FirstTrack) + sizeof(toc->LastTrack)
> +       + sizeof(TRACK_DATA) * (hdr.cdth_trk1-hdr.cdth_trk0+2);
> +    toc->Length[0] = tsz >> 8;
> +    toc->Length[1] = tsz;
this computation should also be used in the FreeBSD/NetBSD case (at 
least initialize Length to some value)
-- 
Eric Pouech




More information about the wine-patches mailing list