Retrieves the path to the physical device object that contains a virtual hard disk (VHD) or CD or DVD image file (ISO).
DWORD GetVirtualDiskPhysicalPath( HANDLE VirtualDiskHandle, PULONG DiskPathSizeInBytes, PWSTR DiskPath );
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.
The size, in bytes, of the buffer pointed to by the DiskPath parameter.
A target buffer to receive the path of the physical disk device that contains the virtual disk.
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.
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 \.<i>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.
|Minimum supported client||Windows 7|
|Minimum supported server||Windows Server 2008 R2|