You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
2.2 KiB
116 lines
2.2 KiB
/*++
|
|
|
|
Copyright (C) Microsoft Corporation, 1995 - 1999
|
|
All rights reserved.
|
|
|
|
Module Name:
|
|
|
|
wow64.h
|
|
|
|
Abstract:
|
|
|
|
printui wow64 related functions.
|
|
|
|
Author:
|
|
|
|
Lazar Ivanov (LazarI) 10-Mar-2000
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#include <nt.h>
|
|
#include <ntrtl.h>
|
|
#include <nturtl.h>
|
|
#include <windows.h>
|
|
#include <tchar.h>
|
|
|
|
#include "wow64.h"
|
|
|
|
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
|
|
|
//
|
|
// Win64 APIs, types and data structures.
|
|
//
|
|
|
|
ClientVersion
|
|
OSEnv_GetClientVer(
|
|
VOID
|
|
)
|
|
{
|
|
return(sizeof(ULONG_PTR));
|
|
}
|
|
|
|
ServerVersion
|
|
OSEnv_GetServerVer(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG_PTR ul;
|
|
NTSTATUS st;
|
|
ServerVersion serverVersion;
|
|
|
|
st = NtQueryInformationProcess(NtCurrentProcess(),
|
|
ProcessWow64Information, &ul, sizeof(ul), NULL);
|
|
|
|
if( NT_SUCCESS(st) )
|
|
{
|
|
// If this call succeeds, we're on Win2000 or newer machines.
|
|
if( 0 != ul )
|
|
{
|
|
// 32-bit code running on Win64
|
|
serverVersion = THUNKVERSION;
|
|
}
|
|
else
|
|
{
|
|
// 32-bit code running on Win2000 or later 32-bit OS
|
|
serverVersion = NATIVEVERSION;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
serverVersion = NATIVEVERSION;
|
|
}
|
|
|
|
return serverVersion;
|
|
}
|
|
|
|
BOOL
|
|
IsRunningWOW64(
|
|
VOID
|
|
)
|
|
{
|
|
// return !IsRunningInSPLWOW();
|
|
return (RUN32BINVER == OSEnv_GetClientVer() &&
|
|
THUNKVERSION == OSEnv_GetServerVer());
|
|
|
|
}
|
|
|
|
PlatformType
|
|
GetCurrentPlatform(
|
|
VOID
|
|
)
|
|
{
|
|
if (RUN64BINVER == OSEnv_GetClientVer())
|
|
{
|
|
// this is a native 64bit process - i.e. the platform is IA64
|
|
return kPlatform_IA64;
|
|
}
|
|
else
|
|
{
|
|
// this is 32 bit process. it can be either native - i.e. the platform is i386 -
|
|
// or wow64 - i.e. the platform is again IA64.
|
|
|
|
if (THUNKVERSION == OSEnv_GetServerVer())
|
|
{
|
|
// the process is wow64 - the platform is IA64
|
|
return kPlatform_IA64;
|
|
}
|
|
else
|
|
{
|
|
// the process is native - i.e. the platform is x86
|
|
return kPlatform_x86;
|
|
}
|
|
}
|
|
}
|
|
|