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

[Mirror] Use prefix \\?\UNC\ for long file paths over network (or for all /r paths over network) #1130

Open
snullp opened this issue Feb 2, 2023 · 2 comments

Comments

@snullp
Copy link

snullp commented Feb 2, 2023

In latest Windows 10 there is a peculiar behavior over network path relating to long file path. This is not associated with the long file path flag in mirror.c (thanks for enabling it by default), and I already enabled long file path support in Win10 registry (long path in local drive works).

For the network share paths with a long path name, instead of using \\server_name\long\path\to\file, Win 10 uses \\?\UNC\server_name\long\path\to\file. Windows Explorer does this conversion automatically: When navigating into a long path folder, the location bar converts to the \\?\UNC\ format.

mirror.exe does not to this automatically and when invoked in this form:

mirror.exe /l \\server_name\share /l D

Files with short file path can be retrieved successfully, but upon long file path files the mounted fs throws File Not Found error (I did not take screenshot or copy the log when this occurs, and now I'm running the fixed cmd below so unable to reproduce).

Manually changing cmd to the following fixes the problem:

mirror.exe /l \\?\UNC\server_name\share /l D

It would be better if mirror.exe uses the prefix automatically to avoid future user spend hours debugging like I did.

@Liryna
Copy link
Member

Liryna commented Feb 3, 2023

Hi @snullp ,

That seems to be a good and quick idea to implement. Thanks for the suggestion!
Would need to populate the \\?\UNC prefix in gRootDirectory when the arg starts with \ (UNC).
https://github.com/dokan-dev/dokany/blob/master/samples/dokan_mirror/mirror.c#L1596-L1603

@snullp
Copy link
Author

snullp commented Feb 3, 2023

Thank you @Liryna . I also found out that rclone does the same: https://rclone.org/local/#long-paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants