Win32 API function GetFinalPathNameByHandleW fails on volume mounted by OSFMount

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dwedi
    Junior Member
    • Dec 2014
    • 4

    #1

    Win32 API function GetFinalPathNameByHandleW fails on volume mounted by OSFMount

    While trying to solve an issue with Rust and Ruffle Flash Player, I found an incompatibility with a particular Win32 API call.

    Steps to Reproduce:
    Install OSFMount
    Mount a disk image as drive X:
    Use CreateFileW on a file on the disk image (my path: "X:/flash Movies/11-29-04-thanksgiving.swf")
    Call GetFinalPathNameByHandleW on that handle, using FILE_NAME_NORMALIZED

    Instead of getting a filename back (like "X:/flash Movies/11-29-04-thanksgiving.swf"), you get 0, and GetLastError returns 1 (ERROR_INVALID_FUNCTION).
    If you call GetFinalPathNameByHandleW using VOLUME_NAME_NT, you get a different path back, "\Device\OSFMDisk0\Flash Movies\11-29-04-thanksgiving.swf", but this path isn't usable with CreateFileW.
  • keith
    Employee
    • Oct 2010
    • 718

    #2
    This is a known issue with calling GetFinalPathNameByHandle() on OSFMount logical drives which bypasses the Windows Mount Manager.

    This is better explained in the following thread:
    http://mail.openjdk.java.net/piperma...ly/067594.html

    The workaround would be to use a different call (eg. Obtaining a File Name From a File Handle - Win32 apps | Microsoft Docs) or mount as a physical drive in OSFMount instead.

    Update: See also this newer post

    Comment

    Working...