From 7fc08a960bcefc1e06a6d5587079648fdde9112f Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 25 Jun 2024 07:24:51 +1000 Subject: [PATCH] Rebase against f9af971bd7d6799d54436ba9f7fa327b7edfbc77. --- ...-support-for-creating-reparse-points.patch | 64 +++++++++---------- staging/upstream-commit | 2 +- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-creating-reparse-points.patch b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-creating-reparse-points.patch index ba591539..26093ec3 100644 --- a/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-creating-reparse-points.patch +++ b/patches/ntdll-Junction_Points/0001-ntdll-Add-support-for-creating-reparse-points.patch @@ -1,4 +1,4 @@ -From ef771cfa26c9d15568d0711073145b3cf11c6b5a Mon Sep 17 00:00:00 2001 +From 4bc218280bf7e0d697b2386ea2f71d5562bc8867 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 creating reparse points. @@ -13,10 +13,10 @@ Signed-off-by: Erich E. Hoover 5 files changed, 451 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac -index 417b1a63a13..88e53b11c05 100644 +index 89bc831bb94..0138b5d3b9a 100644 --- a/configure.ac +++ b/configure.ac -@@ -2084,6 +2084,8 @@ AC_CHECK_FUNCS(\ +@@ -2087,6 +2087,8 @@ AC_CHECK_FUNCS(\ prctl \ proc_pidinfo \ sched_yield \ @@ -26,7 +26,7 @@ index 417b1a63a13..88e53b11c05 100644 setprogname \ sigprocmask \ diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in -index b519bcd655f..f71f79b9f5f 100644 +index e17e3f72b92..66cdf11423c 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -4,7 +4,7 @@ UNIXLIB = ntdll.so @@ -39,7 +39,7 @@ index b519bcd655f..f71f79b9f5f 100644 EXTRADLLFLAGS = -nodefaultlibs i386_EXTRADLLFLAGS = -Wl,--image-base,0x7bc00000 diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 9dd49c925b7..89d65bf6f46 100644 +index 7d3618a3804..148b6058cee 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -38,6 +38,7 @@ @@ -50,7 +50,7 @@ index 9dd49c925b7..89d65bf6f46 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -5854,32 +5855,154 @@ static void test_mailslot_name(void) +@@ -5863,32 +5864,154 @@ static void test_mailslot_name(void) CloseHandle( device ); } @@ -101,9 +101,7 @@ index 9dd49c925b7..89d65bf6f46 100644 + INT buffer_len; + HANDLE handle; + BOOL bret; - -- pRtlInitUnicodeString( &nameW, L"\\??\\C:\\" ); -- InitializeObjectAttributes( &attr, &nameW, 0, NULL, NULL ); ++ + /* Create a temporary folder for the junction point tests */ + GetTempFileNameW(dotW, fooW, 0, path); + DeleteFileW(path); @@ -112,9 +110,7 @@ index 9dd49c925b7..89d65bf6f46 100644 + win_skip("Unable to create a temporary junction point directory.\n"); + return; + } - -- status = pNtOpenFile( &handle, READ_CONTROL, &attr, &io, 0, 0 ); -- ok( !status, "open %s failed %#lx\n", wine_dbgstr_w(nameW.Buffer), status ); ++ + /* Check that the volume this folder is located on supports junction points */ + pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL); + volW[0] = nameW.Buffer[4]; @@ -131,17 +127,15 @@ index 9dd49c925b7..89d65bf6f46 100644 + RemoveDirectoryW(path); + return; + } - -- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, NULL, 0 ); -- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status ); ++ + /* Create the folder to be replaced by a junction point */ + lstrcpyW(reparse_path, path); + lstrcatW(reparse_path, reparseW); + bret = CreateDirectoryW(reparse_path, NULL); + ok(bret, "Failed to create junction point directory.\n"); -- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 0 ); -- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status ); +- pRtlInitUnicodeString( &nameW, L"\\??\\C:\\" ); +- InitializeObjectAttributes( &attr, &nameW, 0, NULL, NULL ); + /* Create a destination folder for the junction point to target */ + lstrcpyW(target_path, path); + for (int i=0; i<1; i++) @@ -154,9 +148,8 @@ index 9dd49c925b7..89d65bf6f46 100644 + ok(bret, "Failed to create junction point target directory.\n"); + pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL); -- /* a volume cannot be a reparse point by definition */ -- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 1 ); -- ok( status == STATUS_NOT_A_REPARSE_POINT, "expected %#lx, got %#lx\n", STATUS_NOT_A_REPARSE_POINT, status ); +- status = pNtOpenFile( &handle, READ_CONTROL, &attr, &io, 0, 0 ); +- ok( !status, "open %s failed %#lx\n", wine_dbgstr_w(nameW.Buffer), status ); + /* construct a too long pathname (resulting reparse buffer over 16 kiB limit) */ + long_path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32767); + lstrcpyW(long_path, nameW.Buffer); @@ -166,8 +159,7 @@ index 9dd49c925b7..89d65bf6f46 100644 + lstrcatW(long_path, path); + } + lstrcatW(long_path, targetW); - -- CloseHandle( handle ); ++ + /* Create the junction point */ + handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0); @@ -181,7 +173,9 @@ index 9dd49c925b7..89d65bf6f46 100644 + ok(!bret && GetLastError()==ERROR_INVALID_REPARSE_DATA, "Unexpected error (0x%lx)\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, buffer); + CloseHandle(handle); -+ + +- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, NULL, 0 ); +- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status ); + /* construct a long pathname to demonstrate correct behavior with very large reparse points */ + pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL); + lstrcpyW(long_path, nameW.Buffer); @@ -191,11 +185,16 @@ index 9dd49c925b7..89d65bf6f46 100644 + lstrcatW(long_path, path); + } + lstrcatW(long_path, targetW); -+ + +- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 0 ); +- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status ); + /* use a sane (not obscenely long) target for the rest of testing */ + pRtlFreeUnicodeString(&nameW); + pRtlDosPathNameToNtPathName_U(target_path, &nameW, NULL, NULL); -+ + +- /* a volume cannot be a reparse point by definition */ +- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 1 ); +- ok( status == STATUS_NOT_A_REPARSE_POINT, "expected %#lx, got %#lx\n", STATUS_NOT_A_REPARSE_POINT, status ); + /* Create the junction point */ + handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0); @@ -208,7 +207,8 @@ index 9dd49c925b7..89d65bf6f46 100644 + bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0); + ok(bret, "Failed to create junction point! (0x%lx)\n", GetLastError()); + CloseHandle(handle); -+ + +- CloseHandle( handle ); +cleanup: + /* Cleanup */ + pRtlFreeUnicodeString(&nameW); @@ -222,7 +222,7 @@ index 9dd49c925b7..89d65bf6f46 100644 } START_TEST(file) -@@ -5960,6 +6083,6 @@ START_TEST(file) +@@ -5969,6 +6092,6 @@ START_TEST(file) test_ioctl(); test_query_ea(); test_flush_buffers_file(); @@ -231,7 +231,7 @@ index 9dd49c925b7..89d65bf6f46 100644 + test_mailslot_name(); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index d292d934efa..d67983ffac7 100644 +index b8fb4f19e13..c52377264fe 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -36,6 +36,8 @@ @@ -360,7 +360,7 @@ index d292d934efa..d67983ffac7 100644 /* check if a given Unicode char is OK in a DOS short name */ static inline BOOL is_invalid_dos_char( WCHAR ch ) { -@@ -1565,6 +1663,28 @@ static int parse_samba_dos_attrib_data( char *data, int len ) +@@ -1644,6 +1742,28 @@ static int parse_samba_dos_attrib_data( char *data, int len ) } @@ -389,7 +389,7 @@ index d292d934efa..d67983ffac7 100644 static BOOL fd_is_mount_point( int fd, const struct stat *st ) { struct stat parent; -@@ -3335,6 +3455,181 @@ done: +@@ -3420,6 +3540,181 @@ done: } @@ -571,7 +571,7 @@ index d292d934efa..d67983ffac7 100644 /****************************************************************************** * lookup_unix_name * -@@ -6181,6 +6476,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6266,6 +6561,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap break; } @@ -584,7 +584,7 @@ index d292d934efa..d67983ffac7 100644 + case FSCTL_SET_SPARSE: TRACE("FSCTL_SET_SPARSE: Ignoring request\n"); - io->Information = 0; + status = STATUS_SUCCESS; diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h index 980235abdc9..90248b4897c 100644 --- a/include/ddk/ntifs.h diff --git a/staging/upstream-commit b/staging/upstream-commit index 37c4a572..40f0c550 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -6c5d17af07a318d754c0c21023b2d162a0d3725d +f9af971bd7d6799d54436ba9f7fa327b7edfbc77