From b5055c0b1b8301effaca2997c8fa1c454ad8ed51 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 18 Jun 2019 08:39:24 +1000 Subject: [PATCH] Rebase against 4aa7fbe0561e6a27f098a05a63c5a7d12397e678 --- ...ow-to-allocate-thread-stack-for-curr.patch | 29 +-- ...t-HashLinks-field-in-LDR-module-data.patch | 50 ++--- ...tlCreateUserThread-into-NtCreateThre.patch | 30 +-- ...Add-support-for-EXT4-case-folding-pe.patch | 189 ------------------ ...returning-a-name-in-IEnumSTATPROPSTG.patch | 2 +- patches/patchinstall.sh | 26 +-- ...-Implement-virtual_map_shared_memory.patch | 18 +- ...lement-decoding-of-SLTG-help-strings.patch | 4 +- ...ix-some-TRACE-calls-erroneously-mark.patch | 36 ++++ ...e-new-features-from-FAudio-19.06-bu.patch} | 0 ...003-Revert-xaudio2-Fix-32-bit-build.patch} | 0 ...tests-Remove-redundant-not-NULL-che.patch} | 0 ...-Add-a-trailing-n-to-an-ERR-message.patch} | 0 ...APO-Process-out-parameter-should-no.patch} | 0 ...Audio23-needs-its-own-interface-for.patch} | 0 ...x-uninitialized-variable-access-Val.patch} | 0 ...evert-xaudio2-Rewrite-to-use-FAudio.patch} | 0 ...d.patch => 0010-xaudio2_7-Fix-build.patch} | 0 18 files changed, 116 insertions(+), 268 deletions(-) delete mode 100644 patches/ntdll-ext4-case-folder/0001-ntdll-directory-Add-support-for-EXT4-case-folding-pe.patch create mode 100644 patches/xaudio2-revert/0001-Revert-xaudio2-Fix-some-TRACE-calls-erroneously-mark.patch rename patches/xaudio2-revert/{0001-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch => 0002-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch} (100%) rename patches/xaudio2-revert/{0002-Revert-xaudio2-Fix-32-bit-build.patch => 0003-Revert-xaudio2-Fix-32-bit-build.patch} (100%) rename patches/xaudio2-revert/{0003-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch => 0004-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch} (100%) rename patches/xaudio2-revert/{0004-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch => 0005-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch} (100%) rename patches/xaudio2-revert/{0005-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch => 0006-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch} (100%) rename patches/xaudio2-revert/{0006-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch => 0007-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch} (100%) rename patches/xaudio2-revert/{0007-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch => 0008-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch} (100%) rename patches/xaudio2-revert/{0008-Revert-xaudio2-Rewrite-to-use-FAudio.patch => 0009-Revert-xaudio2-Rewrite-to-use-FAudio.patch} (100%) rename patches/xaudio2-revert/{0009-xaudio2_7-Fix-build.patch => 0010-xaudio2_7-Fix-build.patch} (100%) diff --git a/patches/ntdll-Dealloc_Thread_Stack/0001-ntdll-Do-not-allow-to-allocate-thread-stack-for-curr.patch b/patches/ntdll-Dealloc_Thread_Stack/0001-ntdll-Do-not-allow-to-allocate-thread-stack-for-curr.patch index 36be7a76..f4213c6c 100644 --- a/patches/ntdll-Dealloc_Thread_Stack/0001-ntdll-Do-not-allow-to-allocate-thread-stack-for-curr.patch +++ b/patches/ntdll-Dealloc_Thread_Stack/0001-ntdll-Do-not-allow-to-allocate-thread-stack-for-curr.patch @@ -1,19 +1,19 @@ -From 9411b94da4291a8000a2bb95f9c2a5b739549d07 Mon Sep 17 00:00:00 2001 +From a01aaa21d4709e52a01198167b49c9519090a4e3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 21 Aug 2015 06:39:47 +0800 -Subject: ntdll: Do not allow to deallocate thread stack for current thread. +Subject: [PATCH] ntdll: Do not allow to deallocate thread stack for current + thread. --- dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/thread.c | 6 ++++++ dlls/ntdll/virtual.c | 12 ++++++++++++ - 3 files changed, 19 insertions(+) + 2 files changed, 13 insertions(+) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index ba296d25c3c..faa258a27f4 100644 +index f847503307b..2d037e0d7cb 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -224,6 +224,7 @@ struct ntdll_thread_data +@@ -240,6 +240,7 @@ struct ntdll_thread_data int wait_fd[2]; /* fd for sleeping server requests */ BOOL wow64_redir; /* Wow64 filesystem redirection flag */ pthread_t pthread_id; /* pthread thread id */ @@ -22,19 +22,19 @@ index ba296d25c3c..faa258a27f4 100644 C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) ); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index 4aeb282adf7..68c0148fbb5 100644 +index 5c12d87d297..f7bac9eac91 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c -@@ -1553,6 +1553,8 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi - teb->DeallocationStack = view->base; - teb->Tib.StackBase = (char *)view->base + view->size; - teb->Tib.StackLimit = (char *)view->base + 2 * page_size; -+ ((struct ntdll_thread_data *)&teb->GdiTebBatch)->pthread_stack = view->base; +@@ -1986,6 +1986,8 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SI + stack->DeallocationStack = view->base; + stack->StackBase = (char *)view->base + view->size; + stack->StackLimit = (char *)view->base + 2 * page_size; ++ ((struct ntdll_thread_data *)&NtCurrentTeb()->GdiTebBatch)->pthread_stack = view->base; + done: server_leave_uninterrupted_section( &csVirtual, &sigset ); return status; -@@ -2149,6 +2151,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si +@@ -2703,6 +2705,16 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si /* Free the pages */ if (size || (base != view->base)) status = STATUS_INVALID_PARAMETER; @@ -52,4 +52,5 @@ index 4aeb282adf7..68c0148fbb5 100644 { delete_view( view ); -- -2.13.1 +2.17.1 + diff --git a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch index 5a275df1..53da8fbc 100644 --- a/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch +++ b/patches/ntdll-HashLinks/0001-ntdll-Implement-HashLinks-field-in-LDR-module-data.patch @@ -1,16 +1,16 @@ -From 0f2ee82d68b0608b5b68fb82e001aaebdc998166 Mon Sep 17 00:00:00 2001 +From 7d5594cc0b3760843d7d566e642e175a9e542a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 3 Apr 2017 05:30:27 +0200 Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data. --- - dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ - dlls/ntdll/loader.c | 65 +++++++++++++++++++++++++++++++++++++ + dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++ + dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++ include/winternl.h | 5 ++- 3 files changed, 145 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c -index b8dc72b..63219c0 100644 +index bdcb3448ab7..8e9e780bb50 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -30,6 +30,7 @@ @@ -21,7 +21,7 @@ index b8dc72b..63219c0 100644 #include "wine/test.h" #include "delayloadhandler.h" -@@ -3858,6 +3859,79 @@ static void test_dll_file( const char *name ) +@@ -3993,6 +3994,79 @@ static void test_dll_file( const char *name ) #undef OK_FIELD } @@ -101,7 +101,7 @@ index b8dc72b..63219c0 100644 START_TEST(loader) { int argc; -@@ -3925,10 +3999,12 @@ START_TEST(loader) +@@ -4061,10 +4135,12 @@ START_TEST(loader) test_import_resolution(); test_ExitProcess(); test_InMemoryOrderModuleList(); @@ -115,10 +115,10 @@ index b8dc72b..63219c0 100644 test_Loader(); } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 994ff6f..cc764d3 100644 +index 8fe2038b346..5a3036e1246 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -93,6 +93,9 @@ static const char * const reason_names[] = +@@ -96,6 +96,9 @@ static const char * const reason_names[] = static const WCHAR dllW[] = {'.','d','l','l',0}; @@ -128,10 +128,11 @@ index 994ff6f..cc764d3 100644 /* internal representation of 32bit modules. per process. */ typedef struct _wine_modref { -@@ -427,6 +430,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) +@@ -429,6 +432,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module ) + } } - /************************************************************************* ++/************************************************************************* + * hash_basename + * + * Calculates the bucket index of a dll using the basename. @@ -177,11 +178,10 @@ index 994ff6f..cc764d3 100644 + } +} + -+/************************************************************************* + /************************************************************************* * get_modref * - * Looks for the referenced HMODULE in the current process -@@ -1150,7 +1199,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name +@@ -1176,7 +1225,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name &wm->ldr.InLoadOrderModuleList); InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList); @@ -194,7 +194,7 @@ index 994ff6f..cc764d3 100644 if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)) { -@@ -1804,6 +1858,7 @@ static void load_builtin_callback( void *module, const char *filename ) +@@ -1921,6 +1975,7 @@ static void load_builtin_callback( void *module, const char *filename ) /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -202,7 +202,7 @@ index 994ff6f..cc764d3 100644 /* FIXME: free the modref */ builtin_load_info->status = STATUS_DLL_NOT_FOUND; return; -@@ -2165,6 +2220,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam +@@ -2288,6 +2343,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam /* the module has only be inserted in the load & memory order lists */ RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -210,7 +210,7 @@ index 994ff6f..cc764d3 100644 /* FIXME: there are several more dangling references * left. Including dlls loaded by this dll before the -@@ -3322,6 +3378,7 @@ static void free_modref( WINE_MODREF *wm ) +@@ -3451,6 +3507,7 @@ static void free_modref( WINE_MODREF *wm ) { RemoveEntryList(&wm->ldr.InLoadOrderModuleList); RemoveEntryList(&wm->ldr.InMemoryOrderModuleList); @@ -218,15 +218,15 @@ index 994ff6f..cc764d3 100644 if (wm->ldr.InInitializationOrderModuleList.Flink) RemoveEntryList(&wm->ldr.InInitializationOrderModuleList); -@@ -3750,6 +3807,7 @@ void __wine_process_init(void) - ANSI_STRING func_name; +@@ -3937,6 +3994,7 @@ void __wine_process_init(void) UNICODE_STRING nt_name; void * (CDECL *init_func)(void); + INITIAL_TEB stack; + DWORD i; thread_init(); -@@ -3759,6 +3817,10 @@ void __wine_process_init(void) +@@ -3946,6 +4004,10 @@ void __wine_process_init(void) load_global_options(); @@ -237,21 +237,21 @@ index 994ff6f..cc764d3 100644 /* setup the load callback and create ntdll modref */ wine_dll_set_callback( load_builtin_callback ); -@@ -3801,6 +3863,9 @@ void __wine_process_init(void) +@@ -4000,6 +4062,9 @@ void __wine_process_init(void) RemoveEntryList( &wm->ldr.InMemoryOrderModuleList ); InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList ); + /* the windows version was not set yet when ntdll and kernel32 were loaded */ + recompute_hash_map(); + - if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0, NULL )) != STATUS_SUCCESS) + if ((status = virtual_alloc_thread_stack( &stack, 0, 0, NULL )) != STATUS_SUCCESS) { ERR( "Main exe initialization for %s failed, status %x\n", diff --git a/include/winternl.h b/include/winternl.h -index fb7b7c1..c522207 100644 +index 4cd531a4613..0d5e0e9bd8a 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2198,8 +2198,8 @@ typedef struct _LDR_MODULE +@@ -2225,8 +2225,8 @@ typedef struct _LDR_MODULE ULONG Flags; SHORT LoadCount; SHORT TlsIndex; @@ -261,7 +261,7 @@ index fb7b7c1..c522207 100644 ULONG TimeDateStamp; HANDLE ActivationContext; PVOID PatchInformation; -@@ -2209,6 +2209,9 @@ typedef struct _LDR_MODULE +@@ -2236,6 +2236,9 @@ typedef struct _LDR_MODULE PVOID ContextInformation; ULONG_PTR OriginalBase; LARGE_INTEGER LoadTime; @@ -272,5 +272,5 @@ index fb7b7c1..c522207 100644 typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA -- -1.9.1 +2.17.1 diff --git a/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch b/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch index fc289d50..99faa5e9 100644 --- a/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch +++ b/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch @@ -1,4 +1,4 @@ -From 8e50c5f3175aa3df7387e8eb409a3bfc9e889c6e Mon Sep 17 00:00:00 2001 +From 0621f527e51061a9693e7e1fdcc584afe8a8a5eb Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 27 Jul 2018 01:22:59 -0500 Subject: [PATCH] ntdll: Refactor RtlCreateUserThread into NtCreateThreadEx. @@ -7,12 +7,12 @@ League of Legends hooks NtCreateThread or NtCreateThreadEx (depending on the reported version), and expects it to be called whenever a thread is created. --- dlls/ntdll/ntdll.spec | 2 +- - dlls/ntdll/thread.c | 192 +++++++++++++++++++++++++++++++++++++++++--------- - include/winternl.h | 25 +++++++ + dlls/ntdll/thread.c | 192 ++++++++++++++++++++++++++++++++++-------- + include/winternl.h | 25 ++++++ 3 files changed, 184 insertions(+), 35 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index e36b1bd..7e19e76 100644 +index 675e2a536b3..26b0d85626b 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -155,7 +155,7 @@ @@ -25,10 +25,10 @@ index e36b1bd..7e19e76 100644 @ stdcall NtCreateTimer(ptr long ptr long) @ stub NtCreateToken diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index fbae5cc..f7cf80f 100644 +index 8af84b06b5c..aaa2cc1022b 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -527,34 +527,18 @@ static void start_thread( struct startup_info *info ) +@@ -542,34 +542,18 @@ static void start_thread( struct startup_info *info ) /*********************************************************************** * NtCreateThreadEx (NTDLL.@) */ @@ -68,9 +68,9 @@ index fbae5cc..f7cf80f 100644 HANDLE handle = 0, actctx = 0; TEB *teb = NULL; DWORD tid = 0; -@@ -564,6 +548,33 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - data_size_t len = 0; +@@ -580,6 +564,33 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, struct object_attributes *objattr = NULL; + INITIAL_TEB stack; + TRACE("(%p, %d, %p, %p, %p, %p, %u, %u, %u, %u, %p)\n", + handle_ptr, access, thread_attr, process, start, param, flags, @@ -102,7 +102,7 @@ index fbae5cc..f7cf80f 100644 if (process != NtCurrentProcess()) { apc_call_t call; -@@ -589,12 +600,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, +@@ -605,12 +616,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, return result.create_thread.status; } @@ -116,7 +116,7 @@ index fbae5cc..f7cf80f 100644 if (server_pipe( request_pipe ) == -1) { -@@ -606,7 +612,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, +@@ -622,7 +628,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, SERVER_START_REQ( new_thread ) { req->process = wine_server_obj_handle( process ); @@ -125,7 +125,7 @@ index fbae5cc..f7cf80f 100644 req->suspend = suspended; req->request_fd = request_pipe[0]; wine_server_add_data( req, objattr, len ); -@@ -664,19 +670,19 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, +@@ -684,19 +690,19 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, thread_data->wait_fd[1] = -1; thread_data->start_stack = (char *)teb->Tib.StackBase; @@ -151,7 +151,7 @@ index fbae5cc..f7cf80f 100644 pthread_sigmask( SIG_SETMASK, &sigset, NULL ); if (id) id->UniqueThread = ULongToHandle(tid); -@@ -693,6 +699,124 @@ error: +@@ -713,6 +719,124 @@ error: return status; } @@ -277,10 +277,10 @@ index fbae5cc..f7cf80f 100644 /****************************************************************************** * RtlGetNtGlobalFlags (NTDLL.@) diff --git a/include/winternl.h b/include/winternl.h -index 064293b..9d12d2f 100644 +index fbcb66ee2af..ba18fdea3a1 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2173,6 +2173,31 @@ typedef enum _SYSDBG_COMMAND { +@@ -2180,6 +2180,31 @@ typedef enum _SYSDBG_COMMAND { SysDbgWriteBusData } SYSDBG_COMMAND, *PSYSDBG_COMMAND; @@ -313,5 +313,5 @@ index 064293b..9d12d2f 100644 /************************************************************************* * Loader structures -- -2.7.4 +2.17.1 diff --git a/patches/ntdll-ext4-case-folder/0001-ntdll-directory-Add-support-for-EXT4-case-folding-pe.patch b/patches/ntdll-ext4-case-folder/0001-ntdll-directory-Add-support-for-EXT4-case-folding-pe.patch deleted file mode 100644 index 1d5b14ce..00000000 --- a/patches/ntdll-ext4-case-folder/0001-ntdll-directory-Add-support-for-EXT4-case-folding-pe.patch +++ /dev/null @@ -1,189 +0,0 @@ -From ca8e866f9653e4c045a9c59759a0d2400d4dfc2c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= -Date: Fri, 24 May 2019 15:09:34 +0300 -Subject: [PATCH 1/2] ntdll/directory: Add support for EXT4 case folding per - directory -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds support for checking the case-insensitive attribute on ext4 with -newer kernels so that Wine can rely on it for performance. - -It has some conditional processing for perf reasons. Checking for the -EXT4_CASEFOLD_FL attribute involves an ioctl, which operates on file -descriptors, while all the former checks operated directly on the dir pathname -(e.g. statfs). - -Obviously, it's best to avoid looking up the directory multiple times (also -for correctness, so it refers to the same dir). So in the case that we *do* -have a file descriptor, then use it everywhere, with e.g. fstatfs. - -However, to avoid a perf regression or downgrade on systems that don't -support the EXT2_IOC_GETFLAGS ioctl (e.g. MacOS, FreeBSD), we continue -using statfs and the like directly, this shaves off two syscalls (open/close). - -But in the case the EXT4_CASEFOLD_FL is not supported on Linux (i.e. on -current kernels) or the directory doesn't have it, this will unfortunately -involve a bit more syscalls now, because it has to open() and close() the fd, -but it shouldn't be too much of a problem. (the fstatfs and fstatat make it -less impactful somewhat, so they won't have to lookup the directory again, -hopefully mitigating some of it) - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47099 -Signed-off-by: Gabriel Ivăncescu ---- - dlls/ntdll/directory.c | 73 +++++++++++++++++++++++++++++++++++++----- - 1 file changed, 65 insertions(+), 8 deletions(-) - -diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c -index bbdbbe9781..354c00f7eb 100644 ---- a/dlls/ntdll/directory.c -+++ b/dlls/ntdll/directory.c -@@ -115,6 +115,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(file); - - /* just in case... */ - #undef VFAT_IOCTL_READDIR_BOTH -+#undef EXT2_IOC_GETFLAGS -+#undef EXT4_CASEFOLD_FL - - #ifdef linux - -@@ -130,12 +132,25 @@ typedef struct - /* Define the VFAT ioctl to get both short and long file names */ - #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, KERNEL_DIRENT [2] ) - -+/* Define the ext2 ioctl for handling extra attributes */ -+#define EXT2_IOC_GETFLAGS _IOR('f', 1, long) -+ -+/* Case-insensitivity attribute */ -+#define EXT4_CASEFOLD_FL 0x40000000 -+ - #ifndef O_DIRECTORY - # define O_DIRECTORY 0200000 /* must be directory */ - #endif - - #endif /* linux */ - -+/* Use a file descriptor for the case-sensitivity check if we have to */ -+#if defined(EXT2_IOC_GETFLAGS) && defined(EXT4_CASEFOLD_FL) -+#define GET_DIR_CASE_SENSITIVITY_USE_FD 1 -+#else -+#define GET_DIR_CASE_SENSITIVITY_USE_FD 0 -+#endif -+ - #define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1') - #define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/') - -@@ -1109,18 +1124,35 @@ static int get_dir_case_sensitivity_attr( const char *dir ) - } - #endif - -+/*********************************************************************** -+ * get_dir_case_sensitivity_ioctl -+ * -+ * Checks if the specified directory is case sensitive or not. Uses ioctl(2). -+ */ -+static int get_dir_case_sensitivity_ioctl(int fd) -+{ -+#if defined(EXT2_IOC_GETFLAGS) && defined(EXT4_CASEFOLD_FL) -+ int flags; -+ if (ioctl(fd, EXT2_IOC_GETFLAGS, &flags) != -1 && (flags & EXT4_CASEFOLD_FL)) -+ return FALSE; -+#endif -+ return -1; -+} -+ - /*********************************************************************** - * get_dir_case_sensitivity_stat - * - * Checks if the volume containing the specified directory is case -- * sensitive or not. Uses statfs(2) or statvfs(2). -+ * sensitive or not. Uses (f)statfs(2), (f)statvfs(2), or fstatat(2). - */ --static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) -+static BOOLEAN get_dir_case_sensitivity_stat( const char *dir, int fd ) - { - #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - struct statfs stfs; - -- if (statfs( dir, &stfs ) == -1) return FALSE; -+ if (fd != -1 && fstatfs( fd, &stfs ) == -1) return FALSE; -+ if (fd == -1 && statfs( dir, &stfs ) == -1) return FALSE; -+ - /* Assume these file systems are always case insensitive on Mac OS. - * For FreeBSD, only assume CIOPFS is case insensitive (AFAIK, Mac OS - * is the only UNIX that supports case-insensitive lookup). -@@ -1157,7 +1189,9 @@ static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) - #elif defined(__NetBSD__) - struct statvfs stfs; - -- if (statvfs( dir, &stfs ) == -1) return FALSE; -+ if (fd != -1 && fstatvfs( fd, &stfs ) == -1) return FALSE; -+ if (fd == -1 && statvfs( dir, &stfs ) == -1) return FALSE; -+ - /* Only assume CIOPFS is case insensitive. */ - if (strcmp( stfs.f_fstypename, "fusefs" ) || - strncmp( stfs.f_mntfromname, "ciopfs", 5 )) -@@ -1170,7 +1204,9 @@ static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) - char *cifile; - - /* Only assume CIOPFS is case insensitive. */ -- if (statfs( dir, &stfs ) == -1) return FALSE; -+ if (fd != -1 && fstatfs( fd, &stfs ) == -1) return FALSE; -+ if (fd == -1 && statfs( dir, &stfs ) == -1) return FALSE; -+ - if (stfs.f_type != 0x65735546 /* FUSE_SUPER_MAGIC */) - return TRUE; - /* Normally, we'd have to parse the mtab to find out exactly what -@@ -1180,6 +1216,13 @@ static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) - * This will break if somebody puts a file named ".ciopfs" in a non- - * CIOPFS directory. - */ -+ if (fd != -1) -+ { -+ if (fstatat( fd, ".ciopfs", &st, AT_NO_AUTOMOUNT ) == 0) -+ return FALSE; -+ return TRUE; -+ } -+ - cifile = RtlAllocateHeap( GetProcessHeap(), 0, strlen( dir )+sizeof("/.ciopfs") ); - if (!cifile) return TRUE; - strcpy( cifile, dir ); -@@ -1201,16 +1244,30 @@ static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) - * get_dir_case_sensitivity - * - * Checks if the volume containing the specified directory is case -- * sensitive or not. Uses statfs(2) or statvfs(2). -+ * sensitive or not. Uses multiple methods, depending on platform. - */ - static BOOLEAN get_dir_case_sensitivity( const char *dir ) - { -+ int case_sensitive, fd = -1; -+ - #if defined(HAVE_GETATTRLIST) && defined(ATTR_VOL_CAPABILITIES) && \ - defined(VOL_CAPABILITIES_FORMAT) && defined(VOL_CAP_FMT_CASE_SENSITIVE) -- int case_sensitive = get_dir_case_sensitivity_attr( dir ); -+ case_sensitive = get_dir_case_sensitivity_attr( dir ); - if (case_sensitive != -1) return case_sensitive; - #endif -- return get_dir_case_sensitivity_stat( dir ); -+ -+ if (GET_DIR_CASE_SENSITIVITY_USE_FD) -+ { -+ if ((fd = open(dir, O_RDONLY | O_NONBLOCK | O_LARGEFILE)) == -1) -+ return TRUE; -+ if ((case_sensitive = get_dir_case_sensitivity_ioctl(fd)) != -1) -+ goto end; -+ } -+ case_sensitive = get_dir_case_sensitivity_stat(dir, fd); -+ -+end: -+ if (fd != -1) close(fd); -+ return case_sensitive; - } - - --- -2.17.1 - diff --git a/patches/ole32-STGPROP/0003-ole32-Implement-returning-a-name-in-IEnumSTATPROPSTG.patch b/patches/ole32-STGPROP/0003-ole32-Implement-returning-a-name-in-IEnumSTATPROPSTG.patch index 4e2e5419..70889476 100644 --- a/patches/ole32-STGPROP/0003-ole32-Implement-returning-a-name-in-IEnumSTATPROPSTG.patch +++ b/patches/ole32-STGPROP/0003-ole32-Implement-returning-a-name-in-IEnumSTATPROPSTG.patch @@ -119,7 +119,7 @@ index e90e1ed4eda..bfc052966ab 100644 + + if (dictionary_find(storage->propid_to_name, UlongToPtr(src_prop->propid), (void**)&name)) + { -+ DWORD size = (strlenW(name) + 1) * sizeof(WCHAR); ++ DWORD size = (lstrlenW(name) + 1) * sizeof(WCHAR); + + dest_prop->lpwstrName = CoTaskMemAlloc(size); + if (!dest_prop->lpwstrName) return; diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index e9d2b710..475e75dd 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "c13351c05af43aa542938e0c0935b154a8166905" + echo "4aa7fbe0561e6a27f098a05a63c5a7d12397e678" } # Show version information @@ -4994,13 +4994,11 @@ fi # | * [#47099] Support for EXT4 case folding per directory. # | # | Modified files: -# | * dlls/ntdll/directory.c, dlls/ntdll/server.c +# | * dlls/ntdll/server.c # | if test "$enable_ntdll_ext4_case_folder" -eq 1; then - patch_apply ntdll-ext4-case-folder/0001-ntdll-directory-Add-support-for-EXT4-case-folding-pe.patch patch_apply ntdll-ext4-case-folder/0002-ntdll-server-Mark-drive_c-as-case-insensitive-when-c.patch ( - printf '%s\n' '+ { "Gabriel Ivăncescu", "ntdll/directory: Add support for EXT4 case folding per directory.", 1 },'; printf '%s\n' '+ { "Gabriel Ivăncescu", "ntdll/server: Mark drive_c as case-insensitive when created.", 1 },'; ) >> "$patchlist" fi @@ -7303,16 +7301,18 @@ fi # | dlls/xaudio2_8/Makefile.in, dlls/xaudio2_9/Makefile.in, include/config.h.in, include/xapo.idl, include/xaudio2.idl # | if test "$enable_xaudio2_revert" -eq 1; then - patch_apply xaudio2-revert/0001-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch - patch_apply xaudio2-revert/0002-Revert-xaudio2-Fix-32-bit-build.patch - patch_apply xaudio2-revert/0003-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch - patch_apply xaudio2-revert/0004-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch - patch_apply xaudio2-revert/0005-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch - patch_apply xaudio2-revert/0006-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch - patch_apply xaudio2-revert/0007-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch - patch_apply xaudio2-revert/0008-Revert-xaudio2-Rewrite-to-use-FAudio.patch - patch_apply xaudio2-revert/0009-xaudio2_7-Fix-build.patch + patch_apply xaudio2-revert/0001-Revert-xaudio2-Fix-some-TRACE-calls-erroneously-mark.patch + patch_apply xaudio2-revert/0002-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch + patch_apply xaudio2-revert/0003-Revert-xaudio2-Fix-32-bit-build.patch + patch_apply xaudio2-revert/0004-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch + patch_apply xaudio2-revert/0005-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch + patch_apply xaudio2-revert/0006-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch + patch_apply xaudio2-revert/0007-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch + patch_apply xaudio2-revert/0008-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch + patch_apply xaudio2-revert/0009-Revert-xaudio2-Rewrite-to-use-FAudio.patch + patch_apply xaudio2-revert/0010-xaudio2_7-Fix-build.patch ( + printf '%s\n' '+ { "Alistair Leslie-Hughes", "Revert \"xaudio2: Fix some TRACE calls erroneously marked as stubs.\".", 1 },'; printf '%s\n' '+ { "Alistair Leslie-Hughes", "Revert \"xaudio2: Use new features from FAudio 19.06 (but keep compatibility for <=19.05).\".", 1 },'; printf '%s\n' '+ { "Alistair Leslie-Hughes", "Revert \"xaudio2: Fix 32-bit build.\".", 1 },'; printf '%s\n' '+ { "Alistair Leslie-Hughes", "Revert \"xaudio2_7/tests: Remove redundant not-NULL checks (coccinellery).\".", 1 },'; diff --git a/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch b/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch index d8015b0b..e3250905 100644 --- a/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch +++ b/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch @@ -1,31 +1,31 @@ -From 1d176743641fcb4cf641858a53b7fd964514220b Mon Sep 17 00:00:00 2001 +From e6ed449896d3a86681033f1e62e86d1d73060d69 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 18 Mar 2015 23:03:01 +0100 -Subject: ntdll: Implement virtual_map_shared_memory. +Subject: [PATCH] ntdll: Implement virtual_map_shared_memory. Preparation for shared memory wineserver communication. --- dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/virtual.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ + dlls/ntdll/virtual.c | 51 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index c97b1e1f73f..9a5578c946d 100644 +index 314495640e6..24d2a40e7c5 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -172,6 +172,7 @@ extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_H +@@ -180,6 +180,7 @@ extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_H extern NTSTATUS virtual_create_builtin_view( void *base ) DECLSPEC_HIDDEN; - extern NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, + extern NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN; +extern NTSTATUS virtual_map_shared_memory( int fd, PVOID *addr_ptr, ULONG zero_bits, SIZE_T *size_ptr, ULONG protect ) DECLSPEC_HIDDEN; extern void virtual_clear_thread_stack( void *stack_end ) DECLSPEC_HIDDEN; extern BOOL virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN; extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index 9f1b6da0c5e..4f816b2b1ca 100644 +index bab2e422705..cd96d22431d 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c -@@ -2899,6 +2899,57 @@ done: +@@ -3209,6 +3209,57 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p } @@ -84,5 +84,5 @@ index 9f1b6da0c5e..4f816b2b1ca 100644 * NtUnmapViewOfSection (NTDLL.@) * ZwUnmapViewOfSection (NTDLL.@) -- -2.14.1 +2.17.1 diff --git a/patches/widl-SLTG_Typelib_Support/0023-oleaut32-Implement-decoding-of-SLTG-help-strings.patch b/patches/widl-SLTG_Typelib_Support/0023-oleaut32-Implement-decoding-of-SLTG-help-strings.patch index 8fe489fd..96f603af 100644 --- a/patches/widl-SLTG_Typelib_Support/0023-oleaut32-Implement-decoding-of-SLTG-help-strings.patch +++ b/patches/widl-SLTG_Typelib_Support/0023-oleaut32-Implement-decoding-of-SLTG-help-strings.patch @@ -88,8 +88,8 @@ index 82ea76c..0a5e07c 100644 + while ((p = lookup_code(table, table_size, &bits))) + { + static const WCHAR spaceW[] = { ' ',0 }; -+ if (buf[0]) strcatW(buf, spaceW); -+ MultiByteToWideChar(CP_ACP, 0, p, -1, buf + strlenW(buf), buf_size - strlenW(buf)); ++ if (buf[0]) lstrcatW(buf, spaceW); ++ MultiByteToWideChar(CP_ACP, 0, p, -1, buf + lstrlenW(buf), buf_size - lstrlenW(buf)); + } + + tlbstr = TLB_append_str(&lib->string_list, buf); diff --git a/patches/xaudio2-revert/0001-Revert-xaudio2-Fix-some-TRACE-calls-erroneously-mark.patch b/patches/xaudio2-revert/0001-Revert-xaudio2-Fix-some-TRACE-calls-erroneously-mark.patch new file mode 100644 index 00000000..189fbb6f --- /dev/null +++ b/patches/xaudio2-revert/0001-Revert-xaudio2-Fix-some-TRACE-calls-erroneously-mark.patch @@ -0,0 +1,36 @@ +From 7eef5a822e898b55e8530f608ccc568b252b27fc Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 18 Jun 2019 08:16:48 +1000 +Subject: [PATCH] Revert "xaudio2: Fix some TRACE calls erroneously marked as + stubs." + +This reverts commit 07d3780d6888e795e9fe6da0391991f85b5f0947. +--- + dlls/xaudio2_7/xaudio_dll.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c +index da0b0aa606..f135642524 100644 +--- a/dlls/xaudio2_7/xaudio_dll.c ++++ b/dlls/xaudio2_7/xaudio_dll.c +@@ -1811,7 +1811,7 @@ static void WINAPI IXAudio2Impl_GetPerformanceData(IXAudio2 *iface, + { + IXAudio2Impl *This = impl_from_IXAudio2(iface); + +- TRACE("(%p)->(%p)\n", This, pPerfData); ++ TRACE("(%p)->(%p): stub!\n", This, pPerfData); + + FAudio_GetPerformanceData(This->faudio, (FAudioPerformanceData *)pPerfData); + } +@@ -1822,7 +1822,7 @@ static void WINAPI IXAudio2Impl_SetDebugConfiguration(IXAudio2 *iface, + { + IXAudio2Impl *This = impl_from_IXAudio2(iface); + +- TRACE("(%p)->(%p, %p)\n", This, pDebugConfiguration, pReserved); ++ TRACE("(%p)->(%p, %p): stub!\n", This, pDebugConfiguration, pReserved); + + FAudio_SetDebugConfiguration(This->faudio, (FAudioDebugConfiguration *)pDebugConfiguration, pReserved); + } +-- +2.17.1 + diff --git a/patches/xaudio2-revert/0001-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch b/patches/xaudio2-revert/0002-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch similarity index 100% rename from patches/xaudio2-revert/0001-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch rename to patches/xaudio2-revert/0002-Revert-xaudio2-Use-new-features-from-FAudio-19.06-bu.patch diff --git a/patches/xaudio2-revert/0002-Revert-xaudio2-Fix-32-bit-build.patch b/patches/xaudio2-revert/0003-Revert-xaudio2-Fix-32-bit-build.patch similarity index 100% rename from patches/xaudio2-revert/0002-Revert-xaudio2-Fix-32-bit-build.patch rename to patches/xaudio2-revert/0003-Revert-xaudio2-Fix-32-bit-build.patch diff --git a/patches/xaudio2-revert/0003-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch b/patches/xaudio2-revert/0004-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch similarity index 100% rename from patches/xaudio2-revert/0003-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch rename to patches/xaudio2-revert/0004-Revert-xaudio2_7-tests-Remove-redundant-not-NULL-che.patch diff --git a/patches/xaudio2-revert/0004-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch b/patches/xaudio2-revert/0005-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch similarity index 100% rename from patches/xaudio2-revert/0004-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch rename to patches/xaudio2-revert/0005-Revert-xaudio2_7-Add-a-trailing-n-to-an-ERR-message.patch diff --git a/patches/xaudio2-revert/0005-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch b/patches/xaudio2-revert/0006-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch similarity index 100% rename from patches/xaudio2-revert/0005-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch rename to patches/xaudio2-revert/0006-Revert-xaudio2-IXAPO-Process-out-parameter-should-no.patch diff --git a/patches/xaudio2-revert/0006-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch b/patches/xaudio2-revert/0007-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch similarity index 100% rename from patches/xaudio2-revert/0006-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch rename to patches/xaudio2-revert/0007-Revert-xaudio2-IXAudio23-needs-its-own-interface-for.patch diff --git a/patches/xaudio2-revert/0007-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch b/patches/xaudio2-revert/0008-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch similarity index 100% rename from patches/xaudio2-revert/0007-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch rename to patches/xaudio2-revert/0008-Revert-xaudio2-Fix-uninitialized-variable-access-Val.patch diff --git a/patches/xaudio2-revert/0008-Revert-xaudio2-Rewrite-to-use-FAudio.patch b/patches/xaudio2-revert/0009-Revert-xaudio2-Rewrite-to-use-FAudio.patch similarity index 100% rename from patches/xaudio2-revert/0008-Revert-xaudio2-Rewrite-to-use-FAudio.patch rename to patches/xaudio2-revert/0009-Revert-xaudio2-Rewrite-to-use-FAudio.patch diff --git a/patches/xaudio2-revert/0009-xaudio2_7-Fix-build.patch b/patches/xaudio2-revert/0010-xaudio2_7-Fix-build.patch similarity index 100% rename from patches/xaudio2-revert/0009-xaudio2_7-Fix-build.patch rename to patches/xaudio2-revert/0010-xaudio2_7-Fix-build.patch