[PATCH 0/1] MR8464: ntdll: Collapse paths in get_unix_full_path.
Before the commit in question, both of these paths would be parsed as valid (with e.g. FindFirstFile): ``` Z:\tmp\\* /tmp//* ``` After the commit, only the DOS path is accepted, while the Unix path returns ERROR_INVALID_NAME. Fixes: ffa88c3993c3da97c7403209ef2068b2e3fac66f -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8464
From: William Horvath <william(a)horvath.blog> Before the commit in question, both of these paths would be parsed as valid (with e.g. FindFirstFile): Z:\tmp\\* /tmp//* After the commit, only the DOS path is accepted, while the Unix path returns ERROR_INVALID_NAME. Fixes: ffa88c3993c3da97c7403209ef2068b2e3fac66f --- dlls/ntdll/path.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 5118ce4ee9b..f5c8377b0ef 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -564,6 +564,11 @@ static BOOL get_unix_full_path( LPCWSTR name, LPWSTR buffer, ULONG size, ULONG * memcpy( buffer, name, len ); memcpy( buffer + len / sizeof(WCHAR), str.Buffer + str.Length / sizeof(WCHAR), file_len + sizeof(WCHAR) ); + /* collapse duplicate backslashes and path components */ + if (buffer[5] == ':') + collapse_path( buffer, 3 ); /* i.e. \\??\Z:\ */ + else + collapse_path( buffer, 1 ); /* other paths */ *reqsize -= sizeof(WCHAR); } ret = TRUE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8464
There shouldn't be any reason to do that here. Removing duplicate backslashes can be done much more simply. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8464#note_108504
This merge request was closed by William Horvath. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8464
Thanks, 93e945e3237d300e13fa7f16044cdaf8364197bb fixes this properly. I wasn't really satisfied with my solution, either. I didn't have a good enough understanding of how these path functions interacted, so I don't really have an excuse other than I impulsively submitted the first idea that seemed plausible to me. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8464#note_108615
participants (3)
-
Alexandre Julliard (@julliard) -
William Horvath -
William Horvath (@whrvt)