Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Can't access VSS under Windows 8.1

$
0
0

Hello,

i am trying to develop a simple backup solution by using the VSS service.

Right now i found this code:

#include <vss.h>
#include <vswriter.h>
#include <vsbackup.h>

typedef HRESULT(STDAPICALLTYPE *_CreateVssBackupComponentsInternal)(__out IVssBackupComponents **ppBackup);
typedef void (APIENTRY *_VssFreeSnapshotPropertiesInternal)( __in VSS_SNAPSHOT_PROP *pProp);

static _CreateVssBackupComponentsInternal CreateVssBackupComponentsInternal_I;
static _VssFreeSnapshotPropertiesInternal VssFreeSnapshotPropertiesInternal_I;

int _tmain(int argc, _TCHAR* argv[])
{
	HRESULT result;
	HMODULE vssapiBase;
	IVssBackupComponents *backupComponents;

	vssapiBase = LoadLibrary(L"vssapi.dll");

	if (vssapiBase)
	{
		CreateVssBackupComponentsInternal_I = (_CreateVssBackupComponentsInternal)GetProcAddress(vssapiBase, "CreateVssBackupComponentsInternal");
		VssFreeSnapshotPropertiesInternal_I = (_VssFreeSnapshotPropertiesInternal)GetProcAddress(vssapiBase, "VssFreeSnapshotPropertiesInternal");
	}

	if (!CreateVssBackupComponentsInternal_I || !VssFreeSnapshotPropertiesInternal_I)
		abort(); // Handle error

	result = CreateVssBackupComponentsInternal_I(&backupComponents);

	if (!SUCCEEDED(result))
		abort(); // Handle error

When running the application i get abort() called on the last line.

I tried to run the application as Admininistrator, by setting it in the manifest. But i had no luck.

It seems a permission problem.

Any suggestion? Thank you!


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>