I’m use reg->SaveKey(“Software”, “D:\1.reg”). But getting empty file, without data.
void __fastcall TForm1::Button2Click(TObject *Sender)
{
TRegistry *reg=new TRegistry(KEY_READ);
reg->RootKey=HKEY_LOCAL_MACHINE;
reg->OpenKey("Software",0);;
reg->SaveKey("Software","D:\\1.reg");
delete reg;
}
SaveKeyis a loose wrapper aroundRegSaveKey(), the documentation of which states:User tokens do not normally have the
SE_BACKUP_NAMEprivilege enabled. In order to meet this requirement you need to:SE_BACKUP_NAMEprivilege to your user token.The other requirement you must adhere to is that the output file must not exist before you call
SaveKey.See this EDN article for C++ code illustrating the method.