flat assembler
Message board for the users of flat assembler.
Index
> Main > Infinite loop |
Author |
|
kohlrak 28 Jun 2007, 11:36
try pushing and poping ecx before and after the printf accordingly.
|
|||
28 Jun 2007, 11:36 |
|
revolution 28 Jun 2007, 12:22
Try using ebx, esi, ebp or edi instead of ecx. The 4 registers I mentioned there are preserved by the printf function whereas all the other registers (eax, ecx and edx) should be assumed to be clobbered.
|
|||
28 Jun 2007, 12:22 |
|
kohlrak 28 Jun 2007, 12:42
I'd also like to note that your string isn't terminated (you seem to be using 10, but printf uses 0). That means it'll start printing the code of your Exe. Also, since each letter isn't null terminated, if you don't print out your code, the output would look a bit like this...
Quote: HELLOELLOLLOLOO |
|||
28 Jun 2007, 12:42 |
|
Ren 28 Jun 2007, 15:58
Thanks guys,
I did use ebx and that is OK. But does it mean that I need to use ebx or push and pop ecx for all the crtdll functions? Are there other dll's who give problems with ebx or others that You know of? And Yes I got the HELLOHELLO..... but no problem as I posted only because of the endless loop problem. But never the less, Thanks Ren |
|||
28 Jun 2007, 15:58 |
|
LocoDelAssembly 28 Jun 2007, 16:14
Quote:
For every API function you call actually, it is the way stdcall and cdecl calling convention works. Only EBP, EBX, ESI and EDI are preserved. On stdcall ESP returns with the value prior to the first argument push and cdecl returns ESP with the same value it had before executing the CALL instruction. |
|||
28 Jun 2007, 16:14 |
|
Ren 29 Jun 2007, 04:28
Thanks, that's what I needed!
Ran |
|||
29 Jun 2007, 04:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.