- 积分
- 14
- 下载分
- 分
- 威望
- 点
- 原创币
- 点
- 下载
- 次
- 上传
- 次
- 注册时间
- 2012-3-23
- 精华
|
马上注册,获取阅读精华内容及下载权限
您需要 登录 才可以下载或查看,没有帐号?注册
x
编程工具:MASM 6.0
我很想知道32位分区中:主引导扇区、分区表、引导扇区、文件分配表、ROOT区的详细格式说明。
回答:
目前还没有找到完整的微软的技术说明,只是在Windows 98 Resource Kit中有一些说明。下面是部分相关内容:
32-bit File Allocation Table
The purpose of the FAT has not changed. It still acts as a table for linking the clusters of a file together. File/Directory entries point to the first cluster in the file which the operating system uses to find the first entry in the FAT. The FAT then tracks the location of the remaining clusters in the file. The entries are twice the size (4 bytes) and you can hold many more clusters on a FAT32 drive.
With the 16-bit FAT, the quantity of clusters on a drive is 65,525 (216 with 10 reserved). With a 32-bit FAT, the highest 4 bits of the 32-bit values are reserved and are not part of the cluster number. Therefore, the maximum amount of clusters on a 32-bit FAT is: 268,435,445 (228 with 10 reserved).
Stepping Through a FAT32 Entry
The starting cluster given in the file/directory entry tells the operating system where to find the first piece of that file. The starting cluster also tells the operating system where to look in FAT32 for the next cluster number. The entry for a starting cluster in a file entry is in bold below.
49 4F 20 20 20 20 20 20-44 4F 53 07 00 00 00 00 IO SYS.....
00 00 00 00 00 00 80 32-3E 1B 02 00 46 9F 00 00 .......2....F...
Two additional entries are used in the 32-bit directory entry. These two entries are taken from a reserved area and in this example are shown above as 00 00. Together with the existing 2 byte entry (02 00), there is a four-byte entry (00 00 00 02) to search the FAT. The following is a sample tracing of the file in a 32-bit FAT:
F8 FF FF 0F FF FF FF 0F-03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00-07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00-0B 00 00 00 0C 00 00 00
0D 00 00 00 0E 00 00 00-0F 00 00 00 10 00 00 00
11 00 00 00 12 00 00 00-13 00 00 00 14 00 00 00
15 00 00 00 16 00 00 00-17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00-1B 00 00 00 FF FF FF F8
As with FAT16, F8 is the media descriptor byte. The next 7 bytes, FF FF 0F FF FF FF 0F, are reserved. The clusters are grouped in 4 byte numbers as:
03 00 00 00, 04 00 00 00, 05 00 00 00, 06 00 00 00
And so on. Invert the numbers to read:
00 00 00 03, 00 00 00 04, 00 00 00 05, 00 00 00 06
And so on, to trace the file through the FAT. (The contents in the second entry is 00 00 00 03. F8 FF FF FF, and FF FF FF 0F are grouped as entries 0 and 1 respectively.) The new end of file marker is FF FF FF F8.
How Win.com Determines Improper Shutdown
Of the first 112 bytes of the FAT32, the first 8 bytes are reserved. The eighth byte of the reserved area, by default, is 0F. The virtual file allocation table (VFAT) and the Windows 98 shutdown process manipulate the fourth bit of this byte to 1 or 0.
• 0 = VFAT has written to disk
• 1 = Windows has properly shutdown
When you write a file to the disk, VFAT handles the write. During the write, VFAT clears the fourth bit to 0 (07h). When Windows 98 exits properly, this bit is reset to 1. During reboot, Win.com reads that bit. If it is set to 0, it runs ScanDisk to check the drive for errors.
Hard Sector Error. Windows 98 detects a hard sector error during startup. This process toggles the third bit to zero (0Bh). When detected during startup, Windows 98 automatically launches ScanDisk with a surface scan test.
Disabling ScanDisk at Boot. There is a way to disable the improper shutdown check. It is in the Msdos.sys file under [OPTIONS]. The parameters for AutoScan are as follows:
Value Definition
AUTOSCAN = 0 Ignore the bits in the reserved FAT entry
AUTOSCAN = 1 Default behavior, run ScanDisk
Mirroring
On all FAT drives, historically, there are two copies of the FAT. If an error occurs reading the primary copy, the file system will attempt to read from the backup copy. On 12-bit and 16-bit FAT drives, the first FAT is always the primary copy and a modification is automatically written to the second copy. When a second FAT is written to as a backup, the process is called mirroring.
On new FAT32 drives, mirroring a secondary FAT can be disabled. This means that a read/write is quicker using one FAT, or if the first FAT is sitting on corrupted sectors, the second FAT can be used as a primary with the first FAT ignored.
Note On FAT32 drives, a FAT can be very large. Disabling duplicate FAT writes can make FAT access quicker. Windows 98 does not provide a mechanism for eliminating the use of a second FAT. Mirroring is always enabled. Third-party utilities, however, might include this ability as users with larger hard disks might want to disable a second FAT to speed disk access. Any issues about mirroring should be directed to that third-party utility.
Root Directory
With FAT32, the limitation is now 65,535 root directory entries.
There is a new entry in the Boot Sector that points to the first cluster of the root directory. The root directory is no longer forced to reside at a specific location after the second FAT and it can grow just like a subdirectory.
There is a trade off in performance when you have a large number of directory entries to pass across when searching for actual data. For this reason, it is recommended that you limit the number of root directory entries to a small, manageable number. There is no actual recommended size for the same reasons as there is no optimal cluster size to choose from.
Extensions Changed, Superseded, or No Longer Supported
The following list presents some areas where FAT32 may be incompatible with legacy software:
• Share services are a part of the installable file system (IFS) manager. VFAT uses them to provide full file sharing functionality. All MS-DOS-based, Win16-based, and Win32-based applications have full file sharing services available to them. As a consequence, the MS-DOS utility Share.exe is no longer necessary and is not provided in Windows 98.
• VFAT implements an enhanced version of FASTOPEN. As such, the MS-DOS FASTOPEN utility is no longer necessary, but can install without error.
• Windows 3.x File Manager is not supported since it may misreport free or total disk space.
• File Control Block (FCB) has limited support but this should not be a problem.
• Dealing with files larger than 2 GB (opening, creating, writing) may cause problems on non-FAT32-aware programs.
• Absolute disk reads and write utilities should be upgraded to recognize FAT32.
• Users should not dual-boot Windows 98 with FAT32 and Windows NT 4.0.
• Interlink does not work on FAT32.
Windows 98 partition types not recognized by Windows NT.
When you set up Windows NT on a computer that has Windows 98 preinstalled, the FAT partitions may be shown as unknown.
Windows NT cannot recognize primary partitions using the FAT32 format. Backup any data that you might need to save and then delete the partition(s) using Fdisk from either MS-DOS or Windows 98.
Windows 98 supports four partition types for FAT file systems that Windows NT cannot recognize. The partition type can be identified by the System ID byte in the partition table. This byte is located at the following offsets:
0x1C2 = Partition 1
0x1D2 = Partition 2
0x1E2 = Partition 3
0x1F2 = Partition 4
The four values used by Windows 98 that Windows NT does not recognize are as follows:
0x0B Primary Fat32 Partitions up to 2047 GB
0x0C Same as 0x0B, uses Logical Block Address Int 0x13 extensions
0x0E Same as 0x06, uses Logical Block Address Int 0x13 extensions
0x0F Same as 0x05, uses Logical Block Address Int 0x13 extensions
The FAT partition types that Windows NT version 3.x and 4.0 can recognize are:
0x01 Fat12 < 10 megabytes
0x04 Fat16 < 32 megabytes
0x06 Fat16 > 32 megabytes
0x05 Extended (may be FAT, HPFS or NTFS)
|
|