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 73b75afe55144727775e8a865f82ed843c19b3bb.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
From 00991099552d2c3e24ef04d379755bdea2a80941 Mon Sep 17 00:00:00 2001
|
||||
From 3a20b65362185b01069e04d84201da0ac6fa61cd Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Sat, 6 Feb 2021 12:46:30 -0700
|
||||
Subject: [PATCH 1/1] kernelbase: Add support for moving reparse points with
|
||||
Subject: [PATCH] kernelbase: Add support for moving reparse points with
|
||||
MoveFile*.
|
||||
|
||||
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
---
|
||||
dlls/kernelbase/file.c | 2 +-
|
||||
dlls/ntdll/tests/file.c | 12 +++++++++++-
|
||||
dlls/ntdll/unix/file.c | 20 ++++++++++++++++++++
|
||||
dlls/ntdll/unix/file.c | 21 +++++++++++++++++++++
|
||||
server/fd.c | 6 ++++--
|
||||
4 files changed, 36 insertions(+), 4 deletions(-)
|
||||
4 files changed, 37 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
|
||||
index 266d59ef58d..d1fcf22f0d9 100644
|
||||
@@ -56,22 +56,23 @@ index 8d4de8ae29a..ddc0e024b2e 100644
|
||||
/* Cleanup */
|
||||
pRtlFreeUnicodeString(&nameW);
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 681a9cf4c6f..7f8974c9b04 100644
|
||||
index 0af1c40f7e4..f3274478ae2 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -5581,6 +5581,8 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
@@ -5688,6 +5688,8 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
unsigned int flags;
|
||||
UNICODE_STRING name_str, redir;
|
||||
UNICODE_STRING name_str, nt_name;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
+ REPARSE_DATA_BUFFER *buffer = NULL;
|
||||
+ ULONG buffer_len = 0;
|
||||
char *unix_name;
|
||||
|
||||
if (class == FileLinkInformation)
|
||||
@@ -5597,6 +5599,19 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
@@ -5702,6 +5704,20 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
name_str.Length = info->FileNameLength;
|
||||
name_str.MaximumLength = info->FileNameLength + sizeof(WCHAR);
|
||||
InitializeObjectAttributes( &attr, &name_str, OBJ_CASE_INSENSITIVE, info->RootDirectory, NULL );
|
||||
get_redirect( &attr, &redir );
|
||||
|
||||
+
|
||||
+ /* obtain all the data from the reparse point (if applicable) */
|
||||
+ status = get_reparse_point( handle, NULL, &buffer_len );
|
||||
+ if (status == STATUS_BUFFER_TOO_SMALL)
|
||||
@@ -85,10 +86,10 @@ index 681a9cf4c6f..7f8974c9b04 100644
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
status = nt_to_unix_file_name( &attr, &unix_name, FILE_OPEN_IF );
|
||||
status = get_nt_and_unix_names( &attr, &nt_name, &unix_name, FILE_OPEN_IF );
|
||||
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
|
||||
{
|
||||
@@ -5613,9 +5628,14 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
@@ -5718,6 +5734,11 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
@@ -96,18 +97,15 @@ index 681a9cf4c6f..7f8974c9b04 100644
|
||||
+ if (buffer && status == STATUS_SUCCESS)
|
||||
+ status = create_reparse_point( handle, buffer );
|
||||
+
|
||||
free( unix_name );
|
||||
+ free( unix_name );
|
||||
}
|
||||
free( redir.Buffer );
|
||||
+ free( buffer );
|
||||
}
|
||||
else status = STATUS_INVALID_PARAMETER_3;
|
||||
break;
|
||||
free( unix_name );
|
||||
free( nt_name.Buffer );
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index dd6a61c557d..dde92beb664 100644
|
||||
index b5ccf5d5e9d..b755e406c13 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -2724,7 +2724,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
@@ -2740,7 +2740,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -116,7 +114,7 @@ index dd6a61c557d..dde92beb664 100644
|
||||
{
|
||||
if (!fstat( fd->unix_fd, &st2 ) && st.st_ino == st2.st_ino && st.st_dev == st2.st_dev)
|
||||
{
|
||||
@@ -2740,7 +2740,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
@@ -2756,7 +2756,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
}
|
||||
|
||||
/* can't replace directories or special files */
|
||||
@@ -125,7 +123,7 @@ index dd6a61c557d..dde92beb664 100644
|
||||
{
|
||||
set_error( STATUS_ACCESS_DENIED );
|
||||
goto failed;
|
||||
@@ -2806,6 +2806,8 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
@@ -2822,6 +2822,8 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
|
||||
fd->nt_name = dup_nt_name( root, nt_name, &fd->nt_namelen );
|
||||
free( fd->unix_name );
|
||||
fd->closed->unix_name = fd->unix_name = realpath( name, NULL );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 4f26d71abf2447b5e0c6d7b6e878cf6b6c578558 Mon Sep 17 00:00:00 2001
|
||||
From a9773394980e77b017dcb797766ec422b384a5cc Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sat, 3 Sep 2022 11:23:31 -0600
|
||||
Subject: [PATCH] ntdll: Follow reparse points during path resolution.
|
||||
@@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
2 files changed, 184 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 39b98af7efa..80b967f5469 100644
|
||||
index 9bd4bbdd245..84a0957b040 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -6082,7 +6082,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, ULONG flags,
|
||||
@@ -6025,7 +6025,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, ULONG flags,
|
||||
|
||||
static void test_reparse_points(void)
|
||||
{
|
||||
@@ -22,7 +22,7 @@ index 39b98af7efa..80b967f5469 100644
|
||||
static const WCHAR new_reparseW[] = {'\\','n','e','w','_','r','e','p','a','r','s','e',0};
|
||||
static const WCHAR reparseW[] = {'\\','r','e','p','a','r','s','e',0};
|
||||
static const WCHAR targetW[] = {'\\','t','a','r','g','e','t',0};
|
||||
@@ -6469,11 +6469,20 @@ static void test_reparse_points(void)
|
||||
@@ -6412,11 +6412,20 @@ static void test_reparse_points(void)
|
||||
bret = CopyFileW(reparse_path, new_path, TRUE);
|
||||
ok(!bret, "Reparse points cannot be copied.\n");
|
||||
|
||||
@@ -44,10 +44,10 @@ index 39b98af7efa..80b967f5469 100644
|
||||
ok(bret, "Failed to remove temporary reparse point directory!\n");
|
||||
bret = RemoveDirectoryW(target_path);
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 49afb57b2b6..26e412d28f1 100644
|
||||
index f3274478ae2..860e563f69d 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -3725,6 +3725,35 @@ done:
|
||||
@@ -3741,6 +3741,35 @@ done:
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ index 49afb57b2b6..26e412d28f1 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.
|
||||
@@ -3901,16 +3930,14 @@ cleanup:
|
||||
@@ -3917,16 +3946,14 @@ cleanup:
|
||||
|
||||
|
||||
/*
|
||||
@@ -102,7 +102,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
char *encoded = NULL;
|
||||
int link_dir_fd = -1;
|
||||
NTSTATUS status;
|
||||
@@ -3918,9 +3945,6 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
|
||||
@@ -3934,9 +3961,6 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
|
||||
int depth;
|
||||
char *p;
|
||||
|
||||
@@ -112,7 +112,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
ret = readlink( unix_name, link_path, sizeof(link_path) );
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -4020,12 +4044,76 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
|
||||
@@ -4036,12 +4060,76 @@ NTSTATUS get_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG *si
|
||||
|
||||
cleanup:
|
||||
if (link_dir_fd != -1) close( link_dir_fd );
|
||||
@@ -190,7 +190,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
/*
|
||||
* Retrieve the unix name corresponding to a file handle, remove that symlink, and then recreate
|
||||
* a directory at the location of the old filename.
|
||||
@@ -4119,15 +4207,24 @@ cleanup:
|
||||
@@ -4135,15 +4223,24 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
struct stat st;
|
||||
@@ -4184,6 +4281,8 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
@@ -4200,6 +4297,8 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
while (name_len)
|
||||
{
|
||||
const WCHAR *end, *next;
|
||||
@@ -225,7 +225,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
|
||||
end = name;
|
||||
while (end < name + name_len && *end != '\\') end++;
|
||||
@@ -4203,8 +4302,31 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
@@ -4219,8 +4318,31 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
|
||||
status = find_file_in_dir( root_fd, unix_name, pos, name, end - name, is_unix );
|
||||
|
||||
@@ -258,7 +258,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
{
|
||||
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
{
|
||||
@@ -4243,12 +4365,12 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
@@ -4259,12 +4381,12 @@ static NTSTATUS lookup_unix_name( int root_fd, const WCHAR *name, int name_len,
|
||||
/******************************************************************************
|
||||
* nt_to_unix_file_name_no_root
|
||||
*/
|
||||
@@ -273,7 +273,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
const WCHAR *name;
|
||||
struct stat st;
|
||||
@@ -4338,7 +4460,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
@@ -4354,7 +4476,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
name += prefix_len;
|
||||
name_len -= prefix_len;
|
||||
|
||||
@@ -282,7 +282,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
|
||||
{
|
||||
TRACE( "%s -> %s\n", debugstr_us(nameW), debugstr_a(unix_name) );
|
||||
@@ -4346,7 +4468,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
@@ -4362,7 +4484,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,9 +292,9 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
free( unix_name );
|
||||
}
|
||||
return status;
|
||||
@@ -4364,18 +4487,30 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
@@ -4380,18 +4503,30 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
|
||||
*/
|
||||
NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
|
||||
static NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
|
||||
{
|
||||
+ HANDLE rootdir = attr->RootDirectory;
|
||||
enum server_fd_type type;
|
||||
@@ -328,7 +328,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
|
||||
if (name_len && name[0] == '\\') return STATUS_INVALID_PARAMETER;
|
||||
|
||||
@@ -4383,7 +4518,7 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
|
||||
@@ -4399,7 +4534,7 @@ static NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name
|
||||
if (!(unix_name = malloc( unix_len ))) return STATUS_NO_MEMORY;
|
||||
unix_name[0] = '.';
|
||||
|
||||
@@ -337,7 +337,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
{
|
||||
if (type != FD_TYPE_DIR)
|
||||
{
|
||||
@@ -4392,7 +4527,16 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
|
||||
@@ -4408,7 +4543,16 @@ static NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,7 +355,7 @@ index 49afb57b2b6..26e412d28f1 100644
|
||||
if (needs_close) close( root_fd );
|
||||
}
|
||||
}
|
||||
@@ -4400,14 +4544,22 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
|
||||
@@ -4416,14 +4560,22 @@ static NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name
|
||||
|
||||
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
|
||||
{
|
||||
|
Reference in New Issue
Block a user