<div class="content"><p> </p><p> The CreatePartition method creates a <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_2f24f458-7d39-47a2-93f7-de433ea85c75" data-linktype="relative-path">partition</a></span>
on a <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a></span>
at a specified byte offset.</p><dl>
<dd>
<div><pre> HRESULT CreatePartition(
   [in] ULONGLONG ullOffset,
   [in] ULONGLONG ullSize,
   [in] CREATE_PARTITION_PARAMETERS* para,
   [out] IVdsAsync** ppAsync
 );
</pre></div>
</dd></dl><p><b>ullOffset: </b>MUST be the byte offset from the
beginning of the disk at which to create the new partition.</p><dl>
<dd>
<p>The partition is created at or beyond the <i>ullOffset</i>
such that the offset is divisible by the default alignment value of the disk.
The offset value returned in the server&#39;s partition notification, after
CreatePartition is successful, reflects the rounded-up value.</p>
</dd></dl><p><b>ullSize: </b>MUST be the size of the new
partition, in bytes.</p><p><b>para: </b>MUST be a pointer to a <span><a href="bd6d633a-389c-4df4-81dc-49f4f584ce3f" data-linktype="relative-path">CREATE_PARTITION_PARAMETERS</a></span>
structure that describes the new partition to create.</p><p><b>ppAsync: </b>MUST be a pointer to an <span><a href="97ea9c0f-5c8a-43e9-a9ee-deda29e2a09e" data-linktype="relative-path">IVdsAsync</a></span>
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 <span><a href="ccba511e-b299-4153-bb2f-c25ba97840f4" data-linktype="relative-path">IVdsAsync::Wait</a></span>
method is called on the interface, the interfaces returned in the
VDS_ASYNC_OUTPUT structure MUST be released as well.</p><p><b>Return Values: </b>The method MUST return zero or
a non-error <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_799103ab-b3cb-4eab-8c55-322821b2b235" data-linktype="relative-path">HRESULT</a></span> (as
specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>)
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 <span><a href="5102cc53-3143-4268-ba4c-6ea39e999ab4" data-linktype="relative-path">2.2.3</a></span>.<a id="Appendix_A_Target_94"></a><a aria-label="Product behavior note 94" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_94" data-linktype="relative-path">&lt;94&gt;</a></p><dl>
<dd>
<p><b>Note</b>  Creating or deleting
partitions on dynamic disks is not supported.</p>
</dd>
<dd>
<p><b>Note</b>  This method is not valid on
CD/DVD or <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_a2b20515-dc69-4674-b74e-91c8f24e3003" data-linktype="relative-path">super floppy</a></span>
devices. These devices do not support partition tables.</p>
</dd></dl><p>When the server receives this message, it MUST validate the
following parameters:</p><ul><li><p><span><span> 
</span></span>Verify that para is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that ppAsync is not NULL.</p>
</li></ul><p>The server MUST perform the following:</p><ul><li><p><span><span> 
</span></span>If the partition cannot be created because there is not enough
free space on the specified disk, then the server MUST return VDS_E_NOT_ENOUGH_SPACE.</p>
</li><li><p><span><span> 
</span></span>Create a new async object implementing the IVdsAsync interface
with an output type of VDS_ASYNCOUT_CREATEPARTITION and set the pointer that <b>ppAsync</b>
references to the interface.</p>
</li><li><p><span><span> 
</span></span>Return an HRESULT indicating failure or success. Any errors
encountered up through this point in processing the operation are returned in
this HRESULT.</p>
</li></ul><p>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.</p><ul><li><p><span><span> 
</span></span>Create a new partition following the parameters specified to the
method.</p>
<ul><li><p><span><span>  </span></span>If
the partition creation resulted in the renumbering of existing partitions on a
boot disk, the server MUST update the <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_f1bdb0a4-803c-4cb5-ab76-82f6886a5031" data-linktype="relative-path">boot configuration file</a></span>
with the new partition numbering.</p>
</li></ul></li><li><p><span><span> 
</span></span>Set the task-specific return values in the async object to return
the values associated with VDS_ASYNCOUT_CREATEPARTITION. For information on
asynchronous tasks, see section <span><a href="28fc0a76-54bc-4d7d-81c3-37cf36586b23" data-linktype="relative-path">3.4.5.1.9</a></span>.</p>
</li><li><p><span><span> 
</span></span>Set the return code in the async object to an HRESULT indicating
failure or success.</p>
<ul><li><p><span><span>  </span></span>If
the server was required to update the boot configuration file but failed, the
return code MUST be set to VDS_S_UPDATE_BOOTFILE_FAILED (HRESULT of
0x80042434).</p>
</li></ul></li><li><p><span><span> 
</span></span>If the task was completed successfully, set the percentage
completed value in the async object to 100.</p>
</li><li><p><span><span> 
</span></span>Set the signal state in the async object to TRUE.</p>
</li><li><p><span><span> 
</span></span>For each callback object that is registered in the list of
callback objects, call the callback object&#39;s IVdsAdviseSink::OnNotify (Opnum 3)
method by using a <span><a href="4f29057f-ab32-4a3d-9fcb-00ba3457cb42" data-linktype="relative-path">VDS_NOTIFICATION</a></span>
structure that has the following attributes:</p>
<ul><li><p><span><span>  </span></span>objectType
member is VDS_NTT_PARTITION.</p>
</li><li><p><span><span>  </span></span>Partition
member is a VDS_PARTITION_NOTIFICATION that has the following attributes:</p>
<ul><li><p><span><span> 
</span></span>ulEvent is VDS_NF_PARTITION_ARRIVE.</p>
</li><li><p><span><span> 
</span></span>diskId is the VDS_OBJECT_ID of the disk object that corresponds
to the disk on which the partition was added.</p>
</li><li><p><span><span> 
</span></span>ullOffset is the byte offset at which the partition starts on the
disk.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>If the partition is created on a <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_58aae236-0186-4ba1-a46b-f0a997e6c6f2" data-linktype="relative-path">removable media</a></span>
disk, for each callback object that is registered in the list of callback
objects, call the callback object&#39;s IVdsAdviseSink::OnNotify (Opnum 3) method
by using a VDS_NOTIFICATION structure that has the following attributes:</p>
<ul><li><p><span><span>  </span></span><b>objectType</b>
member is VDS_NTT_VOLUME.</p>
</li><li><p><span><span>  </span></span><b>Volume</b>
member is a <span><a href="410540de-982d-4db1-991e-a73efed4e6f0" data-linktype="relative-path">VDS_VOLUME_NOTIFICATION</a></span>
that has the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_VOLUME_ARRIVE.</p>
</li><li><p><span><span> 
</span></span><b>volumeId</b> is the <span><a href="9186f1ce-04de-4df2-a8cf-3925a02fcd47" data-linktype="relative-path">VDS_OBJECT_ID</a></span> of
the <span><a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a></span>
object corresponding to the removable media drive.</p>
</li><li><p><span><span> 
</span></span><b>plexId</b> is NULL GUID, but it is not relevant when ulEvent
is VDS_NF_VOLUME_ARRIVE.</p>
</li><li><p><span><span> 
</span></span><b>ulPercentCompleted</b> ranges from 0-100; however, it is not
relevant when ulEvent is VDS_NF_VOLUME_ARRIVE.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>For each callback object that is registered in the list of
callback objects, call the callback object&#39;s IVdsAdviseSink::OnNotify (Opnum 3)
method by using a VDS_NOTIFICATION structure that has the following attributes:</p>
<ul><li><p><span><span>  </span></span><b>objectType</b>
member is VDS_NTT_DISK.</p>
</li><li><p><span><span>  </span></span><b>Disk</b>
member is a <span><a href="1478f791-1ebd-421c-ba87-5fd7493dafd1" data-linktype="relative-path">VDS_DISK_NOTIFICATION</a></span>
that has the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_DISK_MODIFY.</p>
</li><li><p><span><span> 
</span></span><b>diskId</b> is the VDS_OBJECT_ID of this disk object.</p>
</li></ul></li></ul></li></ul><p>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.</p></div>