Skip to content

Commit 97ed327

Browse files
committed
Respect address range inside section.
1 parent 98803d6 commit 97ed327

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎ReClass.NET/MemoryScanner/Scanner.cs‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,22 @@ private Task<bool> FirstScan(IScanComparer comparer, CancellationToken ct, IProg
211211
() => new ScannerContext(Settings, comparer, initialBufferSize), // Create a new context for every worker (thread).
212212
(s, state, _, context) =>
213213
{
214+
var start = s.Start;
214215
var size = s.Size.ToInt32();
216+
217+
if (Settings.StartAddress.InRange(s.Start, s.End))
218+
{
219+
start = Settings.StartAddress;
220+
size = size - Settings.StartAddress.Sub(s.Start).ToInt32();
221+
}
222+
if (Settings.StopAddress.InRange(s.Start, s.End))
223+
{
224+
size = size - s.End.Sub(Settings.StopAddress).ToInt32();
225+
}
226+
215227
context.EnsureBufferSize(size);
216228
var buffer = context.Buffer;
217-
if (process.ReadRemoteMemoryIntoBuffer(s.Start, ref buffer, 0, size)) // Fill the buffer.
229+
if (process.ReadRemoteMemoryIntoBuffer(start, ref buffer, 0, size)) // Fill the buffer.
218230
{
219231
var results = context.Worker.Search(buffer, size) // Search for results.
220232
.OrderBy(r => r.Address, IntPtrComparer.Instance)

0 commit comments

Comments
 (0)