AddDifArea , ChangeDiffAreaMaximumSize APIs on longhorn and windows 2003

S

santosh

Hi ,
I am using

"IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea
IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAreaMaximumSize"

to configure the Diff area for COW snapshot for systerm VSS provider.

Provider name: 'MS Software Shadow Copy provider 1.0'
Provider type: System
Provider Id: {b5946137-7b9f-4925-af80-51abd60b20d5}

Above APIs are returning "VSS_E_INSUFFICIENT_STORAGE" error on windows
2003 and longhorn.

I verified the space available and also specifying the new size more
than 300 MB.

But "QueryDiffAreasForVolume" API succeeds on both windows 2003 and
longhorn.

I tried to cnfigure the shadow copy using GUI , that is rightclick on
dirve -> properties -> Shadow Copy . It allows to add as well as to
change the diff area.


The test program which I am using is added in this post .
If anyone is already using above APIs , please let me know if I am
missing anything ?

Thanks
Santosh


/////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "vss.h"
#include "vswriter.h"
#include "resource.h"
#include <atlcomcli.h>
#include <vsmgmt.h>


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;
// 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;

CComPtr<IVssSnapshotMgmt> pMgmt = NULL;
CComPtr<IVssDifferentialSoftwareSnapshotMgmt> pDiffMgmt = NULL;


//form the drive letter
dl = (WCHAR*) malloc(strlen(argv[1])* sizeof(WCHAR));
swprintf(dl,L"%S",argv[1]);

//new diff area size
int size = atoi(argv[2]);


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


CComPtr<IVssEnumMgmtObject> ppEnum;
hr = pDiffMgmt->QueryDiffAreasOnVolume( (VSS_PWSZ) dl,
&ppEnum);


if (FAILED(hr))
{
printf("QueryDiffAreasOnVolume Failed %x\n" , hr);
}
else
{
printf("QueryDiffAreasOnVolume succeeed\n");
}



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;

}
 
R

Rock

santosh said:
Hi ,
I am using

"IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea
IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAreaMaximumSize"

to configure the Diff area for COW snapshot for systerm VSS provider.

Provider name: 'MS Software Shadow Copy provider 1.0'
Provider type: System
Provider Id: {b5946137-7b9f-4925-af80-51abd60b20d5}

Above APIs are returning "VSS_E_INSUFFICIENT_STORAGE" error on windows
2003 and longhorn.

I verified the space available and also specifying the new size more
than 300 MB.

But "QueryDiffAreasForVolume" API succeeds on both windows 2003 and
longhorn.

I tried to cnfigure the shadow copy using GUI , that is rightclick on
dirve -> properties -> Shadow Copy . It allows to add as well as to
change the diff area.


The test program which I am using is added in this post .
If anyone is already using above APIs , please let me know if I am
missing anything ?

Thanks
Santosh

You'd be better off posting to a developer group.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top