示例#1
0
        /// <summary>
        /// Open process for manipulation
        /// </summary>
        public bool Open(uint processId)
        {
            ProcessHandle = Syscall.OpenProcess(Natives.Enumerations.ProcessAccessFlags.ProcessAllAccess, processId);

            if (ProcessHandle == IntPtr.Zero)
            {
                return(false);
            }

            var processInformation = new Structures.PROCESS_BASIC_INFORMATION();

            if (Syscall.QueryInformationProcess(ProcessHandle, ref processInformation))
            {
                ProcessEnvironmentBlock = new RemoteProcessEnvironmentBlock(this, processInformation.PebBaseAddress);
            }
            else
            {
                return(false);
            }

            ImageBase = ProcessEnvironmentBlock.ImageBase;

            ProcessId = processId;
            return(true);
        }