-
__local_size [msvc 7.1]
I need someone to explain this to me. As I understand it, __LOCAL_SIZE is the total size of all local variables in a naked function, like the one I've got here:
Code:
_declspec(naked) int StringLen(char* stri)
{
int l;
_asm
{
push ebp
mov ebp, esp
sub esp, __LOCAL_SIZE
mov esp, ebp
pop ebp
xor eax, eax
ret
}
}
I'm not sure how many bytes in size an int is on my machine, but I'm certain it's not 204 - my disassembler says otherwise. Is it taking into account stri as well? Or am I misunderstanding it.
:(
(Yes, I know the function hasn't been written yet.)
-
I don't actually know, but reading about it you are correct, it's just the size of all local crap.
I think it should be only the local int.
Assuming your on x86 an int is a double word, which is 32 bits, 32 < 204. Next time I boot into windows if you still haven't figured it out I'll take a look with a debugger, since this post is only speculation. I hope it's of at least a bit of help.
A call goes like this:
Each argument is pushed onto the stack from right to left then call pushes the current ip on the stack and jumps to the location specified. So esp = return address, esp+4 = last arg, so all you should need to subtract from the stack should be your local vars.