本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryGetIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryGetIntValue方法的具体用法?Java Advapi32Util.registryGetIntValue怎么用?Java Advapi32Util.registryGetIntValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.platform.win32.Advapi32Util
的用法示例。
在下文中一共展示了Advapi32Util.registryGetIntValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIntValue
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Get Integer registry value(REG_DWORD)
*
* @param keyPath
* @param keyName
* @return
*/
@Override
public int getIntValue(
String rootKey,
String keyPath,
String keyName ) {
checkKeyExists(rootKey, keyPath, keyName);
try {
return Advapi32Util.registryGetIntValue(getHKey(rootKey), keyPath, keyName);
} catch (RuntimeException re) {
throw new RegistryOperationsException("Registry key is not of type Integer. "
+ getDescription(rootKey, keyPath, keyName), re);
}
}
示例2: doApplySize
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
@Override
protected void doApplySize(final Size size) throws BotConfigurationException {
final int width = size.x();
final int height = size.y();
final HKEYByReference key = Advapi32Util.registryGetKey(WinReg.HKEY_LOCAL_MACHINE,
"SOFTWARE\\BlueStacks\\Guests\\Android\\FrameBuffer\\0", WinNT.KEY_READ | WinNT.KEY_WRITE);
final int w1 = Advapi32Util.registryGetIntValue(key.getValue(), "WindowWidth");
final int h1 = Advapi32Util.registryGetIntValue(key.getValue(), "WindowHeight");
final int w2 = Advapi32Util.registryGetIntValue(key.getValue(), "GuestWidth");
final int h2 = Advapi32Util.registryGetIntValue(key.getValue(), "GuestHeight");
if (w1 != width || h1 != height || w2 != width || h2 != height) {
Advapi32Util.registrySetIntValue(key.getValue(), "WindowWidth", width);
Advapi32Util.registrySetIntValue(key.getValue(), "WindowHeight", height);
Advapi32Util.registrySetIntValue(key.getValue(), "GuestWidth", width);
Advapi32Util.registrySetIntValue(key.getValue(), "GuestHeight", height);
Advapi32Util.registrySetIntValue(key.getValue(), "FullScreen", 0);
}
throw new BotConfigurationException(String.format("Please restart %s to fix resolution", BS_WINDOW_NAME));
}
示例3: 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;
}
示例4: validateNETFrameworkIsInstalled
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Attemps to read what version of .NET framework is installed and if the
* release version meets the minimum ME3Explorer requirements
*
* @return true if satisfied, false otherwise
*/
public static boolean validateNETFrameworkIsInstalled() {
if (!PERFORM_DOT_NET_CHECK) {
NET_FRAMEWORK_IS_INSTALLED = true;
return true;
}
String os = System.getProperty("os.name");
if (os.contains("Windows")) {
int releaseNum = 0;
String netFrameWork4Key = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full";
ModManager.debugLogger.writeMessage("Checking for .NET Framework 4.5 or higher registry key");
try {
releaseNum = Advapi32Util.registryGetIntValue(WinReg.HKEY_LOCAL_MACHINE, netFrameWork4Key, "Release");
ModManager.debugLogger.writeMessage(".NET Framework release detected: " + releaseNum);
if (releaseNum >= MIN_REQUIRED_NET_FRAMEWORK_RELNUM) {
ModManager.debugLogger.writeMessage("This version (" + releaseNum + ") satisfies the current requirements (" + MIN_REQUIRED_NET_FRAMEWORK_RELNUM + ")");
NET_FRAMEWORK_IS_INSTALLED = true;
return true;
} else {
ModManager.debugLogger.writeError("This version (" + releaseNum + ") DOES NOT satisfy the current requirements (" + MIN_REQUIRED_NET_FRAMEWORK_RELNUM + ")");
NET_FRAMEWORK_IS_INSTALLED = false;
return false;
}
} catch (com.sun.jna.platform.win32.Win32Exception keynotfoundException) {
ModManager.debugLogger.writeError(".NET Framework 4.5 registry key was not found: " + netFrameWork4Key);
NET_FRAMEWORK_IS_INSTALLED = false;
return false;
} catch (Throwable e) {
ModManager.debugLogger.writeErrorWithException(".NET Framework 4.5 detection exception:", e);
NET_FRAMEWORK_IS_INSTALLED = false;
return false;
}
}
ModManager.debugLogger.writeError("This is not a windows OS. So obviously there is no registry. .NET is not installed");
NET_FRAMEWORK_IS_INSTALLED = false;
return false;
}
示例5: getGameStatus
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Returns the current game status from the Windows Registry.
* @return the current game status or <code>null</code> if some error occurs
*/
public static Integer getGameStatus() {
try {
return Advapi32Util.registryGetIntValue( WinReg.HKEY_CURRENT_USER, "Software\\Razer\\Starcraft2", "StartModule" );
} catch ( final Exception e ) {
// Silently ignore, do not print stack trace
return null;
}
}