OpenProcess() private method

private OpenProcess ( [ access, [ inheritHandler, uint processId ) : IntPtr
access [
inheritHandler [
processId uint
return System.IntPtr
示例#1
0
        /// <summary>
        ///     Initializes a new instance of the Memory
        /// </summary>
        /// <param name="process">Remote process</param>
        public Memory(System.Diagnostics.Process process)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            Process       = process;
            processHandle = Win32.OpenProcess(
                Win32.ProcessAccessType.PROCESS_VM_READ | Win32.ProcessAccessType.PROCESS_VM_WRITE |
                Win32.ProcessAccessType.PROCESS_VM_OPERATION, true, (uint)process.Id);
            if (processHandle == IntPtr.Zero)
            {
                throw new InvalidOperationException("Could not open the process");
            }
        }