User32: SetCursorPos is declared (long, long), but Windows declares (int, int)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- backend, operating-systems
Hướng nghiên cứu
Bắt đầu từ khai báo SetCursorPos trong contrib/platform/src/com/sun/jna/platform/win32/User32.java và so sánh với chữ ký Win32 được trích dẫn trong issue. Kiểm tra các bên gọi liên quan và User32Test.testSetCursorPos để hiểu khả năng tương thích và phạm vi kiểm thử hiện có. Công việc hoàn tất khi binding sử dụng đúng kiểu tọa độ, mọi lựa chọn về khả năng tương thích được xử lý và bài kiểm thử bao quát hành vi này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
User32.SetCursorPos takes two Java longs. Win32 declares both coordinates as int.
// contrib/platform/src/com/sun/jna/platform/win32/User32.java:2329
boolean SetCursorPos(long x, long y);
// um/WinUser.h (Windows SDK 10.0.28000)
WINUSERAPI
BOOL
WINAPI
SetCursorPos(
_In_ int X,
_In_ int Y);
What it can cause
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.
- Ngôn ngữ chính
- Java
- Star
- 8.9k
- Fork
- 1.7k
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của java-native-access/jna
-
MacFileUtils: FSPathMakeRef passes an int where the C function takes its FSRef output pointerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 79/100
java-native-access/jna#1746 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
java-native-access/jna#1747 ·
-
`Native.typeOptions` never releases library interfaces, leaking classloadersCó thể đã có người làm @curforever đã nhận 11 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 48/100
java-native-access/jna#1742 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 66/100
java-native-access/jna#1738 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
java-native-access/jna#1736 ·
Tất cả issue của java-native-access/jna
Issue tương tự
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixCó thể đã có người làm @ItsDeadlyProgrammer đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
appsmithorg/appsmith#42471 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
code-maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
carlos-emr/carlos#5258 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: author create/update with an unknown avatarId returns 404 instead of 400 UNKNOWN_REFERENCECó thể đã có người làm @Vinu2111 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
atomityhq/blog-cms#59 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PlatformSpecific.hasGreenThreads incorrectly returns false for JDK updates and non-GA versionsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày