summaryrefslogtreecommitdiffstats
path: root/src/fat_adv.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-10-20 12:27:45 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-10-20 12:27:45 +0200
commit9398e8ab2cea8b6104bd960d18ba5f443ca710e8 (patch)
tree5bb86166218eb37f59bf67df18a226eb254d5bf4 /src/fat_adv.c
parenta971b56765f155593220732c6d50e7d271c800d8 (diff)
FAT12 media descriptor should be 0xf0. FAT32 Drive number should be 0 or between 0x80 and 0x87.
Diffstat (limited to 'src/fat_adv.c')
-rw-r--r--src/fat_adv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fat_adv.c b/src/fat_adv.c
index 96f6e87..8c17fec 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -1108,7 +1108,6 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
fat_header->sector_size[0]=disk_car->sector_size & 0xFF;
fat_header->sector_size[1]=disk_car->sector_size >>8;
fat_header->fats=fats;
- fat_header->media=0xF8;
fat_header->secs_track=le16(disk_car->geom.sectors_per_head);
fat_header->heads=le16(disk_car->geom.heads_per_cylinder);
fat_header->marker=le16(0xAA55);
@@ -1167,6 +1166,7 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
switch(upart_type)
{
case UP_FAT12:
+ fat_header->media=0xF0; /* Floppy */
if((fat_length==0) || (dir_entries==0))
error=1;
if((newboot[36]<0x80)||(newboot[36]>0x88))
@@ -1183,6 +1183,7 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
newboot[FAT1X_PART_NAME]='\0';
break;
case UP_FAT16:
+ fat_header->media=0xF8; /* Hard Disk*/
if((fat_length==0) || (dir_entries==0))
error=1;
if((newboot[36]<0x80)||(newboot[36]>0x88))
@@ -1199,6 +1200,7 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
newboot[FAT1X_PART_NAME]='\0';
break;
case UP_FAT32:
+ fat_header->media=0xF8; /* Hard Disk*/
if((fat_length==0) || (root_cluster==0))
error=1;
fat_header->fat_length=le16(0);