I'm trying to save the contents of a particular registry key to a file using the RegSaveKey() API:
HKEY key;
LRESULT result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\MyProduct", 0, KEY_ACCESS_ALL, &key);
result = RegSaveKey(key, L"c:\\temp\\saved.reg", NULL);
However, RegSaveKey() is returning ERROR_PRIVILEGE_NOT_HELD
. The SDK documentation says that "The calling process must have the SE_BACKUP_NAME
privilege enabled". The process is running as either a local administrator or as a service.
Any ideas?