public bool VirtualQuery(ulong addr, out VirtualQueryData data) { uint min = 0, max = (uint)_memoryChunks.Count - 1; while (min <= max) { uint mid = (max + min) / 2; ulong targetStartAddress = _memoryChunks.StartAddress(mid); if (addr < targetStartAddress) { max = mid - 1; } else { ulong targetEndAddress = _memoryChunks.EndAddress(mid); if (targetEndAddress < addr) { min = mid + 1; } else { data = new VirtualQueryData(targetStartAddress, _memoryChunks.Size(mid)); return(true); } } } data = new VirtualQueryData(); return(false); }
/// <summary> /// Gets information about the given memory range. /// </summary> /// <param name="addr">An arbitrary address in the target process.</param> /// <param name="virtualQuery">The base address and size of the allocation.</param> /// <returns>True if the address was found and vq was filled, false if the address is not valid memory.</returns> /// <inheritdoc /> public bool VirtualQuery(ulong addr, out VirtualQueryData virtualQuery) { var res = DataReader.VirtualQuery(addr, out var outVar); virtualQuery = Converter.Convert(outVar); return(res); }
public void Require_Create_An_Instance_With_Required_Parameters() { // arrange var sut = new VirtualQueryData(0x1337, 0x42); // act // assert sut.BaseAddress.Should().Be(0x1337); sut.Size.Should().Be(0x42); }
public bool VirtualQuery(ulong addr, out VirtualQueryData vq) { foreach (var entry in _memoryMapEntries) { if (entry.BeginAddr <= addr && entry.EndAddr >= addr) { vq = new VirtualQueryData(entry.BeginAddr, entry.EndAddr - entry.BeginAddr + 1); return(true); } } vq = new VirtualQueryData(); return(false); }
public bool VirtualQuery(ulong addr, out VirtualQueryData vq) { _CheckClosed(); using (new DbgEngContextSaver(m_umd, m_target.Context)) { vq = new VirtualQueryData(); try { MEMORY_BASIC_INFORMATION64 mem = m_umd.QueryVirtual(addr); vq.BaseAddress = mem.BaseAddress; vq.Size = mem.RegionSize; return(true); } catch (DbgProviderException dpe) { LogManager.Trace("DbgShellDebugClientDataReader.VirtualQuery: ignoring \"{0}\".", Util.GetExceptionMessages(dpe)); return(false); } } } // end VirtualQuery()
/// <summary> /// Gets information about the given memory range. /// </summary> /// <param name="addr">An arbitrary address in the target process.</param> /// <param name="vq">The base address and size of the allocation.</param> /// <returns> /// True if the address was found and vq was filled, false if the address is not valid memory. /// </returns> public bool VirtualQuery(ulong addr, out VirtualQueryData vq) { try { var dumpReader = Process.DumpFileMemoryReader; ulong baseAddress, regionSize; if (dumpReader != null) { dumpReader.GetMemoryRange(addr, out baseAddress, out regionSize); } else { Context.Debugger.QueryVirtual(addr, out baseAddress, out regionSize); } vq = new VirtualQueryData(baseAddress, regionSize); return(true); } catch (Exception) { vq = new VirtualQueryData(); return(false); } }
public bool VirtualQuery(ulong addr, out VirtualQueryData vq) { return(_impl.VirtualQuery(addr, out vq)); }
/// <summary> /// Gets information about the given memory range. /// </summary> /// <param name="addr">An arbitrary address in the target process.</param> /// <param name="vq">The base address and size of the allocation.</param> /// <returns> /// True if the address was found and vq was filled, false if the address is not valid memory. /// </returns> public bool VirtualQuery(ulong addr, out VirtualQueryData vq) { vq = new VirtualQueryData(); return(false); }