This is a discussion on AddDiffArea and ChangeDiffAreaMaximumSize APIs in Longhorn and Win2003 - Storage ; Did anyone use following APIs to manage shadow copy area ? "IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAr eaMaximumSize" I have written a sample program but fails on 2003 and longhorn , Please correct me if I have missed anything Thanks Santosh // test.cpp : ...
Did anyone use following APIs to manage shadow copy area ?
"IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea
IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAr eaMaximumSize"
I have written a sample program but fails on 2003 and longhorn ,
Please correct me if I have missed anything
Thanks
Santosh
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "vss.h"
#include "vswriter.h"
#include "resource.h"
#include
#include
const CLSID CLSID_VssDifferentialSoftwareSnapshotMgmt =
{0xD6222095,0x05C3,0x42F3,{0x81,0xD9,0xA4,0xA0,0xC E,0xC0,0x5C,0x26}};
//{0x214A0F28,0xB737,0x4026,{0xB8,0x47,0x4F,0x9E,0x3 7,0xD7,0x95,0x29}};
//const GUID CLSID_VdsLoader =
{0x9C38ED61,0xD565,0x4728,{0xAE,0xEE,0xC8,0x09,0x5 2,0xF0,0xEC,0xDE}};
int main(int argc, char* argv[])
{
if(argc < 3)
{
printf("\nUSAGe test.exe drive_letter\n E.g test.exe F:\\ size ");
exit(0);
}
WCHAR *dl;
dl = (WCHAR*) malloc(strlen(argv[1])* sizeof(WCHAR));
if(!dl)
{
_asm int 3;
}
swprintf(dl,L"%S",argv[1]);
CoInitialize(NULL);
// software-provider id is {b5946137-7b9f-4925-af80-51abd60b20d5}
const VSS_ID ProviderId = { 0xb5946137,
0x7b9f,
0x4925,
{ 0xaf,0x80,0x51,0xab,0xd6,0xb,0x20,0xd5 } };
HRESULT hr = S_OK;
CComPtrpMgmt = NULL;
CComPtrpDiffMgmt = NULL;
hr = CoCreateInstance(CLSID_VssSnapshotMgmt,
NULL,
CLSCTX_ALL,
IID_IVssSnapshotMgmt,
(void**) &pMgmt);
if (FAILED(hr)) {
printf("CoCreateInstance Failed\n %x" , hr);
exit(0);
}
hr = pMgmt->GetProviderMgmtInterface(ProviderId,
IID_IVssDifferentialSoftwareSnapshotMgmt,
(IUnknown**)&pDiffMgmt);
if (FAILED(hr)) {
printf("GetProviderMgmtInterface Failed\n%x" , hr);
exit(0);
}
CComPtrppEnum;
hr = pDiffMgmt->QueryDiffAreasOnVolume( (VSS_PWSZ) dl, &ppEnum);
if (FAILED(hr)) {
printf("QueryDiffAreasOnVolume Failed %x\n" , hr);
}
else
{
printf("QueryDiffAreasOnVolume succeeed\n");
}
int size = atoi(argv[2]);
hr =pDiffMgmt->AddDiffArea((VSS_PWSZ) dl , (VSS_PWSZ)dl , size );
if (FAILED(hr)) {
printf("AddDiffArea Failed %x\n" , hr);
}
else
{
printf("AddDiffArea succeed\n");
}
hr =pDiffMgmt->ChangeDiffAreaMaximumSize((VSS_PWSZ) dl , (VSS_PWSZ)dl ,
size);
if (FAILED(hr)) {
printf("ChangeDiffAreaMaximumSize Failed ,%x\n",hr);
}
else
{
printf("ChangeDiffAreaMaximumSize succeed\n");
}
return 0;
}