Alexandre Julliard : ntdll: Check for existing Unix path name in RtlGetFullPathName_U().

Alexandre Julliard julliard at winehq.org
Mon Mar 1 15:54:03 CST 2021


Module: wine
Branch: master
Commit: 45bfa4eec3f52a00f4a92b1d533d5fe39edeec3b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=45bfa4eec3f52a00f4a92b1d533d5fe39edeec3b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Feb 28 11:29:17 2021 +0100

ntdll: Check for existing Unix path name in RtlGetFullPathName_U().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/path.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 86760f178e1..9d707d883b2 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -543,16 +543,18 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
             WCHAR *nt_str;
             SIZE_T buflen;
             NTSTATUS status;
-
-            unix_name = RtlAllocateHeap( GetProcessHeap(), 0, 3 * wcslen(name) + 1 );
-            ntdll_wcstoumbs( name, wcslen(name) + 1, unix_name, 3 * wcslen(name) + 1, FALSE );
-            buflen = strlen(unix_name) + 10;
-            for (;;)
+            UNICODE_STRING str;
+
+            nt_str = RtlAllocateHeap( GetProcessHeap(), 0, (wcslen(name) + 9) * sizeof(WCHAR) );
+            wcscpy( nt_str, L"\\??\\unix" );
+            wcscat( nt_str, name );
+            RtlInitUnicodeString( &str, nt_str );
+            buflen = 3 * wcslen(name) + 1;
+            unix_name = RtlAllocateHeap( GetProcessHeap(), 0, buflen );
+            if (!(status = wine_nt_to_unix_file_name( &str, unix_name, &buflen, FILE_OPEN )))
             {
-                if (!(nt_str = RtlAllocateHeap( GetProcessHeap(), 0, buflen * sizeof(WCHAR) ))) break;
+                buflen = wcslen(name) + 9;
                 status = wine_unix_to_nt_file_name( unix_name, nt_str, &buflen );
-                if (status != STATUS_BUFFER_TOO_SMALL) break;
-                RtlFreeHeap( GetProcessHeap(), 0, nt_str );
             }
             RtlFreeHeap( GetProcessHeap(), 0, unix_name );
             if (!status && buflen > 6 && nt_str[5] == ':')




More information about the wine-cvs mailing list