Artemis.Utilities.Memory.Win32.OpenProcess C# (CSharp) Метод

OpenProcess() приватный Метод

private OpenProcess ( [ access, [ inheritHandler, uint processId ) : IntPtr
access [
inheritHandler [
processId uint
Результат System.IntPtr
        public static extern IntPtr OpenProcess(
            [MarshalAs(UnmanagedType.U4)] ProcessAccessType access,
            [MarshalAs(UnmanagedType.Bool)] bool inheritHandler, uint processId);

Usage Example

Пример #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");
            }
        }