Author Topic: why is my code not working?  (Read 7305 times)

Offline xellos

  • Jr. Member
  • *
  • Posts: 2
why is my code not working?
« on: April 25, 2011, 06:28:39 PM »
it compiles without errors

Code: [Select]
import SetCursorPos user32.dll
extern SetCursorPos

import ExitProcess kernel32.dll
extern ExitProcess

segment .data use32
x dd 10
y dd 10

segment .bbs use32

segment .code use32

..start:
push 0
push x
push y
call [SetCursorPos]

push dword 0x00
call [ExitProcess]
ret

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: why is my code not working?
« Reply #1 on: April 25, 2011, 08:57:55 PM »
Off-hand you are not using SetCursorPos correctly. It expects only two arguments, both integer values.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: why is my code not working?
« Reply #2 on: April 26, 2011, 03:51:57 AM »
In case you don't get what Keith is telling you about "values"...

Code: [Select]
push x
push y

pushes the addresses (offsets) of the two variables. To get the "values", you'd:

Code: [Select]
push dword [x]
push dword [y]

(I'll take a guess that you're supposed to push "[y]" first, too - you can figure it out when you make 'em different)

Best,
Frank


Offline xellos

  • Jr. Member
  • *
  • Posts: 2
Re: why is my code not working?
« Reply #3 on: April 26, 2011, 10:09:44 AM »
thank you it works