Zebediah Figura : kernel32: Implement Wow64SetThreadContext().
Alexandre Julliard
julliard at winehq.org
Tue Jun 12 17:36:03 CDT 2018
Module: wine
Branch: master
Commit: 2c551a90547f5441e502c43c83df643b9f4c08fe
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2c551a90547f5441e502c43c83df643b9f4c08fe
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Wed Jun 6 13:30:20 2018 -0500
kernel32: Implement Wow64SetThreadContext().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/kernel32.spec | 2 +-
dlls/kernel32/thread.c | 17 +++++++++++++++++
include/winbase.h | 1 +
include/winternl.h | 1 +
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 1cb0b54..de6f007 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1603,7 +1603,7 @@
@ stdcall Wow64GetThreadContext(long ptr)
# @ stub Wow64GetThreadSelectorEntry
@ stdcall Wow64RevertWow64FsRedirection(ptr)
-# @ stub Wow64SetThreadContext
+@ stdcall Wow64SetThreadContext(long ptr)
# @ stub Wow64SuspendThread
@ stdcall WriteConsoleA(long ptr long ptr ptr)
@ stdcall WriteConsoleInputA(long ptr long ptr)
diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c
index 5ba3190..a86ad34 100644
--- a/dlls/kernel32/thread.c
+++ b/dlls/kernel32/thread.c
@@ -236,6 +236,23 @@ BOOL WINAPI SetThreadContext( HANDLE handle, /* [in] Handle to thread
/***********************************************************************
+ * Wow64SetThreadContext [KERNEL32.@]
+ */
+BOOL WINAPI Wow64SetThreadContext( HANDLE handle, const WOW64_CONTEXT *context)
+{
+#ifdef __i386__
+ NTSTATUS status = NtSetContextThread( handle, (const CONTEXT *)context );
+#elif defined(__x86_64__)
+ NTSTATUS status = RtlWow64SetThreadContext( handle, context );
+#else
+ NTSTATUS status = STATUS_NOT_IMPLEMENTED;
+ FIXME("not implemented on this platform\n");
+#endif
+ if (status) SetLastError( RtlNtStatusToDosError(status) );
+ return !status;
+}
+
+/***********************************************************************
* GetThreadContext [KERNEL32.@] Retrieves context of thread.
*
* RETURNS
diff --git a/include/winbase.h b/include/winbase.h
index f7239b8..667df96 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2708,6 +2708,7 @@ WINBASEAPI BOOL WINAPI Wow64DisableWow64FsRedirection(PVOID*);
WINBASEAPI BOOLEAN WINAPI Wow64EnableWow64FsRedirection(BOOLEAN);
WINBASEAPI BOOL WINAPI Wow64GetThreadContext(HANDLE, WOW64_CONTEXT *);
WINBASEAPI BOOL WINAPI Wow64RevertWow64FsRedirection(PVOID);
+WINBASEAPI BOOL WINAPI Wow64SetThreadContext(HANDLE, const WOW64_CONTEXT *);
WINADVAPI DWORD WINAPI WriteEncryptedFileRaw(PFE_IMPORT_FUNC,PVOID,PVOID);
WINBASEAPI BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
WINBASEAPI BOOL WINAPI WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE);
diff --git a/include/winternl.h b/include/winternl.h
index 411f523..58c475d 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2838,6 +2838,7 @@ NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirection(BOOLEAN);
NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx(ULONG,ULONG*);
#ifdef __x86_64__
NTSYSAPI NTSTATUS WINAPI RtlWow64GetThreadContext(HANDLE, WOW64_CONTEXT *);
+NTSYSAPI NTSTATUS WINAPI RtlWow64SetThreadContext(HANDLE, const WOW64_CONTEXT *);
#endif
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
NTSYSAPI NTSTATUS WINAPI RtlZombifyActivationContext(HANDLE);
More information about the wine-cvs
mailing list