Rebase against 39263558a2088940aaacd6eda19ca23d40b63495.

This commit is contained in:
Zebediah Figura
2021-04-16 00:26:25 -05:00
parent 425f75f839
commit 30c9d5a0f8
11 changed files with 54 additions and 476 deletions

View File

@@ -1,4 +1,4 @@
From fdbd1834e06f2476c2798613e45f764e5eba8f9d Mon Sep 17 00:00:00 2001
From 42675b2cbb3460a5c9fe57f6804d1f144fe27529 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 1 May 2019 17:48:51 -0600
Subject: [PATCH] ntdll: Find dangling symlinks quickly.
@@ -8,40 +8,31 @@ case-insensitive lookups of files.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/unix/file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
dlls/ntdll/unix/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index f77e64ee6b4..0de80ebee7b 100644
index 9654f31cf30..f5e968c369e 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -2715,7 +2715,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
@@ -2709,7 +2709,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
if (ret >= 0 && ret <= MAX_DIR_ENTRY_LEN)
{
unix_name[pos + ret] = 0;
- if (!stat( unix_name, &st )) return STATUS_SUCCESS;
+ if (!lstat( unix_name, &st )) return STATUS_SUCCESS;
}
if (check_case) goto not_found; /* we want an exact match */
@@ -3373,7 +3373,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
char *p;
unix_name[pos + 1 + ret] = 0;
for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/';
- if (!stat( unix_name, &st ))
+ if (!lstat( unix_name, &st ))
{
if (is_win_dir) *is_win_dir = is_same_file( &windir, &st );
if (disposition == FILE_CREATE) return STATUS_OBJECT_NAME_COLLISION;
return STATUS_SUCCESS;
@@ -2819,7 +2819,7 @@ not_found:
return STATUS_OBJECT_PATH_NOT_FOUND;
success:
- if (is_win_dir && !stat( unix_name, &st )) *is_win_dir = is_same_file( &windir, &st );
+ if (is_win_dir && !lstat( unix_name, &st )) *is_win_dir = is_same_file( &windir, &st );
return STATUS_SUCCESS;
}
@@ -3359,7 +3359,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/';
if (!name_len || !redirect || (!strstr( unix_name, "/windows/") && strncmp( unix_name, "windows/", 8 )))
{
- if (!stat( unix_name, &st ))
+ if (!lstat( unix_name, &st ))
{
if (disposition == FILE_CREATE)
return STATUS_OBJECT_NAME_COLLISION;
--
2.20.1
2.30.2

View File

@@ -1,18 +1,18 @@
From efd074f0e742ac8199b091860b2d4bc36136ca1c Mon Sep 17 00:00:00 2001
From 4507201faf3a7993d4e8f214c5de081f4656ad5e Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 6 Feb 2021 16:15:46 -0700
Subject: [PATCH] ntdll: Strip the wine prefix from reparse point paths
external to the prefix.
---
dlls/ntdll/unix/file.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
dlls/ntdll/unix/file.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index b6e49590f62..25b542cb4fc 100644
index b17b53146b3..614f37fb3d6 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5913,6 +5913,31 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -6051,6 +6051,33 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
}
@@ -23,13 +23,15 @@ index b6e49590f62..25b542cb4fc 100644
+
+ if (unix_root == NULL)
+ {
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING nameW;
+ WCHAR *nt_name;
+
+ if (unix_to_nt_file_name( "/", &nt_name ) != STATUS_SUCCESS) return;
+ nameW.Buffer = nt_name;
+ nameW.Length = wcslen(nt_name) * sizeof(WCHAR);
+ nt_to_unix_file_name( &nameW, &unix_root, NULL, FILE_OPEN );
+ InitializeObjectAttributes( &attr, &nameW, OBJ_CASE_INSENSITIVE, 0, NULL );
+ nt_to_unix_file_name( &attr, &unix_root, FILE_OPEN );
+ free( nt_name );
+ if (unix_root == NULL) return;
+ unix_root_len = strlen(unix_root);
@@ -44,7 +46,7 @@ index b6e49590f62..25b542cb4fc 100644
/*
* Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink
* the requested directory to the location of the old directory.
@@ -6045,6 +6070,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -6183,6 +6210,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
goto cleanup;
}
}
@@ -54,5 +56,5 @@ index b6e49590f62..25b542cb4fc 100644
TRACE( "Linking %s to %s\n", unix_src, &unix_dest[relative_offset] );
--
2.20.1
2.30.2