Torna al Thread
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process(
[In] IntPtr hProcess,
[Out] out bool wow64Process
);
public static string CurrentVersionSO()
{
//Ottine la versione del sistema operativo (32 o 64 bit)
try
{
Process p = Process.GetCurrentProcess();
IntPtr handle = p.Handle;
bool isWow64;
bool risultato = IsWow64Process(handle, out isWow64);
if (risultato == true)
{
return "64";
}
else
{
return "32";
}
}
catch (Exception)
{
return "32";
}
}