/// <summary>The unique identifier. This identifier is persistently stored in the virtual disk and will not change even if the virtual disk file is copied to another file.</summary>
/// Open the VHD file (backing store) without opening any differencing-chain parents. Used to correct broken parent links. This flag is not supported
/// for ISO virtual disks.
/// </summary>
OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS=0x00000001,
/// <summary>Reserved. This flag is not supported for ISO virtual disks.</summary>
OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE=0x00000002,
/// <summary>Reserved. This flag is not supported for ISO virtual disks.</summary>
OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE=0x00000004,
/// <summary>
/// Indicates that the virtual disk should be opened in cached mode. By default the virtual disks are opened using FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH.
/// <para><c>Windows 7 and Windows Server 2008 R2:</c> This value is not supported before Windows 8 and Windows Server 2012.</para>
/// </summary>
OPEN_VIRTUAL_DISK_FLAG_CACHED_IO=0x00000008,
/// <summary>
/// Indicates the VHD file is to be opened without opening any differencing-chain parents and the parent chain is to be created manually using the
/// AddVirtualDiskParent function.
/// <para><c>Windows 7 and Windows Server 2008 R2:</c> This value is not supported before Windows 8 and Windows Server 2012.</para>
/// <summary>Not used. Will fail the operation.</summary>
SET_VIRTUAL_DISK_INFO_UNSPECIFIED=0,
/// <summary>Parent information is being set.</summary>
SET_VIRTUAL_DISK_INFO_PARENT_PATH=1,
/// <summary>A unique identifier is being set.</summary>
SET_VIRTUAL_DISK_INFO_IDENTIFIER=2,
/// <summary>Sets the parent file path and the child depth.</summary>
SET_VIRTUAL_DISK_INFO_PARENT_PATH_WITH_DEPTH=3,
/// <summary>Sets the physical sector size reported by the VHD.</summary>
SET_VIRTUAL_DISK_INFO_PHYSICAL_SECTOR_SIZE=4,
/// <summary>The identifier that is uniquely created when a user first creates the virtual disk to attempt to uniquely identify that virtual disk.</summary>
SET_VIRTUAL_DISK_INFO_VIRTUAL_DISK_ID=5,
/// <summary>Whether resilient change tracking (RCT) is turned on for the virtual disk.</summary>
SET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE=6,
/// <summary>The parent linkage information that differencing VHDs store. Parent linkage information is metadata used to locate and correctly identify the next parent in the virtual disk chain.</summary>
SET_VIRTUAL_DISK_INFO_PARENT_LOCATOR=7,
}
/// <summary>Contains the version of the virtual hard disk (VHD) STORAGE_DEPENDENCY_INFO structure to use in calls to VHD functions.</summary>
/// Open the virtual disk with no access. This is the only supported value when calling CreateVirtualDisk and specifying
/// CREATE_VIRTUAL_DISK_VERSION_2 in the VirtualDiskAccessMask parameter.
/// </summary>
VIRTUAL_DISK_ACCESS_NONE=0x00000000,
/// <summary>
/// Open the virtual disk for read-only attach access. The caller must have READ access to the virtual disk image file.
/// <para>
/// If used in a request to open a virtual disk that is already open, the other handles must be limited to either VIRTUAL_DISK_ACCESS_DETACH or
/// VIRTUAL_DISK_ACCESS_GET_INFO access, otherwise the open request with this flag will fail.
/// </para>
/// <para>
/// <c>Windows 7 and Windows Server 2008 R2:</c> This access right is not supported for opening ISO virtual disks until Windows 8 and Windows Server 2012.
/// </para>
/// </summary>
VIRTUAL_DISK_ACCESS_ATTACH_RO=0x00010000,
/// <summary>
/// Open the virtual disk for read/write attaching access. The caller must have (READ | WRITE) access to the virtual disk image file.
/// <para>
/// If used in a request to open a virtual disk that is already open, the other handles must be limited to either VIRTUAL_DISK_ACCESS_DETACH or
/// VIRTUAL_DISK_ACCESS_GET_INFO access, otherwise the open request with this flag will fail.
/// </para>
/// <para>
/// If the virtual disk is part of a differencing chain, the disk for this request cannot be less than the RWDepth specified during the prior open
/// request for that differencing chain.
/// </para>
/// <para>This flag is not supported for ISO virtual disks.</para>
/// </summary>
VIRTUAL_DISK_ACCESS_ATTACH_RW=0x00020000,
/// <summary>
/// Open the virtual disk to allow detaching of an attached virtual disk. The caller must have (FILE_READ_ATTRIBUTES | FILE_READ_DATA) access to the
/// virtual disk image file.
/// <para>
/// <c>Windows 7 and Windows Server 2008 R2:</c> This access right is not supported for opening ISO virtual disks until Windows 8 and Windows Server 2012.
/// </para>
/// </summary>
VIRTUAL_DISK_ACCESS_DETACH=0x00040000,
/// <summary>
/// Information retrieval access to the virtual disk. The caller must have READ access to the virtual disk image file.
/// <para>
/// <c>Windows 7 and Windows Server 2008 R2:</c> This access right is not supported for opening ISO virtual disks until Windows 8 and Windows Server 2012.
/// </para>
/// </summary>
VIRTUAL_DISK_ACCESS_GET_INFO=0x00080000,
/// <summary>
/// Virtual disk creation access.
/// <para>This flag is not supported for ISO virtual disks.</para>
/// </summary>
VIRTUAL_DISK_ACCESS_CREATE=0x00100000,
/// <summary>
/// Open the virtual disk to perform offline meta-operations. The caller must have (READ | WRITE) access to the virtual disk image file, up to
/// RWDepth if working with a differencing chain.
/// <para>If the virtual disk is part of a differencing chain, the backing store (host volume) is opened in RW exclusive mode up to RWDepth.</para>
/// <para>This flag is not supported for ISO virtual disks.</para>
/// </summary>
VIRTUAL_DISK_ACCESS_METAOPS=0x00200000,
/// <summary>Reserved.</summary>
VIRTUAL_DISK_ACCESS_READ=0x000d0000,
/// <summary>
/// Allows unrestricted access to the virtual disk. The caller must have unrestricted access rights to the virtual disk image file.
/// <para>This flag is not supported for ISO virtual disks.</para>
/// </summary>
VIRTUAL_DISK_ACCESS_ALL=0x003f0000,
/// <summary>
/// Reserved.
/// <para>This flag is not supported for ISO virtual disks.</para>
/// <summary>Attaches a virtual hard disk (VHD) or CD or DVD image file (ISO) by locating an appropriate VHD provider to accomplish the attachment.</summary>
/// <param name="VirtualDiskHandle">A handle to an open virtual disk. For information on how to open a virtual disk, see the OpenVirtualDisk function.</param>
/// <param name="SecurityDescriptor">
/// An optional pointer to a SECURITY_DESCRIPTOR to apply to the attached virtual disk. If this parameter is NULL, the security descriptor of the virtual
/// disk image file is used.
/// <para>
/// Ensure that the security descriptor that AttachVirtualDisk applies to the attached virtual disk grants the write attributes permission for the user,
/// or that the security descriptor of the virtual disk image file grants the write attributes permission for the user if you specify NULL for this
/// parameter. If the security descriptor does not grant write attributes permission for a user, Shell displays the following error when the user
/// accesses the attached virtual disk: The Recycle Bin is corrupted. Do you want to empty the Recycle Bin for this drive?
/// </para>
/// </param>
/// <param name="Flags">A valid combination of values of the ATTACH_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="ProviderSpecificFlags">Flags specific to the type of virtual disk being attached. May be zero if none are required.</param>
/// <param name="Parameters">A pointer to a valid ATTACH_VIRTUAL_DISK_PARAMETERS structure that contains attachment parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// Status of the request.
/// <para>If the function succeeds, the return value is ERROR_SUCCESS.</para>
/// <para>If the function fails, the return value is an error code. For more information, see System Error Codes.</para>
/// <summary>Attaches a virtual hard disk (VHD) or CD or DVD image file (ISO) by locating an appropriate VHD provider to accomplish the attachment.</summary>
/// <param name="VirtualDiskHandle">A handle to an open virtual disk. For information on how to open a virtual disk, see the OpenVirtualDisk function.</param>
/// <param name="SecurityDescriptor">
/// An optional pointer to a SECURITY_DESCRIPTOR to apply to the attached virtual disk. If this parameter is NULL, the security descriptor of the virtual
/// disk image file is used.
/// <para>
/// Ensure that the security descriptor that AttachVirtualDisk applies to the attached virtual disk grants the write attributes permission for the user,
/// or that the security descriptor of the virtual disk image file grants the write attributes permission for the user if you specify NULL for this
/// parameter. If the security descriptor does not grant write attributes permission for a user, Shell displays the following error when the user
/// accesses the attached virtual disk: The Recycle Bin is corrupted. Do you want to empty the Recycle Bin for this drive?
/// </para>
/// </param>
/// <param name="Flags">A valid combination of values of the ATTACH_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="ProviderSpecificFlags">Flags specific to the type of virtual disk being attached. May be zero if none are required.</param>
/// <param name="Parameters">A pointer to a valid ATTACH_VIRTUAL_DISK_PARAMETERS structure that contains attachment parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// Status of the request.
/// <para>If the function succeeds, the return value is ERROR_SUCCESS.</para>
/// <para>If the function fails, the return value is an error code. For more information, see System Error Codes.</para>
/// Breaks a previously initiated mirror operation and sets the mirror to be the active virtual disk.
/// </summary>
/// <param name="VirtualDiskHandle">A handle to the open mirrored virtual disk. For information on how to open a virtual disk, see the OpenVirtualDisk function. For information on how to mirror a virtual disk, see the MirrorVirtualDisk function.</param>
/// <returns>
/// Status of the request.
/// <para>If the function succeeds, the return value is ERROR_SUCCESS.</para>
/// <para>If the function fails, the return value is an error code. For more information, see System Error Codes.</para>
/// <summary>Reduces the size of a virtual hard disk (VHD) backing store file.</summary>
/// <param name="VirtualDiskHandle">
/// A handle to the open virtual disk, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag in the VirtualDiskAccessMask parameter
/// passed to OpenVirtualDisk. For information on how to open a virtual disk, see the OpenVirtualDisk function.
/// </param>
/// <param name="Flags">Must be the COMPACT_VIRTUAL_DISK_FLAG_NONE value (0) of the COMPACT_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A optional pointer to a valid COMPACT_VIRTUAL_DISK_PARAMETERS structure that contains compaction parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is an error code. For more information, see
/// System Error Codes.
/// </returns>
/// <remarks>
/// Compaction can be run only on a virtual disk that is dynamically expandable or differencing.
/// <para>There are two different types of compaction.</para>
/// <list type="bullet">
/// <item>
/// <description>
/// The first type, file-system-aware compaction, uses the NTFS file system to determine free space. This is done by attaching the VHD as a read-only
/// device by including the VIRTUAL_DISK_ACCESS_METAOPS and VIRTUAL_DISK_ACCESS_ATTACH_RO flags in the VirtualDiskAccessMask parameter passed to
/// OpenVirtualDisk, attaching the VHD by calling AttachVirtualDisk, and while the VHD is attached calling CompactVirtualDisk. Detaching the VHD before
/// compaction is done can cause compaction to return failure before it is done (similar to cancellation of compaction).
/// </description>
/// </item>
/// <item>
/// <description>
/// The second type, file-system-agnostic compaction, does not involve the file system but only looks for VHD blocks filled entirely with zeros (0). This
/// is done by including the VIRTUAL_DISK_ACCESS_METAOPS flag in the VirtualDiskAccessMask parameter passed to OpenVirtualDisk, and calling CompactVirtualDisk.
/// </description>
/// </item>
/// </list>
/// <para>
/// File-system-aware compaction is the most efficient compaction type but using first the file-system-aware compaction followed by the
/// file-system-agnostic compaction will produce the smallest VHD.
/// </para>
/// <para>
/// A compaction operation on a virtual disk can be safely interrupted and re-run later. Re-opening a virtual disk file that has been interrupted may
/// result in the reduction of a virtual disk file's size at the time of opening.
/// </para>
/// <para>Compaction can be CPU-intensive and/or I/O-intensive, depending on how large the virtual disk is and how many blocks require movement.</para>
/// <para>The CompactVirtualDisk function runs on the virtual disk in the same security context as the caller.</para>
/// <summary>Reduces the size of a virtual hard disk (VHD) backing store file.</summary>
/// <param name="VirtualDiskHandle">
/// A handle to the open virtual disk, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag in the VirtualDiskAccessMask parameter
/// passed to OpenVirtualDisk. For information on how to open a virtual disk, see the OpenVirtualDisk function.
/// </param>
/// <param name="Flags">Must be the COMPACT_VIRTUAL_DISK_FLAG_NONE value (0) of the COMPACT_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A optional pointer to a valid COMPACT_VIRTUAL_DISK_PARAMETERS structure that contains compaction parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is an error code. For more information, see
/// System Error Codes.
/// </returns>
/// <remarks>
/// Compaction can be run only on a virtual disk that is dynamically expandable or differencing.
/// <para>There are two different types of compaction.</para>
/// <list type="bullet">
/// <item>
/// <description>
/// The first type, file-system-aware compaction, uses the NTFS file system to determine free space. This is done by attaching the VHD as a read-only
/// device by including the VIRTUAL_DISK_ACCESS_METAOPS and VIRTUAL_DISK_ACCESS_ATTACH_RO flags in the VirtualDiskAccessMask parameter passed to
/// OpenVirtualDisk, attaching the VHD by calling AttachVirtualDisk, and while the VHD is attached calling CompactVirtualDisk. Detaching the VHD before
/// compaction is done can cause compaction to return failure before it is done (similar to cancellation of compaction).
/// </description>
/// </item>
/// <item>
/// <description>
/// The second type, file-system-agnostic compaction, does not involve the file system but only looks for VHD blocks filled entirely with zeros (0). This
/// is done by including the VIRTUAL_DISK_ACCESS_METAOPS flag in the VirtualDiskAccessMask parameter passed to OpenVirtualDisk, and calling CompactVirtualDisk.
/// </description>
/// </item>
/// </list>
/// <para>
/// File-system-aware compaction is the most efficient compaction type but using first the file-system-aware compaction followed by the
/// file-system-agnostic compaction will produce the smallest VHD.
/// </para>
/// <para>
/// A compaction operation on a virtual disk can be safely interrupted and re-run later. Re-opening a virtual disk file that has been interrupted may
/// result in the reduction of a virtual disk file's size at the time of opening.
/// </para>
/// <para>Compaction can be CPU-intensive and/or I/O-intensive, depending on how large the virtual disk is and how many blocks require movement.</para>
/// <para>The CompactVirtualDisk function runs on the virtual disk in the same security context as the caller.</para>
/// <summary>Creates a virtual hard disk (VHD) image file, either using default parameters or using an existing VHD or physical disk.</summary>
/// <param name="VirtualStorageType">A pointer to a VIRTUAL_STORAGE_TYPE structure that contains the desired disk type and vendor information.</param>
/// <param name="Path">A pointer to a valid string that represents the path to the new virtual disk image file.</param>
/// <param name="VirtualDiskAccessMask">The VIRTUAL_DISK_ACCESS_MASK value to use when opening the newly created virtual disk file.</param>
/// <param name="SecurityDescriptor">
/// An optional pointer to a SECURITY_DESCRIPTOR to apply to the virtual disk image file. If this parameter is NULL, the parent directory's security
/// descriptor will be used.
/// </param>
/// <param name="Flags">Creation flags, which must be a valid combination of the CREATE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="ProviderSpecificFlags">Flags specific to the type of virtual disk being created. May be zero if none are required.</param>
/// <param name="Parameters">A pointer to a valid CREATE_VIRTUAL_DISK_PARAMETERS structure that contains creation parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <param name="Handle">A pointer to the handle object that represents the newly created virtual disk.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Creates a virtual hard disk (VHD) image file, either using default parameters or using an existing VHD or physical disk.</summary>
/// <param name="VirtualStorageType">A pointer to a VIRTUAL_STORAGE_TYPE structure that contains the desired disk type and vendor information.</param>
/// <param name="Path">A pointer to a valid string that represents the path to the new virtual disk image file.</param>
/// <param name="VirtualDiskAccessMask">The VIRTUAL_DISK_ACCESS_MASK value to use when opening the newly created virtual disk file.</param>
/// <param name="SecurityDescriptor">
/// An optional pointer to a SECURITY_DESCRIPTOR to apply to the virtual disk image file. If this parameter is NULL, the parent directory's security
/// descriptor will be used.
/// </param>
/// <param name="Flags">Creation flags, which must be a valid combination of the CREATE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="ProviderSpecificFlags">Flags specific to the type of virtual disk being created. May be zero if none are required.</param>
/// <param name="Parameters">A pointer to a valid CREATE_VIRTUAL_DISK_PARAMETERS structure that contains creation parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <param name="Handle">A pointer to the handle object that represents the newly created virtual disk.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// Detaches a virtual hard disk (VHD) or CD or DVD image file (ISO) by locating an appropriate virtual disk provider to accomplish the operation.
/// </summary>
/// <param name="VirtualDiskHandle">
/// A handle to an open virtual disk, which must have been opened using the VIRTUAL_DISK_ACCESS_DETACH flag set in the VirtualDiskAccessMask parameter to
/// the OpenVirtualDisk function. For information on how to open a virtual disk, see the OpenVirtualDisk function.
/// </param>
/// <param name="Flags">A valid combination of values of the DETACH_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="ProviderSpecificFlags">Flags specific to the type of virtual disk being detached. May be zero if none are required.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is an error code. For more information, see
/// <summary>Increases the size of a fixed or dynamic virtual hard disk (VHD).</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag.</param>
/// <param name="Flags">Must be the EXPAND_VIRTUAL_DISK_FLAG_NONE value of the EXPAND_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A pointer to a valid EXPAND_VIRTUAL_DISK_PARAMETERS structure that contains expansion parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Increases the size of a fixed or dynamic virtual hard disk (VHD).</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag.</param>
/// <param name="Flags">Must be the EXPAND_VIRTUAL_DISK_FLAG_NONE value of the EXPAND_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A pointer to a valid EXPAND_VIRTUAL_DISK_PARAMETERS structure that contains expansion parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <param name="PathsBufferSizeInBytes">Size of the buffer supplied in <paramref name="PathsBuffer"/>.</param>
/// <param name="PathsBuffer">Buffer of sufficient size to hold all returned paths.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Returns the relationships between virtual hard disks (VHDs) or the volumes contained within those disks and their parent disk or volume.</summary>
/// <param name="ObjectHandle">A handle to an open VHD.</param>
/// <param name="Flags">A valid combination of GET_STORAGE_DEPENDENCY_FLAG values.</param>
/// <param name="StorageDependencyInfoSize">
/// Size, in bytes, of the STORAGE_DEPENDENCY_INFO structure that the StorageDependencyInfo parameter refers to.
/// </param>
/// <param name="StorageDependencyInfo">A pointer to a valid STORAGE_DEPENDENCY_INFO structure, which is a variable-length structure.</param>
/// <param name="SizeUsed">An optional pointer to a ULONG that receives the size used.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// A pointer to a valid <see cref="GET_VIRTUAL_DISK_INFO"/> structure. The format of the data returned is dependent on the value passed in the Version member by the caller.
/// <param name="SizeUsed">A pointer to a ULONG that contains the size used.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Retrieves the path to the physical device object that contains a virtual hard disk (VHD).</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_GET_INFO flag.</param>
/// <param name="DiskPathSizeInBytes">The size, in bytes, of the buffer pointed to by the DiskPath parameter.</param>
/// <param name="DiskPath">A target buffer to receive the path of the physical disk device that contains the VHD.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Merges a child virtual hard disk (VHD) in a differencing chain with parent disks in the chain.</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag.</param>
/// <param name="Flags">Must be the MERGE_VIRTUAL_DISK_FLAG_NONE value of the MERGE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A pointer to a valid MERGE_VIRTUAL_DISK_PARAMETERS structure that contains merge parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Merges a child virtual hard disk (VHD) in a differencing chain with parent disks in the chain.</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag.</param>
/// <param name="Flags">Must be the MERGE_VIRTUAL_DISK_FLAG_NONE value of the MERGE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">A pointer to a valid MERGE_VIRTUAL_DISK_PARAMETERS structure that contains merge parameter data.</param>
/// <param name="Overlapped">An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// Initiates a mirror operation for a virtual disk. Once the mirroring operation is initiated it will not complete until either CancelIo or CancelIoEx is called to cancel all I/O on the VirtualDiskHandle, leaving the original file as the current or BreakMirrorVirtualDisk is called to stop using the original file and only use the mirror. GetVirtualDiskOperationProgress can be used to determine if the disks are fully mirrored and writes go to both virtual disks.
/// </summary>
/// <param name="VirtualDiskHandle">A handle to the open virtual disk. For information on how to open a virtual disk, see the OpenVirtualDisk function.</param>
/// <param name="Flags">A valid combination of values from the MIRROR_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">Address of a MIRROR_VIRTUAL_DISK_PARAMETERS structure containing mirror parameter data.</param>
/// <param name="Overlapped">Address of an OVERLAPPEDstructure. This parameter is required.</param>
/// <returns>If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is an error code.For more information, see System Error Codes.</returns>
/// <summary>Opens a virtual hard disk (VHD) or CD or DVD image file (ISO) for use.</summary>
/// <param name="VirtualStorageType">A pointer to a valid VIRTUAL_STORAGE_TYPE structure.</param>
/// <param name="Path">A pointer to a valid path to the virtual disk image to open.</param>
/// <param name="VirtualDiskAccessMask">A valid value of the VIRTUAL_DISK_ACCESS_MASK enumeration.</param>
/// <param name="Flags">A valid combination of values of the OPEN_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">An optional pointer to a valid OPEN_VIRTUAL_DISK_PARAMETERS structure. Can be NULL.</param>
/// <param name="Handle">A pointer to the handle object that represents the open virtual disk.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS (0) and the Handle parameter contains a valid pointer to the new virtual disk object.
/// <para>
/// If the function fails, the return value is an error code and the value of the Handle parameter is undefined. For more information, see System Error Codes.
/// <param name="VirtualDiskHandle">Handle to an open virtual disk.</param>
/// <param name="Flags">Zero or more flags enumerated from the RESIZE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">Address of a RESIZE_VIRTUAL_DISK_PARAMETERS structure containing the new size of the virtual disk.</param>
/// <param name="Overlapped">If this is to be an asynchronous operation, the address of a valid OVERLAPPED structure.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS (0) and the Handle parameter contains a valid pointer to the new virtual disk object.
/// <para>
/// If the function fails, the return value is an error code and the value of the Handle parameter is undefined. For more information, see System Error Codes.
/// <param name="VirtualDiskHandle">Handle to an open virtual disk.</param>
/// <param name="Flags">Zero or more flags enumerated from the RESIZE_VIRTUAL_DISK_FLAG enumeration.</param>
/// <param name="Parameters">Address of a RESIZE_VIRTUAL_DISK_PARAMETERS structure containing the new size of the virtual disk.</param>
/// <param name="Overlapped">If this is to be an asynchronous operation, the address of a valid OVERLAPPED structure.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS (0) and the Handle parameter contains a valid pointer to the new virtual disk object.
/// <para>
/// If the function fails, the return value is an error code and the value of the Handle parameter is undefined. For more information, see System Error Codes.
/// <summary>Sets information about a virtual hard disk (VHD).</summary>
/// <param name="VirtualDiskHandle">A handle to the open VHD, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag.</param>
/// <param name="VirtualDiskInfo">A pointer to a valid SET_VIRTUAL_DISK_INFO structure.</param>
/// <returns>
/// If the function succeeds, the return value is ERROR_SUCCESS and the Handle parameter contains a valid pointer to the new virtual disk object. If the
/// function fails, the return value is an error code and the value of the Handle parameter is undefined.
/// <summary>Gets the default value for this structure. This is currently the only valid value for <see cref="ATTACH_VIRTUAL_DISK_PARAMETERS"/>.</summary>
/// <summary>Contains virtual hard disk (VHD) compacting parameters.</summary>
[StructLayout(LayoutKind.Sequential)]
publicstructCOMPACT_VIRTUAL_DISK_PARAMETERS
{
/// <summary>
/// A COMPACT_VIRTUAL_DISK_VERSION enumeration that specifies the version of the COMPACT_VIRTUAL_DISK_PARAMETERS structure being passed to or from
/// the virtual hard disk (VHD) functions.
/// </summary>
publicCOMPACT_VIRTUAL_DISK_VERSIONVersion;
/// <summary>Reserved. Must be set to zero.</summary>
publicuintReserved;
/// <summary>Gets the default value for this structure. This is currently the only valid value for <see cref="COMPACT_VIRTUAL_DISK_PARAMETERS"/>.</summary>
/// Initializes a CREATE_VIRTUAL_DISK_PARAMETERS with a maximum size.
/// </summary>
/// <param name="maxSize">
/// The maximum virtual size of the virtual disk object. Must be a multiple of 512. If a ParentPath is specified, this value must be zero. If a
/// SourcePath is specified, this value can be zero to specify the size of the source VHD to be used, otherwise the size specified must be greater
/// than or equal to the size of the source disk.
/// </param>
/// <param name="version">Set this number if you wish to force the version of this structure to something other than <see cref="CREATE_VIRTUAL_DISK_VERSION.CREATE_VIRTUAL_DISK_VERSION_1"/>.</param>
/// <param name="blockSize">Internal size of the virtual disk object blocks, in bytes. This must be set to one of the following values: 0 (default), 0x80000 (512K), or 0x200000 (2MB).</param>
/// <param name="logicalSectorSize">Internal size of the virtual disk object sectors. For VHDX must be set to 512 (0x200) or 4096 (0x1000). For VHD 1 must be set to 512.</param>
/// <summary>Unique identifier to assign to the virtual disk object. If this member is set to zero, a unique identifier is created by the system.</summary>
publicGuidUniqueId;
/// <summary>
/// The maximum virtual size of the virtual disk object. Must be a multiple of 512. If a ParentPath is specified, this value must be zero. If a
/// SourcePath is specified, this value can be zero to specify the size of the source VHD to be used, otherwise the size specified must be greater
/// than or equal to the size of the source disk.
/// </summary>
publiculongMaximumSize;
/// <summary>
/// Internal size of the virtual disk object blocks. If value is 0, block size will be automatically matched to the parent or source disk's setting
/// if ParentPath or SourcePath is specified (otherwise a block size of 2MB will be used).
/// </summary>
publicuintBlockSizeInBytes;
/// <summary>Internal size of the virtual disk object sectors. Must be set to 512.</summary>
publicuintSectorSizeInBytes;
/// <summary>
/// Optional path to a parent virtual disk object. Associates the new virtual disk with an existing virtual disk. If this parameter is not NULL,
/// SourcePath must be NULL.
/// </summary>
publicIntPtrParentPath;
/// <summary>
/// Optional fully qualified path to pre-populate the new virtual disk object with block data from an existing disk. This path may refer to a virtual
/// disk or a physical disk. If this parameter is not NULL, ParentPath must be NULL.
/// <summary>Unique identifier to assign to the virtual disk object. If this member is set to zero, a unique identifier is created by the system.</summary>
publicGuidUniqueId;
/// <summary>
/// The maximum virtual size of the virtual disk object. Must be a multiple of 512. If a ParentPath is specified, this value must be zero. If a
/// SourcePath is specified, this value can be zero to specify the size of the source VHD to be used, otherwise the size specified must be greater
/// than or equal to the size of the source disk.
/// </summary>
publiculongMaximumSize;
/// <summary>
/// Internal size of the virtual disk object blocks. If value is 0, block size will be automatically matched to the parent or source disk's setting
/// if ParentPath or SourcePath is specified (otherwise a block size of 2MB will be used).
/// </summary>
publicuintBlockSizeInBytes;
/// <summary>Internal size of the virtual disk object sectors. Must be set to 512.</summary>
publicuintSectorSizeInBytes;
/// <summary>Size of the physical disk object sectors.</summary>
publicuintPhysicalSectorSizeInBytes;
/// <summary>
/// Optional path to a parent virtual disk object. Associates the new virtual disk with an existing virtual disk. If this parameter is not NULL,
/// SourcePath must be NULL.
/// </summary>
publicIntPtrParentPath;
/// <summary>
/// Optional fully qualified path to pre-populate the new virtual disk object with block data from an existing disk. This path may refer to a virtual
/// disk or a physical disk. If this parameter is not NULL, ParentPath must be NULL.
/// </summary>
publicIntPtrSourcePath;
/// <summary>Zero or more flags from the OPEN_VIRTUAL_DISK_FLAG enumeration describing how the virtual disk is to be opened.</summary>
publicOPEN_VIRTUAL_DISK_FLAGOpenFlags;
/// <summary>A VIRTUAL_STORAGE_TYPE structure describing the parent virtual disk specified in the ParentPath member.</summary>
/// <summary>Unique identifier to assign to the virtual disk object. If this member is set to zero, a unique identifier is created by the system.</summary>
publicGuidUniqueId;
/// <summary>
/// The maximum virtual size of the virtual disk object. Must be a multiple of 512. If a ParentPath is specified, this value must be zero. If a
/// SourcePath is specified, this value can be zero to specify the size of the source VHD to be used, otherwise the size specified must be greater
/// than or equal to the size of the source disk.
/// </summary>
publiculongMaximumSize;
/// <summary>
/// Internal size of the virtual disk object blocks. If value is 0, block size will be automatically matched to the parent or source disk's setting
/// if ParentPath or SourcePath is specified (otherwise a block size of 2MB will be used).
/// </summary>
publicuintBlockSizeInBytes;
/// <summary>Internal size of the virtual disk object sectors. Must be set to 512.</summary>
publicuintSectorSizeInBytes;
/// <summary>Size of the physical disk object sectors.</summary>
publicuintPhysicalSectorSizeInBytes;
/// <summary>
/// Optional path to a parent virtual disk object. Associates the new virtual disk with an existing virtual disk. If this parameter is not NULL,
/// SourcePath must be NULL.
/// </summary>
publicIntPtrParentPath;
/// <summary>
/// Optional fully qualified path to pre-populate the new virtual disk object with block data from an existing disk. This path may refer to a virtual
/// disk or a physical disk. If this parameter is not NULL, ParentPath must be NULL.
/// </summary>
publicIntPtrSourcePath;
/// <summary>Zero or more flags from the OPEN_VIRTUAL_DISK_FLAG enumeration describing how the virtual disk is to be opened.</summary>
publicOPEN_VIRTUAL_DISK_FLAGOpenFlags;
/// <summary>A VIRTUAL_STORAGE_TYPE structure describing the parent virtual disk specified in the ParentPath member.</summary>
/// <summary>Indicates whether the virtual disk is 4 KB aligned.</summary>
[FieldOffset(8), MarshalAs(UnmanagedType.Bool)]
publicboolIs4kAligned;
/// <summary>Indicates whether the virtual disk is currently mounted and in use. TRUE if the virtual disk is currently mounted and in use; otherwise FALSE.</summary>
[FieldOffset(8), MarshalAs(UnmanagedType.Bool)]
publicboolIsLoaded;
/// <summary>Details about the physical disk on which the virtual disk resides.</summary>
/// <summary>The physical sector size of the virtual disk.</summary>
[FieldOffset(8)]
publicuintVhdPhysicalSectorSize;
/// <summary>The smallest safe minimum size of the virtual disk.</summary>
[FieldOffset(8)]
publiculongSmallestSafeVirtualSize;
/// <summary>The fragmentation level of the virtual disk.</summary>
[FieldOffset(8)]
publicuintFragmentationPercentage;
/// <summary>The identifier that is uniquely created when a user first creates the virtual disk to attempt to uniquely identify that virtual disk.</summary>
[FieldOffset(8)]
publicGuidVirtualDiskId;
/// <summary>The state of resilient change tracking (RCT) for the virtual disk.</summary>
/// <summary>Whether RCT is turned on. TRUE if RCT is turned on; otherwise FALSE.</summary>
[MarshalAs(UnmanagedType.Bool)]publicboolEnabled;
/// <summary>Whether the virtual disk has changed since the change identified by the MostRecentId member occurred. TRUE if the virtual disk has changed since the change identified by the MostRecentId member occurred; otherwise FALSE.</summary>
/// <summary>The change tracking identifier for the change that identifies the state of the virtual disk that you want to use as the basis of comparison to determine whether the NewerChanges member reports new changes.</summary>
publicIntPtrMostRecentId;
}
/// <summary>A structure with the following members
/// <note type="warning">While this structure will fill, the value of ParentLocationBuffer will the be first character of a truncated string.</note>
/// Fully qualified path where the mirrored virtual disk will be located. If the Flags parameter to MirrorVirtualDisk is
/// MIRROR_VIRTUAL_DISK_FLAG_NONE (0) then this file must not exist. If the Flags parameter to MirrorVirtualDisk is
/// MIRROR_VIRTUAL_DISK_FLAG_EXISTING_FILE (1) then this file must exist.
/// </summary>
publicIntPtrMirrorVirtualDiskPath;
}
/// <summary>Contains virtual disk open request parameters.</summary>
[StructLayout(LayoutKind.Explicit)]
publicclassOPEN_VIRTUAL_DISK_PARAMETERS
{
/// <summary>
/// An OPEN_VIRTUAL_DISK_VERSION enumeration that specifies the version of the OPEN_VIRTUAL_DISK_PARAMETERS structure being passed to or from the VHD functions.
/// </summary>
[FieldOffset(0)]
publicOPEN_VIRTUAL_DISK_VERSIONVersion;
/// <summary>This structure is used if the Version member is OPEN_VIRTUAL_DISK_VERSION_1 (1).</summary>
/// <summary>Initializes a new instance of the <see cref="OPEN_VIRTUAL_DISK_PARAMETERS"/> struct setting Version to OPEN_VIRTUAL_DISK_VERSION_1.</summary>
/// <param name="rwDepth">
/// <para>
/// Indicates the number of stores, beginning with the child, of the backing store chain to open as read/write. The remaining stores in the
/// differencing chain will be opened read-only. This is necessary for merge operations to succeed.
/// <item><term>0</term><term>Do not open for read/write at any depth. This value should be used for read-only operations.</term></item>
/// <item><term>OPEN_VIRTUAL_DISK_RW_DEPTH_DEFAULT (1)</term><term>Default value to use if no other value is desired.</term></item>
/// <item><term>n (user-defined)</term><term>This integer value should be the number of merge levels plus one, if a merge operation is intended.</term></item>
/// <summary>Gets the default value for this structure. This is currently the only valid value for <see cref="ATTACH_VIRTUAL_DISK_PARAMETERS"/>.</summary>
/// <item><term>0</term><term>Do not open for read/write at any depth. This value should be used for read-only operations.</term></item>
/// <item><term>OPEN_VIRTUAL_DISK_RW_DEPTH_DEFAULT (1)</term><term>Default value to use if no other value is desired.</term></item>
/// <item><term>n (user-defined)</term><term>This integer value should be the number of merge levels plus one, if a merge operation is intended.</term></item>
/// </list>
/// </summary>
publicuintRWDepth;
}
/// <summary>
/// This value is used if the Version member is OPEN_VIRTUAL_DISK_VERSION_2 (2).
/// <para><c>Windows 7 and Windows Server 2008 R2:</c> This structure is not supported until Windows 8 and Windows Server 2012.</para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
publicstructOPEN_VIRTUAL_DISK_PARAMETERS_Version2
{
/// <summary>If TRUE, indicates the handle is only to be used to get information on the virtual disk.</summary>
[MarshalAs(UnmanagedType.Bool)]
publicboolGetInfoOnly;
/// <summary>If TRUE, indicates the file backing store is to be opened as read-only.</summary>
[MarshalAs(UnmanagedType.Bool)]
publicboolReadOnly;
/// <summary>Resiliency GUID to specify when opening files.</summary>
publicGuidResiliencyGuid;
}
/// <summary>
/// This value is used if the Version member is OPEN_VIRTUAL_DISK_VERSION_3 (3).
/// <para><c>Windows 7 and Windows Server 2008 R2:</c> This structure is not supported until Windows 8 and Windows Server 2012.</para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
publicstructOPEN_VIRTUAL_DISK_PARAMETERS_Version3
{
/// <summary>If TRUE, indicates the handle is only to be used to get information on the virtual disk.</summary>
[MarshalAs(UnmanagedType.Bool)]
publicboolGetInfoOnly;
/// <summary>If TRUE, indicates the file backing store is to be opened as read-only.</summary>
[MarshalAs(UnmanagedType.Bool)]
publicboolReadOnly;
/// <summary>Resiliency GUID to specify when opening files.</summary>
publicGuidResiliencyGuid;
/// <summary></summary>
publicGuidSnapshotId;
}
/// <summary>Contains the parameters for a ResizeVirtualDisk function.</summary>
[StructLayout(LayoutKind.Sequential)]
publicstructRESIZE_VIRTUAL_DISK_PARAMETERS
{
/// <summary>
/// Discriminant for the union containing a value enumerated from the RESIZE_VIRTUAL_DISK_VERSION enumeration.
/// </summary>
publicRESIZE_VIRTUAL_DISK_VERSIONVersion;
/// <summary>Contains the new size of the virtual disk.</summary>
publiculongNewSize;
/// <summary>Initializes with default version and <paramref name="newSize"/>.</summary>
/// <param name="newSize">Contains the new size of the virtual disk.</param>
/// <summary>Sets the physical sector size reported by the VHD.</summary>
[FieldOffset(8)]publicuintVhdPhysicalSectorSize;
/// <summary>The identifier that is uniquely created when a user first creates the virtual disk to attempt to uniquely identify that virtual disk.</summary>
[FieldOffset(8)]publicGuidVirtualDiskId;
/// <summary>Turns resilient change tracking (RCT) on or off for the VHD. TRUE turns RCT on. FALSE turns RCT off.</summary>
/// <summary>Sets the parent linkage information that differencing VHDs store. Parent linkage information is metadata used to locate and correctly identify the next parent in the virtual disk chain.</summary>
/// <summary>Specifies the depth to the child from the leaf. The leaf itself is at depth 1.</summary>
publicuintChildDepth;
/// <summary>Specifies the depth to the parent from the leaf. The leaf itself is at depth 1.</summary>
publicIntPtrParentFilePath;
}
/// <summary>
/// Sets the parent linkage information that differencing VHDs store. Parent linkage information is metadata used to locate and correctly identify the next parent in the virtual disk chain.
/// <summary>Contains the progress and result data for the current virtual disk operation, used by the GetVirtualDiskOperationProgress function.</summary>
[StructLayout(LayoutKind.Sequential)]
publicstructVIRTUAL_DISK_PROGRESS
{
/// <summary>
/// A system error code status value, this member will be ERROR_IO_PENDING if the operation is still in progress; otherwise, the value is the result
/// code of the completed operation.
/// </summary>
publicuintOperationStatus;
/// <summary>
/// The current progress of the operation, used in conjunction with the CompletionValue member. This value is meaningful only if OperationStatus is ERROR_IO_PENDING.
/// </summary>
publiculongCurrentValue;
/// <summary>
/// The value that the CurrentValue member would be if the operation were complete. This value is meaningful only if OperationStatus is ERROR_IO_PENDING.
/// </summary>
publiculongCompletionValue;
}
/// <summary>Device type identifier.</summary>
[StructLayout(LayoutKind.Sequential)]
publicstructVIRTUAL_STORAGE_TYPE
{
/// <summary>The device identifier.</summary>
publicVIRTUAL_STORAGE_TYPE_DEVICE_TYPEDeviceId;
/// <summary>Vendor-unique identifier.</summary>
publicGuidVendorId;
/// <summary>
/// Initializes a new instance of <see cref="VIRTUAL_STORAGE_TYPE"/>.
/// </summary>
/// <param name="type">The type of disk to create.</param>
/// <param name="vendorIsMicrosoft"><c>true</c> if <see cref="VendorId"/> is to be assigned VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT.</param>