windows.GetFinalPathNameByHandle: Support volumes mounted as paths#19738
Merged
andrewrk merged 1 commit intoziglang:masterfrom Apr 24, 2024
Merged
windows.GetFinalPathNameByHandle: Support volumes mounted as paths#19738andrewrk merged 1 commit intoziglang:masterfrom
andrewrk merged 1 commit intoziglang:masterfrom
Conversation
8ba85fb to
a94ce7f
Compare
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
a94ce7f to
94145bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theC:\Mnt\Foopath, 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:
After:
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
GetVolumePathNameWcompares, need to test that.