So does anybody know why windows api dont return an error by setting the carry flag, like dos and bios interrupts do?? Carry flag seems a better option to me. At lest you dont have to do an extra compare.
You might send that question to the M$ tech support, maybe they can answer it ;) btw, you don't really need an extra comparison, a simple test eax,eax is enough in almost all cases (I think you can afford that additonal clock cycle).
It makes no sense for the API to use the carry flag, as that imposes a very high burdon on it's clients. Why? Cause the API was written with C in mind. The API uses the STDCALL convention (which interestingly enough, comes from Pascal and not C). It expects that return value to be in a register. C knows how to handle that. C does NOT know how to handle the carry flag by itself. One would have to inline some asm, add custom compiler additions, make crazy macros, etc, to get this to work.
The original Win32 platform, NT 3.1, was coded in C. All the way down to the API of the "native NT kernel". The use of the stack to pass arguments, and the register saving conventions were set by the compilers used at that time. (circa 1992)