Rebase against 18230d23c599f1f5f9dd419dccc11c49117cc3b8.

This commit is contained in:
Alistair Leslie-Hughes
2022-03-05 09:58:02 +11:00
parent 0648126dae
commit a79a08a6f7
10 changed files with 148 additions and 80 deletions

View File

@@ -159,7 +159,7 @@ index 5ed116d94d9..35ae5ab854a 100644
- nt_dest.Length = dest_len;
+ if (flags == SYMLINK_FLAG_RELATIVE)
+ {
+ SIZE_T nt_path_len = PATH_MAX, unix_path_len = PATH_MAX;
+ ULONG nt_path_len = PATH_MAX, unix_path_len = PATH_MAX;
+ WCHAR *nt_path;
+
+ /* resolve the NT path of the source */

View File

@@ -1,7 +1,7 @@
From 96a9115e57cee4a11675d1fff5125155b6b213fb Mon Sep 17 00:00:00 2001
From 1d139a330669c7d650a95c08872e11da8d9d28f6 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Mon, 3 May 2021 09:28:08 -0600
Subject: ntdll: Add support for creating Unix/Linux symlinks.
Subject: [PATCH] ntdll: Add support for creating Unix/Linux symlinks.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 18887895e40..bff3b18ce83 100644
index e4eb36e31b3..6f647ddcca5 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5390,7 +5390,9 @@ static void test_reparse_points(void)
@@ -72,10 +72,10 @@ index 18887895e40..bff3b18ce83 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 752561931ab..0c2117ca801 100644
index 323bf865631..c146fc70639 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6031,18 +6031,18 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -6024,18 +6024,18 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
BOOL src_allocated = FALSE, path_allocated = FALSE, dest_allocated = FALSE;
BOOL nt_dest_allocated = FALSE, tempdir_created = FALSE;
@@ -97,7 +97,7 @@ index 752561931ab..0c2117ca801 100644
ULONG flags;
int i;
@@ -6060,6 +6060,12 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -6053,6 +6053,12 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
dest = &buffer->SymbolicLinkReparseBuffer.PathBuffer[offset];
flags = buffer->SymbolicLinkReparseBuffer.Flags;
break;
@@ -110,7 +110,7 @@ index 752561931ab..0c2117ca801 100644
default:
FIXME("stub: FSCTL_SET_REPARSE_POINT(%x)\n", buffer->ReparseTag);
return STATUS_NOT_IMPLEMENTED;
@@ -6071,6 +6077,9 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -6064,6 +6070,9 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if ((status = server_get_unix_name( handle, &unix_src, FALSE )))
goto cleanup;
src_allocated = TRUE;
@@ -119,8 +119,8 @@ index 752561931ab..0c2117ca801 100644
+
if (flags == SYMLINK_FLAG_RELATIVE)
{
SIZE_T nt_path_len = PATH_MAX, unix_path_len = PATH_MAX;
@@ -6146,6 +6155,8 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
ULONG nt_path_len = PATH_MAX, unix_path_len = PATH_MAX;
@@ -6139,6 +6148,8 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if (status != STATUS_SUCCESS && status != STATUS_NO_SUCH_FILE)
goto cleanup;
dest_allocated = TRUE;
@@ -129,7 +129,7 @@ index 752561931ab..0c2117ca801 100644
/* check that the source and destination paths are the same up to the relative path */
if (flags == SYMLINK_FLAG_RELATIVE)
{
@@ -6161,14 +6172,17 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -6154,14 +6165,17 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
/* Encode the reparse tag into the symlink */
strcpy( magic_dest, "" );
@@ -153,5 +153,5 @@ index 752561931ab..0c2117ca801 100644
/* Encode the type (file or directory) if NT symlink */
if (buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK)
--
2.17.1
2.34.1

View File

@@ -0,0 +1,71 @@
From 8c6455d6be0cba8dc98a95726d9d289089c2bf67 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sat, 5 Mar 2022 11:08:23 +1100
Subject: [PATCH] Fix warnings
These need to be merged into the patches above.
---
dlls/ntdll/unix/file.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 787616aa675..ee4f31a1e38 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6150,16 +6150,14 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
/* re-resolve the unix path for the source */
for (;;)
{
- UNICODE_STRING nt_path_tmp;
+ OBJECT_ATTRIBUTES attr;
unix_path = malloc( unix_path_len );
if (!unix_path)
{
status = STATUS_NO_MEMORY;
goto cleanup;
}
- nt_path_tmp.Buffer = nt_path;
- nt_path_tmp.Length = wcslen(nt_path) * sizeof(WCHAR);
- status = wine_nt_to_unix_file_name( &nt_path_tmp, unix_path, &unix_path_len, FALSE );
+ 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 );
}
@@ -6182,13 +6180,15 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
/* resolve the NT path of the destination */
for (;;)
{
+ OBJECT_ATTRIBUTES attr;
+ ULONG len = unix_dest_len;
unix_dest = malloc( unix_dest_len );
if (!unix_dest)
{
status = STATUS_NO_MEMORY;
goto cleanup;
}
- status = wine_nt_to_unix_file_name( &nt_dest, unix_dest, &unix_dest_len, FILE_WINE_PATH );
+ status = wine_nt_to_unix_file_name( &attr, unix_dest, &len, FILE_WINE_PATH );
if (status != STATUS_BUFFER_TOO_SMALL) break;
free( unix_dest );
}
@@ -6447,13 +6447,15 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
/* resolve the NT path */
for (;;)
{
+ ULONG len;
nt_dest = malloc( nt_dest_len * sizeof(WCHAR) );
if (!nt_dest)
{
status = STATUS_NO_MEMORY;
goto cleanup;
}
- status = wine_unix_to_nt_file_name( unix_dest, nt_dest, &nt_dest_len );
+ status = wine_unix_to_nt_file_name( unix_dest, nt_dest, &len );
+ nt_dest_len = len;
if (status != STATUS_BUFFER_TOO_SMALL) break;
free( nt_dest );
}
--
2.34.1