diff --git a/sdk/lib/fslib/vfatlib/fat12.c b/sdk/lib/fslib/vfatlib/fat12.c index d3cffdd1457..bf96f8d2ec3 100644 --- a/sdk/lib/fslib/vfatlib/fat12.c +++ b/sdk/lib/fslib/vfatlib/fat12.c @@ -38,9 +38,9 @@ Fat12WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector); /* Copy FAT16 BPB to new bootsector */ - memcpy(&NewBootSector->OEMName[0], - &BootSector->OEMName[0], - FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, OEMName)); + memcpy(&NewBootSector->Jump[0], + &BootSector->Jump[0], + FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, Jump)); /* FAT16 BPB length (up to (not including) Res2) */ /* Write the boot sector signature */ @@ -276,6 +276,10 @@ Fat12Format(IN HANDLE FileHandle, RtlZeroMemory(&BootSector, sizeof(FAT16_BOOT_SECTOR)); memcpy(&BootSector.OEMName[0], "MSWIN4.1", 8); + /* FIXME: Add dummy bootloader for real */ + BootSector.Jump[0] = 0xeb; + BootSector.Jump[1] = 0x3c; + BootSector.Jump[2] = 0x90; BootSector.BytesPerSector = DiskGeometry->BytesPerSector; BootSector.SectorsPerCluster = ClusterSize / BootSector.BytesPerSector; BootSector.ReservedSectors = 1; diff --git a/sdk/lib/fslib/vfatlib/fat16.c b/sdk/lib/fslib/vfatlib/fat16.c index d0beaa39454..1438532390b 100644 --- a/sdk/lib/fslib/vfatlib/fat16.c +++ b/sdk/lib/fslib/vfatlib/fat16.c @@ -38,9 +38,9 @@ Fat16WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector); /* Copy FAT16 BPB to new bootsector */ - memcpy(&NewBootSector->OEMName[0], - &BootSector->OEMName[0], - FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, OEMName)); + memcpy(&NewBootSector->Jump[0], + &BootSector->Jump[0], + FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, Jump)); /* FAT16 BPB length (up to (not including) Res2) */ /* Write the boot sector signature */ @@ -283,6 +283,10 @@ Fat16Format(IN HANDLE FileHandle, RtlZeroMemory(&BootSector, sizeof(FAT16_BOOT_SECTOR)); memcpy(&BootSector.OEMName[0], "MSWIN4.1", 8); + /* FIXME: Add dummy bootloader for real */ + BootSector.Jump[0] = 0xeb; + BootSector.Jump[1] = 0x3c; + BootSector.Jump[2] = 0x90; BootSector.BytesPerSector = DiskGeometry->BytesPerSector; BootSector.SectorsPerCluster = ClusterSize / BootSector.BytesPerSector; BootSector.ReservedSectors = 1; diff --git a/sdk/lib/fslib/vfatlib/fat32.c b/sdk/lib/fslib/vfatlib/fat32.c index 030f1206b6c..1987af4fdde 100644 --- a/sdk/lib/fslib/vfatlib/fat32.c +++ b/sdk/lib/fslib/vfatlib/fat32.c @@ -38,9 +38,9 @@ Fat32WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector); /* Copy FAT32 BPB to new bootsector */ - memcpy(&NewBootSector->OEMName[0], - &BootSector->OEMName[0], - FIELD_OFFSET(FAT32_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT32_BOOT_SECTOR, OEMName)); + memcpy(&NewBootSector->Jump[0], + &BootSector->Jump[0], + FIELD_OFFSET(FAT32_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT32_BOOT_SECTOR, Jump)); /* FAT32 BPB length (up to (not including) Res2) */ /* Write the boot sector signature */ @@ -428,6 +428,10 @@ Fat32Format(IN HANDLE FileHandle, RtlZeroMemory(&BootSector, sizeof(FAT32_BOOT_SECTOR)); memcpy(&BootSector.OEMName[0], "MSWIN4.1", 8); + /* FIXME: Add dummy bootloader for real */ + BootSector.Jump[0] = 0xeb; + BootSector.Jump[1] = 0x58; + BootSector.Jump[2] = 0x90; BootSector.BytesPerSector = DiskGeometry->BytesPerSector; BootSector.SectorsPerCluster = ClusterSize / BootSector.BytesPerSector; BootSector.ReservedSectors = 32; diff --git a/sdk/lib/fslib/vfatlib/vfatlib.h b/sdk/lib/fslib/vfatlib/vfatlib.h index 40b1de376e7..20788510a78 100644 --- a/sdk/lib/fslib/vfatlib/vfatlib.h +++ b/sdk/lib/fslib/vfatlib/vfatlib.h @@ -27,9 +27,7 @@ #include typedef struct _FAT16_BOOT_SECTOR { - unsigned char magic0; // 0 - unsigned char res0; // 1 - unsigned char magic1; // 2 + unsigned char Jump[3]; // 0 unsigned char OEMName[8]; // 3 unsigned short BytesPerSector; // 11 unsigned char SectorsPerCluster; // 13 @@ -55,9 +53,7 @@ typedef struct _FAT16_BOOT_SECTOR typedef struct _FAT32_BOOT_SECTOR { - unsigned char magic0; // 0 - unsigned char res0; // 1 - unsigned char magic1; // 2 + unsigned char Jump[3]; // 0 unsigned char OEMName[8]; // 3 unsigned short BytesPerSector; // 11 unsigned char SectorsPerCluster; // 13