1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
procedure TForm1.mnuCreateSysRestoreClick(Sender: TObject);
// Crée et annule un point de restauration en cas d'erreur
procedure Affiche(Texte:String);
begin
StatusBar1.Panels[2].text := Texte+' Données du point de restauration :' + crlf +
'Numéro de séquence : ' + Format('%d', [SMgrStatus.llSequenceNumber]) + crlf +
'Statut: ' + Format('%u', [SMgrStatus.nStatus])
end;
begin
// Initialise l'enregistrement
InfoPointRestauration.dwEventType := BEGIN_SYSTEM_CHANGE;
InfoPointRestauration.dwRestorePtType := APPLICATION_INSTALL;
InfoPointRestauration.llSequenceNumber := 0;
{C'est ici ! Réussir : InfoPointRestauration.szDescription := RestoreName;
RestoreName := InputBox('Point de restauration', 'Entrez un nom', 'Nouveau point de restauration'); }
InfoPointRestauration.szDescription := 'Nouveau point de restauration';
if (SRSetRestorePointA(@InfoPointRestauration, @SMgrStatus)) then
begin
Affiche('Configure le point de restauration.');
// Configuration pour annuler le point de restauration précédent.
InfoPointRestauration.dwEventType := END_SYSTEM_CHANGE;
{Pour annuler le point de restauration actuel:}
//InfoPointRestauration.dwRestorePtType := CANCELLED_OPERATION;
// Termine les modifications systéme en passant le numéro de séquence
// recu lors du premier appel à l'API SRSetRestorePoint.
InfoPointRestauration.llSequenceNumber := SMgrStatus.llSequenceNumber;
// Notifie le système que les modifications sont terminée et
// que c'est la fin du point de restauration.
if not SRSetRestorePointA(@InfoPointRestauration, @SMgrStatus) then
begin
Affiche('Ne peut pas positionner la fin du point de restauration.');
Exit;
end
end;
end; |
Partager