I have a .NET application that was supposed to be compiled as a 32-bit only application. I suspect my build server isn\'t actually doing it.
How do I determine if a .NE
I use the following code:
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process(
[In] IntPtr hProcess,
[Out] out bool wow64Process
);
With:
public static bool IsProcess64(Process process)
{
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) || Environment.OSVersion.Version.Major >= 6) {
bool ret_val;
try {
if (!WindowsAPI.IsWow64Process(process.Handle,out ret_val)) ret_val = false;
} catch {
ret_val = false;
}
if (!ret_val && IntPtr.Size == 8) {
return true;
} else {
return false;
}
} else {
return false;
}
}
You can pass Process.CurrentProcess or similar to this.