From bb90e20fdb8162104a4fb20157350b174b7a2b64 Mon Sep 17 00:00:00 2001 From: Dan Widdis Date: Sun, 10 May 2026 00:09:40 +0000 Subject: [PATCH] Fix RegisterServiceCtrlHandler using wrong Handler type Closes #1510 The lpHandlerProc parameter resolved to Library.Handler (an InvocationHandler) instead of Winsvc.Handler (a StdCallCallback). Add the missing import for Winsvc.Handler. --- CHANGES.md | 1 + contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 192a84342d..35c5fa9109 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ Bug Fixes * [#1644](https://github.com/java-native-access/jna/issues/1644): Fix bug in VARDESC and TYPEDESC causing an illegal memory access - [@lwahonen](https://github.com/lwahonen) * [#1715](https://github.com/java-native-access/jna/pull/1715): Fix `UdevDevice.getSysname()` calling `udev_device_get_syspath` instead of `udev_device_get_sysname` - [@dbwiddis](https://github.com/dbwiddis). * [#1721](https://github.com/java-native-access/jna/pull/1721): Fix switched `serverName`/`domainName` arguments in `Netapi32Util#getDCName` - [@dbwiddis](https://github.com/dbwiddis). +* [#1722](https://github.com/java-native-access/jna/pull/1722): Fix `Advapi32#RegisterServiceCtrlHandler` using wrong `Handler` type - [@dbwiddis](https://github.com/dbwiddis). Release 5.18.1 ============== diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java index 07e5992b7a..8d4da68fe6 100755 --- a/contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java @@ -3325,7 +3325,7 @@ boolean CreateProcessWithLogonW(String lpUsername, String lpDomain, String lpPas * */ public SERVICE_STATUS_HANDLE RegisterServiceCtrlHandler(String lpServiceName, - Handler lpHandlerProc); + Winsvc.Handler lpHandlerProc); /** * Registers a function to handle extended service control requests.