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 


Calling IsBadReadPtr from Lua?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Jul 21, 2016 8:16 am    Post subject: Calling IsBadReadPtr from Lua? Reply with quote

I would like to set up a breakpoint condition with this windows api function.
I figured out how to get the address of the function with getAddress("KERNEL32.IsBadReadPtr") but I have no idea how cast the integer to a function i can use with synchronize()?

so is this the correct way to do it, by using synchronize()?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Thu Jul 21, 2016 10:57 am    Post subject: Reply with quote

You could achieve the same result with this:
Code:
readInteger(address) ~= nil

Regardless, synchronize() is documented in main.lua:
Quote:
Called from inside the thread. This will cause the tread to get the main thread to execute the given function and wait for it to finish.
Usually for GUI access

So it's not what you want. Use the executeCode function for executing assembly code.
Code:
autoAssemble([[globalalloc(checkPtr,128)
checkPtr:
push 4
push [esp+8]
call kernel32.IsBadReadPtr
ret 4]])

executeCode("checkPtr", 0)  -- 0 = false (valid ptr), 1 = true (bad ptr)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Jul 21, 2016 11:45 am    Post subject: Reply with quote

thanks! Very Happy readInteger totally skipped my train of thought lol. fell into the trap of overcomplicating things Laughing
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