Java Code Examples for com.sun.jna.platform.win32.Advapi32Util#registryDeleteValue()

The following examples show how to use com.sun.jna.platform.win32.Advapi32Util#registryDeleteValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalRegistryOperations.java    From ats-framework with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 2
Source File: ContextMenuTools.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
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);
    }
}