/*
** Java native interface to the Windows Registry API.
**
** Authored by Timothy Gerard Endres
** <mailto:time@gjt.org> <http://www.trustice.com>
**
** This work has been placed into the public domain.
** You may use this work in any way and for any purpose you wish.
**
** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
** REDISTRIBUTION OF THIS SOFTWARE.
**
*/
package com.ice.jni.registry;
import java.io.*;
import java.util.*;
/**
* The Registry class provides is used to load the native
* library DLL, as well as a placeholder for the top level
* keys, error codes, and utility methods.
*
* @version 3.1.3
*
*/
public class
Registry
{
/**
* The following statics are the top level keys.
* Without these, there is no way to get "into"
* the registry, since the RegOpenSubkey() call
* requires an existing key which contains the
* subkey.
*/
public static RegistryKey HKEY_CLASSES_ROOT;
public static RegistryKey HKEY_CURRENT_USER;
public static RegistryKey HKEY_LOCAL_MACHINE;
public static RegistryKey HKEY_USERS;
public static RegistryKey HKEY_PERFORMANCE_DATA;
public static RegistryKey HKEY_CURRENT_CONFIG;
public static RegistryKey HKEY_DYN_DATA;
/**
* This is a key for ICE's testing purposes.
*/
private static RegistryKey HKEY_ICE_TESTKEY = null;
/**
* These are predefined keys ($0-$9) used to make the
* testing program easier to use (less typing).
*/
private static String[] preDefines;
/**
* These are the Registry API error codes, which can
* be returned via the RegistryException.
*/
public static final int ERROR_SUCCESS = 0;
public static final int ERROR_FILE_NOT_FOUND = 2;
public static final int ERROR_ACCESS_DENIED = 5;
public static final int ERROR_INVALID_HANDLE = 6;
public static final int ERROR_INVALID_PARAMETER = 87;
public static final int ERROR_CALL_NOT_IMPLEMENTED = 120;
public static final int ERROR_INSUFFICIENT_BUFFER = 122;
public static final int ERROR_LOCK_FAILED = 167;
public static final int ERROR_TRANSFER_TOO_LONG = 222;
public static final int ERROR_MORE_DATA = 234;
public static final int ERROR_NO_MORE_ITEMS = 259;
public static final int ERROR_BADDB = 1009;
public static final int ERROR_BADKEY = 1010;
public static final int ERROR_CANTOPEN = 1011;
public static final int ERROR_CANTREAD = 1012;
public static final int ERROR_CANTWRITE = 1013;
public static final int ERROR_REGISTRY_RECOVERED = 1014;
public static final int ERROR_REGISTRY_CORRUPT = 1015;
public static final int ERROR_REGISTRY_IO_FAILED = 1016;
public static final int ERROR_NOT_REGISTRY_FILE = 1017;
public static final int ERROR_KEY_DELETED = 1018;
/**
* These are used by dumpHex().
*/
private static final int ROW_BYTES = 16;
private static final int ROW_QTR1 = 3;
private static final int ROW_HALF = 7;
private static final int ROW_QTR2 = 11;
/**
* This is the last key used by the test program ($$).
*/
private static String saveKey = null;
/**
* This is a Hashtable which maps nams to the top level keys.
*/
private static Hashtable topLevelKeys = null;
/**
* If true, debug the fv parameters and computation.
*/
public boolean debugLevel;
/**
* Loads the DLL needed for the native methods, creates the
* toplevel keys, fills the hashtable that maps various names
* to the toplevel keys.
*/
static
{
try {
System.loadLibrary( "ICE_JNIRegistry" );
}
catch ( UnsatisfiedLinkError e )
{
System.err.println
( "ERROR You have not installed the DLL named '"
+ "ICE_JNIRegistry.DLL'.\n\t" + e.getMessage() );
}
catch ( SecurityException e )
{
System.err.println
( "ERROR You do not have permission to load the DLL named '"
+ "ICE_JNIRegistry.DLL'.\n\t" + e.getMessage() );
}
Registry.HKEY_CLASSES_ROOT =
new RegistryKey( 0x80000000, "HKEY_CLASSES_ROOT" );
Registry.HKEY_CURRENT_USER =
new RegistryKey( 0x80000001, "HKEY_CURRENT_USER" );
Registry.HKEY_LOCAL_MACHINE =
new RegistryKey( 0x80000002, "HKEY_LOCAL_MACHINE" );
Registry.HKEY_USERS =
new RegistryKey( 0x80000003, "HKEY_USERS" );
Registry.HKEY_PERFORMANCE_DATA =
new RegistryKey( 0x80000004, "HKEY_PERFORMANCE_DATA" );
Registry.HKEY_CURRENT_CONFIG =
new RegistryKey( 0x80000005, "HKEY_CURRENT_CONFIG" );
Registry.HKEY_DYN_DATA =
new RegistryKey( 0x80000006, "HKEY_DYN_DATA" );
Registry.topLevelKeys = new Hashtable( 16 );
topLevelKeys.put( "HKCR", Registry.HKEY_CLASSES_ROOT );
topLevelKeys.put( "HKEY_CLASSES_ROOT", Registry.HKEY_CLASSES_ROOT );
topLevelKeys.put( "HKCU", Registry.HKEY_CURRENT_USER );
topLevelKeys.put( "HKEY_CURRENT_USER", Registry.HKEY_CURRENT_USER );
topLevelKeys.put( "HKLM", Registry.HKEY_LOCAL_MACHINE );
topLevelKeys.put( "HKEY_LOCAL_MACHINE", Registry.HKEY_LOCAL_MACHINE );
topLevelKeys.put( "HKU", Registry.HKEY_USERS );
topLevelKeys.put( "HKUS", Registry.HKEY_USERS );
topLevelKeys.put( "HKEY_USERS", Registry.HKEY_USERS );
topLevelKeys.put( "HKPD", Registry.HKEY_PERFORMANCE_DATA );
topLevelKeys.put( "HKEY_PERFORMANCE_DATA", Registry.HKEY_PERFORMANCE_DATA );
topLevelKeys.put( "HKCC", Registry.HKEY_PERFORMANCE_DATA );
topLevelKeys.put( "HKEY_CURRENT_CONFIG", Registry.HKEY_PERFORMANCE_DATA );
topLevelKeys.put( "HKDD", Registry.HKEY_PERFORMANCE_DATA );
topLevelKeys.put( "HKEY_DYN_DATA", Registry.HKEY_PERFORMANCE_DATA );
}
/**
* Get a top level key by name using the top level key Hashtable.
*
* @param keyName The name of the top level key.
* @return The top level RegistryKey, or null if unknown keyName.
*
* @see topLevelKeys
*/
public static RegistryKey
getTopLevelKey( String keyName )
{
return (RegistryKey)
Registry.topLevelKeys.get( keyName );
}
/**
* Open a subkey of a given top level key.
*
* @param topKey The top level key containing the subkey.
* @param keyName The subkey's name.
* @param access The access flag for the newly opened key.
* @return The newly opened RegistryKey.
*
* @see RegistryKey
*/
public static RegistryKey
openSubkey( RegistryKey topKey, String keyName, int access )
{
RegistryKey subKey = null;
try { subKey = topKey.openSubKey( keyName, access ); }
catch ( NoSuchKeyException ex )
{
subKey = null;
}
catch ( RegistryException ex )
{
subKey = null;
}
return subKey;
}
/**
* Get the description of a Registry error code.
*
* @param errCode The error code from a RegistryException
* @return The description of the error code.
*/
public static String
getErrorMessage( int errCode )
{
switch ( errCode )
{
case ERROR_SUCCESS: return "success";
case ERROR_FILE_NOT_FOUND: return "key or value not found";
case ERROR_ACCESS_DENIED: return "access denied";
case ERROR_INVALID_HANDLE: return "invalid handle";
case ERROR_INVALID_PARAMETER: return "invalid parameter";
case ERROR_CALL_NOT_IMPLEMENTED: return "call not implemented";
case ERROR_INSUFFICIENT_BUFFER: return "insufficient buffer";
case ERROR_LOCK_FAILED: return "lock failed";
case ERROR_TRANSFER_TOO_LONG: return "transfer was too long";
case ERROR_MORE_DATA: return "more data buffer needed";
case ERROR_NO_MORE_ITEMS: return "no more items";
case ERROR_BADDB: return "bad database";
case ERROR_BADKEY: return "bad key";
case ERROR_CANTOPEN: return "can not open";
case ERROR_CANTREAD: return "can not read";
case ERROR_CANTWRITE: re
没有合适的资源?快使用搜索试试~ 我知道了~
最新java操作注册表的com.ice.jni.registry依赖压缩包
共62个文件
class:13个
java:11个
idb:4个
3星 · 超过75%的资源 需积分: 50 38 下载量 177 浏览量
2017-08-18
17:10:52
上传
评论
收藏 450KB RAR 举报
温馨提示
最新java操作注册表的com.ice.jni.registry依赖压缩包
资源推荐
资源详情
资源评论
收起资源包目录
registry-3.1.3.rar (62个子文件)
registry-3.1.3
bin
registry.jar 26KB
ICE_JNIRegistry.dll 64KB
source
windows
jniregistry.mdp 33KB
jniregistry.mak 7KB
jniregistry.bak 7KB
jniregistry.plg 1KB
jniregistry.001 4KB
RegistryKey.h 6KB
jniregistry.dsp 4KB
jniregistry.ncb 49KB
Debug
vc60.pdb 69KB
RegistryKey.obj 85KB
hs_err_pid1120.log 2KB
vc60.idb 41KB
ICE_JNIRegistry.ilk 306KB
ICE_JNIRegistry.lib 11KB
hs_err_pid2064.log 2KB
vc50.idb 33KB
ICE_JNIRegistry.dll 237KB
vc50.pdb 69KB
ICE_JNIRegistry.pdb 611KB
ICE_JNIRegistry.exp 6KB
RegistryKey.c 43KB
jniregistry.opt 48KB
RegistryKeyProto.h 3KB
Release
RegistryKey.obj 46KB
vc60.idb 33KB
ICE_JNIRegistry.lib 11KB
vc50.idb 33KB
ICE_JNIRegistry.dll 64KB
ICE_JNIRegistry.exp 6KB
jniregistry.dsw 545B
jniregistry.002 4KB
com
ice
jni
registry
RegMultiStringValue.java 3KB
META-INF
MANIFEST.MF 443B
NoSuchKeyException.java 1KB
RegBinaryValue.java 2KB
RegStringValue.java 2KB
Registry.java 33KB
RegistryException.java 2KB
RegDWordValue.java 2KB
NoSuchValueException.java 1KB
RegistryKey.java 17KB
doc
README.html 1KB
LICENSE 515B
License.html 694B
HexNumberFormat.java 4KB
build.xml 5KB
RegistryValue.java 4KB
doc
api
classes
com
ice
jni
registry
RegBinaryValue.class 2KB
RegistryValue.class 3KB
HexNumberFormat.class 3KB
RegMultiStringValue.class 3KB
NoSuchKeyException.class 820B
Registry.class 21KB
RegistryKey$RegistryKeyEnumerator.class 1KB
RegDWordValue.class 2KB
NoSuchValueException.class 828B
RegistryKey.class 5KB
RegistryException.class 1KB
RegistryKey$RegistryValueEnumerator.class 1KB
RegStringValue.class 2KB
共 62 条
- 1
资源评论
- liuqf2052019-02-19一个包需要3C币,太贵了
- jauddy2019-04-25下载了,试用下
bo602505401
- 粉丝: 11
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 毕业设计-仿生六足机器人的制作全教程源码+电子元器件+程序代码+线路组件图+安装教程+搭建视频教程
- 基于ROS和webots的xrobot机械臂仿真初探C++源码
- 基于ROS的点焊机器人仿真与控制python源码+文档说明+使用说明+详细注释
- 基于vue实现的细粒度交通时空大数据分析系统+源代码+文档说明
- 安卓大作业-基于Electron的交通时空大数据分析挖掘系统客户端(Android)+源代码+文档说明+界面截图
- 基于Java的朱氏集团客户关系管理系统设计源码
- 基于C++的作业提交与批改系统设计源码
- 基于Vue2的移动端电影资讯网站设计源码
- 高分课程设计作业-基于QT的模仿宝石迷阵游戏C++源码+文档说明+界面截图
- 基于Apache Spark的Spark DistCP重实现设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功