User32: SetCursorPos is declared (long, long), but Windows declares (int, int)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
contrib/platform/src/com/sun/jna/platform/win32/User32.java の SetCursorPos 宣言から始め、issue で引用されている Win32 シグネチャと比較してください。関連する呼び出し元と User32Test.testSetCursorPos を確認し、互換性と既存のテスト範囲を把握してください。バインディングが正しい座標型を使用し、互換性に関する選択があれば対処され、テストがその動作を網羅していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 8.9k
- フォーク
- 1.7k
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
java-native-access/jna のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 79/100
java-native-access/jna#1746 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
java-native-access/jna#1747 ·
-
`Native.typeOptions` never releases library interfaces, leaking classloaders対応中かも @curforever が 10 日前に担当しました。 オープン
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
java-native-access/jna#1742 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 66/100
java-native-access/jna#1738 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
java-native-access/jna#1736 ·
java-native-access/jna の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ome/ome-codecs#48 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
tonihele/OpenKeeper#672 ·
メンテナーはふだん 4 日以内に返信
-
Shaded google-api-client trust stores still include AAA Certificate Services (eMudhra CA compromise)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
snowflakedb/snowflake-jdbc#2763 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ControlSystemStudio/phoebus#3983 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zamojski/TowerCollector#292 · コメント 1 件 ·