LONG RegCreateKeyEx( //创建
HKEY hKey, // handle to open key
LPCTSTR lpSubKey, // subkey name,不能以"/"开头
DWORD Reserved, // reserved,必须为0
LPTSTR lpClass, // class string,应用程序通常为NULL
DWORD dwOptions, // special options
REGSAM samDesired, // desired security access
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // inheritance,继承性,NULL为不能被继承
PHKEY phkResult, // key handle ,返回子键的句柄指针
LPDWORD lpdwDisposition // disposition value buffer
);
dwOptions取值:1、REG_OPTION_NON_VOLATILE子键稳定,保存在文件中;2、REG_OPTION_VOLATILE子键不稳,存在内存中;3、REG_OPTION_BACKUP_RESTORE该参数就使samDesired被忽略。
samDesired:指明对被创建子键的存取权限!1、KEY_CREATE_LINK Permission to create a symbolic link.2、
KEY_CREATE_SUB_KEY Permission to create subkeys. 3、KEY_ENUMERATE_SUB_KEYS Permission to enumerate subkeys. 4、KEY_EXECUTE Permission for read access. 5、KEY_NOTIFY Permission for change notification. 6、KEY_QUERY_VALUE Permission to query subkey data. 7、KEY_SET_VALUE Permission to set subkey data. 8、KEY_ALL_ACCESS 包括以上所有值的组合 9、KEY_READ Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY access rights. 10、KEY_WOW64_64KEY Windows XP: Enables a 64- or 32-bit application to open a 64-bit key. 11、KEY_WOW64_32KEY Windows XP: Enables a 64- or 32-bit application to open a 32-bit key. 12、KEY_WRITE Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, and KEY_CREATE_SUB_KEY access rights.
HKEY hKey , // handle to open key
LPCTSTR lpSubKey , // subkey name
DWORD ulOptions , // reserved,
REGSAM samDesired , // security access mask
PHKEY phkResult // handle to open key );
LONG RegDeleteKey( //删除没有子键的键
HKEY hKey, // handle to open key
LPCTSTR lpSubKey // subkey name
);
DWORD SHDeleteKey( //可删除有子键的键
HKEY hkey,
LPCTSTR pszSubKey
);
LONG RegCloseKey( //关闭
HKEY hKey // handle to key to close
);
LONG RegSetValueEx( //为某键设置键
HKEY hKey, // handle to key
LPCTSTR lpValueName, // value name
DWORD Reserved, // reserved
DWORD dwType, // value type
CONST BYTE *lpData, // value data
DWORD cbData // size of value data
);
LONG RegQueryValueEx( //获取某个键值
HKEY hKey, // handle to key
LPCTSTR lpValueName, // value name
LPDWORD lpReserved, // reserved
LPDWORD lpType, // type buffer
LPBYTE lpData, // data buffer
LPDWORD lpcbData // size of data buffer);
LONG RegDeleteValue( //删除键值
HKEY hKey, // handle to key
LPCTSTR lpValueName // value name);
LONG RegEnumValue( //枚举注册表键值
HKEY hKey, // handle to key to query DWORD dwIndex, // index of value to query LPTSTR lpValueName, // value buffer
LPDWORD lpcValueName, // size of value buffer
LPDWORD lpReserved, // reserved
LPDWORD lpType, // type buffer
LPBYTE lpData, // data buffer,返回被列举的键值对应的数据内容,是一个BYTE*类型参数
LPDWORD lpcbData // size of data buffer);
LONG RegQueryInfoKey( //注册表键的信息
HKEY hKey, // handle to key
LPTSTR lpClass, // class buffer
LPDWORD lpcClass, // size of class buffer
LPDWORD lpReserved, // reserved
LPDWORD lpcSubKeys, // number of subkeys
LPDWORD lpcMaxSubKeyLen, // longest subkey name
LPDWORD lpcMaxClassLen, // longest class string
LPDWORD lpcValues, // number of value entries,该键对应的键值数量
LPDWORD lpcMaxValueNameLen, // longest value name
LPDWORD lpcMaxValueLen, // longest value data
LPDWORD lpcbSecurityDescriptor, // descriptor length
PFILETIME lpftLastWriteTime // last write time
);
有些参数可选值太多了,还是在用的时候查吧!