From f1917e904a666bf492b8109f29869ff14f8c2623 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 5 Jun 2020 15:06:03 -0500 Subject: [PATCH] Rebase against 3cc3b445752902e07231900befc296f74ad6576e. --- patches/eventfd_synchronization/definition | 1 - ...tlCreateUserThread-into-NtCreateThre.patch | 287 ------------------ patches/ntdll-RtlCreateUserThread/definition | 2 - ...ss-virtual-memory-counters-in-NtQuer.patch | 16 +- patches/patchinstall.sh | 31 +- ...ate-syscall-thunks-for-ntdll-exports.patch | 32 +- ...e-client-side-file-descriptor-cache-.patch | 30 +- staging/upstream-commit | 2 +- 8 files changed, 41 insertions(+), 360 deletions(-) delete mode 100644 patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch delete mode 100644 patches/ntdll-RtlCreateUserThread/definition diff --git a/patches/eventfd_synchronization/definition b/patches/eventfd_synchronization/definition index e21e1458..1f084c73 100644 --- a/patches/eventfd_synchronization/definition +++ b/patches/eventfd_synchronization/definition @@ -4,7 +4,6 @@ Fixes: [36692] Many multi-threaded applications have poor performance due to hea Depends: server-Shared_Memory Depends: ntdll-SystemRoot_Symlink Depends: ws2_32-WSACleanup -Depends: ntdll-RtlCreateUserThread Depends: server-Realtime_Priority Depends: advapi32-Token_Integrity_Level Depends: ntdll-Junction_Points diff --git a/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch b/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch deleted file mode 100644 index 83ff1152..00000000 --- a/patches/ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch +++ /dev/null @@ -1,287 +0,0 @@ -From df45ba13b75af0ae4c8c4166e39f9e640942466b 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. - -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 | 180 +++++++++++++++++++++++++++++++++++------- - include/winternl.h | 27 +++++++ - 3 files changed, 180 insertions(+), 29 deletions(-) - -diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 42532bd9f1c..65fdc30d7a4 100644 ---- a/dlls/ntdll/ntdll.spec -+++ b/dlls/ntdll/ntdll.spec -@@ -182,7 +182,7 @@ - @ stdcall NtCreateSection(ptr long ptr ptr long long long) - @ stdcall NtCreateSemaphore(ptr long ptr long long) - @ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr) --@ stub NtCreateThread -+@ stdcall NtCreateThread(ptr long ptr long ptr ptr ptr long) - @ stdcall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr) - @ stdcall NtCreateTimer(ptr long ptr long) - @ stub NtCreateToken -diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index d5e34cae3b1..4e1b3f23b7c 100644 ---- a/dlls/ntdll/thread.c -+++ b/dlls/ntdll/thread.c -@@ -377,28 +377,10 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void * - /*********************************************************************** - * NtCreateThreadEx (NTDLL.@) - */ --NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, -- HANDLE process, LPTHREAD_START_ROUTINE start, void *param, -+NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *thread_attr, -+ HANDLE process, PRTL_THREAD_START_ROUTINE start, void *param, - ULONG flags, ULONG zero_bits, ULONG stack_commit, -- ULONG stack_reserve, void *attribute_list ) --{ -- FIXME( "%p, %x, %p, %p, %p, %p, %x, %x, %x, %x, %p semi-stub!\n", handle_ptr, access, attr, -- process, start, param, flags, zero_bits, stack_commit, stack_reserve, attribute_list ); -- -- return RtlCreateUserThread( process, NULL, flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED, -- NULL, stack_reserve, stack_commit, (PRTL_THREAD_START_ROUTINE)start, -- param, handle_ptr, NULL ); --} -- -- --/*********************************************************************** -- * RtlCreateUserThread (NTDLL.@) -- */ --NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, -- BOOLEAN suspended, PVOID stack_addr, -- SIZE_T stack_reserve, SIZE_T stack_commit, -- PRTL_THREAD_START_ROUTINE start, void *param, -- HANDLE *handle_ptr, CLIENT_ID *id ) -+ ULONG stack_reserve, PPS_ATTRIBUTE_LIST ps_attr_list ) - { - HANDLE handle = 0, actctx = 0; - DWORD tid = 0; -@@ -406,6 +388,35 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - NTSTATUS status; - data_size_t len = 0; - struct object_attributes *objattr = NULL; -+ BOOLEAN suspended = !!(flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED); -+ CLIENT_ID *id = NULL; -+ -+ TRACE("(%p, %d, %p, %p, %p, %p, %u, %u, %u, %u, %p)\n", -+ handle_ptr, access, thread_attr, process, start, param, flags, -+ zero_bits, stack_commit, stack_reserve, ps_attr_list); -+ -+ if (ps_attr_list != NULL) -+ { -+ PS_ATTRIBUTE *ps_attr, -+ *ps_attr_end = (PS_ATTRIBUTE *)((UINT_PTR)ps_attr_list + ps_attr_list->TotalLength); -+ for (ps_attr = &ps_attr_list->Attributes[0]; ps_attr < ps_attr_end; ps_attr++) -+ { -+ switch (ps_attr->Attribute) -+ { -+ case PS_ATTRIBUTE_CLIENT_ID: -+ /* TODO validate ps_attr->Size == sizeof(CLIENT_ID) */ -+ /* TODO set *ps_attr->ReturnLength */ -+ id = ps_attr->ValuePtr; -+ break; -+ default: -+ FIXME("Unsupported attribute %08X\n", ps_attr->Attribute); -+ break; -+ } -+ } -+ } -+ -+ if (access == (ACCESS_MASK)0) -+ access = THREAD_ALL_ACCESS; - - if (process != NtCurrentProcess()) - { -@@ -432,12 +443,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - return result.create_thread.status; - } - -- if (descr) -- { -- OBJECT_ATTRIBUTES thread_attr; -- InitializeObjectAttributes( &thread_attr, NULL, 0, NULL, descr ); -- if ((status = alloc_object_attributes( &thread_attr, &objattr, &len ))) return status; -- } -+ if ((status = alloc_object_attributes( thread_attr, &objattr, &len ))) return status; - - if (unix_funcs->server_pipe( request_pipe ) == -1) - { -@@ -449,7 +455,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - SERVER_START_REQ( new_thread ) - { - req->process = wine_server_obj_handle( process ); -- req->access = THREAD_ALL_ACCESS; -+ req->access = access; - req->suspend = suspended; - req->request_fd = request_pipe[0]; - wine_server_add_data( req, objattr, len ); -@@ -539,6 +545,124 @@ NTSTATUS WINAPI NtSuspendThread( HANDLE handle, PULONG count ) - return ret; - } - -+NTSTATUS WINAPI NtCreateThread( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, HANDLE process, -+ CLIENT_ID *id, CONTEXT *context, INITIAL_TEB *teb, BOOLEAN suspended ) -+{ -+ PRTL_THREAD_START_ROUTINE entry; -+ void *arg; -+ ULONG flags = suspended ? THREAD_CREATE_FLAGS_CREATE_SUSPENDED : 0; -+ PS_ATTRIBUTE_LIST attr_list, *pattr_list = NULL; -+ -+#if defined(__i386__) -+ entry = (PRTL_THREAD_START_ROUTINE) context->Eax; -+ arg = (void *)context->Ebx; -+#elif defined(__x86_64__) -+ entry = (PRTL_THREAD_START_ROUTINE) context->Rcx; -+ arg = (void *)context->Rdx; -+#elif defined(__arm__) -+ entry = (PRTL_THREAD_START_ROUTINE) context->R0; -+ arg = (void *)context->R1; -+#elif defined(__aarch64__) -+ entry = (PRTL_THREAD_START_ROUTINE) context->u.X0; -+ arg = (void *)context->u.X1; -+#elif defined(__powerpc__) -+ entry = (PRTL_THREAD_START_ROUTINE) context->Gpr3; -+ arg = (void *)context->Gpr4; -+#endif -+ -+ if (id) -+ { -+ attr_list.TotalLength = sizeof(PS_ATTRIBUTE_LIST); -+ attr_list.Attributes[0].Attribute = PS_ATTRIBUTE_CLIENT_ID; -+ attr_list.Attributes[0].Size = sizeof(CLIENT_ID); -+ attr_list.Attributes[0].ValuePtr = id; -+ attr_list.Attributes[0].ReturnLength = NULL; -+ pattr_list = &attr_list; -+ } -+ -+ return NtCreateThreadEx(handle_ptr, access, attr, process, entry, arg, flags, 0, 0, 0, pattr_list); -+} -+ -+NTSTATUS WINAPI __syscall_NtCreateThread( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, -+ HANDLE process, CLIENT_ID *id, CONTEXT *context, INITIAL_TEB *teb, -+ BOOLEAN suspended ); -+NTSTATUS WINAPI __syscall_NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, -+ HANDLE process, LPTHREAD_START_ROUTINE start, void *param, -+ ULONG flags, ULONG zero_bits, ULONG stack_commit, -+ ULONG stack_reserve, PPS_ATTRIBUTE_LIST ps_attr_list ); -+ -+/*********************************************************************** -+ * RtlCreateUserThread (NTDLL.@) -+ */ -+NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, -+ BOOLEAN suspended, void *stack_addr, -+ SIZE_T stack_reserve, SIZE_T stack_commit, -+ PRTL_THREAD_START_ROUTINE entry, void *arg, -+ HANDLE *handle_ptr, CLIENT_ID *id ) -+{ -+ OBJECT_ATTRIBUTES thread_attr; -+ InitializeObjectAttributes( &thread_attr, NULL, 0, NULL, descr ); -+ if (stack_addr) -+ FIXME("stack_addr != NULL is unimplemented\n"); -+ -+ if (NtCurrentTeb()->Peb->OSMajorVersion < 6) -+ { -+ /* Use old API. */ -+ CONTEXT context = { 0 }; -+ -+ if (stack_commit) -+ FIXME("stack_commit != 0 is unimplemented\n"); -+ if (stack_reserve) -+ FIXME("stack_reserve != 0 is unimplemented\n"); -+ -+ context.ContextFlags = CONTEXT_FULL; -+#if defined(__i386__) -+ context.Eax = (DWORD)entry; -+ context.Ebx = (DWORD)arg; -+#elif defined(__x86_64__) -+ context.Rcx = (ULONG_PTR)entry; -+ context.Rdx = (ULONG_PTR)arg; -+#elif defined(__arm__) -+ context.R0 = (DWORD)entry; -+ context.R1 = (DWORD)arg; -+#elif defined(__aarch64__) -+ context.u.X0 = (DWORD_PTR)entry; -+ context.u.X1 = (DWORD_PTR)arg; -+#elif defined(__powerpc__) -+ context.Gpr3 = (DWORD)entry; -+ context.Gpr4 = (DWORD)arg; -+#endif -+ -+#if defined(__i386__) || defined(__x86_64__) -+ return __syscall_NtCreateThread(handle_ptr, (ACCESS_MASK)0, &thread_attr, process, id, &context, NULL, suspended); -+#else -+ return NtCreateThread(handle_ptr, (ACCESS_MASK)0, &thread_attr, process, id, &context, NULL, suspended); -+#endif -+ } -+ else -+ { -+ /* Use new API from Vista+. */ -+ ULONG flags = suspended ? THREAD_CREATE_FLAGS_CREATE_SUSPENDED : 0; -+ PS_ATTRIBUTE_LIST attr_list, *pattr_list = NULL; -+ -+ if (id) -+ { -+ attr_list.TotalLength = sizeof(PS_ATTRIBUTE_LIST); -+ attr_list.Attributes[0].Attribute = PS_ATTRIBUTE_CLIENT_ID; -+ attr_list.Attributes[0].Size = sizeof(CLIENT_ID); -+ attr_list.Attributes[0].ValuePtr = id; -+ attr_list.Attributes[0].ReturnLength = NULL; -+ pattr_list = &attr_list; -+ } -+ -+#if defined(__i386__) || defined(__x86_64__) -+ return __syscall_NtCreateThreadEx(handle_ptr, (ACCESS_MASK)0, &thread_attr, process, (LPTHREAD_START_ROUTINE)entry, arg, flags, 0, stack_commit, stack_reserve, pattr_list); -+#else -+ return NtCreateThreadEx(handle_ptr, (ACCESS_MASK)0, &thread_attr, process, (LPTHREAD_START_ROUTINE)entry, arg, flags, 0, stack_commit, stack_reserve, pattr_list); -+#endif -+ } -+} -+ - - /****************************************************************************** - * NtResumeThread (NTDLL.@) -diff --git a/include/winternl.h b/include/winternl.h -index f362790dbca..b79fcd67012 100644 ---- a/include/winternl.h -+++ b/include/winternl.h -@@ -2274,6 +2274,33 @@ typedef struct _NLSTABLEINFO - USHORT *LowerCaseTable; - } NLSTABLEINFO, *PNLSTABLEINFO; - -+#define PS_ATTRIBUTE_THREAD 0x00010000 -+#define PS_ATTRIBUTE_INPUT 0x00020000 -+#define PS_ATTRIBUTE_UNKNOWN 0x00040000 -+ -+typedef enum _PS_ATTRIBUTE_NUM { -+ PsAttributeClientId = 3, -+} PS_ATTRIBUTE_NUM; -+ -+#define PS_ATTRIBUTE_CLIENT_ID (PsAttributeClientId | PS_ATTRIBUTE_THREAD) -+ -+typedef struct _PS_ATTRIBUTE { -+ ULONG Attribute; -+ SIZE_T Size; -+ union { -+ ULONG Value; -+ PVOID ValuePtr; -+ }; -+ PSIZE_T ReturnLength; -+} PS_ATTRIBUTE; -+ -+typedef struct _PS_ATTRIBUTE_LIST { -+ SIZE_T TotalLength; -+ PS_ATTRIBUTE Attributes[1]; -+} PS_ATTRIBUTE_LIST, *PPS_ATTRIBUTE_LIST; -+ -+ -+ - /************************************************************************* - * Loader structures - * --- -2.26.2 - diff --git a/patches/ntdll-RtlCreateUserThread/definition b/patches/ntdll-RtlCreateUserThread/definition deleted file mode 100644 index f9fbdcf1..00000000 --- a/patches/ntdll-RtlCreateUserThread/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [45571] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of NtCreateThread/Ex) -Depends: winebuild-Fake_Dlls diff --git a/patches/ntdll-ThreadTime/0006-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch b/patches/ntdll-ThreadTime/0006-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch index 7b2e48dd..829d8f4d 100644 --- a/patches/ntdll-ThreadTime/0006-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch +++ b/patches/ntdll-ThreadTime/0006-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch @@ -1,4 +1,4 @@ -From 4fd43a8364333519e777718b66e628ace1ad9fff Mon Sep 17 00:00:00 2001 +From ee29bbfa7e10de295db39ab6b89f2175d00692c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 9 Mar 2017 22:56:45 +0100 Subject: [PATCH] ntdll: Fill process virtual memory counters in @@ -29,10 +29,10 @@ index cbb7937631d..bb078c1aa21 100644 } len += procstructlen; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 3ea0dd81349..3e2fa3642c1 100644 +index 6e77694d87b..d725a678246 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -249,6 +249,7 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR); +@@ -248,6 +248,7 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR); /* process / thread time */ extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck, LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN; @@ -41,7 +41,7 @@ index 3ea0dd81349..3e2fa3642c1 100644 /* string functions */ int __cdecl NTDLL_tolower( int c ); diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c -index f47d3c4bc6c..b36fc037dc5 100644 +index 35937ce6026..b4f2dbc8160 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -192,7 +192,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) @@ -54,11 +54,11 @@ index f47d3c4bc6c..b36fc037dc5 100644 #endif diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index cd1b65a210c..71051adc8b0 100644 +index 14198d77b7b..8ae8251f975 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -355,6 +355,42 @@ void WINAPI RtlExitUserThread( ULONG status ) - for (;;) unix_funcs->exit_thread( status ); +@@ -381,6 +381,42 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT + flags, zero_bits, stack_commit, stack_reserve, attr_list ); } +BOOL read_process_memory_stats(int unix_pid, VM_COUNTERS *pvmi) @@ -99,7 +99,7 @@ index cd1b65a210c..71051adc8b0 100644 +} /*********************************************************************** - * call_thread_entry_point + * RtlCreateUserThread (NTDLL.@) -- 2.26.2 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index f790eae0..800cdcdf 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "3c72034b72014a087eae8d181252c67cb0782e28" + echo "3cc3b445752902e07231900befc296f74ad6576e" } # Show version information @@ -190,7 +190,6 @@ patch_enable_all () enable_ntdll_NtSetLdtEntries="$1" enable_ntdll_Pipe_SpecialCharacters="$1" enable_ntdll_ProcessQuotaLimits="$1" - enable_ntdll_RtlCreateUserThread="$1" enable_ntdll_RtlQueryPackageIdentity="$1" enable_ntdll_RtlQueryRegistryValuesEx="$1" enable_ntdll_Serial_Port_Detection="$1" @@ -670,9 +669,6 @@ patch_enable () ntdll-ProcessQuotaLimits) enable_ntdll_ProcessQuotaLimits="$2" ;; - ntdll-RtlCreateUserThread) - enable_ntdll_RtlCreateUserThread="$2" - ;; ntdll-RtlQueryPackageIdentity) enable_ntdll_RtlQueryPackageIdentity="$2" ;; @@ -1676,13 +1672,6 @@ if test "$enable_ntdll_Syscall_Emulation" -eq 1; then enable_winebuild_Fake_Dlls=1 fi -if test "$enable_ntdll_RtlCreateUserThread" -eq 1; then - if test "$enable_winebuild_Fake_Dlls" -gt 1; then - abort "Patchset winebuild-Fake_Dlls disabled, but ntdll-RtlCreateUserThread depends on that." - fi - enable_winebuild_Fake_Dlls=1 -fi - if test "$enable_ntdll_NtQueryEaFile" -eq 1; then if test "$enable_ntdll_Junction_Points" -gt 1; then abort "Patchset ntdll-Junction_Points disabled, but ntdll-NtQueryEaFile depends on that." @@ -4170,24 +4159,6 @@ if test "$enable_ntdll_ProcessQuotaLimits" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-RtlCreateUserThread -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-WRITECOPY, ws2_32-WSACleanup, winebuild-Fake_Dlls -# | -# | This patchset fixes the following Wine bugs: -# | * [#45571] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of NtCreateThread/Ex) -# | -# | Modified files: -# | * dlls/ntdll/ntdll.spec, dlls/ntdll/thread.c, include/winternl.h -# | -if test "$enable_ntdll_RtlCreateUserThread" -eq 1; then - patch_apply ntdll-RtlCreateUserThread/0001-ntdll-Refactor-RtlCreateUserThread-into-NtCreateThre.patch - ( - printf '%s\n' '+ { "Andrew Wesie", "ntdll: Refactor RtlCreateUserThread into NtCreateThreadEx.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-RtlQueryPackageIdentity # | # | Modified files: diff --git a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch index 6d62c691..751b497d 100644 --- a/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch +++ b/patches/winebuild-Fake_Dlls/0003-winebuild-Generate-syscall-thunks-for-ntdll-exports.patch @@ -1,4 +1,4 @@ -From e695bf789da272b2855ad864b0837c38c1a78e62 Mon Sep 17 00:00:00 2001 +From 1fec139d96f32869fc0c8d15219fff493d9951d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 11 May 2017 05:32:55 +0200 Subject: [PATCH] winebuild: Generate syscall thunks for ntdll exports. @@ -78,7 +78,7 @@ index a5e6faa461a..51938bf84cc 100644 ok( context.SegCs == LOWORD(expect.SegCs), "wrong SegCs %08x/%08x\n", context.SegCs, expect.SegCs ); ok( context.SegDs == LOWORD(expect.SegDs), "wrong SegDs %08x/%08x\n", context.SegDs, expect.SegDs ); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index a2f5df1b1c2..dc9affc061a 100644 +index 79d13a01a86..94eb6d1252d 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -173,6 +173,7 @@ int __cdecl __wine_dbg_output( const char *str ) @@ -99,7 +99,7 @@ index a2f5df1b1c2..dc9affc061a 100644 peb = teb->Peb; peb->FastPebLock = &peb_lock; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c -index d3e07cae80e..449e5814c2e 100644 +index b6458da61ad..a158ec20a6a 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -83,7 +83,7 @@ static void pthread_exit_wrapper( int status ) @@ -120,42 +120,42 @@ index d3e07cae80e..449e5814c2e 100644 thread_data->request_fd = -1; thread_data->reply_fd = -1; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 6512160972d..e9a56b37ea1 100644 +index 880e3aacf33..6c7b961e95a 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -98,7 +98,7 @@ extern int CDECL server_pipe( int fd[2] ) DECLSPEC_HIDDEN; +@@ -96,7 +96,7 @@ extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDE extern void CDECL server_init_process_done(void) DECLSPEC_HIDDEN; extern TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size, BOOL *suspend, unsigned int *cpus, BOOL *wow64, - timeout_t *start_time ) DECLSPEC_HIDDEN; + timeout_t *start_time, void *syscall_handler ) DECLSPEC_HIDDEN; - extern NTSTATUS CDECL create_thread( SIZE_T stack_reserve, SIZE_T stack_commit, HANDLE actctx, DWORD tid, - int request_fd, PRTL_THREAD_START_ROUTINE start, - void *param, void *relay ) DECLSPEC_HIDDEN; + extern void CDECL DECLSPEC_NORETURN start_process( PRTL_THREAD_START_ROUTINE entry, BOOL suspend, void *relay ) DECLSPEC_HIDDEN; + extern void CDECL DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN; + extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h -index 72f35cf67e8..93a51871f1d 100644 +index 83c9f3a163b..63728b1c071 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct ldt_copy; struct msghdr; /* increment this when you change the function table */ --#define NTDLL_UNIXLIB_VERSION 28 -+#define NTDLL_UNIXLIB_VERSION 29 +-#define NTDLL_UNIXLIB_VERSION 31 ++#define NTDLL_UNIXLIB_VERSION 32 struct unix_funcs { -@@ -165,7 +165,7 @@ struct unix_funcs +@@ -172,7 +172,7 @@ struct unix_funcs /* thread/process functions */ TEB * (CDECL *init_threading)( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size, - BOOL *suspend, unsigned int *cpus, BOOL *wow64, timeout_t *start_time ); + BOOL *suspend, unsigned int *cpus, BOOL *wow64, timeout_t *start_time, void *syscall_handler ); - NTSTATUS (CDECL *create_thread)( SIZE_T stack_reserve, SIZE_T stack_commit, HANDLE actctx, - DWORD tid, int request_fd, PRTL_THREAD_START_ROUTINE start, - void *param, void *relay ); + void (CDECL *start_process)( PRTL_THREAD_START_ROUTINE entry, BOOL suspend, void *relay ); + void (CDECL *abort_thread)( int status ); + void (CDECL *exit_thread)( int status ); diff --git a/include/winternl.h b/include/winternl.h -index 44a58cadc7a..065f3d24f52 100644 +index 9b8218c861f..ff6916c98e7 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -359,7 +359,7 @@ typedef struct _TEB diff --git a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch b/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch index d830cf2d..25c31564 100644 --- a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch +++ b/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch @@ -1,4 +1,4 @@ -From 613ea1e263d4fbda67465ebaae2331df7728106a Mon Sep 17 00:00:00 2001 +From 1bb20ff5903d8d5e81e8a2b7b22bf67b189b16ec Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 6 Sep 2015 12:41:17 +0200 Subject: [PATCH] ws2_32: Invalidate client-side file descriptor cache in @@ -17,10 +17,10 @@ Subject: [PATCH] ws2_32: Invalidate client-side file descriptor cache in 9 files changed, 36 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 42532bd9f1c..ba46f170670 100644 +index c4d78128758..3d6c8850086 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec -@@ -1575,6 +1575,7 @@ +@@ -1576,6 +1576,7 @@ # Server interface @ cdecl -norelay wine_server_call(ptr) @@ -48,22 +48,22 @@ index 6fb86a68d6f..2f95e190963 100644 /*********************************************************************** * server_init_process diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 767cae92b48..05c6f1e43bf 100644 +index b5ee692024c..d8827b147df 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1074,6 +1074,7 @@ static struct unix_funcs unix_funcs = + server_select, server_wait, - server_queue_process_apc, server_send_fd, + server_remove_fds_from_cache_by_type, server_get_unix_fd, server_fd_to_handle, server_handle_to_fd, diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index 66c438fd62d..c6eb52c5986 100644 +index fb3f98dd579..0754928cfe8 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c -@@ -991,6 +991,26 @@ static int remove_fd_from_cache( HANDLE handle ) +@@ -995,6 +995,26 @@ static int remove_fd_from_cache( HANDLE handle ) return fd; } @@ -91,33 +91,33 @@ index 66c438fd62d..c6eb52c5986 100644 /*********************************************************************** * server_get_unix_fd diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 6fdaa17f087..6512160972d 100644 +index a422fd825ed..880e3aacf33 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -85,6 +85,7 @@ extern unsigned int CDECL server_wait( const select_op_t *select_op, data_size_t +@@ -84,6 +84,7 @@ extern unsigned int CDECL server_select( const select_op_t *select_op, data_size + extern unsigned int CDECL server_wait( const select_op_t *select_op, data_size_t size, UINT flags, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN; - extern unsigned int CDECL server_queue_process_apc( HANDLE process, const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN; extern void CDECL server_send_fd( int fd ) DECLSPEC_HIDDEN; +extern void CDECL server_remove_fds_from_cache_by_type( enum server_fd_type type ) DECLSPEC_HIDDEN; extern int CDECL server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd, int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h -index 4e5cec6637e..72f35cf67e8 100644 +index 58bdad19397..83c9f3a163b 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct ldt_copy; struct msghdr; /* increment this when you change the function table */ --#define NTDLL_UNIXLIB_VERSION 27 -+#define NTDLL_UNIXLIB_VERSION 28 +-#define NTDLL_UNIXLIB_VERSION 30 ++#define NTDLL_UNIXLIB_VERSION 31 struct unix_funcs { -@@ -184,6 +184,7 @@ struct unix_funcs +@@ -187,6 +187,7 @@ struct unix_funcs + unsigned int (CDECL *server_wait)( const select_op_t *select_op, data_size_t size, UINT flags, const LARGE_INTEGER *timeout ); - unsigned int (CDECL *server_queue_process_apc)( HANDLE process, const apc_call_t *call, apc_result_t *result ); void (CDECL *server_send_fd)( int fd ); + void (CDECL *server_remove_fds_from_cache_by_type)( enum server_fd_type type ); int (CDECL *server_get_unix_fd)( HANDLE handle, unsigned int wanted_access, int *unix_fd, diff --git a/staging/upstream-commit b/staging/upstream-commit index b39f89ab..f51939b2 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -3c72034b72014a087eae8d181252c67cb0782e28 +3cc3b445752902e07231900befc296f74ad6576e