Back Again...Everytime I get back to blogging after long hibernation, I promise myself to be regular, only to break the promise soon. Hopefully this time, I would be more consistent. So here it is, my first blog after 1.5 years.
"Windows 32Bit
on Windows 64Bit" , better known as the WoW64 is a subsystem that provides
a lightweight compatibility layer, which aims to create a 32-bit environment
that provides interfaces required to run un-changed 32-bit Windows applications
on a 64-bit machine.
Under a 64 bit
machine, the 32bit applications are installed under "c:\Program Files(x86)" Folder
while the 64 bit applications are installed under "C:\Program Files"
Folder. Many a times, this along with other reasons, makes it necessary for us
to detect if our application is running under WoW64 Feature. Here is how we do
it.
[DllImport("kernel32.dll",
SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return:
MarshalAs(UnmanagedType.Bool)]
private
static extern bool IsWow64Process(
[In]
IntPtr hProcess,
[Out]
out bool wow64Process
);
public
static bool IsApplicationWow64Process()
{
using(Process
currentProcess = Process.GetCurrentProcess())
{
bool
retVal = false;
if(!IsWow64Process(currentProcess.Handle,out
retVal))
{
return
false;
}
return
retVal;
}
}