TexFAT File Naming Limitations
Other versions of this page are also available for the following:
Under the transaction-safe extended FAT (TexFAT) file system, file names are restricted to no more than 247 characters. Attempts to use a file name or path that exceeds this restriction fail.
The root file system on all of Windows Embedded CE-based devices is managed by the TexFAT file system. In most cases, a Windows Embedded CE-based device uses 12- or 16-bit TexFAT.
In the FATFS file system, the root directory resides at a fixed location and cannot be moved. Because of this characteristic, the file system can be corrupted if an operation performed at the root directory is interrupted.
To make operations transaction-safe, the default TexFAT file system redirects all root-directory entries to a hidden directory. In addition, the system redirects all root-directory operations to this hidden directory. To calling applications, the hidden director appears as the root, but is actually a sub-directory of the root directory. Operations performed in the hidden directory are transaction-safe. In this way, TexFAT operations in the root directory are transaction-safe.
To perform the redirection, the TexFAT system prepends the name of the hidden directory to the designated path and increases the path length by the number of characters in the redirection string, __TexFAT_HIDDEN_ROOT_DIR__. For example
CreateFile("\temp\myfile.dat") resolves to CreateFile("__TexFAT_HIDDEN_ROOT_DIR__\temp\myfile.dat").
If the total path size including the string that enacts the redirection, __TexFAT_HIDDEN_ROOT_DIR__, portion is larger than MAX_PATH, the operation fails and returns ERROR_FILENAME_EXCED_RANGE.
As a result, a file name and path must not be longer than the following:
(MAX_PATH - strlen("__TexFAT_HIDDEN_ROOT_DIR__\"))
If desired, you can disable the hidden root redirection feature by adding the appropriate bit to the FATFS Flags registry value in the following registry key:
To disable root directory redirection, set the Flags value to 0x00100000.