From 261a981d774a8e54b2ce670d287b9c3ff355f842 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 29 Jul 2020 09:47:49 +1000 Subject: [PATCH] Rebase against 6d66efa3fee7f529bba6c478e71d54e0d66995f5. --- ...gString-should-throw-the-exception-a.patch | 41 ++++++-------- patches/patchinstall.sh | 8 +-- ...ontextThread-on-i386-with-PE-syscall.patch | 55 ------------------- staging/upstream-commit | 2 +- 4 files changed, 20 insertions(+), 86 deletions(-) delete mode 100644 patches/winebuild-pe_syscall_thunks/0004-ntdll-Fix-NtGetContextThread-on-i386-with-PE-syscall.patch diff --git a/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch b/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch index 67e33891..d76b6cba 100644 --- a/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch +++ b/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch @@ -1,19 +1,19 @@ -From bf3b9244f374b9926db04b63b29f77139280b44a Mon Sep 17 00:00:00 2001 +From 1889b85c9e9eecdff6882fc9a3d1f1b7247bd08a Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 Sep 2014 23:39:51 +0200 -Subject: ntdll: OutputDebugString should throw the exception a second time, if - a debugger is attached. +Subject: [PATCH] ntdll: OutputDebugString should throw the exception a second + time, if a debugger is attached. --- dlls/kernelbase/debug.c | 17 +++++++++++++++++ - dlls/ntdll/tests/exception.c | 11 +++++------ - 2 files changed, 22 insertions(+), 6 deletions(-) + dlls/ntdll/tests/exception.c | 9 ++++----- + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c -index 016c21109..a3d14d340 100644 +index 20dd7d304a2..3b39f78cc7a 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c -@@ -210,6 +210,23 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str ) +@@ -213,6 +213,23 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str ) __ENDTRY if (caught_by_dbg) return; @@ -38,10 +38,10 @@ index 016c21109..a3d14d340 100644 if (!mutex_inited) { diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c -index 0a9dae138..b7b0f0e70 100644 +index 3ced3d04b71..9a2ab8db02a 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c -@@ -2751,7 +2751,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce +@@ -3893,7 +3893,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce return EXCEPTION_CONTINUE_SEARCH; } @@ -50,7 +50,7 @@ index 0a9dae138..b7b0f0e70 100644 { PVOID vectored_handler; -@@ -2767,7 +2767,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo) +@@ -3909,7 +3909,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo) outputdebugstring_exceptions = 0; OutputDebugStringA("Hello World"); @@ -58,7 +58,7 @@ index 0a9dae138..b7b0f0e70 100644 ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %d exceptions, expected %d\n", outputdebugstring_exceptions, numexc); -@@ -3448,9 +3447,9 @@ START_TEST(exception) +@@ -4509,9 +4508,9 @@ START_TEST(exception) run_rtlraiseexception_test(EXCEPTION_BREAKPOINT); run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE); test_stage = 3; @@ -70,24 +70,15 @@ index 0a9dae138..b7b0f0e70 100644 test_stage = 5; test_ripevent(0); test_stage = 6; -@@ -3481,7 +3480,7 @@ START_TEST(exception) - test_exceptions(); - test_rtlraiseexception(); - test_debug_registers(); -- test_outputdebugstring(1, FALSE); -+ test_outputdebugstring(1); - test_ripevent(1); - test_debug_service(1); - test_breakpoint(1); -@@ -3519,7 +3518,7 @@ START_TEST(exception) - "_setjmp" ); +@@ -4588,7 +4587,7 @@ START_TEST(exception) + #endif - test_debug_registers(); + test_thread_context(); - test_outputdebugstring(1, FALSE); + test_outputdebugstring(1); test_ripevent(1); - test_debug_service(1); test_breakpoint(1); + test_closehandle(0, (HANDLE)0xdeadbeef); -- -2.23.0 +2.27.0 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4cbe0138..5e4418cb 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "0d42388095e4fd5c7702a61824b01ce0f9fc4d74" + echo "6d66efa3fee7f529bba6c478e71d54e0d66995f5" } # Show version information @@ -3866,17 +3866,15 @@ fi # | * [#45650] chromium 32-bit sandbox expects different syscall thunks depending on Windows version # | # | Modified files: -# | * dlls/ntdll/ntdll.spec, dlls/ntdll/signal_i386.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/virtual.c, -# | tools/winebuild/import.c, tools/winebuild/spec32.c +# | * dlls/ntdll/ntdll.spec, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/virtual.c, tools/winebuild/import.c, +# | tools/winebuild/spec32.c # | if test "$enable_winebuild_pe_syscall_thunks" -eq 1; then patch_apply winebuild-pe_syscall_thunks/0002-winebuild-Call-__wine_syscall_dispatcher-through-the.patch patch_apply winebuild-pe_syscall_thunks/0003-ntdll-Also-generate-syscall-thunks-for-Nt-functions-.patch - patch_apply winebuild-pe_syscall_thunks/0004-ntdll-Fix-NtGetContextThread-on-i386-with-PE-syscall.patch ( printf '%s\n' '+ { "Paul Gofman", "winebuild: Call __wine_syscall_dispatcher through the fixed address.", 1 },'; printf '%s\n' '+ { "Paul Gofman", "ntdll: Also generate syscall thunks for Nt functions not yet in the Unix part.", 1 },'; - printf '%s\n' '+ { "Paul Gofman", "ntdll: Fix NtGetContextThread on i386 with PE syscall thunks.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/winebuild-pe_syscall_thunks/0004-ntdll-Fix-NtGetContextThread-on-i386-with-PE-syscall.patch b/patches/winebuild-pe_syscall_thunks/0004-ntdll-Fix-NtGetContextThread-on-i386-with-PE-syscall.patch deleted file mode 100644 index 2d9f5bcb..00000000 --- a/patches/winebuild-pe_syscall_thunks/0004-ntdll-Fix-NtGetContextThread-on-i386-with-PE-syscall.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 9604e2ff972e022b0fa10712d3e55580b232f2c2 Mon Sep 17 00:00:00 2001 -From: Paul Gofman -Date: Tue, 14 Jul 2020 13:31:48 +0300 -Subject: [PATCH] ntdll: Fix NtGetContextThread on i386 with PE syscall thunks. - -Note: to be dropped once i386 NtGetContextThread moves to the -Unix part. ---- - dlls/ntdll/signal_i386.c | 8 +++++--- - tools/winebuild/import.c | 3 +++ - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c -index a130638cb310..8f560e51134b 100644 ---- a/dlls/ntdll/signal_i386.c -+++ b/dlls/ntdll/signal_i386.c -@@ -331,6 +331,8 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4, - "ret $4" ) - - -+extern NTSTATUS WINAPI _syscall_NtGetContextThread( HANDLE handle, CONTEXT *context ); -+ - /*********************************************************************** - * NtGetContextThread (NTDLL.@) - * ZwGetContextThread (NTDLL.@) -@@ -353,9 +355,9 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi, - } - if (needed_flags & CONTEXT_CONTROL) - { -- context->Ebp = ebp; -- context->Esp = (DWORD)&retaddr; -- context->Eip = (DWORD)NtGetContextThread + 12; -+ context->Ebp = *(DWORD *)ebp; -+ context->Esp = ebp + 4; -+ context->Eip = *((DWORD *)ebp + 1); - context->EFlags = eflags; - } - return unix_funcs->NtGetContextThread( handle, context ); -diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c -index 229729386390..e8778527d173 100644 ---- a/tools/winebuild/import.c -+++ b/tools/winebuild/import.c -@@ -1470,6 +1470,9 @@ void output_syscalls( DLLSPEC *spec ) - output( "\tmovl %%esp,%%edi\n" ); - output( "\tcld\n" ); - output( "\trep; movsl\n" ); -+ output( "\tmovl -0x4(%%ebp),%%esi\n" ); -+ output( "\tmovl -0x8(%%ebp),%%edi\n" ); -+ - if (UsePIC) - output( "\tcall *.Lsyscall_table-1b(%%eax,%%edx,4)\n" ); - else --- -2.26.2 - diff --git a/staging/upstream-commit b/staging/upstream-commit index 1844a8db..a135ff9a 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -0d42388095e4fd5c7702a61824b01ce0f9fc4d74 +6d66efa3fee7f529bba6c478e71d54e0d66995f5