mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 07:39:10 +00:00
[VFATLIB]
- Write the boot sector signature to the new boot sector after formatting - Volumes formatted after setup are now mountable svn path=/trunk/; revision=52285
This commit is contained in:
parent
67000c5688
commit
9031a3a34b
|
@ -56,11 +56,11 @@ Fat12WriteBootSector(IN HANDLE FileHandle,
|
|||
{
|
||||
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,10 +70,13 @@ Fat12WriteBootSector(IN HANDLE FileHandle,
|
|||
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;
|
||||
Status = NtWriteFile(FileHandle,
|
||||
|
|
|
@ -56,11 +56,11 @@ Fat16WriteBootSector(IN HANDLE FileHandle,
|
|||
{
|
||||
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,10 +70,13 @@ Fat16WriteBootSector(IN HANDLE FileHandle,
|
|||
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;
|
||||
Status = NtWriteFile(FileHandle,
|
||||
|
|
|
@ -56,11 +56,11 @@ Fat32WriteBootSector(IN HANDLE FileHandle,
|
|||
{
|
||||
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,10 +70,13 @@ Fat32WriteBootSector(IN HANDLE FileHandle,
|
|||
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;
|
||||
Status = NtWriteFile(FileHandle,
|
||||
|
|
Loading…
Reference in a new issue