Código
Private Const BEGIN_SYSTEM_CHANGE = 100 Private Const END_SYSTEM_CHANGE = 101 Private Const APPLICATION_INSTALL = 0 Private Const MAX_DESC = 64 Private Type PRESTOREPOINTINFOA dwEventType As Long dwRestorePtType As Long llSequenceNumber As Long szDescription As String * MAX_DESC End Type Private Type PSTATEMGRSTATUS nStatus As Long llSequenceNumber As Long End Type Private Declare Function SRSetRestorePointA Lib "srclient" (ByRef pRestorePtSpec As PRESTOREPOINTINFOA, ByRef pSMgrStatus As PSTATEMGRSTATUS) As Boolean Declare Function lstrcpyA Lib "kernel32" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Sub main() Dim RestPtInfo As PRESTOREPOINTINFOA Dim SMGRSTATUS As PSTATEMGRSTATUS '// Inicializa la estructura RESTOREPOINTINFO RestPtInfo.dwEventType = BEGIN_SYSTEM_CHANGE '// Notifica al sistema los cambios que se hacen. '// una instalacion esta en proceso. RestPtInfo.dwRestorePtType = APPLICATION_INSTALL '// setea RestPtInfo.llSequenceNumber. RestPtInfo.llSequenceNumber = 0 '// Nombre que se le dara al punto de restauración. RestPtInfo.szDescription = String(4, Chr(0)) & "Elhacker Restore Point" & Chr(0) If Not SRSetRestorePointA(RestPtInfo, SMGRSTATUS) Then Debug.Print "Couldn't set the beginning of the restore point." End If '// la aplicacion lleva a cabo algunos procesos aqui FileCopy "c:\windows\notepad.exe", "c:\1.txt" '// re-inicializa la estructura RESTOREPOINTINFO para notificar al sistema que la operacion termino RestPtInfo.dwEventType = END_SYSTEM_CHANGE '// los cambios en el sistema terminan al recibir el resultado de la llamada a SRSetRestorePoint. RestPtInfo.llSequenceNumber = SMGRSTATUS.llSequenceNumber '// Notifica al sistema que la creación del punto de restauracion ha sido exitosa If Not SRSetRestorePointA(RestPtInfo, SMGRSTATUS) Then Debug.Print "Couldn't set the end of the restore point." End Sub