From 49dcc783631e57ee7090bd6c1853c5ead448dad2 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 12 Apr 2023 17:10:01 -0500 Subject: [PATCH] Rebase against f512b3c08ccfc9b9c235964002e644e2cbd657cf. --- ...-support-for-creating-reparse-points.patch | 76 +++++++++---------- staging/upstream-commit | 2 +- 2 files changed, 39 insertions(+), 39 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 73e993d8..03f58a87 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 0dfebc8cb8ed9804c6616fe7eec519b7c3e7ea13 Mon Sep 17 00:00:00 2001 +From 3c2f30734ab4ab7a602f1f66d415a245063ee6d8 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, 447 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac -index 16c4c33d816..e492a707a48 100644 +index c4f34e9e851..ec76805b3e6 100644 --- a/configure.ac +++ b/configure.ac -@@ -2061,6 +2061,8 @@ AC_CHECK_FUNCS(\ +@@ -2025,6 +2025,8 @@ AC_CHECK_FUNCS(\ prctl \ proc_pidinfo \ sched_yield \ @@ -26,12 +26,12 @@ index 16c4c33d816..e492a707a48 100644 setprogname \ sigprocmask \ diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in -index 89e4d5bb579..07688a5fcf6 100644 +index 2e862c68b7e..f8ca3e689ec 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -4,7 +4,7 @@ UNIXLIB = ntdll.so IMPORTLIB = ntdll - IMPORTS = winecrt0 + IMPORTS = $(MUSL_PE_LIBS) winecrt0 UNIX_CFLAGS = $(UNWIND_CFLAGS) -UNIX_LIBS = $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) $(PROCSTAT_LIBS) +UNIX_LIBS = $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) $(PROCSTAT_LIBS) -lm @@ -39,7 +39,7 @@ index 89e4d5bb579..07688a5fcf6 100644 EXTRADLLFLAGS = -nodefaultlibs i386_EXTRADLLFLAGS = -Wl,--image-base,0x7bc00000 diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 98d9e6b3b0a..93e50bd6952 100644 +index 6186afdfb63..7f753caef47 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -38,6 +38,7 @@ @@ -50,7 +50,7 @@ index 98d9e6b3b0a..93e50bd6952 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -5326,32 +5327,154 @@ static void test_mailslot_name(void) +@@ -5406,32 +5407,154 @@ static void test_mailslot_name(void) CloseHandle( device ); } @@ -101,7 +101,9 @@ index 98d9e6b3b0a..93e50bd6952 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); @@ -110,7 +112,9 @@ index 98d9e6b3b0a..93e50bd6952 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]; @@ -127,15 +131,17 @@ index 98d9e6b3b0a..93e50bd6952 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"); -- pRtlInitUnicodeString( &nameW, L"\\??\\C:\\" ); -- InitializeObjectAttributes( &attr, &nameW, 0, NULL, NULL ); +- 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 ); + /* Create a destination folder for the junction point to target */ + lstrcpyW(target_path, path); + for (int i=0; i<1; i++) @@ -148,8 +154,9 @@ index 98d9e6b3b0a..93e50bd6952 100644 + ok(bret, "Failed to create junction point target directory.\n"); + pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL); -- status = pNtOpenFile( &handle, READ_CONTROL, &attr, &io, 0, 0 ); -- ok( !status, "open %s failed %#lx\n", wine_dbgstr_w(nameW.Buffer), status ); +- /* 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 ); + /* 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); @@ -159,7 +166,8 @@ index 98d9e6b3b0a..93e50bd6952 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); @@ -173,9 +181,7 @@ index 98d9e6b3b0a..93e50bd6952 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); @@ -185,16 +191,11 @@ index 98d9e6b3b0a..93e50bd6952 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); @@ -207,8 +208,7 @@ index 98d9e6b3b0a..93e50bd6952 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 98d9e6b3b0a..93e50bd6952 100644 } START_TEST(file) -@@ -5426,6 +5549,6 @@ START_TEST(file) +@@ -5506,6 +5629,6 @@ START_TEST(file) test_ioctl(); test_query_ea(); test_flush_buffers_file(); @@ -231,7 +231,7 @@ index 98d9e6b3b0a..93e50bd6952 100644 + test_mailslot_name(); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 6b73d9dc7e8..52b85cfc6d1 100644 +index eca75b2d4fb..0cef6438c7e 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -36,6 +36,8 @@ @@ -243,7 +243,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 #include #include #ifdef HAVE_MNTENT_H -@@ -121,6 +123,7 @@ +@@ -125,6 +127,7 @@ #include "wine/list.h" #include "wine/debug.h" #include "unix_private.h" @@ -251,7 +251,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 WINE_DEFAULT_DEBUG_CHANNEL(file); WINE_DECLARE_DEBUG_CHANNEL(winediag); -@@ -132,6 +135,12 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); +@@ -136,6 +139,12 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); #undef EXT2_IOC_GETFLAGS #undef EXT4_CASEFOLD_FL @@ -264,7 +264,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 #ifdef linux /* We want the real kernel dirent structure, not the libc one */ -@@ -236,6 +245,95 @@ static const BOOL is_case_sensitive = FALSE; +@@ -247,6 +256,95 @@ static const BOOL is_case_sensitive = FALSE; static pthread_mutex_t dir_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mnt_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -360,7 +360,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 /* check if a given Unicode char is OK in a DOS short name */ static inline BOOL is_invalid_dos_char( WCHAR ch ) { -@@ -1540,6 +1638,28 @@ static int parse_samba_dos_attrib_data( char *data, int len ) +@@ -1562,6 +1660,28 @@ static int parse_samba_dos_attrib_data( char *data, int len ) } @@ -389,7 +389,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 static BOOL fd_is_mount_point( int fd, const struct stat *st ) { struct stat parent; -@@ -3313,6 +3433,181 @@ done: +@@ -3335,6 +3455,181 @@ done: } @@ -571,7 +571,7 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 /****************************************************************************** * lookup_unix_name * -@@ -6072,6 +6367,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap +@@ -6099,6 +6394,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap break; } @@ -586,10 +586,10 @@ index 6b73d9dc7e8..52b85cfc6d1 100644 TRACE("FSCTL_SET_SPARSE: Ignoring request\n"); io->Information = 0; diff --git a/include/Makefile.in b/include/Makefile.in -index 28ac4b3f2dc..7c69ddbfddf 100644 +index f52314e745d..2ec4d835743 100644 --- a/include/Makefile.in +++ b/include/Makefile.in -@@ -564,6 +564,7 @@ SOURCES = \ +@@ -572,6 +572,7 @@ SOURCES = \ ntdef.h \ ntdsapi.h \ ntgdi.h \ @@ -598,5 +598,5 @@ index 28ac4b3f2dc..7c69ddbfddf 100644 ntquery.h \ ntsecapi.h \ -- -2.38.1 +2.39.2 diff --git a/staging/upstream-commit b/staging/upstream-commit index 5fa291cc..a5b5b022 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -1546ef3015999ee27066b317773050a5641c2023 +f512b3c08ccfc9b9c235964002e644e2cbd657cf