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.
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
[FileStream] handle UNC and device paths #54483
[FileStream] handle UNC and device paths #54483
Changes from 1 commit
48e8e5f
c763c89
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume for the opposite, translate NT to DOS, a helper like this should be needed, right?
For context #54253 (comment) , a Symlinks API uses
DeviceIoControl
which returns an NT path that I need to translate to DOS.This is my silly attempt on doing it:
https://github.com/dotnet/runtime/blob/908530a70613af1172138e48d041d6c5d710d866/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs#L513-L518
Also, I think I mixed the names (DOS and NT) in the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jozkee You could use
RtlNtPathNameToDosPathName
, but the problem is that it's internal and not documented, so we should not be using that.The mapping that you have pointed to seems to be missing a few translations:
\??\UNC\
to\\
(files located on a remote machine)\??\
to\\.\
for devices like names pipes:\\.\pipe\$pipeName
But the question is: are they valid in this context? Can someone create a link to a named pipe or a file located on a network share?
FWIW the best doc about the paths I've found so far: https://googleprojectzero.blogspot.com/2016/02/the-definitive-guide-on-win32-to-nt.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symbolic links to files on network shares are possible; fsutil behavior set symlinkevaluation can enable or disable them. I don't know about symbolic links to named pipes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first example you pointed should still work, as far as I know: Converting
\??\UNC\
to\\?\UNC
, should be equivalent. The difference is that you do not want to pass a path prefixed with\??\
to the user, and should always translate it to\\?\
.Regarding the second example: Have you seen cases where Windows gives you a path prefixed with
\??\
but you were expecting it to start with\\.\
? And how would you know this?