flat assembler
Message board for the users of flat assembler.
Index
> Windows > can i assume eax = 0 ? |
Author |
|
asmrox 01 May 2008, 11:02
//by lag
Last edited by asmrox on 01 May 2008, 11:05; edited 1 time in total |
|||
01 May 2008, 11:02 |
|
revolution 01 May 2008, 11:03
I would say that you can't assume anything. Why is one byte so important to you?
|
|||
01 May 2008, 11:03 |
|
revolution 01 May 2008, 11:07
Anything declared void is still subject to the standard rule that eax/ecx/edx are all not preserved, so you can't rely on the return value being anything.
|
|||
01 May 2008, 11:07 |
|
asmrox 01 May 2008, 11:07
why? if thers same implementation on every windows 2k+, its fact (undocumented, but 100% fact).
Quote: Why is one byte so important to you? i want to write smallest possible code and use all i can to do that and... what is mov edi,edi ?! push ebp/mov ebp,esp without substracting esp (stack frame) is also stupid also i dont like destroing ecx,edx why ms cant use pushad/popad, 2 registers are much! Many times i lacked 1 or 2 and had tu use stack to store just 1 address. |
|||
01 May 2008, 11:07 |
|
revolution 01 May 2008, 11:13
Windows is mostly written in HLL so the value of eax for a void function is not guaranteed to be anything, just forget about it. Maybe other versions of Windows have different codes that will modify eax, the thing is you can't guarantee it.
I think that mov edi,edi is to accommodate function hooking for debuggers etc. Just a guess. |
|||
01 May 2008, 11:13 |
|
asmrox 01 May 2008, 11:14
ok thx, so i use that xor ebx,ebx as long as i dont need ebx =(
i hope ur 100% that in other windows (existing in this time, not future) eax can have diffrent values. |
|||
01 May 2008, 11:14 |
|
revolution 01 May 2008, 11:24
asmrox wrote: also i dont like destroing ecx,edx why ms cant use pushad/popad, 2 registers are much! Many times i lacked 1 or 2 and had tu use stack to store just 1 address. And no I am not 100% sure about any return value of eax from a void function in any version of Windows, it is just a speculation which if true then your code will fail. |
|||
01 May 2008, 11:24 |
|
vid 01 May 2008, 12:08
asmrox: actually, you should check returned value, and report error if some occurs
|
|||
01 May 2008, 12:08 |
|
Kevin_Zheng 06 May 2008, 12:24
I agree vid's advise for it; we should check the return status after invoked system API; windows is very complex so that we can't sure everything is always good and perfectly.
_________________ Pure Assembly Language Funs |
|||
06 May 2008, 12:24 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.