Click to See Complete Forum and Search --> : ret


aznium
April 18th, 2005, 11:31 PM
sorry im a nub

ret returns from the method rite? or does it exit?

lets say i think somethign like this


__asm

{
main:
jmp addsomething
jmp subtractsomething
ret

addsomething:
add eax, 12345
ret

subtractsomething:
sub eax. 54321
ret
}


my question is.,...would subtract something be called? thx :D

NoHero
April 19th, 2005, 12:54 AM
No. It only returns to the call it correspondense. It jumps back to address that is on the stack. If your code should work properly it must be:


__asm

{
main:
call addsomething
call subtractsomething
ret

addsomething:
add eax, 12345
ret

subtractsomething:
sub eax, 54321
ret
}

aznium
April 19th, 2005, 05:19 PM
thx :D