如何使用RegLoadKey函数从默认用户加载NTUSER.DAT文件? [英] How to use the RegLoadKey function to load the NTUSER.DAT file from the Default User?
问题描述
我以为我可以使用RegLoadKey来加载位于C:\ Users \ Default文件夹中的NTUSER.DAT文件:
I thought I could use the RegLoadKey to load the NTUSER.DAT file located in the C:\Users\Default folder by using this code:
HKEY hKey = HKEY_LOCAL_MACHINE;
LPCTSTR lpSubKey = L"software\\Load";
LPCTSTR lpFile = L"C:\\Users\\Default\\NTUSER";
long R=RegLoadKey(hKey, lpSubKey, lpFile);
没有用。任何人都可以告诉我如何使用此功能将 NTUSER.DAT 文件加载到 HKLM \ Software \Load 子键中?
It did not work. Can anyone tell me how I have to use this function to load the NTUSER.DAT file into the HKLM\Software\Load sub-key?
谢谢!
推荐答案
由于@Xearinox提到你需要privilages SE_BACKUP_NAME
和 SE_RESTORE_NAME
)
As @Xearinox mentioned you need privilages (SE_BACKUP_NAME
and SE_RESTORE_NAME
)
code> NTUSER.DAT ,否则您创建新的注册表配置单元。并且 lpSubKey
只能在 hKey
之后的第一个级别。
Also you must load NTUSER.DAT
, otherwise you create new registry hive. And lpSubKey
only can be first level after hKey
.
所以你应该设置privilages并像这样加载:
So you should set privilages and load it like this:
long ret = RegLoadKey(HKEY_LOCAL_MACHINE, L"LOAD", L"C:\\Users\\Default\\NTUSER.DAT");
这篇关于如何使用RegLoadKey函数从默认用户加载NTUSER.DAT文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!