elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  como crear un punto de restauracion desde bv6?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: como crear un punto de restauracion desde bv6?  (Leído 2,903 veces)
guidosl

Desconectado Desconectado

Mensajes: 75


Ver Perfil
como crear un punto de restauracion desde bv6?
« en: 2 Abril 2009, 17:03 pm »

como crear un punto de restauracion instantaneo???

esto es en .vbs por si alguien sabe como pasarlo a vb6

rp = “Scripted Restore Point by “ & WScript.ScriptName GetObject(“winmgmts:.rootdefault:Systemrestore”).CreateRestorePoint rp, 0, 100

gracias


En línea

guidosl

Desconectado Desconectado

Mensajes: 75


Ver Perfil
Re: como crear un punto de restauracion desde bv6?
« Respuesta #1 en: 2 Abril 2009, 18:44 pm »

el script anterior no me funciona

este si: Como lo puedo pasar a bv6???




If GetOS = "Windows XP" Then
   CreateSRP
End If

If GetOS = "Windows Vista" Or GetOS = "Windows 7" Then
   If WScript.Argume nts.length =0 Then
        Set objShell = CreateObject("Shell.Applicat ion")
      objShell.ShellExecute "wscript.exe", """" & _
          WScript.Script FullName & """" & " uac","", "runas", 1
   Else
        CreateSRP
     End If
End If

Sub CreateSRP
   Set SRP = getobject("winmgmts:\\.\root\default:Systemrestore")
   sDesc = "Manual Restore Point"
   sDesc = InputBox ("Enter a description.", "System Restore script : winhelponline. com","Manual Restore Point")
   If Trim(sDesc) <> "" Then
      sOut = SRP.createrest orepoint (sDesc, 0, 100)
      If sOut <> 0 Then
          WScript.echo "Error " & sOut & _
            ": Unable to create Restore Point."
      End If
   End If
End Sub

Function GetOS   
    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
       ".\root\cimv2")
    Set colOS = objWMI.ExecQue ry("Select * from Win32_Operatin gSystem")
    For Each objOS in colOS
        If instr(objOS.Caption, "Windows 7") Then
           GetOS = "Windows 7"   
        ElseIf instr(objOS.Caption, "Vista") Then
           GetOS = "Windows Vista"
        elseIf instr(objOS.Caption, "Windows XP") Then
            GetOS = "Windows XP"
        End If
   Next
End Function


En línea

XcryptOR

Desconectado Desconectado

Mensajes: 228



Ver Perfil
Re: como crear un punto de restauracion desde bv6?
« Respuesta #2 en: 2 Abril 2009, 18:51 pm »

Asi se lo hace sin usar WMI, el código es de Syntax_err

Código
  1. Private Const BEGIN_SYSTEM_CHANGE = 100
  2. Private Const END_SYSTEM_CHANGE = 101
  3.  
  4. Private Const APPLICATION_INSTALL = 0
  5.  
  6. Private Const MAX_DESC = 64
  7.  
  8.  
  9. Private Type PRESTOREPOINTINFOA
  10.    dwEventType As Long
  11.    dwRestorePtType As Long
  12.    llSequenceNumber As Long
  13.    szDescription As String * MAX_DESC
  14. End Type
  15.  
  16. Private Type PSTATEMGRSTATUS
  17.    nStatus As Long
  18.    llSequenceNumber  As Long
  19. End Type
  20.  
  21. Private Declare Function SRSetRestorePointA Lib "srclient" (ByRef pRestorePtSpec As PRESTOREPOINTINFOA, ByRef pSMgrStatus As PSTATEMGRSTATUS) As Boolean
  22. Declare Function lstrcpyA Lib "kernel32" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
  23.  
  24. Sub main()
  25.  
  26.   Dim RestPtInfo As PRESTOREPOINTINFOA
  27.   Dim SMGRSTATUS As PSTATEMGRSTATUS
  28.  
  29.   '// Inicializa la estructura RESTOREPOINTINFO
  30.   RestPtInfo.dwEventType = BEGIN_SYSTEM_CHANGE
  31.  
  32.   '// Notifica al sistema los cambios que se hacen.
  33.   '// una instalacion esta en proceso.
  34.   RestPtInfo.dwRestorePtType = APPLICATION_INSTALL
  35.  
  36.   '// setea RestPtInfo.llSequenceNumber.
  37.   RestPtInfo.llSequenceNumber = 0
  38.  
  39.   '// Nombre que se le dara al punto de restauración.
  40.   RestPtInfo.szDescription = String(4, Chr(0)) & "Elhacker Restore Point" & Chr(0)
  41.  
  42.  
  43.  
  44.   If Not SRSetRestorePointA(RestPtInfo, SMGRSTATUS) Then
  45.    Debug.Print "Couldn't set the beginning of the restore point."
  46.   End If
  47.  
  48.   '// la aplicacion lleva a cabo algunos procesos aqui
  49.    FileCopy "c:\windows\notepad.exe", "c:\1.txt"
  50.   '// re-inicializa la estructura RESTOREPOINTINFO para notificar al sistema que la operacion termino
  51.  
  52.   RestPtInfo.dwEventType = END_SYSTEM_CHANGE
  53.  
  54.   '// los cambios en el sistema terminan al recibir el resultado de la llamada a SRSetRestorePoint.
  55.   RestPtInfo.llSequenceNumber = SMGRSTATUS.llSequenceNumber
  56.  
  57.   '// Notifica al sistema que la creación del punto de restauracion ha sido exitosa
  58.   If Not SRSetRestorePointA(RestPtInfo, SMGRSTATUS) Then Debug.Print "Couldn't set the end of the restore point."
  59.  
  60. End Sub
  61.  
En línea



guidosl

Desconectado Desconectado

Mensajes: 75


Ver Perfil
Re: como crear un punto de restauracion desde bv6?
« Respuesta #3 en: 3 Abril 2009, 00:32 am »

gracias me va perfecto

pero tengo una duda...que datos son los que guarda en a.txt??

y como puedo poner para que se muestre un msjbox si se creo correctamente o si hubo error?


mil gracias
En línea

seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: como crear un punto de restauracion desde bv6?
« Respuesta #4 en: 3 Abril 2009, 01:35 am »

si lees el codigo hasta esta comentado cuando se crea correctamente y cuando no...
En línea

guidosl

Desconectado Desconectado

Mensajes: 75


Ver Perfil
Re: como crear un punto de restauracion desde bv6?
« Respuesta #5 en: 4 Abril 2009, 00:33 am »

muchas gracias
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines