Skip to content

Commit e578437

Browse files
widdisddbwiddis
widdisd
authored andcommitted
Fixed the bug, tests now pass!
1 parent e84d355 commit e578437

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Features
1111
Bug Fixes
1212
---------
1313
* [#1115](https://github.com/java-native-access/jna/issues/1115): Fix signature for `c.s.j.p.win32.Kernel32#CreateRemoteThread` and bind `VirtualAllocEx`, `VirtualFreeEx`, `GetExitCodeThread` in `c.s.j.p.win32.Kernel32` - [@apangin](https://github.com/apangin), [@matthiasblaesing](https://github.com/matthiasblaesing).
14+
* [#1127](https://github.com/java-native-access/jna/issues/1127): Windows needs a wide string in `c.s.j.p.win32.COM.IShellFolder#ParseDisplayName` - [@dbwiddis](https://github.com/dbwiddis).
1415

1516
Release 5.4.0
1617
=============

contrib/platform/src/com/sun/jna/platform/win32/COM/IShellFolder.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
import com.sun.jna.Function;
30+
import com.sun.jna.Native;
3031
import com.sun.jna.Pointer;
3132
import com.sun.jna.platform.win32.Guid.IID;
3233
import com.sun.jna.platform.win32.Guid.REFIID;
@@ -480,7 +481,11 @@ public int Release() {
480481
@Override
481482
public WinNT.HRESULT ParseDisplayName(WinDef.HWND hwnd, Pointer pbc, String pszDisplayName, IntByReference pchEaten, PointerByReference ppidl, IntByReference pdwAttributes) {
482483
Function f = Function.getFunction(vTable[3], Function.ALT_CONVENTION);
483-
return new WinNT.HRESULT(f.invokeInt(new Object[]{interfacePointer, hwnd, pbc, pszDisplayName, pchEaten, ppidl, pdwAttributes}));
484+
// pszDisplayName is mapped as String but Windows needs
485+
// Wide String. Convert and pass here.
486+
char[] pszDisplayNameNative = Native.toCharArray(pszDisplayName);
487+
return new WinNT.HRESULT(f.invokeInt(new Object[] { interfacePointer, hwnd, pbc,
488+
pszDisplayNameNative, pchEaten, ppidl, pdwAttributes }));
484489
}
485490

486491
@Override

0 commit comments

Comments
 (0)