ntdll-Junction_Points: Remove hardcoded results for reparse point size and NtReadFile().

As tests show these are actually incorrect; reparse points can contain arbitrary data.
This commit is contained in:
Elizabeth Figura
2025-11-11 16:56:56 -06:00
parent 4ee9edf610
commit 635849c3ed
2 changed files with 0 additions and 90 deletions

View File

@@ -1,35 +0,0 @@
From b0eff92e78691d5f864d14b96131d2a38a3aea1a Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 1 May 2019 12:06:20 -0600
Subject: ntdll: Always report symbolic links as containing zero bytes.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/unix/file.c | 4 ++++
2 files changed, 36 insertions(+)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index f298b1f7a6c..caa454c024f 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1761,6 +1761,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
/* symbolic links (either junction points or NT symlinks) are "reparse points" */
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
+ /* symbolic links always report size 0 */
+ st->st_size = 0;
/* whether a reparse point is a file or a directory is stored inside the link target */
if (is_reparse_dir( fd, "", &is_dir ) == 0)
st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG);
@@ -1844,6 +1846,8 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
stat( path, st );
/* symbolic links (either junction points or NT symlinks) are "reparse points" */
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
+ /* symbolic links always report size 0 */
+ st->st_size = 0;
/* whether a reparse point is a file or a directory is stored inside the link target */
if (is_reparse_dir( AT_FDCWD, path, &is_dir ) == 0)
st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG);
--
2.17.1

View File

@@ -1,55 +0,0 @@
From 6b1c261760080d470254b25b512625f4c1e3d935 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Mon, 23 Nov 2020 13:08:02 -0700
Subject: ntdll: Succeed with no data for NtReadFile on reparse points.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/unix/file.c | 5 +++++
server/file.c | 1 +
server/protocol.def | 1 +
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index b26b239574b..bf80708b41e 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6312,6 +6312,11 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo
if (needs_close) close( unix_handle );
return status;
}
+ else if (type == FD_TYPE_SYMLINK)
+ {
+ status = STATUS_SUCCESS;
+ goto done;
+ }
if (type == FD_TYPE_SERIAL && async_read && length)
{
diff --git a/server/file.c b/server/file.c
index 76c687833c9..b4f99ddc93b 100644
--- a/server/file.c
+++ b/server/file.c
@@ -294,6 +294,7 @@ static enum server_fd_type file_get_fd_type( struct fd *fd )
{
struct file *file = get_fd_user( fd );
+ if (S_ISLNK(file->mode)) return FD_TYPE_SYMLINK;
if (S_ISREG(file->mode) || S_ISBLK(file->mode)) return FD_TYPE_FILE;
if (S_ISDIR(file->mode)) return FD_TYPE_DIR;
return FD_TYPE_CHAR;
diff --git a/server/protocol.def b/server/protocol.def
index d828d41d1f7..aa7398369ad 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1381,6 +1381,7 @@ enum server_fd_type
{
FD_TYPE_INVALID, /* invalid file (no associated fd) */
FD_TYPE_FILE, /* regular file */
+ FD_TYPE_SYMLINK, /* symbolic link */
FD_TYPE_DIR, /* directory */
FD_TYPE_SOCKET, /* socket */
FD_TYPE_SERIAL, /* serial port */
--
2.17.1