[ros-diffs] [cgutman] 52285: [VFATLIB] - Write the boot sector signature to the new boot sector after formatting - Volumes formatted after setup are now mountable

cgutman at svn.reactos.org cgutman at svn.reactos.org
Thu Jun 16 22:16:32 UTC 2011


Author: cgutman
Date: Thu Jun 16 22:16:31 2011
New Revision: 52285

URL: http://svn.reactos.org/svn/reactos?rev=52285&view=rev
Log:
[VFATLIB]
- Write the boot sector signature to the new boot sector after formatting
- Volumes formatted after setup are now mountable

Modified:
    trunk/reactos/lib/fslib/vfatlib/fat12.c
    trunk/reactos/lib/fslib/vfatlib/fat16.c
    trunk/reactos/lib/fslib/vfatlib/fat32.c

Modified: trunk/reactos/lib/fslib/vfatlib/fat12.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/fat12.c?rev=52285&r1=52284&r2=52285&view=diff
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/fat12.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/fat12.c [iso-8859-1] Thu Jun 16 22:16:31 2011
@@ -56,11 +56,11 @@
 {
     IO_STATUS_BLOCK IoStatusBlock;
     NTSTATUS Status;
-    PUCHAR NewBootSector;
+    PFAT16_BOOT_SECTOR NewBootSector;
     LARGE_INTEGER FileOffset;
 
     /* Allocate buffer for new bootsector */
-    NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap (),
+    NewBootSector = (PFAT16_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap (),
                                             0,
                                             BootSector->BytesPerSector);
     if (NewBootSector == NULL)
@@ -70,9 +70,12 @@
     memset(NewBootSector, 0, BootSector->BytesPerSector);
 
     /* Copy FAT16 BPB to new bootsector */
-    memcpy((NewBootSector + 3),
+    memcpy(&NewBootSector->OEMName[0],
            &BootSector->OEMName[0],
            59); /* FAT16 BPB length (up to (not including) Res2) */
+
+    /* Write the boot sector signature */
+    NewBootSector->Signature1 = 0xAA550000;
 
     /* Write sector 0 */
     FileOffset.QuadPart = 0ULL;

Modified: trunk/reactos/lib/fslib/vfatlib/fat16.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/fat16.c?rev=52285&r1=52284&r2=52285&view=diff
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/fat16.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/fat16.c [iso-8859-1] Thu Jun 16 22:16:31 2011
@@ -56,11 +56,11 @@
 {
     IO_STATUS_BLOCK IoStatusBlock;
     NTSTATUS Status;
-    PUCHAR NewBootSector;
+    PFAT16_BOOT_SECTOR NewBootSector;
     LARGE_INTEGER FileOffset;
 
     /* Allocate buffer for new bootsector */
-    NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
+    NewBootSector = (PFAT16_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap(),
                                             0,
                                             BootSector->BytesPerSector);
     if (NewBootSector == NULL)
@@ -70,9 +70,12 @@
     memset(NewBootSector, 0, BootSector->BytesPerSector);
 
     /* Copy FAT16 BPB to new bootsector */
-    memcpy((NewBootSector + 3),
+    memcpy(&NewBootSector->OEMName[0],
            &BootSector->OEMName[0],
            59); /* FAT16 BPB length (up to (not including) Res2) */
+
+    /* Write the boot sector signature */
+    NewBootSector->Signature1 = 0xAA550000;
 
     /* Write sector 0 */
     FileOffset.QuadPart = 0ULL;

Modified: trunk/reactos/lib/fslib/vfatlib/fat32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/fat32.c?rev=52285&r1=52284&r2=52285&view=diff
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/fat32.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/fat32.c [iso-8859-1] Thu Jun 16 22:16:31 2011
@@ -56,11 +56,11 @@
 {
     IO_STATUS_BLOCK IoStatusBlock;
     NTSTATUS Status;
-    PUCHAR NewBootSector;
+    PFAT32_BOOT_SECTOR NewBootSector;
     LARGE_INTEGER FileOffset;
 
     /* Allocate buffer for new bootsector */
-    NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
+    NewBootSector = (PFAT32_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap(),
                                             0,
                                             BootSector->BytesPerSector);
     if (NewBootSector == NULL)
@@ -70,9 +70,12 @@
     memset(NewBootSector, 0, BootSector->BytesPerSector);
 
     /* Copy FAT32 BPB to new bootsector */
-    memcpy((NewBootSector + 3),
+    memcpy(&NewBootSector->OEMName[0],
            &BootSector->OEMName[0],
            87); /* FAT32 BPB length (up to (not including) Res2) */
+
+    /* Write the boot sector signature */
+    NewBootSector->Signature1 = 0xAA550000;
 
     /* Write sector 0 */
     FileOffset.QuadPart = 0ULL;




More information about the Ros-diffs mailing list