From fe3a2fb7dbe4b65b30bf5a9ecb822b61efa4b940 Mon Sep 17 00:00:00 2001 From: Dan Widdis Date: Sun, 10 May 2026 00:07:24 +0000 Subject: [PATCH] Fix switched serverName/domainName arguments in Netapi32Util#getDCName Closes #1650 The arguments to NetGetDCName were passed in the wrong order (domainName, serverName) instead of (serverName, domainName). --- CHANGES.md | 1 + .../platform/src/com/sun/jna/platform/win32/Netapi32Util.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4396c3260..192a84342 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,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). Release 5.18.1 ============== diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Netapi32Util.java b/contrib/platform/src/com/sun/jna/platform/win32/Netapi32Util.java index 8a6488ba4..55fe2340a 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/Netapi32Util.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Netapi32Util.java @@ -118,7 +118,7 @@ public static String getDCName() { public static String getDCName(String serverName, String domainName) { PointerByReference bufptr = new PointerByReference(); try { - int rc = Netapi32.INSTANCE.NetGetDCName(domainName, serverName, bufptr); + int rc = Netapi32.INSTANCE.NetGetDCName(serverName, domainName, bufptr); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); }