本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryValueExists方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryValueExists方法的具体用法?Java Advapi32Util.registryValueExists怎么用?Java Advapi32Util.registryValueExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.platform.win32.Advapi32Util
的用法示例。
在下文中一共展示了Advapi32Util.registryValueExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkKeyExists
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private void checkKeyExists(
String rootKey,
String keyPath,
String keyName ) {
try {
WinReg.HKEY rootHKey = getHKey(rootKey);
if (!Advapi32Util.registryValueExists(rootHKey, keyPath, keyName)) {
throw new RegistryOperationsException("Registry key does not exist. "
+ getDescription(rootKey, keyPath, keyName));
}
} catch (Win32Exception e) {
throw new RegistryOperationsException("Registry key path does not exist. "
+ getDescription(rootKey, keyPath, keyName), e);
}
}
示例2: registryDeleteValue
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
private static void registryDeleteValue(WinReg.HKEY root, String keyPath, String valueName) {
boolean exists = Advapi32Util.registryValueExists(root, keyPath, valueName);
if (exists) {
Advapi32Util.registryDeleteValue(root, keyPath, valueName);
}
}
示例3: 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");
}