Added WBEM methods and a class. by rchateauneu · Pull Request #1474 · java-native-access/jna (original) (raw)
Thank you. Looks good to me. I pushed the PR to appveyor and that came back clean. The last little nitpick: The new test is locale dependent. Could you please check this patch, which should fix that?
This patch file was generated by NetBeans IDE
It uses platform neutral UTF-8 encoding and \n newlines.
--- a/contrib/platform/test/com/sun/jna/platform/win32/COM/WbemcliTest.java +++ b/contrib/platform/test/com/sun/jna/platform/win32/COM/WbemcliTest.java @@ -49,6 +49,7 @@ import com.sun.jna.platform.win32.OaIdl.SAFEARRAY; import com.sun.jna.platform.win32.WTypes; import com.sun.jna.platform.win32.Kernel32; +import com.sun.jna.platform.win32.WinNT; import com.sun.jna.ptr.IntByReference; import java.util.Arrays; import java.util.HashSet; @@ -327,7 +328,7 @@
boolean foundWin32_Process = false;
try {svc = WbemcliUtil.connectServer(WbemcliUtil.DEFAULT_NAMESPACE);
svc = connectServerEnglishLocale(WbemcliUtil.DEFAULT_NAMESPACE); enumRes = svc.ExecQuery( "WQL", "SELECT * FROM meta_class",
@@ -428,4 +429,25 @@ assertEquals(currentPid, pVal.longValue()); }
- /**
* Copy from WbemcliUtil#connectServer with American English selected as* locale.*/- private static Wbemcli.IWbemServices connectServerEnglishLocale(String namespace) {
Wbemcli.IWbemLocator loc = Wbemcli.IWbemLocator.create();if (loc == null) {throw new COMException("Failed to create WbemLocator object.");
} +
Wbemcli.IWbemServices services = loc.ConnectServer(namespace, null, null, "MS_409", 0, null, null);loc.Release();WinNT.HRESULT hres = Ole32.INSTANCE.CoSetProxyBlanket(services, Ole32.RPC_C_AUTHN_WINNT, Ole32.RPC_C_AUTHZ_NONE, null,Ole32.RPC_C_AUTHN_LEVEL_CALL, Ole32.RPC_C_IMP_LEVEL_IMPERSONATE, null, Ole32.EOAC_NONE);if (COMUtils.FAILED(hres)) {services.Release();throw new COMException("Could not set proxy blanket.", hres);}return services;- }
+}
It would be nice if you could include this (if it does not cause issues on your locale). If it works, please include it, squash all commits into a single commit, add an entry to CHANGES.md (have a look at the existing entries) with a summary of this change as a new feature.