Alexandre Julliard : ntdll: Implement RtlWow64GetCurrentMachine().
Alexandre Julliard
julliard at winehq.org
Thu Apr 29 16:38:30 CDT 2021
Module: wine
Branch: master
Commit: 6c2f19c0a72e84579da5fe7d5433de426858a4ad
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6c2f19c0a72e84579da5fe7d5433de426858a4ad
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Apr 29 17:14:20 2021 +0200
ntdll: Implement RtlWow64GetCurrentMachine().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/ntdll.spec | 1 +
dlls/ntdll/process.c | 12 ++++++++++++
dlls/ntdll/tests/info.c | 8 ++++++++
include/winternl.h | 1 +
4 files changed, 22 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 198a7287302..431ab7c6db7 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1068,6 +1068,7 @@
@ stdcall RtlWalkHeap(long ptr)
@ stdcall RtlWow64EnableFsRedirection(long)
@ stdcall RtlWow64EnableFsRedirectionEx(long ptr)
+@ stdcall RtlWow64GetCurrentMachine()
@ stdcall RtlWow64GetProcessMachines(long ptr ptr)
@ stdcall -arch=x86_64 RtlWow64GetThreadContext(long ptr)
@ stdcall -arch=x86_64 RtlWow64SetThreadContext(long ptr)
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 8621d4f4123..f42dc6d8201 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -49,6 +49,18 @@ PEB * WINAPI RtlGetCurrentPeb(void)
}
+/**********************************************************************
+ * RtlWow64GetCurrentMachine (NTDLL.@)
+ */
+USHORT WINAPI RtlWow64GetCurrentMachine(void)
+{
+ USHORT current, native;
+
+ RtlWow64GetProcessMachines( GetCurrentProcess(), ¤t, &native );
+ return current ? current : native;
+}
+
+
/**********************************************************************
* RtlWow64GetProcessMachines (NTDLL.@)
*/
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 1b20937de50..af53c696cdf 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -25,6 +25,7 @@
static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
static NTSTATUS (WINAPI * pNtSetSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG);
static NTSTATUS (WINAPI * pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
+static USHORT (WINAPI * pRtlWow64GetCurrentMachine)(void);
static NTSTATUS (WINAPI * pRtlWow64GetProcessMachines)(HANDLE,WORD*,WORD*);
static NTSTATUS (WINAPI * pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS, void*, ULONG, void*, ULONG, ULONG*);
static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG);
@@ -83,6 +84,7 @@ static BOOL InitFunctionPtrs(void)
NTDLL_GET_PROC(NtQuerySystemInformation);
NTDLL_GET_PROC(NtSetSystemInformation);
NTDLL_GET_PROC(RtlGetNativeSystemInformation);
+ NTDLL_GET_PROC(RtlWow64GetCurrentMachine);
NTDLL_GET_PROC(RtlWow64GetProcessMachines);
NTDLL_GET_PROC(NtPowerInformation);
NTDLL_GET_PROC(NtQueryInformationProcess);
@@ -3009,6 +3011,12 @@ static void test_query_architectures(void)
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
+
+ if (pRtlWow64GetCurrentMachine)
+ {
+ USHORT machine = pRtlWow64GetCurrentMachine();
+ ok( machine == current_machine, "wrong machine %x / %x\n", machine, current_machine );
+ }
}
static void test_thread_lookup(void)
diff --git a/include/winternl.h b/include/winternl.h
index fece32a6f5c..5067fa8ae34 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -4252,6 +4252,7 @@ NTSYSAPI void WINAPI RtlWakeConditionVariable(RTL_CONDITION_VARIABLE *);
NTSYSAPI NTSTATUS WINAPI RtlWalkHeap(HANDLE,PVOID);
NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirection(BOOLEAN);
NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx(ULONG,ULONG*);
+NTSYSAPI USHORT WINAPI RtlWow64GetCurrentMachine(void);
NTSYSAPI NTSTATUS WINAPI RtlWow64GetProcessMachines(HANDLE,USHORT*,USHORT*);
#ifdef __x86_64__
NTSYSAPI NTSTATUS WINAPI RtlWow64GetThreadContext(HANDLE, WOW64_CONTEXT *);
More information about the wine-cvs
mailing list