public static SafeFileHandle DuplicateHandle(this SafeFileHandle sourceHandle, ProcessHandle sourceAndTargetProcess, FileAccessRights desiredAccess, bool inheritHandle, DuplicateHandleOptions options)
 {
     SafeFileHandle targetHandle;
     if (!NativeMethods.DuplicateHandle(sourceAndTargetProcess, sourceHandle, sourceAndTargetProcess, out targetHandle, desiredAccess, inheritHandle, options))
     {
         ErrorHelper.ThrowCustomWin32Exception();
     }
     return targetHandle;
 }
 public IProcessInformation CreateAsUser(TokenHandle token, string applicationName, string commandLine, bool inheritHandles, ProcessCreationFlags creationFlags, EnvironmentBlockHandle environment, string currentDirectory, ProcessStartInfo startInfo, ProcessSecurity processSecurity = null, ThreadSecurity threadSecurity = null)
 {
     return(ProcessHandle.CreateAsUser(token, applicationName, commandLine, inheritHandles, creationFlags, environment, currentDirectory, startInfo, processSecurity, threadSecurity));
 }
示例#3
0
 public ProcessWaitHandle(ProcessHandle processHandle)
 {
     SafeWaitHandle waitHandle;
     if (!NativeMethods.DuplicateHandle(GetCurrentProcess(), processHandle, GetCurrentProcess(), out waitHandle, 0, false, DuplicateHandleOptions.SameAccess))
     {
         ErrorHelper.ThrowCustomWin32Exception();
     }
     SafeWaitHandle = waitHandle;
 }
示例#4
0
 public static extern bool TerminateProcess(ProcessHandle processHandle, int exitCode);
示例#5
0
 public static extern bool OpenProcessToken(ProcessHandle processHandle, TokenAccessRights desiredAccess, out TokenHandle tokenHandle);
示例#6
0
 public static extern bool IsWow64Process(ProcessHandle processHandle, [Out] [MarshalAs(UnmanagedType.Bool)] out bool isWow64Process);
示例#7
0
 public static extern bool GetProcessTimes(ProcessHandle processHandle, out long creationTime, out long exitTime, out long kernelTime, out long userTime);
示例#8
0
 public static extern bool DuplicateHandle(ProcessHandle sourceProcessHandle, ProcessHandle sourceHandle, ProcessHandle targetProcess, out SafeWaitHandle targetHandle, uint desiredAccess, bool inheritHandle, DuplicateHandleOptions options);
示例#9
0
 public static extern bool GetProcessTimes(ProcessHandle processHandle, out long creationTime, out long exitTime, out long kernelTime, out long userTime);
示例#10
0
 public static extern bool OpenProcessToken(ProcessHandle processHandle, TokenAccessRights desiredAccess, out TokenHandle tokenHandle);
示例#11
0
 public static extern bool IsWow64Process(ProcessHandle processHandle, [Out][MarshalAs(UnmanagedType.Bool)] out bool isWow64Process);
示例#12
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);
示例#13
0
 public static extern int GetProcessId(ProcessHandle processHandle);
示例#14
0
 public static extern bool TerminateProcess(ProcessHandle processHandle, int exitCode);
 public IProcessInformation CreateWithToken(TokenHandle token, ProcessLogonFlags logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, EnvironmentBlockHandle environment, string currentDirectory, ProcessStartInfo startupInfo)
 {
     return(ProcessHandle.CreateWithToken(token, logonFlags, applicationName, commandLine, creationFlags, environment, currentDirectory, startupInfo));
 }
 public ProcessSecurity(ProcessHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
示例#17
0
 public static extern bool K32GetProcessMemoryInfo(ProcessHandle processHandle, out ProcessMemoryCountersEx memoryCounters, int size);
示例#18
0
 public static extern int GetProcessId(ProcessHandle processHandle);
示例#19
0
 public static extern bool QueryFullProcessImageNameW(ProcessHandle processHandle, PathFormat format, [Out] StringBuilder exeName, ref uint size);
示例#20
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);
示例#21
0
 public ProcessExitMonitor(ProcessHandle processHandle)
 {
     _processWaitHandle = new ProcessWaitHandle(processHandle);
     ThreadPool.RegisterWaitForSingleObject(_processWaitHandle, HandleExited, null, -1, true);
 }
示例#22
0
 public static extern bool K32GetProcessMemoryInfo(ProcessHandle processHandle, out ProcessMemoryCountersEx memoryCounters, int size);
示例#23
0
 public Process(ProcessHandle handle)
 {
     _handle = handle;
 }
示例#24
0
 public static extern bool QueryFullProcessImageNameW(ProcessHandle processHandle, PathFormat format, [Out] StringBuilder exeName, ref uint size);
示例#25
0
 public void AssignProcess(ProcessHandle processHandle)
 {
     _handle.AssignProcess(processHandle);
 }
示例#26
0
 public ProcessExitMonitor(ProcessHandle processHandle)
 {
     _processWaitHandle = new ProcessWaitHandle(processHandle);
     ThreadPool.RegisterWaitForSingleObject(_processWaitHandle, HandleExited, null, -1, true);
 }
示例#27
0
 public ProcessSecurity(ProcessHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
示例#28
0
 public Process(ProcessHandle handle)
 {
     _handle = handle;
 }
 public static extern bool DuplicateHandle(ProcessHandle sourceProcessHandle, SafeHandle sourceHandle, ProcessHandle targetProcess, out SafeFileHandle targetHandle, FileAccessRights desiredAccess, bool inheritHandle, DuplicateHandleOptions options);
 public IProcessInformation CreateWithLogin(string username, string domain, string password, ProcessLogonFlags logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, EnvironmentBlockHandle environment, string currentDirectory, ProcessStartInfo startupInfo)
 {
     return(ProcessHandle.CreateWithLogin(username, domain, password, logonFlags, applicationName, commandLine, creationFlags, environment, currentDirectory, startupInfo));
 }
示例#31
0
 public static extern bool DuplicateHandle(ProcessHandle sourceProcessHandle, ProcessHandle sourceHandle, ProcessHandle targetProcess, out SafeWaitHandle targetHandle, uint desiredAccess, bool inheritHandle, DuplicateHandleOptions options);
        public IProcess OpenProcess(int processId, ProcessAccessRights desiredAccess = ProcessAccessRights.AllAccess, bool inheritHandle = false)
        {
            var handle = ProcessHandle.OpenProcess(processId, desiredAccess, inheritHandle);

            return(new Process(handle));
        }
示例#33
0
 public static extern bool GetExitCodeProcess(ProcessHandle processHandle, out int exitCode);
 public static extern bool AssignProcessToJobObject(JobObjectHandle handle, ProcessHandle processHandle);
示例#35
0
 public static extern bool GetExitCodeProcess(ProcessHandle processHandle, out int exitCode);