Export (0) Print
Expand All

2.1 Compound File Sector Numbers and Types

Each sector, except for the header, is identified by a non-negative 32-bit sector number. The following sector numbers above 0xFFFFFFFA are reserved, and MUST NOT be used to identify the location of a sector in a compound file.

Sector name

Integer value

Description

REGSECT

0x00000000 - 0xFFFFFFF9

Regular sector number

MAXREGSECT

0xFFFFFFFA

Maximum regular sector number

n/a

0xFFFFFFFB

Reserved for future use.

DIFSECT

0xFFFFFFFC

Specifies a DIFAT sector in the FAT

FATSECT

0xFFFFFFFD

Specifies a FAT sector in the FAT

ENDOFCHAIN

0xFFFFFFFE

End of linked chain of sectors

FREESECT

0xFFFFFFFF

Specifies unallocated sector in the FAT, Mini FAT, or DIFAT

The following list contains the types of sectors allowed in a compound file. Their structures are described in sections 2.2 through 2.8.

Sector type

Array entry length

Purpose

Header

N/A

A single sector with fields needed to read the other structures of the compound file. This sector must be at file offset 0.

FAT

4 BYTES

Main allocator of space within the compound file.

DIFAT

4 BYTES

Used to locate FAT sectors in the compound file.

Mini FAT

4 BYTES

Allocator for mini streamuser-defined data.

Directory

128 BYTES

Contains storage object and stream object metadata.

User-defined Data

N/A

User-defined data for stream objects.

Range Lock

N/A

A single sector used to manage concurrent access to the compound file. This sector must cover file offset 0x7FFFFFFF.

Unallocated Free

N/A

Empty space in the compound file.

Compound file sectors can contain unallocated free space, user-defined data for stream objects, directory sectors containing directory entries, FAT sectors containing the FAT entries, DIFAT sectors containing the DIFAT entries, and mini FAT sectors containing the mini FAT entries. Compound file sectors can be located at any sector-sized offset in the file, with the exception of the header and range lock sector.

5945eba5-6c7b-4ccb-b536-9cd105cc3060

Figure 10: Example of the hierarchy of compound file sectors

All the sector types are eventually linked back to the header sector, except for the range lock sector and unallocated free sectors. Unallocated free sectors are marked in the FAT as FREESECT (0xFFFFFFFF). Unallocated free sectors can be in the middle of the file, and can be created by extending the file size and allocating additional FAT sectors to cover the increased length. The range lock sector is identified by a fixed file offset (0x7FFFFFFF) in the compound file.

In a compound file, all sector chains MUST contain valid sector numbers, less than or equal to MAXREGSECT (0xFFFFFFFA). In a sector chain, the last sector's next pointer MUST be ENDOFCHAIN (0xFFFFFFFE). All sectors in a sector chain MUST NOT be part of any other sector chain in the same file. A sector chain MUST NOT link to a sector appearing earlier in the same chain, which would result in a cycle. Finally, the actual sector count MUST match the size specified for a sector chain.

 
Show:
© 2014 Microsoft