using System.Runtime.InteropServices; namespace Xorog.UniversalExtensions.WindowsAPI; public class kernel32 { /// /// Opens an existing local process object. /// /// The access to the process object. This access right is checked against the security descriptor for the process. This parameter can be one or more of the process access rights. /// If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle. /// The identifier of the local process to be opened. /// If the function succeeds, the return value is an open handle to the specified process. If the function fails, the return value is NULL. [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processId); /// /// Closes an open object handle. /// /// A valid handle to an open object. /// If the function succeeds, the return value is true. [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CloseHandle(IntPtr hObject); }