QuickTime for Windows returns bdNamErr (-37) error with long Windows file names

Q: I'm getting the bdNamErr (-37) error when calling NativePathNameToFSSpec on my Windows PC with QuickTime 7. The paths I'm using are perfectly valid Windows paths to files on my hard drive. What am I doing wrong? Also, can I use the data reference APIs such as QTNewDataReferenceFromFullPathCFString, QTNewDataReferenceFromCFURL and so on to avoid these types of errors?

A: There's a limitation in QuickTime prior to version 7.4 which restricts any file name plus extension to 63 characters or less. The full path may still be MAX_PATH (see WINDEF.H) characters long, but the file name must be 63 characters or less.

Also, the text encoding of the pathname passed to NativePathNameToFSSpec must match the system code page of the Windows system. This means you cannot use Unicode pathnames (either UTF-8 or UTF-16) with this function.

WARNING: You should no longer use the FSSpec data type as it will be deprecated in a future version of QuickTime. Instead, use the APIs which accept QuickTime data references (see Modernizing QuickTime Applications).

Starting with QuickTime 7.4, the limitation on the length of a file leaf name is now 255 characters, rather than 63 characters as it was in earlier releases. The full path must still be less than or equal to MAX_PATH characters.

In addition, the data reference APIs (QTNewDataReferenceFromFullPathCFString, QTNewDataReferenceFromCFURL and so on) in QuickTime 7.4 now provide more robust support for Unicode pathnames, though these pathnames must also be less than or equal to MAX_PATH characters.

WARNING: There may be individual components in QuickTime 7.4 that are not up to this standard. Specifically, the GraphicsImporters/GraphicsExporters do not work with such data references. Many third-party components may have the same problem.

The FSSpec data structure does not allow Unicode characters. Therefore, it is not possible to represent a file whose pathname contains Unicode characters. With QuickTime 7.4, the Carbon Resource File APIs are not compatible with Unicode pathnames.

Note: The FSMakeFSSpec function in QuickTime 7.4 may now return a short MS-DOS 8.3 format name (for example "C:\MyFolder\MYFIL~2\") instead of the long name.

You can obtain the long form by calling the GetLongPathName Windows API.

References

Document Revision History

Date Notes
2008-08-08 Updated to reflect new behavior in QuickTime 7.4.
2005-10-04 Added information about Data Reference APIs and Unicode pathnames.
2005-02-22 Describes how QuickTime may return bdNamErr (-37) error on Windows if file name is > 63 characters

Posted: 2008-08-08


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.