Following is IsWow64 implemenation from
"http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF0072878E6/32-64bit_install.doc"

typedef UINT (WINAPI* GETSYSTEMWOW64DIRECTORY)(LPTSTR, UINT);
BOOL IsWow64(void)
{
#ifdef _WIN64
return FALSE;

#else
GETSYSTEMWOW64DIRECTORY getSystemWow64Directory;
HMODULE hKernel32;
TCHAR Wow64Directory[MAX_PATH];

hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (hKernel32 == NULL) {
//
// This shouldn't happen, but if we can't get
// kernel32's module handle then assume we are
//on x86. We won't ever install 32-bit drivers
// on 64-bit machines, we just want to catch it
// up front to give users a better error message.
//
return FALSE;
}

getSystemWow64Directory = (GETSYSTEMWOW64DIRECTORY)
GetProcAddress(hKernel32, "GetSystemWow64DirectoryW");

if (getSystemWow64Directory == NULL) {
//
// This most likely means we are running
// on Windows 2000, which didn't have this API
// and didn't have a 64-bit counterpart.
//
return FALSE;
}

if ((getSystemWow64Directory(Wow64Directory,
sizeof(Wow64Directory)/sizeof(TCHAR)) == 0) &&
(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) {
return FALSE;
}

//
// GetSystemWow64Directory succeeded
// so we are on a 64-bit OS.
//
return TRUE;
#endif
}

Please help explain the code at very beginning of the method as of:
"#ifdef _WIN64 return FALSE;" Why does it return 'FALSE' instead of
'TRUE'? I am confused.

RE: IsWow64 method clarification needed by bobbym

bobbym
Wed Jan 04 11:46:20 CST 2006

------=_NextPart_0001_3746CC8D
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


--------------------
From: "hq4000@hotmail.com" <hq4000@hotmail.com>
Newsgroups: microsoft.public.development.device.drivers
Subject: IsWow64 method clarification needed
Date: 4 Jan 2006 05:34:38 -0800
Organization: http://groups.google.com


Following is IsWow64 implemenation from
"http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF007
2878E6/32-64bit_install.doc"

typedef UINT (WINAPI* GETSYSTEMWOW64DIRECTORY)(LPTSTR, UINT);
BOOL IsWow64(void)
{
#ifdef _WIN64
return FALSE;


Please help explain the code at very beginning of the method as of:
"#ifdef _WIN64 return FALSE;" Why does it return 'FALSE' instead of
'TRUE'? I am confused.


The above IsWoW64 is used to check from within a 32-bit app whether it is
running in a native 32-bit Os or in wow64 under 64-bit OS and handle it
differently.
_WIN64 is defined only for 64-bit apps and it can run only in a 64-bit OS
and there is no WOW64 involved.

Btw, there is a better API to use , please see:
IsWow64Process
http://msdn.microsoft.com/library/en-us/dllproc/base/iswow64process.asp



Hope this helps.

Thank you,
Bobby Mattappally
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.

------=_NextPart_0001_3746CC8D
Content-Type: text/x-rtf
Content-Transfer-Encoding: 7bit

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20
\par \pard\li720 --------------------
\par From: "hq4000@hotmail.com" <hq4000@hotmail.com>
\par Newsgroups: microsoft.public.development.device.drivers
\par Subject: IsWow64 method clarification needed
\par Date: 4 Jan 2006 05:34:38 -0800
\par Organization: http://groups.google.com
\par
\par
\par Following is IsWow64 implemenation from
\par "http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF0072878E6/32-64bit_install.doc"
\par
\par typedef UINT (WINAPI* GETSYSTEMWOW64DIRECTORY)(LPTSTR, UINT);
\par BOOL IsWow64(void)
\par \{
\par #ifdef _WIN64
\par return FALSE;
\par
\par
\par Please help explain the code at very beginning of the method as of:
\par "#ifdef _WIN64 return FALSE;" Why does it return 'FALSE' instead of
\par 'TRUE'? I am confused.
\par
\par \pard
\par The above IsWoW64 is used to check from within a 32-bit app whether it is running in a native 32-bit Os or in wow64 under 64-bit OS and handle it differently.
\par _WIN64 is defined only for 64-bit apps and it can run only in a 64-bit OS and there is no WOW64 involved.
\par
\par Btw, there is a better API to use , please see:
\par IsWow64Process
\par http://msdn.microsoft.com/library/en-us/dllproc/base/iswow64process.asp
\par
\par
\par
\par Hope this helps.
\par
\par Thank you,
\par Bobby Mattappally
\par Microsoft
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par
\par }
------=_NextPart_0001_3746CC8D--


RE: IsWow64 method clarification needed by pavel_a

pavel_a
Wed Jan 04 11:56:05 CST 2006

"hq4000@hotmail.com" wrote:
> Please help explain the code at very beginning of the method as of:
> "#ifdef _WIN64 return FALSE;" Why does it return 'FALSE' instead of
> 'TRUE'? I am confused.

If _WIN64 is defined, you are a native 64-bit app, so you are not running
under wow64 (emulator).

--PA