From a0708adf427a61acd2f68dda8ccf245d93909f15 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 23 Apr 2019 10:42:19 +1000 Subject: [PATCH] Updated ntdll-Junction_Points patchset Changed dependencies to allow ntdll-Junction_Points to be applied on top of wine. --- patches/eventfd_synchronization/definition | 1 + ...retrieving-DOS-attributes-in-NtQuery.patch | 26 +-- ...retrieving-DOS-attributes-in-NtQuery.patch | 16 +- ...e-Unix-style-hidden-file-check-withi.patch | 18 +-- ...re-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch | 14 +- ...-support-for-junction-point-creation.patch | 46 +++--- ...-support-for-reading-junction-points.patch | 2 +- ...support-for-deleting-junction-points.patch | 65 ++++++-- ...est-for-junction-point-advertisement.patch | 2 +- ...dd-support-for-deleting-junction-poi.patch | 2 +- ...l32-Advertise-junction-point-support.patch | 2 +- ...upport-for-absolute-symlink-creation.patch | 6 +- ...upport-for-reading-absolute-symlinks.patch | 4 +- ...ll-Add-support-for-deleting-symlinks.patch | 6 +- ...upport-for-relative-symlink-creation.patch | 4 +- ...upport-for-reading-relative-symlinks.patch | 4 +- ...-ntdll-Add-support-for-file-symlinks.patch | 54 ++++++- ...-report-file-symbolic-links-as-files.patch | 34 ++-- ...or-code-when-attempting-to-delete-fi.patch | 2 +- ...roperly-handle-file-symlink-deletion.patch | 30 ++-- ...nt-CreateSymbolicLink-A-W-with-ntdll.patch | 2 +- patches/ntdll-Junction_Points/definition | 2 +- ...-ntdll-Improve-stub-of-NtQueryEaFile.patch | 20 +-- patches/ntdll-NtQueryEaFile/definition | 1 + patches/patchinstall.sh | 150 +++++++++--------- ...open-files-without-any-permission-bi.patch | 28 ++-- 26 files changed, 319 insertions(+), 222 deletions(-) diff --git a/patches/eventfd_synchronization/definition b/patches/eventfd_synchronization/definition index 8da3c187..3ef6c6b5 100644 --- a/patches/eventfd_synchronization/definition +++ b/patches/eventfd_synchronization/definition @@ -9,3 +9,4 @@ Depends: server-Realtime_Priority Depends: ntdll-User_Shared_Data Depends: server-Misc_ACL Depends: advapi32-Token_Integrity_Level +Depends: ntdll-Junction_Points diff --git a/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch b/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch index 30a86226..98696660 100644 --- a/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch +++ b/patches/ntdll-DOS_Attributes/0001-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch @@ -1,4 +1,4 @@ -From da5af62afac8508b3323098bb004b87ffde77701 Mon Sep 17 00:00:00 2001 +From 935694ac40ed4b264ef0ede519bd8b9b2f1f28de Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Tue, 19 Aug 2014 22:10:49 -0600 Subject: [PATCH] ntdll: Implement retrieving DOS attributes in @@ -14,10 +14,10 @@ Subject: [PATCH] ntdll: Implement retrieving DOS attributes in create mode 100644 libs/port/xattr.c diff --git a/configure.ac b/configure.ac -index c80d9b1..745bf2b 100644 +index 1905733..6f0429e 100644 --- a/configure.ac +++ b/configure.ac -@@ -84,6 +84,7 @@ AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug an +@@ -85,6 +85,7 @@ AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug an AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)])) AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) @@ -25,7 +25,7 @@ index c80d9b1..745bf2b 100644 AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]), -@@ -703,6 +704,17 @@ AC_CHECK_HEADERS([libprocstat.h],,, +@@ -698,6 +699,17 @@ AC_CHECK_HEADERS([libprocstat.h],,, #include #endif]) @@ -44,12 +44,12 @@ index c80d9b1..745bf2b 100644 AC_SUBST(DLLFLAGS,"-D_REENTRANT") diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 4960e91..5957c44 100644 +index 919eaea..1ffa675 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -122,6 +122,22 @@ mode_t FILE_umask = 0; - - static const WCHAR ntfsW[] = {'N','T','F','S'}; +@@ -127,6 +127,22 @@ static const WCHAR ntfsW[] = {'N','T','F','S'}; + NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, USHORT *unix_dest_len, + DWORD *tag, ULONG *flags, BOOL *is_dir); +/* Match the Samba conventions for storing DOS file attributes */ +#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB" @@ -70,7 +70,7 @@ index 4960e91..5957c44 100644 /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) { -@@ -139,12 +155,16 @@ static inline ULONG get_file_attributes( const struct stat *st ) +@@ -144,12 +160,16 @@ static inline ULONG get_file_attributes( const struct stat *st ) /* 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 ) { @@ -89,10 +89,10 @@ index 4960e91..5957c44 100644 } diff --git a/include/wine/port.h b/include/wine/port.h -index 2f6e9eb..b21d045 100644 +index 19c8682..eaa23bc 100644 --- a/include/wine/port.h +++ b/include/wine/port.h -@@ -335,6 +335,14 @@ int usleep (unsigned int useconds); +@@ -344,6 +344,14 @@ int usleep (unsigned int useconds); extern int mkstemps(char *template, int suffix_len); @@ -108,10 +108,10 @@ index 2f6e9eb..b21d045 100644 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in -index a2e96d1..b975418 100644 +index db27249..790fd96 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in -@@ -108,4 +108,6 @@ C_SRCS = \ +@@ -109,4 +109,6 @@ C_SRCS = \ usleep.c \ utf8.c \ wctomb.c \ diff --git a/patches/ntdll-DOS_Attributes/0002-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch b/patches/ntdll-DOS_Attributes/0002-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch index 4f5955c8..9baf216c 100644 --- a/patches/ntdll-DOS_Attributes/0002-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch +++ b/patches/ntdll-DOS_Attributes/0002-ntdll-Implement-retrieving-DOS-attributes-in-NtQuery.patch @@ -1,7 +1,7 @@ -From f6b156b5bccac55814eeee4fd10013ea3a76f384 Mon Sep 17 00:00:00 2001 +From 938f92470a25e590523f78912301177580c61955 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 16:04:34 -0600 -Subject: ntdll: Implement retrieving DOS attributes in +Subject: [PATCH] ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile. --- @@ -11,10 +11,10 @@ Subject: ntdll: Implement retrieving DOS attributes in 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 83d07e2..b977e45 100644 +index 1ffa675..78ab0ec 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -152,7 +152,8 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr ) +@@ -176,7 +176,8 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr ) /* get the stat info and file attributes for a file (by name) */ int get_file_info( const char *path, struct stat *st, ULONG *attr ) { @@ -24,8 +24,8 @@ index 83d07e2..b977e45 100644 *attr = 0; ret = lstat( path, st ); -@@ -165,6 +166,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) - if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT; +@@ -193,6 +194,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) + st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG); } *attr |= get_file_attributes( st ); + len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); @@ -35,10 +35,10 @@ index 83d07e2..b977e45 100644 } diff --git a/include/wine/port.h b/include/wine/port.h -index 521246b..7977eb9 100644 +index eaa23bc..de6b995 100644 --- a/include/wine/port.h +++ b/include/wine/port.h -@@ -370,6 +370,7 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]); +@@ -351,6 +351,7 @@ extern int mkstemps(char *template, int suffix_len); #endif extern int xattr_fget( int filedes, const char *name, void *value, size_t size ); diff --git a/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch b/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch index b1eb005b..319019a9 100644 --- a/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch +++ b/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch @@ -1,4 +1,4 @@ -From 92eada413d3bc9e95d1d00478daf9a06fd3e587e Mon Sep 17 00:00:00 2001 +From a0b58c6366226c2079da60a4b5d757da4bd728b6 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 11:26:48 -0600 Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the @@ -11,7 +11,7 @@ Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c -index 4655a634..511a345 100644 +index c853470..56737b8 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -1267,17 +1267,17 @@ static DWORD WINAPI init_options( RTL_RUN_ONCE *once, void *param, void **contex @@ -50,11 +50,11 @@ index 4655a634..511a345 100644 } diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 3a96d3b..b2b88d6 100644 +index 0dbf612..5926c99 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -218,6 +218,10 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) - if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT; +@@ -227,6 +227,10 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) + st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG); } *attr |= get_file_attributes( st ); + /* convert Unix-style hidden files to a DOS hidden file attribute */ @@ -64,7 +64,7 @@ index 3a96d3b..b2b88d6 100644 len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); if (len == -1) return ret; *attr |= get_file_xattr( hexattr, len ); -@@ -3023,8 +3027,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, +@@ -3447,8 +3451,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, info->AllocationSize = std.AllocationSize; info->EndOfFile = std.EndOfFile; info->FileAttributes = basic.FileAttributes; @@ -73,7 +73,7 @@ index 3a96d3b..b2b88d6 100644 } RtlFreeAnsiString( &unix_name ); } -@@ -3052,11 +3054,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC +@@ -3476,11 +3478,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) status = STATUS_INVALID_INFO_CLASS; else @@ -86,10 +86,10 @@ index 3a96d3b..b2b88d6 100644 } else WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), status ); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 01a7636..2a8c67b 100644 +index b762ceb..32db62e 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -160,7 +160,7 @@ extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr, +@@ -164,7 +164,7 @@ extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr, FILE_INFORMATION_CLASS class ) DECLSPEC_HIDDEN; extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN; extern void init_directories(void) DECLSPEC_HIDDEN; diff --git a/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch b/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch index c7caa861..7ae3cb14 100644 --- a/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch +++ b/patches/ntdll-DOS_Attributes/0008-ntdll-Always-store-SAMBA_XATTR_DOS_ATTRIB-when-path-.patch @@ -1,7 +1,7 @@ -From 5a419298c1871c0d71a2892d6ac4b517288b3563 Mon Sep 17 00:00:00 2001 +From 1fe0fcb904363d5ac59b8d30a918f62f622b78b7 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 14 Jan 2016 23:09:19 +0100 -Subject: ntdll: Always store SAMBA_XATTR_DOS_ATTRIB when path could be +Subject: [PATCH] ntdll: Always store SAMBA_XATTR_DOS_ATTRIB when path could be interpreted as hidden. --- @@ -9,11 +9,11 @@ Subject: ntdll: Always store SAMBA_XATTR_DOS_ATTRIB when path could be 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 50b0042..b38698f 100644 +index 5926c99..cbd2531 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -213,12 +213,15 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) - if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT; +@@ -227,12 +227,15 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) + st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG); } *attr |= get_file_attributes( st ); - /* convert Unix-style hidden files to a DOS hidden file attribute */ @@ -32,7 +32,7 @@ index 50b0042..b38698f 100644 *attr |= get_file_xattr( hexattr, len ); return ret; } -@@ -231,7 +234,7 @@ NTSTATUS set_file_info( const char *path, ULONG attr ) +@@ -245,7 +248,7 @@ NTSTATUS set_file_info( const char *path, ULONG attr ) /* Note: unix mode already set when called this way */ attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */ len = sprintf( hexattr, "0x%x", attr ); @@ -42,5 +42,5 @@ index 50b0042..b38698f 100644 else xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB ); -- -2.6.4 +1.9.1 diff --git a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch index c03a96a4..451c0357 100644 --- a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch +++ b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch @@ -1,27 +1,27 @@ -From 0d2ea784da8e7b644da39d00852b7470cc3b634e Mon Sep 17 00:00:00 2001 +From 5d45f1a04195f1b058de18586db78367e8fb94ee Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" 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 --- configure.ac | 1 + - dlls/ntdll/file.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/tests/file.c | 101 +++++++++++++++++++++++++++++++++++++++++ + dlls/ntdll/file.c | 116 ++++++++++++++++++++++++++++++++++++++++ + dlls/ntdll/tests/file.c | 101 ++++++++++++++++++++++++++++++++++ include/Makefile.in | 1 + - include/ntifs.h | 42 ++++++++++++++++++ + include/ntifs.h | 42 +++++++++++++++ include/wine/port.h | 9 ++++ libs/port/Makefile.in | 1 + - libs/port/renameat2.c | 44 ++++++++++++++++++ + libs/port/renameat2.c | 44 +++++++++++++++ 8 files changed, 315 insertions(+) create mode 100644 include/ntifs.h create mode 100644 libs/port/renameat2.c diff --git a/configure.ac b/configure.ac -index cf896c1..3275061 100644 +index 611dc69c2e..c567f32d57 100644 --- a/configure.ac +++ b/configure.ac -@@ -2219,6 +2219,7 @@ AC_CHECK_FUNCS(\ +@@ -2179,6 +2179,7 @@ AC_CHECK_FUNCS(\ pwrite \ readdir \ readlink \ @@ -30,7 +30,7 @@ index cf896c1..3275061 100644 select \ setproctitle \ diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index c1de955..6337cc8 100644 +index 3dafdcfb44..5f2da14398 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -21,6 +21,7 @@ @@ -49,7 +49,7 @@ index c1de955..6337cc8 100644 WINE_DEFAULT_DEBUG_CHANNEL(ntdll); WINE_DECLARE_DEBUG_CHANNEL(winediag); -@@ -1746,6 +1748,102 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, +@@ -1648,6 +1650,102 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, } @@ -152,7 +152,7 @@ index c1de955..6337cc8 100644 /************************************************************************** * NtFsControlFile [NTDLL.@] * ZwFsControlFile [NTDLL.@] -@@ -1830,6 +1928,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -1732,6 +1830,24 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc io->Information = 0; status = STATUS_SUCCESS; break; @@ -178,7 +178,7 @@ index c1de955..6337cc8 100644 return server_ioctl_file( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 74adf4c..1eedfaa 100644 +index 8e54dbb541..322dadefe3 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -38,6 +38,7 @@ @@ -189,7 +189,7 @@ index 74adf4c..1eedfaa 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -5050,6 +5051,105 @@ static void test_file_readonly_access(void) +@@ -4831,6 +4832,105 @@ static void test_file_readonly_access(void) DeleteFileW(path); } @@ -295,19 +295,17 @@ index 74adf4c..1eedfaa 100644 START_TEST(file) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); -@@ -5120,6 +5220,7 @@ START_TEST(file) - test_query_volume_information_file(); +@@ -4900,4 +5000,5 @@ START_TEST(file) test_query_attribute_information_file(); test_ioctl(); -+ test_reparse_points(); test_flush_buffers_file(); - test_query_ea(); ++ test_reparse_points(); } diff --git a/include/Makefile.in b/include/Makefile.in -index 31a811d..eeeff7b 100644 +index 09c84d8254..616f265900 100644 --- a/include/Makefile.in +++ b/include/Makefile.in -@@ -482,6 +482,7 @@ SOURCES = \ +@@ -479,6 +479,7 @@ SOURCES = \ ntddvdeo.h \ ntdef.h \ ntdsapi.h \ @@ -317,7 +315,7 @@ index 31a811d..eeeff7b 100644 ntsecapi.h \ diff --git a/include/ntifs.h b/include/ntifs.h new file mode 100644 -index 0000000..21d42e1 +index 0000000000..21d42e1732 --- /dev/null +++ b/include/ntifs.h @@ -0,0 +1,42 @@ @@ -364,7 +362,7 @@ index 0000000..21d42e1 + +#endif /* __WINE_NTIFS_H */ diff --git a/include/wine/port.h b/include/wine/port.h -index 2b8a069..4bbf999 100644 +index d23e2b033f..26c5890ddb 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -317,6 +317,15 @@ double rint(double x); @@ -384,7 +382,7 @@ index 2b8a069..4bbf999 100644 int statvfs( const char *path, struct statvfs *buf ); #endif diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in -index b975418..790fd96 100644 +index a2e96d1500..db27249ac1 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -97,6 +97,7 @@ C_SRCS = \ @@ -397,7 +395,7 @@ index b975418..790fd96 100644 spawn.c \ diff --git a/libs/port/renameat2.c b/libs/port/renameat2.c new file mode 100644 -index 0000000..39b4053 +index 0000000000..39b4053f91 --- /dev/null +++ b/libs/port/renameat2.c @@ -0,0 +1,44 @@ @@ -446,5 +444,5 @@ index 0000000..39b4053 +} +#endif /* HAVE_RENAMEAT2 */ -- -1.9.1 +2.17.1 diff --git a/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch b/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch index ce95bd67..1305e2dd 100644 --- a/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch +++ b/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch @@ -1,4 +1,4 @@ -From 47cc80d8a94523f36a19906b8d647f3e58e346ef Mon Sep 17 00:00:00 2001 +From 7c01bde97a63851a367aa0bd76c9aee398857b4e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 20:57:57 -0700 Subject: ntdll: Add support for reading junction points. diff --git a/patches/ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch b/patches/ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch index 6e963f5c..d124cc74 100644 --- a/patches/ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch +++ b/patches/ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch @@ -1,20 +1,20 @@ -From 272ed659e67adc42778e428ac4b74d2844dc9ad5 Mon Sep 17 00:00:00 2001 +From 8e8839dfe0b2eeae7b0d124b65725257792e3813 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:00:21 -0700 Subject: ntdll: Add support for deleting junction points. Signed-off-by: Erich E. Hoover --- - dlls/ntdll/file.c | 51 +++++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/tests/file.c | 23 ++++++++++++++++++- - include/ntifs.h | 12 ++++++++++ - 3 files changed, 85 insertions(+), 1 deletion(-) + dlls/ntdll/file.c | 96 +++++++++++++++++++++++++++++++++++++++++ + dlls/ntdll/tests/file.c | 23 +++++++++- + include/ntifs.h | 12 ++++++ + 3 files changed, 130 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index ee561d9268..2effe7efb0 100644 +index ee561d9268..1730d816d9 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -1846,6 +1846,41 @@ cleanup: +@@ -1846,6 +1846,86 @@ cleanup: } @@ -24,9 +24,12 @@ index ee561d9268..2effe7efb0 100644 + */ +NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +{ ++ char tmpdir[PATH_MAX], tmpfile[PATH_MAX]; ++ BOOL tempdir_created = FALSE; + int dest_fd, needs_close; + ANSI_STRING unix_name; + NTSTATUS status; ++ struct stat st; + + if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL ))) + return status; @@ -35,12 +38,53 @@ index ee561d9268..2effe7efb0 100644 + goto cleanup; + + TRACE("Deleting symlink %s\n", unix_name.Buffer); -+ if (unlink( unix_name.Buffer ) < 0) ++ ++ /* Produce the directory in a temporary location in the same folder */ ++ if (fstat( dest_fd, &st ) == -1) + { + status = FILE_GetNtStatus(); + goto cleanup; + } -+ if (mkdir( unix_name.Buffer, 0775 ) < 0) ++ strcpy( tmpdir, unix_name.Buffer ); ++ dirname( tmpdir) ; ++ strcat( tmpdir, "/.winelink.XXXXXX" ); ++ if (mkdtemp( tmpdir ) == NULL) ++ { ++ status = FILE_GetNtStatus(); ++ goto cleanup; ++ } ++ tempdir_created = TRUE; ++ strcpy( tmpfile, tmpdir ); ++ strcat( tmpfile, "/tmpfile" ); ++ if (mkdir( tmpfile, st.st_mode )) ++ { ++ status = FILE_GetNtStatus(); ++ goto cleanup; ++ } ++ /* attemp to retain the ownership (if possible) */ ++ lchown( tmpfile, st.st_uid, st.st_gid ); ++ /* Atomically move the directory into position */ ++ if (!renameat2( -1, tmpfile, -1, unix_name.Buffer, RENAME_EXCHANGE )) ++ { ++ /* success: link and folder have switched locations */ ++ unlink( tmpfile ); /* remove the link (at folder location) */ ++ } ++ else if (errno == ENOSYS) ++ { ++ FIXME( "Atomic exchange of directory with symbolic link unsupported on this system, " ++ "using unsafe exchange instead.\n" ); ++ if (unlink( unix_name.Buffer )) ++ { ++ status = FILE_GetNtStatus(); ++ goto cleanup; ++ } ++ if (rename( tmpfile, unix_name.Buffer )) ++ { ++ status = FILE_GetNtStatus(); ++ goto cleanup; /* not moved, orignal file/folder at destination is orphaned */ ++ } ++ } ++ else + { + status = FILE_GetNtStatus(); + goto cleanup; @@ -48,6 +92,7 @@ index ee561d9268..2effe7efb0 100644 + status = STATUS_SUCCESS; + +cleanup: ++ if (tempdir_created) rmdir( tmpdir ); + if (needs_close) close( dest_fd ); + return status; +} @@ -56,7 +101,7 @@ index ee561d9268..2effe7efb0 100644 /************************************************************************** * NtFsControlFile [NTDLL.@] * ZwFsControlFile [NTDLL.@] -@@ -1931,6 +1966,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -1931,6 +2011,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc status = STATUS_SUCCESS; break; diff --git a/patches/ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch b/patches/ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch index 9d8dd1b2..14c6d51e 100644 --- a/patches/ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch +++ b/patches/ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch @@ -1,4 +1,4 @@ -From 719d62a3f338279f466d12a628a9e6ec78f65b00 Mon Sep 17 00:00:00 2001 +From c94b245b19d852b13048227551641c655c591da1 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:01:25 -0700 Subject: ntdll: Add a test for junction point advertisement. diff --git a/patches/ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch b/patches/ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch index ea17f83d..caf7c103 100644 --- a/patches/ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch +++ b/patches/ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch @@ -1,4 +1,4 @@ -From a8eb436342b0f261ba09c0a4bb1a87f0a85b4d85 Mon Sep 17 00:00:00 2001 +From 8b1d430506bf0127a4782594937e1ae1505d64f0 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:02:11 -0700 Subject: kernel32,ntdll: Add support for deleting junction points with diff --git a/patches/ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch b/patches/ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch index 52a46794..905e3983 100644 --- a/patches/ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch +++ b/patches/ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch @@ -1,4 +1,4 @@ -From 4fe08afd847dc6c1c89eb90f647faafe0be2f4a8 Mon Sep 17 00:00:00 2001 +From 602c311b76c08f4d06c71ee0925ea7c3329d7d73 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:03:47 -0700 Subject: kernel32: Advertise junction point support. diff --git a/patches/ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch b/patches/ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch index 0e91e5fb..b095e539 100644 --- a/patches/ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch +++ b/patches/ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch @@ -1,4 +1,4 @@ -From 084864a69084f9e01e53ee289681a342d1ec0a05 Mon Sep 17 00:00:00 2001 +From 6c1d1b1d7819118d3511aaa314a8e3da05f4c7ea Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:06:24 -0700 Subject: ntdll: Add support for absolute symlink creation. @@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover 3 files changed, 139 insertions(+), 15 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 2effe7efb0..00e3d7aa31 100644 +index 1730d816d9..78ea4c5b00 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1657,17 +1657,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, @@ -70,7 +70,7 @@ index 2effe7efb0..00e3d7aa31 100644 strcat( magic_dest, unix_dest.Buffer ); /* Produce the link in a temporary location in the same folder */ -@@ -1995,6 +2023,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -2040,6 +2068,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc switch(buffer->ReparseTag) { case IO_REPARSE_TAG_MOUNT_POINT: diff --git a/patches/ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch b/patches/ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch index d3bd9211..17528103 100644 --- a/patches/ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch +++ b/patches/ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch @@ -1,4 +1,4 @@ -From a482fa218dbe1284c8a08fba84c9f36dec4d3eba Mon Sep 17 00:00:00 2001 +From 498e0feb3c25f92c9930e4007259b12c6ff4e567 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 12:55:20 -0600 Subject: ntdll: Add support for reading absolute symlinks. @@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 00e3d7aa31..ee8ac6bd10 100644 +index 78ea4c5b00..812bfd0e36 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1787,6 +1787,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s diff --git a/patches/ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch b/patches/ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch index 33eef472..7da60739 100644 --- a/patches/ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch +++ b/patches/ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch @@ -1,4 +1,4 @@ -From fdee240e3485e3fb993b811f2bd47142b166fd8c Mon Sep 17 00:00:00 2001 +From c32fc6d0a84e857f17c1c51af9bab5aab6a5ff1e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" 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 2 files changed, 17 insertions(+) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index ee8ac6bd10..834fd8eacc 100644 +index 812bfd0e36..262d24b9d2 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -2023,6 +2023,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -2068,6 +2068,7 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc switch(buffer->ReparseTag) { case IO_REPARSE_TAG_MOUNT_POINT: diff --git a/patches/ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch b/patches/ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch index b7c0c52f..f5108871 100644 --- a/patches/ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch +++ b/patches/ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch @@ -1,4 +1,4 @@ -From 2251bc21739a0876f42085127d861e11df2cc953 Mon Sep 17 00:00:00 2001 +From 273149c2baf56e80063a33ebb5d143819a138436 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 12:16:49 -0600 Subject: ntdll: Add support for relative symlink creation. @@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover 3 files changed, 76 insertions(+), 13 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 834fd8eacc..4b9688c594 100644 +index 262d24b9d2..186156159c 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1656,16 +1656,19 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, diff --git a/patches/ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch b/patches/ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch index 7417de30..ccfaa672 100644 --- a/patches/ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch +++ b/patches/ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch @@ -1,4 +1,4 @@ -From 2a5bd75df6dcbbc28b821e0e70b022f32d6de424 Mon Sep 17 00:00:00 2001 +From 2618729bcbd286d60e0a80c3ad1ef840c58c5689 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 12:31:16 -0600 Subject: ntdll: Add support for reading relative symlinks. @@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 4b9688c594..0eb522bf1d 100644 +index 186156159c..8795eb6e9d 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1828,6 +1828,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s diff --git a/patches/ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch b/patches/ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch index 83fdf7a2..b2b2a237 100644 --- a/patches/ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch +++ b/patches/ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch @@ -1,16 +1,16 @@ -From 43b9fbb15b535717e2b8cb082330efd179acf321 Mon Sep 17 00:00:00 2001 +From 0cf6512a8532b065dc92d6ac16678dff180a1107 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 17:57:53 -0600 Subject: ntdll: Add support for file symlinks. Signed-off-by: Erich E. Hoover --- - dlls/ntdll/file.c | 11 ++++++++--- + dlls/ntdll/file.c | 27 ++++++++++++++++++++++----- dlls/ntdll/tests/file.c | 33 +++++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+), 3 deletions(-) + 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 0eb522bf1d..7c1a711fc3 100644 +index 8795eb6e9d..a9fe846e08 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1665,6 +1665,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) @@ -45,6 +45,52 @@ index 0eb522bf1d..7c1a711fc3 100644 } else if (errno == ENOSYS) { +@@ -1989,6 +1994,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) + BOOL tempdir_created = FALSE; + int dest_fd, needs_close; + ANSI_STRING unix_name; ++ BOOL is_dir = TRUE; + NTSTATUS status; + struct stat st; + +@@ -2000,12 +2006,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) + + TRACE("Deleting symlink %s\n", unix_name.Buffer); + +- /* Produce the directory in a temporary location in the same folder */ ++ /* Produce the file/directory in a temporary location in the same folder */ + if (fstat( dest_fd, &st ) == -1) + { + status = FILE_GetNtStatus(); + goto cleanup; + } ++ is_dir = S_ISDIR(st.st_mode); + strcpy( tmpdir, unix_name.Buffer ); + dirname( tmpdir) ; + strcat( tmpdir, "/.winelink.XXXXXX" ); +@@ -2017,11 +2024,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) + tempdir_created = TRUE; + strcpy( tmpfile, tmpdir ); + strcat( tmpfile, "/tmpfile" ); +- if (mkdir( tmpfile, st.st_mode )) ++ if (is_dir && mkdir( tmpfile, st.st_mode )) + { + status = FILE_GetNtStatus(); + goto cleanup; + } ++ else if (!is_dir) ++ { ++ int fd = open( tmpfile, O_CREAT|O_WRONLY|O_TRUNC, st.st_mode ); ++ if (fd < 0) ++ { ++ status = FILE_GetNtStatus(); ++ goto cleanup; ++ } ++ close( fd ); ++ } + /* attemp to retain the ownership (if possible) */ + lchown( tmpfile, st.st_uid, st.st_gid ); + /* Atomically move the directory into position */ diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index c13ee84bf0..f40dc1f51b 100644 --- a/dlls/ntdll/tests/file.c diff --git a/patches/ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch b/patches/ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch index 7abf269e..b946d1a2 100644 --- a/patches/ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch +++ b/patches/ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch @@ -1,21 +1,21 @@ -From 48fd8c19b8a0403c297c5bd0eade9cd5ef446305 Mon Sep 17 00:00:00 2001 +From 2ccff55de1a8e43f12fde63870b0d93ec63dd4ab Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 30 Mar 2019 12:00:51 -0600 -Subject: [PATCH] ntdll: Correctly report file symbolic links as files. +Subject: ntdll: Correctly report file symbolic links as files. Signed-off-by: Erich E. Hoover --- - dlls/ntdll/file.c | 110 +++++++++++++++++++++++++++++++++--------------- - dlls/ntdll/tests/file.c | 8 ++-- + dlls/ntdll/file.c | 110 +++++++++++++++++++++++++++------------- + dlls/ntdll/tests/file.c | 8 +-- 2 files changed, 79 insertions(+), 39 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 4e5bf46..6cb351b 100644 +index a9fe846e08..8ffd79ccbf 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -140,6 +140,9 @@ static inline int get_file_xattr( char *hexattr, int attrlen ) - return 0; - } +@@ -124,6 +124,9 @@ mode_t FILE_umask = 0; + + static const WCHAR ntfsW[] = {'N','T','F','S'}; +NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, USHORT *unix_dest_len, + DWORD *tag, ULONG *flags, BOOL *is_dir); @@ -23,7 +23,7 @@ index 4e5bf46..6cb351b 100644 /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) { -@@ -214,10 +217,14 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) +@@ -160,10 +163,14 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) if (ret == -1) return ret; if (S_ISLNK( st->st_mode )) { @@ -37,8 +37,8 @@ index 4e5bf46..6cb351b 100644 + st->st_mode = (st->st_mode & ~S_IFMT) | (is_dir ? S_IFDIR : S_IFREG); } *attr |= get_file_attributes( st ); - /* retrieve any stored DOS attributes */ -@@ -1920,48 +1927,34 @@ cleanup: + return ret; +@@ -1822,48 +1829,34 @@ cleanup: } @@ -102,7 +102,7 @@ index 4e5bf46..6cb351b 100644 p++; } if (*p++ != '/') -@@ -1969,7 +1962,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -1871,7 +1864,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s status = STATUS_NOT_IMPLEMENTED; goto cleanup; } @@ -111,7 +111,7 @@ index 4e5bf46..6cb351b 100644 for (i = 0; i < sizeof(ULONG)*8; i++) { char c = *p++; -@@ -1984,21 +1977,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -1886,21 +1879,68 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s status = STATUS_NOT_IMPLEMENTED; goto cleanup; } @@ -186,10 +186,10 @@ index 4e5bf46..6cb351b 100644 /* convert the relative path into an absolute path */ if (flags == SYMLINK_FLAG_RELATIVE) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 3f47c69..cecce37 100644 +index f40dc1f51b..f23bf8644c 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -5288,13 +5288,13 @@ static void test_reparse_points(void) +@@ -5069,13 +5069,13 @@ static void test_reparse_points(void) /* Check deleting a file symlink as if it were a directory */ bret = RemoveDirectoryW(reparse_path); @@ -205,7 +205,7 @@ index 3f47c69..cecce37 100644 ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: 0x%x)\n", dwret); /* Delete the symlink as a file */ -@@ -5303,10 +5303,10 @@ static void test_reparse_points(void) +@@ -5084,10 +5084,10 @@ static void test_reparse_points(void) /* Create a blank slate for directory symlink tests */ bret = CreateDirectoryW(reparse_path, NULL); @@ -219,5 +219,5 @@ index 3f47c69..cecce37 100644 /* Create the directory symlink */ HeapFree(GetProcessHeap(), 0, buffer); -- -1.9.1 +2.17.1 diff --git a/patches/ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch b/patches/ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch index bd123089..de51da4f 100644 --- a/patches/ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch +++ b/patches/ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch @@ -1,4 +1,4 @@ -From e57c2a438bf63fcab5686c8c7dbd4379dda1a49b Mon Sep 17 00:00:00 2001 +From 447ceb46b34604f8c72014b8516851e81850b4de Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 30 Mar 2019 12:01:50 -0600 Subject: kernel32: Set error code when attempting to delete file symlinks as diff --git a/patches/ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch b/patches/ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch index 5dd14e3c..44301710 100644 --- a/patches/ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch +++ b/patches/ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch @@ -1,19 +1,19 @@ -From 108acd429c44d9a06bab68ad66890ee6756264cc Mon Sep 17 00:00:00 2001 +From d6f127ccdc6bb2a2c74551bfae669a6eee55c312 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 30 Mar 2019 13:41:07 -0600 -Subject: [PATCH] server: Properly handle file symlink deletion. +Subject: server: Properly handle file symlink deletion. Signed-off-by: Erich E. Hoover --- - dlls/ntdll/tests/file.c | 6 ++--- - server/fd.c | 64 +++++++++++++++++++++++++++++++++++++++++++++---- + dlls/ntdll/tests/file.c | 6 ++-- + server/fd.c | 64 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 8800ab0..92ac697 100644 +index a1323ab4f6..8ab8a5da53 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -5299,14 +5299,14 @@ static void test_reparse_points(void) +@@ -5080,14 +5080,14 @@ static void test_reparse_points(void) /* Delete the symlink as a file */ bret = DeleteFileW(reparse_path); @@ -32,10 +32,10 @@ index 8800ab0..92ac697 100644 /* Create the directory symlink */ HeapFree(GetProcessHeap(), 0, buffer); diff --git a/server/fd.c b/server/fd.c -index 6c4cf61..58843d7 100644 +index 5d80e218b9..71347e4318 100644 --- a/server/fd.c +++ b/server/fd.c -@@ -1075,7 +1075,7 @@ static void inode_destroy( struct object *obj ) +@@ -1069,7 +1069,7 @@ static void inode_destroy( struct object *obj ) { /* make sure it is still the same file */ struct stat st; @@ -44,7 +44,7 @@ index 6c4cf61..58843d7 100644 { if (S_ISDIR(st.st_mode)) rmdir( fd->unix_name ); else unlink( fd->unix_name ); -@@ -1769,6 +1769,53 @@ char *dup_fd_name( struct fd *root, const char *name ) +@@ -1747,6 +1747,53 @@ char *dup_fd_name( struct fd *root, const char *name ) return ret; } @@ -98,12 +98,12 @@ index 6c4cf61..58843d7 100644 /* open() wrapper that returns a struct fd with no fd user set */ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, unsigned int access, unsigned int sharing, unsigned int options ) -@@ -1876,14 +1923,15 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1826,14 +1873,15 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, + closed_fd->unix_fd = fd->unix_fd; + closed_fd->unlink = 0; closed_fd->unix_name = fd->unix_name; - - if (do_chmod) chmod( name, *mode ); - fstat( fd->unix_fd, &st ); -+ fstatat( -1, fd->unix_name, &st, AT_SYMLINK_NOFOLLOW ); ++ lstat( fd->unix_name, &st ); *mode = st.st_mode; /* only bother with an inode for normal files and directories */ @@ -116,7 +116,7 @@ index 6c4cf61..58843d7 100644 if (!inode) { -@@ -1898,13 +1946,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1848,13 +1896,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, list_add_head( &inode->open, &fd->inode_entry ); closed_fd = NULL; @@ -139,5 +139,5 @@ index 6c4cf61..58843d7 100644 set_error( STATUS_FILE_IS_A_DIRECTORY ); goto error; -- -1.9.1 +2.17.1 diff --git a/patches/ntdll-Junction_Points/0016-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch b/patches/ntdll-Junction_Points/0016-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch index ad65710b..a991ed89 100644 --- a/patches/ntdll-Junction_Points/0016-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch +++ b/patches/ntdll-Junction_Points/0016-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch @@ -1,4 +1,4 @@ -From 0a6af701fbda3b10b709a33f811788d24552cb5f Mon Sep 17 00:00:00 2001 +From a4a9f0c9c9b4453a46d5060d0ec32b8f49cf19a1 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 16:02:05 -0600 Subject: kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse diff --git a/patches/ntdll-Junction_Points/definition b/patches/ntdll-Junction_Points/definition index 3f6031ea..1726a454 100644 --- a/patches/ntdll-Junction_Points/definition +++ b/patches/ntdll-Junction_Points/definition @@ -1,2 +1,2 @@ Fixes: [12401] Support for Junction Points -Depends: ntdll-NtQueryEaFile +#Depends: ntdll-NtQueryEaFile diff --git a/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch b/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch index da3e4f7d..5c0227e7 100644 --- a/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch +++ b/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch @@ -1,4 +1,4 @@ -From 7d5dfe000f83054692b919a07f60869bd350be83 Mon Sep 17 00:00:00 2001 +From db086c104124f1e6d06c5a492823f5e99c9095fe Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 6 Jun 2015 07:03:33 +0800 Subject: [PATCH] ntdll: Improve stub of NtQueryEaFile. @@ -10,10 +10,10 @@ Based on a patch by Qian Hong. 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 7c4eb91..c1de955 100644 +index 956c98a..c529b70 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -3426,14 +3426,25 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io +@@ -3936,14 +3936,25 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io * Success: 0. Atrributes read into buffer * Failure: An NTSTATUS error code describing the error. */ @@ -44,10 +44,10 @@ index 7c4eb91..c1de955 100644 diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 8f986f6..74adf4c 100644 +index a3513e2..79ba790 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c -@@ -84,6 +84,7 @@ static NTSTATUS (WINAPI *pNtQueryDirectoryFile)(HANDLE,HANDLE,PIO_APC_ROUTINE,PV +@@ -85,6 +85,7 @@ static NTSTATUS (WINAPI *pNtQueryDirectoryFile)(HANDLE,HANDLE,PIO_APC_ROUTINE,PV static NTSTATUS (WINAPI *pNtQueryVolumeInformationFile)(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS); static NTSTATUS (WINAPI *pNtQueryFullAttributesFile)(const OBJECT_ATTRIBUTES*, FILE_NETWORK_OPEN_INFORMATION*); static NTSTATUS (WINAPI *pNtFlushBuffersFile)(HANDLE, IO_STATUS_BLOCK*); @@ -55,7 +55,7 @@ index 8f986f6..74adf4c 100644 static WCHAR fooW[] = {'f','o','o',0}; -@@ -4901,6 +4902,86 @@ static void test_flush_buffers_file(void) +@@ -4925,6 +4926,86 @@ static void test_flush_buffers_file(void) DeleteFileA(buffer); } @@ -142,7 +142,7 @@ index 8f986f6..74adf4c 100644 static void test_file_readonly_access(void) { static const DWORD default_sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; -@@ -5009,6 +5090,7 @@ START_TEST(file) +@@ -5376,6 +5457,7 @@ START_TEST(file) pNtQueryVolumeInformationFile = (void *)GetProcAddress(hntdll, "NtQueryVolumeInformationFile"); pNtQueryFullAttributesFile = (void *)GetProcAddress(hntdll, "NtQueryFullAttributesFile"); pNtFlushBuffersFile = (void *)GetProcAddress(hntdll, "NtFlushBuffersFile"); @@ -150,11 +150,13 @@ index 8f986f6..74adf4c 100644 test_read_write(); test_NtCreateFile(); -@@ -5039,4 +5121,5 @@ START_TEST(file) +@@ -5405,6 +5487,7 @@ START_TEST(file) + test_query_volume_information_file(); test_query_attribute_information_file(); test_ioctl(); - test_flush_buffers_file(); + test_query_ea(); + test_flush_buffers_file(); + test_reparse_points(); } -- 1.9.1 diff --git a/patches/ntdll-NtQueryEaFile/definition b/patches/ntdll-NtQueryEaFile/definition index a8078de3..a86870c2 100644 --- a/patches/ntdll-NtQueryEaFile/definition +++ b/patches/ntdll-NtQueryEaFile/definition @@ -1,2 +1,3 @@ Fixes: Improve stub for NtQueryEaFile # Depends: ntdll-Syscall_Wrappers +Depends: ntdll-Junction_Points diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 537830bf..31457043 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -1792,6 +1792,13 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then enable_ntdll_User_Shared_Data=1 fi +if test "$enable_ntdll_NtQueryEaFile" -eq 1; then + if test "$enable_ntdll_Junction_Points" -gt 1; then + abort "Patchset ntdll-Junction_Points disabled, but ntdll-NtQueryEaFile depends on that." + fi + enable_ntdll_Junction_Points=1 +fi + if test "$enable_ntdll_NtContinue" -eq 1; then if test "$enable_winebuild_Fake_Dlls" -gt 1; then abort "Patchset winebuild-Fake_Dlls disabled, but ntdll-NtContinue depends on that." @@ -1827,13 +1834,6 @@ if test "$enable_ntdll_NtDevicePath" -eq 1; then enable_ntdll_Pipe_SpecialCharacters=1 fi -if test "$enable_ntdll_Junction_Points" -eq 1; then - if test "$enable_ntdll_NtQueryEaFile" -gt 1; then - abort "Patchset ntdll-NtQueryEaFile disabled, but ntdll-Junction_Points depends on that." - fi - enable_ntdll_NtQueryEaFile=1 -fi - if test "$enable_ntdll_HashLinks" -eq 1; then if test "$enable_ntdll_LDR_MODULE" -gt 1; then abort "Patchset ntdll-LDR_MODULE disabled, but ntdll-HashLinks depends on that." @@ -1880,6 +1880,9 @@ if test "$enable_eventfd_synchronization" -eq 1; then if test "$enable_advapi32_Token_Integrity_Level" -gt 1; then abort "Patchset advapi32-Token_Integrity_Level disabled, but eventfd_synchronization depends on that." fi + if test "$enable_ntdll_Junction_Points" -gt 1; then + abort "Patchset ntdll-Junction_Points disabled, but eventfd_synchronization depends on that." + fi if test "$enable_ntdll_RtlCreateUserThread" -gt 1; then abort "Patchset ntdll-RtlCreateUserThread disabled, but eventfd_synchronization depends on that." fi @@ -1902,6 +1905,7 @@ if test "$enable_eventfd_synchronization" -eq 1; then abort "Patchset ws2_32-WSACleanup disabled, but eventfd_synchronization depends on that." fi enable_advapi32_Token_Integrity_Level=1 + enable_ntdll_Junction_Points=1 enable_ntdll_RtlCreateUserThread=1 enable_ntdll_SystemRoot_Symlink=1 enable_ntdll_User_Shared_Data=1 @@ -3392,6 +3396,53 @@ if test "$enable_dxva2_Video_Decoder" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-Junction_Points +# | +# | This patchset fixes the following Wine bugs: +# | * [#12401] Support for Junction Points +# | +# | Modified files: +# | * configure.ac, dlls/kernel32/path.c, dlls/kernel32/tests/path.c, dlls/kernel32/volume.c, dlls/ntdll/file.c, +# | dlls/ntdll/tests/file.c, include/Makefile.in, include/ntifs.h, include/wine/port.h, libs/port/Makefile.in, +# | libs/port/renameat2.c, server/fd.c +# | +if test "$enable_ntdll_Junction_Points" -eq 1; then + patch_apply ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch + patch_apply ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch + patch_apply ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch + patch_apply ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch + patch_apply ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch + patch_apply ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch + patch_apply ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch + patch_apply ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch + patch_apply ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch + patch_apply ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch + patch_apply ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch + patch_apply ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch + patch_apply ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch + patch_apply ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch + patch_apply ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch + patch_apply ntdll-Junction_Points/0016-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 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting junction points.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add a test for junction point advertisement.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "kernel32,ntdll: Add support for deleting junction points with RemoveDirectory.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "kernel32: Advertise junction point support.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for absolute symlink creation.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading absolute symlinks.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting symlinks.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for relative symlink creation.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading relative symlinks.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for file symlinks.", 1 },'; + printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Correctly report file symbolic links as files.", 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", "kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse points.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-RtlCreateUserThread # | # | This patchset fixes the following Wine bugs: @@ -3646,10 +3697,10 @@ fi # Patchset eventfd_synchronization # | # | This patchset has the following (direct or indirect) dependencies: -# | * Staging, advapi32-CreateRestrictedToken, server-Misc_ACL, advapi32-Token_Integrity_Level, ntdll-RtlCreateUserThread, -# | ntdll-Exception, ntdll-SystemRoot_Symlink, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-User_Shared_Data, server- -# | Realtime_Priority, ntdll-Threading, ntdll-Wait_User_APC, server-Key_State, server-PeekMessage, server-Signal_Thread, -# | server-Shared_Memory, ws2_32-WSACleanup +# | * Staging, advapi32-CreateRestrictedToken, server-Misc_ACL, advapi32-Token_Integrity_Level, ntdll-Junction_Points, ntdll- +# | RtlCreateUserThread, ntdll-Exception, ntdll-SystemRoot_Symlink, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll- +# | User_Shared_Data, server-Realtime_Priority, ntdll-Threading, ntdll-Wait_User_APC, server-Key_State, server-PeekMessage, +# | server-Signal_Thread, server-Shared_Memory, ws2_32-WSACleanup # | # | This patchset fixes the following Wine bugs: # | * [#36692] Many multi-threaded applications have poor performance due to heavy use of synchronization primitives @@ -4676,68 +4727,6 @@ if test "$enable_ntdll_Interrupt_0x2e" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-NtQueryEaFile -# | -# | Modified files: -# | * dlls/ntdll/file.c, dlls/ntdll/tests/file.c -# | -if test "$enable_ntdll_NtQueryEaFile" -eq 1; then - patch_apply ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch - ( - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Improve stub of NtQueryEaFile.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset ntdll-Junction_Points -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-NtQueryEaFile -# | -# | This patchset fixes the following Wine bugs: -# | * [#12401] Support for Junction Points -# | -# | Modified files: -# | * configure.ac, dlls/kernel32/path.c, dlls/kernel32/tests/path.c, dlls/kernel32/volume.c, dlls/ntdll/file.c, -# | dlls/ntdll/tests/file.c, include/Makefile.in, include/ntifs.h, include/wine/port.h, libs/port/Makefile.in, -# | libs/port/renameat2.c, server/fd.c -# | -if test "$enable_ntdll_Junction_Points" -eq 1; then - patch_apply ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch - patch_apply ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch - patch_apply ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch - patch_apply ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch - patch_apply ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch - patch_apply ntdll-Junction_Points/0006-kernel32-Advertise-junction-point-support.patch - patch_apply ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch - patch_apply ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch - patch_apply ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch - patch_apply ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch - patch_apply ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch - patch_apply ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch - patch_apply ntdll-Junction_Points/0013-ntdll-Correctly-report-file-symbolic-links-as-files.patch - patch_apply ntdll-Junction_Points/0014-kernel32-Set-error-code-when-attempting-to-delete-fi.patch - patch_apply ntdll-Junction_Points/0015-server-Properly-handle-file-symlink-deletion.patch - patch_apply ntdll-Junction_Points/0016-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 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting junction points.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add a test for junction point advertisement.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "kernel32,ntdll: Add support for deleting junction points with RemoveDirectory.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "kernel32: Advertise junction point support.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for absolute symlink creation.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading absolute symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for relative symlink creation.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading relative symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for file symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Correctly report file symbolic links as files.", 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", "kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse points.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-Manifest_Range # | # | This patchset fixes the following Wine bugs: @@ -4916,6 +4905,21 @@ if test "$enable_ntdll_NtContinue" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-NtQueryEaFile +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-Junction_Points +# | +# | Modified files: +# | * dlls/ntdll/file.c, dlls/ntdll/tests/file.c +# | +if test "$enable_ntdll_NtQueryEaFile" -eq 1; then + patch_apply ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch + ( + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Improve stub of NtQueryEaFile.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-NtQuerySection # | # | Modified files: diff --git a/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch b/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch index 4c667e70..114ee306 100644 --- a/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch +++ b/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch @@ -1,21 +1,22 @@ -From d51c91b6f63c6ee874964726439285be8085ac7b Mon Sep 17 00:00:00 2001 +From 987c69eed0950c375af8eeb97dda539f9a636677 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:58:47 +0200 -Subject: server: Allow to open files without any permission bits. (try 2) +Subject: [PATCH] server: Allow to open files without any permission bits. (try + 2) Changes in v2: * As suggested by Piotr, fix the problem for both files and directories. * Pay attention to requested access attributes - this fixes a couple more todo_wine's. --- dlls/advapi32/tests/security.c | 32 ++++++++++++-------------------- - server/fd.c | 21 +++++++++++++++++++++ - 2 files changed, 33 insertions(+), 20 deletions(-) + server/fd.c | 20 ++++++++++++++++++++ + 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index cf104ab..c517f85 100644 +index 56251db..a5ab606 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c -@@ -3548,17 +3548,13 @@ static void test_CreateDirectoryA(void) +@@ -3718,17 +3718,13 @@ static void test_CreateDirectoryA(void) error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, (PSID *)&owner, NULL, &pDacl, NULL, &pSD); @@ -39,7 +40,7 @@ index cf104ab..c517f85 100644 CloseHandle(hTemp); /* Test inheritance of ACLs in NtCreateFile without security descriptor */ -@@ -3628,17 +3624,13 @@ static void test_CreateDirectoryA(void) +@@ -3798,17 +3794,13 @@ static void test_CreateDirectoryA(void) error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, (PSID *)&owner, NULL, &pDacl, NULL, &pSD); @@ -64,10 +65,10 @@ index cf104ab..c517f85 100644 done: diff --git a/server/fd.c b/server/fd.c -index 77c7026..f331606 100644 +index ac046c9..770cc0d 100644 --- a/server/fd.c +++ b/server/fd.c -@@ -1755,6 +1755,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1817,6 +1817,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, struct fd *fd; int root_fd = -1; int rw_mode; @@ -75,7 +76,7 @@ index 77c7026..f331606 100644 int created = (flags & O_CREAT); if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) || -@@ -1816,10 +1817,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1878,10 +1879,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 ); } @@ -104,15 +105,14 @@ index 77c7026..f331606 100644 goto error; } } -@@ -1827,6 +1846,8 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1889,6 +1908,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, closed_fd->unix_fd = fd->unix_fd; closed_fd->unlink = 0; closed_fd->unix_name = fd->unix_name; -+ + if (do_chmod) chmod( name, *mode ); - fstat( fd->unix_fd, &st ); + lstat( fd->unix_name, &st ); *mode = st.st_mode; -- -2.9.0 +1.9.1