-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
I was just testing out the Win32 function GetFinalPathNameByHandleW, and saw a case where it failed to work.
Steps to reproduce:
- Install OSFMount (Passmark)
- Mount a Disk Image (I used a NTFS image file, mounted as drive X)
- Use
CreateFileWon a file on the disk image (my path: "X:/flash Movies/11-29-04-thanksgiving.swf") - Call
GetFinalPathNameByHandleWon that handle, usingFILE_NAME_NORMALIZED
Function returns 0 instead of returning a path name, and GetLastError returns 1 (ERROR_INVALID_FUNCTION).
However, if I call GetFinalPathNameByHandleW using VOLUME_NAME_NT, I get something: "\Device\OSFMDisk0\Flash Movies\11-29-04-thanksgiving.swf", but this path isn't usable with CreateFileW.
There are alternative ways to canonicalize a filename on Win32:
PathCanonicalizeW is the traditional way to do it, works on Windows 2000 and later, but it is limited to 260 character filenames, and is marked as deprecated by Microsoft.
PathCchCanonicalizeEx is the replacement function since Windows 8, and is unavailable in Windows 7 and earlier, but does support very long path names.