private async Task <List <uint> > FindValue(CommittedMemoryBlock memBlock, ulong value, BitWidth bitWidth) { List <uint> toReturn = new List <uint>(); byte[] buffer = new byte[0x10000]; uint bytesLeft = memBlock.Size; uint pos = memBlock.Base; while (bytesLeft != 0) { uint bytesToRead = (bytesLeft > 0x10000) ? 0x10000 : bytesLeft; console.GetMemory(pos, bytesToRead, buffer); // search for the value inside the buffer recieved from the console for (int i = 0; i < bytesToRead / (int)bitWidth; i++) { // deterimine the offset into the buffer for the next value int offset = i * (int)bitWidth; // get the correct value at the current position ulong curValue = GetValue(buffer, offset, bitWidth); // if it matches, then return address it was found at if (curValue == value) { toReturn.Add(pos + (uint)offset); } if (i % 250 == 0) { await Task.Delay(10); } } await Task.Delay(20); // advance to the next value in the buffer pos += bytesToRead; bytesLeft -= bytesToRead; } return(toReturn); }
private async Task<List<uint>> FindValue(CommittedMemoryBlock memBlock, ulong value, BitWidth bitWidth) { List<uint> toReturn = new List<uint>(); byte[] buffer = new byte[0x10000]; uint bytesLeft = memBlock.Size; uint pos = memBlock.Base; while (bytesLeft != 0) { uint bytesToRead = (bytesLeft > 0x10000) ? 0x10000 : bytesLeft; console.GetMemory(pos, bytesToRead, buffer); // search for the value inside the buffer recieved from the console for (int i = 0; i < bytesToRead / (int)bitWidth; i++) { // deterimine the offset into the buffer for the next value int offset = i * (int)bitWidth; // get the correct value at the current position ulong curValue = GetValue(buffer, offset, bitWidth); // if it matches, then return address it was found at if (curValue == value) toReturn.Add(pos + (uint)offset); if (i % 250 == 0) await Task.Delay(10); } await Task.Delay(20); // advance to the next value in the buffer pos += bytesToRead; bytesLeft -= bytesToRead; } return toReturn; }