ntdll-Junction_Points: Updates from Erich E. Hoover.

This commit is contained in:
Zebediah Figura 2021-02-03 19:44:26 -06:00
parent 2be4bfb8fe
commit cfe1b94e0f
34 changed files with 430 additions and 444 deletions

View File

@ -1,7 +1,7 @@
From b5c84083ecc13c2911928a881b25d2924d8ca967 Mon Sep 17 00:00:00 2001
From bf59059770b5398f4d440466c219b03b9c0a9d02 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>
---
@ -14,10 +14,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
create mode 100644 include/ntifs.h
diff --git a/configure.ac b/configure.ac
index fec43bcb194..10b6a2778c3 100644
index df006e31e47..a944591343d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2215,6 +2215,8 @@ AC_CHECK_FUNCS(\
@@ -2216,6 +2216,8 @@ AC_CHECK_FUNCS(\
proc_pidinfo \
pwrite \
readlink \
@ -152,7 +152,7 @@ index 8cfdb72ae97..6359c5bcd48 100644
test_mailslot_name();
}
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 4d96a327f90..7390e7b9187 100644
index 53c1674c2eb..5d717a385cb 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -36,6 +36,7 @@
@ -171,7 +171,7 @@ index 4d96a327f90..7390e7b9187 100644
WINE_DEFAULT_DEBUG_CHANNEL(file);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -153,6 +155,10 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -155,6 +157,10 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#undef EXT2_IOC_GETFLAGS
#undef EXT4_CASEFOLD_FL
@ -182,7 +182,7 @@ index 4d96a327f90..7390e7b9187 100644
#ifdef linux
/* We want the real kernel dirent structure, not the libc one */
@@ -467,6 +473,32 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
@@ -481,6 +487,32 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
#endif
}
@ -215,7 +215,7 @@ index 4d96a327f90..7390e7b9187 100644
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -5748,6 +5780,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5761,6 +5793,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
}
@ -332,7 +332,7 @@ index 4d96a327f90..7390e7b9187 100644
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
@@ -5830,6 +5972,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -5843,6 +5985,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
break;
}
@ -357,10 +357,10 @@ index 4d96a327f90..7390e7b9187 100644
TRACE("FSCTL_SET_SPARSE: Ignoring request\n");
io->Information = 0;
diff --git a/include/Makefile.in b/include/Makefile.in
index 468ee5edf47..8e8ffc26615 100644
index dc849da763c..9de1577aebc 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -531,6 +531,7 @@ SOURCES = \
@@ -533,6 +533,7 @@ SOURCES = \
ntddvdeo.h \
ntdef.h \
ntdsapi.h \
@ -417,5 +417,5 @@ index 00000000000..21d42e17325
+
+#endif /* __WINE_NTIFS_H */
--
2.29.2
2.17.1

View File

@ -1,4 +1,4 @@
From 2d258fdb8d115451cec891a6132ef2b128aa9cc2 Mon Sep 17 00:00:00 2001
From a3a18766dd4ea00e86fd6a22b29df83a5acd9d75 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, 133 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 10bdef5d810..970a144935b 100644
index 6359c5bcd48..8999a063163 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5178,9 +5178,10 @@ static void test_reparse_points(void)
@@ -5190,9 +5190,10 @@ static void test_reparse_points(void)
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
DWORD dwret, dwLen, dwFlags;
@ -25,7 +25,7 @@ index 10bdef5d810..970a144935b 100644
BOOL bret;
/* Create a temporary folder for the junction point tests */
@@ -5228,6 +5229,17 @@ static void test_reparse_points(void)
@@ -5240,6 +5241,17 @@ static void test_reparse_points(void)
buffer_len = build_reparse_buffer(nameW.Buffer, &buffer);
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());
@ -44,10 +44,10 @@ index 10bdef5d810..970a144935b 100644
cleanup:
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 585ecf561a1..3a2ca3ba319 100644
index 5d717a385cb..5cb286cb6ff 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5890,6 +5890,120 @@ cleanup:
@@ -5903,6 +5903,120 @@ cleanup:
}
@ -168,7 +168,7 @@ index 585ecf561a1..3a2ca3ba319 100644
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
@@ -5972,6 +6086,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -5985,6 +6099,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
break;
}

View File

@ -1,4 +1,4 @@
From 17713b3abdd15d7a76ffec8e6376f2424829ecfa Mon Sep 17 00:00:00 2001
From f88a842e600e87a8e1ffed94f4ad3b5479fa6882 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/tests/file.c b/dlls/ntdll/tests/file.c
index 4fe94f58bf1..9da353bbbd2 100644
index 8999a063163..a57bd8285dc 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5004,12 +5004,15 @@ static void test_reparse_points(void)
@@ -5185,12 +5185,15 @@ static void test_reparse_points(void)
static const WCHAR reparseW[] = {'\\','r','e','p','a','r','s','e',0};
WCHAR path[MAX_PATH], reparse_path[MAX_PATH], target_path[MAX_PATH];
static const WCHAR targetW[] = {'\\','t','a','r','g','e','t',0};
@ -30,7 +30,7 @@ index 4fe94f58bf1..9da353bbbd2 100644
UNICODE_STRING nameW;
HANDLE handle;
WCHAR *dest;
@@ -5057,6 +5060,8 @@ static void test_reparse_points(void)
@@ -5238,6 +5241,8 @@ static void test_reparse_points(void)
win_skip("Failed to open junction point directory handle (0x%x).\n", GetLastError());
goto cleanup;
}
@ -39,7 +39,7 @@ index 4fe94f58bf1..9da353bbbd2 100644
buffer_len = build_reparse_buffer(nameW.Buffer, &buffer);
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());
@@ -5071,6 +5076,22 @@ static void test_reparse_points(void)
@@ -5252,6 +5257,22 @@ static void test_reparse_points(void)
dest = &buffer->MountPointReparseBuffer.PathBuffer[buffer->MountPointReparseBuffer.SubstituteNameOffset/sizeof(WCHAR)];
ok((memcmp(dest, nameW.Buffer, string_len) == 0), "Junction point destination does not match ('%s' != '%s')!\n",
wine_dbgstr_w(dest), wine_dbgstr_w(nameW.Buffer));
@ -62,7 +62,7 @@ index 4fe94f58bf1..9da353bbbd2 100644
CloseHandle(handle);
cleanup:
@@ -5078,7 +5099,7 @@ cleanup:
@@ -5259,7 +5280,7 @@ cleanup:
pRtlFreeUnicodeString(&nameW);
HeapFree(GetProcessHeap(), 0, buffer);
bret = RemoveDirectoryW(reparse_path);
@ -72,10 +72,10 @@ index 4fe94f58bf1..9da353bbbd2 100644
ok(bret, "Failed to remove temporary target directory!\n");
RemoveDirectoryW(path);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index cd523dcd313..3f6dcc6ab41 100644
index 5cb286cb6ff..fe86f5a86b3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5817,6 +5817,87 @@ cleanup:
@@ -6017,6 +6017,87 @@ cleanup:
}
@ -163,7 +163,7 @@ index cd523dcd313..3f6dcc6ab41 100644
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
@@ -5899,6 +5980,22 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -6099,6 +6180,22 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
break;
}

View File

@ -1,4 +1,4 @@
From 4b5123561e8260ed4b1421b0cf127468ac7c131f Mon Sep 17 00:00:00 2001
From 17dbb234d78b753b71ae39e7ed9aca51f5d7f5cc 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.
@ -9,10 +9,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 5 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 9da353bbbd2..051237dd494 100644
index a57bd8285dc..49e2771f587 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5066,6 +5066,11 @@ static void test_reparse_points(void)
@@ -5247,6 +5247,11 @@ static void test_reparse_points(void)
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());

View File

@ -1,7 +1,7 @@
From 46d3165f1d7103851a5c15ed69d94be897186093 Mon Sep 17 00:00:00 2001
From 660851a75e0f3cb8fb0c10441f9f87bed3bdd586 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: [PATCH] server: Add support for deleting junction points with
Subject: server: Add support for deleting junction points with
RemoveDirectory.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 61 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 96fbe4501bc..2ac30551cf6 100644
index 49e2771f587..68747b312b4 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5240,7 +5240,7 @@ static void test_reparse_points(void)
@@ -5191,7 +5191,7 @@ static void test_reparse_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@ -23,7 +23,7 @@ index 96fbe4501bc..2ac30551cf6 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5329,6 +5329,38 @@ static void test_reparse_points(void)
@@ -5280,6 +5280,38 @@ static void test_reparse_points(void)
"Junction point folder's access time does not match.\n");
CloseHandle(handle);
@ -63,7 +63,7 @@ index 96fbe4501bc..2ac30551cf6 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/server/fd.c b/server/fd.c
index bca4f20d8ef..08d080ecd32 100644
index edb59b0d540..622b3c246aa 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -169,7 +169,8 @@ struct closed_fd
@ -84,7 +84,7 @@ index bca4f20d8ef..08d080ecd32 100644
char *unix_name; /* unix file name */
int unix_fd; /* unix file descriptor */
unsigned int no_fd_status;/* status to return when unix_fd is -1 */
@@ -1113,6 +1115,7 @@ static void inode_close_pending( struct inode *inode, int keep_unlinks )
@@ -1119,6 +1121,7 @@ static void inode_close_pending( struct inode *inode, int keep_unlinks )
if (!keep_unlinks || !fd->unlink) /* get rid of it unless there's an unlink pending on that file */
{
list_remove( ptr );
@ -92,7 +92,7 @@ index bca4f20d8ef..08d080ecd32 100644
free( fd->unix_name );
free( fd );
}
@@ -1147,12 +1150,13 @@ static void inode_destroy( struct object *obj )
@@ -1153,12 +1156,13 @@ static void inode_destroy( struct object *obj )
{
/* make sure it is still the same file */
struct stat st;
@ -109,7 +109,7 @@ index bca4f20d8ef..08d080ecd32 100644
free( fd->unix_name );
free( fd );
}
@@ -1572,6 +1576,7 @@ static void fd_destroy( struct object *obj )
@@ -1578,6 +1582,7 @@ static void fd_destroy( struct object *obj )
else /* no inode, close it right away */
{
if (fd->unix_fd != -1) close( fd->unix_fd );
@ -117,7 +117,7 @@ index bca4f20d8ef..08d080ecd32 100644
free( fd->unix_name );
}
}
@@ -1681,6 +1686,7 @@ static struct fd *alloc_fd_object(void)
@@ -1687,6 +1692,7 @@ static struct fd *alloc_fd_object(void)
fd->options = 0;
fd->sharing = 0;
fd->unix_fd = -1;
@ -125,7 +125,7 @@ index bca4f20d8ef..08d080ecd32 100644
fd->unix_name = NULL;
fd->cacheable = 0;
fd->signaled = 1;
@@ -1716,6 +1722,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
@@ -1722,6 +1728,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->access = 0;
fd->options = options;
fd->sharing = 0;
@ -133,7 +133,7 @@ index bca4f20d8ef..08d080ecd32 100644
fd->unix_name = NULL;
fd->unix_fd = -1;
fd->cacheable = 0;
@@ -1750,6 +1757,12 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
@@ -1756,6 +1763,12 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
strcpy( fd->unix_name, orig->unix_name );
}
@ -146,7 +146,7 @@ index bca4f20d8ef..08d080ecd32 100644
if (orig->inode)
{
struct closed_fd *closed = mem_alloc( sizeof(*closed) );
@@ -1762,6 +1775,7 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
@@ -1768,6 +1781,7 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
}
closed->unix_fd = fd->unix_fd;
closed->unlink = 0;
@ -154,7 +154,7 @@ index bca4f20d8ef..08d080ecd32 100644
closed->unix_name = fd->unix_name;
fd->closed = closed;
fd->inode = (struct inode *)grab_object( orig->inode );
@@ -1903,18 +1917,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1909,18 +1923,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
fd->unix_name = NULL;
if ((path = dup_fd_name( root, name )))
{
@ -177,7 +177,7 @@ index bca4f20d8ef..08d080ecd32 100644
{
unsigned int err;
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
@@ -1932,6 +1947,9 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1938,6 +1953,9 @@ 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;
@ -187,7 +187,7 @@ index bca4f20d8ef..08d080ecd32 100644
/* check directory options */
if ((options & FILE_DIRECTORY_FILE) && !S_ISDIR(st.st_mode))
{
@@ -2569,10 +2587,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
@@ -2563,10 +2581,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
fchmod( fd->unix_fd, st.st_mode );
}

View File

@ -1,7 +1,7 @@
From 78fe8add28f8385a2d2aae635ff16c027f6240f7 Mon Sep 17 00:00:00 2001
From 9f4c292ed890fa1f0f334878c3fac453b9370759 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: [PATCH] ntdll: Add support for absolute symlink creation.
Subject: ntdll: Add support for absolute symlink creation.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 143 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 2953c77f0ad..81fa9592e3d 100644
index a2fce93c6eb..94160c21971 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5205,26 +5205,50 @@ static void test_mailslot_name(void)
@@ -5154,26 +5154,50 @@ static void test_mailslot_name(void)
CloseHandle( device );
}
@ -73,7 +73,7 @@ index 2953c77f0ad..81fa9592e3d 100644
lstrcpyW(subst_dest, filename);
lstrcpyW(print_dest, &filename[prefix_len]);
*pbuffer = buffer;
@@ -5244,10 +5268,12 @@ static void test_reparse_points(void)
@@ -5193,10 +5217,12 @@ static void test_reparse_points(void)
REPARSE_DATA_BUFFER *buffer = NULL;
DWORD dwret, dwLen, dwFlags, err;
INT buffer_len, string_len;
@ -87,7 +87,7 @@ index 2953c77f0ad..81fa9592e3d 100644
BOOL bret;
/* Create a temporary folder for the junction point tests */
@@ -5294,7 +5320,7 @@ static void test_reparse_points(void)
@@ -5245,7 +5271,7 @@ static void test_reparse_points(void)
}
dwret = NtQueryInformationFile(handle, &iosb, &old_attrib, sizeof(old_attrib), FileBasicInformation);
ok(dwret == STATUS_SUCCESS, "Failed to get junction point folder's attributes (0x%x).\n", dwret);
@ -96,7 +96,7 @@ index 2953c77f0ad..81fa9592e3d 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());
@@ -5335,7 +5361,7 @@ static void test_reparse_points(void)
@@ -5286,7 +5312,7 @@ static void test_reparse_points(void)
HeapFree(GetProcessHeap(), 0, buffer);
handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
@ -105,7 +105,7 @@ index 2953c77f0ad..81fa9592e3d 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);
@@ -5350,7 +5376,7 @@ static void test_reparse_points(void)
@@ -5301,7 +5327,7 @@ static void test_reparse_points(void)
ok(bret, "Failed to create junction point target directory.\n");
handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
@ -114,7 +114,7 @@ index 2953c77f0ad..81fa9592e3d 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);
@@ -5363,14 +5389,73 @@ static void test_reparse_points(void)
@@ -5314,14 +5340,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);
@ -193,10 +193,10 @@ index 2953c77f0ad..81fa9592e3d 100644
}
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 9ad0d7dcb39..7150099f750 100644
index fe86f5a86b3..ce331ae9276 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5664,18 +5664,34 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5800,18 +5800,34 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
BOOL src_allocated = FALSE, dest_allocated = FALSE, tempdir_created = FALSE;
@ -234,7 +234,7 @@ index 9ad0d7dcb39..7150099f750 100644
if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
@@ -5710,6 +5726,18 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5846,6 +5862,18 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@ -253,7 +253,7 @@ index 9ad0d7dcb39..7150099f750 100644
strcat( magic_dest, unix_dest );
/* Produce the link in a temporary location in the same folder */
@@ -6072,6 +6100,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -6209,6 +6237,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:
@ -295,5 +295,5 @@ index 4539b89d583..ab3273d3f81 100644
typedef struct _REPARSE_GUID_DATA_BUFFER {
DWORD ReparseTag;
--
2.27.0
2.17.1

View File

@ -1,4 +1,4 @@
From 37de2cfdefc0d51cec89f9fee2d8b7ee67a84ff0 Mon Sep 17 00:00:00 2001
From d870b2916e62a79d12b63ed40da6ad20e0575b75 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/tests/file.c b/dlls/ntdll/tests/file.c
index 82f928bb432..0f2b3f9f7f2 100644
index 94160c21971..f3ddd397e8e 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5377,7 +5377,6 @@ static void test_reparse_points(void)
@@ -5391,7 +5391,6 @@ static void test_reparse_points(void)
ok(dwret == STATUS_SUCCESS, "Failed to get symlink folder's attributes (0x%x).\n", dwret);
buffer_len = build_reparse_buffer(nameW.Buffer, IO_REPARSE_TAG_SYMLINK, &buffer);
bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
@ -21,7 +21,7 @@ index 82f928bb432..0f2b3f9f7f2 100644
ok(bret, "Failed to create symlink! (0x%x)\n", GetLastError());
/* Check the file attributes of the symlink */
@@ -5385,6 +5384,18 @@ static void test_reparse_points(void)
@@ -5399,6 +5398,18 @@ static void test_reparse_points(void)
ok(dwret != (DWORD)~0, "Symlink doesn't exist (attributes: 0x%x)!\n", dwret);
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: %d)\n", dwret);
@ -41,10 +41,10 @@ index 82f928bb432..0f2b3f9f7f2 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 20e7fbfc218..a61fe7a060b 100644
index ce331ae9276..0a10ec33ced 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5932,6 +5932,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -5945,6 +5945,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
int unix_dest_len;
DWORD max_length;
NTSTATUS status;
@ -52,7 +52,7 @@ index 20e7fbfc218..a61fe7a060b 100644
WCHAR *nt_dest;
INT prefix_len;
ssize_t ret;
@@ -5976,6 +5977,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -5989,6 +5990,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
}
buffer->ReparseTag |= (val << i);
}
@ -70,7 +70,7 @@ index 20e7fbfc218..a61fe7a060b 100644
unix_dest_len -= (p - unix_dest);
memmove(unix_dest, p, unix_dest_len);
unix_dest[unix_dest_len] = 0;
@@ -6009,6 +6021,16 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6022,6 +6034,16 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
buffer->MountPointReparseBuffer.PrintNameLength = nt_dest_len - prefix_len*sizeof(WCHAR);
print_name = &buffer->MountPointReparseBuffer.PathBuffer[buffer->MountPointReparseBuffer.PrintNameOffset/sizeof(WCHAR)];
break;

View File

@ -1,4 +1,4 @@
From 248faa7fd14b6ff0028c7762edd0bb8ad564b9ca Mon Sep 17 00:00:00 2001
From 0dd3826e5cffa8e8f2841e4b4bc2e5739603cbcf 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/tests/file.c b/dlls/ntdll/tests/file.c
index 5b7bdf7ddfd..b6a58c3f2a7 100644
index f3ddd397e8e..073759fcfb9 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5225,6 +5225,22 @@ static void test_reparse_points(void)
@@ -5408,6 +5408,22 @@ static void test_reparse_points(void)
ok(bret, "Failed to read symlink!\n");
ok((memcmp(dest, nameW.Buffer, string_len) == 0), "Symlink destination does not match ('%s' != '%s')!\n",
wine_dbgstr_w(dest), wine_dbgstr_w(nameW.Buffer));
@ -37,10 +37,10 @@ index 5b7bdf7ddfd..b6a58c3f2a7 100644
cleanup:
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index cd14a2e24c3..232cbb36f42 100644
index 0a10ec33ced..3438c064f22 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6037,6 +6037,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -6237,6 +6237,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
switch(buffer->ReparseTag)
{
case IO_REPARSE_TAG_MOUNT_POINT:

View File

@ -1,7 +1,7 @@
From bcd9d5db2f28b626854ef463cc9615ccfc853b44 Mon Sep 17 00:00:00 2001
From 82bb8a8de84b36c610c10a489629f1526998e780 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: [PATCH] ntdll: Add support for relative symlink creation.
Subject: ntdll: Add support for relative symlink creation.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 111 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 5352ff034b7..7e9b214eb63 100644
index 073759fcfb9..e2dae32ca18 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5142,7 +5142,8 @@ static void test_mailslot_name(void)
@@ -5154,7 +5154,8 @@ static void test_mailslot_name(void)
CloseHandle( device );
}
@ -24,7 +24,7 @@ index 5352ff034b7..7e9b214eb63 100644
{
static INT header_size = offsetof(REPARSE_DATA_BUFFER, GenericReparseBuffer);
INT buffer_size, struct_size, data_size, string_len, prefix_len;
@@ -5160,7 +5161,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, REPARSE_DATA_B
@@ -5172,7 +5173,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, REPARSE_DATA_B
default:
return 0;
}
@ -33,7 +33,7 @@ index 5352ff034b7..7e9b214eb63 100644
string_len = lstrlenW(&filename[prefix_len]);
data_size = (prefix_len + 2 * string_len + 2) * sizeof(WCHAR);
buffer_size = struct_size + data_size;
@@ -5180,6 +5181,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, REPARSE_DATA_B
@@ -5192,6 +5193,7 @@ static INT build_reparse_buffer(const WCHAR *filename, ULONG tag, REPARSE_DATA_B
buffer->SymbolicLinkReparseBuffer.SubstituteNameLength = (prefix_len + string_len) * sizeof(WCHAR);
buffer->SymbolicLinkReparseBuffer.PrintNameOffset = (prefix_len + string_len + 1) * sizeof(WCHAR);
buffer->SymbolicLinkReparseBuffer.PrintNameLength = string_len * sizeof(WCHAR);
@ -41,7 +41,7 @@ index 5352ff034b7..7e9b214eb63 100644
subst_dest = &buffer->SymbolicLinkReparseBuffer.PathBuffer[0];
print_dest = &buffer->SymbolicLinkReparseBuffer.PathBuffer[prefix_len + string_len + 1];
break;
@@ -5257,7 +5259,7 @@ static void test_reparse_points(void)
@@ -5271,7 +5273,7 @@ static void test_reparse_points(void)
}
dwret = NtQueryInformationFile(handle, &iosb, &old_attrib, sizeof(old_attrib), FileBasicInformation);
ok(dwret == STATUS_SUCCESS, "Failed to get junction point folder's attributes (0x%x).\n", dwret);
@ -50,7 +50,7 @@ index 5352ff034b7..7e9b214eb63 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());
@@ -5298,7 +5300,7 @@ static void test_reparse_points(void)
@@ -5312,7 +5314,7 @@ static void test_reparse_points(void)
HeapFree(GetProcessHeap(), 0, buffer);
handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
@ -59,7 +59,7 @@ index 5352ff034b7..7e9b214eb63 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);
@@ -5313,7 +5315,7 @@ static void test_reparse_points(void)
@@ -5327,7 +5329,7 @@ static void test_reparse_points(void)
ok(bret, "Failed to create junction point target directory.\n");
handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
@ -68,7 +68,7 @@ index 5352ff034b7..7e9b214eb63 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);
@@ -5375,7 +5377,7 @@ static void test_reparse_points(void)
@@ -5389,7 +5391,7 @@ static void test_reparse_points(void)
}
dwret = NtQueryInformationFile(handle, &iosb, &old_attrib, sizeof(old_attrib), FileBasicInformation);
ok(dwret == STATUS_SUCCESS, "Failed to get symlink folder's attributes (0x%x).\n", dwret);
@ -77,7 +77,7 @@ index 5352ff034b7..7e9b214eb63 100644
bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
ok(bret, "Failed to create symlink! (0x%x)\n", GetLastError());
@@ -5412,6 +5414,22 @@ static void test_reparse_points(void)
@@ -5426,6 +5428,22 @@ static void test_reparse_points(void)
"Symlink folder's access time does not match.\n");
CloseHandle(handle);
@ -101,10 +101,10 @@ index 5352ff034b7..7e9b214eb63 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 097adfb5572..9dd65de2de6 100644
index 3438c064f22..1b3c019a929 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5651,17 +5651,20 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5799,17 +5799,20 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
*/
NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
@ -127,7 +127,7 @@ index 097adfb5572..9dd65de2de6 100644
int i;
switch(buffer->ReparseTag)
@@ -5670,11 +5673,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5818,11 +5821,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
dest_len = buffer->MountPointReparseBuffer.SubstituteNameLength;
offset = buffer->MountPointReparseBuffer.SubstituteNameOffset;
dest = &buffer->MountPointReparseBuffer.PathBuffer[offset];
@ -141,7 +141,7 @@ index 097adfb5572..9dd65de2de6 100644
break;
default:
return STATUS_NOT_IMPLEMENTED;
@@ -5686,8 +5691,66 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5834,8 +5839,66 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if ((status = server_get_unix_name( handle, &unix_src )))
goto cleanup;
src_allocated = TRUE;
@ -210,7 +210,7 @@ index 097adfb5572..9dd65de2de6 100644
for (;;)
{
unix_dest = malloc( unix_dest_len );
@@ -5703,11 +5766,24 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5851,11 +5914,24 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if (status != STATUS_SUCCESS && status != STATUS_NO_SUCH_FILE)
goto cleanup;
dest_allocated = TRUE;
@ -237,7 +237,7 @@ index 097adfb5572..9dd65de2de6 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
if ((buffer->ReparseTag >> i) & 1)
@@ -5726,7 +5802,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5874,7 +5950,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@ -246,7 +246,7 @@ index 097adfb5572..9dd65de2de6 100644
/* Produce the link in a temporary location in the same folder */
strcpy( tmpdir, unix_src );
@@ -5776,7 +5852,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5924,7 +6000,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
cleanup:
if (tempdir_created) rmdir( tmpdir );
@ -268,5 +268,5 @@ index ab3273d3f81..0d02225bc4f 100644
+
#endif /* __WINE_NTIFS_H */
--
2.28.0
2.17.1

View File

@ -1,19 +1,19 @@
From 47bde84ad4a5dc3320f7531e12909046730835dd Mon Sep 17 00:00:00 2001
From d96043bc45facf3fd26a69f6338968f9fdb96be7 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.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 13 ++++++++-
dlls/ntdll/unix/file.c | 60 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 71 insertions(+), 2 deletions(-)
dlls/ntdll/tests/file.c | 15 ++++++++++++++-
dlls/ntdll/unix/file.c | 38 +++++++++++++++++++++++++++++++++-----
2 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 7e9b214eb63..c288d7f62ab 100644
index e2dae32ca18..cd207497b24 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5427,9 +5427,20 @@ static void test_reparse_points(void)
@@ -5441,9 +5441,22 @@ static void test_reparse_points(void)
ok(dwret == STATUS_SUCCESS, "Failed to get symlink folder's attributes (0x%x).\n", dwret);
buffer_len = build_reparse_buffer(targetW, IO_REPARSE_TAG_SYMLINK, SYMLINK_FLAG_RELATIVE, &buffer);
bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
@ -27,6 +27,8 @@ index 7e9b214eb63..c288d7f62ab 100644
+ bret = DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, (LPVOID)buffer, buffer_len, &dwret, 0);
+ ok(bret, "Failed to read relative symlink!\n");
+ string_len = buffer->SymbolicLinkReparseBuffer.SubstituteNameLength;
+ ok(string_len != lstrlenW(targetW), "Symlink destination length does not match ('%d' != '%d')!\n",
+ string_len, lstrlenW(targetW));
+ dest = &buffer->SymbolicLinkReparseBuffer.PathBuffer[buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset/sizeof(WCHAR)];
+ ok((memcmp(dest, targetW, string_len) == 0), "Symlink destination does not match ('%s' != '%s')!\n",
+ wine_dbgstr_w(dest), wine_dbgstr_w(targetW));
@ -36,18 +38,10 @@ index 7e9b214eb63..c288d7f62ab 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 638621fec87..628a76c795a 100644
index 1b3c019a929..920d21af5bd 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6008,6 +6008,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
BOOL dest_allocated = FALSE;
int dest_fd, needs_close;
int unix_dest_len;
+ int path_len = 0;
DWORD max_length;
NTSTATUS status;
ULONG flags = 0;
@@ -6033,6 +6034,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6046,6 +6046,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
/* Decode the reparse tag from the symlink */
p = unix_dest;
@ -59,70 +53,55 @@ index 638621fec87..628a76c795a 100644
if (*p++ != '/')
{
status = STATUS_NOT_IMPLEMENTED;
@@ -6070,6 +6076,24 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6083,24 +6088,47 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
memmove(unix_dest, p, unix_dest_len);
unix_dest[unix_dest_len] = 0;
- for (;;)
+ /* convert the relative path into an absolute path */
+ if (flags == SYMLINK_FLAG_RELATIVE)
+ {
+ int unix_src_len = strlen(unix_src);
+ int offset = unix_src_len + 2;
+ char *d;
+
+ memcpy( &unix_dest[offset], unix_dest, unix_dest_len + 1 );
+ memcpy( unix_dest, unix_src, unix_src_len );
+ unix_dest[unix_src_len] = 0;
+ d = dirname( unix_dest );
+ if (d != unix_dest) strcpy( unix_dest, d );
+ strcat( unix_dest, "/" );
+ path_len = strlen( unix_dest );
+ memmove( &unix_dest[path_len], &unix_dest[offset], unix_dest_len + 1 );
+ unix_dest_len = strlen( unix_dest );
+ }
+ /* resolve the NT path */
for (;;)
{
nt_dest = malloc( nt_dest_len * sizeof(WCHAR) );
@@ -6087,7 +6111,41 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
goto cleanup;
nt_dest_len *= sizeof(WCHAR);
- prefix_len = strlen("\\??\\");
+ /* remove the relative path from the NT path */
+ if (flags == SYMLINK_FLAG_RELATIVE)
+ {
+ SIZE_T nt_path_len = PATH_MAX;
+ int relative_offset;
+ WCHAR *nt_path;
+ int i;
+
+ unix_dest_len = path_len;
+ nt_dest_len = unix_dest_len;
nt_dest = malloc( nt_dest_len * sizeof(WCHAR) );
if (!nt_dest)
{
status = STATUS_NO_MEMORY;
goto cleanup;
}
- status = wine_unix_to_nt_file_name( unix_dest, nt_dest, &nt_dest_len );
- if (status != STATUS_BUFFER_TOO_SMALL) break;
- free( nt_dest );
+ /* wine_unix_to_nt_file_name does not work on relative paths, so convert manually */
+ for (i = 0; i < unix_dest_len; i++)
+ {
+ if (unix_dest[i] == '/') unix_dest[i] = '\\';
+ }
+ ascii_to_unicode( nt_dest, unix_dest, unix_dest_len );
+ }
+ else
+ {
+ /* resolve the NT path */
+ for (;;)
+ {
+ nt_path = malloc( nt_path_len * sizeof(WCHAR) );
+ if (!nt_path)
+ nt_dest = malloc( nt_dest_len * sizeof(WCHAR) );
+ if (!nt_dest)
+ {
+ status = STATUS_NO_MEMORY;
+ goto cleanup;
+ }
+ status = wine_unix_to_nt_file_name( unix_dest, nt_path, &nt_path_len );
+ status = wine_unix_to_nt_file_name( unix_dest, nt_dest, &nt_dest_len );
+ if (status != STATUS_BUFFER_TOO_SMALL) break;
+ free( nt_path );
+ free( nt_dest );
+ }
+ if (status != STATUS_SUCCESS)
+ goto cleanup;
+ relative_offset = lstrlenW( nt_path );
+ if (wcsnicmp( nt_path, nt_dest, relative_offset ) != 0)
+ {
+ free( nt_path );
+ status = STATUS_IO_REPARSE_DATA_INVALID;
+ goto cleanup;
+ }
+ free( nt_path );
+ nt_dest_len = lstrlenW( &nt_dest[relative_offset] ) * sizeof(WCHAR);
+ memmove( nt_dest, &nt_dest[relative_offset], nt_dest_len + sizeof(WCHAR) );
+ }
+
}
dest_allocated = TRUE;
if (status != STATUS_SUCCESS)
goto cleanup;
nt_dest_len *= sizeof(WCHAR);
- prefix_len = strlen("\\??\\");
+ prefix_len = (flags == SYMLINK_FLAG_RELATIVE) ? 0 : strlen("\\??\\");
switch(buffer->ReparseTag)
{

View File

@ -1,4 +1,4 @@
From d98202d50cdb09fe199414b8a313fcf954725e2d Mon Sep 17 00:00:00 2001
From 08ace54e7f14c7f5482da2ed0a086a6e79a37eb9 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.
@ -10,10 +10,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 0db7372a0c8..58fec76bec4 100644
index cd207497b24..8d61257e1e5 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5191,6 +5191,35 @@ static void test_reparse_points(void)
@@ -5374,6 +5374,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");
@ -50,10 +50,10 @@ index 0db7372a0c8..58fec76bec4 100644
ok(bret, "Failed to create junction point directory.\n");
dwret = GetFileAttributesW(reparse_path);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index e62a2529bb2..242d344e1f5 100644
index 920d21af5bd..410b3b4eee7 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5610,6 +5610,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5809,6 +5809,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
int relative_offset = 0;
UNICODE_STRING nt_dest;
int dest_len, offset;
@ -61,7 +61,7 @@ index e62a2529bb2..242d344e1f5 100644
NTSTATUS status;
struct stat st;
WCHAR *dest;
@@ -5745,7 +5746,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5946,7 +5947,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
status = errno_to_status( errno );
goto cleanup;
}
@ -71,7 +71,7 @@ index e62a2529bb2..242d344e1f5 100644
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@@ -5772,8 +5774,11 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5973,8 +5975,11 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
/* Atomically move the link into position */
if (!renameat2( -1, tmplink, -1, unix_src, RENAME_EXCHANGE ))
{
@ -85,7 +85,7 @@ index e62a2529bb2..242d344e1f5 100644
}
else if (errno == ENOSYS)
{
@@ -6011,6 +6016,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -6182,6 +6187,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
char tmpdir[PATH_MAX], tmpfile[PATH_MAX], *d;
BOOL tempdir_created = FALSE;
int dest_fd, needs_close;
@ -93,7 +93,7 @@ index e62a2529bb2..242d344e1f5 100644
NTSTATUS status;
char *unix_name;
struct stat st;
@@ -6023,12 +6029,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -6194,12 +6200,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
TRACE( "Deleting symlink %s\n", unix_name );
@ -108,7 +108,7 @@ index e62a2529bb2..242d344e1f5 100644
strcpy( tmpdir, unix_name );
d = dirname( tmpdir);
if (d != tmpdir) strcpy( tmpdir, d );
@@ -6041,11 +6048,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -6212,11 +6219,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
tempdir_created = TRUE;
strcpy( tmpfile, tmpdir );
strcat( tmpfile, "/tmpfile" );

View File

@ -1,4 +1,4 @@
From 767c81a6bb76f0f852f4ba7260dc0c1b26b45e09 Mon Sep 17 00:00:00 2001
From 7079e4f8ad185776771f4cc65ebbfb28d4e04c06 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
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 242d344e1f5..248bda3d3ce 100644
index 410b3b4eee7..7c553e9cfb1 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3154,6 +3154,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -3355,6 +3355,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
status = STATUS_OBJECT_NAME_COLLISION;
}
}
@ -34,7 +34,7 @@ index 242d344e1f5..248bda3d3ce 100644
if (status != STATUS_SUCCESS) break;
@@ -5707,7 +5720,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5908,7 +5921,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
status = STATUS_NO_MEMORY;
goto cleanup;
}
@ -44,10 +44,10 @@ index 242d344e1f5..248bda3d3ce 100644
free( unix_dest );
}
diff --git a/include/winternl.h b/include/winternl.h
index b3fbb90feff..221c8e39e84 100644
index a89958cf2ab..68fef97087f 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1869,6 +1869,7 @@ typedef struct _RTL_HANDLE_TABLE
@@ -2251,6 +2251,7 @@ typedef struct _RTL_HANDLE_TABLE
#define FILE_OVERWRITE 4
#define FILE_OVERWRITE_IF 5
#define FILE_MAXIMUM_DISPOSITION 5

View File

@ -1,18 +1,18 @@
From a04e2603e0dda3eb635d9d2d524943eca203f19c Mon Sep 17 00:00:00 2001
From 00f71402f0ff5f3e857206c70165bba461c18d0a 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.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/unix/file.c | 115 +++++++++++++++++++++++++++--------------
1 file changed, 77 insertions(+), 38 deletions(-)
dlls/ntdll/unix/file.c | 113 +++++++++++++++++++++++++++--------------
1 file changed, 76 insertions(+), 37 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 4ee804b709a..bf81cc7c851 100644
index 7c553e9cfb1..8d42008a596 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1599,6 +1599,9 @@ static inline int get_file_xattr( char *hexattr, int attrlen )
@@ -1613,6 +1613,9 @@ static inline int get_file_xattr( char *hexattr, int attrlen )
return 0;
}
@ -22,7 +22,7 @@ index 4ee804b709a..bf81cc7c851 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
@@ -1683,10 +1686,15 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1697,10 +1700,15 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
if (ret == -1) return ret;
if (S_ISLNK( st->st_mode ))
{
@ -42,7 +42,7 @@ index 4ee804b709a..bf81cc7c851 100644
}
else if (S_ISDIR( st->st_mode ) && (parent_path = malloc( strlen(path) + 4 )))
{
@@ -6014,47 +6022,34 @@ cleanup:
@@ -6027,46 +6035,34 @@ cleanup:
}
@ -60,7 +60,6 @@ index 4ee804b709a..bf81cc7c851 100644
- BOOL dest_allocated = FALSE;
- int dest_fd, needs_close;
- int unix_dest_len;
- int path_len = 0;
- DWORD max_length;
+ int len = MAX_PATH;
+ DWORD reparse_tag;
@ -105,7 +104,7 @@ index 4ee804b709a..bf81cc7c851 100644
p++;
}
if (*p++ != '/')
@@ -6062,7 +6057,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6074,7 +6070,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@ -114,7 +113,7 @@ index 4ee804b709a..bf81cc7c851 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
char c = *p++;
@@ -6077,21 +6072,65 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6089,21 +6085,64 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
status = STATUS_NOT_IMPLEMENTED;
goto cleanup;
}
@ -167,7 +166,6 @@ index 4ee804b709a..bf81cc7c851 100644
+ int unix_dest_len = PATH_MAX;
+ BOOL dest_allocated = FALSE;
+ int dest_fd, needs_close;
+ int path_len = 0;
+ DWORD max_length;
+ NTSTATUS status;
+ ULONG flags = 0;

View File

@ -1,31 +0,0 @@
From 3a96350814cd7fd9d620352e252b02aede20d1cf 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
directories.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 58fec76bec4..7f69a9116f2 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5208,9 +5208,9 @@ static void test_reparse_points(void)
bret = RemoveDirectoryW(reparse_path);
todo_wine ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
err = GetLastError();
- todo_wine ok(err == ERROR_DIRECTORY,
- "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
- ERROR_DIRECTORY, err);
+ ok(err == ERROR_DIRECTORY,
+ "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
+ ERROR_DIRECTORY, err);
dwret = GetFileAttributesW(reparse_path);
todo_wine ok(dwret != (DWORD)~0, "Symlink doesn't exist (attributes: 0x%x)!\n", dwret);
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: 0x%x)\n", dwret);
--
2.17.1

View File

@ -1,18 +1,18 @@
From d1ccfa832c14af4940c7b6cd2ca63aa7d23bb2d5 Mon Sep 17 00:00:00 2001
From 15b9e40cc1ac1f96ca526d4954cd15a3bf543b5a Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sun, 22 Nov 2020 22:35:50 -0700
Subject: [PATCH] kernelbase: Convert FILE_FLAG_OPEN_REPARSE_POINT for passing
to ntdll.
Subject: kernelbase: Convert FILE_FLAG_OPEN_REPARSE_POINT for passing to
ntdll.
---
dlls/kernelbase/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index b21e5d3222d..478bc63fc75 100644
index 7b122e263b0..b06f003274f 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -724,6 +724,8 @@ static UINT get_nt_file_options( DWORD attributes )
@@ -723,6 +723,8 @@ static UINT get_nt_file_options( DWORD attributes )
options |= FILE_RANDOM_ACCESS;
if (attributes & FILE_FLAG_WRITE_THROUGH)
options |= FILE_WRITE_THROUGH;
@ -22,5 +22,5 @@ index b21e5d3222d..478bc63fc75 100644
}
--
2.29.2
2.17.1

View File

@ -0,0 +1,70 @@
From 922266311e073e79403da082400814c5d68498ce Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 12 Dec 2020 16:54:28 -0700
Subject: server: Implement FILE_OPEN_REPARSE_POINT option.
---
server/fd.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/server/fd.c b/server/fd.c
index 622b3c246aa..d6cd4733d5d 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -107,6 +107,10 @@
#include "winioctl.h"
#include "ddk/wdm.h"
+#if !defined(O_SYMLINK) && defined(O_PATH)
+# define O_SYMLINK (O_NOFOLLOW | O_PATH)
+#endif
+
#if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL_CREATE)
# include <sys/epoll.h>
# define USE_EPOLL
@@ -1904,6 +1908,11 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
}
else rw_mode = O_RDONLY;
+#if defined(O_SYMLINK)
+ if ((options & FILE_OPEN_REPARSE_POINT) && !(flags & O_CREAT))
+ flags |= O_SYMLINK;
+#endif
+
if ((fd->unix_fd = open( name, rw_mode | (flags & ~O_TRUNC), *mode )) == -1)
{
/* if we tried to open a directory for write access, retry read-only */
@@ -2385,6 +2394,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
static int is_dir_empty( int fd )
{
+ int dir_fd;
DIR *dir;
int empty;
struct dirent *de;
@@ -2392,8 +2402,13 @@ static int is_dir_empty( int fd )
if ((fd = dup( fd )) == -1)
return -1;
- if (!(dir = fdopendir( fd )))
+ /* use openat() so that if 'fd' was opened with O_SYMLINK we can still check the contents */
+ dir_fd = openat( fd, ".", O_RDONLY | O_DIRECTORY | O_NONBLOCK );
+ if (dir_fd == -1)
+ return -1;
+ if (!(dir = fdopendir( dir_fd )))
{
+ close( dir_fd );
close( fd );
return -1;
}
@@ -2405,6 +2420,7 @@ static int is_dir_empty( int fd )
empty = 0;
}
closedir( dir );
+ close( dir_fd );
return empty;
}
--
2.17.1

View File

@ -1,8 +1,7 @@
From 3191aede6d60d0d253aa4eb57fee1f48445a6fa3 Mon Sep 17 00:00:00 2001
From 07a914c25e72ddb67226b5099c4fda9dc9f77f22 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sun, 22 Nov 2020 22:37:33 -0700
Subject: [PATCH] ntdll: Allow set_file_times_precise to work on reparse
points.
Subject: ntdll: Allow set_file_times_precise to work on reparse points.
---
configure.ac | 3 ++-
@ -24,10 +23,10 @@ index a944591343d..efb4035295a 100644
CFLAGS="$ac_save_CFLAGS"
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index d4a9aa50108..406ee2242bc 100644
index 8d42008a596..5375b94e02a 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1740,6 +1740,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1738,6 +1738,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
}
@ -42,7 +41,7 @@ index d4a9aa50108..406ee2242bc 100644
#if defined(__ANDROID__) && !defined(HAVE_FUTIMENS)
static int futimens( int fd, const struct timespec spec[2] )
{
@@ -1755,7 +1763,7 @@ static int futimens( int fd, const struct timespec spec[2] )
@@ -1753,7 +1761,7 @@ static int futimens( int fd, const struct timespec spec[2] )
static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
const LARGE_INTEGER *atime, NTSTATUS *status )
{
@ -51,7 +50,7 @@ index d4a9aa50108..406ee2242bc 100644
struct timespec tv[2];
tv[0].tv_sec = tv[1].tv_sec = 0;
@@ -1771,10 +1779,16 @@ static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
@@ -1769,10 +1777,16 @@ static BOOL set_file_times_precise( int fd, const LARGE_INTEGER *mtime,
tv[1].tv_nsec = (mtime->QuadPart % 10000000) * 100;
}
#ifdef __APPLE__

View File

@ -1,28 +1,31 @@
From a936bfbd369e1199723b0e5f2fa1329c084561db Mon Sep 17 00:00:00 2001
From 39739eab0295b80aa081bda4899d7920a5690e09 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.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 6 ++--
server/fd.c | 69 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 70 insertions(+), 5 deletions(-)
dlls/ntdll/tests/file.c | 12 ++++-----
server/fd.c | 58 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 7f69a9116f2..ddd3d693659 100644
index 8d61257e1e5..b9d9c817eaa 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5206,18 +5206,18 @@ static void test_reparse_points(void)
@@ -5389,18 +5389,18 @@ static void test_reparse_points(void)
/* Check deleting a file symlink as if it were a directory */
bret = RemoveDirectoryW(reparse_path);
- todo_wine ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
+ ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
err = GetLastError();
ok(err == ERROR_DIRECTORY,
"Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
ERROR_DIRECTORY, err);
- todo_wine ok(err == ERROR_DIRECTORY,
- "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
- ERROR_DIRECTORY, err);
+ ok(err == ERROR_DIRECTORY,
+ "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
+ ERROR_DIRECTORY, err);
dwret = GetFileAttributesW(reparse_path);
- todo_wine ok(dwret != (DWORD)~0, "Symlink doesn't exist (attributes: 0x%x)!\n", dwret);
+ ok(dwret != (DWORD)~0, "Symlink doesn't exist (attributes: 0x%x)!\n", dwret);
@ -36,21 +39,10 @@ index 7f69a9116f2..ddd3d693659 100644
/* Create a blank slate for directory symlink tests */
bret = CreateDirectoryW(reparse_path, NULL);
diff --git a/server/fd.c b/server/fd.c
index c0d35e2fa4c..9e087917c0d 100644
index d15e727d19f..0d8eece7bcb 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -107,6 +107,10 @@
#include "winioctl.h"
#include "ddk/wdm.h"
+#if !defined(O_SYMLINK) && defined(O_PATH)
+# define O_SYMLINK (O_NOFOLLOW | O_PATH)
+#endif
+
#if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL_CREATE)
# include <sys/epoll.h>
# define USE_EPOLL
@@ -1829,6 +1833,55 @@ char *dup_fd_name( struct fd *root, const char *name )
@@ -1849,6 +1849,55 @@ char *dup_fd_name( struct fd *root, const char *name )
return ret;
}
@ -106,21 +98,7 @@ index c0d35e2fa4c..9e087917c0d 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 )
@@ -1896,6 +1949,13 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT))
fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode );
}
+#if defined(O_SYMLINK)
+ /* if we tried to open a dangling symlink then try again with O_SYMLINK */
+ else if (errno == ENOENT)
+ {
+ fd->unix_fd = open( name, rw_mode | O_SYMLINK | (flags & ~O_TRUNC), *mode );
+ }
+#endif
if (fd->unix_fd == -1)
{
@@ -1923,6 +1983,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1948,6 +1997,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
{
unsigned int err;
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
@ -128,7 +106,7 @@ index c0d35e2fa4c..9e087917c0d 100644
if (!inode)
{
@@ -1937,16 +1998,20 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1962,16 +2012,20 @@ 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;

View File

@ -0,0 +1,33 @@
From d41ad5ae59d2d74b2252f4860dd076717bf27e3b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 12 Dec 2020 17:40:27 -0700
Subject: server: Properly handle deleting dangling symlinks.
---
server/fd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/fd.c b/server/fd.c
index 0d8eece7bcb..78b1ae97f03 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1983,6 +1983,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
{
fd->unlink_name = path;
fd->unix_name = realpath( path, NULL );
+ if (!fd->unix_name) fd->unix_name = dup_fd_name( root, name ); /* dangling symlink */
}
closed_fd->unix_fd = fd->unix_fd;
@@ -2495,7 +2496,7 @@ static void set_fd_disposition( struct fd *fd, int unlink )
file_set_error();
return;
}
- if (S_ISREG( st.st_mode )) /* can't unlink files we don't have permission to write */
+ if (S_ISREG( st.st_mode ) || S_ISLNK( st.st_mode )) /* can't unlink files we don't have permission to write */
{
if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
{
--
2.17.1

View File

@ -0,0 +1,25 @@
From a7ccf5e390aa34567b4e2ce2f1dd5681e8f4724e Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 12 Dec 2020 17:35:21 -0700
Subject: kernelbase: Use FILE_OPEN_REPARSE_POINT in RemoveDirectory[A|W].
---
dlls/kernelbase/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index b06f003274f..712c4ab4170 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -3482,7 +3482,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RemoveDirectoryW( LPCWSTR path )
InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL );
status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
+ FILE_OPEN_REPARSE_POINT | FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
RtlFreeUnicodeString( &nt_name );
if (!status)
--
2.17.1

View File

@ -1,4 +1,4 @@
From ceb069628acc263e5c1a9ed274f8d00eeb9c4dd8 Mon Sep 17 00:00:00 2001
From 41b736c18690d4cc1c7fcff0d45f29a2b5ce0889 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.
@ -7,14 +7,13 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 46 +++++++++++++++++++++++++++++++++++++++--
dlls/ntdll/unix/file.c | 2 ++
server/fd.c | 3 ++-
3 files changed, 48 insertions(+), 3 deletions(-)
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index ddd3d693659..e0a6e3b3143 100644
index b9d9c817eaa..994bfb23a5e 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5037,7 +5037,9 @@ static void test_reparse_points(void)
@@ -5218,7 +5218,9 @@ static void test_reparse_points(void)
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
DWORD dwret, dwLen, dwFlags, err;
@ -24,7 +23,7 @@ index ddd3d693659..e0a6e3b3143 100644
HANDLE handle, token;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5165,8 +5167,6 @@ static void test_reparse_points(void)
@@ -5348,8 +5350,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");
@ -33,7 +32,7 @@ index ddd3d693659..e0a6e3b3143 100644
/* Establish permissions for symlink creation */
bret = OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token);
@@ -5191,6 +5191,13 @@ static void test_reparse_points(void)
@@ -5374,6 +5374,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");
@ -47,7 +46,7 @@ index ddd3d693659..e0a6e3b3143 100644
/* Create the file symlink */
HeapFree(GetProcessHeap(), 0, buffer);
@@ -5204,6 +5211,37 @@ static void test_reparse_points(void)
@@ -5387,6 +5394,37 @@ static void test_reparse_points(void)
ok(bret, "Failed to create symlink! (0x%x)\n", GetLastError());
CloseHandle(handle);
@ -60,8 +59,8 @@ index ddd3d693659..e0a6e3b3143 100644
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to open symlink file.\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");
+ todo_wine ok(bret, "Failed to read data from the symlink.\n");
+ ok(dwLen == 0, "Length of symlink data is not zero.\n");
+ CloseHandle(handle);
+
+ /* Check the size/data of the symlink target */
@ -85,7 +84,7 @@ index ddd3d693659..e0a6e3b3143 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");
@@ -5225,6 +5263,10 @@ static void test_reparse_points(void)
@@ -5408,6 +5446,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);
@ -97,10 +96,10 @@ index ddd3d693659..e0a6e3b3143 100644
/* Create the directory symlink */
HeapFree(GetProcessHeap(), 0, buffer);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index ca21a799231..bdc8b8c756f 100644
index 5375b94e02a..0a6f615c702 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1507,6 +1507,8 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1704,6 +1704,8 @@ static 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 );
@ -109,27 +108,6 @@ index ca21a799231..bdc8b8c756f 100644
/* symbolic links (either junction points or NT symlinks) are "reparse points" */
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
/* whether a reparse point is a file or a directory is stored inside the link target */
diff --git a/server/fd.c b/server/fd.c
index 9e087917c0d..03966cd3067 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1969,6 +1969,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
{
fd->unlink_name = path;
fd->unix_name = realpath( path, NULL );
+ if (!fd->unix_name) fd->unix_name = dup_fd_name( root, name ); /* dangling symlink */
}
closed_fd->unix_fd = fd->unix_fd;
@@ -2487,7 +2488,7 @@ static void set_fd_disposition( struct fd *fd, int unlink )
file_set_error();
return;
}
- if (S_ISREG( st.st_mode )) /* can't unlink files we don't have permission to write */
+ if (S_ISREG( st.st_mode ) || S_ISLNK( st.st_mode )) /* can't unlink files we don't have permission to write */
{
if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
{
--
2.17.1

View File

@ -1,4 +1,4 @@
From bc78873be1ca0e16e7c2d5aedf15f9e09f86069c Mon Sep 17 00:00:00 2001
From ef84cfc973142a9cd754091ffa6a196220909a8f 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.
@ -12,10 +12,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index bdc8b8c756f..a7dc12f0a3e 100644
index 0a6f615c702..746e01e91a0 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -2501,7 +2501,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
@@ -2717,7 +2717,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
if (ret >= 0 && ret <= MAX_DIR_ENTRY_LEN)
{
unix_name[pos + ret] = 0;
@ -24,7 +24,7 @@ index bdc8b8c756f..a7dc12f0a3e 100644
{
if (is_win_dir) *is_win_dir = is_same_file( &windir, &st );
return STATUS_SUCCESS;
@@ -2606,7 +2606,7 @@ not_found:
@@ -2821,7 +2821,7 @@ not_found:
return STATUS_OBJECT_PATH_NOT_FOUND;
success:
@ -33,7 +33,7 @@ index bdc8b8c756f..a7dc12f0a3e 100644
return STATUS_SUCCESS;
}
@@ -3101,7 +3101,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -3316,7 +3316,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/';
if (!name_len || !redirect || (!strstr( unix_name, "/windows/") && strncmp( unix_name, "windows/", 8 )))
{

View File

@ -1,8 +1,8 @@
From f3eb2b6b5484dbcc56717263e28d8eff529b8386 Mon Sep 17 00:00:00 2001
From 79be4ce22135fcf52d67ea70314081ca97678d20 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: [PATCH] kernel32: Implement CreateSymbolicLink[A|W] with ntdll
reparse points.
Subject: kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse
points.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -14,10 +14,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
5 files changed, 266 insertions(+), 81 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 8b4158b29d6..4384fab198d 100644
index 023dff826d6..29bbb5948ff 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -348,8 +348,16 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str )
@@ -350,8 +350,16 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str )
*/
BOOLEAN WINAPI CreateSymbolicLinkA(LPCSTR link, LPCSTR target, DWORD flags)
{
@ -161,7 +161,7 @@ index f49af6d5bfe..bc2cd84a65d 100644
+ test_CreateSymbolicLink();
}
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 7d0c4d63aa8..c9781c17d2b 100644
index 712c4ab4170..1a83d0ad902 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -38,6 +38,7 @@
@ -172,7 +172,7 @@ index 7d0c4d63aa8..c9781c17d2b 100644
#include "kernelbase.h"
#include "wine/exception.h"
@@ -952,8 +953,106 @@ done:
@@ -936,8 +937,106 @@ done:
*/
BOOLEAN WINAPI /* DECLSPEC_HOTPATCH */ CreateSymbolicLinkW( LPCWSTR link, LPCWSTR target, DWORD flags )
{
@ -535,5 +535,5 @@ index ae21feaf9e4..c10e925f8b3 100644
}
--
2.29.2
2.17.1

View File

@ -1,4 +1,4 @@
From 4a55bbf4a64741644288482073d29f9bfac8ffaf Mon Sep 17 00:00:00 2001
From a03acf6635b090d9593abf2f5250eb7f26af6939 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 29 May 2019 15:11:42 -0600
Subject: kernel32: Add reparse support to FindNextFile.
@ -9,10 +9,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 35 insertions(+)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index caec31ce602..a4536ec1c80 100644
index 1a83d0ad902..1908a8b03b8 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -1511,6 +1511,41 @@ BOOL WINAPI DECLSPEC_HOTPATCH FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *da
@@ -1495,6 +1495,41 @@ BOOL WINAPI DECLSPEC_HOTPATCH FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *da
memcpy( data->cFileName, dir_info->FileName, dir_info->FileNameLength );
data->cFileName[dir_info->FileNameLength/sizeof(WCHAR)] = 0;

View File

@ -1,7 +1,7 @@
From 4878d1414a8fa7c87d59625488a7ad0bb64e5e62 Mon Sep 17 00:00:00 2001
From a98908cfe4b02667e6edbbe23feecc6f1044b274 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 29 May 2019 15:18:50 -0600
Subject: [PATCH] wcmd: Display reparse point type in directory listings.
Subject: wcmd: Display reparse point type in directory listings.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -9,7 +9,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 26 insertions(+)
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index 24b18bfa81b..523139d5fe0 100644
index 24b18bfa81b..40554aed368 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -395,6 +395,32 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
@ -46,5 +46,5 @@ index 24b18bfa81b..523139d5fe0 100644
dir_count++;
--
2.29.2
2.17.1

View File

@ -1,7 +1,7 @@
From 99e0d91c314c2463e7e44599173ba383423fc1b9 Mon Sep 17 00:00:00 2001
From 62cff45e50e2ebc5266b444753259e7ffeeff4a5 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 29 May 2019 15:38:30 -0600
Subject: [PATCH] wcmd: Show reparse point target in directory listing.
Subject: wcmd: Show reparse point target in directory listing.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
@ -9,7 +9,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 35 insertions(+)
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index 658eb93e5b4..1b548d56a48 100644
index 40554aed368..0618ffec8d1 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -23,6 +23,8 @@
@ -62,5 +62,5 @@ index 658eb93e5b4..1b548d56a48 100644
if (!((lstrcmpW(fd[i].cFileName, L".") == 0) ||
(lstrcmpW(fd[i].cFileName, L"..") == 0))) {
--
2.29.2
2.17.1

View File

@ -1,44 +0,0 @@
From 8106c6932c691439b014e35d1bba16bdbeef7670 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sun, 22 Nov 2020 22:39:48 -0700
Subject: [PATCH] server: Implement FILE_OPEN_REPARSE_POINT option.
---
dlls/ntdll/tests/file.c | 4 ++--
server/fd.c | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 053441923b3..6a99fa94ebc 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5401,8 +5401,8 @@ static void test_reparse_points(void)
ok(handle != INVALID_HANDLE_VALUE, "Failed to open symlink file.\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");
+ todo_wine ok(bret, "Failed to read data from the symlink.\n");
+ ok(dwLen == 0, "Length of symlink data is not zero.\n");
CloseHandle(handle);
/* Check the size/data of the symlink target */
diff --git a/server/fd.c b/server/fd.c
index c3c53489212..673055718f8 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1957,6 +1957,11 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
}
else rw_mode = O_RDONLY;
+#if defined(O_SYMLINK)
+ if ((options & FILE_OPEN_REPARSE_POINT) && !(flags & O_CREAT))
+ flags |= O_SYMLINK;
+#endif
+
if ((fd->unix_fd = open( name, rw_mode | (flags & ~O_TRUNC), *mode )) == -1)
{
/* if we tried to open a directory for write access, retry read-only */
--
2.29.2

View File

@ -1,4 +1,4 @@
From c146d5ab24640039bd143ebe501755701c126a9e Mon Sep 17 00:00:00 2001
From 505ec0efa320fcc9c4aa379bf2c656fe7e63046b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 29 May 2019 16:01:45 -0600
Subject: wcmd: Add junction point support to mklink.
@ -9,7 +9,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 70ccddebc11..34de0486fdd 100644
index 19265bdbe78..20cf0991184 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -31,6 +31,9 @@
@ -22,7 +22,7 @@ index 70ccddebc11..34de0486fdd 100644
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
@@ -5055,6 +5058,49 @@ void WCMD_color (void) {
@@ -4967,6 +4970,49 @@ void WCMD_color (void) {
}
}
@ -72,7 +72,7 @@ index 70ccddebc11..34de0486fdd 100644
/****************************************************************************
* WCMD_mklink
*/
@@ -5106,7 +5152,7 @@ void WCMD_mklink(WCHAR *args)
@@ -5015,7 +5061,7 @@ void WCMD_mklink(WCHAR *args)
else if(!junction)
ret = CreateSymbolicLinkW(file1, file2, isdir);
else

View File

@ -1,4 +1,4 @@
From 7a25fabadf15c7514dec080502df19595249a3f6 Mon Sep 17 00:00:00 2001
From 33fd7e14918d6acc6416bd0430e6ceae98959c75 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 18 Jul 2020 09:13:29 -0600
Subject: server: Fix obtaining information about a symlink.
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a7dc12f0a3e..b507d575766 100644
index 746e01e91a0..809832dc6f0 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1775,7 +1775,7 @@ static NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
@@ -1996,7 +1996,7 @@ static NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
}
@ -23,7 +23,7 @@ index a7dc12f0a3e..b507d575766 100644
{
data_size_t size = 1024;
NTSTATUS ret;
@@ -1788,6 +1788,7 @@ static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
@@ -2009,6 +2009,7 @@ static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
SERVER_START_REQ( get_handle_unix_name )
{
req->handle = wine_server_obj_handle( handle );
@ -31,7 +31,7 @@ index a7dc12f0a3e..b507d575766 100644
wine_server_set_reply( req, name, size );
ret = wine_server_call( req );
size = reply->name_len;
@@ -1962,7 +1963,7 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
@@ -2183,7 +2184,7 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
NTSTATUS status;
int letter;
@ -40,7 +40,7 @@ index a7dc12f0a3e..b507d575766 100644
letter = find_dos_device( unix_name );
free( unix_name );
@@ -3973,7 +3974,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4205,7 +4206,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = errno_to_status( errno );
else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
io->u.Status = STATUS_INVALID_INFO_CLASS;
@ -49,7 +49,7 @@ index a7dc12f0a3e..b507d575766 100644
{
LONG name_len = len - FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName);
@@ -4034,7 +4035,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4266,7 +4267,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
FILE_NAME_INFORMATION *info = ptr;
char *unix_name;
@ -58,7 +58,7 @@ index a7dc12f0a3e..b507d575766 100644
{
LONG name_len = len - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
io->u.Status = fill_name_info( unix_name, info, &name_len );
@@ -4048,7 +4049,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4280,7 +4281,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
FILE_NETWORK_OPEN_INFORMATION *info = ptr;
char *unix_name;
@ -67,7 +67,7 @@ index a7dc12f0a3e..b507d575766 100644
{
ULONG attributes;
struct stat st;
@@ -5661,7 +5662,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5874,7 +5875,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
@ -76,7 +76,7 @@ index a7dc12f0a3e..b507d575766 100644
goto cleanup;
src_allocated = TRUE;
if (flags == SYMLINK_FLAG_RELATIVE)
@@ -5940,7 +5941,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
@@ -6154,7 +6155,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s
if ((status = server_get_unix_fd( handle, FILE_ANY_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
@ -85,7 +85,7 @@ index a7dc12f0a3e..b507d575766 100644
goto cleanup;
if ((status = FILE_DecodeSymlink( unix_src, unix_dest, &unix_dest_len, &buffer->ReparseTag, &flags, NULL )))
@@ -6078,7 +6079,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
@@ -6263,7 +6264,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer)
if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
@ -94,7 +94,7 @@ index a7dc12f0a3e..b507d575766 100644
goto cleanup;
TRACE( "Deleting symlink %s\n", unix_name );
@@ -7104,7 +7105,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
@@ -7327,7 +7328,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
/* first try as a file object */
@ -104,10 +104,10 @@ index a7dc12f0a3e..b507d575766 100644
if (!(status = unix_to_nt_file_name( unix_name, &nt_name )))
{
diff --git a/server/fd.c b/server/fd.c
index 03966cd3067..100c3865126 100644
index 78b1ae97f03..69926dcfe88 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2729,11 +2729,12 @@ DECL_HANDLER(get_handle_unix_name)
@@ -2737,11 +2737,12 @@ DECL_HANDLER(get_handle_unix_name)
if ((fd = get_handle_fd_obj( current->process, req->handle, 0 )))
{
@ -124,10 +124,10 @@ index 03966cd3067..100c3865126 100644
}
else set_error( STATUS_OBJECT_TYPE_MISMATCH );
diff --git a/server/protocol.def b/server/protocol.def
index a121c371c19..faf4891a01e 100644
index 5b506ea4475..5a11c13768d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1297,6 +1297,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
@@ -1314,6 +1314,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
/* Get the Unix name from a file handle */
@REQ(get_handle_unix_name)
obj_handle_t handle; /* file handle */

View File

@ -1,7 +1,7 @@
From 466149c3b74fbf5a2e36350878d466e360451bda Mon Sep 17 00:00:00 2001
From a82cbbe7ca0bbc59417ac32516c978c7fa6bfde0 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: [PATCH] ntdll: Succeed with no data for NtReadFile on reparse points.
Subject: ntdll: Succeed with no data for NtReadFile on reparse points.
---
dlls/ntdll/tests/file.c | 2 +-
@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Succeed with no data for NtReadFile on reparse points.
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 6a99fa94ebc..d0112749258 100644
index 994bfb23a5e..45254128d45 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5401,7 +5401,7 @@ static void test_reparse_points(void)
@@ -5403,7 +5403,7 @@ static void test_reparse_points(void)
ok(handle != INVALID_HANDLE_VALUE, "Failed to open symlink file.\n");
todo_wine ok(GetFileSize(handle, NULL) == 0, "symlink size is not zero\n");
bret = ReadFile(handle, &buf, sizeof(buf), &dwLen, NULL);
@ -24,10 +24,10 @@ index 6a99fa94ebc..d0112749258 100644
CloseHandle(handle);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index c3000b25dcd..0cfa4f740ad 100644
index 809832dc6f0..00f479109b2 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5225,6 +5225,11 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo
@@ -5245,6 +5245,11 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo
goto done;
}
}
@ -40,10 +40,10 @@ index c3000b25dcd..0cfa4f740ad 100644
if (type == FD_TYPE_SERIAL && async_read && length)
{
diff --git a/server/file.c b/server/file.c
index 2cc4a9d978c..42a812a32a2 100644
index 1012fd4888c..38fb489df4f 100644
--- a/server/file.c
+++ b/server/file.c
@@ -301,6 +301,7 @@ static enum server_fd_type file_get_fd_type( struct fd *fd )
@@ -300,6 +300,7 @@ static enum server_fd_type file_get_fd_type( struct fd *fd )
{
struct file *file = get_fd_user( fd );
@ -52,7 +52,7 @@ index 2cc4a9d978c..42a812a32a2 100644
if (S_ISDIR(file->mode)) return FD_TYPE_DIR;
return FD_TYPE_CHAR;
diff --git a/server/protocol.def b/server/protocol.def
index eba14534b9d..e2836843f4c 100644
index 5a11c13768d..73980390f4a 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1334,6 +1334,7 @@ enum server_fd_type
@ -64,5 +64,5 @@ index eba14534b9d..e2836843f4c 100644
FD_TYPE_SOCKET, /* socket */
FD_TYPE_SERIAL, /* serial port */
--
2.29.2
2.17.1

View File

@ -1,7 +1,7 @@
From 4a873f38d376596190ada3ed356fc773cff5b371 Mon Sep 17 00:00:00 2001
From ba9f8b6a479b92aec362e99ddf2b698e00b05be0 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Wed, 25 Nov 2020 09:05:51 -0700
Subject: [PATCH] ntdll: Support reparse point properties in fd_get_file_info.
Subject: ntdll: Support reparse point properties in fd_get_file_info.
---
dlls/ntdll/tests/file.c | 2 +-
@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Support reparse point properties in fd_get_file_info.
2 files changed, 50 insertions(+), 34 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index d0112749258..9ee9bd4e788 100644
index 45254128d45..09a2ab5be9f 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5399,7 +5399,7 @@ static void test_reparse_points(void)
@@ -5401,7 +5401,7 @@ static void test_reparse_points(void)
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");
@ -22,10 +22,10 @@ index d0112749258..9ee9bd4e788 100644
ok(bret, "Failed to read data from the symlink.\n");
ok(dwLen == 0, "Length of symlink data is not zero.\n");
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 0cfa4f740ad..738f317e176 100644
index 00f479109b2..7d833e115f3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1601,6 +1601,8 @@ static inline int get_file_xattr( char *hexattr, int attrlen )
@@ -1615,6 +1615,8 @@ static inline int get_file_xattr( char *hexattr, int attrlen )
NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_dest_len,
DWORD *tag, ULONG *flags, BOOL *is_dir);
@ -34,7 +34,7 @@ index 0cfa4f740ad..738f317e176 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
@@ -1637,6 +1639,22 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
@@ -1651,6 +1653,22 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
/* consider mount points to be reparse points (IO_REPARSE_TAG_MOUNT_POINT) */
if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, st ))
*attr |= FILE_ATTRIBUTE_REPARSE_POINT;
@ -57,7 +57,7 @@ index 0cfa4f740ad..738f317e176 100644
return ret;
}
@@ -6037,41 +6055,22 @@ cleanup:
@@ -6057,41 +6075,22 @@ cleanup:
}
@ -103,7 +103,7 @@ index 0cfa4f740ad..738f317e176 100644
reparse_tag = 0;
for (i = 0; i < sizeof(ULONG)*8; i++)
{
@@ -6083,10 +6082,7 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des
@@ -6103,10 +6102,7 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des
else if (c == '.' && *p++ == '/')
val = 1;
else
@ -115,7 +115,7 @@ index 0cfa4f740ad..738f317e176 100644
reparse_tag |= (val << i);
}
/* skip past the directory/file flag */
@@ -6099,19 +6095,39 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des
@@ -6119,19 +6115,39 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des
else if (c == '.' && *p++ == '/')
dir_flag = TRUE;
else
@ -162,5 +162,5 @@ index 0cfa4f740ad..738f317e176 100644
cleanup:
if (!unix_dest) free( tmp );
--
2.29.2
2.17.1

View File

@ -1,7 +1,7 @@
From ce9b55753298930f8efc758e7559bd0c40c88cf4 Mon Sep 17 00:00:00 2001
From 4f74580a7cbd03cd0ee3aebab290a1997c4b9a9d Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Wed, 25 Nov 2020 09:19:42 -0700
Subject: [PATCH] ntdll: Add support for FileAttributeTagInformation.
Subject: ntdll: Add support for FileAttributeTagInformation.
---
dlls/ntdll/tests/file.c | 6 ++++++
@ -9,7 +9,7 @@ Subject: [PATCH] ntdll: Add support for FileAttributeTagInformation.
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 9ee9bd4e788..ce65a14d5be 100644
index 09a2ab5be9f..a27502e99bc 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5216,6 +5216,7 @@ static void test_reparse_points(void)
@ -28,7 +28,7 @@ index 9ee9bd4e788..ce65a14d5be 100644
WCHAR *dest;
LUID luid;
BOOL bret;
@@ -5403,6 +5405,10 @@ static void test_reparse_points(void)
@@ -5405,6 +5407,10 @@ static void test_reparse_points(void)
bret = ReadFile(handle, &buf, sizeof(buf), &dwLen, NULL);
ok(bret, "Failed to read data from the symlink.\n");
ok(dwLen == 0, "Length of symlink data is not zero.\n");
@ -40,10 +40,10 @@ index 9ee9bd4e788..ce65a14d5be 100644
/* Check the size/data of the symlink target */
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 738f317e176..9cfc138209f 100644
index 7d833e115f3..5ed3f3ea70d 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4328,7 +4328,16 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4348,7 +4348,16 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
{
FILE_ATTRIBUTE_TAG_INFORMATION *info = ptr;
info->FileAttributes = attr;
@ -62,5 +62,5 @@ index 738f317e176..9cfc138209f 100644
info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
}
--
2.29.2
2.17.1

View File

@ -2501,22 +2501,23 @@ 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-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
patch_apply ntdll-Junction_Points/0020-kernel32-Add-reparse-support-to-FindNextFile.patch
patch_apply ntdll-Junction_Points/0021-wcmd-Display-reparse-point-type-in-directory-listing.patch
patch_apply ntdll-Junction_Points/0022-wcmd-Show-reparse-point-target-in-directory-listing.patch
patch_apply ntdll-Junction_Points/0023-wcmd-Add-junction-point-support-to-mklink.patch
patch_apply ntdll-Junction_Points/0024-server-Fix-obtaining-information-about-a-symlink.patch
patch_apply ntdll-Junction_Points/0025-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch
patch_apply ntdll-Junction_Points/0026-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch
patch_apply ntdll-Junction_Points/0027-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch
patch_apply ntdll-Junction_Points/0028-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch
patch_apply ntdll-Junction_Points/0029-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch
patch_apply ntdll-Junction_Points/0030-ntdll-Add-support-for-FileAttributeTagInformation.patch
patch_apply ntdll-Junction_Points/0015-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch
patch_apply ntdll-Junction_Points/0016-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch
patch_apply ntdll-Junction_Points/0017-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch
patch_apply ntdll-Junction_Points/0018-server-Properly-handle-file-symlink-deletion.patch
patch_apply ntdll-Junction_Points/0019-server-Properly-handle-deleting-dangling-symlinks.patch
patch_apply ntdll-Junction_Points/0020-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-RemoveDire.patch
patch_apply ntdll-Junction_Points/0021-ntdll-Always-report-symbolic-links-as-containing-zer.patch
patch_apply ntdll-Junction_Points/0022-ntdll-Find-dangling-symlinks-quickly.patch
patch_apply ntdll-Junction_Points/0023-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch
patch_apply ntdll-Junction_Points/0024-kernel32-Add-reparse-support-to-FindNextFile.patch
patch_apply ntdll-Junction_Points/0025-wcmd-Display-reparse-point-type-in-directory-listing.patch
patch_apply ntdll-Junction_Points/0026-wcmd-Show-reparse-point-target-in-directory-listing.patch
patch_apply ntdll-Junction_Points/0027-wcmd-Add-junction-point-support-to-mklink.patch
patch_apply ntdll-Junction_Points/0028-server-Fix-obtaining-information-about-a-symlink.patch
patch_apply ntdll-Junction_Points/0029-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch
patch_apply ntdll-Junction_Points/0030-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch
patch_apply ntdll-Junction_Points/0031-ntdll-Add-support-for-FileAttributeTagInformation.patch
fi
# Patchset server-PeekMessage

View File

@ -1,4 +1,4 @@
From 7f1169fde63549646dcd24d60ea648db3a11765c Mon Sep 17 00:00:00 2001
From 0b74f0d359fb05b1b38f211269313b7e02690e86 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 3 Apr 2015 03:58:47 +0200
Subject: [PATCH] server: Allow to open files without any permission bits. (try
@ -13,10 +13,10 @@ Changes in v2:
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 825f8451904..948c257cea2 100644
index 020e69277e0..9466b01bc99 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3702,17 +3702,13 @@ static void test_CreateDirectoryA(void)
@@ -3699,17 +3699,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@ -40,7 +40,7 @@ index 825f8451904..948c257cea2 100644
CloseHandle(hTemp);
/* Test inheritance of ACLs in NtCreateFile without security descriptor */
@@ -3781,17 +3777,13 @@ static void test_CreateDirectoryA(void)
@@ -3778,17 +3774,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@ -65,10 +65,10 @@ index 825f8451904..948c257cea2 100644
done:
diff --git a/server/fd.c b/server/fd.c
index 819f77d041e..c1401acc1aa 100644
index c0425694294..100881f21a6 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1892,6 +1892,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1908,6 +1908,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
int root_fd = -1;
int rw_mode;
char *path;
@ -76,10 +76,10 @@ index 819f77d041e..c1401acc1aa 100644
int created = (flags & O_CREAT);
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
@@ -1958,10 +1959,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
fd->unix_fd = open( name, rw_mode | O_SYMLINK | (flags & ~O_TRUNC), *mode );
@@ -1972,10 +1973,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT))
fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode );
}
#endif
+ else if (errno == EACCES)
+ {
+ /* try to change permissions temporarily to open a file descriptor */
@ -105,7 +105,7 @@ index 819f77d041e..c1401acc1aa 100644
goto error;
}
}
@@ -1978,6 +1997,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1992,6 +2011,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
closed_fd->unlink = 0;
closed_fd->unlink_name = fd->unlink_name;
closed_fd->unix_name = fd->unix_name;
@ -114,5 +114,5 @@ index 819f77d041e..c1401acc1aa 100644
*mode = st.st_mode;
--
2.27.0
2.20.1