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;
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
 public ProcessWaitHandle(ProcessHandle processHandle)
 {
     SafeWaitHandle waitHandle;
     if (!NativeMethods.DuplicateHandle(GetCurrentProcess(), processHandle, GetCurrentProcess(), out waitHandle, 0, false, DuplicateHandleOptions.SameAccess))
     {
         ErrorHelper.ThrowCustomWin32Exception();
     }
     SafeWaitHandle = waitHandle;
 }
Ejemplo n.º 4
0
 public static extern bool TerminateProcess(ProcessHandle processHandle, int exitCode);
Ejemplo n.º 5
0
 public static extern bool OpenProcessToken(ProcessHandle processHandle, TokenAccessRights desiredAccess, out TokenHandle tokenHandle);
Ejemplo n.º 6
0
 public static extern bool IsWow64Process(ProcessHandle processHandle, [Out] [MarshalAs(UnmanagedType.Bool)] out bool isWow64Process);
Ejemplo n.º 7
0
 public static extern bool GetProcessTimes(ProcessHandle processHandle, out long creationTime, out long exitTime, out long kernelTime, out long userTime);
Ejemplo n.º 8
0
 public static extern bool DuplicateHandle(ProcessHandle sourceProcessHandle, ProcessHandle sourceHandle, ProcessHandle targetProcess, out SafeWaitHandle targetHandle, uint desiredAccess, bool inheritHandle, DuplicateHandleOptions options);
Ejemplo n.º 9
0
 public static extern bool GetProcessTimes(ProcessHandle processHandle, out long creationTime, out long exitTime, out long kernelTime, out long userTime);
Ejemplo n.º 10
0
 public static extern bool OpenProcessToken(ProcessHandle processHandle, TokenAccessRights desiredAccess, out TokenHandle tokenHandle);
Ejemplo n.º 11
0
 public static extern bool IsWow64Process(ProcessHandle processHandle, [Out][MarshalAs(UnmanagedType.Bool)] out bool isWow64Process);
Ejemplo n.º 12
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);
Ejemplo n.º 13
0
 public static extern int GetProcessId(ProcessHandle processHandle);
Ejemplo n.º 14
0
 public static extern bool TerminateProcess(ProcessHandle processHandle, int exitCode);
Ejemplo n.º 15
0
 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));
 }
Ejemplo n.º 16
0
 public ProcessSecurity(ProcessHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
Ejemplo n.º 17
0
 public static extern bool K32GetProcessMemoryInfo(ProcessHandle processHandle, out ProcessMemoryCountersEx memoryCounters, int size);
Ejemplo n.º 18
0
 public static extern int GetProcessId(ProcessHandle processHandle);
Ejemplo n.º 19
0
 public static extern bool QueryFullProcessImageNameW(ProcessHandle processHandle, PathFormat format, [Out] StringBuilder exeName, ref uint size);
Ejemplo n.º 20
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);
Ejemplo n.º 21
0
 public ProcessExitMonitor(ProcessHandle processHandle)
 {
     _processWaitHandle = new ProcessWaitHandle(processHandle);
     ThreadPool.RegisterWaitForSingleObject(_processWaitHandle, HandleExited, null, -1, true);
 }
Ejemplo n.º 22
0
 public static extern bool K32GetProcessMemoryInfo(ProcessHandle processHandle, out ProcessMemoryCountersEx memoryCounters, int size);
Ejemplo n.º 23
0
 public Process(ProcessHandle handle)
 {
     _handle = handle;
 }
Ejemplo n.º 24
0
 public static extern bool QueryFullProcessImageNameW(ProcessHandle processHandle, PathFormat format, [Out] StringBuilder exeName, ref uint size);
Ejemplo n.º 25
0
 public void AssignProcess(ProcessHandle processHandle)
 {
     _handle.AssignProcess(processHandle);
 }
Ejemplo n.º 26
0
 public ProcessExitMonitor(ProcessHandle processHandle)
 {
     _processWaitHandle = new ProcessWaitHandle(processHandle);
     ThreadPool.RegisterWaitForSingleObject(_processWaitHandle, HandleExited, null, -1, true);
 }
Ejemplo n.º 27
0
 public ProcessSecurity(ProcessHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
Ejemplo n.º 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);
Ejemplo n.º 30
0
 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));
 }
Ejemplo n.º 31
0
 public static extern bool DuplicateHandle(ProcessHandle sourceProcessHandle, ProcessHandle sourceHandle, ProcessHandle targetProcess, out SafeWaitHandle targetHandle, uint desiredAccess, bool inheritHandle, DuplicateHandleOptions options);
Ejemplo n.º 32
0
        public IProcess OpenProcess(int processId, ProcessAccessRights desiredAccess = ProcessAccessRights.AllAccess, bool inheritHandle = false)
        {
            var handle = ProcessHandle.OpenProcess(processId, desiredAccess, inheritHandle);

            return(new Process(handle));
        }
Ejemplo n.º 33
0
 public static extern bool GetExitCodeProcess(ProcessHandle processHandle, out int exitCode);
Ejemplo n.º 34
0
 public static extern bool AssignProcessToJobObject(JobObjectHandle handle, ProcessHandle processHandle);
Ejemplo n.º 35
0
 public static extern bool GetExitCodeProcess(ProcessHandle processHandle, out int exitCode);