No subject

Tue Aug 30 17:20:58 CDT 2005

pointing to /. The permissions on his / partition allowed Wine to read
the device directly.

Running Wine as a normal user fixed it for him.

Now onto what I think is a proper fix:
Note that the following check
    if (buff[0] =3D=3D 0xE9 || (buff[0] =3D=3D 0xEB && buff[2] =3D=3D 0x90)=
did pass before the above code snippet is executed, and doesn't
discriminate against other types of bootloaders (as that's what's
usually in the first sector, even a FAT). Indeed, my /dev/hde (boot
drive) MBR does pass the test as grub is installed in /dev/hde. If grub
had been installed in /dev/hde2 (/boot), the test would fail, but if I
had a single partition for /boot and / (rest of tree doesn't matter),
and installed grub in it's first sector rather than MBR, it'd pass.

So maybe we should actually check for the FAT signature at buff[0x36] or
buff[0x52] first, and then do the calculations if we actually do find
one of them.

Make sure we're really looking at a FAT before doing some calculations
based on the contents of the first sector of a partition.


Content-Disposition: attachment; filename=fix-wrong-fat.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=fix-wrong-fat.diff; charset=ISO-8859-15

Index: wine/dlls/kernel/volume.c
RCS file: /home/wine/wine/dlls/kernel/volume.c,v
retrieving revision 1.20
diff -u -r1.20 volume.c
--- wine/dlls/kernel/volume.c	10 Aug 2004 23:43:21 -0000	1.20
+++ wine/dlls/kernel/volume.c	22 Sep 2004 20:05:08 -0000
@@ -491,7 +491,10 @@
         size !=3D SUPERBLOCK_SIZE)
         return FS_ERROR;
-    if (buff[0] =3D=3D 0xE9 || (buff[0] =3D=3D 0xEB && buff[2] =3D=3D 0x90=
+    /* FIXME: do really all FAT have their name beginning with
+     * "FAT" ? (At least FAT12, FAT16 and FAT32 have :)
+     */
+    if (!memcmp(buff+0x36, "FAT", 3) || !memcmp(buff+0x52, "FAT", 3))
         /* guess which type of FAT we have */
         unsigned int sz, nsect, nclust;
@@ -506,14 +509,9 @@
         if (nclust < 65525)
             if (buff[0x26] =3D=3D 0x29 && !memcmp(buff+0x36, "FAT", 3))
-            {
-                /* FIXME: do really all FAT have their name beginning with
-                 * "FAT" ? (At least FAT12, FAT16 and FAT32 have :)
-                 */
                 return FS_FAT1216;
-            }
-        else if (!memcmp(buff+0x52, "FAT", 3)) return FS_FAT32;
+        else if (buff[0x42] =3D=3D 0x29 && !memcmp(buff+0x52, "FAT", 3)) r=
eturn FS_FAT32;
     return FS_UNKNOWN;


More information about the wine-devel mailing list