Updated ntdll-Junction_Points patchset

Changed dependencies to allow ntdll-Junction_Points to be applied
on top of wine.
This commit is contained in:
Alistair Leslie-Hughes
2019-04-23 10:42:19 +10:00
parent 9e53a45319
commit a0708adf42
26 changed files with 319 additions and 222 deletions

View File

@@ -1,27 +1,27 @@
From 0d2ea784da8e7b644da39d00852b7470cc3b634e Mon Sep 17 00:00:00 2001
From 5d45f1a04195f1b058de18586db78367e8fb94ee Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:56:49 -0700
Subject: [PATCH] ntdll: Add support for junction point creation.
Subject: ntdll: Add support for junction point creation.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
configure.ac | 1 +
dlls/ntdll/file.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/tests/file.c | 101 +++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/file.c | 116 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/tests/file.c | 101 ++++++++++++++++++++++++++++++++++
include/Makefile.in | 1 +
include/ntifs.h | 42 ++++++++++++++++++
include/ntifs.h | 42 +++++++++++++++
include/wine/port.h | 9 ++++
libs/port/Makefile.in | 1 +
libs/port/renameat2.c | 44 ++++++++++++++++++
libs/port/renameat2.c | 44 +++++++++++++++
8 files changed, 315 insertions(+)
create mode 100644 include/ntifs.h
create mode 100644 libs/port/renameat2.c
diff --git a/configure.ac b/configure.ac
index cf896c1..3275061 100644
index 611dc69c2e..c567f32d57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2219,6 +2219,7 @@ AC_CHECK_FUNCS(\
@@ -2179,6 +2179,7 @@ AC_CHECK_FUNCS(\
pwrite \
readdir \
readlink \
@@ -30,7 +30,7 @@ index cf896c1..3275061 100644
select \
setproctitle \
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index c1de955..6337cc8 100644
index 3dafdcfb44..5f2da14398 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -21,6 +21,7 @@
@@ -49,7 +49,7 @@ index c1de955..6337cc8 100644
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -1746,6 +1748,102 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -1648,6 +1650,102 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
}
@@ -152,7 +152,7 @@ index c1de955..6337cc8 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1830,6 +1928,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1732,6 +1830,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
io->Information = 0;
status = STATUS_SUCCESS;
break;
@@ -178,7 +178,7 @@ index c1de955..6337cc8 100644
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 74adf4c..1eedfaa 100644
index 8e54dbb541..322dadefe3 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -38,6 +38,7 @@
@@ -189,7 +189,7 @@ index 74adf4c..1eedfaa 100644
#ifndef IO_COMPLETION_ALL_ACCESS
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
@@ -5050,6 +5051,105 @@ static void test_file_readonly_access(void)
@@ -4831,6 +4832,105 @@ static void test_file_readonly_access(void)
DeleteFileW(path);
}
@@ -295,19 +295,17 @@ index 74adf4c..1eedfaa 100644
START_TEST(file)
{
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
@@ -5120,6 +5220,7 @@ START_TEST(file)
test_query_volume_information_file();
@@ -4900,4 +5000,5 @@ START_TEST(file)
test_query_attribute_information_file();
test_ioctl();
+ test_reparse_points();
test_flush_buffers_file();
test_query_ea();
+ test_reparse_points();
}
diff --git a/include/Makefile.in b/include/Makefile.in
index 31a811d..eeeff7b 100644
index 09c84d8254..616f265900 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -482,6 +482,7 @@ SOURCES = \
@@ -479,6 +479,7 @@ SOURCES = \
ntddvdeo.h \
ntdef.h \
ntdsapi.h \
@@ -317,7 +315,7 @@ index 31a811d..eeeff7b 100644
ntsecapi.h \
diff --git a/include/ntifs.h b/include/ntifs.h
new file mode 100644
index 0000000..21d42e1
index 0000000000..21d42e1732
--- /dev/null
+++ b/include/ntifs.h
@@ -0,0 +1,42 @@
@@ -364,7 +362,7 @@ index 0000000..21d42e1
+
+#endif /* __WINE_NTIFS_H */
diff --git a/include/wine/port.h b/include/wine/port.h
index 2b8a069..4bbf999 100644
index d23e2b033f..26c5890ddb 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -317,6 +317,15 @@ double rint(double x);
@@ -384,7 +382,7 @@ index 2b8a069..4bbf999 100644
int statvfs( const char *path, struct statvfs *buf );
#endif
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index b975418..790fd96 100644
index a2e96d1500..db27249ac1 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -97,6 +97,7 @@ C_SRCS = \
@@ -397,7 +395,7 @@ index b975418..790fd96 100644
spawn.c \
diff --git a/libs/port/renameat2.c b/libs/port/renameat2.c
new file mode 100644
index 0000000..39b4053
index 0000000000..39b4053f91
--- /dev/null
+++ b/libs/port/renameat2.c
@@ -0,0 +1,44 @@
@@ -446,5 +444,5 @@ index 0000000..39b4053
+}
+#endif /* HAVE_RENAMEAT2 */
--
1.9.1
2.17.1

View File

@@ -1,4 +1,4 @@
From 47cc80d8a94523f36a19906b8d647f3e58e346ef Mon Sep 17 00:00:00 2001
From 7c01bde97a63851a367aa0bd76c9aee398857b4e Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:57:57 -0700
Subject: ntdll: Add support for reading junction points.

View File

@@ -1,20 +1,20 @@
From 272ed659e67adc42778e428ac4b74d2844dc9ad5 Mon Sep 17 00:00:00 2001
From 8e8839dfe0b2eeae7b0d124b65725257792e3813 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:00:21 -0700
Subject: ntdll: Add support for deleting junction points.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 51 +++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/tests/file.c | 23 ++++++++++++++++++-
include/ntifs.h | 12 ++++++++++
3 files changed, 85 insertions(+), 1 deletion(-)
dlls/ntdll/file.c | 96 +++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/tests/file.c | 23 +++++++++-
include/ntifs.h | 12 ++++++
3 files changed, 130 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index ee561d9268..2effe7efb0 100644
index ee561d9268..1730d816d9 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1846,6 +1846,41 @@ cleanup:
@@ -1846,6 +1846,86 @@ cleanup:
}
@@ -24,9 +24,12 @@ index ee561d9268..2effe7efb0 100644
+ */
+NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
+{
+ char tmpdir[PATH_MAX], tmpfile[PATH_MAX];
+ BOOL tempdir_created = FALSE;
+ int dest_fd, needs_close;
+ ANSI_STRING unix_name;
+ NTSTATUS status;
+ struct stat st;
+
+ if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
+ return status;
@@ -35,12 +38,53 @@ index ee561d9268..2effe7efb0 100644
+ goto cleanup;
+
+ TRACE("Deleting symlink %s\n", unix_name.Buffer);
+ if (unlink( unix_name.Buffer ) < 0)
+
+ /* Produce the directory in a temporary location in the same folder */
+ if (fstat( dest_fd, &st ) == -1)
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
+ }
+ if (mkdir( unix_name.Buffer, 0775 ) < 0)
+ strcpy( tmpdir, unix_name.Buffer );
+ dirname( tmpdir) ;
+ strcat( tmpdir, "/.winelink.XXXXXX" );
+ if (mkdtemp( tmpdir ) == NULL)
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
+ }
+ tempdir_created = TRUE;
+ strcpy( tmpfile, tmpdir );
+ strcat( tmpfile, "/tmpfile" );
+ if (mkdir( tmpfile, st.st_mode ))
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
+ }
+ /* attemp to retain the ownership (if possible) */
+ lchown( tmpfile, st.st_uid, st.st_gid );
+ /* Atomically move the directory into position */
+ if (!renameat2( -1, tmpfile, -1, unix_name.Buffer, RENAME_EXCHANGE ))
+ {
+ /* success: link and folder have switched locations */
+ unlink( tmpfile ); /* remove the link (at folder location) */
+ }
+ else if (errno == ENOSYS)
+ {
+ FIXME( "Atomic exchange of directory with symbolic link unsupported on this system, "
+ "using unsafe exchange instead.\n" );
+ if (unlink( unix_name.Buffer ))
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
+ }
+ if (rename( tmpfile, unix_name.Buffer ))
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup; /* not moved, orignal file/folder at destination is orphaned */
+ }
+ }
+ else
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
@@ -48,6 +92,7 @@ index ee561d9268..2effe7efb0 100644
+ status = STATUS_SUCCESS;
+
+cleanup:
+ if (tempdir_created) rmdir( tmpdir );
+ if (needs_close) close( dest_fd );
+ return status;
+}
@@ -56,7 +101,7 @@ index ee561d9268..2effe7efb0 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1931,6 +1966,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1931,6 +2011,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
status = STATUS_SUCCESS;
break;

View File

@@ -1,4 +1,4 @@
From 719d62a3f338279f466d12a628a9e6ec78f65b00 Mon Sep 17 00:00:00 2001
From c94b245b19d852b13048227551641c655c591da1 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:01:25 -0700
Subject: ntdll: Add a test for junction point advertisement.

View File

@@ -1,4 +1,4 @@
From a8eb436342b0f261ba09c0a4bb1a87f0a85b4d85 Mon Sep 17 00:00:00 2001
From 8b1d430506bf0127a4782594937e1ae1505d64f0 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: kernel32,ntdll: Add support for deleting junction points with

View File

@@ -1,4 +1,4 @@
From 4fe08afd847dc6c1c89eb90f647faafe0be2f4a8 Mon Sep 17 00:00:00 2001
From 602c311b76c08f4d06c71ee0925ea7c3329d7d73 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:03:47 -0700
Subject: kernel32: Advertise junction point support.

View File

@@ -1,4 +1,4 @@
From 084864a69084f9e01e53ee289681a342d1ec0a05 Mon Sep 17 00:00:00 2001
From 6c1d1b1d7819118d3511aaa314a8e3da05f4c7ea Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:06:24 -0700
Subject: ntdll: Add support for absolute symlink creation.
@@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 139 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 2effe7efb0..00e3d7aa31 100644
index 1730d816d9..78ea4c5b00 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1657,17 +1657,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -70,7 +70,7 @@ index 2effe7efb0..00e3d7aa31 100644
strcat( magic_dest, unix_dest.Buffer );
/* Produce the link in a temporary location in the same folder */
@@ -1995,6 +2023,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -2040,6 +2068,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:

View File

@@ -1,4 +1,4 @@
From a482fa218dbe1284c8a08fba84c9f36dec4d3eba Mon Sep 17 00:00:00 2001
From 498e0feb3c25f92c9930e4007259b12c6ff4e567 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 13 Mar 2019 12:55:20 -0600
Subject: ntdll: Add support for reading absolute symlinks.
@@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 00e3d7aa31..ee8ac6bd10 100644
index 78ea4c5b00..812bfd0e36 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1787,6 +1787,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s

View File

@@ -1,4 +1,4 @@
From fdee240e3485e3fb993b811f2bd47142b166fd8c Mon Sep 17 00:00:00 2001
From c32fc6d0a84e857f17c1c51af9bab5aab6a5ff1e Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 13 Mar 2019 13:02:22 -0600
Subject: ntdll: Add support for deleting symlinks.
@@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 17 insertions(+)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index ee8ac6bd10..834fd8eacc 100644
index 812bfd0e36..262d24b9d2 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2023,6 +2023,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -2068,6 +2068,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:

View File

@@ -1,4 +1,4 @@
From 2251bc21739a0876f42085127d861e11df2cc953 Mon Sep 17 00:00:00 2001
From 273149c2baf56e80063a33ebb5d143819a138436 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 11 Apr 2019 12:16:49 -0600
Subject: ntdll: Add support for relative symlink creation.
@@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 834fd8eacc..4b9688c594 100644
index 262d24b9d2..186156159c 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1656,16 +1656,19 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,

View File

@@ -1,4 +1,4 @@
From 2a5bd75df6dcbbc28b821e0e70b022f32d6de424 Mon Sep 17 00:00:00 2001
From 2618729bcbd286d60e0a80c3ad1ef840c58c5689 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 11 Apr 2019 12:31:16 -0600
Subject: ntdll: Add support for reading relative symlinks.
@@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 4b9688c594..0eb522bf1d 100644
index 186156159c..8795eb6e9d 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1828,6 +1828,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s

View File

@@ -1,16 +1,16 @@
From 43b9fbb15b535717e2b8cb082330efd179acf321 Mon Sep 17 00:00:00 2001
From 0cf6512a8532b065dc92d6ac16678dff180a1107 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 11 Apr 2019 17:57:53 -0600
Subject: ntdll: Add support for file symlinks.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 11 ++++++++---
dlls/ntdll/file.c | 27 ++++++++++++++++++++++-----
dlls/ntdll/tests/file.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 3 deletions(-)
2 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 0eb522bf1d..7c1a711fc3 100644
index 8795eb6e9d..a9fe846e08 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1665,6 +1665,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -45,6 +45,52 @@ index 0eb522bf1d..7c1a711fc3 100644
}
else if (errno == ENOSYS)
{
@@ -1989,6 +1994,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
BOOL tempdir_created = FALSE;
int dest_fd, needs_close;
ANSI_STRING unix_name;
+ BOOL is_dir = TRUE;
NTSTATUS status;
struct stat st;
@@ -2000,12 +2006,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
TRACE("Deleting symlink %s\n", unix_name.Buffer);
- /* Produce the directory in a temporary location in the same folder */
+ /* Produce the file/directory in a temporary location in the same folder */
if (fstat( dest_fd, &st ) == -1)
{
status = FILE_GetNtStatus();
goto cleanup;
}
+ is_dir = S_ISDIR(st.st_mode);
strcpy( tmpdir, unix_name.Buffer );
dirname( tmpdir) ;
strcat( tmpdir, "/.winelink.XXXXXX" );
@@ -2017,11 +2024,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
tempdir_created = TRUE;
strcpy( tmpfile, tmpdir );
strcat( tmpfile, "/tmpfile" );
- if (mkdir( tmpfile, st.st_mode ))
+ if (is_dir && mkdir( tmpfile, st.st_mode ))
{
status = FILE_GetNtStatus();
goto cleanup;
}
+ else if (!is_dir)
+ {
+ int fd = open( tmpfile, O_CREAT|O_WRONLY|O_TRUNC, st.st_mode );
+ if (fd < 0)
+ {
+ status = FILE_GetNtStatus();
+ goto cleanup;
+ }
+ close( fd );
+ }
/* attemp to retain the ownership (if possible) */
lchown( tmpfile, st.st_uid, st.st_gid );
/* Atomically move the directory into position */
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index c13ee84bf0..f40dc1f51b 100644
--- a/dlls/ntdll/tests/file.c

View File

@@ -1,21 +1,21 @@
From 48fd8c19b8a0403c297c5bd0eade9cd5ef446305 Mon Sep 17 00:00:00 2001
From 2ccff55de1a8e43f12fde63870b0d93ec63dd4ab Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 12:00:51 -0600
Subject: [PATCH] ntdll: Correctly report file symbolic links as files.
Subject: ntdll: Correctly report file symbolic links as files.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 110 +++++++++++++++++++++++++++++++++---------------
dlls/ntdll/tests/file.c | 8 ++--
dlls/ntdll/file.c | 110 +++++++++++++++++++++++++++-------------
dlls/ntdll/tests/file.c | 8 +--
2 files changed, 79 insertions(+), 39 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 4e5bf46..6cb351b 100644
index a9fe846e08..8ffd79ccbf 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -140,6 +140,9 @@ static inline int get_file_xattr( char *hexattr, int attrlen )
return 0;
}
@@ -124,6 +124,9 @@ mode_t FILE_umask = 0;
static const WCHAR ntfsW[] = {'N','T','F','S'};
+NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, USHORT *unix_dest_len,
+ DWORD *tag, ULONG *flags, BOOL *is_dir);
@@ -23,7 +23,7 @@ index 4e5bf46..6cb351b 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
@@ -214,10 +217,14 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -160,10 +163,14 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
if (ret == -1) return ret;
if (S_ISLNK( st->st_mode ))
{
@@ -37,8 +37,8 @@ index 4e5bf46..6cb351b 100644
+ st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG);
}
*attr |= get_file_attributes( st );
/* retrieve any stored DOS attributes */
@@ -1920,48 +1927,34 @@ cleanup:
return ret;
@@ -1822,48 +1829,34 @@ cleanup:
}
@@ -102,7 +102,7 @@ index 4e5bf46..6cb351b 100644
p++;
}
if (*p++ != '/')
@@ -1969,7 +1962,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1871,7 +1864,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@@ -111,7 +111,7 @@ index 4e5bf46..6cb351b 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
char c = *p++;
@@ -1984,21 +1977,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1886,21 +1879,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@@ -186,10 +186,10 @@ index 4e5bf46..6cb351b 100644
/* convert the relative path into an absolute path */
if (flags == SYMLINK_FLAG_RELATIVE)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 3f47c69..cecce37 100644
index f40dc1f51b..f23bf8644c 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5288,13 +5288,13 @@ static void test_reparse_points(void)
@@ -5069,13 +5069,13 @@ static void test_reparse_points(void)
/* Check deleting a file symlink as if it were a directory */
bret = RemoveDirectoryW(reparse_path);
@@ -205,7 +205,7 @@ index 3f47c69..cecce37 100644
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: 0x%x)\n", dwret);
/* Delete the symlink as a file */
@@ -5303,10 +5303,10 @@ static void test_reparse_points(void)
@@ -5084,10 +5084,10 @@ static void test_reparse_points(void)
/* Create a blank slate for directory symlink tests */
bret = CreateDirectoryW(reparse_path, NULL);
@@ -219,5 +219,5 @@ index 3f47c69..cecce37 100644
/* Create the directory symlink */
HeapFree(GetProcessHeap(), 0, buffer);
--
1.9.1
2.17.1

View File

@@ -1,4 +1,4 @@
From e57c2a438bf63fcab5686c8c7dbd4379dda1a49b Mon Sep 17 00:00:00 2001
From 447ceb46b34604f8c72014b8516851e81850b4de Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 12:01:50 -0600
Subject: kernel32: Set error code when attempting to delete file symlinks as

View File

@@ -1,19 +1,19 @@
From 108acd429c44d9a06bab68ad66890ee6756264cc Mon Sep 17 00:00:00 2001
From d6f127ccdc6bb2a2c74551bfae669a6eee55c312 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 13:41:07 -0600
Subject: [PATCH] server: Properly handle file symlink deletion.
Subject: server: Properly handle file symlink deletion.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 6 ++---
server/fd.c | 64 +++++++++++++++++++++++++++++++++++++++++++++----
dlls/ntdll/tests/file.c | 6 ++--
server/fd.c | 64 +++++++++++++++++++++++++++++++++++++----
2 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 8800ab0..92ac697 100644
index a1323ab4f6..8ab8a5da53 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5299,14 +5299,14 @@ static void test_reparse_points(void)
@@ -5080,14 +5080,14 @@ static void test_reparse_points(void)
/* Delete the symlink as a file */
bret = DeleteFileW(reparse_path);
@@ -32,10 +32,10 @@ index 8800ab0..92ac697 100644
/* Create the directory symlink */
HeapFree(GetProcessHeap(), 0, buffer);
diff --git a/server/fd.c b/server/fd.c
index 6c4cf61..58843d7 100644
index 5d80e218b9..71347e4318 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1075,7 +1075,7 @@ static void inode_destroy( struct object *obj )
@@ -1069,7 +1069,7 @@ static void inode_destroy( struct object *obj )
{
/* make sure it is still the same file */
struct stat st;
@@ -44,7 +44,7 @@ index 6c4cf61..58843d7 100644
{
if (S_ISDIR(st.st_mode)) rmdir( fd->unix_name );
else unlink( fd->unix_name );
@@ -1769,6 +1769,53 @@ char *dup_fd_name( struct fd *root, const char *name )
@@ -1747,6 +1747,53 @@ char *dup_fd_name( struct fd *root, const char *name )
return ret;
}
@@ -98,12 +98,12 @@ index 6c4cf61..58843d7 100644
/* open() wrapper that returns a struct fd with no fd user set */
struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, unsigned int access,
unsigned int sharing, unsigned int options )
@@ -1876,14 +1923,15 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1826,14 +1873,15 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
closed_fd->unix_fd = fd->unix_fd;
closed_fd->unlink = 0;
closed_fd->unix_name = fd->unix_name;
if (do_chmod) chmod( name, *mode );
- fstat( fd->unix_fd, &st );
+ fstatat( -1, fd->unix_name, &st, AT_SYMLINK_NOFOLLOW );
+ lstat( fd->unix_name, &st );
*mode = st.st_mode;
/* only bother with an inode for normal files and directories */
@@ -116,7 +116,7 @@ index 6c4cf61..58843d7 100644
if (!inode)
{
@@ -1898,13 +1946,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1848,13 +1896,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
list_add_head( &inode->open, &fd->inode_entry );
closed_fd = NULL;
@@ -139,5 +139,5 @@ index 6c4cf61..58843d7 100644
set_error( STATUS_FILE_IS_A_DIRECTORY );
goto error;
--
1.9.1
2.17.1

View File

@@ -1,4 +1,4 @@
From 0a6af701fbda3b10b709a33f811788d24552cb5f Mon Sep 17 00:00:00 2001
From a4a9f0c9c9b4453a46d5060d0ec32b8f49cf19a1 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 13 Mar 2019 16:02:05 -0600
Subject: kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse

View File

@@ -1,2 +1,2 @@
Fixes: [12401] Support for Junction Points
Depends: ntdll-NtQueryEaFile
#Depends: ntdll-NtQueryEaFile