示例#1
0
 public void EndAccess()
 {
     if (!this.m_Open)
     {
         return;
     }
     ProcessStream.CloseHandle(this.m_Process);
     this.m_Open = false;
 }
示例#2
0
 public bool BeginAccess()
 {
     if (this.m_Open)
     {
         return(false);
     }
     this.m_Process = ProcessStream.OpenProcess(2035711, 0, this.m_ProcessId);
     this.m_Open    = true;
     return(true);
 }
示例#3
0
        public override unsafe void Write(byte[] buffer, int offset, int count)
        {
            bool flag = !this.BeginAccess();

            fixed(byte *numPtr = buffer)
            ProcessStream.WriteProcessMemory(this.m_Process, this.m_Position, (void *)(numPtr + offset), count, 0);

            this.m_Position += count;
            if (!flag)
            {
                return;
            }
            this.EndAccess();
        }
示例#4
0
        public override unsafe int Read(byte[] buffer, int offset, int count)
        {
            bool flag      = !this.BeginAccess();
            int  bytesRead = 0;

            fixed(byte *numPtr = buffer)
            ProcessStream.ReadProcessMemory(this.m_Process, this.m_Position, (void *)(numPtr + offset), count, ref bytesRead);

            this.m_Position += count;
            if (flag)
            {
                this.EndAccess();
            }
            return(bytesRead);
        }