Rebase against d1373e8aae1b15b96e847488e4b6617789f8fb62.

This commit is contained in:
Paul Gofman
2020-02-12 02:37:57 +03:00
parent d3ad4e1115
commit 59d19c8963
14 changed files with 79 additions and 1058 deletions

View File

@@ -1,29 +1,28 @@
From d17d5121c6447d08981c47955979ed39871f4489 Mon Sep 17 00:00:00 2001
From 5b9831bcc26ab81b428b9c8f996c50b50c195a5d Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 30 Apr 2019 16:24:54 -0600
Subject: ntdll: Allow creation of dangling reparse points to non-existent
paths.
Subject: [PATCH] ntdll: Allow creation of dangling reparse points to
non-existent paths.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/directory.c | 14 ++++++++++++++
dlls/ntdll/directory.c | 13 +++++++++++++
dlls/ntdll/file.c | 3 ++-
include/winternl.h | 1 +
3 files changed, 17 insertions(+), 1 deletion(-)
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index bbdbbe9781..cca1e3c4a8 100644
index 7b0627cd3d..669fd56cbe 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2705,6 +2705,20 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -2644,6 +2644,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
status = STATUS_OBJECT_NAME_COLLISION;
}
}
+ else if (disposition == FILE_WINE_PATH && status == STATUS_OBJECT_PATH_NOT_FOUND)
+ {
+ ret = ntdll_wcstoumbs( 0, name, end - name, unix_name + pos + 1,
+ MAX_DIR_ENTRY_LEN, NULL, &used_default );
+ if (ret > 0 && !used_default)
+ ret = ntdll_wcstoumbs( name, end - name, unix_name + pos + 1, MAX_DIR_ENTRY_LEN + 1, TRUE );
+ if (ret > 0 && ret <= MAX_DIR_ENTRY_LEN)
+ {
+ unix_name[pos] = '/';
+ unix_name[pos + 1 + ret] = 0;
@@ -37,10 +36,10 @@ index bbdbbe9781..cca1e3c4a8 100644
if (status != STATUS_SUCCESS) break;
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 2f10472eeb..3e1121e521 100644
index e27382adf7..22764f05f3 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1713,8 +1713,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1714,8 +1714,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
RtlCreateUnicodeString( &nt_dest, dest );
nt_dest.Length = dest_len;
}
@@ -52,10 +51,10 @@ index 2f10472eeb..3e1121e521 100644
goto cleanup;
dest_allocated = TRUE;
diff --git a/include/winternl.h b/include/winternl.h
index e7f89b0059..168c471696 100644
index e0a827a11c..b71e456b53 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1788,6 +1788,7 @@ typedef struct _RTL_HANDLE_TABLE
@@ -1816,6 +1816,7 @@ typedef struct _RTL_HANDLE_TABLE
#define FILE_OVERWRITE 4
#define FILE_OVERWRITE_IF 5
#define FILE_MAXIMUM_DISPOSITION 5
@@ -64,5 +63,5 @@ index e7f89b0059..168c471696 100644
/* Characteristics of a File System */
#define FILE_REMOVABLE_MEDIA 0x00000001
--
2.17.1
2.24.1

View File

@@ -1,7 +1,7 @@
From 434c51a02c8a17e9b6ca91ccce8f192572823d45 Mon Sep 17 00:00:00 2001
From 1a7f83237f0d843be63c947f3c9e2aaaa90156a8 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: ntdll: Find dangling symlinks quickly.
Subject: [PATCH] ntdll: Find dangling symlinks quickly.
This is also necessary on systems (such as MacOS) that support
case-insensitive lookups of files.
@@ -12,11 +12,11 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index cca1e3c4a8..8f16f5e310 100644
index 669fd56cbe..95af2dde24 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2052,7 +2052,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
if (ret >= 0 && !used_default)
@@ -2053,7 +2053,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 ))
@@ -24,7 +24,7 @@ index cca1e3c4a8..8f16f5e310 100644
{
if (is_win_dir) *is_win_dir = is_same_file( &windir, &st );
return STATUS_SUCCESS;
@@ -2174,7 +2174,7 @@ not_found:
@@ -2175,7 +2175,7 @@ not_found:
return STATUS_OBJECT_PATH_NOT_FOUND;
success:
@@ -33,7 +33,7 @@ index cca1e3c4a8..8f16f5e310 100644
return STATUS_SUCCESS;
}
@@ -2640,7 +2640,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -2580,7 +2580,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 )))
{
@@ -43,5 +43,5 @@ index cca1e3c4a8..8f16f5e310 100644
if (disposition == FILE_CREATE)
return STATUS_OBJECT_NAME_COLLISION;
--
2.17.1
2.24.1