Advertisement
TTpocToXaKep

Create windows restore point

Feb 14th, 2023
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <windows.h>
  2. #include <srrestoreptapi.h>
  3. #include <iostream>
  4.  
  5. int main() {
  6.     RESTOREPOINTINFO rpInfo;
  7.     STATEMGRSTATUS smgrStatus;
  8.  
  9.     // Заполняем информацию о точке восстановления
  10.     rpInfo.dwEventType = BEGIN_SYSTEM_CHANGE;
  11.     rpInfo.dwRestorePtType = APPLICATION_INSTALL;
  12.     rpInfo.llSequenceNumber = 0;
  13.     wcscpy_s(rpInfo.szDescription, MAX_DESC_WLEN, L"My Restore Point Description");
  14.  
  15.     // Создаем точку восстановления
  16.     int result = SRSetRestorePointW(&rpInfo, &smgrStatus);
  17.  
  18.     if (result != ERROR_SUCCESS) {
  19.         std::cout << "Ошибка при создании точки восстановления: " << result << std::endl;
  20.         return 1;
  21.     }
  22.  
  23.     std::cout << "Точка восстановления успешно создана!" << std::endl;
  24.  
  25.     return 0;
  26. }
  27. // ru rules!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement