From d79b66338e9a53d047b63eddd889c0ec1a829156 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 19 Mar 2017 20:32:29 +0100 Subject: [PATCH] Added patch to implement stub handler for int 0x2e. --- ...tch-windows-int-0x2e-syscall-on-i386.patch | 56 +++++++++++++++++++ patches/ntdll-Interrupt-0x2e/definition | 1 + patches/patchinstall.sh | 16 ++++++ 3 files changed, 73 insertions(+) create mode 100644 patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch create mode 100644 patches/ntdll-Interrupt-0x2e/definition diff --git a/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch b/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch new file mode 100644 index 00000000..6ebfaa3d --- /dev/null +++ b/patches/ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch @@ -0,0 +1,56 @@ +From 40f4e264b0c957eafe187bc0de597c3aa18dc6be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 19 Mar 2017 19:08:34 +0100 +Subject: ntdll: Catch windows int 0x2e syscall on i386. + +--- + dlls/ntdll/signal_i386.c | 13 +++++++++++++ + include/wine/exception.h | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c +index d76fe95dfa..93d9418527 100644 +--- a/dlls/ntdll/signal_i386.c ++++ b/dlls/ntdll/signal_i386.c +@@ -1572,6 +1572,14 @@ static inline BOOL handle_interrupt( unsigned int interrupt, EXCEPTION_RECORD *r + rec->ExceptionInformation[1] = context->Ecx; + rec->ExceptionInformation[2] = context->Edx; + return TRUE; ++ case 0x2e: ++ context->Eip += 2; ++ rec->ExceptionCode = EXCEPTION_WINE_SYSCALL; ++ rec->ExceptionAddress = (void *)context->Eip; ++ rec->NumberParameters = 2; ++ rec->ExceptionInformation[0] = context->Eax; ++ rec->ExceptionInformation[1] = context->Edx; ++ return TRUE; + default: + return FALSE; + } +@@ -1953,6 +1961,11 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context + } + } + break; ++ case EXCEPTION_WINE_SYSCALL: ++ FIXME("unimplemented syscall handler for 0x%lx, stack 0x%lx\n", ++ rec->ExceptionInformation[0], rec->ExceptionInformation[1]); ++ context->Eax = STATUS_INVALID_SYSTEM_SERVICE; ++ goto done; + } + status = NtRaiseException( rec, context, TRUE ); + raise_status( status, rec ); +diff --git a/include/wine/exception.h b/include/wine/exception.h +index f275568f4d..b8aeb3b866 100644 +--- a/include/wine/exception.h ++++ b/include/wine/exception.h +@@ -259,6 +259,7 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_get_frame(void) + + #define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */ + #define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */ ++#define EXCEPTION_WINE_SYSCALL 0x80000103 + + /* unhandled return status from vm86 mode */ + #define EXCEPTION_VM86_INTx 0x80000110 +-- +2.11.0 + diff --git a/patches/ntdll-Interrupt-0x2e/definition b/patches/ntdll-Interrupt-0x2e/definition new file mode 100644 index 00000000..bcc00b8b --- /dev/null +++ b/patches/ntdll-Interrupt-0x2e/definition @@ -0,0 +1 @@ +Fixes: Implement stub handler for int 0x2e diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4aa6cead..8eaf4d63 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -233,6 +233,7 @@ patch_enable_all () enable_ntdll_Grow_Virtual_Heap="$1" enable_ntdll_Heap_FreeLists="$1" enable_ntdll_Hide_Wine_Exports="$1" + enable_ntdll_Interrupt_0x2e="$1" enable_ntdll_Junction_Points="$1" enable_ntdll_LDR_MODULE="$1" enable_ntdll_LdrEnumerateLoadedModules="$1" @@ -919,6 +920,9 @@ patch_enable () ntdll-Hide_Wine_Exports) enable_ntdll_Hide_Wine_Exports="$2" ;; + ntdll-Interrupt-0x2e) + enable_ntdll_Interrupt_0x2e="$2" + ;; ntdll-Junction_Points) enable_ntdll_Junction_Points="$2" ;; @@ -5425,6 +5429,18 @@ if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-Interrupt-0x2e +# | +# | Modified files: +# | * dlls/ntdll/signal_i386.c, include/wine/exception.h +# | +if test "$enable_ntdll_Interrupt_0x2e" -eq 1; then + patch_apply ntdll-Interrupt-0x2e/0001-ntdll-Catch-windows-int-0x2e-syscall-on-i386.patch + ( + printf '%s\n' '+ { "Michael Müller", "ntdll: Catch windows int 0x2e syscall on i386.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-NtQueryEaFile # | # | This patchset has the following (direct or indirect) dependencies: