Kopia gałęzi rejestru

0

Witam wszystkich,

Znacie może sposób na zrobienie kopii wybranej gałęzi rejestru łącznie z pod gałęziami i kluczami?

Pozdrawiam
Robert

0

szukales czy od razu pytasz na forum?

procedure EnableAllPrivileges;
var c1, c2 : dword;
   ptp    : PTokenPrivileges;
   i1     : integer;
begin
 if OpenProcessToken(windows.GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, c1) then
   try
     c2 := 0;
     GetTokenInformation(c1, TokenPrivileges, nil, 0, c2);
     if c2 <> 0 then begin
       ptp := AllocMem(c2);
       if GetTokenInformation(c1, TokenPrivileges, ptp, c2, c2) then begin
         for i1 := 0 to integer(ptp^.PrivilegeCount) - 1 do
           ptp^.Privileges[i1].Attributes := ptp^.Privileges[i1].Attributes or SE_PRIVILEGE_ENABLED;
         AdjustTokenPrivileges(c1, false, ptp^, c2, PTokenPrivileges(nil)^, cardinal(pointer(nil)^));
       end;
       FreeMem(ptp);
     end;
   finally CloseHandle(c1) end;
end;



procedure TForm1.Button1Click(Sender: TObject);
const
  sFileName = 'c:\temp\testt';
  sRegString = 'SYSTEM\CurrentControlSet\Services\lanmanserver\Shares';
var
  Reg: TRegistry;
begin
  if FileExists(sFilename) then begin
    //setfileattribute
    //FileSetAttr(sFilename, 0); // clear Read-Only and Hidden flags
    Deletefile(sFilename);
  end;

  EnableAllPrivileges;

  Reg := TRegistry.Create;
  try
    Reg.RootKey:=HKEY_LOCAL_MACHINE;
    if Reg.SaveKey(sRegString, sFileName) then begin
      Showmessage('Saved: ' + sFilename)
    end else begin
      Showmessage('NOT saved');
    end;
  finally
    Reg.Free;
  end;
end;
0

Dziękuję bardzo. Szukałem ale nie znalazłem dlatego zapytałem. Zanim to jednak zrobiłem przestudiowałem cały artykuł na ten temat.

Jeszcze raz dziękuję

Robert

1 użytkowników online, w tym zalogowanych: 0, gości: 1