Rebase against 73b75afe55144727775e8a865f82ed843c19b3bb.

This commit is contained in:
Alistair Leslie-Hughes
2025-06-19 11:06:28 +10:00
parent a044166651
commit 5cc4d90333
5 changed files with 64 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
From 9829e3c307e8019a3a2b9204d1133833863da5f1 Mon Sep 17 00:00:00 2001
From b4f92dd9311882607cedd7d247ddf3069ae33d8b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 7 Jul 2018 12:57:47 +0200
Subject: [PATCH] server: Create eventfd descriptors for pseudo-fd objects and
@@ -11,10 +11,10 @@ Subject: [PATCH] server: Create eventfd descriptors for pseudo-fd objects and
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/server/fd.c b/server/fd.c
index 6a1b89b0e54..8ba704344cf 100644
index 737f7ee67b9..01a055f8b2d 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -97,6 +97,7 @@
@@ -95,6 +95,7 @@
#include "handle.h"
#include "process.h"
#include "request.h"
@@ -22,7 +22,7 @@ index 6a1b89b0e54..8ba704344cf 100644
#include "winternl.h"
#include "winioctl.h"
@@ -198,6 +199,7 @@ struct fd
@@ -159,6 +160,7 @@ struct fd
struct completion *completion; /* completion object attached to this fd */
apc_param_t comp_key; /* completion key to set in completion events */
unsigned int comp_flags; /* completion flags */
@@ -40,7 +40,7 @@ index 6a1b89b0e54..8ba704344cf 100644
}
/* check if the desired access is possible without violating */
@@ -1784,6 +1789,7 @@ static struct fd *alloc_fd_object(void)
@@ -1786,6 +1791,7 @@ static struct fd *alloc_fd_object(void)
fd->poll_index = -1;
fd->completion = NULL;
fd->comp_flags = 0;
@@ -48,7 +48,7 @@ index 6a1b89b0e54..8ba704344cf 100644
init_async_queue( &fd->read_q );
init_async_queue( &fd->write_q );
init_async_queue( &fd->wait_q );
@@ -1823,11 +1829,15 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
@@ -1827,11 +1833,15 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->completion = NULL;
fd->comp_flags = 0;
fd->no_fd_status = STATUS_BAD_DEVICE_TYPE;
@@ -64,7 +64,7 @@ index 6a1b89b0e54..8ba704344cf 100644
return fd;
}
@@ -2268,6 +2278,9 @@ void set_fd_signaled( struct fd *fd, int signaled )
@@ -2283,6 +2293,9 @@ void set_fd_signaled( struct fd *fd, int signaled )
if (fd->comp_flags & FILE_SKIP_SET_EVENT_ON_HANDLE) return;
fd->signaled = signaled;
if (signaled) wake_up( fd->user, 0 );
@@ -74,7 +74,7 @@ index 6a1b89b0e54..8ba704344cf 100644
}
/* check if events are pending and if yes return which one(s) */
@@ -2293,6 +2306,15 @@ int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -2324,6 +2337,15 @@ WCHAR *default_fd_get_full_name( struct object *obj, data_size_t max, data_size_
return ret;
}
@@ -91,19 +91,19 @@ index 6a1b89b0e54..8ba704344cf 100644
{
int events = 0;
diff --git a/server/file.h b/server/file.h
index 0ffe0e2c8dc..b5b1e2a1077 100644
index 7742e705e49..d86a9fc159d 100644
--- a/server/file.h
+++ b/server/file.h
@@ -106,6 +106,7 @@ extern char *dup_fd_name( struct fd *root, const char *name );
extern void get_nt_name( struct fd *fd, struct unicode_str *name );
@@ -110,6 +110,7 @@ extern void get_nt_name( struct fd *fd, struct unicode_str *name );
extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry );
extern WCHAR *default_fd_get_full_name( struct object *obj, data_size_t max, data_size_t *ret_len );
+extern int default_fd_get_esync_fd( struct object *obj, enum esync_type *type );
extern int default_fd_get_poll_events( struct fd *fd );
extern void default_poll_event( struct fd *fd, int event );
extern void fd_cancel_async( struct fd *fd, struct async *async );
diff --git a/server/named_pipe.c b/server/named_pipe.c
index b8ec17a787a..e01b28f725a 100644
index cdb27ed45c0..d4f8cf5e964 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -168,7 +168,7 @@ static const struct object_ops pipe_server_ops =
@@ -125,5 +125,5 @@ index b8ec17a787a..e01b28f725a 100644
no_signal, /* signal */
pipe_end_get_fd, /* get_fd */
--
2.35.1
2.47.2

View File

@@ -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 );

View File

@@ -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)
{

View File

@@ -1,4 +1,4 @@
From 18540f65cde320c499eb8bcb630ade9f9fa977fe Mon Sep 17 00:00:00 2001
From 41e1d1b92a179f00f391919b47732e7eab9f8337 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.
@@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Implement opening files through nt device paths.
2 files changed, 156 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index af67e8d75bf..608b64a32ad 100644
index 16489f4b29c..11769021b32 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -137,18 +137,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
@@ -139,18 +139,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
static void create_file_test(void)
{
@@ -36,7 +36,7 @@ index af67e8d75bf..608b64a32ad 100644
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
UNICODE_STRING nameW;
@@ -328,6 +332,25 @@ static void create_file_test(void)
@@ -320,6 +324,25 @@ static void create_file_test(void)
status = pNtQueryFullAttributesFile( &attr, &info );
ok( status == STATUS_OBJECT_NAME_INVALID,
"query %s failed %lx\n", wine_dbgstr_w(nameW.Buffer), status );
@@ -63,10 +63,10 @@ index af67e8d75bf..608b64a32ad 100644
static void open_file_test(void)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index ba9cd8d9031..c3ddf72b44b 100644
index a39079efa97..c76d91cdf68 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4494,7 +4494,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
@@ -4688,7 +4688,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
/******************************************************************************
@@ -75,16 +75,16 @@ index ba9cd8d9031..c3ddf72b44b 100644
*
* Convert a file name from NT namespace to Unix namespace.
*
@@ -4502,7 +4502,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
@@ -4696,7 +4696,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.
*/
-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 )
+NTSTATUS nt_to_unix_file_name_internal( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
{
HANDLE rootdir = attr->RootDirectory;
enum server_fd_type type;
@@ -4581,6 +4581,136 @@ reparse:
@@ -4775,6 +4775,136 @@ reparse:
}
@@ -222,5 +222,5 @@ index ba9cd8d9031..c3ddf72b44b 100644
* wine_nt_to_unix_file_name
*
--
2.39.1
2.47.2

View File

@@ -1 +1 @@
885446556ce443b496e368b8f2c68807dcc7df0f
73b75afe55144727775e8a865f82ed843c19b3bb