From 8a2765d1250572378f4c43f9f4e19e7295ac9fb4 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 4 Jun 2020 18:26:54 -0500 Subject: [PATCH] Rebase against 3c72034b72014a087eae8d181252c67cb0782e28. 64-bit syscalls are broken. --- ...mporary-signal-handler-during-proces.patch | 16 +-- patches/patchinstall.sh | 61 ++++++---- ...ate-syscall-thunks-for-ntdll-exports.patch | 107 ++++++++++++++---- ...uild-Add-stub-functions-in-fake-dlls.patch | 16 +-- ...ebuild-Add-syscall-thunks-for-64-bit.patch | 58 ++++------ patches/winebuild-Fake_Dlls/definition | 2 + ...e-client-side-file-descriptor-cache-.patch | 24 ++-- staging/upstream-commit | 2 +- 8 files changed, 172 insertions(+), 114 deletions(-) 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 8cb334d6..d6e9a682 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 fb4189551e75a8c52ee1abd98871138c06d94e0e Mon Sep 17 00:00:00 2001 +From 46968c583a30476a86463530d0047699e64529b5 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 ff791a60764..eba4ace6ae8 100644 +index 65c65cc02d8..63a4b597872 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 @@ -25,7 +25,7 @@ index ff791a60764..eba4ace6ae8 100644 +extern void signal_init_early(void) DECLSPEC_HIDDEN; extern void version_init(void) DECLSPEC_HIDDEN; extern void debug_init(void) DECLSPEC_HIDDEN; - extern TEB *thread_init(void) DECLSPEC_HIDDEN; + extern TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index 8ff9f66d3f0..44e3d2df523 100644 --- a/dlls/ntdll/signal_arm.c @@ -166,17 +166,17 @@ index 0ccc7cbceb6..dc8a1a987c5 100644 static ULONG64 get_int_reg( CONTEXT *context, int reg ) { diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index d5e34cae3b1..16e61658cdf 100644 +index 8918b39a9c5..a2f5df1b1c2 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -217,6 +217,7 @@ TEB *thread_init(void) - struct ntdll_thread_data *thread_data; +@@ -186,6 +186,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) + TEB *teb; virtual_init(); + signal_init_early(); - /* reserve space for shared user data */ - + teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, + &is_wow64, &server_start_time ); -- 2.26.2 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 807d3c39..f790eae0 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "aba27fd5a3241635adb15fa7ef40aa43bf3978a1" + echo "3c72034b72014a087eae8d181252c67cb0782e28" } # Show version information @@ -1704,6 +1704,17 @@ if test "$enable_ntdll_NtContinue" -eq 1; then enable_winebuild_Fake_Dlls=1 fi +if test "$enable_winebuild_Fake_Dlls" -eq 1; then + if test "$enable_ntdll_WRITECOPY" -gt 1; then + abort "Patchset ntdll-WRITECOPY disabled, but winebuild-Fake_Dlls depends on that." + fi + if test "$enable_ws2_32_WSACleanup" -gt 1; then + abort "Patchset ws2_32-WSACleanup disabled, but winebuild-Fake_Dlls depends on that." + fi + enable_ntdll_WRITECOPY=1 + enable_ws2_32_WSACleanup=1 +fi + if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then if test "$enable_advapi32_Token_Integrity_Level" -gt 1; then abort "Patchset advapi32-Token_Integrity_Level disabled, but ntdll-Hide_Wine_Exports depends on that." @@ -3977,8 +3988,30 @@ if test "$enable_ntdll_NtAccessCheck" -eq 1; then ) >> "$patchlist" fi +# Patchset ws2_32-WSACleanup +# | +# | This patchset fixes the following Wine bugs: +# | * [#18670] Properly close sockets when WSACleanup is called +# | +# | Modified files: +# | * dlls/ntdll/ntdll.spec, dlls/ntdll/server.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/server.c, +# | dlls/ntdll/unix/unix_private.h, dlls/ntdll/unixlib.h, dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, +# | include/wine/server.h, server/protocol.def, server/sock.c +# | +if test "$enable_ws2_32_WSACleanup" -eq 1; then + patch_apply ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch + patch_apply ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch + ( + printf '%s\n' '+ { "Matt Durgavich", "ws2_32: Proper WSACleanup implementation using wineserver function.", 2 },'; + printf '%s\n' '+ { "Sebastian Lackner", "ws2_32: Invalidate client-side file descriptor cache in WSACleanup.", 1 },'; + ) >> "$patchlist" +fi + # Patchset winebuild-Fake_Dlls # | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-WRITECOPY, ws2_32-WSACleanup +# | # | This patchset fixes the following Wine bugs: # | * [#21232] Chromium-based browser engines (Chrome, Opera, Comodo Dragon, SRWare Iron) crash on startup unless '--no- # | sandbox' is used (native API sandboxing/hooking scheme incompatible with Wine) @@ -3993,6 +4026,7 @@ fi # | dlls/krnl386.exe16/task.c, dlls/krnl386.exe16/thunk.c, dlls/krnl386.exe16/wowthunk.c, dlls/ntdll/actctx.c, # | dlls/ntdll/directory.c, dlls/ntdll/loader.c, dlls/ntdll/locale.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/path.c, # | dlls/ntdll/process.c, dlls/ntdll/signal_i386.c, dlls/ntdll/tests/exception.c, dlls/ntdll/thread.c, +# | dlls/ntdll/unix/thread.c, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unix/virtual.c, dlls/ntdll/unixlib.h, # | dlls/system.drv16/system.c, dlls/toolhelp.dll16/toolhelp.c, dlls/user.exe16/message.c, dlls/user.exe16/user.c, # | dlls/user.exe16/window.c, include/winternl.h, libs/wine/loader.c, server/mapping.c, tools/winebuild/build.h, # | tools/winebuild/import.c, tools/winebuild/parser.c, tools/winebuild/relay.c, tools/winebuild/res32.c, @@ -4028,7 +4062,7 @@ fi # Patchset ntdll-NtContinue # | # | This patchset has the following (direct or indirect) dependencies: -# | * winebuild-Fake_Dlls +# | * ntdll-WRITECOPY, ws2_32-WSACleanup, winebuild-Fake_Dlls # | # | This patchset fixes the following Wine bugs: # | * [#31910] Add stub for NtContinue @@ -4139,7 +4173,7 @@ fi # Patchset ntdll-RtlCreateUserThread # | # | This patchset has the following (direct or indirect) dependencies: -# | * winebuild-Fake_Dlls +# | * 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) @@ -4211,7 +4245,7 @@ fi # Patchset ntdll-Syscall_Emulation # | # | This patchset has the following (direct or indirect) dependencies: -# | * winebuild-Fake_Dlls +# | * ntdll-WRITECOPY, ws2_32-WSACleanup, winebuild-Fake_Dlls # | # | This patchset fixes the following Wine bugs: # | * [#48291] Detroit: Become Human crashes on launch @@ -4662,25 +4696,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then ) >> "$patchlist" fi -# Patchset ws2_32-WSACleanup -# | -# | This patchset fixes the following Wine bugs: -# | * [#18670] Properly close sockets when WSACleanup is called -# | -# | Modified files: -# | * dlls/ntdll/ntdll.spec, dlls/ntdll/server.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/server.c, -# | dlls/ntdll/unix/unix_private.h, dlls/ntdll/unixlib.h, dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, -# | include/wine/server.h, server/protocol.def, server/sock.c -# | -if test "$enable_ws2_32_WSACleanup" -eq 1; then - patch_apply ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch - patch_apply ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch - ( - printf '%s\n' '+ { "Matt Durgavich", "ws2_32: Proper WSACleanup implementation using wineserver function.", 2 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ws2_32: Invalidate client-side file descriptor cache in WSACleanup.", 1 },'; - ) >> "$patchlist" -fi - # Patchset server-Desktop_Refcount # | # | This patchset has the following (direct or indirect) dependencies: 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 8dd18d54..6d62c691 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,25 +1,28 @@ -From 916104878b837947e14ed7d44f591de5ba4fa2dc Mon Sep 17 00:00:00 2001 +From e695bf789da272b2855ad864b0837c38c1a78e62 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 | 3 + - include/winternl.h | 2 +- - tools/winebuild/build.h | 7 +++ - tools/winebuild/import.c | 10 ++-- - tools/winebuild/parser.c | 59 ++++++++++++++++++++ - tools/winebuild/spec16.c | 22 +------- - tools/winebuild/spec32.c | 104 +++++++++++++++++++++++++++++++++++ - tools/winebuild/utils.c | 21 +++++++ - 11 files changed, 210 insertions(+), 27 deletions(-) + dlls/ntdll/loader.c | 3 + + dlls/ntdll/signal_i386.c | 4 +- + dlls/ntdll/tests/exception.c | 2 + + dlls/ntdll/thread.c | 3 +- + dlls/ntdll/unix/thread.c | 3 +- + dlls/ntdll/unix/unix_private.h | 2 +- + dlls/ntdll/unixlib.h | 4 +- + include/winternl.h | 2 +- + tools/winebuild/build.h | 7 +++ + tools/winebuild/import.c | 10 ++-- + tools/winebuild/parser.c | 59 +++++++++++++++++++ + tools/winebuild/spec16.c | 22 +------ + tools/winebuild/spec32.c | 104 +++++++++++++++++++++++++++++++++ + tools/winebuild/utils.c | 21 +++++++ + 14 files changed, 214 insertions(+), 32 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 51addaaf983..b888b680bc4 100644 +index 45d32399adf..b42cff8bcd4 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3810,6 +3810,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) @@ -40,7 +43,7 @@ index 51addaaf983..b888b680bc4 100644 if (process_detaching) return; diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index 72413dcd6c7..88dffb03138 100644 +index be88d9bf3c7..84ab7991886 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -448,6 +448,8 @@ static ULONG first_ldt_entry = 32; @@ -75,26 +78,82 @@ 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 d5e34cae3b1..73057d9a9a4 100644 +index a2f5df1b1c2..dc9affc061a 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -201,6 +201,8 @@ void map_user_shared_data(void) - NtClose( section ); +@@ -173,6 +173,7 @@ int __cdecl __wine_dbg_output( const char *str ) + return unix_funcs->dbg_output( str ); } +extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); -+ + /*********************************************************************** * thread_init - * -@@ -235,6 +237,7 @@ TEB *thread_init(void) +@@ -189,7 +190,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) + signal_init_early(); - teb = unix_funcs->virtual_alloc_first_teb(); - unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy ); -+ teb->WOW32Reserved = __wine_syscall_dispatcher; + teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, +- &is_wow64, &server_start_time ); ++ &is_wow64, &server_start_time, __wine_syscall_dispatcher ); 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 +--- a/dlls/ntdll/unix/thread.c ++++ b/dlls/ntdll/unix/thread.c +@@ -83,7 +83,7 @@ static void pthread_exit_wrapper( int status ) + * init_threading + */ + 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 ) ++ unsigned int *cpus, BOOL *wow64, timeout_t *start_time, void *syscall_handler ) + { + TEB *teb; + SIZE_T info_size; +@@ -95,6 +95,7 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ + nb_threads = nb_threads_ptr; + + teb = virtual_alloc_first_teb(); ++ teb->WOW32Reserved = syscall_handler; + thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; + 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 +--- 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; + 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; +diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h +index 72f35cf67e8..93a51871f1d 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 + + struct unix_funcs + { +@@ -165,7 +165,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 ); 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 c26e699f..7dcd7ad9 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,4 +1,4 @@ -From c7bd63dbac91eb167ec90846cd8cb7a193b04aa1 Mon Sep 17 00:00:00 2001 +From 1c0ba3961674f316dba2d89042571b7863076f08 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. @@ -62,7 +62,7 @@ index 926fa913866..902907329c0 100644 CloseHandle(map); CloseHandle(file); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index b888b680bc4..bb60aa919af 100644 +index b42cff8bcd4..b21d88bb13b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3811,6 +3811,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule) @@ -82,10 +82,10 @@ index b888b680bc4..bb60aa919af 100644 pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL ); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 73057d9a9a4..8c9b0b11c86 100644 +index ed77e4a2e98..a988d4c3e6b 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c -@@ -203,6 +203,39 @@ void map_user_shared_data(void) +@@ -175,6 +175,39 @@ int __cdecl __wine_dbg_output( const char *str ) extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); @@ -125,10 +125,10 @@ index 73057d9a9a4..8c9b0b11c86 100644 /*********************************************************************** * thread_init * -@@ -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; +@@ -190,6 +223,7 @@ TEB *thread_init( SIZE_T *info_size, BOOL *suspend ) + + teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus, + &is_wow64, &server_start_time, __wine_syscall_dispatcher ); + teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher; peb = teb->Peb; 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 35f9eb13..b1663793 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,16 +1,16 @@ -From 9382d41830426f68bf5da895f308f6691df8111b Mon Sep 17 00:00:00 2001 +From 2f82153b52cd517c9e30ab5ac26a0c60ed70a48d 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. --- dlls/kernel32/tests/loader.c | 7 +- - dlls/ntdll/thread.c | 13 +- + dlls/ntdll/unix/virtual.c | 4 +- libs/wine/loader.c | 4 + server/mapping.c | 6 +- tools/winebuild/parser.c | 2 +- tools/winebuild/spec32.c | 285 ++++++++++++++++++++++++++++++++++- - 6 files changed, 306 insertions(+), 11 deletions(-) + 6 files changed, 297 insertions(+), 11 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 95939ba6bde..ae5462f6e55 100644 @@ -39,45 +39,27 @@ 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 8187dbe1f2d..5427cbcf04e 100644 ---- a/dlls/ntdll/thread.c -+++ b/dlls/ntdll/thread.c -@@ -51,6 +51,8 @@ WINE_DECLARE_DEBUG_CHANNEL(relay); +diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c +index 7c5b5d5cf15..66ae4cb841c 100644 +--- a/dlls/ntdll/unix/virtual.c ++++ b/dlls/ntdll/unix/virtual.c +@@ -2546,14 +2546,14 @@ TEB *virtual_alloc_first_teb(void) + TEB *teb; + PEB *peb; + NTSTATUS status; +- SIZE_T data_size = page_size; ++ SIZE_T data_size = page_size * 2; + SIZE_T peb_size = page_size; + SIZE_T teb_size = signal_stack_mask + 1; + SIZE_T total = 32 * teb_size; - struct _KUSER_SHARED_DATA *user_shared_data = NULL; - -+extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void ); -+ - void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL; - - static PEB *peb; -@@ -256,9 +258,9 @@ TEB *thread_init(void) /* reserve space for shared user data */ - - addr = (void *)0x7ffe0000; -- size = 0x1000; -+ size = 0x2000; - status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, -- MEM_RESERVE|MEM_COMMIT, PAGE_READONLY ); -+ MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE ); + status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&user_shared_data, 0, &data_size, +- MEM_RESERVE | MEM_COMMIT, PAGE_READONLY ); ++ MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE ); if (status) { - MESSAGE( "wine: failed to map the shared user data: %08x\n", status ); -@@ -266,6 +268,13 @@ TEB *thread_init(void) - } - user_shared_data = addr; - -+#if defined(__APPLE__) && defined(__x86_64__) -+ *((DWORD*)((char*)user_shared_data + 0x1000)) = __wine_syscall_dispatcher; -+#endif -+ -+ /* Init this field early for x86_64 syscall thunks. */ -+ user_shared_data->SystemCallPad[0] = 1; -+ - /* allocate and initialize the PEB and initial TEB */ - - teb = unix_funcs->virtual_alloc_first_teb(); + ERR( "wine: failed to map the shared user data: %08x\n", status ); diff --git a/libs/wine/loader.c b/libs/wine/loader.c index 4597a6cb324..3d0d75e9c6d 100644 --- a/libs/wine/loader.c diff --git a/patches/winebuild-Fake_Dlls/definition b/patches/winebuild-Fake_Dlls/definition index 5ffc046f..99799c33 100644 --- a/patches/winebuild-Fake_Dlls/definition +++ b/patches/winebuild-Fake_Dlls/definition @@ -3,3 +3,5 @@ Fixes: [42741] StarCraft I: 1.18 PTR fails to initialize ClientSdk.dll Fixes: [45349] Multiple applications and games crash due to missing support for 64-bit syscall thunks (StreetFighter V) Fixes: [45573] League of Legends 8.12+ fails to start a game (anticheat engine, hooking of syscall return instructions) Fixes: [45650] chromium 32-bit sandbox expects different syscall thunks depending on Windows version +Depends: ntdll-WRITECOPY +Depends: ws2_32-WSACleanup \ No newline at end of file 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 2d0f016c..d830cf2d 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 d6f023a80929f22d520584d47abb08e5b523e0c0 Mon Sep 17 00:00:00 2001 +From 613ea1e263d4fbda67465ebaae2331df7728106a 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 bde4a2add18..de3b4b9d2e7 100644 +index 6fb86a68d6f..2f95e190963 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 bde4a2add18..de3b4b9d2e7 100644 /*********************************************************************** * server_init_process diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 1297c451a10..06c0174dd5e 100644 +index 767cae92b48..05c6f1e43bf 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1044,6 +1044,7 @@ static struct unix_funcs unix_funcs = +@@ -1074,6 +1074,7 @@ static struct unix_funcs unix_funcs = server_wait, server_queue_process_apc, server_send_fd, @@ -60,10 +60,10 @@ index 1297c451a10..06c0174dd5e 100644 server_fd_to_handle, server_handle_to_fd, diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index 17b23e58d28..f7d172cf324 100644 +index 66c438fd62d..c6eb52c5986 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c -@@ -983,6 +983,26 @@ static int remove_fd_from_cache( HANDLE handle ) +@@ -991,6 +991,26 @@ static int remove_fd_from_cache( HANDLE handle ) return fd; } @@ -91,10 +91,10 @@ 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 14c4ee4cd97..5657bc9c27d 100644 +index 6fdaa17f087..6512160972d 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 +@@ -85,6 +85,7 @@ extern unsigned int CDECL server_wait( const select_op_t *select_op, data_size_t 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; @@ -103,19 +103,19 @@ index 14c4ee4cd97..5657bc9c27d 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 67c63fd9268..51e27be22b7 100644 +index 4e5cec6637e..72f35cf67e8 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 19 -+#define NTDLL_UNIXLIB_VERSION 20 +-#define NTDLL_UNIXLIB_VERSION 27 ++#define NTDLL_UNIXLIB_VERSION 28 struct unix_funcs { -@@ -128,6 +128,7 @@ struct unix_funcs +@@ -184,6 +184,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 8b626a80..b39f89ab 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -aba27fd5a3241635adb15fa7ef40aa43bf3978a1 +3c72034b72014a087eae8d181252c67cb0782e28