Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows.GetFinalPathNameByHandle: Support volumes mounted as paths #19738

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

squeek502
Copy link
Collaborator

@squeek502 squeek502 commented Apr 22, 2024

A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like \??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}. In order to get the C:\Mnt\Foo path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH.

Fixes #19731


Zig installed to a VHD mounted as a path:

Before:

> zig test test.zig
error: unable to find zig self exe path: FileNotFound

After:

> zig test test.zig
All 1 tests passed.

Note: It's also possible for a volume to be mounted to multiple paths. This PR will currently always just return the first one--unsure how something like GetVolumePathNameW compares, need to test that.

A volume can be mounted as a NTFS path, e.g. as C:\Mnt\Foo. In that case, IOCTL_MOUNTMGR_QUERY_POINTS gives us a mount point with a symlink value something like `\??\Volume{383da0b0-717f-41b6-8c36-00500992b58d}`. In order to get the `C:\Mnt\Foo` path, we can query the mountmgr again using IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH.

Fixes ziglang#19731
@andrewrk andrewrk merged commit a0f1825 into ziglang:master Apr 24, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On a mounted VHD without a drive letter: error: unable to find zig self exe path: FileNotFound
2 participants