本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryDeleteValue方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryDeleteValue方法的具体用法?Java Advapi32Util.registryDeleteValue怎么用?Java Advapi32Util.registryDeleteValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.platform.win32.Advapi32Util
的用法示例。
在下文中一共展示了Advapi32Util.registryDeleteValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteKey
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
* Delete a registry key
*
* @param keyPath
* @param keyName
*/
@Override
public void deleteKey(
String rootKey,
String keyPath,
String keyName ) {
log.info("Delete key: " + getDescription(rootKey, keyPath, keyName));
try {
Advapi32Util.registryDeleteValue(getHKey(rootKey), keyPath, keyName);
} catch (RuntimeException re) {
throw new RegistryOperationsException("Couldn't delete registry key. "
+ getDescription(rootKey, keyPath, keyName), re);
}
}
示例2: uninstall
import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public void uninstall() throws DebuggableException {
File file = new File(winPath + "\\" + winFile);
if (file.exists()) {
file.delete();
}
file = new File(winPath + "\\" + verInfoFile);
if (file.exists()) {
file.delete();
}
file = new File(START_MENU_PATH + "\\osumer.lnk");
if (file.exists()) {
file.delete();
}
file = new File(START_MENU_PATH + "\\osumer (Start as Daemon).lnk");
if (file.exists()) {
file.delete();
}
try {
final String clientRegPath = WIN_REG_CLIENTS_PATH + "\\" + WIN_REG_INTERNET_CLIENT_KEY;
final String capRegPath = clientRegPath + "\\" + WIN_REG_CAP_KEY;
final String shellRegPath = clientRegPath + "\\" + WIN_REG_SHELL_KEY;
final String shellOpenRegPath = shellRegPath + "\\" + WIN_REG_SHELL_OPEN_KEY;
// Capabilities
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, capRegPath, WIN_REG_CAP_FILEASSOC_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, capRegPath, WIN_REG_CAP_URLASSOC_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, capRegPath, WIN_REG_CAP_STARTMENU_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, clientRegPath, WIN_REG_CAP_KEY);
// Shell open command
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, shellOpenRegPath, WIN_REG_SHELL_OPEN_COMMAND_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, shellRegPath, WIN_REG_SHELL_OPEN_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, clientRegPath, WIN_REG_SHELL_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, clientRegPath, WIN_REG_DEFAULTICON_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, clientRegPath, WIN_REG_INSTALLINFO_KEY);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, WIN_REG_CLIENTS_PATH,
WIN_REG_INTERNET_CLIENT_KEY);
// Classes and Registered applications
Advapi32Util.registryDeleteValue(WinReg.HKEY_LOCAL_MACHINE, WIN_REG_REGISTEREDAPPS_PATH,
WIN_REG_REGISTEREDAPPS_OSUMEREXPRESS_PARA);
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE,
WIN_REG_CLASSES_PATH + "\\" + WIN_REG_CLASSES_OSUMER_KEY + "\\shell\\open", "command");
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE,
WIN_REG_CLASSES_PATH + "\\" + WIN_REG_CLASSES_OSUMER_KEY + "\\shell", "open");
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE,
WIN_REG_CLASSES_PATH + "\\" + WIN_REG_CLASSES_OSUMER_KEY, "shell");
Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, WIN_REG_CLASSES_PATH, WIN_REG_CLASSES_OSUMER_KEY);
Advapi32Util.registryDeleteValue(WinReg.HKEY_LOCAL_MACHINE, WIN_REG_RUN_PATH, WIN_REG_RUN_OSUMERDAEMON_PARA);
} catch (Win32Exception e) {
e.printStackTrace();
throw new DebuggableException(null, "(Try&catch try) Writing to registry", "Throw debuggable exception",
"(End of function)", "Error writing registry", false, e);
}
}
示例3: 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);
}
}