The CreateVDisk method defines a new virtual disk. This method creates a virtual disk file to be used as the backing store for the virtual disk.

 HRESULT CreateVDisk(
   [in] PVIRTUAL_STORAGE_TYPE VirtualDeviceType,
   [in, string] LPWSTR pPath,
   [in, string, unique] LPWSTR pStringSecurityDescriptor,
   [in] CREATE_VIRTUAL_DISK_FLAG Flags,
   [in] ULONG ProviderSpecificFlags,
   [in] ULONG Reserved,
   [in] PVDS_CREATE_VDISK_PARAMETERS pCreateDiskParameters,
   [in, out, unique] IVdsAsync** ppAsync
 );

VirtualDeviceType: Pointer to a VIRTUAL_STORAGE_TYPE (section 2.2.1.3.23) structure that specifies the type of virtual hard disk to be created.

pPath: A NULL-terminated wide-character string containing the name and directory path for the backing file to be created for the virtual hard disk.

pStringSecurityDescriptor: A NULL-terminated wide-character string containing the security descriptor to be applied to the virtual disk. Security descriptors MUST be in the Security Descriptor Definition Language (see [MSDN-SDDLforDevObj]).<77> If this parameter is NULL, the security descriptor in the caller's access token (see [MSFT-WSM/WEDWNK]) MUST be used.

Flags: Bitmask of flags specifying how the virtual disk is to be created.

ProviderSpecificFlags: A bitmask of flags that are specific to the type of virtual hard disk that is being surfaced. These flags are provider-specific.<78>

Reserved: The parameter is reserved for future use and MAY be zero.<79>

pCreateDiskParameters: Pointer to a VDS_CREATE_VDISK_PARAMETERS (section 2.2.2.18.2.1) structure that contains the virtual hard disk creation parameters.

ppAsync: A pointer to an IVdsAsync (section 3.1.3.1) interface that, if the operation is successfully completed, receives the IVdsAsync interface to monitor and control this operation. Callers MUST release the interface when they are done with it.

Return Values: The method MUST return zero to indicate success, or return an implementation-specific nonzero error code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service Remote Protocol, see section 2.2.3.

When the server receives this message, it MUST validate the following parameters:

The server MUST perform the following:

The server MUST then perform the following in sequence. Errors generated in this sequence of steps are returned in the pHrResult parameter to the IVdsAsync::Wait or IVdsAsyncQueryStatus methods.

At any point in the preceding sequence--before the percentage completed value in the async object is 100--the server MUST update the percentage completed value if progress has been made.