none
VssExpressWriter fails to add a folder non monitored files into restore point RRS feed

  • Question

  • I'm trying to use VSS Express Writer to include all the files in specific folder in the restore point when it is conducted which are crucial for my app to run.

    Some of the files have extensions (mostly .txt) that is not automatically monitored (see https://docs.microsoft.com/en-us/windows/win32/sr/monitored-file-extensions for all auto monitored extensions).

    So I've wrote a special vssWriter for those files (see https://docs.microsoft.com/en-us/windows/win32/vss/writers) and expected that the OS would call its requester which would add the files at the writer to the restore set..

    After running my code, the writer created successfully and is visible from `vssadmin list writers`. However, the folder isn't kept once i go back to restore point (the files aren't there..)

    Currently my flow goes as follow:

    1. Register using the following code (see below).
    2. Create system restore point.
    3. Delete my folder.
    4. Restart
    5. Restore my system.

    Unfortunately, I dont get my folder back..

    I've tried to summarize the code in the following block : 

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

    I am wondering if there is a need to implement a requester to add the files to restore properly (https://docs.microsoft.com/en-us/windows/win32/vss/requestors).

    Perhaps anyone can tell me where did i go wrong in my flow ? 

    Thanks 

    Tuesday, August 13, 2019 8:05 AM

All replies

  • Hello,

    Thank you for posting here.

    >>EXPRESS_WRITER_SAMPLE_GUID

    Can you show me what this is? I can't find it on Google.

    Best Regards,

    Suarez Zhou

    Wednesday, August 14, 2019 8:56 AM