<div class="content" name="DeletePartition" uuid="51ec4003-12d5-4201-bd0f-a59ba29aff46"><p>The DeletePartition method deletes a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_2f24f458-7d39-47a2-93f7-de433ea85c75" data-linktype="relative-path">partition</a> from the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a> at a specified byte
offset.</p><dl>
<dd>
<div><pre> HRESULT DeletePartition(
   [in] ULONGLONG ullOffset,
   [in] long bForce,
   [in] long bForceProtected
 );
</pre></div>
</dd></dl><p><b>ullOffset: </b>The byte offset of the partition,
from the beginning of the disk. This offset MUST be the offset at the start of
a partition.</p><p><b>bForce: </b>A Boolean that determines whether the
partition deletion is forced. If this parameter is set to a nonzero value,
calls to lock and dismount any file system on the partition that fail are
ignored. If this parameter is set to zero and any file systems on the partition
failed to be locked or dismounted, the server returns VDS_E_DEVICE_IN_USE.</p><p><b>bForceProtected: </b>A Boolean value that
determines whether deletion of a protected partition  will be forced.<a id="Appendix_A_Target_95"></a><a aria-label="Product behavior note 95" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_95" data-linktype="relative-path">&lt;95&gt;</a></p><p><b>Return Values: </b>The method MUST return zero or
a non-error <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_799103ab-b3cb-4eab-8c55-322821b2b235" data-linktype="relative-path">HRESULT</a> (as
specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>)
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 <a href="5102cc53-3143-4268-ba4c-6ea39e999ab4" data-linktype="relative-path">2.2.3</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 for
CD/DVD or <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_a2b20515-dc69-4674-b74e-91c8f24e3003" data-linktype="relative-path">super floppy</a>
devices. These devices do not support <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_cee39671-0b98-4ca3-904d-018780e7042f" data-linktype="relative-path">partition tables</a>.</p>
</dd></dl><p><b>ERROR_SUCCESS</b> (0x00000000)</p><p>When the server receives this message, it MUST perform the
following:</p><ul><li><p><span><span> 
</span></span>Attempt to get exclusive access to the partition. If the server
fails to get exclusive access to the partition, and the <i>bForce</i> parameter
is not set to a non-zero value, then the server MUST return
VDS_E_DEVICE_IN_USE.</p>
</li><li><p><span><span> 
</span></span>Delete the partition following the parameters specified to the
method.</p>
</li><li><p><span><span> 
</span></span>If deleting the partition removed a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a>, remove the
corresponding volume object from the list of storage management objects. For
each callback object that is registered in the list of callback objects, call
the callback object&#39;s <a href="04a70bf6-208d-463a-b0a4-cc96e198ded1" data-linktype="relative-path">IVdsAdviseSink::OnNotify</a>
method by using a <a href="4f29057f-ab32-4a3d-9fcb-00ba3457cb42" data-linktype="relative-path">VDS_NOTIFICATION</a>
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 VDS_VOLUME_NOTIFICATION that has the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_VOLUME_DEPART.</p>
</li><li><p><span><span> 
</span></span><b>volumeId</b> is the VDS_OBJECT_ID of the volume object that
was removed.</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_DEPART.</p>
</li><li><p><span><span> 
</span></span><b>ulPercentCompleted</b> range is 0-100 and is implementation
specific; however, it is not relevant when ulEvent is VDS_NF_VOLUME_DEPART.</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 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_PARTITION.</p>
</li><li><p><span><span>  </span></span>Partition
member is a <a href="72738b43-1afe-4b36-9978-eddcbcbfca55" data-linktype="relative-path">VDS_PARTITION_NOTIFICATION</a>
that has the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_PARTITION_DEPART.</p>
</li><li><p><span><span> 
</span></span><b>diskId</b> is the VDS_OBJECT_ID of the disk object
corresponding to the disk from which the partition was deleted.</p>
</li><li><p><span><span> 
</span></span><b>ullOffset</b> is the byte offset at which the partition
started on the disk.</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 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 <a href="1478f791-1ebd-421c-ba87-5fd7493dafd1" data-linktype="relative-path">VDS_DISK_NOTIFICATION</a>
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><li><p><span><span> 
</span></span>Return an HRESULT indicating failure or success.</p>
</li></ul></div>