The CreatePartition method creates a partition on a disk at a specified byte offset.

 HRESULT CreatePartition(
   [in] ULONGLONG ullOffset,
   [in] ULONGLONG ullSize,
   [in] CREATE_PARTITION_PARAMETERS* para,
   [out] IVdsAsync** ppAsync
 );

ullOffset: MUST be the byte offset from the beginning of the disk at which to create the new partition.

The partition is created at or beyond the ullOffset such that the offset is divisible by the default alignment value of the disk. The offset value returned in the server's partition notification, after CreatePartition is successful, reflects the rounded-up value.

ullSize: MUST be the size of the new partition, in bytes.

para: MUST be a pointer to a CREATE_PARTITION_PARAMETERS structure that describes the new partition to create.

ppAsync: MUST be a pointer to an IVdsAsync interface that, upon successful completion, receives the IVdsAsync interface to monitor and control this operation. Callers MUST release the interface received when they are done with it. If the IVdsAsync::Wait method is called on the interface, the interfaces returned in the VDS_ASYNC_OUTPUT structure MUST be released as well.

Return Values: The method MUST return zero or a non-error HRESULT (as specified in [MS-ERREF]) 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.<94>

Note Creating or deleting partitions on dynamic disks is not supported.

Note This method is not valid on CD/DVD or super floppy devices. These devices do not support partition tables.

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.

The server MUST update the percentage completed value periodically during the preceding sequence. How often the percentage completed is updated, and at what point in the sequence, is implementation-specific.