NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nikipa on September 04, 2015, 07:09:55 PM

Title: windows call return
Post by: nikipa on September 04, 2015, 07:09:55 PM
Hello all,

I am new to the assembly programming so sorry if my question is stupid.

If i make a windows API call,lets say the CreateFile function. How can i get the return value in order to compare it with something which i want?

For this specific call, the return value is INVALID_HANDLE_VALUE if it fails.

Thank you
Title: Re: windows call return
Post by: Frank Kotler on September 04, 2015, 07:35:35 PM
Return value should be in eax... or rax. The NASMX macros would include the definition of INVALID_HANDLE_VALUE (-1) if you haven't got it .

Best,
Frank

Title: Re: windows call return
Post by: nikipa on September 04, 2015, 07:58:08 PM
so i the code should be:

push arg1
push arg2
...
push argn

call function

cmp eax,[INVALID_HANDLE_VALUE)

is that right?
Title: Re: windows call return
Post by: nikipa on September 04, 2015, 08:05:32 PM
hi again,
i just tested and it worked,
thank you for the help :)