Index: mtools-4.0.33-1+really4.0.32/fat.c =================================================================== --- mtools-4.0.33-1+really4.0.32.orig/fat.c +++ mtools-4.0.33-1+really4.0.32/fat.c @@ -602,8 +602,13 @@ static void set_fat32(Fs_t *This) } } -void set_fat(Fs_t *This) { - if(This->num_clus < FAT12) +void set_fat(Fs_t *This, bool haveBigFatLen) { + if(haveBigFatLen) { + /* This is how Windows 10 behaves, despite + fatgen103's stern assertion otherwise */ + set_fat32(This); + } + else if(This->num_clus < FAT12) set_fat12(This); else if(This->num_clus < FAT16) set_fat16(This); @@ -767,7 +772,7 @@ int fat_read(Fs_t *This, union bootsecto This->lastFatSectorNr = 0; This->lastFatSectorData = 0; - if(This->num_clus < FAT16) + if(This->fat_bits <= 16) return old_fat_read(This, boot, nodups); else return fat_32_read(This, boot); Index: mtools-4.0.33-1+really4.0.32/fsP.h =================================================================== --- mtools-4.0.33-1+really4.0.32.orig/fsP.h +++ mtools-4.0.33-1+really4.0.32/fsP.h @@ -88,7 +88,7 @@ typedef struct Fs_t { int fs_free(Stream_t *Stream); -void set_fat(Fs_t *This); +void set_fat(Fs_t *This, bool haveBigFatLen); unsigned int get_next_free_cluster(Fs_t *Fs, unsigned int last); unsigned int fatDecode(Fs_t *This, unsigned int pos); void fatAppend(Fs_t *This, unsigned int pos, unsigned int newpos); Index: mtools-4.0.33-1+really4.0.32/init.c =================================================================== --- mtools-4.0.33-1+really4.0.32.orig/init.c +++ mtools-4.0.33-1+really4.0.32/init.c @@ -397,6 +397,7 @@ uint32_t parseFsParams( Fs_t *This, unsigned int cylinder_size) { uint32_t tot_sectors; + int haveBigFatLen = 0; if ((media & ~7) == 0xf8){ /* This bit of code is only entered if there is no BPB, or @@ -456,6 +457,7 @@ uint32_t parseFsParams( Fs_t *This, } else { labelBlock = &boot->boot.ext.fat32.labelBlock; This->fat_len = DWORD(ext.fat32.bigFat); + haveBigFatLen = 1; This->backupBoot = WORD(ext.fat32.backupBoot); } @@ -468,7 +470,7 @@ uint32_t parseFsParams( Fs_t *This, if(calc_num_clus(This, tot_sectors) < 0) /* Too few sectors */ return 0; - set_fat(This); + set_fat(This, haveBigFatLen); return tot_sectors; } Index: mtools-4.0.33-1+really4.0.32/mformat.c =================================================================== --- mtools-4.0.33-1+really4.0.32.orig/mformat.c +++ mtools-4.0.33-1+really4.0.32/mformat.c @@ -367,7 +367,7 @@ static void check_fs_params_and_set_fat( assert(clusters_fit_into_fat(Fs)); #endif provisional_fat_bits = Fs->fat_bits; - set_fat(Fs); + set_fat(Fs, provisional_fat_bits == 32); #ifdef HAVE_ASSERT_H assert(provisional_fat_bits == Fs->fat_bits); #endif