c++winapisystem-restorerestore-points

How to enumerate system restore points using WinAPI (not WMI)?


Must work for WinXp - Vista - Windows 7


Solution

  • After having a short look at the available documentation it seems that there is no way around WMI if you want to list existing restore points.

    The Windows API only offers you functions for setting and removing restore points:

    MSDN also has samples how to use these methods.

    For listing the existing restore points you can use the VBScript sample code from here (Note that the code needs elevation on Vista and above):

    Set RPSet = GetObject("winmgmts:root/default").InstancesOf ("SystemRestore")
    for each RP in RPSet
        wscript.Echo "Dir: RP" & RP.SequenceNumber & ", Name: " & RP.Description & ", Type: ", RP.RestorePointType & ", Time: " & RP.CreationTime
    next