![]() |
|
|
|
#1
|
|||
|
|||
|
GetModuleHandleA i think will be useful, look when is called and see in EAX the value when return from api.
ricnar |
|
#2
|
|||
|
|||
|
ricnar456, your post made me wonder, how can you discover if a routine is a function (thus returns a value) or is a procedure (returns nothing)? Is there any to understand it?
yaa |
|
#3
|
||||
|
||||
|
Simple, look at API prototypes. GetmodulehandleA is an API function.
__________________
omnino lo qui quae que quod somos es pulvis en el ventus. TAOS -The opposite of courage in our society is not cowardice, but conformity- |
|
#4
|
|||
|
|||
|
taos
the meaning of my question was, if there is a way, at runtime, to discover if a routine is a function or a procedure. My knowledge of assembly is really lousy but I can't find any clue to answer my question based on registers or flags. I mean, EAX could have changed value during a routine's execution without it meaning that it is a return value. Am I right or am I missing something? yaa Last edited by yaa; 11-05-2007 at 02:12. |
|
#5
|
||||
|
||||
|
Quote:
It's more easy to test it, use sleep procedure api (Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long) ) and messagebeep api function (Declare Function MessageBeep Lib "user32.dll" (ByVal wType As Long) As Long), in a simple asm program.Debug with olly and follow generic registers before and after sleep and messagebeep APIs.
__________________
omnino lo qui quae que quod somos es pulvis en el ventus. TAOS -The opposite of courage in our society is not cowardice, but conformity- |
|
#6
|
|||
|
|||
|
I tested this in a small C app, with a function that returns a value and one that returns void. I can't in any way distinguish the two cases. btw, EAX is not among the registers whose values a C programs expects each routine will maintain so ...
yaa |
|
#7
|
||||
|
||||
|
In fact, in assembler instructions it is quite difficult to decide if you are facing a procedure or a function.
But you could follow this approach: if the EAX value after the return of the CALL is used immediately in the code, it should be a function, and if the EAX value is ignored after that return, you could think of it as a procedure... Normally, this should work if you are reversing code to a higher level of programming. Cheers Nacho_dj
__________________
http://arteam.accessroot.com |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding API Address | britedream | General Discussion | 5 | 10-05-2006 21:28 |
| Can we hook some func in another process then change return address? | Teerayoot | General Discussion | 5 | 09-21-2004 11:12 |