12 if (machineName ==
null)
16 if (machineName.Length == 0)
32 using SafeProcessHandle safeProcessHandle = global::Interop.Kernel32.OpenProcess(1024, inherit:
false, processId);
33 if (!safeProcessHandle.IsInvalid)
67 if (processInfos2.Length == 1)
69 return processInfos2[0];
111 if (!global::Interop.Advapi32.LookupPrivilegeValue(
null,
"SeDebugPrivilege", out var lpLuid))
118 if (global::Interop.Advapi32.OpenProcessToken(global::Interop.Kernel32.GetCurrentProcess(), 32, out TokenHandle))
120 Unsafe.SkipInit(out global::Interop.Advapi32.TOKEN_PRIVILEGE tOKEN_PRIVILEGE);
121 tOKEN_PRIVILEGE.PrivilegeCount = 1u;
122 tOKEN_PRIVILEGE.Privileges.Luid = lpLuid;
123 tOKEN_PRIVILEGE.Privileges.Attributes = 2u;
124 global::Interop.Advapi32.AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges:
false, &tOKEN_PRIVILEGE, 0u,
null,
null);
135 SafeProcessHandle safeProcessHandle = global::Interop.Kernel32.OpenProcess(access, inherit:
false, processId);
139 return safeProcessHandle;
158 SafeThreadHandle safeThreadHandle = global::Interop.Kernel32.OpenThread(access, inherit:
false, threadId);
162 if (lastWin32Error == 87)
168 return safeThreadHandle;
static readonly SafeProcessHandle InvalidHandle
int IList. IndexOf(object value)
static unsafe ProcessInfo[] GetProcessInfos(int? processIdFilter=null)
static ProcessInfo[] GetProcessInfos(string machineName, bool isRemoteMachine)
static int[] GetProcessIds(string machineName, bool isRemoteMachine)
static int GetProcessIdFromHandle(SafeProcessHandle processHandle)
static ProcessModuleCollection GetModules(int processId)
static SafeProcessHandle OpenProcess(int processId, int access, bool throwIfExited)
static ProcessInfo[] GetProcessInfos(string machineName)
static int GetProcessIdFromHandle(SafeProcessHandle processHandle)
static bool IsProcessRunning(int processId)
static SafeThreadHandle OpenThread(int threadId, int access)
static IntPtr GetMainWindowHandle(int processId)
static bool IsRemoteMachine(string machineName)
static bool IsProcessRunning(int processId, string machineName)
static ProcessModuleCollection GetModules(int processId)
static int[] GetProcessIds(string machineName)
static int[] GetProcessIds()
static ProcessInfo GetProcessInfo(int processId, string machineName)
static bool IsRemoteMachineCore(string machineName)
static unsafe ProcessManager()
static bool Equals(this ReadOnlySpan< char > span, ReadOnlySpan< char > other, StringComparison comparisonType)
static int GetLastWin32Error()
static string ProcessHasExited
static string Format(string resourceFormat, object p1)
static string ThreadExited
static string InvalidParameter
static unsafe IntPtr FindMainWindow(int processId)