TexFAT Programming Considerations

Other versions of this page are also available for the following:
Windows Mobile Not SupportedWindows Embedded CE Supported

The interfaces exposed by the transaction-safe extended FAT (TexFAT) file system are equivalent to those associated with the FAT file system. The following enhancements are provided by TexFAT to ensure transaction safety:

  • TexFAT-specific drivers
  • TexFAT atomic sector writes
  • FAT volume operations
  • Operations from other components

TexFAT is an extension of the FAT file system. TexFAT requires a hardware-specific driver designed for the type of media on which the volume resides. The driver abstracts the media storage and provides atomic block operations.

For flash storage, the block driver must provide a verification of atomicity on the block level to provide transaction-safety for data on a disk.

TexFAT requires the underlying block structure to support atomic sector writes. The flash driver and most CF card hardware provide atomic sector write operations. If the block driver is not atomic, TexFAT cannot guarantee transaction-safety.

Use the following settings for hard drives and other media with non-atomic sector writes:


Use the following settings for storage media with atomic sector writes:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<Profile Name>\FATFS]

Most TexFAT operations are triggered by the FILE_FLAG_WRITE_THROUGH file attribute, as follows:

  • When the file attribute FILE_FLAG_WRITE_THROUGH is set to TRUE for any file, each WriteFile function call is committed to the disk in an individual transaction. This means that TexFAT has written data to both the volume and the FAT tables. If this attribute is not set, the data written by the WriteFile function is not committed until the CloseHandle or the FlushFileBuffers function is called.
  • When CreateFile creates a memory-mapped file, it automatically sets the FILE_FLAG_WRITE_THROUGH value to TRUE.
  • All databases and memory-mapped files must commit every WriteFile operation to the FAT atomically and set the FILE_FLAG_WRITE_THROUGH value to TRUE.

Other operations such as rename, createdir, and RemoveDirectory are all transaction-safe and committed when the CloseHandle, the FlushFileBuffers, the or WriteFile function is called.

Community Additions