Export (0) Print
Expand All

2.5 Compound File DIFAT Sectors

The DIFAT array is used to represent storage of the FAT sectors. The DIFAT is represented by an array of 32-bit sector numbers. The DIFAT array is stored both in the header and in DIFAT sectors. In the header, the DIFAT array occupies 109 entries, and in each DIFAT sector, the DIFAT array occupies the entire sector minus 4 bytes (the last field is for chaining the DIFAT sector chain).

ac60e849-68ec-4538-af73-ffe8e5a13d0a

Figure 13: Sectors of a DIFAT array

The DIFAT sectors are linked together by the last field in each DIFAT sector. As an optimization, the first 109 FAT sectors are represented within the header itself. No DIFAT sectors will be needed in a compound file that is smaller than 6.875 megabyte (MB) for a 512 byte sector compound file (6.875 MB = (1 header sector + 109 FAT sectors x 128 non-empty entries) × 512 bytes per sector).

The DIFAT represents the FAT sectors in a different manner than the FAT represents a sector chain. A given index, n, into the DIFAT array will contain the sector number of the (n+1)th FAT sector. For instance, index #3 in the DIFAT contains the sector number for the 4rd FAT sector, since DIFAT array starts with index #0.

The storage for DIFAT sectors is reserved with the FAT, but it is not chained there. Space for DIFAT sectors is marked by a special sector number, DIFSECT (0xFFFFFFFC).

The location of the first DIFAT sector is stored in the header.

A special value of ENDOFCHAIN (0xFFFFFFFE) is stored in "Next DIFAT Sector Location" field of the last DIFAT sector, or in the header when no DIFAT sectors are needed.

The detailed DIFAT sector structure is specified below.


0

1

2

3

4

5

6

7

8

9
1
0

1

2

3

4

5

6

7

8

9
2
0

1

2

3

4

5

6

7

8

9
3
0

1

FAT Sector Location (variable)

...

Next DIFAT Sector Location

FAT Sector Location (variable): This field specifies the FAT sector number in a DIFAT.

  • If Header Major Version is 3, then there MUST be 127 fields specified to fill a 512-byte sector minus the "Next DIFAT Sector Location" field.

  • If Header Major Version is 4, then there MUST be 1023 fields specified to fill a 4096-byte sector minus the "Next DIFAT Sector Location" field.

Next DIFAT Sector Location (4 bytes): This field specifies the next sector number in the DIFAT chain of sectors. The first DIFAT sector is specified in the Header. The last DIFAT sector MUST set this field to ENDOFCHAIN (0xFFFFFFFE).

Name Value

ENDOFCHAIN

0xFFFFFFFE

 
Show:
© 2014 Microsoft