Alexandre Julliard : ntdll: Actually return an NT path in wine_unix_to_nt_file_name() for relative paths.

Alexandre Julliard julliard at winehq.org
Fri Jun 19 14:48:54 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jun 19 18:34:19 2020 +0200

ntdll: Actually return an NT path in wine_unix_to_nt_file_name() for relative paths.

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

---

 dlls/ntdll/path.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 5f4eb11316..9a7ba447aa 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -986,24 +986,15 @@ NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRIN
     if (path[0] != '/')  /* relative path name */
     {
         WCHAR *tmp;
+        NTSTATUS status;
 
-        path++;
-        lenA--;
         if (!(tmp = RtlAllocateHeap( GetProcessHeap(), 0, (lenA + 1) * sizeof(WCHAR) )))
             return STATUS_NO_MEMORY;
         lenW = ntdll_umbstowcs( path, lenA, tmp, lenA );
         tmp[lenW] = 0;
-        lenW = RtlGetFullPathName_U( tmp, 0, NULL, NULL );
-        if (!lenW || !(nt->Buffer = RtlAllocateHeap( GetProcessHeap(), 0, lenW )))
-        {
-            RtlFreeHeap( GetProcessHeap(), 0, tmp );
-            return STATUS_NO_MEMORY;
-        }
-        lenW = RtlGetFullPathName_U( tmp, lenW, nt->Buffer, NULL );
-        nt->Length = lenW;
-        nt->MaximumLength = lenW + sizeof(WCHAR);
+        status = RtlDosPathNameToNtPathName_U_WithStatus( tmp, nt, NULL, NULL );
         RtlFreeHeap( GetProcessHeap(), 0, tmp );
-        return STATUS_SUCCESS;
+        return status;
     }
     return unix_funcs->unix_to_nt_file_name( name, nt );
 }




More information about the wine-cvs mailing list