From 89c049ee68fdbbd4854a3dd2df03c9562bd0c085 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 5 Mar 2021 21:27:36 -0600 Subject: [PATCH] ntdll-Junction_Points: Updates from Erich E. Hoover. --- ...-support-for-junction-point-creation.patch | 12 +++--- ...-support-for-reading-junction-points.patch | 8 ++-- ...support-for-deleting-junction-points.patch | 8 ++-- ...est-for-junction-point-advertisement.patch | 2 +- ...rt-for-deleting-junction-points-with.patch | 2 +- ...l32-Advertise-junction-point-support.patch | 2 +- ...upport-for-absolute-symlink-creation.patch | 24 ++++++------ ...upport-for-reading-absolute-symlinks.patch | 10 ++--- ...ll-Add-support-for-deleting-symlinks.patch | 6 +-- ...upport-for-relative-symlink-creation.patch | 16 ++++---- ...upport-for-reading-relative-symlinks.patch | 8 ++-- ...-ntdll-Add-support-for-file-symlinks.patch | 37 +++++++++---------- ...tion-of-dangling-reparse-points-to-n.patch | 26 +++++++++---- ...-report-file-symbolic-links-as-files.patch | 18 +++++---- ...rt-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch | 2 +- ...ement-FILE_OPEN_REPARSE_POINT-option.patch | 2 +- ...file_times_precise-to-work-on-repars.patch | 8 ++-- ...roperly-handle-file-symlink-deletion.patch | 2 +- ...ly-handle-deleting-dangling-symlinks.patch | 2 +- ...ILE_OPEN_REPARSE_POINT-in-RemoveDire.patch | 2 +- ...ort-symbolic-links-as-containing-zer.patch | 4 +- ...ntdll-Find-dangling-symlinks-quickly.patch | 10 ++--- ...nt-CreateSymbolicLink-A-W-with-ntdll.patch | 2 +- ...-Add-reparse-support-to-FindNextFile.patch | 2 +- ...arse-point-type-in-directory-listing.patch | 2 +- ...se-point-target-in-directory-listing.patch | 2 +- ...Add-junction-point-support-to-mklink.patch | 2 +- ...btaining-information-about-a-symlink.patch | 18 ++++----- ...th-no-data-for-NtReadFile-on-reparse.patch | 6 +-- ...parse-point-properties-in-fd_get_fil.patch | 19 ++++++---- ...port-for-FileAttributeTagInformation.patch | 13 ++++--- ...ly-handle-renames-involving-symlinks.patch | 2 +- ...ILE_OPEN_REPARSE_POINT-in-MoveFileWi.patch | 2 +- ...ILE_OPEN_REPARSE_POINT-in-DeleteFile.patch | 2 +- ...decoded-unix-symlinks-as-NT-symlinks.patch | 18 ++++----- ...wine-prefix-from-reparse-point-paths.patch | 8 ++-- ...er-to-reparse-point-paths-to-indicat.patch | 8 ++-- ...bsolute-reparse-point-targets-if-the.patch | 2 +- 38 files changed, 167 insertions(+), 152 deletions(-) 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 587fc26d..9453749f 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,4 +1,4 @@ -From 5b5d3c574a0586bf6690db9957dbe6708a8801ec Mon Sep 17 00:00:00 2001 +From 719f4d5ab7ba2b2e9f3797dfce0370fa5cba5a66 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. @@ -14,10 +14,10 @@ Signed-off-by: Erich E. Hoover create mode 100644 include/ntifs.h diff --git a/configure.ac b/configure.ac -index 0510b47963a..26af8a0a4b7 100644 +index ce6bad68f68..11f57d13274 100644 --- a/configure.ac +++ b/configure.ac -@@ -2216,6 +2216,8 @@ AC_CHECK_FUNCS(\ +@@ -2218,6 +2218,8 @@ AC_CHECK_FUNCS(\ proc_pidinfo \ pwrite \ readlink \ @@ -152,7 +152,7 @@ index 498da270a34..792c07b0d8e 100644 test_mailslot_name(); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index e9d88320bc2..a5b3d5090aa 100644 +index a4728003cf8..ea9c0d811f5 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -36,6 +36,7 @@ @@ -215,7 +215,7 @@ index e9d88320bc2..a5b3d5090aa 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 ) { -@@ -5840,6 +5872,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, +@@ -5806,6 +5838,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, } @@ -332,7 +332,7 @@ index e9d88320bc2..a5b3d5090aa 100644 /****************************************************************************** * NtFsControlFile (NTDLL.@) */ -@@ -5922,6 +6064,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -5888,6 +6030,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap break; } 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 8c72c17c..d68a0a8c 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 115fc2745111b35ae65ea5c046428b93655d0a65 Mon Sep 17 00:00:00 2001 +From ba7660d29357412b0a12475dacd1d96da9d5679c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 20:57:57 -0700 Subject: [PATCH] ntdll: Add support for reading junction points. @@ -44,10 +44,10 @@ index 792c07b0d8e..88e114ab7a2 100644 cleanup: diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index a5b3d5090aa..13cc797e54e 100644 +index ea9c0d811f5..6389e7c8f20 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5982,6 +5982,120 @@ cleanup: +@@ -5948,6 +5948,120 @@ cleanup: } @@ -168,7 +168,7 @@ index a5b3d5090aa..13cc797e54e 100644 /****************************************************************************** * NtFsControlFile (NTDLL.@) */ -@@ -6064,6 +6178,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6030,6 +6144,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap break; } 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 b9c3fb69..b578c2b6 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,4 +1,4 @@ -From 0a6eefc1c56cad4d75aa9a1384a94f2fd2d8bec9 Mon Sep 17 00:00:00 2001 +From 7554efacce44c930a981312bcf341b74e896fc17 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:00:21 -0700 Subject: [PATCH] ntdll: Add support for deleting junction points. @@ -72,10 +72,10 @@ index 88e114ab7a2..0dcefdef97b 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 13cc797e54e..28191fb9258 100644 +index 6389e7c8f20..982df84d029 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -6096,6 +6096,87 @@ cleanup: +@@ -6062,6 +6062,87 @@ cleanup: } @@ -163,7 +163,7 @@ index 13cc797e54e..28191fb9258 100644 /****************************************************************************** * NtFsControlFile (NTDLL.@) */ -@@ -6178,6 +6259,22 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6144,6 +6225,22 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap 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 a1f430d7..fbfa538a 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 68608b8100a07e22e873bc07dfd71bca128195f0 Mon Sep 17 00:00:00 2001 +From c0fe3802d5baca7d4048abfca0dcc261fb63ad2c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:01:25 -0700 Subject: [PATCH] ntdll: Add a test for junction point advertisement. diff --git a/patches/ntdll-Junction_Points/0005-server-Add-support-for-deleting-junction-points-with.patch b/patches/ntdll-Junction_Points/0005-server-Add-support-for-deleting-junction-points-with.patch index d835856d..d4424ae1 100644 --- a/patches/ntdll-Junction_Points/0005-server-Add-support-for-deleting-junction-points-with.patch +++ b/patches/ntdll-Junction_Points/0005-server-Add-support-for-deleting-junction-points-with.patch @@ -1,4 +1,4 @@ -From b56a57487422e65693d0308ac2a0683ec7bb21ce Mon Sep 17 00:00:00 2001 +From 55571cb23f81d2d5836c69793d5621f09f535009 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:02:11 -0700 Subject: [PATCH] server: 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 212940c7..82e342ca 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 1b9189f1aecf65f2ab73b5e26a1707e11c7d1926 Mon Sep 17 00:00:00 2001 +From 2086a18555c0c4111c48676af90c642828ce87f5 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 12 Dec 2020 17:28:31 -0700 Subject: [PATCH] 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 ef966443..41934567 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 572dccf8ef60557faa7ccf3495940d22487de7c1 Mon Sep 17 00:00:00 2001 +From 7e61f5b75c7bebded9476d271e5a1377a63938b1 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 21:06:24 -0700 Subject: [PATCH] ntdll: Add support for absolute symlink creation. @@ -6,9 +6,9 @@ Subject: [PATCH] ntdll: Add support for absolute symlink creation. Signed-off-by: Erich E. Hoover --- dlls/ntdll/tests/file.c | 117 ++++++++++++++++++++++++++++++++++------ - dlls/ntdll/unix/file.c | 35 ++++++++++-- + dlls/ntdll/unix/file.c | 33 ++++++++++-- include/ntifs.h | 10 ++++ - 3 files changed, 143 insertions(+), 19 deletions(-) + 3 files changed, 141 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 5882793c883..53a24574eec 100644 @@ -193,10 +193,10 @@ index 5882793c883..53a24574eec 100644 } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 28191fb9258..25b26d963ef 100644 +index 982df84d029..11a7269c09e 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5879,18 +5879,34 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, +@@ -5845,18 +5845,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,26 +234,24 @@ index 28191fb9258..25b26d963ef 100644 if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL ))) return status; -@@ -5925,6 +5941,18 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5891,6 +5907,16 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) strcat( magic_dest, "." ); strcat( magic_dest, "/" ); } + /* Encode the type (file or directory) if NT symlink */ + if (buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) + { -+ if (fstat( dest_fd, &st ) == -1) -+ { -+ status = errno_to_status( errno ); -+ goto cleanup; -+ } -+ if (S_ISDIR(st.st_mode)) ++ BOOL is_dir = FALSE; /* treat dangling symlinks as files */ ++ if (!stat( unix_dest, &st )) ++ is_dir = S_ISDIR(st.st_mode); ++ if (is_dir) + strcat( magic_dest, "." ); + strcat( magic_dest, "/" ); + } strcat( magic_dest, unix_dest ); /* Produce the link in a temporary location in the same folder */ -@@ -6288,6 +6316,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6254,6 +6280,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap 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 8836764e..12fe108f 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 f65a80d742f049407acfb3fb6bccf9e037fcbcf9 Mon Sep 17 00:00:00 2001 +From 59ba8b3a0f29945da7e1f082b197ce398bf442f2 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 12:55:20 -0600 Subject: [PATCH] ntdll: Add support for reading absolute symlinks. @@ -41,10 +41,10 @@ index 53a24574eec..9a6f72cb783 100644 /* Cleanup */ pRtlFreeUnicodeString(&nameW); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 25b26d963ef..c8b04601efa 100644 +index 11a7269c09e..19a2d0ae471 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -6024,6 +6024,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -5988,6 +5988,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 25b26d963ef..c8b04601efa 100644 WCHAR *nt_dest; INT prefix_len; ssize_t ret; -@@ -6068,6 +6069,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6032,6 +6033,17 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s } buffer->ReparseTag |= (val << i); } @@ -70,7 +70,7 @@ index 25b26d963ef..c8b04601efa 100644 unix_dest_len -= (p - unix_dest); memmove(unix_dest, p, unix_dest_len); unix_dest[unix_dest_len] = 0; -@@ -6101,6 +6113,16 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6065,6 +6077,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; 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 b2be5bed..8ada4832 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 1916474827593c822e41141d6e928001b408ee92 Mon Sep 17 00:00:00 2001 +From a563404dcdc796241cb83da788c5ac62dfe1fc17 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 13:02:22 -0600 Subject: [PATCH] ntdll: Add support for deleting symlinks. @@ -37,10 +37,10 @@ index 9a6f72cb783..dd21083ebbb 100644 cleanup: diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index c8b04601efa..af01a1646c5 100644 +index 19a2d0ae471..4e16db830d2 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -6316,6 +6316,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6280,6 +6280,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap 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 3d51ec1b..c14db982 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 0fe1cf1db4e5115170a225596688b12bed103fe2 Mon Sep 17 00:00:00 2001 +From b5698ce1750769a0b57372be14bf4efb5f1c872c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 12:16:49 -0600 Subject: [PATCH] ntdll: Add support for relative symlink creation. @@ -101,10 +101,10 @@ index dd21083ebbb..8ed749cfe33 100644 /* Cleanup */ pRtlFreeUnicodeString(&nameW); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index af01a1646c5..28862eff52e 100644 +index 4e16db830d2..45aab990fb5 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5878,17 +5878,20 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, +@@ -5844,17 +5844,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 af01a1646c5..28862eff52e 100644 int i; switch(buffer->ReparseTag) -@@ -5897,11 +5900,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5863,11 +5866,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 af01a1646c5..28862eff52e 100644 break; default: return STATUS_NOT_IMPLEMENTED; -@@ -5913,8 +5918,66 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5879,8 +5884,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 af01a1646c5..28862eff52e 100644 for (;;) { unix_dest = malloc( unix_dest_len ); -@@ -5930,11 +5993,24 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5896,11 +5959,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 af01a1646c5..28862eff52e 100644 for (i = 0; i < sizeof(ULONG)*8; i++) { if ((buffer->ReparseTag >> i) & 1) -@@ -5953,7 +6029,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5917,7 +5993,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) strcat( magic_dest, "." ); strcat( magic_dest, "/" ); } @@ -246,7 +246,7 @@ index af01a1646c5..28862eff52e 100644 /* Produce the link in a temporary location in the same folder */ strcpy( tmpdir, unix_src ); -@@ -6003,7 +6079,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5967,7 +6043,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) cleanup: if (tempdir_created) rmdir( tmpdir ); 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 1ffa3413..839d081d 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 dccfec5e07225d3be4ff653d294a4d49a3663c34 Mon Sep 17 00:00:00 2001 +From 26b27a370a0fac1344dc6f480648d6698a10876e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 12:31:16 -0600 Subject: [PATCH] ntdll: Add support for reading relative symlinks. @@ -38,10 +38,10 @@ index 8ed749cfe33..bdc1a151b45 100644 /* Cleanup */ pRtlFreeUnicodeString(&nameW); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 28862eff52e..1554d19cc01 100644 +index 45aab990fb5..522cc38f2fc 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -6125,6 +6125,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6089,6 +6089,11 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s /* Decode the reparse tag from the symlink */ p = unix_dest; @@ -53,7 +53,7 @@ index 28862eff52e..1554d19cc01 100644 if (*p++ != '/') { status = STATUS_NOT_IMPLEMENTED; -@@ -6162,24 +6167,47 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6126,24 +6131,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; 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 b577642f..a28b5567 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,4 +1,4 @@ -From faa53ece23717100c6d2ae407e8871576c3bb3f6 Mon Sep 17 00:00:00 2001 +From 9dd02015d50ecfdf378fe5cced2697f50eb56794 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 11 Apr 2019 17:57:53 -0600 Subject: [PATCH] ntdll: Add support for file symlinks. @@ -6,8 +6,8 @@ Subject: [PATCH] ntdll: Add support for file symlinks. Signed-off-by: Erich E. Hoover --- dlls/ntdll/tests/file.c | 29 +++++++++++++++++++++++++++++ - dlls/ntdll/unix/file.c | 27 ++++++++++++++++++++++----- - 2 files changed, 51 insertions(+), 5 deletions(-) + dlls/ntdll/unix/file.c | 26 +++++++++++++++++++++----- + 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index bdc1a151b45..8938c5bf50c 100644 @@ -50,10 +50,10 @@ index bdc1a151b45..8938c5bf50c 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 1554d19cc01..d7b65399e64 100644 +index 522cc38f2fc..0655371dc66 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5888,6 +5888,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5854,6 +5854,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) int relative_offset = 0; UNICODE_STRING nt_dest; int dest_len, offset; @@ -61,17 +61,16 @@ index 1554d19cc01..d7b65399e64 100644 NTSTATUS status; struct stat st; WCHAR *dest; -@@ -6025,7 +6026,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) - status = errno_to_status( errno ); - goto cleanup; - } -- if (S_ISDIR(st.st_mode)) -+ is_dir = S_ISDIR(st.st_mode); -+ if (is_dir) - strcat( magic_dest, "." ); - strcat( magic_dest, "/" ); - } -@@ -6052,8 +6054,11 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5986,7 +5987,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) + /* Encode the type (file or directory) if NT symlink */ + if (buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) + { +- BOOL is_dir = FALSE; /* treat dangling symlinks as files */ ++ is_dir = FALSE; /* treat dangling symlinks as files */ + if (!stat( unix_dest, &st )) + is_dir = S_ISDIR(st.st_mode); + if (is_dir) +@@ -6016,8 +6017,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 +84,7 @@ index 1554d19cc01..d7b65399e64 100644 } else if (errno == ENOSYS) { -@@ -6261,6 +6266,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +@@ -6225,6 +6229,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 +92,7 @@ index 1554d19cc01..d7b65399e64 100644 NTSTATUS status; char *unix_name; struct stat st; -@@ -6273,12 +6279,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +@@ -6237,12 +6242,13 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) TRACE( "Deleting symlink %s\n", unix_name ); @@ -108,7 +107,7 @@ index 1554d19cc01..d7b65399e64 100644 strcpy( tmpdir, unix_name ); d = dirname( tmpdir); if (d != tmpdir) strcpy( tmpdir, d ); -@@ -6291,11 +6298,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +@@ -6255,11 +6261,21 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) tempdir_created = TRUE; strcpy( tmpfile, tmpdir ); strcat( tmpfile, "/tmpfile" ); diff --git a/patches/ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch b/patches/ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch index ae1bd69b..dc67500f 100644 --- a/patches/ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch +++ b/patches/ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch @@ -1,4 +1,4 @@ -From 7a18980361dcbf958d1f5b1c614758283bc1e1cc Mon Sep 17 00:00:00 2001 +From ba365806d06a93493f1f91d6ca8ab3676a513136 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Tue, 30 Apr 2019 16:24:54 -0600 Subject: [PATCH] ntdll: Allow creation of dangling reparse points to @@ -6,15 +6,25 @@ Subject: [PATCH] ntdll: Allow creation of dangling reparse points to Signed-off-by: Erich E. Hoover --- - dlls/ntdll/unix/file.c | 15 ++++++++++++++- + dlls/ntdll/unix/file.c | 18 ++++++++++++++++-- include/winternl.h | 1 + - 2 files changed, 15 insertions(+), 1 deletion(-) + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index d7b65399e64..d08f6813d28 100644 +index 0655371dc66..a9fcf6cc444 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -3432,6 +3432,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer +@@ -3378,7 +3378,8 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer + /* if this is the last element, not finding it is not necessarily fatal */ + if (!name_len) + { +- if (status == STATUS_OBJECT_PATH_NOT_FOUND) ++ if (status == STATUS_OBJECT_PATH_NOT_FOUND ++ || (disposition == FILE_WINE_PATH && status == STATUS_OBJECT_NAME_NOT_FOUND)) + { + status = STATUS_OBJECT_NAME_NOT_FOUND; + if (disposition != FILE_OPEN && disposition != FILE_OVERWRITE) +@@ -3398,6 +3399,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer status = STATUS_OBJECT_NAME_COLLISION; } } @@ -34,7 +44,7 @@ index d7b65399e64..d08f6813d28 100644 if (status != STATUS_SUCCESS) break; -@@ -5987,7 +6000,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5953,7 +5967,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) status = STATUS_NO_MEMORY; goto cleanup; } @@ -44,10 +54,10 @@ index d7b65399e64..d08f6813d28 100644 free( unix_dest ); } diff --git a/include/winternl.h b/include/winternl.h -index f0ab223ef2e..b804436ee98 100644 +index d35d509eb41..561a83bd648 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2268,6 +2268,7 @@ typedef struct _RTL_ATOM_TABLE +@@ -2513,6 +2513,7 @@ typedef struct _RTL_ATOM_TABLE #define FILE_OVERWRITE 4 #define FILE_OVERWRITE_IF 5 #define FILE_MAXIMUM_DISPOSITION 5 diff --git a/patches/ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch b/patches/ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch index 29ab6dfd..84a3fef4 100644 --- a/patches/ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch +++ b/patches/ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch @@ -1,15 +1,15 @@ -From e7429fc51d2bf337cccf3016e923ebea0326e2fd Mon Sep 17 00:00:00 2001 +From 30353100c8647bd85bdf53fe95ccc039ca3ee867 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. Signed-off-by: Erich E. Hoover --- - dlls/ntdll/unix/file.c | 113 +++++++++++++++++++++++++++-------------- - 1 file changed, 76 insertions(+), 37 deletions(-) + dlls/ntdll/unix/file.c | 115 +++++++++++++++++++++++++++-------------- + 1 file changed, 77 insertions(+), 38 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index d08f6813d28..a992c66504a 100644 +index a9fcf6cc444..5d41919267e 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1612,6 +1612,9 @@ static inline int get_file_xattr( char *hexattr, int attrlen ) @@ -42,7 +42,7 @@ index d08f6813d28..a992c66504a 100644 } else if (S_ISDIR( st->st_mode ) && (parent_path = malloc( strlen(path) + 4 ))) { -@@ -6106,46 +6114,34 @@ cleanup: +@@ -6070,46 +6078,35 @@ cleanup: } @@ -93,6 +93,7 @@ index d08f6813d28..a992c66504a 100644 } - unix_dest_len = ret; + len = ret; ++ tmp[len] = 0; /* Decode the reparse tag from the symlink */ - p = unix_dest; @@ -104,7 +105,7 @@ index d08f6813d28..a992c66504a 100644 p++; } if (*p++ != '/') -@@ -6153,7 +6149,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6117,7 +6114,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s status = STATUS_NOT_IMPLEMENTED; goto cleanup; } @@ -113,7 +114,7 @@ index d08f6813d28..a992c66504a 100644 for (i = 0; i < sizeof(ULONG)*8; i++) { char c = *p++; -@@ -6168,21 +6164,64 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6132,22 +6129,64 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s status = STATUS_NOT_IMPLEMENTED; goto cleanup; } @@ -139,6 +140,7 @@ index d08f6813d28..a992c66504a 100644 } - unix_dest_len -= (p - unix_dest); - memmove(unix_dest, p, unix_dest_len); +- unix_dest[unix_dest_len] = 0; + else + dir_flag = TRUE; + len -= (p - tmp); @@ -180,9 +182,9 @@ index d08f6813d28..a992c66504a 100644 + + if ((status = FILE_DecodeSymlink( unix_src, unix_dest, &unix_dest_len, &buffer->ReparseTag, &flags, NULL ))) + goto cleanup; - unix_dest[unix_dest_len] = 0; /* convert the relative path into an absolute path */ + if (flags == SYMLINK_FLAG_RELATIVE) -- 2.20.1 diff --git a/patches/ntdll-Junction_Points/0015-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch b/patches/ntdll-Junction_Points/0015-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch index 61cc0232..45de43fd 100644 --- a/patches/ntdll-Junction_Points/0015-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch +++ b/patches/ntdll-Junction_Points/0015-kernelbase-Convert-FILE_FLAG_OPEN_REPARSE_POINT-for-.patch @@ -1,4 +1,4 @@ -From 6d623ff7c29b1913b89681993a2dd63627312928 Mon Sep 17 00:00:00 2001 +From 17a86aec0579d7632eaa718800d51cdda191a4b4 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sun, 22 Nov 2020 22:35:50 -0700 Subject: [PATCH] kernelbase: Convert FILE_FLAG_OPEN_REPARSE_POINT for passing diff --git a/patches/ntdll-Junction_Points/0016-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch b/patches/ntdll-Junction_Points/0016-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch index d8b9751c..882922e7 100644 --- a/patches/ntdll-Junction_Points/0016-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch +++ b/patches/ntdll-Junction_Points/0016-server-Implement-FILE_OPEN_REPARSE_POINT-option.patch @@ -1,4 +1,4 @@ -From e95940380071fe812b54e5d92078d92993b8c21d Mon Sep 17 00:00:00 2001 +From 663544d9d76dcd9d9338528a41a4e58343a8fc75 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 12 Dec 2020 16:54:28 -0700 Subject: [PATCH] server: Implement FILE_OPEN_REPARSE_POINT option. diff --git a/patches/ntdll-Junction_Points/0017-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch b/patches/ntdll-Junction_Points/0017-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch index 725e1642..66309313 100644 --- a/patches/ntdll-Junction_Points/0017-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch +++ b/patches/ntdll-Junction_Points/0017-ntdll-Allow-set_file_times_precise-to-work-on-repars.patch @@ -1,4 +1,4 @@ -From ecba21139cff9cf2ec15377252b7c7f4b8ee217e Mon Sep 17 00:00:00 2001 +From 9303f780842e09a09c2e7d0a763cdd93f4289b8a Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sun, 22 Nov 2020 22:37:33 -0700 Subject: [PATCH] ntdll: Allow set_file_times_precise to work on reparse @@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Allow set_file_times_precise to work on reparse 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac -index 26af8a0a4b7..ea5d767ab9a 100644 +index 11f57d13274..eea5847c51f 100644 --- a/configure.ac +++ b/configure.ac -@@ -2224,7 +2224,8 @@ AC_CHECK_FUNCS(\ +@@ -2226,7 +2226,8 @@ AC_CHECK_FUNCS(\ sigprocmask \ symlink \ tcdrain \ @@ -65,7 +65,7 @@ index 59f10ea8cce..8938c5bf50c 100644 CloseHandle(handle); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index a992c66504a..4355f1ac473 100644 +index 5d41919267e..4fb5afc2755 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1737,6 +1737,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) diff --git a/patches/ntdll-Junction_Points/0018-server-Properly-handle-file-symlink-deletion.patch b/patches/ntdll-Junction_Points/0018-server-Properly-handle-file-symlink-deletion.patch index 9f32f3ef..024741e2 100644 --- a/patches/ntdll-Junction_Points/0018-server-Properly-handle-file-symlink-deletion.patch +++ b/patches/ntdll-Junction_Points/0018-server-Properly-handle-file-symlink-deletion.patch @@ -1,4 +1,4 @@ -From a7d722fea77ebfea46c9ad70a8e452251c1b2ca6 Mon Sep 17 00:00:00 2001 +From b17dd0d9dbfe6aff1654c1b8fe49019d5f97d139 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. diff --git a/patches/ntdll-Junction_Points/0019-server-Properly-handle-deleting-dangling-symlinks.patch b/patches/ntdll-Junction_Points/0019-server-Properly-handle-deleting-dangling-symlinks.patch index 0cb54626..e8515677 100644 --- a/patches/ntdll-Junction_Points/0019-server-Properly-handle-deleting-dangling-symlinks.patch +++ b/patches/ntdll-Junction_Points/0019-server-Properly-handle-deleting-dangling-symlinks.patch @@ -1,4 +1,4 @@ -From cd8b189a3be04bcda04481f790be20d624eaaf02 Mon Sep 17 00:00:00 2001 +From 879b893a5429ba4aa0ced3fdefd284dcca0b0a7d Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 12 Dec 2020 17:40:27 -0700 Subject: [PATCH] server: Properly handle deleting dangling symlinks. diff --git a/patches/ntdll-Junction_Points/0020-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-RemoveDire.patch b/patches/ntdll-Junction_Points/0020-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-RemoveDire.patch index d63f1bd2..b26c8377 100644 --- a/patches/ntdll-Junction_Points/0020-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-RemoveDire.patch +++ b/patches/ntdll-Junction_Points/0020-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-RemoveDire.patch @@ -1,4 +1,4 @@ -From b43f01caa40215a41a135995adaebbde2bc619a1 Mon Sep 17 00:00:00 2001 +From b5c33b762b57ac73bc374e8aea6199730524ea59 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 12 Dec 2020 17:35:21 -0700 Subject: [PATCH] kernelbase: Use FILE_OPEN_REPARSE_POINT in diff --git a/patches/ntdll-Junction_Points/0021-ntdll-Always-report-symbolic-links-as-containing-zer.patch b/patches/ntdll-Junction_Points/0021-ntdll-Always-report-symbolic-links-as-containing-zer.patch index 5eec6839..55a57bea 100644 --- a/patches/ntdll-Junction_Points/0021-ntdll-Always-report-symbolic-links-as-containing-zer.patch +++ b/patches/ntdll-Junction_Points/0021-ntdll-Always-report-symbolic-links-as-containing-zer.patch @@ -1,4 +1,4 @@ -From 5aa006dcd294a7cff1c9cc9572f906280cd7ffb5 Mon Sep 17 00:00:00 2001 +From 4bbc98949eb154de067f68188bb2c2702782c48c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 1 May 2019 12:06:20 -0600 Subject: [PATCH] ntdll: Always report symbolic links as containing zero bytes. @@ -96,7 +96,7 @@ index c5c186748b6..fb168549641 100644 /* Create the directory symlink */ HeapFree(GetProcessHeap(), 0, buffer); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 4355f1ac473..1775ec24fe5 100644 +index 4fb5afc2755..f77e64ee6b4 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1703,6 +1703,8 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) diff --git a/patches/ntdll-Junction_Points/0022-ntdll-Find-dangling-symlinks-quickly.patch b/patches/ntdll-Junction_Points/0022-ntdll-Find-dangling-symlinks-quickly.patch index 0ddccf4d..5b901090 100644 --- a/patches/ntdll-Junction_Points/0022-ntdll-Find-dangling-symlinks-quickly.patch +++ b/patches/ntdll-Junction_Points/0022-ntdll-Find-dangling-symlinks-quickly.patch @@ -1,4 +1,4 @@ -From b4aee2ec695bb6de8798f9bb824ff9d816111654 Mon Sep 17 00:00:00 2001 +From fdbd1834e06f2476c2798613e45f764e5eba8f9d Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 1 May 2019 17:48:51 -0600 Subject: [PATCH] ntdll: Find dangling symlinks quickly. @@ -12,10 +12,10 @@ Signed-off-by: Erich E. Hoover 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 1775ec24fe5..712b0196f05 100644 +index f77e64ee6b4..0de80ebee7b 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -2716,7 +2716,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i +@@ -2715,7 +2715,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 1775ec24fe5..712b0196f05 100644 { if (is_win_dir) *is_win_dir = is_same_file( &windir, &st ); return STATUS_SUCCESS; -@@ -2820,7 +2820,7 @@ not_found: +@@ -2819,7 +2819,7 @@ not_found: return STATUS_OBJECT_PATH_NOT_FOUND; success: @@ -33,7 +33,7 @@ index 1775ec24fe5..712b0196f05 100644 return STATUS_SUCCESS; } -@@ -3393,7 +3393,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer +@@ -3359,7 +3359,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 ))) { diff --git a/patches/ntdll-Junction_Points/0023-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch b/patches/ntdll-Junction_Points/0023-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch index f8b775fe..05941a09 100644 --- a/patches/ntdll-Junction_Points/0023-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch +++ b/patches/ntdll-Junction_Points/0023-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch @@ -1,4 +1,4 @@ -From cfb87d4a7081fe17596ca63cfdb15671462d9e74 Mon Sep 17 00:00:00 2001 +From 36d6dca595e1db08be515989d741ccd512a662a3 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 13 Mar 2019 16:02:05 -0600 Subject: [PATCH] kernel32: Implement CreateSymbolicLink[A|W] with ntdll diff --git a/patches/ntdll-Junction_Points/0024-kernel32-Add-reparse-support-to-FindNextFile.patch b/patches/ntdll-Junction_Points/0024-kernel32-Add-reparse-support-to-FindNextFile.patch index 978a3f6c..e09516c7 100644 --- a/patches/ntdll-Junction_Points/0024-kernel32-Add-reparse-support-to-FindNextFile.patch +++ b/patches/ntdll-Junction_Points/0024-kernel32-Add-reparse-support-to-FindNextFile.patch @@ -1,4 +1,4 @@ -From 09525ce7c090eece4c5a9b0dc972b086e25d5a64 Mon Sep 17 00:00:00 2001 +From 2d3399e1071d0754dd3cd7f7ddb2906e561428fb Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 29 May 2019 15:11:42 -0600 Subject: [PATCH] kernel32: Add reparse support to FindNextFile. diff --git a/patches/ntdll-Junction_Points/0025-wcmd-Display-reparse-point-type-in-directory-listing.patch b/patches/ntdll-Junction_Points/0025-wcmd-Display-reparse-point-type-in-directory-listing.patch index b823da9a..c124ff94 100644 --- a/patches/ntdll-Junction_Points/0025-wcmd-Display-reparse-point-type-in-directory-listing.patch +++ b/patches/ntdll-Junction_Points/0025-wcmd-Display-reparse-point-type-in-directory-listing.patch @@ -1,4 +1,4 @@ -From b67fce62c7b91b4b569bb16af51e7b1c0a6e6c98 Mon Sep 17 00:00:00 2001 +From c32b14dc99d3518a015ff8acc29d710304a45fc8 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 29 May 2019 15:18:50 -0600 Subject: [PATCH] wcmd: Display reparse point type in directory listings. diff --git a/patches/ntdll-Junction_Points/0026-wcmd-Show-reparse-point-target-in-directory-listing.patch b/patches/ntdll-Junction_Points/0026-wcmd-Show-reparse-point-target-in-directory-listing.patch index 5d6d58fb..174742d7 100644 --- a/patches/ntdll-Junction_Points/0026-wcmd-Show-reparse-point-target-in-directory-listing.patch +++ b/patches/ntdll-Junction_Points/0026-wcmd-Show-reparse-point-target-in-directory-listing.patch @@ -1,4 +1,4 @@ -From 46d0f8141530dc254c2cc57c056f762d91e62db1 Mon Sep 17 00:00:00 2001 +From 652ceaf374295989dec1d32157f3f81707af08ea Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 29 May 2019 15:38:30 -0600 Subject: [PATCH] wcmd: Show reparse point target in directory listing. diff --git a/patches/ntdll-Junction_Points/0027-wcmd-Add-junction-point-support-to-mklink.patch b/patches/ntdll-Junction_Points/0027-wcmd-Add-junction-point-support-to-mklink.patch index 78631b38..1eca8822 100644 --- a/patches/ntdll-Junction_Points/0027-wcmd-Add-junction-point-support-to-mklink.patch +++ b/patches/ntdll-Junction_Points/0027-wcmd-Add-junction-point-support-to-mklink.patch @@ -1,4 +1,4 @@ -From 4334ed826f3055b5cf359919e27be08effad1713 Mon Sep 17 00:00:00 2001 +From 4d2c17cf2ccd327c57be77429f86221c9d984b72 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 29 May 2019 16:01:45 -0600 Subject: [PATCH] wcmd: Add junction point support to mklink. diff --git a/patches/ntdll-Junction_Points/0028-server-Fix-obtaining-information-about-a-symlink.patch b/patches/ntdll-Junction_Points/0028-server-Fix-obtaining-information-about-a-symlink.patch index 8d83ef51..1e901a1b 100644 --- a/patches/ntdll-Junction_Points/0028-server-Fix-obtaining-information-about-a-symlink.patch +++ b/patches/ntdll-Junction_Points/0028-server-Fix-obtaining-information-about-a-symlink.patch @@ -1,4 +1,4 @@ -From 03347baf370ccc769cfd2cd76e6953fd9e2345ed Mon Sep 17 00:00:00 2001 +From 06e0409820f530dfe425693cba954d7defbfa722 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 18 Jul 2020 09:13:29 -0600 Subject: [PATCH] server: Fix obtaining information about a symlink. @@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 712b0196f05..f77b8184183 100644 +index 0de80ebee7b..b52f0074175 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1995,7 +1995,7 @@ static NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr, @@ -40,7 +40,7 @@ index 712b0196f05..f77b8184183 100644 letter = find_dos_device( unix_name ); free( unix_name ); -@@ -4278,7 +4279,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, +@@ -4245,7 +4246,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 712b0196f05..f77b8184183 100644 { LONG name_len = len - FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName); -@@ -4339,7 +4340,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, +@@ -4306,7 +4307,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, FILE_NAME_INFORMATION *info = ptr; char *unix_name; @@ -58,7 +58,7 @@ index 712b0196f05..f77b8184183 100644 { LONG name_len = len - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName); io->u.Status = fill_name_info( unix_name, info, &name_len ); -@@ -4353,7 +4354,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, +@@ -4320,7 +4321,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, FILE_NETWORK_OPEN_INFORMATION *info = ptr; char *unix_name; @@ -67,7 +67,7 @@ index 712b0196f05..f77b8184183 100644 { ULONG attributes; struct stat st; -@@ -5953,7 +5954,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -5920,7 +5921,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 712b0196f05..f77b8184183 100644 goto cleanup; src_allocated = TRUE; if (flags == SYMLINK_FLAG_RELATIVE) -@@ -6233,7 +6234,7 @@ NTSTATUS FILE_GetSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer, ULONG out_s +@@ -6198,7 +6199,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 712b0196f05..f77b8184183 100644 goto cleanup; if ((status = FILE_DecodeSymlink( unix_src, unix_dest, &unix_dest_len, &buffer->ReparseTag, &flags, NULL ))) -@@ -6342,7 +6343,7 @@ NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +@@ -6306,7 +6307,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 712b0196f05..f77b8184183 100644 goto cleanup; TRACE( "Deleting symlink %s\n", unix_name ); -@@ -7447,7 +7448,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas +@@ -7411,7 +7412,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas /* first try as a file object */ diff --git a/patches/ntdll-Junction_Points/0029-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch b/patches/ntdll-Junction_Points/0029-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch index 123d7eb6..31ea8c84 100644 --- a/patches/ntdll-Junction_Points/0029-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch +++ b/patches/ntdll-Junction_Points/0029-ntdll-Succeed-with-no-data-for-NtReadFile-on-reparse.patch @@ -1,4 +1,4 @@ -From cb6f9f1cee547e88942490bd46e7d6f9a5a8f0a2 Mon Sep 17 00:00:00 2001 +From b68b7725bf2bf7524bcd52c560b5fa61c98a8316 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Mon, 23 Nov 2020 13:08:02 -0700 Subject: [PATCH] ntdll: Succeed with no data for NtReadFile on reparse points. @@ -24,10 +24,10 @@ index fb168549641..05f6f67c4d3 100644 CloseHandle(handle); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index f77b8184183..6178f232db1 100644 +index b52f0074175..06a010f02ce 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5324,6 +5324,11 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo +@@ -5291,6 +5291,11 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo goto done; } } diff --git a/patches/ntdll-Junction_Points/0030-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch b/patches/ntdll-Junction_Points/0030-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch index 855f6c6d..96826782 100644 --- a/patches/ntdll-Junction_Points/0030-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch +++ b/patches/ntdll-Junction_Points/0030-ntdll-Support-reparse-point-properties-in-fd_get_fil.patch @@ -1,12 +1,12 @@ -From f50cb288f497d40a76f345f62eb99d7d0be1f416 Mon Sep 17 00:00:00 2001 +From 3a617a56abd9277e83a0c23d60cb8cba09c4082f Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 25 Nov 2020 09:05:51 -0700 Subject: [PATCH] ntdll: Support reparse point properties in fd_get_file_info. --- dlls/ntdll/tests/file.c | 2 +- - dlls/ntdll/unix/file.c | 82 ++++++++++++++++++++++++----------------- - 2 files changed, 50 insertions(+), 34 deletions(-) + dlls/ntdll/unix/file.c | 85 ++++++++++++++++++++++++----------------- + 2 files changed, 52 insertions(+), 35 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 05f6f67c4d3..20c569c0962 100644 @@ -22,7 +22,7 @@ index 05f6f67c4d3..20c569c0962 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 6178f232db1..555e2e549e7 100644 +index 06a010f02ce..61fc8e821d9 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1614,6 +1614,8 @@ static inline int get_file_xattr( char *hexattr, int attrlen ) @@ -34,7 +34,7 @@ index 6178f232db1..555e2e549e7 100644 /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) -@@ -1650,6 +1652,22 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON +@@ -1650,6 +1652,23 @@ 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; @@ -45,6 +45,7 @@ index 6178f232db1..555e2e549e7 100644 + BOOL is_dir; + + if ((len = readlinkat( fd, "", path, sizeof(path))) == -1) goto done; ++ path[len] = 0; + /* symbolic links (either junction points or NT symlinks) are "reparse points" */ + *attr |= FILE_ATTRIBUTE_REPARSE_POINT; + /* symbolic links always report size 0 */ @@ -57,7 +58,7 @@ index 6178f232db1..555e2e549e7 100644 return ret; } -@@ -6136,41 +6154,22 @@ cleanup: +@@ -6100,42 +6119,22 @@ cleanup: } @@ -86,6 +87,7 @@ index 6178f232db1..555e2e549e7 100644 - goto cleanup; - } - len = ret; +- tmp[len] = 0; - /* Decode the reparse tag from the symlink */ - p = tmp; @@ -103,7 +105,7 @@ index 6178f232db1..555e2e549e7 100644 reparse_tag = 0; for (i = 0; i < sizeof(ULONG)*8; i++) { -@@ -6182,10 +6181,7 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des +@@ -6147,10 +6146,7 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des else if (c == '.' && *p++ == '/') val = 1; else @@ -115,7 +117,7 @@ index 6178f232db1..555e2e549e7 100644 reparse_tag |= (val << i); } /* skip past the directory/file flag */ -@@ -6198,19 +6194,39 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des +@@ -6163,19 +6159,40 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des else if (c == '.' && *p++ == '/') dir_flag = TRUE; else @@ -157,6 +159,7 @@ index 6178f232db1..555e2e549e7 100644 + goto cleanup; + } + len = ret; ++ tmp[len] = 0; + status = get_symlink_properties(tmp, len, unix_dest, unix_dest_len, tag, flags, is_dir); cleanup: diff --git a/patches/ntdll-Junction_Points/0031-ntdll-Add-support-for-FileAttributeTagInformation.patch b/patches/ntdll-Junction_Points/0031-ntdll-Add-support-for-FileAttributeTagInformation.patch index 216b4587..ce755305 100644 --- a/patches/ntdll-Junction_Points/0031-ntdll-Add-support-for-FileAttributeTagInformation.patch +++ b/patches/ntdll-Junction_Points/0031-ntdll-Add-support-for-FileAttributeTagInformation.patch @@ -1,12 +1,12 @@ -From 216217b0759ae81c48fa8e56238a7f0b6c084576 Mon Sep 17 00:00:00 2001 +From 69a49f474062017e89448228923e9d3736409d80 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 25 Nov 2020 09:19:42 -0700 Subject: [PATCH] ntdll: Add support for FileAttributeTagInformation. --- dlls/ntdll/tests/file.c | 6 ++++++ - dlls/ntdll/unix/file.c | 11 ++++++++++- - 2 files changed, 16 insertions(+), 1 deletion(-) + dlls/ntdll/unix/file.c | 14 +++++++++++++- + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 20c569c0962..3f4017d2aeb 100644 @@ -40,10 +40,10 @@ index 20c569c0962..3f4017d2aeb 100644 /* Check the size/data of the symlink target */ diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 555e2e549e7..e16290d5903 100644 +index 61fc8e821d9..1c19a05a1c8 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -4421,7 +4421,16 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, +@@ -4389,7 +4389,19 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, { FILE_ATTRIBUTE_TAG_INFORMATION *info = ptr; info->FileAttributes = attr; @@ -56,7 +56,10 @@ index 555e2e549e7..e16290d5903 100644 + BOOL is_dir; + + if ((len = readlinkat( fd, "", path, sizeof(path))) != -1) ++ { ++ path[len] = 0; + get_symlink_properties(path, len, NULL, NULL, &info->ReparseTag, NULL, &is_dir); ++ } + } if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, &st )) info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; diff --git a/patches/ntdll-Junction_Points/0032-server-Properly-handle-renames-involving-symlinks.patch b/patches/ntdll-Junction_Points/0032-server-Properly-handle-renames-involving-symlinks.patch index 0749b57d..96478d93 100644 --- a/patches/ntdll-Junction_Points/0032-server-Properly-handle-renames-involving-symlinks.patch +++ b/patches/ntdll-Junction_Points/0032-server-Properly-handle-renames-involving-symlinks.patch @@ -1,4 +1,4 @@ -From 0057f977c574aebefda0c3047f8027d68391ec3f Mon Sep 17 00:00:00 2001 +From e509d8607a0c85846b8d060041f8d16704f2f749 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 12:17:23 -0700 Subject: [PATCH] server: Properly handle renames involving symlinks. diff --git a/patches/ntdll-Junction_Points/0033-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-MoveFileWi.patch b/patches/ntdll-Junction_Points/0033-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-MoveFileWi.patch index 6e43f36a..b0a0ae3d 100644 --- a/patches/ntdll-Junction_Points/0033-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-MoveFileWi.patch +++ b/patches/ntdll-Junction_Points/0033-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-MoveFileWi.patch @@ -1,4 +1,4 @@ -From 5dba21fa1e73037cdeabb35b464a0b70b07200c8 Mon Sep 17 00:00:00 2001 +From 8d31be068c4e5fbf31c66b8a28a9a7a666a2e2ab Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 12:46:30 -0700 Subject: [PATCH] kernelbase: Use FILE_OPEN_REPARSE_POINT in diff --git a/patches/ntdll-Junction_Points/0034-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-DeleteFile.patch b/patches/ntdll-Junction_Points/0034-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-DeleteFile.patch index 13ed7ad6..b1cc9f52 100644 --- a/patches/ntdll-Junction_Points/0034-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-DeleteFile.patch +++ b/patches/ntdll-Junction_Points/0034-kernelbase-Use-FILE_OPEN_REPARSE_POINT-in-DeleteFile.patch @@ -1,4 +1,4 @@ -From 1ebd7e436e19c89ddd164e4b42e4aba3efd63afa Mon Sep 17 00:00:00 2001 +From 0646ca34d0052611e66af79cfb1196177260e1c9 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 12:52:51 -0700 Subject: [PATCH] kernelbase: Use FILE_OPEN_REPARSE_POINT in DeleteFile. diff --git a/patches/ntdll-Junction_Points/0035-ntdll-Treat-undecoded-unix-symlinks-as-NT-symlinks.patch b/patches/ntdll-Junction_Points/0035-ntdll-Treat-undecoded-unix-symlinks-as-NT-symlinks.patch index d5b4a723..acdade65 100644 --- a/patches/ntdll-Junction_Points/0035-ntdll-Treat-undecoded-unix-symlinks-as-NT-symlinks.patch +++ b/patches/ntdll-Junction_Points/0035-ntdll-Treat-undecoded-unix-symlinks-as-NT-symlinks.patch @@ -1,4 +1,4 @@ -From 960250fb1a76a0777ab32d3472184309a5ba124e Mon Sep 17 00:00:00 2001 +From 2851b3072e7776cd87a3b79aa7edc99813fbcf2e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 16:32:44 -0700 Subject: [PATCH] ntdll: Treat undecoded unix symlinks as NT symlinks. @@ -8,7 +8,7 @@ Subject: [PATCH] ntdll: Treat undecoded unix symlinks as NT symlinks. 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index e16290d5903..dedf93c11f2 100644 +index 1c19a05a1c8..b6e49590f62 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1614,8 +1614,8 @@ static inline int get_file_xattr( char *hexattr, int attrlen ) @@ -22,7 +22,7 @@ index e16290d5903..dedf93c11f2 100644 /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) -@@ -1663,8 +1663,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON +@@ -1664,8 +1664,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON *attr |= FILE_ATTRIBUTE_REPARSE_POINT; /* symbolic links always report size 0 */ st->st_size = 0; @@ -33,7 +33,7 @@ index e16290d5903..dedf93c11f2 100644 } done: -@@ -6163,10 +6163,11 @@ cleanup: +@@ -6131,10 +6131,11 @@ cleanup: } @@ -47,7 +47,7 @@ index e16290d5903..dedf93c11f2 100644 DWORD reparse_tag; BOOL dir_flag; int i; -@@ -6178,7 +6179,7 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in +@@ -6146,7 +6147,7 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in p++; } if (*p++ != '/') @@ -56,7 +56,7 @@ index e16290d5903..dedf93c11f2 100644 reparse_tag = 0; for (i = 0; i < sizeof(ULONG)*8; i++) { -@@ -6190,7 +6191,7 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in +@@ -6158,7 +6159,7 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in else if (c == '.' && *p++ == '/') val = 1; else @@ -65,7 +65,7 @@ index e16290d5903..dedf93c11f2 100644 reparse_tag |= (val << i); } /* skip past the directory/file flag */ -@@ -6203,16 +6204,31 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in +@@ -6171,16 +6172,31 @@ NTSTATUS get_symlink_properties(const char *target, int len, char *unix_dest, in else if (c == '.' && *p++ == '/') dir_flag = TRUE; else @@ -99,10 +99,10 @@ index e16290d5903..dedf93c11f2 100644 } -@@ -6235,7 +6251,8 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des - goto cleanup; +@@ -6204,7 +6220,8 @@ NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, int *unix_des } len = ret; + tmp[len] = 0; - status = get_symlink_properties(tmp, len, unix_dest, unix_dest_len, tag, flags, is_dir); + get_symlink_properties(tmp, len, unix_dest, unix_dest_len, tag, flags, is_dir); + status = STATUS_SUCCESS; diff --git a/patches/ntdll-Junction_Points/0036-ntdll-Strip-the-wine-prefix-from-reparse-point-paths.patch b/patches/ntdll-Junction_Points/0036-ntdll-Strip-the-wine-prefix-from-reparse-point-paths.patch index b78cfba2..2ecdbaa4 100644 --- a/patches/ntdll-Junction_Points/0036-ntdll-Strip-the-wine-prefix-from-reparse-point-paths.patch +++ b/patches/ntdll-Junction_Points/0036-ntdll-Strip-the-wine-prefix-from-reparse-point-paths.patch @@ -1,4 +1,4 @@ -From 0f88dfb1dc52d5a44f81f49c67b17beb87539dca Mon Sep 17 00:00:00 2001 +From efd074f0e742ac8199b091860b2d4bc36136ca1c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 16:15:46 -0700 Subject: [PATCH] ntdll: Strip the wine prefix from reparse point paths @@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Strip the wine prefix from reparse point paths 1 file changed, 27 insertions(+) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index dedf93c11f2..aeb11c57829 100644 +index b6e49590f62..25b542cb4fc 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5942,6 +5942,31 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, +@@ -5913,6 +5913,31 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, } @@ -44,7 +44,7 @@ index dedf93c11f2..aeb11c57829 100644 /* * Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink * the requested directory to the location of the old directory. -@@ -6074,6 +6099,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -6045,6 +6070,8 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) goto cleanup; } } diff --git a/patches/ntdll-Junction_Points/0037-ntdll-Add-a-marker-to-reparse-point-paths-to-indicat.patch b/patches/ntdll-Junction_Points/0037-ntdll-Add-a-marker-to-reparse-point-paths-to-indicat.patch index bfbf61e3..bf8bc1cc 100644 --- a/patches/ntdll-Junction_Points/0037-ntdll-Add-a-marker-to-reparse-point-paths-to-indicat.patch +++ b/patches/ntdll-Junction_Points/0037-ntdll-Add-a-marker-to-reparse-point-paths-to-indicat.patch @@ -1,4 +1,4 @@ -From ecbe6ee5d35378e71c9170a7197e6f41be48e70a Mon Sep 17 00:00:00 2001 +From d7dbc8bcef2eb27d629ecf69f3d98fbe8aab3da7 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 16:16:17 -0700 Subject: [PATCH] ntdll: Add a marker to reparse point paths to indicate the @@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Add a marker to reparse point paths to indicate the 1 file changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index aeb11c57829..25ac1911720 100644 +index 25b542cb4fc..313d17ddbf9 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -5967,6 +5967,26 @@ void strip_external_path( char *path, SIZE_T *len ) +@@ -5938,6 +5938,26 @@ void strip_external_path( char *path, SIZE_T *len ) } @@ -39,7 +39,7 @@ index aeb11c57829..25ac1911720 100644 /* * Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink * the requested directory to the location of the old directory. -@@ -6100,7 +6120,10 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) +@@ -6071,7 +6091,10 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer) } } else diff --git a/patches/ntdll-Junction_Points/0038-server-Rewrite-absolute-reparse-point-targets-if-the.patch b/patches/ntdll-Junction_Points/0038-server-Rewrite-absolute-reparse-point-targets-if-the.patch index 2c9966a7..a0566429 100644 --- a/patches/ntdll-Junction_Points/0038-server-Rewrite-absolute-reparse-point-targets-if-the.patch +++ b/patches/ntdll-Junction_Points/0038-server-Rewrite-absolute-reparse-point-targets-if-the.patch @@ -1,4 +1,4 @@ -From d50198b3aa971c3b1b76afb2630901466503107c Mon Sep 17 00:00:00 2001 +From 5f87760574f835580a0bf47962c28f6ef8f2859d Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 6 Feb 2021 16:15:03 -0700 Subject: [PATCH] server: Rewrite absolute reparse point targets if the prefix