Exemplo n.º 1
0
        public static bool Is64BitProcess( int pid )
        {
            SYSTEM_INFO si = new SYSTEM_INFO();
            UnsafeFunctions.GetNativeSystemInfo(ref si);
            if (si.processorArchitecture == 0)
            {
                return false;
            }

            IntPtr hProcess = UnsafeFunctions.OpenProcess(ProcessAccessFlags.QueryInformation, false, pid);
            if (IntPtr.Zero == hProcess)
            {
                throw new Exception("Cann't open process.");
            }

            bool result;
            if (!UnsafeFunctions.IsWow64Process(hProcess, out result))
            {
                UnsafeFunctions.CloseHandle(hProcess);
                throw new InvalidOperationException();
            }

            UnsafeFunctions.CloseHandle(hProcess);

            return !result;
        }
Exemplo n.º 2
0
 public static extern void GetNativeSystemInfo(ref SYSTEM_INFO si);
Exemplo n.º 3
0
 public static extern void GetNativeSystemInfo( ref SYSTEM_INFO si );