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 


logging every single ret in "fowata"

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
listito
Cheater
Reputation: 0

Joined: 31 Dec 2010
Posts: 35

PostPosted: Sun May 15, 2011 6:48 am    Post subject: logging every single ret in "fowata" Reply with quote

hey,

i'd like to log every single return address into stack when some calls are shown in "find out what access this address"

for example:
10 cmp dword ptr [ecx],01

"find out what access this address" tell's me it was called 10 times, and i'd like to know those 10 return addresses


is that possible? Shocked
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun May 15, 2011 7:26 am    Post subject: Reply with quote

Not with find out what accesses, but you can do it in the debugger

First define "function debugger_onBreakpoint()" in the lua engine

in there check if ECX==the address you want to inspect

Then when that matches do a returnaddress=readInteger(EBP+4) (if ebp+4 is not valid due to using a different kind of function calling use ESP+xxxx where XXXX is the offset into the stack where the return address is actually stored)

And hold a counter so it disables the breakpoint after 10 times


I'll see if I can make an easy example

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun May 15, 2011 7:43 am    Post subject: Reply with quote

The following script will set a breakpoint at 0x00421138 and when it is triggered and EBX = 0x2D924B8 it will write down the return address

I'm sure you can figure out how to adapt it to your own situation

Code:

count=0
AddressOfCode=0x00421138;

function debugger_onBreakpoint()
  if (EBX==0x2D924B8) then
    local returnAddress=readInteger(EBP+4)
    count=count+1
    print(string.format(" %d: The return address is %x",count, returnAddress ));

    if (count==10) then
      debug_removeBreakpoint(AddressOfCode)
    end
  end

  debug_continueFromBreakpoint(co_run)
  return 1
end

debug_setBreakpoint(AddressOfCode)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
listito
Cheater
Reputation: 0

Joined: 31 Dec 2010
Posts: 35

PostPosted: Sun May 15, 2011 8:53 am    Post subject: Reply with quote

man, thanks, i luv you Twisted Evil

is it a hardware BP? if not, how to set it?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun May 15, 2011 9:25 am    Post subject: Reply with quote

It depends on your settings (it's the same as selecting it and pressing f5)

Default it will be a hardware breakpoint (unless all 4 have been used up, in which case it will be a software bp)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun May 15, 2011 9:28 am    Post subject: Reply with quote

Also, instead of debug_setBreakpoint(AddressOfCode) you could also do:

debug_setBreakpoint(DataAddressToWatch, 4, bptAccess)

that will set a Break on dataaccess on the given address

In the onBreakpoint you could then check for the EIP if there are multiple codes, and it's sure to be a HW breakpoint (Note that on data breakpoint eip is always the eip of the instruction after it)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
listito
Cheater
Reputation: 0

Joined: 31 Dec 2010
Posts: 35

PostPosted: Wed May 18, 2011 4:27 pm    Post subject: Reply with quote

hey DB, can you tell me how to write into code section with lua?

i'm just thinking how can i know more about it's api's? for example, i didn't find any reference to readInteger() in google
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Wed May 18, 2011 6:36 pm    Post subject: Reply with quote

listito wrote:
hey DB, can you tell me how to write into code section with lua?

i'm just thinking how can i know more about it's api's? for example, i didn't find any reference to readInteger() in google

See the "main.lua" file located at Cheat Engine's main directory.
Back to top
View user's profile Send private message
listito
Cheater
Reputation: 0

Joined: 31 Dec 2010
Posts: 35

PostPosted: Sun May 22, 2011 9:36 pm    Post subject: Reply with quote

Code:
count=0
AddressOfCode=0x92a41f;

function debugger_onBreakpoint()

    local returnAddress=readInteger(ESP+8)
    local addr = (returnAddress+0xcd)
    count=count+1
    print(string.format(" %x %x",addr, returnAddress ));

    if (count==10) then
      debug_removeBreakpoint(AddressOfCode)
    end
 

  debug_continueFromBreakpoint(co_run)
  return 1
end

debug_setBreakpoint(AddressOfCode)


I'm just trying now to log every [esp+8]+0xcd when eip = 0x00421138 is that right?

'cause it's not woking


Last edited by listito on Sun May 22, 2011 9:59 pm; edited 3 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun May 22, 2011 9:39 pm    Post subject: Reply with quote

ebx matches the value you are looking for?

If not, then you might want to fix that, or just remove that check completely if you're not looking for that

also, if you really mean esp+4 and it's not a typo then replace EBP+4 with ESP+4

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
listito
Cheater
Reputation: 0

Joined: 31 Dec 2010
Posts: 35

PostPosted: Sun May 22, 2011 9:54 pm    Post subject: Reply with quote

fixed the code, but, there's any way to do it without breakpointing?

because i wanna log the keyboard array which store keyboard state of directinput, if i break i cant change the state of this array
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Mon May 23, 2011 4:58 am    Post subject: Reply with quote

There's nothing stopping you from using writeInteger/ writeFloat to change that array

Anyhow, you can of course use code injection, so instead of a breakpoint just use the auto assembler code injection template and then write the code to do 'stuff' there

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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