注册表操作的几个windows api
(转自:http://blog.sina.com.cn/s/blog_4e66c6cd01000bcu.html)
RegCloseKey():关闭注册表键释放句柄。
RegCloseKey(ByVal hKey As Long)
参数:hKey--根键(或子键)句柄
返回值:=0 成功 ≠0 失败
RegCreateKey():打开指定的注册表键,如果该键不存在则试图建立。
RegCreateKey(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long)
参数:hKey--根键句柄 lpSubKey--子键的名称或路径
phkResult--若执行成功则该参数返回子键的句柄
返回值:=0 成功 ≠0 失败
RegCreateKeyEx():同RegCreateKey()。
RegCreateKeyEx(ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long)
RegDeleteKey():删除注册表键,但不能删除根键。
RegDeleteKey(ByVal hKey As Long, ByVal lpSubKey As String)
参数:hKey--键句柄 lpSubKey--子键名称或路径,如为""则删除hKey键
返回值:=0 成功 ≠0 失败
RegDeleteKeyEx():同RegDeleteKeyEx()
RegOpenKey():获得注册表根键下子键的句柄。
RegOpenKey(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long)
参数:hKey--根键句柄 lpSubKey--子键的名称或路径
phkResult--若执行成功则该参数返回子键的句柄
返回值:=0 成功 ≠0 失败
RegOpenKeyEx():同RegOpenKey()
RegOpenKeyEx(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long)
值管理类:
LONG RegQueryValueEx(
HKEY hKey, // 已打开的键的句柄
LPTSTR lpValueName, // 要查询值的名称,传如""为查询键下的默认值
LPDWORD lpReserved, // 保留,为0
LPDWORD lpType, // 查询的类型
LPBYTE lpData, // 数据存放的地址
LPDWORD lpcbData // 数据长度+1
);
RegQueryValue() 与以上类似
LONG RegSetValueEx(
HKEY hKey, // 已打开的键的句柄
LPCTSTR lpValueName, // 要查询值的名称,传如""为查询键下的默认值
DWORD Reserved, // 保留
DWORD dwType, // 变量的类型
CONST BYTE *lpData, // 变量数据的地址
DWORD cbData // 变量的长度
);
RegSetValue() 与以上类似
LONG RegDeleteValue(
HKEY hKey, // 要删除的键的句柄
LPCTSTR lpValueName // 要删除的名称
);
LONG RegEnumValue(
HKEY hKey, // 要查询的已打开的键的句柄
DWORD dwIndex, // 读取名称的索引号
LPTSTR lpValueName, // 返回所读取的名称
LPDWORD lpcbValueName, // 返回读取名称的长度,不含chr(0)
LPDWORD lpReserved, // 保留,为0
LPDWORD lpType, // 返回所读取的数据类型
LPBYTE lpData, // 返回所读取的数据` LPDWORD lpcbData // 返回所读取的数据长度
);
RegEnumKeyEx(
HKEY hKey, // 要列举的键的句柄
DWORD dwIndex, // 索引
LPTSTR lpName, // 子键的名称
LPDWORD lpcbName, // 子键名称的长度
LPDWORD lpReserved, // 保留
LPTSTR lpClass, // address of buffer for class string
LPDWORD lpcbClass, // address for size of class buffer
PFILETIME lpftLastWriteTime // address for time key last written to
);
RegEnumKey()与上类似LONG RegQueryInfoKey(
HKEY hKey, // 已打开的键的句柄
LPTSTR lpClass, // 类型名称,仅使用于NT。若不使用则传入Null
LPDWORD lpcbClass, // 类型名称的长度
LPDWORD lpReserved, // 保留
LPDWORD lpcSubKeys, // 返回子键的数目
LPDWORD lpcbMaxSubKeyLen, // 返回最长的子键长度
LPDWORD lpcbMaxClassLen, // 返回最长的类长度
LPDWORD lpcValues, // 返回值的数目
LPDWORD lpcbMaxValueNameLen, // 返回最长的值项名称的长度
LPDWORD lpcbMaxValueLen, // 返回最长的值的长度
LPDWORD lpcbSecurityDescriptor, //返回安全描述,仅适用于 NT
PFILETIME lpftLastWriteTime // 返回键最后被写入的时间,仅适用于 NT
);LONG RegLoadKey(
HKEY hKey, // 打开的句柄
LPCTSTR lpSubKey, //子键的路径
LPCTSTR lpFile // 要写入注册表信息的文件
); LONG RegReplaceKey(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey, // address of name of subkey
LPCTSTR lpNewFile, // 在替换前生成新的备份文件
LPCTSTR lpOldFile // 需要覆盖上注册表的文件
);HKEY hKey, // 要保存的句柄
LPCTSTR lpFile, // 保存子键的文件
LPSECURITY_ATTRIBUTES lpSecurityAttributes //不太懂(大概是与安全有关的属性设置)
);
LONG RegConnectRegistry(
LPTSTR lpMachineName, //远程计算机的名称
HKEY hKey, // 预先注册的句柄
PHKEY phkResult // 远程计算机上的句柄
);
LONG RegUnLoadKey(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey // address of name of subkey to unload
);
LONG RegNotifyChangeKeyValue(
HKEY hKey, // 要监视的一个项的句柄
BOOL bWatchSubtree, // 是否监视此项的子键
DWORD dwNotifyFilter, // 监视哪些变化
HANDLE hEvent, // 接受注册表变化事件的事件对象句柄
BOOL fAsynchronous // 注册表变化前报告还是注册表变化后才报告
);
LONG RegRestoreKey(
HKEY hKey, // handle to key where restore begins
LPCTSTR lpFile, // registry file
DWORD dwFlags // options
);
LONG RegSetKeySecurity( HKEY hKey, // handle to key
SECURITY_INFORMATION SecurityInformation // request
PSECURITY_DESCRIPTOR pSecurityDescriptor // SD
);
LONG RegGetKeySecurity(
HKEY hKey, // handle to key
SECURITY_INFORMATION SecurityInformation, // request
PSECURITY_DESCRIPTOR pSecurityDescriptor, // SD
LPDWORD lpcbSecurityDescriptor // buffer size
);
注册表操作的几个windows api的更多相关文章
- Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理
Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理 1. reg 工具 这个cli工具接口有,优先使用,jreg的要调用dll了,麻烦的 ...
- 《天书夜读:从汇编语言到windows内核编程》八 文件操作与注册表操作
1)Windows运用程序的文件与注册表操作进入R0层之后,都有对应的内核函数实现.在windows内核中,无论打开的是文件.注册表或者设备,都需要使用InitializeObjectAttribut ...
- delphi 注册表操作(读取、添加、删除、修改)完全手册
DELPHI VS PASCAL(87) 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创建和释放TRegistry对象 1.创建TRegistry对象.为了操 ...
- Delphi的注册表操作
转帖:Delphi的注册表操作 2009-12-21 11:12:52 分类: Delphi的注册表操作 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创 ...
- QSettings配置读写-win注册表操作-ini文件读写
版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QSettings配置读写-win注册表操作-ini文件读写 本文地址:http:// ...
- CRegKey 注册表操作
CRegKey 注册表操作 标签: accessnulluserpathbyteie 2011-11-03 13:55 3477人阅读 评论(0) 收藏 举报 分类: win32(7) 1.简介 ...
- C#注册表操作类--完整优化版
using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; namespace ...
- C#注册表操作类(完整版) 整理完整
/// <summary> /// 注册表基项静态域 /// /// 主要包括: /// 1.Registry.ClassesRoot 对应于HKEY_CLASSES_ROOT主键 /// ...
- 注册表操作 Microsoft.Win32.Registry与RegistryKey类
一.注册表操作简介 Registry 类,RegistryKey 类提供了操作注册表的接口 RegistryValueKind:用于指定操作注册表的数据类型 一.注册表巢 在注册表中,最上面的节点是注 ...
随机推荐
- boost shared_ptr weak_ptr
文档: http://www.boost.org/doc/libs/1_57_0/libs/smart_ptr/shared_ptr.htm shared_ptr构造有个原型 template< ...
- StringBuilder String string.Concat 字符串拼接速度
首先看测试代码: public class StringSpeedTest { "; public string StringAdd(int count) { string str = st ...
- 集成ssm+shiro出现的 问题
1.springmvc-servlet.xml .applicationContext.xml该如何配置include和exclude?,目前的做法是将.applicationContext.xml全 ...
- PAT 天梯赛 L1-019. 谁先倒 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-019 AC代码 #include <iostream> #include <cstdio&g ...
- Flume1.7.0概述
Flume概述 常见的开源数据收集系统有: 非结构数据(日志)收集 Flume 结构化数据收集(传统数据库与 Hadoop 同步) Sqoop:全量导入 Canal(alibaba):增量导入 Dat ...
- JavaScript判断对象 是什么类型的.
// 这种方法不起作用 if (x == undefined) { // 作某些操作 } // 这个方法同样不起作用- if (typeof(x) == undefined) { // 作某些 ...
- Zabbix 自定义Key
系统:Linux Centos 7.4 x64.Windos 2008 x64 服务:Zabbix 3.0.16 说明1:自定义Key 主要通过自定义 脚本 或者 命令 来实现自定义监控类型,需要在a ...
- Centos6.5安装python2.7与pip
安装Python2.7 安装环境 [root@localhost1 ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@local ...
- 用“倍增法”求最近公共祖先(LCA)
1.最近公共祖先:对于有根树T的两个结点u.v,最近公共祖先LCA(T,u,v)表示一个结点x,满足x是u.的祖先且x的深度尽可能大. 2.朴素算法:记录下每个节点的父亲,使节点u,v一步一步地向上找 ...
- [洛谷3041]视频游戏的连击Video Game Combos
题目描述 Bessie is playing a video game! In the game, the three letters 'A', 'B', and 'C' are the only v ...