flat assembler
Message board for the users of flat assembler.

Index > Windows > virtual at esp problem

Author
Thread Post new topic Reply to topic
wisepenguin



Joined: 30 Mar 2005
Posts: 129
wisepenguin 11 Aug 2005, 23:04
i am calling GetCursorPos to get the current mouse position so i can call TrackPopupMenu.
instead of using a global variable POINT, i made room on the stack then did this

Code:
virtual at esp
.curpos POINT
end virtual

lea ebx, [.curpos]
push ebx
call [GetCursorPos]
    


however, the popup menu is placed in the bottom left of screen (0, 0 coordinates).

if i change it to

Code:
lea esi, [esp]
virtual at ESI
    

...same as above

it works and the menu is placed correctly.

now, i thought esi will be the same value as esp because of the LEA instruction so i dont understand how using LEA and ESI makes the code work.

am i doing something wrong ?

i used
Code:
virtual at esp
.wc WNDCLASSEX
end virtual
    


to set window class properties and RegisterClassEx with the WNDCLASSEX on the stack and that works. thats why i cant understand why it doesnt work with the GetCursorPos.[/code]
Post 11 Aug 2005, 23:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 12 Aug 2005, 02:54
Try this:
Code:
virtual at esp
.curpos POINT
end virtual

sub esp,sizeof.POINT
lea ebx, [.curpos] ;you can also use "mov ebx,esp" here
push ebx
call [GetCursorPos]
... ;here is some code using ebx that points to .curpos
add esp,sizeof.POINT ;we're finished with .curpos    
Post 12 Aug 2005, 02:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.