2.5.15 How to read the FIB

The Fib structure is located at offset 0 of the WordDocument Stream. Given the variable size of the Fib, the proper way to load it is the following:

  1. Set all bytes of the in-memory version of the Fib being used to 0. It is recommended to use the largest version of the Fib structure as the in-memory version.

  2. Read the entire FibBase, which MUST be present and has fixed size.

  3. Read Fib.csw.

  4. Read the minimum of Fib.csw * 2 bytes and the size, in bytes, of the in-memory version of FibRgW97 into FibRgW97.

  5. If the application expects fewer bytes than indicated by Fib.csw, advance by the difference thereby skipping the unknown portion of FibRgW97.

  6. Read Fib.cslw.

  7. Read the minimum of Fib.cslw * 4 bytes and the size, in bytes, of the in-memory version of FibRgLw97 into FibRgLw97.

  8. If the application expects fewer bytes than indicated by Fib.cslw, advance by the difference thereby skipping the unknown portion of FibRgLw97.

  9. Read Fib.cbRgFcLcb.

  10. Read the minimum of Fib.cbRgFcLcb * 8 bytes and the size, in bytes, of the in-memory version of FibRgFcLcb into FibRgFcLcb.

  11. If the application expects fewer bytes than indicated by Fib.cbRgFcLcb, advance by the difference, thereby skipping the unknown portion of FibRgFcLcb.

  12. Read Fib.cswNew.

  13. Read the minimum of Fib.cswNew * 2 bytes and the size, in bytes, of the in-memory version of FibRgCswNew into FibRgCswNew.