Skip to content

Commit

Permalink
Fixed the bug, tests now pass!
Browse files Browse the repository at this point in the history
  • Loading branch information
widdisd authored and widdisd committed Aug 16, 2019
1 parent 761a437 commit 595bedb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Features
Bug Fixes
---------
* [#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).
* [#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).

Release 5.4.0
=============
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

import com.sun.jna.Function;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.IID;
import com.sun.jna.platform.win32.Guid.REFIID;
Expand Down Expand Up @@ -480,7 +481,11 @@ public int Release() {
@Override
public WinNT.HRESULT ParseDisplayName(WinDef.HWND hwnd, Pointer pbc, String pszDisplayName, IntByReference pchEaten, PointerByReference ppidl, IntByReference pdwAttributes) {
Function f = Function.getFunction(vTable[3], Function.ALT_CONVENTION);
return new WinNT.HRESULT(f.invokeInt(new Object[]{interfacePointer, hwnd, pbc, pszDisplayName, pchEaten, ppidl, pdwAttributes}));
// pszDisplayName is mapped as String but Windows needs
// Wide String. Convert and pass here.
char[] pszDisplayNameNative = Native.toCharArray(pszDisplayName);
return new WinNT.HRESULT(f.invokeInt(new Object[] { interfacePointer, hwnd, pbc,
pszDisplayNameNative, pchEaten, ppidl, pdwAttributes }));
}

@Override
Expand Down

0 comments on commit 595bedb

Please sign in to comment.