From 7b78338b078a7a55c5851a91064ef70836f4c996 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 4 Jun 2020 00:08:14 -0500 Subject: [PATCH] Rebase against aba27fd5a3241635adb15fa7ef40aa43bf3978a1. --- ...-BCryptSecretAgreement-with-libgcryp.patch | 44 +++++------ ...tlCreateUserThread-into-NtCreateThre.patch | 75 +++++-------------- ...dll-Support-x86_64-syscall-emulation.patch | 16 ++-- ...ss-virtual-memory-counters-in-NtQuer.patch | 16 ++-- ...ondition-when-threads-are-killed-dur.patch | 40 +++++----- ...mporary-signal-handler-during-proces.patch | 34 ++++----- ...S-segment-prefixes-in-set_full_cpu_c.patch | 18 ++--- patches/patchinstall.sh | 6 +- ...ate-syscall-thunks-for-ntdll-exports.patch | 48 +++++++----- ...uild-Add-stub-functions-in-fake-dlls.patch | 43 +++++++---- ...ebuild-Add-syscall-thunks-for-64-bit.patch | 12 +-- ...e-client-side-file-descriptor-cache-.patch | 18 ++--- staging/upstream-commit | 2 +- 13 files changed, 185 insertions(+), 187 deletions(-) diff --git a/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch b/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch index cdf8aa90..6a88199b 100644 --- a/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch +++ b/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch @@ -1,4 +1,4 @@ -From 830d2641a7e23474b3ef4ee52e42e6b4f2cd388b Mon Sep 17 00:00:00 2001 +From a5c9b96c7b517d212260cb8567162425554ff613 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 7 Jan 2020 14:22:49 -0600 Subject: [PATCH] bcrypt: Implement BCryptSecretAgreement with libgcrypt. @@ -17,10 +17,10 @@ Signed-off-by: Derek Lesho create mode 100644 dlls/bcrypt/gcrypt.c diff --git a/configure.ac b/configure.ac -index 47d2b750c01..2dfa2ebcb51 100644 +index e3d63ed7501..beb86c23b45 100644 --- a/configure.ac +++ b/configure.ac -@@ -46,6 +46,7 @@ AC_ARG_WITH(faudio, AS_HELP_STRING([--without-faudio],[do not use FAudio (XAu +@@ -47,6 +47,7 @@ AC_ARG_WITH(faudio, AS_HELP_STRING([--without-faudio],[do not use FAudio (XAu AC_ARG_WITH(float-abi, AS_HELP_STRING([--with-float-abi=abi],[specify the ABI (soft|softfp|hard) for ARM platforms])) AC_ARG_WITH(fontconfig,AS_HELP_STRING([--without-fontconfig],[do not use fontconfig])) AC_ARG_WITH(freetype, AS_HELP_STRING([--without-freetype],[do not use the FreeType library])) @@ -28,7 +28,7 @@ index 47d2b750c01..2dfa2ebcb51 100644 AC_ARG_WITH(gettext, AS_HELP_STRING([--without-gettext],[do not use gettext])) AC_ARG_WITH(gettextpo, AS_HELP_STRING([--with-gettextpo],[use the GetTextPO library to rebuild po files]), [if test "x$withval" = "xno"; then ac_cv_header_gettext_po_h=no; fi]) -@@ -1989,6 +1990,19 @@ WINE_NOTICE_WITH(vkd3d,[test "x$ac_cv_lib_soname_vkd3d" = "x"], +@@ -2033,6 +2034,19 @@ WINE_NOTICE_WITH(vkd3d,[test "x$ac_cv_lib_soname_vkd3d" = "x"], [vkd3d ${notice_platform}development files not found (or too old), Direct3D 12 won't be supported.]) test "x$ac_cv_lib_soname_vkd3d" != "x" || enable_d3d12=${enable_d3d12:-no} @@ -61,7 +61,7 @@ index dd6d4a76640..ea3486a4002 100644 macos.c \ md2.c \ diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h -index 5cc2c249da8..b16dfbdcd2b 100644 +index 18343a6c749..27cd4950274 100644 --- a/dlls/bcrypt/bcrypt_internal.h +++ b/dlls/bcrypt/bcrypt_internal.h @@ -25,6 +25,9 @@ @@ -74,7 +74,7 @@ index 5cc2c249da8..b16dfbdcd2b 100644 #elif HAVE_COMMONCRYPTO_COMMONCRYPTOR_H #include #include -@@ -157,6 +160,12 @@ struct algorithm +@@ -161,6 +164,12 @@ struct algorithm ULONG flags; }; @@ -87,15 +87,15 @@ index 5cc2c249da8..b16dfbdcd2b 100644 #if defined(HAVE_GNUTLS_CIPHER_INIT) struct key_symmetric { -@@ -251,6 +260,7 @@ NTSTATUS key_destroy( struct key * ) DECLSPEC_HIDDEN; - BOOL key_is_symmetric( struct key * ) DECLSPEC_HIDDEN; +@@ -258,6 +267,7 @@ NTSTATUS key_export_dsa_capi( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_H NTSTATUS key_export_ecc( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_HIDDEN; + NTSTATUS key_import_dsa_capi( struct key *, UCHAR *, ULONG ) DECLSPEC_HIDDEN; NTSTATUS key_import_ecc( struct key *, UCHAR *, ULONG ) DECLSPEC_HIDDEN; +NTSTATUS compute_secret_ecc (struct key *pubkey_in, struct key *privkey_in, struct secret *secret) DECLSPEC_HIDDEN; BOOL is_zero_vector( const UCHAR *, ULONG ) DECLSPEC_HIDDEN; BOOL is_equal_vector( const UCHAR *, ULONG, const UCHAR *, ULONG ) DECLSPEC_HIDDEN; -@@ -258,4 +268,7 @@ BOOL is_equal_vector( const UCHAR *, ULONG, const UCHAR *, ULONG ) DECLSPEC_HIDD +@@ -265,4 +275,7 @@ BOOL is_equal_vector( const UCHAR *, ULONG, const UCHAR *, ULONG ) DECLSPEC_HIDD BOOL gnutls_initialize(void) DECLSPEC_HIDDEN; void gnutls_uninitialize(void) DECLSPEC_HIDDEN; @@ -104,10 +104,10 @@ index 5cc2c249da8..b16dfbdcd2b 100644 + #endif /* __BCRYPT_INTERNAL_H */ diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index c2939ea815a..15b934247d8 100644 +index fee40ebe8d7..f254571bbc2 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c -@@ -1349,6 +1349,12 @@ NTSTATUS key_import_ecc( struct key *key, UCHAR *input, ULONG len ) +@@ -1421,6 +1421,12 @@ NTSTATUS key_import_ecc( struct key *key, UCHAR *input, ULONG len ) ERR( "support for keys not available at build time\n" ); return STATUS_NOT_IMPLEMENTED; } @@ -120,7 +120,7 @@ index c2939ea815a..15b934247d8 100644 #endif NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle, -@@ -1714,27 +1720,81 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO +@@ -1833,27 +1839,81 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO return STATUS_SUCCESS; } @@ -212,7 +212,7 @@ index c2939ea815a..15b934247d8 100644 } BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) -@@ -1746,6 +1806,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) +@@ -1865,6 +1925,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) DisableThreadLibraryCalls( hinst ); #ifdef HAVE_GNUTLS_CIPHER_INIT gnutls_initialize(); @@ -222,7 +222,7 @@ index c2939ea815a..15b934247d8 100644 #endif break; -@@ -1753,6 +1816,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) +@@ -1872,6 +1935,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) if (reserved) break; #ifdef HAVE_GNUTLS_CIPHER_INIT gnutls_uninitialize(); @@ -234,7 +234,7 @@ index c2939ea815a..15b934247d8 100644 } diff --git a/dlls/bcrypt/gcrypt.c b/dlls/bcrypt/gcrypt.c new file mode 100644 -index 00000000000..d7ed6eeddf3 +index 00000000000..f882d61def8 --- /dev/null +++ b/dlls/bcrypt/gcrypt.c @@ -0,0 +1,264 @@ @@ -503,10 +503,10 @@ index 00000000000..d7ed6eeddf3 +} +#endif diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c -index 1d78b9f4d1f..59c98eed0cc 100644 +index d447e90a11e..7828fa5c792 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c -@@ -1297,4 +1297,13 @@ NTSTATUS key_destroy( struct key *key ) +@@ -1580,4 +1580,13 @@ NTSTATUS key_destroy( struct key *key ) heap_free( key ); return STATUS_SUCCESS; } @@ -521,10 +521,10 @@ index 1d78b9f4d1f..59c98eed0cc 100644 + #endif diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c -index 9ff9772c15a..4851603819c 100644 +index f635ba4bc8e..50cd5d83d1f 100644 --- a/dlls/bcrypt/macos.c +++ b/dlls/bcrypt/macos.c -@@ -268,4 +268,10 @@ NTSTATUS key_destroy( struct key *key ) +@@ -267,4 +267,10 @@ NTSTATUS key_destroy( struct key *key ) heap_free( key ); return STATUS_SUCCESS; } @@ -536,10 +536,10 @@ index 9ff9772c15a..4851603819c 100644 +} #endif diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c -index f7404057fa8..d9509f2c49b 100644 +index e4a99d63048..6ca26b3d6ba 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c -@@ -2067,7 +2067,7 @@ static void test_ECDH(void) +@@ -2068,7 +2068,7 @@ static void test_ECDH(void) goto raw_secret_end; } @@ -549,5 +549,5 @@ index f7404057fa8..d9509f2c49b 100644 if (status != STATUS_SUCCESS) { -- -2.17.1 +2.26.2 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 4869a02b..83ff1152 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 9fdc6855fed56b4b6baa0c5bd0f4633fec536c06 Mon Sep 17 00:00:00 2001 +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. @@ -7,9 +7,9 @@ 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 | 196 ++++++++++++++++++++++++++++++++++-------- - include/winternl.h | 27 ++++++ - 3 files changed, 188 insertions(+), 37 deletions(-) + 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 @@ -25,10 +25,10 @@ index 42532bd9f1c..65fdc30d7a4 100644 @ stdcall NtCreateTimer(ptr long ptr long) @ stub NtCreateToken diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index c9a2240a4da..f04b8bb337e 100644 +index d5e34cae3b1..4e1b3f23b7c 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -406,34 +406,18 @@ static void start_thread( struct startup_info *info ) +@@ -377,28 +377,10 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void * /*********************************************************************** * NtCreateThreadEx (NTDLL.@) */ @@ -58,21 +58,15 @@ index c9a2240a4da..f04b8bb337e 100644 - HANDLE *handle_ptr, CLIENT_ID *id ) + ULONG stack_reserve, PPS_ATTRIBUTE_LIST ps_attr_list ) { - sigset_t sigset; - pthread_t pthread_id; -- pthread_attr_t attr; -+ pthread_attr_t pthread_attr; - struct ntdll_thread_data *thread_data; - struct startup_info *info; + 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; - HANDLE handle = 0, actctx = 0; - TEB *teb = NULL; - DWORD tid = 0; -@@ -444,6 +428,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, + zero_bits, stack_commit, stack_reserve, ps_attr_list); @@ -99,11 +93,10 @@ index c9a2240a4da..f04b8bb337e 100644 + + if (access == (ACCESS_MASK)0) + access = THREAD_ALL_ACCESS; -+ + if (process != NtCurrentProcess()) { - apc_call_t call; -@@ -469,12 +480,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, +@@ -432,12 +443,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, return result.create_thread.status; } @@ -117,7 +110,7 @@ index c9a2240a4da..f04b8bb337e 100644 if (unix_funcs->server_pipe( request_pipe ) == -1) { -@@ -486,7 +492,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, +@@ -449,7 +455,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, SERVER_START_REQ( new_thread ) { req->process = wine_server_obj_handle( process ); @@ -126,36 +119,8 @@ index c9a2240a4da..f04b8bb337e 100644 req->suspend = suspended; req->request_fd = request_pipe[0]; wine_server_add_data( req, objattr, len ); -@@ -547,20 +553,20 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - thread_data->wait_fd[1] = -1; - thread_data->start_stack = (char *)teb->Tib.StackBase; - -- pthread_attr_init( &attr ); -- pthread_attr_setstack( &attr, teb->DeallocationStack, -+ pthread_attr_init( &pthread_attr ); -+ pthread_attr_setstack( &pthread_attr, teb->DeallocationStack, - (char *)teb->Tib.StackBase + extra_stack - (char *)teb->DeallocationStack ); -- pthread_attr_setguardsize( &attr, 0 ); -- pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */ -+ pthread_attr_setguardsize( &pthread_attr, 0 ); -+ pthread_attr_setscope( &pthread_attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */ - InterlockedIncrement( &nb_threads ); -- if (pthread_create( &pthread_id, &attr, (void * (*)(void *))start_thread, info )) -+ if (pthread_create( &pthread_id, &pthread_attr, (void * (*)(void *))start_thread, info )) - { - InterlockedDecrement( &nb_threads ); -- pthread_attr_destroy( &attr ); -+ pthread_attr_destroy( &pthread_attr ); - status = STATUS_NO_MEMORY; - goto error; - } -- pthread_attr_destroy( &attr ); -+ pthread_attr_destroy( &pthread_attr ); - pthread_sigmask( SIG_SETMASK, &sigset, NULL ); - - if (id) id->UniqueThread = ULongToHandle(tid); -@@ -577,6 +583,124 @@ error: - return status; +@@ -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, @@ -278,9 +243,9 @@ index c9a2240a4da..f04b8bb337e 100644 + /****************************************************************************** - * RtlGetNtGlobalFlags (NTDLL.@) + * NtResumeThread (NTDLL.@) diff --git a/include/winternl.h b/include/winternl.h -index 199b8fc52f2..489b145937c 100644 +index f362790dbca..b79fcd67012 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2274,6 +2274,33 @@ typedef struct _NLSTABLEINFO diff --git a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch index c94ae38c..4ae5fcdf 100644 --- a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch +++ b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch @@ -1,4 +1,4 @@ -From b18e90a92f2e44b5167016c90ea1d49f4d7e3211 Mon Sep 17 00:00:00 2001 +From 20298be5a42af52be27c56f88ad6a8a0304b55b6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 30 Dec 2019 13:27:53 +0300 Subject: [PATCH] ntdll: Support x86_64 syscall emulation. @@ -15,10 +15,10 @@ is used for trapping syscalls. 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 7b7433efde4..e62daf9e384 100644 +index e3d63ed7501..2fbec4129df 100644 --- a/configure.ac +++ b/configure.ac -@@ -474,6 +474,7 @@ AC_CHECK_HEADERS(\ +@@ -464,6 +464,7 @@ AC_CHECK_HEADERS(\ linux/joystick.h \ linux/major.h \ linux/param.h \ @@ -27,7 +27,7 @@ index 7b7433efde4..e62daf9e384 100644 linux/types.h \ linux/ucdrom.h \ diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index 66a17b9bbc9..2424109553c 100644 +index 0ccc7cbceb6..149ad1bf5e7 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -24,6 +24,7 @@ @@ -52,16 +52,16 @@ index 66a17b9bbc9..2424109553c 100644 #define NONAMELESSUNION #define NONAMELESSSTRUCT #include "ntstatus.h" -@@ -77,6 +85,8 @@ +@@ -76,6 +84,8 @@ + WINE_DEFAULT_DEBUG_CHANNEL(seh); - WINE_DECLARE_DEBUG_CHANNEL(relay); +extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); + typedef struct _SCOPE_TABLE { ULONG Count; -@@ -3113,6 +3123,104 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext ) +@@ -2797,6 +2807,104 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext ) restore_context( &context, ucontext ); } @@ -166,7 +166,7 @@ index 66a17b9bbc9..2424109553c 100644 /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) -@@ -3158,6 +3266,9 @@ void signal_init_process(void) +@@ -2842,6 +2950,9 @@ void signal_init_process(void) sig_act.sa_sigaction = trap_handler; if (sigaction( SIGTRAP, &sig_act, NULL ) == -1) goto error; #endif 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 4656891e..7b2e48dd 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 e1ff2fee38b602ff500c35f1eb589162c0d166d1 Mon Sep 17 00:00:00 2001 +From 4fd43a8364333519e777718b66e628ace1ad9fff 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 @@ -13,7 +13,7 @@ FIXME: fill_VM_COUNTERS now uses a different method ... which one is better? 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c -index 7c2945f0a73..abb2d2176d6 100644 +index cbb7937631d..bb078c1aa21 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -2686,8 +2686,11 @@ NTSTATUS WINAPI NtQuerySystemInformation( @@ -29,10 +29,10 @@ index 7c2945f0a73..abb2d2176d6 100644 } len += procstructlen; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index e85f3a3b900..b45b9a02bb1 100644 +index 3ea0dd81349..3e2fa3642c1 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h -@@ -285,6 +285,7 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR); +@@ -249,6 +249,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 e85f3a3b900..b45b9a02bb1 100644 /* string functions */ int __cdecl NTDLL_tolower( int c ); diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c -index c066610ebca..f2dddb18052 100644 +index f47d3c4bc6c..b36fc037dc5 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -192,7 +192,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) @@ -54,10 +54,10 @@ index c066610ebca..f2dddb18052 100644 #endif diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index b7d4e399f62..21e8b0c08f8 100644 +index cd1b65a210c..71051adc8b0 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -385,6 +385,42 @@ void WINAPI RtlExitUserThread( ULONG status ) +@@ -355,6 +355,42 @@ void WINAPI RtlExitUserThread( ULONG status ) for (;;) unix_funcs->exit_thread( status ); } @@ -99,7 +99,7 @@ index b7d4e399f62..21e8b0c08f8 100644 +} /*********************************************************************** - * start_thread + * call_thread_entry_point -- 2.26.2 diff --git a/patches/ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch b/patches/ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch index 9f370c21..e331c3dc 100644 --- a/patches/ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch +++ b/patches/ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch @@ -1,4 +1,4 @@ -From 5f34c6a4429025ee71616e677e0e59342bee17b0 Mon Sep 17 00:00:00 2001 +From 9da818bd948256572640e17766a14a72e58ce100 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 25 Feb 2015 22:45:42 +0100 Subject: [PATCH] ntdll: Fix race-condition when threads are killed during @@ -15,22 +15,15 @@ only be executed safely when all other threads have terminated before. Most likely there are more Wine bugs in this area, but the attached patch should fix the most critical one (messed up refcounting of threads) for now. --- - dlls/ntdll/thread.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) + dlls/ntdll/thread.c | 2 +- + dlls/ntdll/unix/thread.c | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index bb11521cf69..fee26ccd21d 100644 +index d5e34cae3b1..83237b3569a 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -298,6 +298,7 @@ TEB *thread_init(void) - void WINAPI RtlExitUserThread( ULONG status ) - { - static void *prev_teb; -+ sigset_t sigset; - TEB *teb; - - if (status) /* send the exit code to the server (0 is already the default) */ -@@ -311,7 +312,7 @@ void WINAPI RtlExitUserThread( ULONG status ) +@@ -295,7 +295,7 @@ void WINAPI RtlExitUserThread( ULONG status ) SERVER_END_REQ; } @@ -39,16 +32,29 @@ index bb11521cf69..fee26ccd21d 100644 { LdrShutdownProcess(); unix_funcs->exit_process( status ); -@@ -333,6 +334,11 @@ void WINAPI RtlExitUserThread( ULONG status ) +diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c +index 205a1312e92..563712bd59e 100644 +--- a/dlls/ntdll/unix/thread.c ++++ b/dlls/ntdll/unix/thread.c +@@ -219,6 +219,7 @@ void CDECL abort_thread( int status ) + void CDECL exit_thread( int status ) + { + static void *prev_teb; ++ sigset_t sigset; + TEB *teb; + + pthread_sigmask( SIG_BLOCK, &server_block_set, NULL ); +@@ -233,6 +234,12 @@ void CDECL exit_thread( int status ) + virtual_free_teb( teb ); } } - ++ + sigemptyset( &sigset ); + sigaddset( &sigset, SIGQUIT ); + pthread_sigmask( SIG_BLOCK, &sigset, NULL ); -+ if (!InterlockedDecrement( &nb_threads )) _exit( status ); ++ if (!InterlockedDecrement( nb_threads )) _exit( status ); + - for (;;) unix_funcs->exit_thread( status ); + signal_exit_thread( status, pthread_exit_wrapper ); } -- diff --git a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch index c4811447..8cb334d6 100644 --- a/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch +++ b/patches/ntdll-WRITECOPY/0003-ntdll-Setup-a-temporary-signal-handler-during-proces.patch @@ -1,4 +1,4 @@ -From 6fa954cc5fd6840c9207abf4f41e53be0dbf8728 Mon Sep 17 00:00:00 2001 +From fb4189551e75a8c52ee1abd98871138c06d94e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 4 Oct 2014 02:53:22 +0200 Subject: [PATCH] ntdll: Setup a temporary signal handler during process @@ -15,7 +15,7 @@ Subject: [PATCH] ntdll: Setup a temporary signal handler during process 7 files changed, 79 insertions(+) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index e9a3230e814..04aee675e55 100644 +index ff791a60764..eba4ace6ae8 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -78,6 +78,7 @@ extern LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa) DECLSPEC_HI @@ -23,14 +23,14 @@ index e9a3230e814..04aee675e55 100644 extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN; extern void signal_init_process(void) DECLSPEC_HIDDEN; +extern void signal_init_early(void) DECLSPEC_HIDDEN; - extern void signal_start_thread( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend ) DECLSPEC_HIDDEN; - extern void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend ) DECLSPEC_HIDDEN; extern void version_init(void) DECLSPEC_HIDDEN; + extern void debug_init(void) DECLSPEC_HIDDEN; + extern TEB *thread_init(void) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c -index b7e387babf1..bb329f888ce 100644 +index 8ff9f66d3f0..44e3d2df523 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c -@@ -774,6 +774,12 @@ void signal_init_process(void) +@@ -773,6 +773,12 @@ void signal_init_process(void) exit(1); } @@ -44,10 +44,10 @@ index b7e387babf1..bb329f888ce 100644 /*********************************************************************** * RtlUnwind (NTDLL.@) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c -index c2dd129a569..22d4983d5c6 100644 +index 104ffbf6df9..e7c6abd0046 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c -@@ -1101,6 +1101,12 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +@@ -1100,6 +1100,12 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) return 0; } @@ -61,10 +61,10 @@ index c2dd129a569..22d4983d5c6 100644 /********************************************************************** * signal_init_process diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 78d03f669d7..e3dc2c0d1c8 100644 +index 1b0b9352a87..0fe9f7a3c84 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -1737,6 +1737,31 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st +@@ -1621,6 +1621,31 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st } @@ -96,7 +96,7 @@ index 78d03f669d7..e3dc2c0d1c8 100644 /********************************************************************** * segv_handler * -@@ -2064,6 +2089,34 @@ void signal_init_process(void) +@@ -1948,6 +1973,34 @@ void signal_init_process(void) exit(1); } @@ -132,10 +132,10 @@ index 78d03f669d7..e3dc2c0d1c8 100644 /******************************************************************* * RtlUnwind (NTDLL.@) diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c -index 75b18e1e933..314a0677d92 100644 +index 7e73322cbeb..07f0b89f30a 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c -@@ -638,6 +638,12 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +@@ -637,6 +637,12 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) return 0; } @@ -149,10 +149,10 @@ index 75b18e1e933..314a0677d92 100644 /********************************************************************** * signal_init_process diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c -index 7cefd1403f3..0eb58d3d149 100644 +index 0ccc7cbceb6..dc8a1a987c5 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c -@@ -2850,6 +2850,12 @@ void signal_init_process(void) +@@ -2849,6 +2849,12 @@ void signal_init_process(void) exit(1); } @@ -166,10 +166,10 @@ index 7cefd1403f3..0eb58d3d149 100644 static ULONG64 get_int_reg( CONTEXT *context, int reg ) { diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index f9ea9203ed8..31213614911 100644 +index d5e34cae3b1..16e61658cdf 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -228,6 +228,7 @@ TEB *thread_init(void) +@@ -217,6 +217,7 @@ TEB *thread_init(void) struct ntdll_thread_data *thread_data; virtual_init(); diff --git a/patches/ntdll-set_full_cpu_context/0001-ntdll-Add-back-SS-segment-prefixes-in-set_full_cpu_c.patch b/patches/ntdll-set_full_cpu_context/0001-ntdll-Add-back-SS-segment-prefixes-in-set_full_cpu_c.patch index 91d6081d..c311d267 100644 --- a/patches/ntdll-set_full_cpu_context/0001-ntdll-Add-back-SS-segment-prefixes-in-set_full_cpu_c.patch +++ b/patches/ntdll-set_full_cpu_context/0001-ntdll-Add-back-SS-segment-prefixes-in-set_full_cpu_c.patch @@ -1,17 +1,17 @@ -From 9701b29e87bc913b95e26ec8f7d26ba404dc1bce Mon Sep 17 00:00:00 2001 +From afec7f854357083d9741054ff0d3c768c8b77e9b Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 26 Jul 2017 23:44:32 +0200 -Subject: ntdll: Add back SS segment prefixes in set_full_cpu_context. +Subject: [PATCH] ntdll: Add back SS segment prefixes in set_full_cpu_context. --- - dlls/ntdll/signal_i386.c | 4 ++++ + dlls/ntdll/unix/signal_i386.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index bee08275340..75c6654a7f5 100644 ---- a/dlls/ntdll/signal_i386.c -+++ b/dlls/ntdll/signal_i386.c -@@ -1274,12 +1274,16 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context, +diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c +index 515090d9af8..06751681f5b 100644 +--- a/dlls/ntdll/unix/signal_i386.c ++++ b/dlls/ntdll/unix/signal_i386.c +@@ -304,12 +304,16 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context, "movl 0xc4(%ecx),%eax\n\t" /* Esp */ "leal -4*4(%eax),%eax\n\t" "movl 0xc0(%ecx),%edx\n\t" /* EFlags */ @@ -29,5 +29,5 @@ index bee08275340..75c6654a7f5 100644 "pushl 0x98(%ecx)\n\t" /* SegDs */ "movl 0xa8(%ecx),%edx\n\t" /* Edx */ -- -2.13.1 +2.26.2 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 0688e05f..807d3c39 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "48020f4846cca1a02f4e1dc037e2cc2068df5e9c" + echo "aba27fd5a3241635adb15fa7ef40aa43bf3978a1" } # Show version information @@ -4327,7 +4327,7 @@ fi # Patchset ntdll-Threading # | # | Modified files: -# | * dlls/ntdll/thread.c +# | * dlls/ntdll/thread.c, dlls/ntdll/unix/thread.c # | if test "$enable_ntdll_Threading" -eq 1; then patch_apply ntdll-Threading/0001-ntdll-Fix-race-condition-when-threads-are-killed-dur.patch @@ -4383,7 +4383,7 @@ fi # Patchset ntdll-set_full_cpu_context # | # | Modified files: -# | * dlls/ntdll/signal_i386.c +# | * dlls/ntdll/unix/signal_i386.c # | if test "$enable_ntdll_set_full_cpu_context" -eq 1; then patch_apply ntdll-set_full_cpu_context/0001-ntdll-Add-back-SS-segment-prefixes-in-set_full_cpu_c.patch 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 91188a82..8dd18d54 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,13 +1,14 @@ -From 3b9456b9e0bc870281df2144b67d42112baad4bd Mon Sep 17 00:00:00 2001 +From 916104878b837947e14ed7d44f591de5ba4fa2dc 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. Based on a patch by Erich E. Hoover. --- + dlls/ntdll/loader.c | 3 + dlls/ntdll/signal_i386.c | 4 +- dlls/ntdll/tests/exception.c | 2 + - dlls/ntdll/thread.c | 4 ++ + dlls/ntdll/thread.c | 3 + include/winternl.h | 2 +- tools/winebuild/build.h | 7 +++ tools/winebuild/import.c | 10 ++-- @@ -15,13 +16,34 @@ Based on a patch by Erich E. Hoover. tools/winebuild/spec16.c | 22 +------- tools/winebuild/spec32.c | 104 +++++++++++++++++++++++++++++++++++ tools/winebuild/utils.c | 21 +++++++ - 10 files changed, 208 insertions(+), 27 deletions(-) + 11 files changed, 210 insertions(+), 27 deletions(-) +diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c +index 51addaaf983..b888b680bc4 100644 +--- a/dlls/ntdll/loader.c ++++ b/dlls/ntdll/loader.c +@@ -3810,6 +3810,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) + return ret; + } + ++extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); + + /****************************************************************** + * LdrInitializeThunk (NTDLL.@) +@@ -3827,6 +3828,8 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow + WINE_MODREF *wm; + LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; + ++ NtCurrentTeb()->WOW32Reserved = __wine_syscall_dispatcher; ++ + pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL ); + + if (process_detaching) return; diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index eb6c87bce4d..d3cbfe63f1c 100644 +index 72413dcd6c7..88dffb03138 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c -@@ -449,6 +449,8 @@ static ULONG first_ldt_entry = 32; +@@ -448,6 +448,8 @@ static ULONG first_ldt_entry = 32; static wine_signal_handler handlers[256]; @@ -30,7 +52,7 @@ index eb6c87bce4d..d3cbfe63f1c 100644 enum i386_trap_code { TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */ -@@ -1275,7 +1277,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, +@@ -1159,7 +1161,7 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, { context->Ebp = ebp; context->Esp = (DWORD)&retaddr; @@ -53,10 +75,10 @@ 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 f9ea9203ed8..7e435c4ccb3 100644 +index d5e34cae3b1..73057d9a9a4 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -212,6 +212,8 @@ void map_user_shared_data(void) +@@ -201,6 +201,8 @@ void map_user_shared_data(void) NtClose( section ); } @@ -65,7 +87,7 @@ index f9ea9203ed8..7e435c4ccb3 100644 /*********************************************************************** * thread_init * -@@ -246,6 +248,7 @@ TEB *thread_init(void) +@@ -235,6 +237,7 @@ TEB *thread_init(void) teb = unix_funcs->virtual_alloc_first_teb(); unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy ); @@ -73,14 +95,6 @@ index f9ea9203ed8..7e435c4ccb3 100644 peb = teb->Peb; peb->FastPebLock = &peb_lock; -@@ -491,6 +494,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - teb->Tib.StackBase = stack.StackBase; - teb->Tib.StackLimit = stack.StackLimit; - teb->DeallocationStack = stack.DeallocationStack; -+ teb->WOW32Reserved = __wine_syscall_dispatcher; - - thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; - thread_data->request_fd = request_pipe[1]; diff --git a/include/winternl.h b/include/winternl.h index 44a58cadc7a..065f3d24f52 100644 --- a/include/winternl.h diff --git a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch index 883ca5ee..c26e699f 100644 --- a/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch +++ b/patches/winebuild-Fake_Dlls/0005-winebuild-Add-stub-functions-in-fake-dlls.patch @@ -1,16 +1,17 @@ -From 724fec1afabf68217dc161e0f784a8b65c2c5854 Mon Sep 17 00:00:00 2001 +From c7bd63dbac91eb167ec90846cd8cb7a193b04aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 15 May 2017 16:27:56 +0200 Subject: [PATCH] winebuild: Add stub functions in fake dlls. --- dlls/kernel32/tests/loader.c | 8 +- - dlls/ntdll/thread.c | 35 ++++++ + dlls/ntdll/loader.c | 2 + + dlls/ntdll/thread.c | 34 ++++++ include/winternl.h | 2 +- tools/winebuild/build.h | 1 + tools/winebuild/spec32.c | 209 +++++++++++++++++++++++++++++++++-- tools/winebuild/utils.c | 10 +- - 6 files changed, 250 insertions(+), 15 deletions(-) + 7 files changed, 251 insertions(+), 15 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 926fa913866..902907329c0 100644 @@ -60,15 +61,35 @@ index 926fa913866..902907329c0 100644 UnmapViewOfFile(ptr); CloseHandle(map); CloseHandle(file); +diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c +index b888b680bc4..bb60aa919af 100644 +--- a/dlls/ntdll/loader.c ++++ b/dlls/ntdll/loader.c +@@ -3811,6 +3811,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) + } + + extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); ++extern void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord ); + + /****************************************************************** + * LdrInitializeThunk (NTDLL.@) +@@ -3829,6 +3830,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow + LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; + + NtCurrentTeb()->WOW32Reserved = __wine_syscall_dispatcher; ++ NtCurrentTeb()->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher; + + pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL ); + diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 7e435c4ccb3..5148445ce3a 100644 +index 73057d9a9a4..8c9b0b11c86 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -214,6 +214,39 @@ void map_user_shared_data(void) +@@ -203,6 +203,39 @@ void map_user_shared_data(void) extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); -+static void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord ) ++void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord ) +{ + UNICODE_STRING name; + NTSTATUS status; @@ -104,7 +125,7 @@ index 7e435c4ccb3..5148445ce3a 100644 /*********************************************************************** * thread_init * -@@ -249,6 +282,7 @@ TEB *thread_init(void) +@@ -238,6 +271,7 @@ TEB *thread_init(void) teb = unix_funcs->virtual_alloc_first_teb(); unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy ); teb->WOW32Reserved = __wine_syscall_dispatcher; @@ -112,14 +133,6 @@ index 7e435c4ccb3..5148445ce3a 100644 peb = teb->Peb; peb->FastPebLock = &peb_lock; -@@ -495,6 +529,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, - teb->Tib.StackLimit = stack.StackLimit; - teb->DeallocationStack = stack.DeallocationStack; - teb->WOW32Reserved = __wine_syscall_dispatcher; -+ teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher; - - thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; - thread_data->request_fd = request_pipe[1]; diff --git a/include/winternl.h b/include/winternl.h index 065f3d24f52..199b8fc52f2 100644 --- a/include/winternl.h diff --git a/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch b/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch index 2d38ff3c..35f9eb13 100644 --- a/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch +++ b/patches/winebuild-Fake_Dlls/0010-tools-winebuild-Add-syscall-thunks-for-64-bit.patch @@ -1,4 +1,4 @@ -From 253d27816a1eb43b54834a12aa4c55442b0b1062 Mon Sep 17 00:00:00 2001 +From 9382d41830426f68bf5da895f308f6691df8111b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 7 Sep 2017 00:38:09 +0200 Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit. @@ -40,10 +40,10 @@ index 95939ba6bde..ae5462f6e55 100644 todo_wine ok(0, "%s: Export is a stub-function, skipping\n", func_name); continue; diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 5148445ce3a..c9a2240a4da 100644 +index 8187dbe1f2d..5427cbcf04e 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -54,6 +54,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread); +@@ -51,6 +51,8 @@ WINE_DECLARE_DEBUG_CHANNEL(relay); struct _KUSER_SHARED_DATA *user_shared_data = NULL; @@ -51,8 +51,8 @@ index 5148445ce3a..c9a2240a4da 100644 + void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL; - /* info passed to a starting thread */ -@@ -267,9 +269,9 @@ TEB *thread_init(void) + static PEB *peb; +@@ -256,9 +258,9 @@ TEB *thread_init(void) /* reserve space for shared user data */ addr = (void *)0x7ffe0000; @@ -64,7 +64,7 @@ index 5148445ce3a..c9a2240a4da 100644 if (status) { MESSAGE( "wine: failed to map the shared user data: %08x\n", status ); -@@ -277,6 +279,13 @@ TEB *thread_init(void) +@@ -266,6 +268,13 @@ TEB *thread_init(void) } user_shared_data = addr; 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 95c2d9b8..2d0f016c 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 88f8d0382e55cbe97ae5d7937a63bd801f277f25 Mon Sep 17 00:00:00 2001 +From d6f023a80929f22d520584d47abb08e5b523e0c0 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 @@ -29,7 +29,7 @@ index 42532bd9f1c..ba46f170670 100644 @ cdecl wine_server_handle_to_fd(long long ptr ptr) @ cdecl wine_server_release_fd(long long) diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c -index c7788b99e2d..54291d0a909 100644 +index bde4a2add18..de3b4b9d2e7 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -239,6 +239,14 @@ void CDECL wine_server_release_fd( HANDLE handle, int unix_fd ) @@ -48,10 +48,10 @@ index c7788b99e2d..54291d0a909 100644 /*********************************************************************** * server_init_process diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 0f342e8277e..4c7a5c488dc 100644 +index 1297c451a10..06c0174dd5e 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1045,6 +1045,7 @@ static struct unix_funcs unix_funcs = +@@ -1044,6 +1044,7 @@ static struct unix_funcs unix_funcs = server_wait, server_queue_process_apc, server_send_fd, @@ -91,7 +91,7 @@ index 17b23e58d28..f7d172cf324 100644 /*********************************************************************** * server_get_unix_fd diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 8562efb7dd4..ee2bd47ad70 100644 +index 14c4ee4cd97..5657bc9c27d 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -90,6 +90,7 @@ extern unsigned int CDECL server_wait( const select_op_t *select_op, data_size_t @@ -103,19 +103,19 @@ index 8562efb7dd4..ee2bd47ad70 100644 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 fb755373f07..7df35f0eee1 100644 +index 67c63fd9268..51e27be22b7 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 16 -+#define NTDLL_UNIXLIB_VERSION 17 +-#define NTDLL_UNIXLIB_VERSION 19 ++#define NTDLL_UNIXLIB_VERSION 20 struct unix_funcs { -@@ -127,6 +127,7 @@ struct unix_funcs +@@ -128,6 +128,7 @@ struct unix_funcs 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 ); diff --git a/staging/upstream-commit b/staging/upstream-commit index b36cf9b1..8b626a80 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -48020f4846cca1a02f4e1dc037e2cc2068df5e9c +aba27fd5a3241635adb15fa7ef40aa43bf3978a1