[ros-kernel] Bug + correction in cdfs/volume label

Hervé Poussineau poussine at freesurf.fr
Tue Mar 2 10:35:23 CET 2004


Hi,

I have found a problem with volume label in cdfs.
I have a cdrom named REACTOS (curious, isn't it?).

C:\>vol e:
    Volume in drive E: is REA
    Volume Serial Number is 1557-D9AF
C:\>

I'm not too good with Unicode/ASCII and ISO9660 specification, but I think
that I have isolated the problem.

In drivers/fs/cdfs/fsctl.c (L78) :
PCHAR pc;
/* Extract the volume label */
  pc = Pvd->VolumeId;
  pw = CdInfo->VolumeLabel;
  for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH && *pc != ' '; i++)
    {
      *pw++ = (WCHAR)*pc++;
    }
  *pw = 0;
  CdInfo->VolumeLabelLength = i;

As I understand, VolumeLabelLength is the number of letters in the volume
name, and not the number of bytes in the unicode string.

In drivers/fs/cdfs/volinfo.c (L62) :
/* valid entries */
  FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
  memcpy(FsVolumeInfo->VolumeLabel,
  DeviceObject->Vpb->VolumeLabel,
  DeviceObject->Vpb->VolumeLabelLength);

Structure FsVolumeInfo must contain an unicode string and VolumeLabelLength
its length (in bytes).
Here, we copy only the first part of the volume name.

To do as in FAT fs, Vpb->VolumeLabelLength should be the unicode length of
the volume label.
The line 86 (fsctl.c)
  CdInfo->VolumeLabelLength = i;
should be modified as
  CdInfo->VolumeLabelLength = i * sizeof(WCHAR);

After this, result is correct :
C:\>vol e:
    Volume in drive E: is REACTOS
    Volume Serial Number is 1557-D9AF
C:\>

Additional informations :
Using VMWare, CVS version of Reactos (a few days ago)

Regards,

Herve



More information about the Ros-kernel mailing list