16[Designer(
"System.Diagnostics.Design.ProcessDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
38 private unsafe readonly global::Interop.Shell32.SHELLEXECUTEINFO*
_executeInfo;
74 Name =
".NET Process STA"
350 [
Obsolete(
"Process.NonpagedSystemMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.NonpagedSystemMemorySize64 instead.")]
369 [
Obsolete(
"Process.PagedMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PagedMemorySize64 instead.")]
388 [
Obsolete(
"Process.PagedSystemMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PagedSystemMemorySize64 instead.")]
407 [
Obsolete(
"Process.PeakPagedMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PeakPagedMemorySize64 instead.")]
426 [
Obsolete(
"Process.PeakWorkingSet has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PeakWorkingSet64 instead.")]
445 [
Obsolete(
"Process.PeakVirtualMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PeakVirtualMemorySize64 instead.")]
506 [
Obsolete(
"Process.PrivateMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.PrivateMemorySize64 instead.")]
592 for (
int i = 0; i <
count; i++)
621 [
Obsolete(
"Process.VirtualMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.VirtualMemorySize64 instead.")]
723 [
Obsolete(
"Process.WorkingSet has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.WorkingSet64 instead.")]
768 if (!global::Interop.Kernel32.SetProcessPriorityBoost(
handle, !
value))
790 if (!global::Interop.Kernel32.SetPriorityClass(
handle, (
int)
value))
811 if (!global::Interop.Kernel32.SetProcessAffinityMask(
handle,
value))
863 if (global::Interop.NtDll.NtQueryInformationProcess(processHandle, 0, &
pROCESS_BASIC_INFORMATION, (uint)
sizeof(global::Interop.NtDll.PROCESS_BASIC_INFORMATION),
out var _) != 0)
1479 if (outputDataReceived !=
null)
1497 if (errorDataReceived !=
null)
1535 for (
int i = 0; i <
processes.Length; i++)
1546 return list.ToArray();
1719 if ((
long)
min > (
long)
max)
1727 if (!global::Interop.Kernel32.SetProcessWorkingSetSizeEx(
handle,
min,
max, 0))
1744 global::Interop.Kernel32.STARTUPINFO
lpStartupInfo =
default(global::Interop.Kernel32.STARTUPINFO);
1745 global::Interop.Kernel32.PROCESS_INFORMATION
lpProcessInformation =
default(global::Interop.Kernel32.PROCESS_INFORMATION);
1746 global::Interop.Kernel32.SECURITY_ATTRIBUTES
procSecAttrs =
default(global::Interop.Kernel32.SECURITY_ATTRIBUTES);
1796 if (
startInfo._environmentVariables !=
null)
1802 if (
text2.Length == 0)
1814 global::Interop.Advapi32.LogonFlags
logonFlags = (global::Interop.Advapi32.LogonFlags)0;
1817 logonFlags = global::Interop.Advapi32.LogonFlags.LOGON_WITH_PROFILE;
1828 flag = global::Interop.Advapi32.CreateProcessWithLogonW(
startInfo.UserName,
startInfo.Domain, (
intPtr !=
IntPtr.
Zero) ?
intPtr : ((
IntPtr)
ptr),
logonFlags,
null,
cmdLine, num, (
IntPtr)
ptr2,
text2,
ref lpStartupInfo,
ref lpProcessInformation);
1948 if (!global::Interop.Advapi32.OpenProcessToken(global::Interop.Kernel32.GetCurrentProcess(), 32,
out TokenHandle))
2005 global::Interop.Kernel32.SECURITY_ATTRIBUTES
lpPipeAttributes =
default(global::Interop.Kernel32.SECURITY_ATTRIBUTES);
2050 return global::Interop.Kernel32.GetMessage(
error);
2072 if (
startInfo.StandardInputEncoding !=
null)
2076 if (
startInfo.StandardErrorEncoding !=
null)
2080 if (
startInfo.StandardOutputEncoding !=
null)
2084 if (
startInfo._environmentVariables !=
null)
2093 fixed (
char* lpParameters = ((
text.Length > 0) ?
text :
null))
2097 global::Interop.Shell32.SHELLEXECUTEINFO
sHELLEXECUTEINFO =
default(global::Interop.Shell32.SHELLEXECUTEINFO);
2158 long num = (long)
error;
2159 long num2 = num - 2;
2178 long num3 = num - 26;
2197 return (
int)(long)
error;
2205 return string.Empty;
2210 return string.Empty;
2322 item3.Item1.Dispose();
2323 item3.Item2.Dispose();
2375 if (
list ==
null ||
list.Count == 0)
2404 while (
queue.TryDequeue(
out result));
static readonly SafeProcessHandle InvalidHandle
static void Sort(Array array)
void CopyTo(TKey[] array, int index)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
static ? Delegate Remove(Delegate? source, Delegate? value)
static ? Delegate Combine(Delegate? a, Delegate? b)
static ProcessModule GetFirstModule(int processId)
readonly List< ThreadInfo > _threadInfoList
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 IntPtr GetMainWindowHandle(int processId)
static bool IsRemoteMachine(string machineName)
static ProcessModuleCollection GetModules(int processId)
static ProcessInfo GetProcessInfo(int processId, string machineName)
TimeSpan UserProcessorTime
TimeSpan TotalProcessorTime
TimeSpan PrivilegedProcessorTime
unsafe void ShellExecuteFunction()
unsafe readonly global::Interop.Shell32.SHELLEXECUTEINFO * _executeInfo
unsafe ShellExecuteHelper(global::Interop.Shell32.SHELLEXECUTEINFO *executeInfo)
bool ShellExecuteOnSTAThread()
void ErrorReadNotifyUser(string data)
bool Equals(Process process)
static string GetEnvironmentVariablesBlock(IDictionary< string, string > sd)
void SetProcessHandle(SafeProcessHandle processHandle)
TimeSpan TotalProcessorTime
TimeSpan PrivilegedProcessorTime
static void CreatePipeWithSecurityAttributes(out SafeFileHandle hReadPipe, out SafeFileHandle hWritePipe, ref global::Interop.Kernel32.SECURITY_ATTRIBUTES lpPipeAttributes, int nSize)
static Process Start(string fileName, string arguments)
static unsafe void SetPrivilege(string privilegeName, int attrib)
long NonpagedSystemMemorySize64
static Process[] GetProcessesByName(string? processName, string machineName)
static readonly object s_createProcessLock
void EnsureWatchingForExit()
void OutputReadNotifyUser(string data)
bool StartCore(ProcessStartInfo startInfo)
ProcessStartInfo StartInfo
bool IsParentOf(Process possibleChild)
void BeginOutputReadLine()
void Kill(bool entireProcessTree)
static void BuildCommandLine(ProcessStartInfo startInfo, ref System.Text.ValueStringBuilder commandLine)
bool PriorityBoostEnabled
unsafe string GetMainWindowTitle()
void BeginErrorReadLine()
void SetWorkingSetLimitsCore(IntPtr? newMin, IntPtr? newMax, out IntPtr resultingMin, out IntPtr resultingMax)
async Task WaitForExitAsync(CancellationToken cancellationToken=default(CancellationToken))
SafeProcessHandle _processHandle
static Process[] GetProcessesByName(string? processName)
StreamReader _standardError
void CreatePipe(out SafeFileHandle parentHandle, out SafeFileHandle childHandle, bool parentInputs)
StreamWriter _standardInput
int GetShellError(IntPtr error)
static Process Start(string fileName, IEnumerable< string > arguments)
bool WaitForInputIdle(int milliseconds)
List<(Process Process, SafeProcessHandle Handle)> GetProcessHandlePairs(Func< Process, Process, bool > predicate)
ProcessThreadTimes GetProcessTimes()
void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet)
SafeProcessHandle GetProcessHandle()
bool CloseMainWindowCore()
StreamReadMode _outputStreamReadMode
ProcessPriorityClass PriorityClassCore
int NonpagedSystemMemorySize
void EnsureWorkingSetLimits()
bool PriorityBoostEnabledCore
static ? Process Start(string fileName, string userName, SecureString password, string domain)
Process(string machineName, bool isRemoteMachine, int processId, ProcessInfo processInfo)
StreamReader StandardError
IntPtr ProcessorAffinityCore
IntPtr _processorAffinity
void EnsureState(State state)
DataReceivedEventHandler? ErrorDataReceived
ProcessPriorityClass _priorityClass
StreamReadMode _errorStreamReadMode
SafeProcessHandle GetOrOpenProcessHandle()
void SetWorkingSetLimits(IntPtr? min, IntPtr? max)
int PeakVirtualMemorySize
IReadOnlyList< Process > GetChildProcesses(Process[] processes=null)
static void EnterDebugMode()
SafeProcessHandle GetProcessHandle(int access, bool throwIfExited=true)
bool WaitForExit(int milliseconds)
long PeakVirtualMemorySize64
static Process GetProcessById(int processId)
ProcessThreadCollection Threads
StreamWriter StandardInput
StreamReader StandardOutput
void StopWatchingForExit()
AsyncStreamReader _output
static Process GetProcessById(int processId, string machineName)
static Process[] GetProcesses(string machineName)
unsafe bool StartWithCreateProcess(ProcessStartInfo startInfo)
List< Exception > KillTree()
bool _standardInputAccessed
ProcessModule? MainModule
bool IsSelfOrDescendantOf(Process processOfInterest)
ISynchronizeInvoke? SynchronizingObject
static Process[] GetProcesses()
static Win32Exception CreateExceptionForErrorStartingProcess(string errorMessage, int errorCode, string fileName, string workingDirectory)
bool _haveProcessorAffinity
bool _priorityBoostEnabled
int PagedSystemMemorySize
static ? Process Start(ProcessStartInfo startInfo)
override void Dispose(bool disposing)
unsafe bool StartWithShellExecuteEx(ProcessStartInfo startInfo)
ProcessThreadCollection _threads
RegisteredWaitHandle _registeredWaitHandle
static Process Start(string fileName)
long PeakPagedMemorySize64
long PagedSystemMemorySize64
unsafe int ParentProcessId
List< Exception > KillTree(SafeProcessHandle handle)
bool WaitForExitCore(int milliseconds)
bool WaitForInputIdleCore(int milliseconds)
static bool IsProcessInvalidException(Exception e)
static void LeaveDebugMode()
TimeSpan UserProcessorTime
ProcessModuleCollection _modules
void SetProcessId(int processId)
ProcessPriorityClass PriorityClass
DataReceivedEventHandler? OutputDataReceived
StreamReader _standardOutput
static string GetErrorMessage(int error)
ProcessStartInfo _startInfo
static Encoding GetEncoding(int codePage)
static Process GetCurrentProcess()
static ? Process Start(string fileName, string arguments, string userName, SecureString password, string domain)
void CompletionCallback(object waitHandleContext, bool wasSignaled)
static int s_cachedSerializationSwitch
bool _havePriorityBoostEnabled
bool _haveWorkingSetLimits
override string ToString()
static bool IsDefined(Type enumType, object value)
static readonly EventArgs Empty
static void SuppressFinalize(object obj)
static string GetCurrentDirectory()
virtual Encoding CurrentEncoding
virtual Stream BaseStream
static unsafe void ZeroFreeGlobalAllocUnicode(IntPtr s)
static IntPtr SecureStringToGlobalAllocUnicode(SecureString s)
static int GetLastWin32Error()
static void InitHandle(SafeHandle safeHandle, IntPtr handle)
IntPtr DangerousGetHandle()
static void ThrowIfDeserializationInProgress(string switchSuffix, ref int cachedValue)
static string KillEntireProcessTree_DisallowedBecauseTreeContainsCallingProcess
static string NoProcessInfo
static string CantSetDuplicatePassword
static string StandardOutputEncodingNotAllowed
static string ProcessHasExited
static string InvalidApplication
static string MissingProccess
static string WaitTillExit
static string InputIdleUnkownError
static string NoAssociatedProcess
static string CantRedirectStreams
static string PendingAsyncOperation
static string StandardErrorEncodingNotAllowed
static string CantGetStandardIn
static string ProcessInformationUnavailable
static string Format(string resourceFormat, object p1)
static string CantUseEnvVars
static string StandardInputEncodingNotAllowed
static string CantStartAsUser
static string BadMinWorkset
static string UseShellExecuteNotSupported
static string ProcessHasExitedNoId
static string CantGetProcessStartInfo
static string CantSetProcessStartInfo
static string ArgumentAndArgumentListInitialized
static string FileNameMissing
static string KillEntireProcessTree_TerminationIncomplete
static string CantMixSyncAsyncOperation
static string BadMaxWorkset
static string CantGetStandardOut
static string CantGetStandardError
static string NoProcessHandle
static string NotSupportedRemote
static string ErrorStartingProcess
static string NoAsyncOperation
static string ProcessIdRequired
static StringComparer OrdinalIgnoreCase
static Encoding GetSupportedConsoleEncoding(int codepage)
new Task< TResult > WaitAsync(CancellationToken cancellationToken)
new TaskAwaiter< TResult > GetAwaiter()
static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce, bool flowExecutionContext)
static Thread CurrentThread
delegate void DataReceivedEventHandler(object sender, DataReceivedEventArgs e)
delegate void ThreadStart()
delegate void EventHandler(object? sender, EventArgs e)
static readonly IntPtr Zero