public IEnumerable <IntPtr> ScanRegion(IntPtr baseAddress, ulong regionSize, float value) { var buffer = new float[regionSize / sizeof(float)]; var offsets = new List <IntPtr>(); ProcessQuery.ReadProcessMemory(hProcess, baseAddress, buffer, (IntPtr)regionSize, out IntPtr numBytesRead); for (long offset = 0; offset < (long)numBytesRead / sizeof(float); offset++) { var calculatedOffset = (long)baseAddress + (offset * sizeof(float)); if (value == buffer[offset]) { offsets.Add(new IntPtr(calculatedOffset)); } } return(offsets); }
public void GetMemoryAllocations() { MemoryInformationBlocks = new List <ProcessQuery.MEMORY_BASIC_INFORMATION64>(); IntPtr basePtr = IntPtr.Zero; var mbi = new ProcessQuery.MEMORY_BASIC_INFORMATION64(); while (0 != ProcessQuery.VirtualQueryEx(hProcess, basePtr, out mbi, (uint)Marshal.SizeOf(mbi))) { if (mbi.State == ProcessQuery.MbiStateFlags.Commit) { MemoryInformationBlocks.Add(mbi); } basePtr = new IntPtr(basePtr.ToInt64() + (long)mbi.RegionSize); if (basePtr.Equals(0)) { break; } } }
public Process(ProcessQuery.PROCESSENTRY32 processEntry) { this.processEntry = processEntry; hProcess = ProcessQuery.OpenProcess(ProcessQuery.ProcessAccessFlags.All, false, processEntry.th32ProcessID); }