See the question and my original answer on StackOverflow

Windows stores this in COM Structured storage. The implementation is either in the file itself (Office docs support this, or any file format that supports structured storage), or in NTFS itself.

The API is available here: Structured Storage. The interesting function is StgOpenStorageEx.

Here are some details about NTFS implementation: IPropertySetStorage-NTFS File System Implementation