CLSCTX_DISABLE_AAA ne peut pas être spécifié dans cet appel. Si CoInitializeSecurity est appelé, EOAC_DISABLE_AAA ne peut pas être spécifié dans le paramètre dwCapabilities .
L’exemple de code suivant initialise le service qui retourne un pointeur vers l’objet de service.
#include "initguid.h"
#include "vds.h"
#include <stdio.h>
#pragma comment( lib, "ole32.lib" )
//
// Simple macro to release non-null interfaces.
//
#define _SafeRelease(x) {if (NULL != x) { x->Release(); x = NULL; } }
void __cdecl main(void)
{
HRESULT hResult;
IVdsService *pService = NULL;
IVdsServiceLoader *pLoader = NULL;
// For this, you first get a pointer to the VDS Loader
// Launch the VDS service.
//
hResult = CoInitialize(NULL);
if (SUCCEEDED(hResult))
{
hResult = CoCreateInstance(CLSID_VdsLoader,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IVdsServiceLoader,
(void **) &pLoader);
//
// And then load VDS on the local computer.
//
if (SUCCEEDED(hResult))
{
hResult = pLoader->LoadService(NULL, &pService);
}
//
// You're done with the Loader interface at this point.
//
_SafeRelease(pLoader);
if (SUCCEEDED(hResult))
{
hResult = pService->WaitForServiceReady();
if (SUCCEEDED(hResult))
{
//
// You obtained an interface to the service: pService.
// This interface can now be used to query for providers
// and perform other operations.
//
printf("VDS Service Loaded");
}
}
else
{
printf("VDS Service failed hr=%x\n",hResult);
}
}
}
Dans ce module, vous allez découvrir comment télécharger et mettre à jour un disque dur virtuel (VHD) pour les applications de finances et d’opérations.