コード例 #1
0
ファイル: ProcessInjector.cs プロジェクト: fday/NDllInjector
        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;
        }
コード例 #2
0
 public static extern void GetNativeSystemInfo(ref SYSTEM_INFO si);
コード例 #3
0
ファイル: UnsafeFunctions.cs プロジェクト: fday/NDllInjector
 public static extern void GetNativeSystemInfo( ref SYSTEM_INFO si );