System Restore Point

%3CLINGO-SUB%20id%3D%22lingo-sub-802506%22%20slang%3D%22en-US%22%3ESystem%20Restore%20Point%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802506%22%20slang%3D%22en-US%22%3E%3CP%3E%3CBR%20%2F%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20use%20the%20functionality%20of%20vssWriter%20in%20order%20to%20add%20folders%20and%20files%20(that%20are%20critical%20to%20my%20app)%20to%20the%20system%20restore%20point.%26nbsp%3B%3CSPAN%3EI%20have%20tried%20so%20far%20to%20write%20the%20writer%20with%20vssWriter%20and%20with%20vssExpressWriter%20using%20windows%20classic%20sample%20code%20(%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FWindows-classic-samples%2Ftree%2Fmaster%2FSamples%2FVolumeShadowCopyServiceWriter%2Fcpp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoft%2FWindows-classic-samples%2Ftree%2Fmaster%2FSamples%2FVolumeShadowCopyServiceWriter%2Fcpp%3C%2FA%3E%3CSPAN%3E).%20I%20have%20tried%20to%20set%20different%20paths%20and%20different%20methods%20of%20retrieval.%20Unfortunately%2C%20with%20the%20current%20documentation%20I%20can't%20get%20what%20am%20I%20doing%20wrong.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20was%20thinking%20that%20maybe%20because%20I%20don't%20implement%20a%20requester%2C%20then%20I%20dont%20get%20the%20functionality.%20On%20the%20other%20hand%20it%20is%20not%20clear%20from%20the%20documentation%20that%20it%20is%20needed.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20is%20a%20simplified%20version%20of%20my%20code%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22typ%22%3Eint%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20main%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22pun%22%3E%3A%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ECoInitialize%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3ENULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20createAndRegister%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22typ%22%3Eint%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20createAndRegister%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22pun%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22typ%22%3ECComPtr%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EIVssExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20spExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22typ%22%3ECComPtr%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EIVssCreateExpressWriterMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20spMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22typ%22%3ECreateVssExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%26amp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EspExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20spExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ECreateMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EEXPRESS_WRITER_SAMPLE_GUID%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20L%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22Sample%20Express%20Writer%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20VSS_UT_USERDATA%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22lit%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22lit%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22lit%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%26amp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EspMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20PCWSTR%20%20wszComponent%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20L%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22myExpressWriter%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%0A%20%20%20%20spMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ESetRestoreMethod%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20VSS_RME_RESTORE_AT_REBOOT%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22com%22%3E%2F%2F%2F%2FI've%20also%20tried%20it%20with%20different%20option%20of%20this%20enum%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20VSS_WRE_NEVER%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Efalse%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20L%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22SetRestoreMethod%20failed%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%0A%0A%20%20%20%20spMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EAddComponent%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20VSS_CT_FILEGROUP%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20wszComponent%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20wszComponent%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22lit%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Efalse%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Efalse%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Efalse%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%0A%0A%20%20%20%20spMetadata%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3EAddFilesToFileGroup%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20wszComponent%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20L%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22c%3A%5C%5CProgramData%5C%5CmyFolder%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20L%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E%22*.*%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kwd%22%3Etrue%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20%20%20%20%20NULL%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20%20%20%20spExpressWriter%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22typ%22%3ERegister%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E()%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22pun%22%3E%7D%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EAny%20help%20would%20be%20appreciated!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor


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