From 0c2536b0258ec30546e9f062f8fd212a3837eb77 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 6 Jun 2015 18:04:37 +0200 Subject: [PATCH] Added patch to improve stubs for NtQueryEaFile. --- README.md | 3 +- debian/changelog | 1 + ...-support-for-junction-point-creation.patch | 26 +-- patches/ntdll-Junction_Points/definition | 3 +- ...-ntdll-Improve-stub-of-NtQueryEaFile.patch | 161 ++++++++++++++++++ patches/ntdll-NtQueryEaFile/definition | 1 + patches/patchinstall.sh | 70 +++++--- 7 files changed, 225 insertions(+), 40 deletions(-) create mode 100644 patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch create mode 100644 patches/ntdll-NtQueryEaFile/definition diff --git a/README.md b/README.md index cf7e8d36..ae7e1839 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [15]:** +**Bug fixes and features included in the next upcoming release [16]:** * Add implementation for kernel32.GetNumaProcessorNode ([Wine Bug #38660](https://bugs.winehq.org/show_bug.cgi?id=38660)) * Allow to enable/disable InsertMode in wineconsole settings ([Wine Bug #38697](https://bugs.winehq.org/show_bug.cgi?id=38697)) @@ -49,6 +49,7 @@ Included bug fixes and improvements * Implement default homepage button in inetcpl.cpl * Implement mscoree._CorValidateImage for mono runtime ([Wine Bug #38662](https://bugs.winehq.org/show_bug.cgi?id=38662)) * Implement proper handling of CLI .NET images in Wine library loader ([Wine Bug #38661](https://bugs.winehq.org/show_bug.cgi?id=38661)) +* Improve stub for NtQueryEaFile * Initialize System\CurrentControlSet\Control\TimeZoneInformation registry keys * Multiple applications needs better NtQueryInformationJobObject stub * Return proper status codes when NtReadFile/NtWriteFile is called on closed (but not disconnected) pipe diff --git a/debian/changelog b/debian/changelog index 9862f838..e07c8759 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,7 @@ wine-staging (1.7.45) UNRELEASED; urgency=low * Added patch to fix link notification conditions for riched20. * Added patch to fix endless loop in regedit when importing files with very long lines. + * Added patch to improve stubs for NtQueryEaFile. * Removed patch to handle '\r' as whitespace in wbemprox queries (accepted upstream). * Removed patch to make sure OpenClipboard with current owner doesn't fail 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 39aabea6..d00a1264 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 fcfa5f82a4cbb6b3871fde70e72868b0b017a386 Mon Sep 17 00:00:00 2001 +From eac9db85f7a5703a41bb956a9cabc2277872881d Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 20:56:49 -0700 Subject: ntdll: Add support for junction point creation. @@ -12,10 +12,10 @@ Subject: ntdll: Add support for junction point creation. create mode 100644 include/ntifs.h diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 5232027..69e8b52 100644 +index 8503dd8..fb171f2 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -89,12 +89,14 @@ +@@ -88,12 +88,14 @@ #include "winioctl.h" #include "ddk/ntddk.h" #include "ddk/ntddser.h" @@ -30,7 +30,7 @@ index 5232027..69e8b52 100644 #define SECSPERDAY 86400 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY) -@@ -1515,6 +1517,76 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, +@@ -1633,6 +1635,76 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event, } @@ -107,7 +107,7 @@ index 5232027..69e8b52 100644 /************************************************************************** * NtFsControlFile [NTDLL.@] * ZwFsControlFile [NTDLL.@] -@@ -1662,6 +1734,23 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc +@@ -1780,6 +1852,23 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc } break; } @@ -132,7 +132,7 @@ index 5232027..69e8b52 100644 case FSCTL_PIPE_WAIT: default: diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index d70ed6b..90e753d 100644 +index 3696124..b7b9e00 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -37,6 +37,7 @@ @@ -143,8 +143,8 @@ index d70ed6b..90e753d 100644 #ifndef IO_COMPLETION_ALL_ACCESS #define IO_COMPLETION_ALL_ACCESS 0x001F0003 -@@ -2683,6 +2684,98 @@ todo_wine - CloseHandle(hfile); +@@ -2866,6 +2867,98 @@ static void test_query_ea(void) + #undef EA_BUFFER_SIZE } +static INT build_reparse_buffer(WCHAR *filename, REPARSE_DATA_BUFFER **pbuffer) @@ -242,17 +242,17 @@ index d70ed6b..90e753d 100644 START_TEST(file) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); -@@ -2736,4 +2829,5 @@ START_TEST(file) - test_file_disposition_information(); +@@ -2922,4 +3015,5 @@ START_TEST(file) test_query_volume_information_file(); test_query_attribute_information_file(); + test_query_ea(); + test_junction_points(); } diff --git a/include/Makefile.in b/include/Makefile.in -index 49ad276..7149ea9 100644 +index 499c5d4..e410e14 100644 --- a/include/Makefile.in +++ b/include/Makefile.in -@@ -473,6 +473,7 @@ SRCDIR_INCLUDES = \ +@@ -479,6 +479,7 @@ SRCDIR_INCLUDES = \ ntddstor.h \ ntdef.h \ ntdsapi.h \ @@ -319,5 +319,5 @@ index 0000000..db07c28 + +#endif /* __WINE_NTIFS_H */ -- -2.2.1 +2.4.2 diff --git a/patches/ntdll-Junction_Points/definition b/patches/ntdll-Junction_Points/definition index d8cc1626..e289dfd2 100644 --- a/patches/ntdll-Junction_Points/definition +++ b/patches/ntdll-Junction_Points/definition @@ -1,2 +1,3 @@ -Depends: ntdll-Fix_Free Fixes: [12401] Support for Junction Points +Depends: ntdll-Fix_Free +Depends: ntdll-NtQueryEaFile diff --git a/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch b/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch new file mode 100644 index 00000000..f583bc4f --- /dev/null +++ b/patches/ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch @@ -0,0 +1,161 @@ +From 1914529dbe74c405c9ab0a947b8b065286ebc8a2 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 6 Jun 2015 07:03:33 +0800 +Subject: ntdll: Improve stub of NtQueryEaFile. + +Based on a patch by Qian Hong. +--- + dlls/ntdll/file.c | 19 ++++++++--- + dlls/ntdll/tests/file.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 98 insertions(+), 4 deletions(-) + +diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c +index d081750..8503dd8 100644 +--- a/dlls/ntdll/file.c ++++ b/dlls/ntdll/file.c +@@ -3191,14 +3191,25 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io + * Success: 0. Atrributes read into buffer + * Failure: An NTSTATUS error code describing the error. + */ +-NTSTATUS WINAPI NtQueryEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer, ULONG length, ++NTSTATUS WINAPI NtQueryEaFile( HANDLE handle, PIO_STATUS_BLOCK iosb, PVOID buffer, ULONG length, + BOOLEAN single_entry, PVOID ea_list, ULONG ea_list_len, + PULONG ea_index, BOOLEAN restart ) + { +- FIXME("(%p,%p,%p,%d,%d,%p,%d,%p,%d) stub\n", +- hFile, iosb, buffer, length, single_entry, ea_list, ++ int fd, needs_close; ++ NTSTATUS status; ++ ++ FIXME("(%p,%p,%p,%d,%d,%p,%d,%p,%d) semi-stub\n", ++ handle, iosb, buffer, length, single_entry, ea_list, + ea_list_len, ea_index, restart); +- return STATUS_ACCESS_DENIED; ++ ++ if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )) != STATUS_SUCCESS) ++ return status; ++ ++ if (buffer && length) ++ memset(buffer, 0, length); ++ ++ if (needs_close) close( fd ); ++ return STATUS_NO_EAS_ON_FILE; + } + + +diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c +index 2df0edc..3696124 100644 +--- a/dlls/ntdll/tests/file.c ++++ b/dlls/ntdll/tests/file.c +@@ -78,6 +78,7 @@ static NTSTATUS (WINAPI *pNtQueryInformationFile)(HANDLE, PIO_STATUS_BLOCK, PVOI + static NTSTATUS (WINAPI *pNtQueryDirectoryFile)(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK, + PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN); + static NTSTATUS (WINAPI *pNtQueryVolumeInformationFile)(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS); ++static NTSTATUS (WINAPI *pNtQueryEaFile)(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PULONG,BOOLEAN); + + static inline BOOL is_signaled( HANDLE obj ) + { +@@ -2785,6 +2786,86 @@ static void test_read_write(void) + CloseHandle(hfile); + } + ++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 = 4096; ++ 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 ++} ++ + START_TEST(file) + { + HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); +@@ -2820,6 +2901,7 @@ START_TEST(file) + pNtQueryInformationFile = (void *)GetProcAddress(hntdll, "NtQueryInformationFile"); + pNtQueryDirectoryFile = (void *)GetProcAddress(hntdll, "NtQueryDirectoryFile"); + pNtQueryVolumeInformationFile = (void *)GetProcAddress(hntdll, "NtQueryVolumeInformationFile"); ++ pNtQueryEaFile = (void *)GetProcAddress(hntdll, "NtQueryEaFile"); + + test_read_write(); + test_NtCreateFile(); +@@ -2839,4 +2921,5 @@ START_TEST(file) + test_file_disposition_information(); + test_query_volume_information_file(); + test_query_attribute_information_file(); ++ test_query_ea(); + } +-- +2.4.2 + diff --git a/patches/ntdll-NtQueryEaFile/definition b/patches/ntdll-NtQueryEaFile/definition new file mode 100644 index 00000000..c3a4b643 --- /dev/null +++ b/patches/ntdll-NtQueryEaFile/definition @@ -0,0 +1 @@ +Fixes: Improve stub for NtQueryEaFile diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index f95fcbec..70f1eabb 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -176,6 +176,7 @@ patch_enable_all () enable_ntdll_Hide_Wine_Exports="$1" enable_ntdll_Junction_Points="$1" enable_ntdll_LZNT1_Compression="$1" + enable_ntdll_NtQueryEaFile="$1" enable_ntdll_NtQuerySection="$1" enable_ntdll_NtSetLdtEntries="$1" enable_ntdll_Pipe_SpecialCharacters="$1" @@ -601,6 +602,9 @@ patch_enable () ntdll-LZNT1_Compression) enable_ntdll_LZNT1_Compression="$2" ;; + ntdll-NtQueryEaFile) + enable_ntdll_NtQueryEaFile="$2" + ;; ntdll-NtQuerySection) enable_ntdll_NtQuerySection="$2" ;; @@ -1812,7 +1816,11 @@ if test "$enable_ntdll_Junction_Points" -eq 1; then if test "$enable_ntdll_Fix_Free" -gt 1; then abort "Patchset ntdll-Fix_Free disabled, but ntdll-Junction_Points depends on that." fi + if test "$enable_ntdll_NtQueryEaFile" -gt 1; then + abort "Patchset ntdll-NtQueryEaFile disabled, but ntdll-Junction_Points depends on that." + fi enable_ntdll_Fix_Free=1 + enable_ntdll_NtQueryEaFile=1 fi if test "$enable_ntdll_CLI_Images" -eq 1; then @@ -3705,6 +3713,18 @@ if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-NtQueryEaFile +# | +# | Modified files: +# | * dlls/ntdll/file.c, dlls/ntdll/tests/file.c +# | +if test "$enable_ntdll_NtQueryEaFile" -eq 1; then + patch_apply ntdll-NtQueryEaFile/0001-ntdll-Improve-stub-of-NtQueryEaFile.patch + ( + echo '+ { "Sebastian Lackner", "ntdll: Improve stub of NtQueryEaFile.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-Junction_Points # | # | This patchset fixes the following Wine bugs: @@ -5118,27 +5138,18 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then ) >> "$patchlist" fi -# Patchset wined3d-UnhandledBlendFactor +# Patchset wined3d-Multisampling +# | +# | This patchset fixes the following Wine bugs: +# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE. # | # | Modified files: -# | * dlls/wined3d/state.c +# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h # | -if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then - patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch +if test "$enable_wined3d_Multisampling" -eq 1; then + patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch ( - echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset wined3d-wined3d_swapchain_present -# | -# | Modified files: -# | * dlls/wined3d/swapchain.c -# | -if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then - patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch - ( - echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },'; + echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },'; ) >> "$patchlist" fi @@ -5188,18 +5199,27 @@ if test "$enable_wined3d_resource_check_usage" -eq 1; then ) >> "$patchlist" fi -# Patchset wined3d-Multisampling -# | -# | This patchset fixes the following Wine bugs: -# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE. +# Patchset wined3d-wined3d_swapchain_present # | # | Modified files: -# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h +# | * dlls/wined3d/swapchain.c # | -if test "$enable_wined3d_Multisampling" -eq 1; then - patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch +if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then + patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch ( - echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },'; + echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset wined3d-UnhandledBlendFactor +# | +# | Modified files: +# | * dlls/wined3d/state.c +# | +if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then + patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch + ( + echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },'; ) >> "$patchlist" fi