GetVirtualDiskPhysicalPath function

Retrieves the path to the physical device object that contains a virtual hard disk (VHD) or CD or DVD image file (ISO).

Syntax


DWORD GetVirtualDiskPhysicalPath(
  _In_       HANDLE VirtualDiskHandle,
  _Inout_    PULONG DiskPathSizeInBytes,
  _Out_opt_  PWSTR DiskPath
);

Parameters

VirtualDiskHandle [in]

A handle to the open virtual disk, which must have been opened using the VIRTUAL_DISK_ACCESS_GET_INFO flag. For information on how to open a virtual disk, see the OpenVirtualDisk function.

DiskPathSizeInBytes [in, out]

The size, in bytes, of the buffer pointed to by the DiskPath parameter.

DiskPath [out, optional]

A target buffer to receive the path of the physical disk device that contains the virtual disk.

Return value

Status of the request.

If the function succeeds, the return value is ERROR_SUCCESS and the DiskPath parameter contains a pointer to a populated string.

If the function fails, the return value is an error code and the value of the contents of the buffer referred to by the DiskPath parameter is undefined. For more information, see System Error Codes.

Remarks

For the GetVirtualDiskPhysicalPath function to succeed, the virtual disk referred to by the VirtualDiskHandle parameter must be attached, the physical disk object must be to be located by the system, and the DiskPath parameter must refer to a buffer large enough to hold the resulting path. This path is in the form \\.\PhysicalDriveX where X is an integer that represents the particular enumeration of the physical disk on the caller's system.

CD and DVD image files (ISO) are not supported before Windows 8 and Windows Server 2012.

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2

Header

VirtDisk.h (include Windows.h)

Library

VirtDisk.lib

DLL

VirtDisk.dll

See also

About VHD
VHD Reference

 

 

Build date: 10/26/2012

Community Additions

ADD
Show:
© 2014 Microsoft