ReactOS 0.4.17-dev-540-g8f54750
wow64.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for wow64.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI RtlWow64GetProcessMachines (_In_ HANDLE ProcessHandle, _Out_ PUSHORT ProcessMachine, _Out_opt_ PUSHORT NativeMachine)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file wow64.c.

Function Documentation

◆ RtlWow64GetProcessMachines()

NTSTATUS NTAPI RtlWow64GetProcessMachines ( _In_ HANDLE  ProcessHandle,
_Out_ PUSHORT  ProcessMachine,
_Out_opt_ PUSHORT  NativeMachine 
)

Definition at line 17 of file wow64.c.

21{
23 ULONG_PTR Wow64Info;
24
25 /* Check if the caller wants the current process */
27 {
28 /* Easy: process machine is current architecture */
29 *ProcessMachine = IMAGE_FILE_MACHINE_NATIVE;
30 }
31 else if (SharedUserData->ImageNumberLow == IMAGE_FILE_MACHINE_AMD64)
32 {
33 /* Kernel architecture is AMD64, query whether the process is WOW64 */
36 &Wow64Info,
37 sizeof(Wow64Info),
38 NULL);
39 if (!NT_SUCCESS(Status))
40 {
41 return Status;
42 }
43
44 *ProcessMachine = Wow64Info ? IMAGE_FILE_MACHINE_I386 : IMAGE_FILE_MACHINE_AMD64;
45 }
46 else
47 {
48 /* kernel is something else, assume no WOW64 */
49 *ProcessMachine = IMAGE_FILE_MACHINE_NATIVE;
50 }
51
52 if (NativeMachine != NULL)
53 {
54 /* The kernel stores it's native architecture in this field */
55 *NativeMachine = SharedUserData->ImageNumberLow;
56 }
57
58 return STATUS_SUCCESS;
59}
LONG NTSTATUS
Definition: precomp.h:26
@ ProcessWow64Information
Definition: cicbase.cpp:65
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:407
#define NtCurrentProcess()
Definition: nt_native.h:1660
#define IMAGE_FILE_MACHINE_AMD64
Definition: ntimage.h:17
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_to_opt_(ProcessInformationLength, *ReturnLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:211
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
#define SharedUserData
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65