Update dependency net.java.dev.jna:jna-platform to v5 #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.5.2->5.0.0By merging this PR, the issue #17 will be automatically resolved and closed:
Release Notes
java-native-access/jna (net.java.dev.jna:jna-platform)
v5.0.0Compare Source
=============
Features
HRESULTinc.s.j.p.win32.COM.COMException, introducec.s.j.p.win32.COM.COMInvokeExceptionas subclass ofCOMExceptionfor exception as the result of aIDispatch#Invoke. TheEXECPINFOis unwrapped into fields in theCOMInvokeExceptionand correctly freed. - @matthiasblaesing.Native#loadLibraryrequires that the interface class passed in is an instance of Library. The runtime check can be enhanced by using a constraint generic. This breaks binary compatibility (see notes below) - @d-noll.In a followup, the original
loadLibrarymethods were deprecated andNative#loadmethods were introduced, that hold the new generic definitions. So this change is now binary compatible.Structure#newInstancereceive the target type as a parameter. This adds a limited generic type, so that the return type ist the target type and not a generic structure, removing the necessity to do an explizit cast - @matthiasblaesing.@ComInterfaceannotation tocom.sun.jna.platform.win32.COM.util.IConnectionPointto make it possible to retrieve it viaIUnknown#queryInterface- @matthiasblaesing.Advapi32#EnumDependendServices,Advapi32#EnumServicesStatusExandAdvapi32#QueryServiceStatus.W32Service#stopServicewas modified to be more resilent when stopping service - @matthiasblaesing.com.sun.jna.platform.win32.Kernel32.ExpandEnvironmentStringsand add helper method for it asKernel32Util#expandEnvironmentStrings- @matthiasblaesing.ACEsfromcom.sun.jna.platform.win32.WinNT.ACLeven if the containedACEis not currently supported - @jrobhoward.c.s.j.Structure.FieldOrderannotation to define the field order of a structures without implementingStructure#getFieldOrder()- @idosu.GetProcessTimesandGetProcessIoCounterstocom.sun.jna.platform.win32.Kernel32- @dbwiddis.CreateMutex,OpenMutexandReleaseMutextocom.sun.jna.platform.win32.Kernel32- @matthiasblaesing.PdhLookupPerfNameByIndex,PdhLookupPerfIndexByName, andPdhEnumObjectItemstoc.s.j.platform.win32.Pdhand ac.s.j.platform.win32.PdhUtilclass to access them - @dbwiddis.PERF_OBJECT_TYPE,PERF_COUNTER_BLOCK, andPERF_COUNTER_DEFINITIONtoc.s.j.platform.win32.WinPerfand addedPointerconstructors to ``PERF_INSTANCE_DEFINITIONandPERF_DATA_BLOCK` - @dbwiddis.WTS_PROCESS_INFO_EX,WTSEnumerateProcessesEx, andWTSFreeMemoryExtoc.s.j.platform.win32.Wtsapi32- @dbwiddis.GetIfEntry,GetIfEntry2, andGetNetworkParamsand supporting structuresMIB_IFROW,MIB_IF_ROW2, andFIXED_INFOtoc.s.j.platform.win32.IPHlpAPI.java- @dbwiddis.CM_Locate_DevNode,CM_Get_Parent,CM_Get_Child,CM_Get_Sibling,CM_Get_Device_ID, andCM_Get_Device_ID_Sizetoc.s.j.platform.win32.Cfgmgr32.javaand ac.s.j.platform.win32.Cfgmgr32Utilclass forCM_Get_Device_ID- @dbwiddis.PdhLookupPerfIndexByEnglishNametoc.s.j.platform.win32.PdhUtil- @dbwiddis.c.s.j.platform.mac.SystemBfor Process, Network interface, Swapfile, Time, and Filesystem info - @dbwiddis.Sysinfostructure and function toc.s.j.platform.linux.LibC- @dbwiddis.c.s.j.platform.win32.Advapi32Utilmethods which allow the caller to specifysamDesiredExtrato request additional registry key security and access rights - @camw.NativeMappedto be used with enums - @koraktor.CoInitializeSecurityandCoSetProxyBlankettoc.s.j.platform.win32.Ole32, added newc.s.j.platform.win32.Wbemcliclasses needed to query WMI, and added aWbemcliUtilclass implementing WMI queries. - @dbwiddis.~/Library/Application Support/JNA/tempand on other Unix like systems$XDG_CACHE_DIR/JNA/temp(Default value is:~/.cache/JNA/temp) is used - @matthiasblaesing.com.sun.jna.platform.win32.Kernel32#ExitProcess- @Groostav.Bug Fixes
com.sun.jna.platform.win32.SecBufferDescand add convenience binding ascom.sun.jna.platform.win32.SspiUtil.ManagedSecBufferDesc. Bind SSPI functionsInitializeSecurityContext,AcceptSecurityContext,QueryCredentialsAttributes,QuerySecurityPackageInfo,EncryptMessage,DecryptMessage,MakeSignature,VerifySignatureincom.sun.jna.platform.win32.Secur32- @matthiasblaesing.COMLateBindingObject#getStringProperty- @matthiasblaesing.gethostname,sethostname,getdomainnameandsetdomainnameand bindcom.sun.jna.platform.win32.Winsock2.gethostname(byte[], int)- @matthiasblaesing.ELFAnalyser#runDetection, fix suggested by @Sylvyrfysh in #880 - @matthiasblaesing.com.sun.jna.platform.win32.COM.util.ProxyObject#disposemultiple times - @matthiasblaesing.Structure#validateand preventArrayIndexOutOfBoundsExceptioninSAFEARRAY#readfor zero dimensions - @matthiasblaesing.javahwas removed from the JDK and
javacis now used to create the necessary headers.JNA now has JDK 8 as the minimum build version, at runtime Java 6 is the minimum version.
Native code for platforms with a JDK version lower than 8 can still be build by (demonstrated for Solaris x86):
- Run `ant -Dbuild.os.name=SunOS -Dbuild.os.arch=x86 native-build-package`
- Transfer the `build/build-package-sunos-x86-5.2.1.zip` file to the target system. The file holds the native sources, the necessary headers and and a shell script for the build.
- Expand the zip on the target system.
- Setup `JAVA_HOME` to point to the JDK sources.
- Change into the expanded directory and run `bash build.sh`.
- The resulting `sunos-x86.jar` is copied back to the original build system to `lib/native/sunos-x86.jar`
- [@matthiasblaesing](https://redirect.github.com/matthiasblaesing).JNIEnvpointer was used to access the JVM - @matthiasblaesing.lpAccessNameparameter ofcom.sun.jna.platform.win32.Mpr#WNetUseConnection- @matthiasblaesing.jna.nosystotrue. By default then the embedded native library is used - @matthiasblaesing.Breaking Changes
com.sun.jna.Pointer#SIZEis removed. Its use is replaced bycom.sun.jna.Native#POINTER_SIZEto prevent a class loading deadlock, when JNA is initialized from multiple threads
com.sun.jna.Pointer#getString(long offset, boolean wide)is removed. It was replaced bycom.sun.jna.Pointer#getString(long offset)orcom.sun.jna.Pointer#getWideString(long offset)com.sun.jna.Pointer#getStringArray(long offset, boolean wide)is removed. It was replaced bycom.sun.jna.Pointer#getStringArray(long offset)orcom.sun.jna.Pointer#getWideStringArray(long offset)com.sun.jna.Pointer#setString(long offset, String value, boolean wide)is removed. It was replaced bycom.sun.jna.Pointer#setString(long offset, String value)orcom.sun.jna.Pointer#setWideString(long offset, String value)com.sun.jna.Structure#setFieldOrderis removed. It was replaced bycom.sun.jna.Structure#getFieldOrderand threw anjava.lang.Erroron call.com.sun.jna.Native#parseVersionwas removed without replacementcom.sun.jna.Native#setPreserveLastErrorandcom.sun.jna.Native#getPreserveLastErrorwere removed without replacement. They were turned into NOOPs in the past.
com.sun.jna.Native#getDirectByteBufferwas replaced bycom.sun.jna.Pointer#getByteBuffergethostname,sethostname,getdomainnameand
setdomainnamein the interfacecom.sun.jna.platform.unix.LibCAPIwere changed from
(char[] name, int len)to(byte[] name, int len)com.sun.jna.Platform#isAixwas replaced bycom.sun.jna.Platform#isAIXcom.sun.jna.platform.win32.Sspi.SecBufferDescwas incompatibly changed tomatch the correct native semantics. SecBufferDesc describing more than one
buffer were broken. For most usecases
com.sun.jna.platform.win32.SspiUtil.ManagedSecBufferDescis the bestalternative.
com.sun.jna.platform.win32.WinBase.FILETIME#toLong()was replaced bycom.sun.jna.platform.win32.WinBase.FILETIME#toTime()com.sun.jna.platform.win32.Variant#COM_DAYS_ADJUSTMENTwas removedcom.sun.jna.platform.win32.Variant#MICRO_SECONDS_PER_DAYwas removedcom.sun.jna.platform.win32.Variant.VARIANT#toJavaDatewas removedcom.sun.jna.platform.win32.Variant.VARIANT#fromJavaDatewas removedcom.sun.jna.platform.win32.User32#MonitorFromPoint(Point pt, int dwFlags)was replaced by
com.sun.jna.platform.win32.User32#MonitorFromPoint(Point.ByValue pt, int dwFlags)com.sun.jna.platform.win32.OleAuto.LoadTypeLib(WString, PointerByReference)was replaced by
com.sun.jna.platform.win32.OleAuto.LoadTypeLib(String, PointerByReference)com.sun.jna.platform.win32.Kernel32Util.formatMessageFromHR(HRESULT)was replaced by
com.sun.jna.platform.win32.Kernel32Util.formatMessage(HRESULT)com.sun.jna.platform.win32.COM.COMExceptionwas structurally modified. ThepExcepInfoandpuArgErrmembers were removed andhresultmember was added.The now missing information in
COMExceptionwas moved toCOMInvokeException.com.sun.jna.platform.win32.COM.IShellFolder#GetDisplayNameOfwas changed from
PointerByReferencetoSTRRETand matching this,the first parameter of
com.sun.jna.platform.win32.Shlwapi.StrRetToStrwaschanged identically.
ACE_HEADERreplacesACEStructureas the base class forACEs.com.sun.jna.platform.win32.WinNT.ACLwas modified to support ACLS, that containACEsother thanACCESS_ALLOWED_ACE_TYPEandACCESS_DENIED_ACE_TYPEbywidening the return type of
getACEStructurestoACE_HEADER[]and renamingthe method to
getACEs. Inconsequence
com.sun.jna.platform.win32.Advapi32Util#getFileSecuritywaschanged similarly. The SID accessors
getSidStringandgetSIDwere movedfrom
ACEStructuretoACCESS_ACEStructure.com.sun.jna.platform.win32.Ole32#CoCreateGuid(GUID.ByReference pguid)was replaced bycom.sun.jna.platform.win32.Ole32#CoCreateGuid(GUID pguid)andcom.sun.jna.platform.win32.Ole32#CLSIDFromString(WString lpsz, CLSID.ByReference pclsid)was replaced bycom.sun.jna.platform.win32.Ole32#CLSIDFromString(String lpsz, CLSID.ByReference pclsid)