注册表API应用的问题!
1.RegLoadKey
函数原型
LONG RegLoadKey(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey,
// address of name of subkey
LPCTSTR lpFile // address of filename for registry information
);
lpSubKey只能为".."而不能为"..\\..",且子键原来不能存在。
加载后的子键好象只驻留在内存中,重启后就不存在了。
2.RegReplaceKey
函数原型:
LONG RegReplaceKey(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey, // address of name of subkey
LPCTSTR lpNewFile, // address of filename for file with new data
LPCTSTR lpOldFile // address of filename for backup file
);
加载成功,重启后注册表无变化!!!
且子键只能为根目录下一层,如HKEY_LOCAL_MACHINE\Software,如果再下就有问题了,
错误为ERROR_INVALID_PARAMETER 。