Exemplo n.º 1
0
        public bool CreateRestorePoint(string RPName)
        {
            try
            {
                RegistryKey SystemRestoreKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", true);
                SystemRestoreKey.SetValue("SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord);

                bool             result   = false;
                RESTOREPOINTINFO RPInfo   = new RESTOREPOINTINFO();
                STATEMGRSTATUS   RPStatus = new STATEMGRSTATUS();

                RPInfo.dwEventType      = 100;
                RPInfo.dwRestorePtType  = 16;
                RPInfo.llSequenceNumber = 0;
                RPInfo.szDescription    = RPName;

                result = SRSetRestorePoint(ref RPInfo, ref RPStatus);

                SystemRestoreKey.DeleteValue("SystemRestorePointCreationFrequency");
                return(result);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 static extern bool SRSetRestorePoint(ref RESTOREPOINTINFO SRPInfo, ref STATEMGRSTATUS SRPStatus);