Updated tdll-Junction_Points patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-05-30 11:14:16 +10:00
parent 8725e273cc
commit cd1862609a
22 changed files with 154 additions and 265 deletions

View File

@ -1,22 +1,22 @@
From 347997c4118fa01fbf87cf7cadb6ba04a83a97c4 Mon Sep 17 00:00:00 2001
From 9dc5bc2dda6026276cc44db68f51dcba2394a6de Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 00:08:52 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in
NtSetInformationFile.
---
dlls/ntdll/file.c | 54 +++++++++++++++++++++++++++++++------------------
dlls/ntdll/tests/file.c | 8 ++++----
dlls/ntdll/file.c | 54 ++++++++++++++++++++++++++---------------
dlls/ntdll/tests/file.c | 8 +++---
include/wine/port.h | 2 ++
libs/port/xattr.c | 20 ++++++++++++++++++
libs/port/xattr.c | 20 +++++++++++++++
4 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 6743d37..12d47ae 100644
index bdc3faacac7..d968f06b02d 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -157,6 +157,39 @@ static inline ULONG get_file_attributes( const struct stat *st )
return attr;
@@ -169,6 +169,39 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr )
return ret;
}
+/* set the stat info and file attributes for a file (by file descriptor) */
@ -55,7 +55,7 @@ index 6743d37..12d47ae 100644
/* get the stat info and file attributes for a file (by name) */
int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
@@ -3097,7 +3130,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
@@ -3062,7 +3095,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
case FileBasicInformation:
if (len >= sizeof(FILE_BASIC_INFORMATION))
{
@ -63,7 +63,7 @@ index 6743d37..12d47ae 100644
const FILE_BASIC_INFORMATION *info = ptr;
if ((io->u.Status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
@@ -3107,25 +3139,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
@@ -3072,25 +3104,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
io->u.Status = set_file_times( fd, &info->LastWriteTime, &info->LastAccessTime );
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
@ -91,7 +91,7 @@ index 6743d37..12d47ae 100644
if (needs_close) close( fd );
}
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index d0646aa..39f9013 100644
index 8336bba8739..ce1d763c121 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1341,7 +1341,7 @@ static void test_file_basic_information(void)
@ -131,7 +131,7 @@ index d0646aa..39f9013 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
diff --git a/include/wine/port.h b/include/wine/port.h
index de6b995..c075958 100644
index de6b9955ecc..c0759584131 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -351,6 +351,8 @@ extern int mkstemps(char *template, int suffix_len);
@ -144,7 +144,7 @@ index de6b995..c075958 100644
/* Interlocked functions */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 88e900d..6918c99 100644
index 88e900dac6d..6918c9956cc 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -38,6 +38,26 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
@ -175,5 +175,5 @@ index 88e900d..6918c99 100644
{
#if defined(HAVE_ATTR_XATTR_H)
--
1.9.1
2.17.1

View File

@ -1,4 +1,4 @@
From 589bbdea7af00507d3dce26feec1c6db1d8e9746 Mon Sep 17 00:00:00 2001
From 71e4fd5717018ba31e37382a0d5eb67cd4b6d5d0 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: ntdll: Add support for junction point creation.
@ -18,10 +18,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
create mode 100644 libs/port/renameat2.c
diff --git a/configure.ac b/configure.ac
index 0ad8417735..39a9571a95 100644
index ef7af7021a..6453cf2697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2206,6 +2206,8 @@ AC_CHECK_FUNCS(\
@@ -2119,6 +2119,8 @@ AC_CHECK_FUNCS(\
pwrite \
readdir \
readlink \
@ -31,7 +31,7 @@ index 0ad8417735..39a9571a95 100644
select \
setproctitle \
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 3dafdcfb44..c0992ea657 100644
index 1cbaa1b293..693caecffa 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -21,6 +21,7 @@
@ -50,7 +50,7 @@ index 3dafdcfb44..c0992ea657 100644
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -1648,6 +1650,104 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -1639,6 +1641,104 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
}
@ -155,7 +155,7 @@ index 3dafdcfb44..c0992ea657 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1732,6 +1832,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1723,6 +1823,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
io->Information = 0;
status = STATUS_SUCCESS;
break;

View File

@ -1,4 +1,4 @@
From 56730d38b6326cee609916af394a37d4559d249e Mon Sep 17 00:00:00 2001
From 102451499f5de1148d55df7c7bdfe91257a13cef 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.
@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index c0992ea657..e0984b4567 100644
index 693caecffa..b9087cbf4d 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1748,6 +1748,106 @@ cleanup:
@@ -1739,6 +1739,106 @@ cleanup:
}
@ -120,7 +120,7 @@ index c0992ea657..e0984b4567 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1833,6 +1933,12 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1824,6 +1924,12 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
status = STATUS_SUCCESS;
break;

View File

@ -1,4 +1,4 @@
From 424814c370108dcad48290dc203adff96672dea9 Mon Sep 17 00:00:00 2001
From b544a9cd5b1d8abe456125652e1a78b20bdc4a27 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.
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index e0984b4567..54768695b3 100644
index b9087cbf4d..dbbb54768b 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1848,6 +1848,87 @@ cleanup:
@@ -1839,6 +1839,87 @@ cleanup:
}
@ -102,7 +102,7 @@ index e0984b4567..54768695b3 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1933,6 +2014,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1924,6 +2005,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
status = STATUS_SUCCESS;
break;

View File

@ -1,4 +1,4 @@
From 3e60e844c4ce938fb12ff09d561967a75e110f82 Mon Sep 17 00:00:00 2001
From c86d6453694ed2723e5eaa1c55f9e53e1b9946d8 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 f0ac5c57f3a0c2ddb542ed1cc1e78513ad4a60fe Mon Sep 17 00:00:00 2001
From 641f298192f9c21e2e02f0e5296771454d3467d3 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
@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index b8f49bd597..76a9512c77 100644
index 5fed28da0e..5ef66b5913 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1696,6 +1696,7 @@ BOOL WINAPI CreateDirectoryExW( LPCWSTR template, LPCWSTR path, LPSECURITY_ATTRI

View File

@ -1,4 +1,4 @@
From 944851b4f7cda627c3c35a6735f14121b87d0148 Mon Sep 17 00:00:00 2001
From 5028b688bbe434ce83811da8251d920c7e2dba8a 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,20 +1,20 @@
From 7183c92e5f02346e8d72432a602fb7dfc3659a5b Mon Sep 17 00:00:00 2001
From 5706d02d2bb68f87d4687f8acef96dd59978b6f8 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.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 35 +++++++++++--
dlls/ntdll/tests/file.c | 109 +++++++++++++++++++++++++++++++++++-----
dlls/ntdll/file.c | 35 ++++++++++--
dlls/ntdll/tests/file.c | 117 ++++++++++++++++++++++++++++++++++------
include/ntifs.h | 10 ++++
3 files changed, 139 insertions(+), 15 deletions(-)
3 files changed, 143 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 54768695b3..18630c12c9 100644
index dbbb54768b..62941774ec 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1657,17 +1657,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -1648,17 +1648,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
BOOL src_allocated = FALSE, dest_allocated = FALSE, tempdir_created = FALSE;
@ -51,7 +51,7 @@ index 54768695b3..18630c12c9 100644
if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
@@ -1691,6 +1707,18 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1682,6 +1698,18 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@ -70,7 +70,7 @@ index 54768695b3..18630c12c9 100644
strcat( magic_dest, unix_dest.Buffer );
/* Produce the link in a temporary location in the same folder */
@@ -2043,6 +2071,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -2034,6 +2062,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:
@ -79,7 +79,7 @@ index 54768695b3..18630c12c9 100644
break;
default:
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 71e7dd56f3..bdac50cbd6 100644
index 71e7dd56f3..05ba0fc57e 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4832,26 +4832,50 @@ static void test_file_readonly_access(void)
@ -182,7 +182,7 @@ index 71e7dd56f3..bdac50cbd6 100644
bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
ok(bret, "Failed to create junction point! (0x%x)\n", GetLastError());
CloseHandle(handle);
@@ -4990,6 +5016,65 @@ static void test_reparse_points(void)
@@ -4990,14 +5016,73 @@ static void test_reparse_points(void)
ok(dwret != (DWORD)~0, "Junction point doesn't exist (attributes: 0x%x)!\n", dwret);
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a junction point! (attributes: 0x%x)\n", dwret);
@ -248,6 +248,18 @@ index 71e7dd56f3..bdac50cbd6 100644
cleanup:
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
HeapFree(GetProcessHeap(), 0, buffer);
- bret = RemoveDirectoryW(reparse_path);
- ok(bret, "Failed to remove temporary reparse point directory!\n");
- bret = RemoveDirectoryW(target_path);
- ok(bret, "Failed to remove temporary target directory!\n");
+ RemoveDirectoryW(reparse_path);
+ DeleteFileW(reparse_path);
+ RemoveDirectoryW(target_path);
+ DeleteFileW(target_path);
RemoveDirectoryW(path);
}
diff --git a/include/ntifs.h b/include/ntifs.h
index 4539b89d58..ab3273d3f8 100644
--- a/include/ntifs.h

View File

@ -1,4 +1,4 @@
From d3129f74304e5fa5ba33eb51bd4ef1e9bfce1b8f Mon Sep 17 00:00:00 2001
From b4c166f821e7254737bf0920c3f0ea62e0646846 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,10 +10,10 @@ 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 18630c12c9..80d3e9b089 100644
index 62941774ec..84da022325 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1789,6 +1789,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1780,6 +1780,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
UNICODE_STRING nt_dest;
DWORD max_length;
NTSTATUS status;
@ -21,7 +21,7 @@ index 18630c12c9..80d3e9b089 100644
INT prefix_len;
ssize_t ret;
char *p;
@@ -1835,6 +1836,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1826,6 +1827,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
}
buffer->ReparseTag |= (val << i);
}
@ -39,7 +39,7 @@ index 18630c12c9..80d3e9b089 100644
unix_dest.Length -= (p - unix_dest.Buffer);
memmove(unix_dest.Buffer, p, unix_dest.Length);
@@ -1853,6 +1865,16 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1844,6 +1856,16 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
buffer->MountPointReparseBuffer.PrintNameLength = nt_dest.Length - prefix_len*sizeof(WCHAR);
print_name = &buffer->MountPointReparseBuffer.PathBuffer[buffer->MountPointReparseBuffer.PrintNameOffset/sizeof(WCHAR)];
break;
@ -57,7 +57,7 @@ index 18630c12c9..80d3e9b089 100644
/* unrecognized (regular) files should probably be treated as symlinks */
WARN("unrecognized symbolic link\n");
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index bdac50cbd6..ef69d12f6c 100644
index 05ba0fc57e..526bd8a85a 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5067,7 +5067,6 @@ static void test_reparse_points(void)

View File

@ -1,4 +1,4 @@
From 9bc86ef7b245595248c0f5b157c9a57f4ce0c8aa Mon Sep 17 00:00:00 2001
From 2ee26355e8261f4065b3e5e933a81ce0bfd1a1c6 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 80d3e9b089..60affd59a2 100644
index 84da022325..c3e171ab19 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2071,6 +2071,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -2062,6 +2062,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:
@ -22,7 +22,7 @@ index 80d3e9b089..60affd59a2 100644
break;
default:
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index ef69d12f6c..de06e625d6 100644
index 526bd8a85a..f0545feb5c 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5084,6 +5084,22 @@ static void test_reparse_points(void)

View File

@ -1,4 +1,4 @@
From 0879c8d8575ba4ff1b7e9f408679c4fb92468f62 Mon Sep 17 00:00:00 2001
From dcdb22da6bc6ad1c771aab007dd098ce180cdd11 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,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 77 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 60affd59a2..8487bb5158 100644
index c3e171ab19..603bbdc306 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1656,16 +1656,19 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -1647,16 +1647,19 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
*/
NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
@ -36,7 +36,7 @@ index 60affd59a2..8487bb5158 100644
int i;
switch(buffer->ReparseTag)
@@ -1674,11 +1677,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1665,11 +1668,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
dest_len = buffer->MountPointReparseBuffer.SubstituteNameLength;
offset = buffer->MountPointReparseBuffer.SubstituteNameOffset;
dest = &buffer->MountPointReparseBuffer.PathBuffer[offset];
@ -50,7 +50,7 @@ index 60affd59a2..8487bb5158 100644
break;
default:
return STATUS_NOT_IMPLEMENTED;
@@ -1690,17 +1695,54 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1681,17 +1686,54 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if ((status = server_get_unix_name( handle, &unix_src )))
goto cleanup;
src_allocated = TRUE;
@ -109,7 +109,7 @@ index 60affd59a2..8487bb5158 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
if ((buffer->ReparseTag >> i) & 1)
@@ -1719,7 +1761,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1710,7 +1752,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@ -118,7 +118,7 @@ index 60affd59a2..8487bb5158 100644
/* Produce the link in a temporary location in the same folder */
strcpy( tmpdir, unix_src.Buffer );
@@ -1769,7 +1811,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1760,7 +1802,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
cleanup:
if (tempdir_created) rmdir( tmpdir );
@ -129,7 +129,7 @@ index 60affd59a2..8487bb5158 100644
if (needs_close) close( dest_fd );
return status;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index de06e625d6..4a6a28e879 100644
index f0545feb5c..889f130789 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4832,7 +4832,8 @@ static void test_file_readonly_access(void)

View File

@ -1,4 +1,4 @@
From 7c02ce3203b8796455d12423b960b720e90a9639 Mon Sep 17 00:00:00 2001
From ab0e87ab1439fae74ec38aecabd417602b7b61db 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,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 8487bb5158..5df2d8c3fa 100644
index 603bbdc306..7af9c6635a 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1831,6 +1831,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1822,6 +1822,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
BOOL dest_allocated = FALSE;
int dest_fd, needs_close;
UNICODE_STRING nt_dest;
@ -21,7 +21,7 @@ index 8487bb5158..5df2d8c3fa 100644
DWORD max_length;
NTSTATUS status;
ULONG flags = 0;
@@ -1858,6 +1859,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1849,6 +1850,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
/* Decode the reparse tag from the symlink */
p = unix_dest.Buffer;
@ -33,7 +33,7 @@ index 8487bb5158..5df2d8c3fa 100644
if (*p++ != '/')
{
status = STATUS_NOT_IMPLEMENTED;
@@ -1894,10 +1900,46 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1885,10 +1891,46 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
unix_dest.Length -= (p - unix_dest.Buffer);
memmove(unix_dest.Buffer, p, unix_dest.Length);
@ -82,7 +82,7 @@ index 8487bb5158..5df2d8c3fa 100644
{
case IO_REPARSE_TAG_MOUNT_POINT:
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 4a6a28e879..c13ee84bf0 100644
index 889f130789..a17e792ae0 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5117,9 +5117,20 @@ static void test_reparse_points(void)

View File

@ -1,4 +1,4 @@
From ac69cecc3f024819efae83723b77d9f310b43251 Mon Sep 17 00:00:00 2001
From 824e8fa59621da5b509297d25a95cad8d4562e68 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.
@ -6,14 +6,14 @@ Subject: ntdll: Add support for file symlinks.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 27 ++++++++++++++++++++++-----
dlls/ntdll/tests/file.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 5 deletions(-)
dlls/ntdll/tests/file.c | 29 +++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 5df2d8c3fa..03a07d46cd 100644
index 7af9c6635a..2f10472eeb 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1665,6 +1665,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1656,6 +1656,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
int relative_offset = 0;
UNICODE_STRING nt_dest;
int dest_len, offset;
@ -21,7 +21,7 @@ index 5df2d8c3fa..03a07d46cd 100644
NTSTATUS status;
struct stat st;
WCHAR *dest;
@@ -1757,7 +1758,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1748,7 +1749,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
status = FILE_GetNtStatus();
goto cleanup;
}
@ -31,7 +31,7 @@ index 5df2d8c3fa..03a07d46cd 100644
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@@ -1784,8 +1786,11 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1775,8 +1777,11 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
/* Atomically move the link into position */
if (!renameat2( -1, tmplink, -1, unix_src.Buffer, RENAME_EXCHANGE ))
{
@ -45,7 +45,7 @@ index 5df2d8c3fa..03a07d46cd 100644
}
else if (errno == ENOSYS)
{
@@ -1994,6 +1999,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -1985,6 +1990,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
BOOL tempdir_created = FALSE;
int dest_fd, needs_close;
ANSI_STRING unix_name;
@ -53,7 +53,7 @@ index 5df2d8c3fa..03a07d46cd 100644
NTSTATUS status;
struct stat st;
@@ -2005,12 +2011,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -1996,12 +2002,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
TRACE("Deleting symlink %s\n", unix_name.Buffer);
@ -68,7 +68,7 @@ index 5df2d8c3fa..03a07d46cd 100644
strcpy( tmpdir, unix_name.Buffer );
d = dirname( tmpdir);
if (d != tmpdir) strcpy( tmpdir, d );
@@ -2023,11 +2030,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -2014,11 +2021,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
tempdir_created = TRUE;
strcpy( tmpfile, tmpdir );
strcat( tmpfile, "/tmpfile" );
@ -92,10 +92,10 @@ index 5df2d8c3fa..03a07d46cd 100644
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..5bf8ebf704 100644
index a17e792ae0..b904bc1f2d 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5050,6 +5050,39 @@ static void test_reparse_points(void)
@@ -5050,6 +5050,35 @@ static void test_reparse_points(void)
/* Delete the junction point directory and create a blank slate for symlink tests */
bret = RemoveDirectoryW(reparse_path);
ok(bret, "Failed to delete junction point!\n");
@ -104,11 +104,7 @@ index c13ee84bf0..5bf8ebf704 100644
+ HeapFree(GetProcessHeap(), 0, buffer);
+ handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
+ if (handle == INVALID_HANDLE_VALUE)
+ {
+ win_skip("Failed to open symlink file handle (0x%x).\n", GetLastError());
+ goto cleanup;
+ }
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to create symlink file.\n");
+ dwret = NtQueryInformationFile(handle, &iosb, &old_attrib, sizeof(old_attrib), FileBasicInformation);
+ ok(dwret == STATUS_SUCCESS, "Failed to get symlink file's attributes (0x%x).\n", dwret);
+ buffer_len = build_reparse_buffer(nameW.Buffer, IO_REPARSE_TAG_SYMLINK, 0, &buffer);

View File

@ -1,4 +1,4 @@
From 1cb09e87cf0fd0a805849f3483d2b3b7bed5ec18 Mon Sep 17 00:00:00 2001
From d17d5121c6447d08981c47955979ed39871f4489 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 30 Apr 2019 16:24:54 -0600
Subject: ntdll: Allow creation of dangling reparse points to non-existent
@ -37,10 +37,10 @@ index bbdbbe9781..cca1e3c4a8 100644
if (status != STATUS_SUCCESS) break;
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 03a07d46cd..04d34dd572 100644
index 2f10472eeb..3e1121e521 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1722,8 +1722,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -1713,8 +1713,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
RtlCreateUnicodeString( &nt_dest, dest );
nt_dest.Length = dest_len;
}
@ -52,7 +52,7 @@ index 03a07d46cd..04d34dd572 100644
goto cleanup;
dest_allocated = TRUE;
diff --git a/include/winternl.h b/include/winternl.h
index 2b3fb947b9..7f6b2f57ba 100644
index e7f89b0059..168c471696 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1788,6 +1788,7 @@ typedef struct _RTL_HANDLE_TABLE

View File

@ -1,4 +1,4 @@
From 9a808d848f2a57140822c31047ce882c75d74b99 Mon Sep 17 00:00:00 2001
From 916221d26598c06a07e84d980ae4c16e92b38ebd 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: ntdll: Correctly report file symbolic links as files.
@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 84 insertions(+), 44 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 04d34dd572..57d7d334d5 100644
index 3e1121e521..be594ea517 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -124,6 +124,9 @@ mode_t FILE_umask = 0;
@ -43,7 +43,7 @@ index 04d34dd572..57d7d334d5 100644
}
*attr |= get_file_attributes( st );
return ret;
@@ -1826,48 +1834,33 @@ cleanup:
@@ -1817,48 +1825,33 @@ cleanup:
}
@ -107,7 +107,7 @@ index 04d34dd572..57d7d334d5 100644
p++;
}
if (*p++ != '/')
@@ -1875,7 +1868,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1866,7 +1859,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@ -116,7 +116,7 @@ index 04d34dd572..57d7d334d5 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
char c = *p++;
@@ -1890,21 +1883,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -1881,21 +1874,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@ -191,10 +191,10 @@ index 04d34dd572..57d7d334d5 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 5bf8ebf704..bacfad266e 100644
index b904bc1f2d..fbd824fd10 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5069,13 +5069,13 @@ static void test_reparse_points(void)
@@ -5065,13 +5065,13 @@ static void test_reparse_points(void)
/* Check deleting a file symlink as if it were a directory */
bret = RemoveDirectoryW(reparse_path);
@ -210,7 +210,7 @@ index 5bf8ebf704..bacfad266e 100644
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: 0x%x)\n", dwret);
/* Delete the symlink as a file */
@@ -5084,10 +5084,10 @@ static void test_reparse_points(void)
@@ -5080,10 +5080,10 @@ static void test_reparse_points(void)
/* Create a blank slate for directory symlink tests */
bret = CreateDirectoryW(reparse_path, NULL);

View File

@ -1,4 +1,4 @@
From 417a71fe5c16121c85bf59c13f610ebcdf701508 Mon Sep 17 00:00:00 2001
From 95288f8fe17bf7c8f772c863fe49a85c117a71eb 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
@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 76a9512c77..f15b6dd68b 100644
index 5ef66b5913..227473f71a 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1738,7 +1738,10 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
@ -27,10 +27,10 @@ index 76a9512c77..f15b6dd68b 100644
}
else
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index bacfad266e..2f5ee0618c 100644
index fbd824fd10..0041a41b6d 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5071,9 +5071,9 @@ static void test_reparse_points(void)
@@ -5067,9 +5067,9 @@ static void test_reparse_points(void)
bret = RemoveDirectoryW(reparse_path);
ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
err = GetLastError();

View File

@ -1,137 +0,0 @@
From 4f8611e2dfc7fb70e13a6f05949257e5d441328a Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 1 May 2019 19:46:03 -0600
Subject: ntdll: Correctly report fd-based file info for symlinks.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 64 ++++++++++++++++++++++++++++++++++-------------
1 file changed, 46 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 8336392ddb..934577bfba 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -141,18 +141,6 @@ static inline ULONG get_file_attributes( const struct stat *st )
return attr;
}
-/* get the stat info and file attributes for a file (by file descriptor) */
-int fd_get_file_info( int fd, struct stat *st, ULONG *attr )
-{
- int ret;
-
- *attr = 0;
- ret = fstat( fd, st );
- if (ret == -1) return ret;
- *attr |= get_file_attributes( st );
- return ret;
-}
-
/* get the stat info and file attributes for a file (by name) */
int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
@@ -175,6 +163,46 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
return ret;
}
+/* get the stat info and file attributes for a file (by file descriptor) */
+int fd_get_file_info( HANDLE h, int fd, struct stat *st, ULONG *attr )
+{
+ ANSI_STRING unix_src;
+ struct stat tmp;
+ int ret = -1;
+
+ /* if this handle is to a symlink then we need to return information about the symlink */
+ if (server_get_unix_name( h, &unix_src ) != STATUS_SUCCESS)
+ return ret;
+ ret = get_file_info( unix_src.Buffer, st, attr);
+ RtlFreeAnsiString( &unix_src );
+ if (ret == -1) return ret;
+ /* but return the times from the file itself */
+ ret = fstat( fd, &tmp );
+ if (ret == -1) return ret;
+#if defined(HAVE_STRUCT_STAT_ST_ATIM)
+ st->st_atim = tmp.st_atim;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
+ st->st_atimespec = tmp.st_atimespec;
+#else
+ st->st_atime = tmp.st_atime;
+#endif
+#if defined(HAVE_STRUCT_STAT_ST_MTIM)
+ st->st_mtim = tmp.st_mtim;
+#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
+ st->st_mtimespec = tmp.st_mtimespec;
+#else
+ st->st_mtime = tmp.st_mtime;
+#endif
+#if defined(HAVE_STRUCT_STAT_ST_CTIM)
+ st->st_ctim = tmp.st_ctim;
+#elif defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
+ st->st_ctimespec = tmp.st_ctimespec;
+#else
+ st->st_ctime = tmp.st_ctime;
+#endif
+ return ret;
+}
+
/**************************************************************************
* FILE_CreateFile (internal)
* Open a file.
@@ -2832,7 +2860,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
switch (class)
{
case FileBasicInformation:
- if (fd_get_file_info( fd, &st, &attr ) == -1)
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1)
io->u.Status = FILE_GetNtStatus();
else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
io->u.Status = STATUS_INVALID_INFO_CLASS;
@@ -2843,7 +2871,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
{
FILE_STANDARD_INFORMATION *info = ptr;
- if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
else
{
fill_file_info( &st, attr, info, class );
@@ -2860,7 +2888,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
}
break;
case FileInternalInformation:
- if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
else fill_file_info( &st, attr, ptr, class );
break;
case FileEaInformation:
@@ -2870,7 +2898,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
}
break;
case FileEndOfFileInformation:
- if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
else fill_file_info( &st, attr, ptr, class );
break;
case FileAllInformation:
@@ -2878,7 +2906,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
FILE_ALL_INFORMATION *info = ptr;
ANSI_STRING unix_name;
- if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
io->u.Status = STATUS_INVALID_INFO_CLASS;
else if (!(io->u.Status = server_get_unix_name( hFile, &unix_name )))
@@ -2986,7 +3014,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
}
break;
case FileIdInformation:
- if (fd_get_file_info( fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
+ if (fd_get_file_info( hFile, fd, &st, &attr ) == -1) io->u.Status = FILE_GetNtStatus();
else
{
FILE_ID_INFORMATION *info = ptr;
--
2.17.1

View File

@ -1,4 +1,4 @@
From 356b2d92b5690c529408a99ac81d9c47d495a39b Mon Sep 17 00:00:00 2001
From 460d07ee2cd46fb8c291b6a7ad0405b017370520 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: server: Properly handle file symlink deletion.
@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 74 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 2f5ee0618c..5f42ad5e0b 100644
index 0041a41b6d..f2c273e901 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5080,14 +5080,14 @@ static void test_reparse_points(void)
@@ -5076,14 +5076,14 @@ static void test_reparse_points(void)
/* Delete the symlink as a file */
bret = DeleteFileW(reparse_path);

View File

@ -1,19 +1,19 @@
From 7e42a251daf77f13b3299d5955879161128a4065 Mon Sep 17 00:00:00 2001
From 4df537eadbf20772213e02eb65d51fc1c016981e 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: [PATCH] ntdll: Always report symbolic links as containing zero bytes.
Subject: ntdll: Always report symbolic links as containing zero bytes.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/file.c | 2 ++
dlls/ntdll/tests/file.c | 27 +++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
dlls/ntdll/tests/file.c | 46 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 5390c4b..7481864 100644
index be594ea517..6bb45f34f3 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -155,6 +155,8 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -167,6 +167,8 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
/* return information about the destination (unless this is a dangling symlink) */
stat( path, st );
@ -23,18 +23,20 @@ index 5390c4b..7481864 100644
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
/* whether a reparse point is a file or a directory is stored inside the link target */
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 5f42ad5..36c021a 100644
index f2c273e901..d776d12329 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4897,6 +4897,7 @@ static void test_reparse_points(void)
@@ -4896,7 +4896,9 @@ static void test_reparse_points(void)
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
DWORD dwret, dwLen, dwFlags, err;
+ WIN32_FILE_ATTRIBUTE_DATA fad;
INT buffer_len, string_len;
+ WCHAR buf[] = {0,0,0,0};
HANDLE handle, token;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5024,8 +5025,6 @@ static void test_reparse_points(void)
@@ -5024,8 +5026,6 @@ static void test_reparse_points(void)
"Unexpected junction point attributes (0x%x != 0x410)!\n", dwret);
bret = RemoveDirectoryW(target_path);
ok(bret, "Failed to delete junction point target!\n");
@ -43,13 +45,13 @@ index 5f42ad5..36c021a 100644
/* Establish permissions for symlink creation */
bret = OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token);
@@ -5050,6 +5049,13 @@ static void test_reparse_points(void)
@@ -5050,6 +5050,13 @@ static void test_reparse_points(void)
/* Delete the junction point directory and create a blank slate for symlink tests */
bret = RemoveDirectoryW(reparse_path);
ok(bret, "Failed to delete junction point!\n");
+ handle = CreateFileW(target_path, GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, 0, 0);
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to create symlink target file.\n");
+ bret = WriteFile(handle, fooW, sizeof(fooW), NULL, NULL);
+ bret = WriteFile(handle, fooW, sizeof(fooW), &dwLen, NULL);
+ ok(bret, "Failed to write data to the symlink target file.\n");
+ ok(GetFileSize(handle, NULL) == sizeof(fooW), "target size is incorrect (%d vs %d)\n",
+ GetFileSize(handle, NULL), sizeof(fooW));
@ -57,15 +59,33 @@ index 5f42ad5..36c021a 100644
/* Create the file symlink */
HeapFree(GetProcessHeap(), 0, buffer);
@@ -5067,6 +5073,19 @@ static void test_reparse_points(void)
@@ -5063,6 +5070,37 @@ static void test_reparse_points(void)
ok(bret, "Failed to create symlink! (0x%x)\n", GetLastError());
CloseHandle(handle);
+ /* Check the size of the symlink */
+ bret = GetFileAttributesExW(reparse_path, GetFileExInfoStandard, &fad);
+ ok(bret, "Failed to read file attributes from the symlink target.\n");
+ ok(fad.nFileSizeLow == 0 && fad.nFileSizeHigh == 0, "Size of symlink is not zero.\n");
+ handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to open symlink file.\n");
+ ok(GetFileSize(handle, NULL) == 0, "symlink size is not zero\n");
+ todo_wine ok(GetFileSize(handle, NULL) == 0, "symlink size is not zero\n");
+ bret = ReadFile(handle, &buf, sizeof(buf), &dwLen, NULL);
+ ok(bret, "Failed to read data from the symlink.\n");
+ todo_wine ok(dwLen == 0, "Length of symlink data is not zero.\n");
+ CloseHandle(handle);
+
+ /* Check the size/data of the symlink target */
+ handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, 0);
+ if (handle == INVALID_HANDLE_VALUE)
+ {
+ win_skip("Failed to open symlink file handle (0x%x).\n", GetLastError());
+ goto cleanup;
+ }
+ ok(GetFileSize(handle, NULL) == sizeof(fooW), "symlink target size does not match (%d != %d)\n",
+ GetFileSize(handle, NULL), sizeof(fooW));
+ bret = ReadFile(handle, &buf, sizeof(buf), &dwLen, NULL);
+ ok(bret, "Failed to read data from the symlink.\n");
+ ok(dwLen == sizeof(fooW), "Length of symlink target data does not match (%d != %d).\n",
@ -77,7 +97,7 @@ index 5f42ad5..36c021a 100644
/* Check deleting a file symlink as if it were a directory */
bret = RemoveDirectoryW(reparse_path);
ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
@@ -5088,6 +5107,10 @@ static void test_reparse_points(void)
@@ -5084,6 +5122,10 @@ static void test_reparse_points(void)
dwret = GetFileAttributesW(reparse_path);
ok(dwret != (DWORD)~0, "Path doesn't exist (attributes: 0x%x)!\n", dwret);
ok(!(dwret & FILE_ATTRIBUTE_REPARSE_POINT), "File is already a reparse point! (attributes: %d)\n", dwret);
@ -89,5 +109,5 @@ index 5f42ad5..36c021a 100644
/* Create the directory symlink */
HeapFree(GetProcessHeap(), 0, buffer);
--
1.9.1
2.17.1

View File

@ -1,4 +1,4 @@
From e573ccae4f2584e7f7c040f1c1f986d1e7ebdc6e Mon Sep 17 00:00:00 2001
From 434c51a02c8a17e9b6ca91ccce8f192572823d45 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 1 May 2019 17:48:51 -0600
Subject: ntdll: Find dangling symlinks quickly.

View File

@ -1,4 +1,4 @@
From 3b19992c3906902dfb452360c0e0b22d31ab0a6e Mon Sep 17 00:00:00 2001
From f8bce6f4c951b6d5b1b3473b272a3fe20df0aa39 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
@ -13,7 +13,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
4 files changed, 275 insertions(+), 81 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index f15b6dd68b..71661ad540 100644
index 227473f71a..fd69cdede4 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -34,6 +34,8 @@
@ -162,7 +162,7 @@ index f15b6dd68b..71661ad540 100644
/*************************************************************************
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 8f5508355b..6664ca7d3f 100644
index f15cc09ee5..346591990f 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -81,6 +81,9 @@ static void (WINAPI *pReleaseActCtx)(HANDLE);

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "6d05fae6f7ebab83a2f1c6621d9619bbe91833fd"
echo "d535df42f665a097ec721b10fb49d7b18f899be9"
}
# Show version information
@ -3300,12 +3300,11 @@ if test "$enable_ntdll_Junction_Points" -eq 1; then
patch_apply ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch
patch_apply ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch
patch_apply ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch
patch_apply ntdll-Junction_Points/0015-ntdll-Correctly-report-fd-based-file-info-for-symlin.patch
patch_apply ntdll-Junction_Points/0016-kernel32-Set-error-code-when-attempting-to-delete-fi.patch
patch_apply ntdll-Junction_Points/0017-server-Properly-handle-file-symlink-deletion.patch
patch_apply ntdll-Junction_Points/0018-ntdll-Always-report-symbolic-links-as-containing-zer.patch
patch_apply ntdll-Junction_Points/0019-ntdll-Find-dangling-symlinks-quickly.patch
patch_apply ntdll-Junction_Points/0020-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch
patch_apply ntdll-Junction_Points/0015-kernel32-Set-error-code-when-attempting-to-delete-fi.patch
patch_apply ntdll-Junction_Points/0016-server-Properly-handle-file-symlink-deletion.patch
patch_apply ntdll-Junction_Points/0017-ntdll-Always-report-symbolic-links-as-containing-zer.patch
patch_apply ntdll-Junction_Points/0018-ntdll-Find-dangling-symlinks-quickly.patch
patch_apply ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch
(
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for junction point creation.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading junction points.", 1 },';
@ -3321,7 +3320,6 @@ if test "$enable_ntdll_Junction_Points" -eq 1; then
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for file symlinks.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Allow creation of dangling reparse points to non-existent paths.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Correctly report file symbolic links as files.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Correctly report fd-based file info for symlinks.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "kernel32: Set error code when attempting to delete file symlinks as directories.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "server: Properly handle file symlink deletion.", 1 },';
printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Always report symbolic links as containing zero bytes.", 1 },';