flat assembler
Message board for the users of flat assembler.
Index
> Windows > Why doesn't my jump work? |
Author |
|
arafel 21 Nov 2006, 10:43
Windows API functions don't preserve registers other than ebx, esi, edi, and ebp. Therefore your ecx gets corrupted during the WriteFile call.
push ecx invoke WriteFile, ... pop ecx |
|||
21 Nov 2006, 10:43 |
|
2 21 Nov 2006, 22:44
THANK YOU! I WILL write this down!
That's definitely what must be causing the problem. |
|||
21 Nov 2006, 22:44 |
|
vid 21 Nov 2006, 23:13
it's simpler to remember that winAPI trashes ECX and EDX
|
|||
21 Nov 2006, 23:13 |
|
LocoDelAssembly 21 Nov 2006, 23:32
And EAX even if the function does not return any value. Modifies EFLAGS too (except some bits like DF).
|
|||
21 Nov 2006, 23:32 |
|
2 22 Nov 2006, 02:52
Yeah<i wrote down that eax,ecx,and edx get messed with by Windows.
It's sad. |
|||
22 Nov 2006, 02:52 |
|
RedGhost 22 Nov 2006, 03:42
2 wrote: Yeah<i wrote down that eax,ecx,and edx get messed with by Windows. You can't expect every api to preserve every register. cdecl and other formats aren't even so liberal in saving registers, and fastcall uses registers as arguments. You can do Code:
pushad
;....
popad
If you must save all GPR. _________________ redghost.ca |
|||
22 Nov 2006, 03:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.