<div class="content"><p> </p><p>The CreatePartitionsForVolume method creates a partition
underneath a <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a></span>. This is a
synchronous task.</p><dl>
<dd>
<div><pre> HRESULT CreatePartitionsForVolume(
   [in] LdmObjectId volumeId,
   [in] boolean active,
   [in] hyper volumeLastKnownState,
   [out] TASK_INFO* tinfo
 );
</pre></div>
</dd></dl><p><b>volumeId: </b>Specifies the OID of the volume
under which to create a partition.</p><p><b>active: </b>Boolean value that indicates whether
the new partition is to be set to active, which would make it an <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_37f8831a-72a8-4808-9a39-6949f7172de9" data-linktype="relative-path">active
partition</a></span>. On x86, and possibly other BIOSes, this is needed by the
BIOS to start the machine from the volume.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>FALSE</p>
  <p>0</p>
  </td>
  <td>
  <p>New partition is not set to active.</p>
  </td>
 </tr><tr>
  <td>
  <p>TRUE</p>
  <p>1</p>
  </td>
  <td>
  <p>New partition is set to active.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>volumeLastKnownState:</b> Last known <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_5a574d80-6bdb-4fb0-a0dd-b0601d16b4cd" data-linktype="relative-path">modification
sequence number</a></span> of the volume.</p><p><b>tinfo: </b>Pointer to a <span><a href="d55c167e-c6ad-445f-951c-9ac2d0de7a11" data-linktype="relative-path">TASK_INFO</a></span> structure
that the client can use to track the request&#39;s progress.</p><p><b>Return Values: </b>The method MUST return 0 or a
nonerror <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path"><span>HRESULT</span></a> on success, or
an implementation-specific nonzero error code on failure (as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>;
see also section <span><a href="31eea9e6-25b0-4309-8f4a-50c74fbedc9b" data-linktype="relative-path">2.2.1</a></span> for HRESULT
values predefined by the Disk Management Remote Protocol).</p><p>Upon receiving this message, the server MUST validate
parameters:</p><ol><li><p><span>    </span>Verify that the <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_80affbd0-04b4-489e-be50-ddf9383e5d28" data-linktype="relative-path">dynamic
volume</a></span> specified by <i>volumeId</i> is in the list of storage
objects, and check whether the field <b>volumeSpec.lastKnownState</b> matches
the field <b>LastKnownState</b> of the object.</p>
</li><li><p><span>    </span>Verify that <i>tinfo</i>
is not NULL.</p>
</li></ol><p>If parameter validation fails, the server MUST fail the
operation immediately, returning an appropriate error as its response to the
client.</p><p>Otherwise, the server MUST process the message as follows:</p><ol><li><p><span>    </span>Enumerate all <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_753cb2b4-3f5c-48f3-97ef-61612c40499e" data-linktype="relative-path">disk
regions</a></span> that correspond to the dynamic volume specified by <i>volumeId</i>
from the list of storage objects.</p>
</li><li><p><span>    </span>For each disk
region, create an entry in the <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_cee39671-0b98-4ca3-904d-018780e7042f" data-linktype="relative-path">partition table</a></span> of
its <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a></span>.
The partition MUST have the same offset and length as the disk region. If the
active <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_425bcab9-7911-4eae-b414-624b7a51eb5f" data-linktype="relative-path">flag</a></span> is set to TRUE,
set the active bit in the partition table to 1. If the active flag is set to
FALSE, set the active bit in the partition table to 0. </p>
</li><li><p><span>    </span>Wait for the partition
creations to succeed or fail. </p>
</li><li><p><span>    </span>Fill in the <i>tinfo</i>
output parameter. </p>
<table><thead>
  <tr>
   <th>
   <p>TASK_INFO member</p>
   </th>
   <th>
   <p>Required for this operation</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>TASK_INFO::id</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::storageId</p>
  </td>
  <td>
  <p>Not required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::createTime</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_202"></a><a aria-label="Product behavior note 202" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_202" data-linktype="relative-path">&lt;202&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::clientID</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_203"></a><a aria-label="Product behavior note 203" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_203" data-linktype="relative-path">&lt;203&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::percentComplete</p>
  </td>
  <td>
  <p>Required for any task that returns REQ_IN_PROGRESS.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::status</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::type</p>
  </td>
  <td>
  <p>Required if PercentageComplete is being used.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::error</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::tflag</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_204"></a><a aria-label="Product behavior note 204" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_204" data-linktype="relative-path">&lt;204&gt;</a></p>
  </td>
 </tr></tbody></table>
</li><li><p><span>    </span>Return a
response to the client containing <i>tinfo</i> and the status of the operation.
</p>
</li><li><p><span>    </span>Send the task
completion notification.<a id="Appendix_A_Target_205"></a><a aria-label="Product behavior note 205" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_205" data-linktype="relative-path">&lt;205&gt;</a></p>
</li></ol><p>If the operation is successful, the server MUST make the
following changes to the list of storage objects before returning the response:</p><ul><li><p><span><span> 
</span></span>Modify the dynamic volume object to account for the change of
status.</p>
</li><li><p><span><span> 
</span></span>Modify the disk objects where the partitions were created to
account for the change in region allocation.<a id="Appendix_A_Target_206"></a><a aria-label="Product behavior note 206" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_206" data-linktype="relative-path">&lt;206&gt;</a></p>
</li></ul></div>