Good morning all
To determine the address of a Proc I use "offset MyProc", my question is:
Is there any way to know the size of this proc or to know the address of the end proc
Yes, write a procedure AFTER the procedure you want to find the address for and put a label AFTER is but before the next procedure and you get both the start address and by subtracting the start address from the end label address, you get the exact length as well.
Put a label endtestproc: after your proc
testproc proc
xor eax,eax
ret
testproc endp
endtestproc:
mov eax,(endtestproc - offset testproc) ; eax = the code size of your proc
EDIT: Hutch was faster. :biggrin:
:biggrin:
Yeah, you have to watch us old fellas, we are not as slow as we look. ;)
CodeSize (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1221) 8)
hutch,jj2007,Siekmanski, Thanks for the information
Usually The procedure ends with one of two things:
RETN ;(C3) :1 word
or
LEAVE ;(C9) :1 word
RETN x ;(C2 x 00 ):3 word
Can we take advantage of them, Instead of the LABEL hutch :biggrin:
I suspect that it needs an algorithm :redface:
You could try your own prologue/epilogue.
Quote from: mabdelouahab on November 30, 2015, 09:08:48 AM
Can we take advantage of them, Instead of the LABEL hutch :biggrin:
Of course you can, but why should you? Unless you only have the exe and no source, of course :icon_mrgreen: