public void EndAccess() { if (!this.m_Open) { return; } ProcessStream.CloseHandle(this.m_Process); this.m_Open = false; }
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); }
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(); }
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); }