public bool Set(MemoryHandler Memory) { this.Memory = Memory; Memory.RefreshMemory(); var process = Memory.Process; Address = Memory.GetAddress(Pointer); if (Address == null) { return(false); } foreach (ProcessThread th in process.Threads) { if (AffectedThreads.ContainsKey(th.Id)) { continue; } var hThread = Kernel32.OpenThread(ThreadAccess.THREAD_ALL_ACCESS, false, th.Id); if (hThread == IntPtr.Zero) { throw new BreakPointException("Can't open thread for access"); } SetToThread(hThread, th.Id); if (!Kernel32.CloseHandle(hThread)) { throw new BreakPointException("Failed to close thread handle"); } } return(true); }
public void UnSet(MemoryHandler Memory) { Memory.RefreshMemory(); var process = Memory.Process; foreach (ProcessThread th in process.Threads) { if (!AffectedThreads.ContainsKey(th.Id)) { continue; } var hThread = Kernel32.OpenThread(ThreadAccess.THREAD_ALL_ACCESS, false, th.Id); if (hThread == IntPtr.Zero) { throw new BreakPointException("Can't open thread for access"); } UnsetFromThread(hThread, th.Id); if (!Kernel32.CloseHandle(hThread)) { throw new BreakPointException("Failed to close thread handle"); } } AffectedThreads.Clear(); }
public void Read(MemoryHandler Memory) { var bytes = new List <byte>(); for (long i = 0; i < Length; i += readCount) { bytes.AddRange(Memory.ReadBytes(IntPtr.Add(StartAddress, (int)i), i + readCount >= Length ? (int)(Length - i) : readCount)); } Data = bytes.ToArray(); }
public ProcessSuspender(MemoryHandler m) { this.m = m; m.SuspendAllThreads(); }
public MemoryDump(MemoryHandler Memory, IntPtr Address, long Length) : this(Address, Length) { Read(Memory); }
public MemoryContainer(MemoryHandler m, IntPtr Address, int Length) : this(Address) { this.Data = m.ReadBytes(Address, Length); }
public ProcessSuspender(MemoryHandler Memory) { this.Memory = Memory; Memory.SuspendAllThreads(); }