<div class="content" name="Open" uuid="a0ad8aa3-805f-4af9-af3b-748520427819"><p>The Open method opens a handle to the specified <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_1fbc35d5-bcf5-4ce7-9449-4197a1671440" data-linktype="relative-path">virtual disk</a> file and
returns an <a href="01ea51d6-09e2-4364-90af-32f8efb5b892" data-linktype="relative-path">IVdsOpenVDisk (section 3.1.15.2)</a>
interface pointer to an object representing the open virtual disk (an
OpenVirtualDisk object). Release the IVdsOpenVDisk interface to close the
handle to the virtual disk.</p><dl>
<dd>
<div><pre> HRESULT Open(
   [in] VIRTUAL_DISK_ACCESS_MASK AccessMask,
   [in] OPEN_VIRTUAL_DISK_FLAG Flags,
   [in] ULONG ReadWriteDepth,
   [out] IVdsOpenVDisk** ppOpenVDisk
 );
</pre></div>
</dd></dl><p><b>AccessMask: </b>A <a href="4fa2f54d-00b3-4cd9-b673-a6b8d64ed57f" data-linktype="relative-path">VIRTUAL_DISK_ACCESS_MASK (section 2.2.2.19.1.4)</a>
structure that contains the set of access rights to be applied to the opened
virtual disk.</p><p><b>Flags: </b>A bitmask of <a href="6151c504-e617-4e1f-aea8-36528b807e9a" data-linktype="relative-path">OPEN_VIRTUAL_DISK_FLAG (section 2.2.2.19.1.2)</a>
flags specifying how the virtual disk is to be opened.</p><p><b>ReadWriteDepth: </b>This is applicable only to <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_f738286f-68d6-4890-a658-efcf815313ae" data-linktype="relative-path">differencing</a> type virtual
disks. The number of <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_432d7a86-d2ca-4977-8189-d28b54883d09" data-linktype="relative-path">backing
stores</a> (files) to open read/write. This count includes the child. The
remaining stores in the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_bded4a57-f841-4b1e-a981-579bec032bc8" data-linktype="relative-path">differencing
chain</a> MUST be opened as <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_ca1db15f-c3cf-41ca-832e-b2c98007cb6a" data-linktype="relative-path">read-only</a>.
For example, given a differencing disk with two parents (diskA is the
differencing disk whose parent is diskB, and since diskB is a differencing
disk, it has a parent which is diskC), entering &#39;2&#39; for this parameter will
open the differencing disk (diskA) and the parent used to create this
differencing disk (diskB) as read-write. In this case, diskB is also a
differencing disk and its parent (diskC) is opened as read-only.</p><p><b>ppOpenVDisk: </b>A pointer to a variable that, if
the operation is successfully completed, receives an IVdsOpenVDisk interface
pointer to the newly opened virtual disk object. Callers MUST release the
interface pointer when it is no longer needed by calling the <b>IUnknown::Release</b>
method.</p><p><b>Return Values: </b>The method MUST return zero to
indicate success, or return an implementation-specific nonzero error code to
indicate failure.</p><p>When the server receives this message, it MUST validate the
following parameters:</p><ul><li><p><span><span> 
</span></span>Verify that <i>ppOpenVDisk</i> is not NULL.</p>
</li></ul><p>The server MUST then perform the following in sequence:</p><ul><li><p><span><span> 
</span></span>Pass the input parameters to the operating system to open the
virtual disk file.</p>
</li><li><p><span><span> 
</span></span>If the operating system failed to open the file, return an
implementation-specific error code. Otherwise, if the file was successfully
opened, the server MUST:</p>
<ul><li><p><span><span>  </span></span>Mark
the state of the object that implements <a href="22049df2-09cf-4e87-a00e-d2c7676ca2d1" data-linktype="relative-path">IVdsVDisk</a> as
&#34;open&#34;. For details, see section <a href="d1ff9fd9-9527-4936-91c2-292bd9d1ff17" data-linktype="relative-path">2.2.2.19.1.1</a>.</p>
</li><li><p><span><span>  </span></span>Create
an object that implements the IVdsOpenVDisk <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_95913fbd-3262-47ae-b5eb-18e6806824b9" data-linktype="relative-path">interface</a> to represent the
virtual disk file in the open state.</p>
</li><li><p><span><span>  </span></span>Point
<i>ppOpenVDisk</i> to an IVdsOpenVDisk interface of the virtual disk object
created and return an <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path"><span>HRESULT</span></a> indicating
success.</p>
</li></ul></li></ul></div>