Every Word binary file starts its WordDocument stream with a File
Information Block (FIB). It has a fixed base and three counted arrays. The last array holds
the offset and size of every other structure, in the WordDocument or table
stream. All numbers are little-endian.
Layout
FibBasethe identifier, version, flags and key32csw14: the number of 16-bit values2fibRgWreserved values and the East Asian language28cslw22: the number of 32-bit values2fibRgLwcbMac and the counts of characters in each part88cbRgFcLcbthe number of fc/lcb pairs2fibRgFcLcbeight bytes for each pair: offset, then lengthvariescswNew0, or the count of the values after it2fibRgCswNewnFibNew and more, when cswNew is not zerovaries
FibBase
| Offset | Size | Field | Meaning |
|---|---|---|---|
0 | 2 | wIdent | 0xA5EC: Word 97 or later |
2 | 2 | nFib | The file format version, usually 0x00C1 (193) |
4 | 2 | unused | Undefined |
6 | 2 | lid | The install language |
8 | 2 | pnNext | In a template, the 512-byte page holding the FIB of its AutoText document |
10 | 2 | flags | Bit 0: a template. Bit 1: holds only AutoText. Bit 2: the last save was incremental. Bit 3: has pictures. Bits 4–7: count of quick saves. Bit 8: encrypted. Bit 9: fWhichTblStm, the table stream is 1Table. Bit 10: read-only recommended. Bit 11: write reservation. Bit 12: fExtChar. Bit 13: fLoadOverride. Bit 14: an East Asian install. Bit 15: XOR obfuscation when also encrypted. |
12 | 2 | nFibBack | The oldest version that can read this file, 0x00BF or 0x00C1 |
14 | 4 | lKey | For an encrypted file, the password verifier or the size of the encryption header at the start of the table stream |
18 | 2 | flags | Environment and rarely used flags |
20 | 12 | reserved | Ignored |
fibRgW
Fourteen 16-bit values, mostly reserved. The last, lidFE, is the East Asian
language when fFarEast is set.
fibRgLw
Twenty-two 32-bit values. Those that matter:
| Offset in the array | Field | Meaning |
|---|---|---|
0 | cbMac | The meaningful length of WordDocument |
12 | ccpText | Characters in the main document |
16 | ccpFtn | Characters in footnotes |
20 | ccpHdd | Characters in headers and footers |
28 | ccpAtn | Characters in comments |
32 | ccpEdn | Characters in endnotes |
36 | ccpTxbx | Characters in text boxes of the main document |
40 | ccpHdrTxbx | Characters in text boxes of headers and footers |
fibRgFcLcb
An array of pairs: a 32-bit offset (fc) and a 32-bit length
(lcb). cbRgFcLcb at offset 152 is the number of pairs: 93 for
nFib 193, and more when nFibNew marks a later version. Offsets are in the
table stream. The structure names that follow are the specification’s. A length of zero
means the structure is absent, and its offset is ignored.
| Index | Name | Holds |
|---|---|---|
| 1 | Stshf | The style sheet |
| 2, 3 | PlcffndRef, PlcffndTxt | Footnotes |
| 4, 5 | PlcfandRef, PlcfandTxt | Comments |
| 6 | PlcfSed | Section descriptors |
| 11 | PlcfHdd | Headers and footers |
| 12, 13 | PlcfBteChpx, PlcfBtePapx | Character and paragraph property pages |
| 15 | SttbfFfn | The font table |
| 16–20 | PlcfFldMom and others | Positions of fields in each part |
| 21–23 | SttbfBkmk, PlcfBkf, PlcfBkl | Bookmarks |
| 31 | Dop | Document properties |
| 33 | Clx | The piece table |
| 40, 41 | PlcSpaMom, PlcSpaHdr | Anchors of drawn objects |
| 46, 47 | PlcfendRef, PlcfendTxt | Endnotes |
| 50 | DggInfo | Office drawing data |
| 73, 74 | PlfLst, PlfLfo | List definitions and overrides |
Versions
nFib stays 193 in most Word 97 and later files; a later Word writes the
real version in nFibNew, the first value of fibRgCswNew.
| nFibNew | Written by | cbRgFcLcb | cswNew |
|---|---|---|---|
0x00C1 | Word 97 | 93 | 0 |
0x00D9 | Word 2000 | 108 | 2 |
0x0101 | Word 2002 | 136 | 2 |
0x010C | Word 2003 | 164 | 2 |
0x0112 | Word 2007 | 183 | 5 |
Encryption and obfuscation
Bit 8 of the flags, fEncrypted, says the file is password protected.
With fObfuscated (bit 15) also set, it uses XOR obfuscation and
lKey is the password verifier. Otherwise the first lKey bytes
of the table stream are an encryption header, which says whether Office binary document
RC4 or RC4 CryptoAPI is used. The first 68 bytes of WordDocument and the
header are readable; the text and most tables are not.