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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user