Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

User32: SetCursorPos is declared (long, long), but Windows declares (int, int)

オープン 初心者向け
#1,745 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

java-native-access/jna のほかの issue

java-native-access/jna の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。