From 17716bc7f325e5f7606c74c0af8d425b98e60054 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 30 Jun 2021 11:16:01 +0200 Subject: [PATCH] ntdll: Implement RtlWow64GetCurrentCpuArea(). Signed-off-by: Alexandre Julliard --- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/process.c | 18 ++++++++++++++++++ include/winternl.h | 1 + 3 files changed, 20 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 0e1706f2dd2..42de54c895e 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1075,6 +1075,7 @@ @ stdcall RtlWow64EnableFsRedirection(long) @ stdcall RtlWow64EnableFsRedirectionEx(long ptr) @ stdcall -arch=win64 RtlWow64GetCpuAreaInfo(ptr long ptr) +@ stdcall -arch=win64 RtlWow64GetCurrentCpuArea(ptr ptr ptr) @ stdcall RtlWow64GetCurrentMachine() @ stdcall RtlWow64GetProcessMachines(long ptr ptr) @ stdcall -arch=win64 RtlWow64GetThreadContext(long ptr) diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 3ed31e22100..e8b7785ce31 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -143,6 +143,24 @@ NTSTATUS WINAPI RtlWow64GetCpuAreaInfo( WOW64_CPURESERVED *cpu, ULONG reserved, } +/********************************************************************** + * RtlWow64GetCurrentCpuArea (NTDLL.@) + */ +NTSTATUS WINAPI RtlWow64GetCurrentCpuArea( USHORT *machine, void **context, void **context_ex ) +{ + WOW64_CPU_AREA_INFO info; + NTSTATUS status; + + if (!(status = RtlWow64GetCpuAreaInfo( NtCurrentTeb()->TlsSlots[WOW64_TLS_CPURESERVED], 0, &info ))) + { + if (machine) *machine = info.Machine; + if (context) *context = info.Context; + if (context_ex) *context_ex = *(void **)info.ContextEx; + } + return status; +} + + /****************************************************************************** * RtlWow64GetThreadContext (NTDLL.@) */ diff --git a/include/winternl.h b/include/winternl.h index 71be1f5816d..b07a5465d86 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4404,6 +4404,7 @@ NTSYSAPI int __cdecl _strnicmp(LPCSTR,LPCSTR,size_t); #ifdef _WIN64 NTSYSAPI NTSTATUS WINAPI RtlWow64GetCpuAreaInfo(WOW64_CPURESERVED*,ULONG,WOW64_CPU_AREA_INFO*); +NTSYSAPI NTSTATUS WINAPI RtlWow64GetCurrentCpuArea(USHORT*,void**,void**); NTSYSAPI NTSTATUS WINAPI RtlWow64GetThreadContext(HANDLE,WOW64_CONTEXT*); NTSYSAPI NTSTATUS WINAPI RtlWow64SetThreadContext(HANDLE,const WOW64_CONTEXT*); #else