当前位置: 首页>>代码示例>>Java>>正文


Java Advapi32Util.registryKeyExists方法代码示例

本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryKeyExists方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryKeyExists方法的具体用法?Java Advapi32Util.registryKeyExists怎么用?Java Advapi32Util.registryKeyExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.platform.win32.Advapi32Util的用法示例。


在下文中一共展示了Advapi32Util.registryKeyExists方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVLCRegistryInfo

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
protected void getVLCRegistryInfo() {
	String key = "SOFTWARE\\VideoLAN\\VLC";
	try {
		if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
			key = "SOFTWARE\\Wow6432Node\\VideoLAN\\VLC";
			if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
				return;
			}
		}
		vlcPath = Paths.get(Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, key, ""));
		vlcVersion = new Version(Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, key, "Version"));
	} catch (Win32Exception e) {
		LOGGER.debug("Could not get VLC information from Windows registry: {}", e.getMessage());
		LOGGER.trace("", e);
	}
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:17,代码来源:WinUtils.java

示例2: getAviSynthPluginsFolder

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
protected String getAviSynthPluginsFolder() {
	String key = "SOFTWARE\\AviSynth";
	try {
		if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
			key = "SOFTWARE\\Wow6432Node\\AviSynth";
			if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
				return null;
			}
		}
		return Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, key, "plugindir2_5");
	} catch (Win32Exception e) {
		LOGGER.debug("Could not get AviSynth information from Windows registry: {}", e.getMessage());
		LOGGER.trace("", e);
	}
	return null;
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:17,代码来源:WinUtils.java

示例3: getKLiteFiltersFolder

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
protected String getKLiteFiltersFolder() {
	String key = "SOFTWARE\\Wow6432Node\\KLCodecPack";
	try {
		if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
			key = "SOFTWARE\\KLCodecPack";
			if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
				return null;
			}
		}
		return Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, key, "installdir");
	} catch (Win32Exception e) {
		LOGGER.debug("Could not get K-Lite Codec Pack information from Windows registry: {}", e.getMessage());
		LOGGER.trace("", e);
	}
	return null;
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:17,代码来源:WinUtils.java

示例4: isAddedToContextMenu

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static boolean isAddedToContextMenu() {
    if (!Platform.isWindows()) {
        return false;
    }
    final WinReg.HKEY REG_CLASSES_HKEY = WinReg.HKEY_LOCAL_MACHINE;
    final String REG_CLASSES_PATH = "Software\\Classes\\";
    try {
        if (!Advapi32Util.registryKeyExists(REG_CLASSES_HKEY, REG_CLASSES_PATH + ".swf")) {
            return false;
        }
        String clsName = Advapi32Util.registryGetStringValue(REG_CLASSES_HKEY, REG_CLASSES_PATH + ".swf", "");
        if (clsName == null) {
            return false;
        }
        return Advapi32Util.registryKeyExists(REG_CLASSES_HKEY, REG_CLASSES_PATH + clsName + "\\shell\\ffdec");
    } catch (Win32Exception ex) {
        return false;
    }
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:20,代码来源:ContextMenuTools.java

示例5: checkPathDoesNotExist

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private void checkPathDoesNotExist(
                                    String rootKey,
                                    String keyPath ) {

    if (Advapi32Util.registryKeyExists(getHKey(rootKey), keyPath)) {
        throw new RegistryOperationsException("Registry path already exists. "
                                              + getDescription(rootKey, keyPath, null));
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:10,代码来源:LocalRegistryOperations.java

示例6: writeToKey

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private static void writeToKey(int value) {
    try {
        if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY)) {
            Advapi32Util.registryCreateKey(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY);
        }
        Advapi32Util.registrySetIntValue(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY, "WriteProtect", value);
    }
    catch (IllegalArgumentException e) {
        Logging.log("Failed to " + (value == 0 ? "disable" : "enable") + " USB write block", LogMessageType.WARNING);
        Logging.log(e);
    }

}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:14,代码来源:UsbWriteBlock.java

示例7: getWriteBlockStatus

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
 * Gets the current setting of the write block key.
 * @return True if write block is turned on in the registry, false otherwise.
 */
public static boolean getWriteBlockStatus() {
    if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY)) {
        return false;
    }
    return Advapi32Util.registryGetIntValue(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY, "WriteProtect") == 1;

}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:12,代码来源:UsbWriteBlock.java

示例8: resetWriteBlockStatus

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
 * Sets the write block key back to what it was when ION launched.
 */
public static void resetWriteBlockStatus() {
    if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY)) {
        return;
    }
    Advapi32Util.registrySetIntValue(WinReg.HKEY_LOCAL_MACHINE, WRITE_BLOCK_KEY, "WriteProtect", initial_status ? 1 : 0);

}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:11,代码来源:UsbWriteBlock.java

示例9: isKerioInstalled

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
protected boolean isKerioInstalled() {
	try {
		String key = "SOFTWARE\\Kerio";
		if (!Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key)) {
			key = "SOFTWARE\\Wow6432Node\\Kerio";
			return Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, key);
		}
		return true;
	} catch (Win32Exception e) {
		LOGGER.debug("Could not get Kerio information from Windows registry: {}", e.getMessage());
		LOGGER.trace("", e);
		return false;
	}
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:15,代码来源:WinUtils.java

示例10: createRootRegistryFolder

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static void createRootRegistryFolder(String path) throws RegistryCanNotWriteInfoException {
    if (!Advapi32Util.registryKeyExists(APP_ROOT_HKEY, path)) {
        try {
            Advapi32Util.registryCreateKey(APP_ROOT_HKEY, path);
        } catch (Win32Exception e) {
            throw new RegistryCanNotWriteInfoException("Can not create root folder on registry.", e);
        }
    }
}
 
开发者ID:benchdoos,项目名称:WeblocOpener,代码行数:10,代码来源:RegistryManager.java

示例11: registryDeleteKey

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private static void registryDeleteKey(WinReg.HKEY hKey, String keyName) {
    boolean exists = Advapi32Util.registryKeyExists(hKey, keyName);
    if (exists) {
        Advapi32Util.registryDeleteKey(hKey, keyName);
    }
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:7,代码来源:ContextMenuTools.java

示例12: initLang

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static void initLang() {
    if (!Configuration.locale.hasValue()) {
        if (Platform.isWindows()) {
            //Load from Installer
            String uninstKey = "{E618D276-6596-41F4-8A98-447D442A77DB}_is1";
            uninstKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + uninstKey;
            try {
                if (Advapi32Util.registryKeyExists(WinReg.HKEY_LOCAL_MACHINE, uninstKey)) {
                    if (Advapi32Util.registryValueExists(WinReg.HKEY_LOCAL_MACHINE, uninstKey, "NSIS: Language")) {
                        String installedLoc = Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, uninstKey, "NSIS: Language");
                        int lcid = Integer.parseInt(installedLoc);
                        char[] buf = new char[9];
                        int cnt = Kernel32.INSTANCE.GetLocaleInfo(lcid, Kernel32.LOCALE_SISO639LANGNAME, buf, 9);
                        String langCode = new String(buf, 0, cnt).trim().toLowerCase();

                        cnt = Kernel32.INSTANCE.GetLocaleInfo(lcid, Kernel32.LOCALE_SISO3166CTRYNAME, buf, 9);
                        String countryCode = new String(buf, 0, cnt).trim().toLowerCase();

                        List<String> langs = Arrays.asList(SelectLanguageDialog.getAvailableLanguages());
                        for (int i = 0; i < langs.size(); i++) {
                            langs.set(i, langs.get(i).toLowerCase());
                        }

                        String selectedLang = null;

                        if (langs.contains(langCode + "-" + countryCode)) {
                            selectedLang = SelectLanguageDialog.getAvailableLanguages()[langs.indexOf(langCode + "-" + countryCode)];
                        } else if (langs.contains(langCode)) {
                            selectedLang = SelectLanguageDialog.getAvailableLanguages()[langs.indexOf(langCode)];
                        }
                        if (selectedLang != null) {
                            Configuration.locale.set(selectedLang);
                        }
                    }
                }
            } catch (Exception ex) {
                //ignore
            }
        }
    }
    Locale.setDefault(Locale.forLanguageTag(Configuration.locale.get()));
    AppStrings.updateLanguage();

    Helper.decompilationErrorAdd = AppStrings.translate(Configuration.autoDeobfuscate.get() ? "deobfuscation.comment.failed" : "deobfuscation.comment.tryenable");
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:46,代码来源:Main.java

示例13: keyExists

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public boolean keyExists(final HKEY root, final String key) {
	return Advapi32Util.registryKeyExists(root, key);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:IPv6Validator.java


注:本文中的com.sun.jna.platform.win32.Advapi32Util.registryKeyExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。