[PATCH 0/1] MR9419: kernel32: handle root path in wine_get_dos_file_name
Fixed path concatenation issue in wine_get_dos_file_name function when dealing with root paths. The function now checks if the buffer contains a root path using PathIsRootW and adjusts the concatenation offset accordingly. When the path is a root path, it skips the trailing backslash in the NT name to avoid double backslashes in the final path. Signed-off-by: Jiajin Cui <cuijiajin(a)uniontech.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9419
From: Jiajin Cui <cuijiajin(a)uniontech.com> Fixed path concatenation issue in wine_get_dos_file_name function when dealing with root paths. The function now checks if the buffer contains a root path using PathIsRootW and adjusts the concatenation offset accordingly. When the path is a root path, it skips the trailing backslash in the NT name to avoid double backslashes in the final path. Signed-off-by: Jiajin Cui <cuijiajin(a)uniontech.com> --- dlls/kernel32/path.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index 8952592c1ab..efdc1e6b796 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -32,6 +32,7 @@ #include "winbase.h" #include "winnls.h" #include "winternl.h" +#include "shlwapi.h" #include "kernel_private.h" #include "wine/debug.h" @@ -512,7 +513,10 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str ) if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, (len + 8) * sizeof(WCHAR) ))) goto failed; res = GetFinalPathNameByHandleW( handle, buffer, len + 8, VOLUME_NAME_DOS ); if (!res || res > len + 8) goto failed; - wcscat( buffer, nt_name.Buffer + nt_name.Length / sizeof(WCHAR) ); + if(PathIsRootW(buffer)) + wcscat( buffer, nt_name.Buffer + nt_name.Length / sizeof(WCHAR) + 1 ); + else + wcscat( buffer, nt_name.Buffer + nt_name.Length / sizeof(WCHAR) ); NtClose( handle ); RtlFreeHeap( GetProcessHeap(), 0, nt_str ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9419
participants (2)
-
Jiajin Cui -
Jiajin Cui (@jin-king1)