You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
User32: SetCursorPos is declared (long, long), but Windows declares (int, int) #1745
On 64-bit Windows nothing goes wrong: each argument travels in a register, and SetCursorPos reads its low 32 bits. On 32-bit Windows the arguments go on the stack, and each long takes 8 bytes. SetCursorPos reads X from the low half of x and Y from the high half of x, which is 0 for any on-screen x, so the cursor lands at (x, 0). Because the function is stdcall, it also pops 8 bytes where 16 were pushed. I don't have 32-bit Windows to run this; it follows from the two declarations. User32Test.testSetCursorPos passes on 64-bit, which is consistent with it.
Fix
boolean SetCursorPos(int x, int y);. Changing the signature breaks callers compiled against the long version, so adding the int overload and deprecating the long one may be gentler. Happy to send a PR for whichever you prefer.
How this was found
By a research tool that compares each native declaration against the C declaration of the function it binds. Nothing was built or executed; every file quoted is in this repository at 5.19.1, and unchanged on master.
Activity
fix(win32): correct SetCursorPos parameter types (java-native-access#…