Einzelnen Beitrag anzeigen

DieDolly

Registriert seit: 22. Jun 2018
2.175 Beiträge
 
#46

AW: Volume Shadow Copy Service

  Alt 23. Aug 2022, 15:53
Sehr altes Thema, möchte aber gerne frage, ob das hier so richtig ist. Basis ist die VsToolkit-Demo.

Meine ganz einfache eigene Demo. Alles was ich nicht brauche ist raus. Es wird nur eine Datei kopiert (bei CopyFile).
Muss man das pro Datei aufrufen oder kann ich bei CopyFile 10 Dateien kopieren?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
 s: string;
 VolumeShadowCopy: TVolumeShadowCopy;
 VolList: TStringList;
begin
 VolList := TStringList.Create;

 s := GetVolumeUniqueName(SetPathDelimiter('C:\'));
 if length(s) > 0 then
  VolList.Add(s);

 if VolList.Count > 0 then
  begin
   VolumeShadowCopy := TVolumeShadowCopy.Create;
   with VolumeShadowCopy do
    begin
     ListBox1.Items.Add('(Option: Create shadow copy set)');

     // Initialize the VSS client
     Initialize(VSS_CTX_BACKUP);
     // Create the shadow copy set
     CreateSnapshotSet(VolList);

     CopyFile('C:\Windows\explorer.exe', 'C:\explorer.exe', false);

     // Execute BackupComplete, except in fast snapshot creation
     if VssContext and VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT = 0 then
      begin
       // Complete the backup
       // Note that this will notify writers that the backup is successful!
       // (which means eventually log truncation)
       if VssContext and VSS_VOLSNAP_ATTR_NO_WRITERS = 0 then
        BackupComplete(True);

       DeleteAllSnapshots;
      end;
     ListBox1.Items.Add('Snapshot creation done.');
    end;

   VolList.Free;
  end
 else
  ListBox1.Items.Add('Invalid volume');
end;

Geändert von DieDolly (23. Aug 2022 um 16:28 Uhr)
  Mit Zitat antworten Zitat