Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


In CE Lua, how to do an aobscan within a memory range?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Master Cheater
Reputation: 1

Joined: 17 Feb 2016
Posts: 490

PostPosted: Wed Jul 19, 2017 8:46 am    Post subject: In CE Lua, how to do an aobscan within a memory range? Reply with quote

In CE Lua, how to do an aobscan within a memory range? Say, I want to search after 0x10000000.
_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
FreeER
Master Cheater
Reputation: 10

Joined: 09 Aug 2013
Posts: 327

PostPosted: Wed Jul 19, 2017 11:01 am    Post subject: Reply with quote

To use a memory range in lua I think you'd need to use a memscan object and the firstScan function, here's an example using the tutorial (nops step 2 code): https://www.dropbox.com/s/6a5m3ir24ic67c7/aob%20memscan%20in%20range%20with%20disableInfo.CT?dl=0
Back to top
View user's profile Send private message
Dr.Disrespect
Master Cheater
Reputation: 1

Joined: 17 Feb 2016
Posts: 490

PostPosted: Wed Jul 19, 2017 1:26 pm    Post subject: Reply with quote

FreeER wrote:
To use a memory range in lua I think you'd need to use a memscan object and the firstScan function, here's an example using the tutorial (nops step 2 code): https://www.dropbox.com/s/6a5m3ir24ic67c7/aob%20memscan%20in%20range%20with%20disableInfo.CT?dl=0


Thanks for the example.

I use the following code to perform an AOBScan, but it always returns 0:
Code:

local ms = createMemScan()
   local AOB = "EB 81 C4 B5 C4 D1 A4 55 00"
   local startAddress = getAddress(process)
   local stopAddress = startAddress + getModuleSize(process)
   ms.firstScan(soExactValue, vtByteArray, nil, AOB, nil, startAddress, stopAddress,
                             "", nil, nil , true, nil, nil, nil)
   ms.waitTillDone()
   local fl = createFoundList(ms)
   fl.initialize()
   print(fl.Count) <---------fl.Count is always 0
   fl.destroy()
   ms.destroy()


This code always print out "0". I am sure the AOB string is correct, because I can use it to find the result I want by using the built-in AOB scan of CE.
So what is the problem? Sad

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
FreeER
Master Cheater
Reputation: 10

Joined: 09 Aug 2013
Posts: 327

PostPosted: Wed Jul 19, 2017 1:59 pm    Post subject: Reply with quote

Hm, that seems correct so the best I can suggest is double checking the start and stop addresses and making sure that the address you get from the built-in AOB is actually in that range...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 341

Joined: 09 May 2003
Posts: 20022
Location: The netherlands

PostPosted: Wed Jul 19, 2017 2:32 pm    Post subject: Reply with quote

are you sure that the AOB is inside the executable?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Dr.Disrespect
Master Cheater
Reputation: 1

Joined: 17 Feb 2016
Posts: 490

PostPosted: Wed Jul 19, 2017 7:20 pm    Post subject: Reply with quote

Dark Byte wrote:
are you sure that the AOB is inside the executable?


@FreeER @Dark Byte

Actually I am not sure if the AOB is inside the executable, it's not a static address. So how do I search that address range? Say, if the address is 0x10000000, how do I assign this address to firstscan function as a parameter?

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
FreeER
Master Cheater
Reputation: 10

Joined: 09 Aug 2013
Posts: 327

PostPosted: Wed Jul 19, 2017 7:38 pm    Post subject: This post has 1 review(s) Reply with quote

Dr.Disrespect wrote:
Say, if the address is 0x10000000, how do I assign this address to firstscan function as a parameter?


Just set the start address to that value and stopAddress to whatever you want.

Code:
local startAddress = 0x10000000
local stopAddress = startAddress + 0x2000
-- scans 0x2000 bytes starting from 0x1000000
-- you could also set the stopAddress to the default the CE builtin uses
-- 0x7FFFFFFFFFFFFFFF I think, though it might be all Fs


You don't need them to be variables by the way, you could just as easily use

Code:

   ms.firstScan(soExactValue, vtByteArray, nil, "EB 81 C4 B5 C4 D1 A4 55 00", nil, 0x10000000, 0x30000000,
                             "", nil, nil , true, nil, nil, nil)
Back to top
View user's profile Send private message
Dr.Disrespect
Master Cheater
Reputation: 1

Joined: 17 Feb 2016
Posts: 490

PostPosted: Wed Jul 19, 2017 7:48 pm    Post subject: Reply with quote

FreeER wrote:
Dr.Disrespect wrote:
Say, if the address is 0x10000000, how do I assign this address to firstscan function as a parameter?


Just set the start address to that value and stopAddress to whatever you want.

Code:
local startAddress = 0x10000000
local stopAddress = startAddress + 0x2000
-- scans 0x2000 bytes starting from 0x1000000
-- you could also set the stopAddress to the default the CE builtin uses
-- 0x7FFFFFFFFFFFFFFF I think, though it might be all Fs


You don't need them to be variables by the way, you could just as easily use

Code:

   ms.firstScan(soExactValue, vtByteArray, nil, "EB 81 C4 B5 C4 D1 A4 55 00", nil, 0x10000000, 0x30000000,
                             "", nil, nil , true, nil, nil, nil)


Thanks a lot, it worked. Smile +Rep

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites