jgoemat Master Cheater Reputation: 22
Joined: 25 Sep 2011 Posts: 252
|
Posted: Sat Jul 13, 2013 9:17 pm Post subject: How to access memscan results? (writing AOBSCAN AA template) |
|
|
I'm working on an AA template but I can't figure out how to get the results from my memory scan. If I evaluate the Tmemscan object the private member FOUND is 2 which is correct, but there aren't any addresses. Do I need to use TFoundList somewhere? I tried GetOnlyOneResults which would seem to return an address list, but it only returns if I set onlyOne to true and doesn't seem to work right, although GetOnlyOneResult then does return a single address... Is there somewhere in CE that someone could point me to so I can see how to use it? I've tried looking through the main form code but there is too much there and I can't process it all...
Here's the code I have so far, lots of debugging stuff in there from trying different things...
Code: | //ms.FastScanDigitCount := 1;
ms.OnlyOne := false;
// fl := TFoundlist.create(foundlist: tlistview; memscan: TMemScan; listname: string='')
fl := TFoundlist.create(nil, ms, '');
ms.FirstScan(soExactValue, vtByteArray, rtTruncated, aob, '', minaddress, maxaddress, true, false, false, true, fsmAligned, '1');
ms.WaitTillReallyDone; //wait till it's finished scanning
afl := ms.attachedFoundlist;
assemblescreen.Lines.Add('GetUniqueAOB: Found Count: ' + inttostr(ms.GetFoundCount));
//assemblescreen.Lines.Add('ms.FOUND is: ' + inttostr(ms.FOUND));
if ms.GetOnlyOneResults(addresses) then
begin
assemblescreen.Lines.Add('GetUniqueAOB: Multiple addresses found: ' + IntToStr(Length(addresses)));
exit;
end;
if ms.GetOnlyOneResult(foundAddress) then
begin
assemblescreen.Lines.Add('GetUniqueAOB: GetOnlyOneResult() true, address $' + inttohex(foundAddress, 8));
result := aob; // original AOB is good enough
exit;
end;
|
The fl and afl don't have any addresses and have different scan parameters than I passed to memscan...
Thanks
***** EDIT *****
Nevermind, I found it. I just had to call Initialize() on the FoundList after the memscan and that returned the count, then I could use GetAddress(index):
Code: | fl := TFoundlist.create(nil, ms, '');
ms.FirstScan(soExactValue, vtByteArray, rtTruncated, aob, '', minaddress, maxaddress, true, false, false, true, fsmAligned, '1');
ms.WaitTillReallyDone; //wait till it's finished scanning
count := fl.Initialize(vtByteArray, nil);
assemblescreen.Lines.Add('GetUniqueAOB: Found ' + IntToStr(count) + ' addresses');
for i := 0 to count - 1 do
begin
SetLength(addresses, i + 1);
addresses[i] := fl.GetAddress(i);
assemblescreen.Lines.Add('GetUniqueAOB: addresses[' + IntToStr(i) + ']: $' + IntToHex(addresses[i], 8));
end;
|
|
|