0

我想使用 Window API 创建系统还原点 (SRP)。但是,在 24 小时内创建 SRP 是有限的。

这是我的步骤

  • 在注册表项 HKLM\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore 下添加 SystemRestorePointCreationFrequency 并设置为零。

在源代码中

  • 调用 LoadLibraryW(L"srclient.dll")
  • 获取 SRSetRestorePointW 的 GetProcAddress
  • 调用 SRSetRestorePointW 方法。

此方法仅在第一次调用时创建 SRP。在第二次调用中,它总是返回前一个 sequenceNumber(STATEMGRSTATUS.llSequenceNumber)。似乎 SRSetRestorePointW 没有引用 SystemRestorePointCreationFrequency。

我尝试使用 powershell 创建 2 个 SRP,效果很好(无需重新启动系统)

Checkpoint-Computer -Description 'Install_TEST' -RestorePointType 'APPLICATION_INSTALL'

此源代码来自 MSD。但它有这个问题。(docs.microsoft.com/en-us/windows/win32/sr/using-system-restore)

4

1 回答 1

2

您必须使用 Windows 8 或更高版本才能SystemRestorePointCreationFrequency开始工作。

  1. 第一次通话时设置eventtypeBEGIN_SYSTEM_CHANGE
  2. 在第二次调用时设置eventtypeEND_SYSTEM_CHANGESequenceNumber从第一次调用返回。
于 2021-12-18T22:03:13.530 回答