flat assembler
Message board for the users of flat assembler.
Index
> Main > Problem with function |
Author |
|
shoorick 26 Feb 2008, 11:35
try "ret" instead "RET"
|
|||
26 Feb 2008, 11:35 |
|
Cthulhu 26 Feb 2008, 11:38
shoorick wrote: try "ret" instead "RET" I could never imagine it was the case of the ret instruction Thanks a lot shoorick! |
|||
26 Feb 2008, 11:38 |
|
dap 26 Feb 2008, 12:23
You should pop the arguments from the stack when the function returns. You can simply write "ret 12" instead of ret (because there are 12 bytes of arguments left on the stack). That's how the stdcall convention handles it. Or you can use C convention where you add manually the number of bytes to ESP after the function returns (add esp, 12). If you have only one argument you can also simply pop it from the stack (in ECX for example which is a register you can freely use), it will be shorter than adding 4 to ESP.
|
|||
26 Feb 2008, 12:23 |
|
bitRAKE 26 Feb 2008, 15:09
"ret" has been redefined by win32a.inc (actually proc32.inc) to work with "proc" macro. When you use "RET" the macro for ret isn't executed. This macro changes the ret into "ret 12" - based on proc arguments.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
26 Feb 2008, 15:09 |
|
Cthulhu 26 Feb 2008, 15:45
Thanks a lot guys!
|
|||
26 Feb 2008, 15:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.