From e57d5003088f7ea00516bcdaf92bb068a4b442ef Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 27 Jul 2021 11:24:33 +0200 Subject: [PATCH] wow64: Add thunks for the write watch syscalls. Signed-off-by: Alexandre Julliard --- dlls/wow64/syscall.h | 2 ++ dlls/wow64/virtual.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 516e0d833c4..95c2cf646e3 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -64,6 +64,7 @@ SYSCALL_ENTRY( NtFreeVirtualMemory ) \ SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \ SYSCALL_ENTRY( NtGetNlsSectionPtr ) \ + SYSCALL_ENTRY( NtGetWriteWatch ) \ SYSCALL_ENTRY( NtListenPort ) \ SYSCALL_ENTRY( NtLoadKey ) \ SYSCALL_ENTRY( NtLoadKey2 ) \ @@ -113,6 +114,7 @@ SYSCALL_ENTRY( NtReplyWaitReceivePort ) \ SYSCALL_ENTRY( NtRequestWaitReplyPort ) \ SYSCALL_ENTRY( NtResetEvent ) \ + SYSCALL_ENTRY( NtResetWriteWatch ) \ SYSCALL_ENTRY( NtRestoreKey ) \ SYSCALL_ENTRY( NtSaveKey ) \ SYSCALL_ENTRY( NtSecureConnectPort ) \ diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index 27b46ee74e8..fad79a2de60 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -177,6 +177,38 @@ NTSTATUS WINAPI wow64_NtGetNlsSectionPtr( UINT *args ) } +/********************************************************************** + * wow64_NtGetWriteWatch + */ +NTSTATUS WINAPI wow64_NtGetWriteWatch( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + ULONG flags = get_ulong( &args ); + void *base = get_ptr( &args ); + SIZE_T size = get_ulong( &args ); + ULONG *addr_ptr = get_ptr( &args ); + ULONG *count_ptr = get_ptr( &args ); + ULONG *granularity = get_ptr( &args ); + + ULONG_PTR i, count = *count_ptr; + void **addresses; + NTSTATUS status; + + if (!count || !size) return STATUS_INVALID_PARAMETER; + if (flags & ~WRITE_WATCH_FLAG_RESET) return STATUS_INVALID_PARAMETER; + if (!addr_ptr) return STATUS_ACCESS_VIOLATION; + + addresses = RtlAllocateHeap( GetProcessHeap(), 0, count * sizeof(*addresses) ); + if (!(status = NtGetWriteWatch( handle, flags, base, size, addresses, &count, granularity ))) + { + for (i = 0; i < count; i++) addr_ptr[i] = PtrToUlong( addresses[i] ); + *count_ptr = count; + } + RtlFreeHeap( GetProcessHeap(), 0, addresses ); + return status; +} + + /********************************************************************** * wow64_NtLockVirtualMemory */ @@ -279,6 +311,19 @@ NTSTATUS WINAPI wow64_NtReadVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtResetWriteWatch + */ +NTSTATUS WINAPI wow64_NtResetWriteWatch( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void *base = get_ptr( &args ); + SIZE_T size = get_ulong( &args ); + + return NtResetWriteWatch( process, base, size ); +} + + /********************************************************************** * wow64_NtUnlockVirtualMemory */