From 2be4bfb8fe164503238cde477246365ebbd5363b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 3 Feb 2021 16:10:49 -0600 Subject: [PATCH] Rebase against 2201ca08fb03d069fa2ccf46773c150a6f7988bc. --- ...nvalid-characters-from-mask-in-FindF.patch | 72 ---------- ...dd-tests-for-FindFirstFileA-with-inv.patch | 135 ------------------ patches/kernel32-FindFirstFile/definition | 1 - patches/patchinstall.sh | 20 +-- ...te-WinRT-runtimeclass-name-constants.patch | 35 ----- staging/upstream-commit | 2 +- 6 files changed, 2 insertions(+), 263 deletions(-) delete mode 100644 patches/kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch delete mode 100644 patches/kernel32-FindFirstFile/0002-kernel32-tests-Add-tests-for-FindFirstFileA-with-inv.patch delete mode 100644 patches/kernel32-FindFirstFile/definition delete mode 100644 patches/widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch diff --git a/patches/kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch b/patches/kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch deleted file mode 100644 index 54f7d320..00000000 --- a/patches/kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6b8f0a1f1283cb47bf1156745a42e50bb32d3d2f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sat, 6 Feb 2016 18:31:25 +0100 -Subject: [PATCH] kernel32: Strip invalid characters from mask in - FindFirstFileExW. - ---- - dlls/kernelbase/file.c | 26 ++++++++++++++++++++++---- - 1 file changed, 22 insertions(+), 4 deletions(-) - -diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c -index 6591a110732..fd411b7baac 100644 ---- a/dlls/kernelbase/file.c -+++ b/dlls/kernelbase/file.c -@@ -790,6 +790,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_ - WCHAR *mask; - BOOL has_wildcard = FALSE; - FIND_FIRST_INFO *info = NULL; -+ UNICODE_STRING mask_str; - UNICODE_STRING nt_name; - OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; -@@ -821,6 +822,8 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_ - return INVALID_HANDLE_VALUE; - } - -+ RtlInitUnicodeString( &mask_str, NULL ); -+ - if (!mask && (device = RtlIsDosDeviceName_U( filename ))) - { - WCHAR *dir = NULL; -@@ -854,8 +857,26 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_ - } - else - { -+ static const WCHAR invalidW[] = { '<', '>', '\"', 0 }; -+ DWORD mask_len = lstrlenW( mask ); -+ -+ /* strip invalid characters from mask */ -+ while (mask_len && wcschr( invalidW, mask[mask_len - 1] )) -+ mask_len--; -+ -+ if (!mask_len) -+ { -+ has_wildcard = TRUE; -+ RtlInitUnicodeString( &mask_str, L"*?" ); -+ } -+ else -+ { -+ has_wildcard = wcspbrk( mask, L"*?" ) != NULL; -+ RtlInitUnicodeString( &mask_str, mask ); -+ mask_str.Length = mask_len * sizeof(WCHAR); -+ } -+ - nt_name.Length = (mask - nt_name.Buffer) * sizeof(WCHAR); -- has_wildcard = wcspbrk( mask, L"*?" ) != NULL; - size = has_wildcard ? 8192 : max_entry_size; - } - -@@ -916,9 +937,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_ - } - else - { -- UNICODE_STRING mask_str; -- -- RtlInitUnicodeString( &mask_str, mask ); - status = NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size, - FileBothDirectoryInformation, FALSE, &mask_str, TRUE ); - if (status) --- -2.25.1 - diff --git a/patches/kernel32-FindFirstFile/0002-kernel32-tests-Add-tests-for-FindFirstFileA-with-inv.patch b/patches/kernel32-FindFirstFile/0002-kernel32-tests-Add-tests-for-FindFirstFileA-with-inv.patch deleted file mode 100644 index a4f6d9ff..00000000 --- a/patches/kernel32-FindFirstFile/0002-kernel32-tests-Add-tests-for-FindFirstFileA-with-inv.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 29a12264fdd49cdb5b815064c2767e7fc349133b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sat, 6 Feb 2016 18:32:09 +0100 -Subject: kernel32/tests: Add tests for FindFirstFileA with invalid characters. - -Includes testcases by Vincent Pelletier. ---- - dlls/kernel32/tests/file.c | 100 ++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 99 insertions(+), 1 deletion(-) - -diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c -index 53dc04b..a7ac09c 100644 ---- a/dlls/kernel32/tests/file.c -+++ b/dlls/kernel32/tests/file.c -@@ -2517,11 +2517,85 @@ static char get_windows_drive(void) - return windowsdir[0]; - } - -+struct -+{ -+ const char *path; -+ BOOL expected; -+} -+static const invalid_char_tests[] = -+{ -+ { "./test-dir", TRUE }, -+ { "./test-dir/", FALSE }, -+ { ".\\test-dir", TRUE }, -+ { ".\\test-dir\\", FALSE }, -+ { "/>test-dir", FALSE }, -+ { "<\"test->dir", FALSE }, -+ { "dir", FALSE }, -+ { ">dir", FALSE }, -+ { ">>test-dir", FALSE }, -+ { ">test->dir", FALSE }, -+ { ">test-dir", FALSE }, -+ { "\"test-dir\"", FALSE }, -+ { "\"test-file\"", FALSE }, -+ { "test-/>dir", FALSE }, -+ { "test-dir/", FALSE }, -+ { "test-dir//", FALSE }, -+ { "test-dir/:", FALSE }, -+ { "test-dir/<", TRUE }, -+ { "test-dir/>", TRUE }, -+ { "test-dir/\"", TRUE }, -+ { "test-dir/\\", FALSE }, -+ { "test-dir/|", FALSE }, -+ { "test-dir<", TRUE }, -+ { "test-dir<><>\"\"\"\"<<<>", TRUE }, -+ { "test-dir<>", TRUE }, -+ { "test-dir<\"", TRUE }, -+ { "test-dir>", TRUE }, -+ { "test-dir>/", FALSE }, -+ { "test-dir><", TRUE }, -+ { "test-dir>>", TRUE }, -+ { "test-dir>\"", TRUE }, -+ { "test-dir\"", TRUE }, -+ { "test-dir\"/", FALSE }, -+ { "test-dir\"<", TRUE }, -+ { "test-dir\">", TRUE }, -+ { "test-dir\"\"", TRUE }, -+ { "test-dir\"\"\"\"\"", TRUE }, -+ { "test-dir\\", FALSE }, -+ { "test-dir\\/", FALSE }, -+ { "test-dir\\<", TRUE }, -+ { "test-dir\\>", TRUE }, -+ { "test-dir\\\"", TRUE }, -+ { "test-dir\\\\", FALSE }, -+ { "test-file/", FALSE }, -+ { "test-file/<", FALSE }, -+ { "test-file/>", FALSE }, -+ { "test-file/\"", FALSE }, -+ { "test-file<", TRUE }, -+ { "test-file<<", TRUE }, -+ { "test-file<>", TRUE }, -+ { "test-file<\"", TRUE }, -+ { "test-file>", TRUE }, -+ { "test-file><", TRUE }, -+ { "test-file>>", TRUE }, -+ { "test-file>\"", TRUE }, -+ { "test-file\"", TRUE }, -+ { "test-file\"<", TRUE }, -+ { "test-file\">", TRUE }, -+ { "test-file\"\"", TRUE }, -+ { "test-file\\", FALSE }, -+ { "test-file\\<", FALSE }, -+ { "test-file\\>", FALSE }, -+ { "test-file\\\"", FALSE }, -+}; -+ - static void test_FindFirstFileA(void) - { - HANDLE handle; - WIN32_FIND_DATAA data; -- int err; -+ int err, i; - char buffer[5] = "C:\\"; - char buffer2[100]; - char nonexistent[MAX_PATH]; -@@ -2689,6 +2763,30 @@ static void test_FindFirstFileA(void) - err = GetLastError(); - ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should fail\n", buffer2 ); - ok ( err == ERROR_PATH_NOT_FOUND, "Bad Error number %d\n", err ); -+ -+ /* try FindFirstFileA with invalid characters */ -+ CreateDirectoryA("test-dir", NULL); -+ _lclose(_lcreat("test-file", 0)); -+ -+ for (i = 0; i < sizeof(invalid_char_tests) / sizeof(invalid_char_tests[0]); i++) -+ { -+ handle = FindFirstFileA(invalid_char_tests[i].path, &data); -+ if (invalid_char_tests[i].expected) -+ { -+ ok(handle != INVALID_HANDLE_VALUE, "FindFirstFileA on %s should succeed\n", -+ invalid_char_tests[i].path); -+ } -+ else -+ { -+ ok(handle == INVALID_HANDLE_VALUE, "FindFirstFileA on %s should fail\n", -+ invalid_char_tests[i].path); -+ } -+ if (handle != INVALID_HANDLE_VALUE) -+ FindClose(handle); -+ } -+ -+ DeleteFileA("test-file"); -+ RemoveDirectoryA("test-dir"); - } - - static void test_FindNextFileA(void) --- -2.7.0 - diff --git a/patches/kernel32-FindFirstFile/definition b/patches/kernel32-FindFirstFile/definition deleted file mode 100644 index 5c04a439..00000000 --- a/patches/kernel32-FindFirstFile/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [22635] Strip invalid characters from mask in FindFirstFileExW diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 930d1941..823f62a1 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "433b9081ba7c862feb947400f507228e793d7d4c" + echo "2201ca08fb03d069fa2ccf46773c150a6f7988bc" } # Show version information @@ -136,7 +136,6 @@ patch_enable_all () enable_iphlpapi_System_Ping="$1" enable_kernel32_CopyFileEx="$1" enable_kernel32_Debugger="$1" - enable_kernel32_FindFirstFile="$1" enable_kernel32_Job_Tests="$1" enable_kernel32_Processor_Group="$1" enable_krnl386_exe16_GDT_LDT_Emulation="$1" @@ -493,9 +492,6 @@ patch_enable () kernel32-Debugger) enable_kernel32_Debugger="$2" ;; - kernel32-FindFirstFile) - enable_kernel32_FindFirstFile="$2" - ;; kernel32-Job_Tests) enable_kernel32_Job_Tests="$2" ;; @@ -2812,19 +2808,6 @@ if test "$enable_kernel32_Debugger" -eq 1; then patch_apply kernel32-Debugger/0001-kernel32-Always-start-debugger-on-WinSta0.patch fi -# Patchset kernel32-FindFirstFile -# | -# | This patchset fixes the following Wine bugs: -# | * [#22635] Strip invalid characters from mask in FindFirstFileExW -# | -# | Modified files: -# | * dlls/kernel32/tests/file.c, dlls/kernelbase/file.c -# | -if test "$enable_kernel32_FindFirstFile" -eq 1; then - patch_apply kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch - patch_apply kernel32-FindFirstFile/0002-kernel32-tests-Add-tests-for-FindFirstFileA-with-inv.patch -fi - # Patchset kernel32-Job_Tests # | # | Modified files: @@ -4450,7 +4433,6 @@ fi # | tools/widl/widltypes.h # | if test "$enable_widl_winrt_support" -eq 1; then - patch_apply widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch patch_apply widl-winrt-support/0005-widl-Support-using-qualified-names-for-interfaces.patch patch_apply widl-winrt-support/0006-widl-Support-WinRT-static-attribute-parsing.patch patch_apply widl-winrt-support/0007-widl-Support-WinRT-requires-keyword.patch diff --git a/patches/widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch b/patches/widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch deleted file mode 100644 index 1ceb13d3..00000000 --- a/patches/widl-winrt-support/0002-widl-Generate-WinRT-runtimeclass-name-constants.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 41ffc864a47b18e138fe92e6f5be78d9cc1e7936 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Tue, 19 Jan 2021 13:51:25 +0100 -Subject: [PATCH] widl: Generate WinRT runtimeclass name constants. - ---- - tools/widl/header.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/tools/widl/header.c b/tools/widl/header.c -index ad205df0d05..153437971cc 100644 ---- a/tools/widl/header.c -+++ b/tools/widl/header.c -@@ -1698,6 +1698,7 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass) - { - expr_t *contract = get_attrp(runtimeclass->attrs, ATTR_CONTRACT); - char *name, *c_name; -+ size_t i, len; - name = format_namespace(runtimeclass->namespace, "", ".", runtimeclass->name, NULL); - c_name = format_namespace(runtimeclass->namespace, "", "_", runtimeclass->name, NULL); - fprintf(header, "/*\n"); -@@ -1706,6 +1707,10 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass) - if (contract) write_apicontract_guard_start(header, contract); - fprintf(header, "#ifndef RUNTIMECLASS_%s_DEFINED\n", c_name); - fprintf(header, "#define RUNTIMECLASS_%s_DEFINED\n", c_name); -+ /* FIXME: MIDL generates extern const here but GCC warns if extern is initialized */ -+ fprintf(header, "/*extern*/ const DECLSPEC_SELECTANY WCHAR RuntimeClass_%s[] = {", c_name); -+ for (i = 0, len = strlen(name); i < len; ++i) fprintf(header, "'%c',", name[i]); -+ fprintf(header, "0};\n"); - fprintf(header, "#endif /* RUNTIMECLASS_%s_DEFINED */\n", c_name); - free(c_name); - free(name); --- -2.29.2 - diff --git a/staging/upstream-commit b/staging/upstream-commit index 8a3b2b68..d3d5dbbc 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -433b9081ba7c862feb947400f507228e793d7d4c +2201ca08fb03d069fa2ccf46773c150a6f7988bc