forked from ReClassNET/ReClass.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProcessExtension.cs
More file actions
29 lines (25 loc) · 930 Bytes
/
Copy pathProcessExtension.cs
File metadata and controls
29 lines (25 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ReClassNET
{
public static class ProcessExtension
{
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process([In] IntPtr processHandle, [Out, MarshalAs(UnmanagedType.Bool)] out bool wow64Process);
public static bool Is64BitProcess(this Process process)
{
if (!Environment.Is64BitOperatingSystem)
return false;
if (!IsWow64Process(process.Handle, out bool isWow64Process))
throw new Win32Exception(Marshal.GetLastWin32Error());
return !isWow64Process;
}
}
}