Define the following function in a class

 [DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]

[return: MarshalAs(UnmanagedType.Bool)]

private static extern bool IsWow64Process(

[In] IntPtr hProcess,

[Out] out bool lpSystemInfo

);

Process p = Process.GetCurrentProcess();

IntPtr handle = p.Handle;

bool isWow64 = false;

bool success = IsWow64Process(handle, out isWow64);

 

if (success)

{

if (isWow64)

tw.WriteLine("64bit process.");

else

tw.WriteLine("32bit process.");

}