flat assembler
Message board for the users of flat assembler.

Index > Windows > Windows 11 bug ? pos.x from GetCursorPos = -1

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 2079
Roman 04 Aug 2026, 11:24
Today i print cursor pos.x from GetCursorPos.
On my Laptop ninkear ybook 15 ryzen 3200u Windows 11 i get x= -1 ! If my cursor in left side screen.

But could be x from 0 to width screen.

On my descktop computer Windows 10 i get x from 0 to 1920

My question its Windows 11 bug or AMD ?


Last edited by Roman on 04 Aug 2026, 12:14; edited 3 times in total
Post 04 Aug 2026, 11:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 21023
Location: In your JS exploiting you and your system
revolution 04 Aug 2026, 11:39
It's probably a bug in the code. Show a minimal example code that gives the error.
Post 04 Aug 2026, 11:39
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 2079
Roman 04 Aug 2026, 11:42
Thats all.
Code:
;my code 32 bits
mousePosit POINT ;as dd 0,0

invoke  GetCursorPos, mousePosit

;I simple do this to fix bug
inc dword [mousePosit]      ;x+1
inc dword [mousePosit+4]  ;y+1
    


Last edited by Roman on 04 Aug 2026, 12:01; edited 1 time in total
Post 04 Aug 2026, 11:42
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 21023
Location: In your JS exploiting you and your system
revolution 04 Aug 2026, 11:46
Roman wrote:
Thats all.
Code:
mousePosit POINT ;as dd 0,0

invoke  GetCursorPos, mousePosit
    
Doesn't compile for me.
Code:
flat assembler  version 1.73.31  (16384 kilobytes memory)
test.asm [1]:
mousePosit POINT ;as dd 0,0
processed: mousePosit POINT
error: illegal instruction.    
Perhaps there is an include missing? There is no format either.
Post 04 Aug 2026, 11:46
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 2079
Roman 04 Aug 2026, 11:47
replace POINT to dd 0,0

msdn
struct POINT {
LONG x;
LONG y;
}
Post 04 Aug 2026, 11:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 21023
Location: In your JS exploiting you and your system
revolution 04 Aug 2026, 14:01
The code posted can't be assembled.

Please show the exact problem, with code that can be assembled, without needing to guess all the other needed things.
Post 04 Aug 2026, 14:01
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1228
Location: Russia
macomics 04 Aug 2026, 22:28
MSDN wrote:
Remarks
The cursor position is always specified in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.

The calling process must have WINSTA_READATTRIBUTES access to the window station.

The input desktop must be the current desktop when you call GetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.
Post 04 Aug 2026, 22:28
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 883
Ali.Z 06 Aug 2026, 13:34
from my experience with other windows api specifically screen and shell related ones, there is some undocumented race condition at OS level.

getting cursor position is also one of the api that i had trouble with in past depending on the windows version and where the api is called from.

what you should know is, some api are not supposed to be called in some specific window messages (wm_), because not all messages are queued, some passed directly to your wnd_proc, and some comes from other threads not necessarily the kernel.
just know it is not totally your fault, because there is inconsistency between versions in first place.

sadly i didnt compile or document the list of api that can have this side effect, but from what i remember, some window pos and rect, and one or two client area related things.

_________________
Asm For Wise Humans
Post 06 Aug 2026, 13:34
View user's profile Send private message 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-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.