public byte[] ReadByteArray(IntPtr pOffset, uint pSize) { if (this.processHandle == IntPtr.Zero) { this.CheckProcess(); } byte[] result; try { uint flNewProtect; VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, 4U, out flNewProtect); byte[] array = new byte[pSize]; VAMemory.ReadProcessMemory(this.processHandle, pOffset, array, pSize, 0U); VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, flNewProtect, out flNewProtect); result = array; } catch (Exception ex) { if (VAMemory.debugMode) { Console.WriteLine("Error: ReadByteArray" + ex.ToString()); } result = new byte[1]; } return(result); }
// Token: 0x06000021 RID: 33 RVA: 0x00002A08 File Offset: 0x00000C08 public bool WriteByteArray(IntPtr pOffset, byte[] pBytes) { if (this.processHandle == IntPtr.Zero) { this.CheckProcess(); } bool result; try { uint flNewProtect; VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)((ulong)((long)pBytes.Length)), 4U, out flNewProtect); bool flag = VAMemory.WriteProcessMemory(this.processHandle, pOffset, pBytes, (uint)pBytes.Length, 0U); VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)((ulong)((long)pBytes.Length)), flNewProtect, out flNewProtect); result = flag; } catch (Exception ex) { if (VAMemory.debugMode) { Console.WriteLine("Error: WriteByteArray" + ex.ToString()); } result = false; } return(result); }
public bool CheckProcess() { if (this.process == null) { return(false); } this.processHandle = VAMemory.OpenProcess(2035711U, false, this.process.Id); if (this.processHandle == IntPtr.Zero) { this.ErrorProcessNotFound(this.process.ProcessName); return(false); } return(true); }
public bool CheckProcess() { if (this.process == null) { MessageBox.Show("Programmer, define process name first!"); return(false); } this.processHandle = VAMemory.OpenProcess(2035711U, false, this.process.Id); if (this.processHandle == IntPtr.Zero) { this.ErrorProcessNotFound(this.process.ProcessName); return(false); } return(true); }