You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 182e2887b7c01d464f296bd7aa1335f147d8e514.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 5b94720ada0b6f75ddff60cf19472a2685dbeaf0 Mon Sep 17 00:00:00 2001
|
||||
From 6b96b85136b078f9779c07e5c0daecd7b1006e09 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sun, 4 Sep 2022 13:19:16 -0600
|
||||
Subject: [PATCH] ntdll: Allow reparse points to target the applicable Unix
|
||||
@@ -9,14 +9,14 @@ the user to follow the symlink outside of Wine.
|
||||
|
||||
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
---
|
||||
dlls/ntdll/unix/file.c | 118 +++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 118 insertions(+)
|
||||
dlls/ntdll/unix/file.c | 90 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 90 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index c54fd1119e1..33f26ceb89a 100644
|
||||
index f83a30d36ed..234a0fa7397 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -3712,6 +3712,114 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
|
||||
@@ -3714,6 +3714,86 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,9 @@ index c54fd1119e1..33f26ceb89a 100644
|
||||
+NTSTATUS create_reparse_target( int dirfd, const char *unix_src, int depth, const char *link_path,
|
||||
+ REPARSE_DATA_BUFFER *buffer )
|
||||
+{
|
||||
+ ULONG nt_path_len = PATH_MAX, unix_path_len = PATH_MAX;
|
||||
+ UNICODE_STRING nt_target, nt_full_target;
|
||||
+ ULONG unix_target_len = PATH_MAX;
|
||||
+ char *unix_path = NULL, *d;
|
||||
+ char target_path[PATH_MAX];
|
||||
+ OBJECT_ATTRIBUTES attr;
|
||||
+ int nt_target_len;
|
||||
+ char *unix_target;
|
||||
+ int is_relative;
|
||||
@@ -41,8 +38,6 @@ index c54fd1119e1..33f26ceb89a 100644
|
||||
+ /* if the target path is relative then turn the source path into an NT path */
|
||||
+ if (is_relative)
|
||||
+ {
|
||||
+ UNICODE_STRING nt_path_tmp;
|
||||
+
|
||||
+ /* resolve the NT path of the source */
|
||||
+ unix_path = malloc( strlen(unix_src) + 2 );
|
||||
+ if (!unix_path) return STATUS_NO_MEMORY;
|
||||
@@ -55,17 +50,7 @@ index c54fd1119e1..33f26ceb89a 100644
|
||||
+ if (status != STATUS_SUCCESS)
|
||||
+ return status;
|
||||
+ /* re-resolve the unix path for the source */
|
||||
+ nt_path_tmp.Buffer = nt_path;
|
||||
+ nt_path_tmp.Length = wcslen(nt_path) * sizeof(WCHAR);
|
||||
+ InitializeObjectAttributes( &attr, &nt_path_tmp, 0, 0, NULL );
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ unix_path = malloc( unix_path_len );
|
||||
+ if (!unix_path) return STATUS_NO_MEMORY;
|
||||
+ status = wine_nt_to_unix_file_name( &attr, unix_path, &unix_path_len, FILE_OPEN_IF );
|
||||
+ if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||
+ free( unix_path );
|
||||
+ }
|
||||
+ status = ntdll_get_unix_file_name( nt_path, &unix_path, FILE_OPEN_IF );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
@@ -85,21 +70,8 @@ index c54fd1119e1..33f26ceb89a 100644
|
||||
+ wcscpy( nt_full_target.Buffer, nt_path );
|
||||
+ free( nt_path );
|
||||
+ memcpy( &nt_full_target.Buffer[wcslen(nt_full_target.Buffer)], nt_target.Buffer, nt_target_len );
|
||||
+ nt_full_target.Length = wcslen( nt_full_target.Buffer ) * sizeof(WCHAR);
|
||||
+ /* find the unix path for the target */
|
||||
+ InitializeObjectAttributes( &attr, &nt_full_target, 0, 0, NULL );
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ unix_target = malloc( unix_target_len );
|
||||
+ if (!unix_target)
|
||||
+ {
|
||||
+ status = STATUS_NO_MEMORY;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ status = wine_nt_to_unix_file_name( &attr, unix_target, &unix_target_len, FILE_OPEN_IF );
|
||||
+ if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||
+ free( unix_target );
|
||||
+ }
|
||||
+ status = ntdll_get_unix_file_name( nt_full_target.Buffer, &unix_target, FILE_OPEN_IF );
|
||||
+ /* create the symlink to the target at the last metadata location */
|
||||
+ if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
|
||||
+ {
|
||||
@@ -131,7 +103,7 @@ index c54fd1119e1..33f26ceb89a 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.
|
||||
@@ -3845,6 +3953,16 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
|
||||
@@ -3847,6 +3927,16 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
|
||||
link_dir_fd = fd;
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
From 41e1d1b92a179f00f391919b47732e7eab9f8337 Mon Sep 17 00:00:00 2001
|
||||
From efd73d7778d8c083337bda1ad162618841c368e0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 30 Nov 2021 16:32:34 +0300
|
||||
Subject: [PATCH] ntdll: Implement opening files through nt device paths.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/file.c | 25 +++++++-
|
||||
dlls/ntdll/unix/file.c | 134 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 156 insertions(+), 3 deletions(-)
|
||||
dlls/ntdll/unix/file.c | 135 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 157 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 16489f4b29c..11769021b32 100644
|
||||
index 25381caf313..7f048572e03 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -139,18 +139,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
|
||||
@@ -63,10 +63,10 @@ index 16489f4b29c..11769021b32 100644
|
||||
|
||||
static void open_file_test(void)
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index a39079efa97..c76d91cdf68 100644
|
||||
index 542a314ea81..68587cbef11 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -4688,7 +4688,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
@@ -4593,7 +4593,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -75,7 +75,7 @@ index a39079efa97..c76d91cdf68 100644
|
||||
*
|
||||
* Convert a file name from NT namespace to Unix namespace.
|
||||
*
|
||||
@@ -4696,7 +4696,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
@@ -4601,7 +4601,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
* element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is
|
||||
* returned, but the unix name is still filled in properly.
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ index a39079efa97..c76d91cdf68 100644
|
||||
{
|
||||
HANDLE rootdir = attr->RootDirectory;
|
||||
enum server_fd_type type;
|
||||
@@ -4775,6 +4775,136 @@ reparse:
|
||||
@@ -4680,6 +4680,137 @@ reparse:
|
||||
}
|
||||
|
||||
|
||||
@@ -218,8 +218,9 @@ index a39079efa97..c76d91cdf68 100644
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
/******************************************************************************
|
||||
* wine_nt_to_unix_file_name
|
||||
+
|
||||
/******************************************************************
|
||||
* collapse_path
|
||||
*
|
||||
--
|
||||
2.47.2
|
||||
|
@@ -1,2 +1,3 @@
|
||||
Fixes: [37487] Resolve \\SystemRoot\\ prefix when opening files
|
||||
Fixes: Implement opening files through nt device paths
|
||||
Depends: ntdll-Junction_Points
|
||||
|
@@ -1 +1 @@
|
||||
e1af2ae201c9853133ef3af1dafe15fe992fed92
|
||||
182e2887b7c01d464f296bd7aa1335f147d8e514
|
||||
|
Reference in New Issue
Block a user