August 6th, 2014

Why does Explorer say "File too large" for my custom file system, when the problem has nothing to do with the file being too large (heck it's not even a file)

When Explorer copies files around, it doesn’t really know what the maximum file size supported by any file system happens to be. (That information is not reported by Get­Volume­Information.) So it guesses. If the file system name is "FAT" or "FAT32", then Explorer assumes that the maximum file size is 4GB − 1. Also, if a file operation fails with the error ERROR_INVALID_PARAMETER, and Explorer can’t figure out why the parameter is invalid, it assumes that the reason is that the file has exceeded the maximum allowed file size. Why does Explorer map “invalid parameter” to “file size too large”? Because some file systems use ERROR_INVALID_PARAMETER to report that a file is too large instead of the somewhat more obvious ERROR_FILE_TOO_LARGE.

Therefore, if you’re implementing a file system, and you’re getting these spurious “File too large” errors, one thing to check is whether you are reporting “invalid parameter” for a case where all the parameters are actually valid, but something else prevents you from doing what you want. (Maybe “access denied” would be a better error code.)

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.