I'm trying to use VSS Express Writer to include one of my folders in the restore point when it is conducted. Although the code seem to runs without any errors I don't get the expected result and the folder isn't kept when i go back to restore point.
To verify my code functionality, I could trace my writer in vssadmin list writers.
I am doing the following flow:
- Register using the following code (see below).
- Create system restore point.
- Delete my folder.
- Restart
- Restore my system.
Unfortunately, I dont get my folder back..
int main()
{
::CoInitialize(NULL);
createAndRegister();
}
int createAndRegister()
{
CComPtr<IVssExpressWriter> spExpressWriter;
CComPtr<IVssCreateExpressWriterMetadata> spMetadata;
CreateVssExpressWriter(&spExpressWriter);
spExpressWriter->CreateMetadata(EXPRESS_WRITER_SAMPLE_GUID, L"Sample Express Writer", VSS_UT_USERDATA, 1, 0, 0, &spMetadata);
PCWSTR wszComponent = L"myExpressWriter";
spMetadata->SetRestoreMethod(
VSS_RME_RESTORE_AT_REBOOT, ////I've also tried it with different option of this enum
NULL,
NULL,
VSS_WRE_NEVER,
false),
L"SetRestoreMethod failed");
spMetadata->AddComponent(
VSS_CT_FILEGROUP,
NULL,
wszComponent,
wszComponent,
NULL,
0,
false,
false,
false);
spMetadata->AddFilesToFileGroup(
NULL,
wszComponent,
L"c:\\ProgramData\\myFolder",
L"*.*",
true,
NULL,
NULL),
spExpressWriter->Register();
}
procmon recording was set during system restore point, and no event that contain the path to myFolder was found at the time... is it possible that the file adding is made during the registration to vsswriter, and not during the restore point creation ?
Perhaps anyone can help me find what am i missing here?
thanks