Insufficient privilage when call RegLoadKey

G

Guest

Hi,

I log in as a administrator, then compile and run the following code on a
computer:

#include "stdafx.h"
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
long l = ::RegLoadKey(HKEY_USERS,L"XXXX",L"D:\\NTUSER.DAT");
return 0;
}

I get a 1314(A required privilege is not held by the client ) error when
call RegLoadKey, but i am an administrator!!! What the hell?

Thanks in advance
-Joe
 
D

David Lowndes

I log in as a administrator, then compile and run the following code on a
computer:

#include "stdafx.h"
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
long l = ::RegLoadKey(HKEY_USERS,L"XXXX",L"D:\\NTUSER.DAT");
return 0;
}

I get a 1314(A required privilege is not held by the client ) error when
call RegLoadKey, but i am an administrator!!! What the hell?

Joe,

The documentation notes:

"The calling process must have the SE_RESTORE_NAME and SE_BACKUP_NAME
privileges on the computer in which the registry resides. For more
information, see Running with Special Privileges. To load a hive
without requiring these special privileges, use the RegLoadAppKey
function.
"

Just because you're an admin account doesn't necessarily mean that you
have those privileges.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top