Comments (2)
I discussed this in dosemu2/fdpp#202 (comment) too.
from kernel.
Quoting me from that thread:
mtools just had this edge case fixed. The truth is that the word (16-bit) "sectors per FAT" field being zero indicates using both the larger EBPB and FAT32. It doesn't really matter how many clusters there are, you can create a FAT32 file system with less than 64 Ki clusters. That seems to be what most drivers, including Microsoft's, actually do.
Quoting from the mailing list for mtools: https://lists.gnu.org/archive/html/info-mtools/2022-09/msg00003.html
Actually, according to Microsoft's specification, number of FAT bits of
an existing filesystem is SOLELY determined by the number of clusters.
This applies to all three bit numbers: 12/16/32Yes, the (in)famous fatgen103.pdf document, retired from Microsoft's own
site, but still available at
https://web.archive.org/web/20210723100623/http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc
It sternly says at page 14:
"It is really quite simple how this works. The FAT typeβ one of FAT12,
FAT16, or FAT32βis determined by the count of clusters on the volume
and nothing else."
But see below...:
[...]But as Alain pointed Microsoft FAT implementation (fastfat.sys) for
FAT32 detection does not use number of clusters, but rather explicit
marking of FAT32. Same behavior has Linux kernel implementation
(msdos.ko and vfat.ko) and same in dosfstools project. Hence this
non-standard FAT32 can be still created by mkfs.fat.Actually, what I meant in my previous mail was that everything else
that is referred to in the FAT32 extended boot block (root directory
location, etc.) would depend on this explicit marking
(fatLen/bigFatLen), but not the number of FAT bits themselves.
However, your remark got me thinking, and so I tried it out on a Windows
10 VM.
... and lo and behold: the mere presence of a FAT32 extended boot block
(as signaled by fat_len being 0) was enough to make it use 32 fat bits,
even if the number of clusters was too low for FAT32.
Sorry for having been to easily misled by an assertive, but nonfactual,
Microsoft statement.
Given this finding, I'll shortly make a new mtools release that will
consider presence of FAT32 extended boot block as well for picking
appropriate number of FAT bits.
if (DiskTransferBuffer[0x26] == 0x29) // BPB v4.1 offset = 0x27;
This seems wrong. If you have a FAT32 EBPB then the byte at offset 26h is part of the ebpbSectorsPerFATLarge field, for which 29h would be a valid value. You should check bpbSectorsPerFAT == 0 to determine whether to use the EBPB or BPB new fields.
from kernel.
Related Issues (20)
- When allocating HMA the requested size is not rounded up to paragraph HOT 6
- IDLE HOT 2
- Whether Freedos support exfat in the future ? HOT 2
- port to other Arch?
- 8086+ or 386+ ? HOT 3
- BPB to DPB catch-22 HOT 9
- BytesPerSector
- Exec syscall on empty (0 byte) executable file results in NC, nothing loaded HOT 2
- The github blurb says "released under the GPL v2", should be "GNU GPL v2+" HOT 2
- gcc kernel crash upon initialisation, due to using HMATEXT memcpy implicitly in DoConfig HOT 8
- Depack utility for UPX-compressed FreeDOS kernel HOT 1
- OW 8086 build fails to boot HOT 3
- Can't hook BIOS interrupt 15h to limit available XMS memory HOT 2
- Microsoft HIMEM.SYS throws a VDISK memory allocator error when used with FreeDOS HOT 2
- Microsoft EMM386.EXE throws an "incorrect machine type" error when used in FreeDOS
- SYS: When OEM compatibility boot sector enabled and in use, /FORCE:LBA and /FORCE:CHS are silently ignored HOT 1
- Boot sector listing files not named correctly HOT 1
- SYS kernel config incorrectly swaps wrong size 19 to 14, should be to 5 or 6 HOT 5
- Pre-compiled boot records HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kernel.