Paul Gofman : ntdll: Use case sensitive search for \??\unix file names only.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 15:47:08 CDT 2020


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Fri Jun 26 15:26:55 2020 +0300

ntdll: Use case sensitive search for \??\unix file names only.

Fixes crash on start in Planet Zoo and Jurassic World Evolution.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/path.c           | 4 ++--
 dlls/ntdll/directory.c         | 4 ++--
 dlls/ntdll/ntdll.spec          | 2 +-
 dlls/ntdll/tests/file.c        | 2 +-
 dlls/ntdll/unix/file.c         | 8 ++++----
 dlls/ntdll/unix/loader.c       | 2 +-
 dlls/ntdll/unix/process.c      | 2 +-
 dlls/ntdll/unix/unix_private.h | 2 +-
 dlls/ntdll/unixlib.h           | 4 ++--
 include/winternl.h             | 2 +-
 10 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 0f075d0af1..db2c1fb024 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -263,7 +263,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
         return FALSE;
     }
 
-    status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE );
+    status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN );
     RtlFreeUnicodeString( &nt_name );
     if (!set_ntstatus( status ))
     {
@@ -342,7 +342,7 @@ char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
     NTSTATUS status;
 
     if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
-    status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN_IF, FALSE );
+    status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN_IF );
     RtlFreeUnicodeString( &nt_name );
     if (status && status != STATUS_NO_SUCH_FILE)
     {
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index e0b3a9e955..6c78203981 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -111,9 +111,9 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH NtQueryDirectoryFile( HANDLE handle, HANDLE ev
  * returned, but the unix name is still filled in properly.
  */
 NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
-                                          UINT disposition, BOOLEAN check_case )
+                                          UINT disposition )
 {
-    return unix_funcs->nt_to_unix_file_name( nameW, unix_name_ret, disposition, check_case );
+    return unix_funcs->nt_to_unix_file_name( nameW, unix_name_ret, disposition );
 }
 
 
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index ef38613a4e..3f28e3d5ea 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1604,5 +1604,5 @@
 @ cdecl __wine_get_unix_codepage()
 
 # Filesystem
-@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
+@ cdecl wine_nt_to_unix_file_name(ptr ptr long)
 @ cdecl wine_unix_to_nt_file_name(ptr ptr)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 184b7cdad5..9e65a1f6dd 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -349,7 +349,7 @@ static void open_file_test(void)
     attr.Length = sizeof(attr);
     attr.RootDirectory = 0;
     attr.ObjectName = &nameW;
-    attr.Attributes = OBJ_CASE_INSENSITIVE;
+    attr.Attributes = 0;
     attr.SecurityDescriptor = NULL;
     attr.SecurityQualityOfService = NULL;
     status = pNtOpenFile( &dir, SYNCHRONIZE|FILE_LIST_DIRECTORY, &attr, &io,
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 223c863dca..61340a0e01 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3248,10 +3248,9 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
     char *unix_name;
     int name_len, unix_len;
     NTSTATUS status;
-    BOOLEAN check_case = !(attr->Attributes & OBJ_CASE_INSENSITIVE);
 
     if (!attr->RootDirectory)  /* without root dir fall back to normal lookup */
-        return nt_to_unix_file_name( attr->ObjectName, unix_name_ret, disposition, check_case );
+        return nt_to_unix_file_name( attr->ObjectName, unix_name_ret, disposition );
 
     name     = attr->ObjectName->Buffer;
     name_len = attr->ObjectName->Length / sizeof(WCHAR);
@@ -3280,7 +3279,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
             if ((old_cwd = open( ".", O_RDONLY )) != -1 && fchdir( root_fd ) != -1)
             {
                 status = lookup_unix_name( name, name_len, &unix_name, unix_len, 1,
-                                           disposition, check_case );
+                                           disposition, FALSE );
                 if (fchdir( old_cwd ) == -1) chdir( "/" );
             }
             else status = STATUS_ACCESS_DENIED;
@@ -3317,7 +3316,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
  * returned, but the unix name is still filled in properly.
  */
 NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
-                                     UINT disposition, BOOLEAN check_case )
+                                     UINT disposition )
 {
     static const WCHAR unixW[] = {'u','n','i','x'};
     static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
@@ -3328,6 +3327,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
     char *unix_name;
     int pos, ret, name_len, unix_len, prefix_len;
     WCHAR prefix[MAX_DIR_ENTRY_LEN + 1];
+    BOOLEAN check_case = FALSE;
     BOOLEAN is_unix = FALSE;
 
     name     = nameW->Buffer;
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 2b43b69be9..ae17d11668 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -931,7 +931,7 @@ static NTSTATUS CDECL load_so_dll( UNICODE_STRING *nt_name, void **module )
     NTSTATUS status;
     DWORD len;
 
-    if (nt_to_unix_file_name( nt_name, &unix_name, FILE_OPEN, FALSE )) return STATUS_DLL_NOT_FOUND;
+    if (nt_to_unix_file_name( nt_name, &unix_name, FILE_OPEN )) return STATUS_DLL_NOT_FOUND;
 
     /* remove .so extension from Windows name */
     len = nt_name->Length / sizeof(WCHAR);
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c
index b86c67e6af..7061d8864d 100644
--- a/dlls/ntdll/unix/process.c
+++ b/dlls/ntdll/unix/process.c
@@ -665,7 +665,7 @@ static NTSTATUS fork_and_exec( UNICODE_STRING *path, int unixdir,
     ANSI_STRING unix_name;
     NTSTATUS status;
 
-    status = nt_to_unix_file_name( path, &unix_name, FILE_OPEN, FALSE );
+    status = nt_to_unix_file_name( path, &unix_name, FILE_OPEN );
     if (status) return status;
 
 #ifdef HAVE_PIPE2
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index cdc867a858..82806463e5 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -125,7 +125,7 @@ extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT
                                           CONTEXT *context ) DECLSPEC_HIDDEN;
 
 extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
-                                            UINT disposition, BOOLEAN check_case ) DECLSPEC_HIDDEN;
+                                            UINT disposition ) DECLSPEC_HIDDEN;
 extern NTSTATUS CDECL unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ) DECLSPEC_HIDDEN;
 extern void CDECL set_show_dot_files( BOOL enable ) DECLSPEC_HIDDEN;
 
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index 5f1ad1b5d9..4c00408bda 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -28,7 +28,7 @@ struct msghdr;
 struct _DISPATCHER_CONTEXT;
 
 /* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 71
+#define NTDLL_UNIXLIB_VERSION 72
 
 struct unix_funcs
 {
@@ -329,7 +329,7 @@ struct unix_funcs
 
     /* file functions */
     NTSTATUS      (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
-                                                 UINT disposition, BOOLEAN check_case );
+                                                 UINT disposition );
     NTSTATUS      (CDECL *unix_to_nt_file_name)( const ANSI_STRING *name, UNICODE_STRING *nt );
     void          (CDECL *set_show_dot_files)( BOOL enable );
 
diff --git a/include/winternl.h b/include/winternl.h
index 5b5a5f32c6..4ee32d3c9e 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3372,7 +3372,7 @@ NTSYSAPI void      WINAPI TpWaitForWork(TP_WORK *,BOOL);
 /* Wine internal functions */
 
 NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
-                                                   UINT disposition, BOOLEAN check_case );
+                                                   UINT disposition );
 NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt );
 
 




More information about the wine-cvs mailing list