Author Topic: windows call return  (Read 5000 times)

Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
windows call return
« 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

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: windows call return
« Reply #1 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


Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
Re: windows call return
« Reply #2 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?

Offline nikipa

  • Jr. Member
  • *
  • Posts: 7
Re: windows call return
« Reply #3 on: September 04, 2015, 08:05:32 PM »
hi again,
i just tested and it worked,
thank you for the help :)