当前位置: 首页>>代码示例>>Java>>正文


Java Advapi32Util.registryCreateKey方法代码示例

本文整理汇总了Java中com.sun.jna.platform.win32.Advapi32Util.registryCreateKey方法的典型用法代码示例。如果您正苦于以下问题:Java Advapi32Util.registryCreateKey方法的具体用法?Java Advapi32Util.registryCreateKey怎么用?Java Advapi32Util.registryCreateKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.platform.win32.Advapi32Util的用法示例。


在下文中一共展示了Advapi32Util.registryCreateKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPath

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
/**
 * Creates path in the registry.
 *
 * Will fail if the path exists already.
 *
 * If want to create a nested path(for example "Software\\MyCompany\\MyApplication\\Configuration"),
 * it is needed to call this method for each path token(first for "Software\\MyCompany", then for "Software\\MyCompany\\MyApplication" etc)
 *
 * @param keyPath
 */
@Override
public void createPath(
                        String rootKey,
                        String keyPath ) {

    log.info("Create regestry key path: " + getDescription(rootKey, keyPath, null));

    int index = keyPath.lastIndexOf("\\");
    if (index < 1) {
        throw new RegistryOperationsException("Invalid path '" + keyPath + "'");
    }

    String keyParentPath = keyPath.substring(0, index);
    String keyName = keyPath.substring(index + 1);

    checkPathDoesNotExist(rootKey, keyPath);

    try {
        Advapi32Util.registryCreateKey(getHKey(rootKey), keyParentPath, keyName);
    } catch (RuntimeException re) {
        throw new RegistryOperationsException("Couldn't create registry key. "
                                              + getDescription(rootKey, keyPath, keyName), re);
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:35,代码来源:LocalRegistryOperations.java

示例2: 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);
    }

}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:14,代码来源:UsbWriteBlock.java

示例3: createRootRegistryFolder

import com.sun.jna.platform.win32.Advapi32Util; //导入方法依赖的package包/类
public static void createRootRegistryFolder(String path) throws RegistryCanNotWriteInfoException {
    if (!Advapi32Util.registryKeyExists(APP_ROOT_HKEY, path)) {
        try {
            Advapi32Util.registryCreateKey(APP_ROOT_HKEY, path);
        } catch (Win32Exception e) {
            throw new RegistryCanNotWriteInfoException("Can not create root folder on registry.", e);
        }
    }
}
 
开发者ID:benchdoos,项目名称:WeblocOpener,代码行数:10,代码来源:RegistryManager.java


注:本文中的com.sun.jna.platform.win32.Advapi32Util.registryCreateKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。