flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE
Just traced down one of those stupid typo errors to find that RegisterClassEx errors when AX is zero - I have assumed MSDN means EAX equal zero is an error:
Quote: If the function fails, the return value is zero. ![]() (Maybe someone else has other pitfalls to note?) |
|||
![]() |
|
LocoDelAssembly
WinDef.h:
Code: typedef unsigned short WORD; . . . typedef WORD ATOM; Considering that, why do you think it is a typo error from MSDN? |
|||
![]() |
|
vid
Quote: Guess it's slightly better than just assuming success on all API functions, lol. Congratulations ![]() Yeah, using C docs for Asm can sometimes cause problems like this. I probably wouldn't notice this one too :/ |
|||
![]() |
|
asmcoder
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:57; edited 1 time in total |
|||
![]() |
|
bitRAKE
The upper word of EAX is not zero on my Windows when this API fails. Yet, the lower word is zero. YWMV (your windows may vary).
|
|||
![]() |
|
asmcoder
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:57; edited 1 time in total |
|||
![]() |
|
vid
asmcoder: Don't type bullshit if you don't know. Functions that return WORD return in AX, and functions that return BYTE return in AL.
|
|||
![]() |
|
f0dder
asmcoder wrote: what windows u have? _________________ ![]() |
|||
![]() |
|
rxantos
Thank you for pointing this out. Although this has not yet bite me, I will be more carefull when checking what a function returns.
Altough, a good design should have some consistence. Guess Windows is not a good example of a good design. |
|||
![]() |
|
f0dder
The NT kernel is an example of decent design, the WIN32 API less so (largely because of it's WIN16 legacy). But keep in mind that the API was written with C programmers and not assembly programmers in mind - thus you don't get exact lists of what an API changes and what it doesn't, only the general "expect these registers to be modified, and you're guaranteed those registers aren't".
This also means that if only a byte or a word is returned, you should only look at that part of EAX, and consider the rest to be undefined. Use movsx/movzx if this is too horrible for you ![]() |
|||
![]() |
|
asmfan
Also have you noticed that some Win builds treat BOOL as al (1 byte) other as eax (4 bytes)? As i remember i stumbled this.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.