From ca3220cbd6c414a76bd538e01926b576f0acf332 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 13 Oct 2022 16:00:57 -0500 Subject: [PATCH] Rebase against f87ad783e23a2b6f5e9b8cf78dbf99bad4471a25. --- ...-support-for-creating-reparse-points.patch | 12 +- patches/ntdll-Junction_Points/definition | 1 - ...-ntdll-Improve-stub-of-NtQueryEaFile.patch | 156 ------------------ patches/ntdll-NtQueryEaFile/definition | 1 - patches/patchinstall.sh | 26 +-- 5 files changed, 10 insertions(+), 186 deletions(-) delete mode 100644 patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch delete mode 100644 patches/ntdll-NtQueryEaFile/definition 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 23fb0756..2714f650 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 98350beb9209a2fdb1caeaf9ca6cf508ab2b4d80 Mon Sep 17 00:00:00 2001 +From 99431b53452b3c40a024de30d3b182b4b84a2cca 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. @@ -41,7 +41,7 @@ index 3b1cdb54f9f..6eb4690f8e0 100644 EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000 x86_64_EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x170000000 diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index ddc864b3588..2baacaa9bc3 100644 +index d49d4d5c26f..5d33cbda47e 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -38,6 +38,7 @@ @@ -52,7 +52,7 @@ index ddc864b3588..2baacaa9bc3 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -5326,6 +5327,156 @@ static void test_mailslot_name(void) +@@ -5245,6 +5246,156 @@ static void test_mailslot_name(void) CloseHandle( device ); } @@ -209,15 +209,15 @@ index ddc864b3588..2baacaa9bc3 100644 START_TEST(file) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); -@@ -5398,5 +5549,6 @@ START_TEST(file) +@@ -5315,5 +5466,6 @@ START_TEST(file) + test_query_attribute_information_file(); test_ioctl(); - test_query_ea(); test_flush_buffers_file(); + test_reparse_points(); test_mailslot_name(); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 604ca866890..58310fd8504 100644 +index 469c714f847..c644c22e578 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -36,6 +36,8 @@ diff --git a/patches/ntdll-Junction_Points/definition b/patches/ntdll-Junction_Points/definition index ed7aae2b..3d4b4135 100644 --- a/patches/ntdll-Junction_Points/definition +++ b/patches/ntdll-Junction_Points/definition @@ -1,4 +1,3 @@ Fixes: [12401] NET Framework 2.0, 3.0, 4.0 installers and other apps that make use of GAC API for managed assembly installation on NTFS filesystems need reparse point/junction API support (FSCTL_SET_REPARSE_POINT/FSCTL_GET_REPARSE_POINT) Fixes: [44948] Multiple apps (Spine (Mod starter for Gothic), MS Office 365 installer) need CreateSymbolicLinkW implementation -Depends: ntdll-NtQueryEaFile Depends: ntdll-Serial_Port_Detection diff --git a/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch b/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch deleted file mode 100644 index 036b0be2..00000000 --- a/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch +++ /dev/null @@ -1,156 +0,0 @@ -From b38ef24ec2a84cf8ae1e3d1fcb12c249a0d9c512 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. - -Based on a patch by Qian Hong. ---- - dlls/ntdll/tests/file.c | 83 +++++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/unix/file.c | 15 +++++++- - 2 files changed, 96 insertions(+), 2 deletions(-) - -diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index decfaff638a..acba3540282 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 - 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*); -+static NTSTATUS (WINAPI *pNtQueryEaFile)(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PULONG,BOOLEAN); - - static WCHAR fooW[] = {'f','o','o',0}; - -@@ -4990,6 +4991,86 @@ static void test_flush_buffers_file(void) - DeleteFileA(buffer); - } - -+static void test_query_ea(void) -+{ -+ #define EA_BUFFER_SIZE 4097 -+ unsigned char data[EA_BUFFER_SIZE + 8]; -+ unsigned char *buffer = (void *)(((DWORD_PTR)data + 7) & ~7); -+ DWORD buffer_len, i; -+ IO_STATUS_BLOCK io; -+ NTSTATUS status; -+ HANDLE handle; -+ -+ if (!(handle = create_temp_file(0))) return; -+ -+ /* test with INVALID_HANDLE_VALUE */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ memset(buffer, 0xcc, EA_BUFFER_SIZE); -+ buffer_len = EA_BUFFER_SIZE - 1; -+ status = pNtQueryEaFile(INVALID_HANDLE_VALUE, &io, buffer, buffer_len, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_OBJECT_TYPE_MISMATCH, "expected STATUS_OBJECT_TYPE_MISMATCH, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ ok(buffer[0] == 0xcc, "data at position 0 overwritten\n"); -+ -+ /* test with 0xdeadbeef */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ memset(buffer, 0xcc, EA_BUFFER_SIZE); -+ buffer_len = EA_BUFFER_SIZE - 1; -+ status = pNtQueryEaFile((void *)0xdeadbeef, &io, buffer, buffer_len, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_INVALID_HANDLE, "expected STATUS_INVALID_HANDLE, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ ok(buffer[0] == 0xcc, "data at position 0 overwritten\n"); -+ -+ /* test without buffer */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ status = pNtQueryEaFile(handle, &io, NULL, 0, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_NO_EAS_ON_FILE, "expected STATUS_NO_EAS_ON_FILE, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ -+ /* test with zero buffer */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ status = pNtQueryEaFile(handle, &io, buffer, 0, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_NO_EAS_ON_FILE, "expected STATUS_NO_EAS_ON_FILE, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ -+ /* test with very small buffer */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ memset(buffer, 0xcc, EA_BUFFER_SIZE); -+ buffer_len = 4; -+ status = pNtQueryEaFile(handle, &io, buffer, buffer_len, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_NO_EAS_ON_FILE, "expected STATUS_NO_EAS_ON_FILE, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ for (i = 0; i < buffer_len && !buffer[i]; i++); -+ ok(i == buffer_len, "expected %u bytes filled with 0x00, got %u bytes\n", buffer_len, i); -+ ok(buffer[i] == 0xcc, "data at position %u overwritten\n", buffer[i]); -+ -+ /* test with very big buffer */ -+ U(io).Status = 0xdeadbeef; -+ io.Information = 0xdeadbeef; -+ memset(buffer, 0xcc, EA_BUFFER_SIZE); -+ buffer_len = EA_BUFFER_SIZE - 1; -+ status = pNtQueryEaFile(handle, &io, buffer, buffer_len, TRUE, NULL, 0, NULL, FALSE); -+ ok(status == STATUS_NO_EAS_ON_FILE, "expected STATUS_NO_EAS_ON_FILE, got %x\n", status); -+ ok(U(io).Status == 0xdeadbeef, "expected 0xdeadbeef, got %x\n", U(io).Status); -+ ok(io.Information == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", io.Information); -+ for (i = 0; i < buffer_len && !buffer[i]; i++); -+ ok(i == buffer_len, "expected %u bytes filled with 0x00, got %u bytes\n", buffer_len, i); -+ ok(buffer[i] == 0xcc, "data at position %u overwritten\n", buffer[i]); -+ -+ CloseHandle(handle); -+ #undef EA_BUFFER_SIZE -+} -+ - static void test_file_readonly_access(void) - { - static const DWORD default_sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; -@@ -5163,6 +5244,7 @@ START_TEST(file) - pNtQueryVolumeInformationFile = (void *)GetProcAddress(hntdll, "NtQueryVolumeInformationFile"); - pNtQueryFullAttributesFile = (void *)GetProcAddress(hntdll, "NtQueryFullAttributesFile"); - pNtFlushBuffersFile = (void *)GetProcAddress(hntdll, "NtFlushBuffersFile"); -+ pNtQueryEaFile = (void *)GetProcAddress(hntdll, "NtQueryEaFile"); - - test_read_write(); - test_NtCreateFile(); -@@ -5192,6 +5274,7 @@ START_TEST(file) - test_query_volume_information_file(); - test_query_attribute_information_file(); - test_ioctl(); -+ test_query_ea(); - test_flush_buffers_file(); - test_mailslot_name(); - } -diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 350a42f4249..e54a010855f 100644 ---- a/dlls/ntdll/unix/file.c -+++ b/dlls/ntdll/unix/file.c -@@ -6555,9 +6555,20 @@ NTSTATUS WINAPI NtQueryEaFile( HANDLE handle, IO_STATUS_BLOCK *io, void *buffer, - BOOLEAN single_entry, void *list, ULONG list_len, - ULONG *index, BOOLEAN restart ) - { -- FIXME( "(%p,%p,%p,%d,%d,%p,%d,%p,%d) stub\n", -+ int fd, needs_close; -+ NTSTATUS status; -+ -+ FIXME( "(%p,%p,%p,%d,%d,%p,%d,%p,%d) semi-stub\n", - handle, io, buffer, length, single_entry, list, list_len, index, restart ); -- return STATUS_ACCESS_DENIED; -+ -+ if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ))) -+ return status; -+ -+ if (buffer && length) -+ memset( buffer, 0, length ); -+ -+ if (needs_close) close( fd ); -+ return STATUS_NO_EAS_ON_FILE; - } - - --- -2.27.0 - diff --git a/patches/ntdll-NtQueryEaFile/definition b/patches/ntdll-NtQueryEaFile/definition deleted file mode 100644 index c3a4b643..00000000 --- a/patches/ntdll-NtQueryEaFile/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: Improve stub for NtQueryEaFile diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 5894db2b..13e09b4b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -138,7 +138,6 @@ patch_enable_all () enable_ntdll_Hide_Wine_Exports="$1" enable_ntdll_Junction_Points="$1" enable_ntdll_Manifest_Range="$1" - enable_ntdll_NtQueryEaFile="$1" enable_ntdll_NtQuerySection="$1" enable_ntdll_NtSetLdtEntries="$1" enable_ntdll_ProcessQuotaLimits="$1" @@ -432,9 +431,6 @@ patch_enable () ntdll-Manifest_Range) enable_ntdll_Manifest_Range="$2" ;; - ntdll-NtQueryEaFile) - enable_ntdll_NtQueryEaFile="$2" - ;; ntdll-NtQuerySection) enable_ntdll_NtQuerySection="$2" ;; @@ -1289,13 +1285,9 @@ if test "$enable_eventfd_synchronization" -eq 1; then 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 if test "$enable_ntdll_Serial_Port_Detection" -gt 1; then abort "Patchset ntdll-Serial_Port_Detection disabled, but ntdll-Junction_Points depends on that." fi - enable_ntdll_NtQueryEaFile=1 enable_ntdll_Serial_Port_Detection=1 fi @@ -1661,15 +1653,6 @@ if test "$enable_dsound_EAX" -eq 1; then patch_apply dsound-EAX/0023-dsound-Fake-success-for-EAX-Set-Buffer-ListenerPrope.patch fi -# Patchset ntdll-NtQueryEaFile -# | -# | Modified files: -# | * dlls/ntdll/tests/file.c, dlls/ntdll/unix/file.c -# | -if test "$enable_ntdll_NtQueryEaFile" -eq 1; then - patch_apply ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch -fi - # Patchset ntdll-Serial_Port_Detection # | # | This patchset fixes the following Wine bugs: @@ -1685,7 +1668,7 @@ fi # Patchset ntdll-Junction_Points # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-NtQueryEaFile, ntdll-Serial_Port_Detection +# | * ntdll-Serial_Port_Detection # | # | This patchset fixes the following Wine bugs: # | * [#12401] NET Framework 2.0, 3.0, 4.0 installers and other apps that make use of GAC API for managed assembly @@ -1762,8 +1745,7 @@ fi # Patchset eventfd_synchronization # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-NtQueryEaFile, ntdll-Serial_Port_Detection, ntdll-Junction_Points, server-PeekMessage, server-Realtime_Priority, -# | server-Signal_Thread +# | * ntdll-Serial_Port_Detection, ntdll-Junction_Points, server-PeekMessage, server-Realtime_Priority, server-Signal_Thread # | # | This patchset fixes the following Wine bugs: # | * [#36692] Many multi-threaded applications have poor performance due to heavy use of synchronization primitives @@ -2555,7 +2537,7 @@ fi # Patchset server-File_Permissions # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-NtQueryEaFile, ntdll-Serial_Port_Detection, ntdll-Junction_Points +# | * ntdll-Serial_Port_Detection, ntdll-Junction_Points # | # | Modified files: # | * dlls/advapi32/tests/security.c, dlls/ntdll/tests/file.c, server/fd.c @@ -2573,7 +2555,7 @@ fi # Patchset server-Stored_ACLs # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-NtQueryEaFile, ntdll-Serial_Port_Detection, ntdll-Junction_Points, server-File_Permissions +# | * ntdll-Serial_Port_Detection, ntdll-Junction_Points, server-File_Permissions # | # | This patchset fixes the following Wine bugs: # | * [#33576] Support for stored file ACLs