[FASTFAT]
[reactos.git] / reactos / drivers / filesystems / fastfat / fsctl.c
index 199919f..ff222f5 100644 (file)
@@ -220,6 +220,7 @@ VfatHasFileSystem(
                     DPRINT("FAT12\n");
                     FatInfo.FatType = FAT12;
                     FatInfo.RootCluster = (FatInfo.rootStart - 1) / FatInfo.SectorsPerCluster;
+                    RtlCopyMemory(&FatInfo.VolumeLabel, &Boot->VolumeLabel, sizeof(FatInfo.VolumeLabel));
                 }
                 else if (FatInfo.NumberOfClusters >= 65525)
                 {
@@ -228,12 +229,14 @@ VfatHasFileSystem(
                     FatInfo.RootCluster = ((struct _BootSector32*) Boot)->RootCluster;
                     FatInfo.rootStart = FatInfo.dataStart + ((FatInfo.RootCluster - 2) * FatInfo.SectorsPerCluster);
                     FatInfo.VolumeID = ((struct _BootSector32*) Boot)->VolumeID;
+                    RtlCopyMemory(&FatInfo.VolumeLabel, &((struct _BootSector32*)Boot)->VolumeLabel, sizeof(FatInfo.VolumeLabel));
                 }
                 else
                 {
                     DPRINT("FAT16\n");
                     FatInfo.FatType = FAT16;
                     FatInfo.RootCluster = FatInfo.rootStart / FatInfo.SectorsPerCluster;
+                    RtlCopyMemory(&FatInfo.VolumeLabel, &Boot->VolumeLabel, sizeof(FatInfo.VolumeLabel));
                 }
 
                 if (PartitionInfoIsValid &&
@@ -332,30 +335,6 @@ VfatHasFileSystem(
     return Status;
 }
 
-/*
- * FUNCTION: Mounts the device
- */
-static
-NTSTATUS
-VfatMountDevice(
-    PDEVICE_EXTENSION DeviceExt,
-    PDEVICE_OBJECT DeviceToMount)
-{
-    NTSTATUS Status;
-    BOOLEAN RecognizedFS;
-
-    DPRINT("Mounting VFAT device...\n");
-
-    Status = VfatHasFileSystem(DeviceToMount, &RecognizedFS, &DeviceExt->FatInfo, FALSE);
-    if (!NT_SUCCESS(Status))
-    {
-        return Status;
-    }
-    DPRINT("MountVfatdev %u, PAGE_SIZE = %d\n", DeviceExt->FatInfo.BytesPerCluster, PAGE_SIZE);
-
-    return STATUS_SUCCESS;
-}
-
 
 /*
  * FUNCTION: Mount the filesystem
@@ -443,11 +422,7 @@ VfatMount(
     DeviceObject->Vpb = Vpb;
     DeviceToMount->Vpb = Vpb;
 
-    Status = VfatMountDevice(DeviceExt, DeviceToMount);
-    if (!NT_SUCCESS(Status))
-    {
-        goto ByeBye;
-    }
+    RtlCopyMemory(&DeviceExt->FatInfo, &FatInfo, sizeof(FATINFO));
 
     DPRINT("BytesPerSector:     %u\n", DeviceExt->FatInfo.BytesPerSector);
     DPRINT("SectorsPerCluster:  %u\n", DeviceExt->FatInfo.SectorsPerCluster);
@@ -643,7 +618,7 @@ VfatVerify(
     PVFAT_IRP_CONTEXT IrpContext)
 {
     PDEVICE_OBJECT DeviceToVerify;
-    NTSTATUS Status = STATUS_SUCCESS;
+    NTSTATUS Status;
     FATINFO FatInfo;
     BOOLEAN RecognizedFS;
     PDEVICE_EXTENSION DeviceExt;
@@ -681,7 +656,7 @@ VfatVerify(
              *   Each write to the root directory must update this crc sum.
              */
             /* HACK */
-            if (!FatInfo.FixedMedia)
+            if (!FatInfo.FixedMedia && FatInfo.FatType >= FATX16)
             {
                 Status = STATUS_WRONG_VOLUME;
             }