/** * Get names of the registry key's sub-keys. * * @param root * Root key. * @param keyPath * Path to a registry key. * @return Array of registry key names. */ public static String[] registryGetKeys(HKEY root, String keyPath) { return registryGetKeys(root, keyPath, 0); }
public String getSoapUiPath() { try { String[] jvms = Advapi32Util.registryGetKeys(WinReg.HKEY_CURRENT_USER, "Software\\ej-technologies\\exe4j\\jvms"); for (String jvm: jvms) { if (jvm.toLowerCase().contains("soapui")) { return jvm.split("/jre/bin")[0]; } } } catch (Exception e) { } throw new DisabledConnector("SOAP UI is not installed (not found in registry). Install it and run it once (MANDATORY)"); }
public String getSoapUiPath() { try { String[] jvms = Advapi32Util.registryGetKeys(WinReg.HKEY_CURRENT_USER, "Software\\ej-technologies\\exe4j\\jvms"); for (String jvm: jvms) { if (jvm.toLowerCase().contains("soapui")) { return jvm.split("/jre/bin")[0]; } } } catch (Exception e) { } throw new DisabledConnector("SOAP UI is not installed (not found in registry). Install it and run it once (MANDATORY)"); }
private static void addAllJavaHomesOnWindows(final String keyJre, final Set<String> javaHomes) { if (Advapi32Util.registryKeyExists(HKEY_LOCAL_MACHINE, keyJre)) { javaHomes.addAll(findJavaHomesOnWindows(keyJre, Advapi32Util.registryGetKeys(HKEY_LOCAL_MACHINE, keyJre))); } }
/** * Get names of the registry key's sub-keys. * * @param root * Root key. * @param keyPath * Path to a registry key. * @return Array of registry key names. */ public static String[] registryGetKeys(HKEY root, String keyPath) { HKEYByReference phkKey = new HKEYByReference(); int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, keyPath, 0, WinNT.KEY_READ, phkKey); if (rc != W32Errors.ERROR_SUCCESS) { throw new Win32Exception(rc); } try { return registryGetKeys(phkKey.getValue()); } finally { rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue()); if (rc != W32Errors.ERROR_SUCCESS) { throw new Win32Exception(rc); } } }
/** * Get names of the registry key's sub-keys. * * @param root * Root key. * @param keyPath * Path to a registry key. * @param samDesiredExtra * Registry key security and access rights to be requested in addition to WinNT.KEY_READ. * (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.) * @return Array of registry key names. */ public static String[] registryGetKeys(HKEY root, String keyPath, int samDesiredExtra) { HKEYByReference phkKey = new HKEYByReference(); int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, keyPath, 0, WinNT.KEY_READ | samDesiredExtra, phkKey); if (rc != W32Errors.ERROR_SUCCESS) { throw new Win32Exception(rc); } try { return registryGetKeys(phkKey.getValue()); } finally { rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue()); if (rc != W32Errors.ERROR_SUCCESS) { throw new Win32Exception(rc); } } }