System Restore Point

Copper Contributor


Hello,

 

I am trying to use the functionality of vssWriter in order to add folders and files (that are critical to my app) to the system restore point. I have tried so far to write the writer with vssWriter and with vssExpressWriter using windows classic sample code (https://github.com/microsoft/Windows-classic-samples/tree/master/Samples/VolumeShadowCopyServiceWrit...). I have tried to set different paths and different methods of retrieval. Unfortunately, with the current documentation I can't get what am I doing wrong.

I was thinking that maybe because I don't implement a requester, then I dont get the functionality. On the other hand it is not clear from the documentation that it is needed.

 

That is a simplified version of my code:

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();
}

Any help would be appreciated!

 

0 Replies