本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registrySetIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registrySetIntValue方法的具体用法?Java Advapi32Util.registrySetIntValue怎么用?Java Advapi32Util.registrySetIntValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.platform.win32.Advapi32Util
的用法示例。
在下文中一共展示了Advapi32Util.registrySetIntValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setIntValue
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Applies a Integer(REG_DWORD) value on the specified key.
*
* The key will be created if does not exist.
* The key type will be changed if needed.
*
* @param keyPath
* @param keyName
* @param keyValue
*/
@Override
public void setIntValue(
String rootKey,
String keyPath,
String keyName,
int keyValue ) {
log.info("Set Intger value '" + keyValue + "' on: " + getDescription(rootKey, keyPath, keyName));
try {
Advapi32Util.registrySetIntValue(getHKey(rootKey), keyPath, keyName, keyValue);
} catch (RuntimeException re) {
throw new RegistryOperationsException("Couldn't set registry Integer value '" + keyValue
+ "' to: "
+ 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: 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);
}
}
示例4: 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);
}