Επεξεργασία

Κοινή χρήση μέσω


IVMHardDisk::MergeTo method

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Merges a differencing virtual hard disk with all of its parents (up to and including the root parent virtual hard disk) to a new hard disk file.

Syntax

HRESULT MergeTo(
  [in]          BSTR           newDiskImagePath,
  [in]          VMHardDiskType newDiskImageType,
  [out, retval] IVMTask        **mergeTask
);

Parameters

newDiskImagePath [in]

The path to the new target disk image where the selected disk images will be merged.

newDiskImageType [in]

The type of new target disk image. The image types allowed for the new target disk image are vmDiskType_Dynamic and vmDiskType_FixedSize. For more information, see VMHardDiskType.

mergeTask [out, retval]

An IVMTask object that is used to track the completion of the merging process.

Return value

This method can return one of these values.

Return code/value Description
S_OK
0
The operation was successful.
E_POINTER
0x80004003
A parameter is NULL.
E_INVALIDARG
0x80000003
The newDiskImagePath parameter is empty.
HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
0x80070002
The system cannot find the file specified by the newDiskImagePath parameter.
HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
0x80070003
The system cannot find the path specified by the newDiskImagePath parameter.
HRESULT_FROM_WIN32(ERROR_INVALID_NAME)
0x8007007b
The newDiskImagePath parameter contains an invalid character (one of the following: "*?<>/|":").
HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME)
0x800700a1
The newDiskImagePath parameter specifies an empty or relative path. An absolute path is required.
HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW)
0x8007006f
The path specified by the newDiskImagePath parameter is too long. The path must be less than 260 characters.
HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION)
0x80070020
Either the virtual hard disk referenced by this object is in use or the parent of this virtual hard disk is in use.
VM_E_WRONG_HD_IMAGE_TYPE
0xA004067B
This error is caused either because the virtual hard disk image referenced by this IVMHardDisk object is not a differencing disk image or because the parameter newDiskImageType is not one of the accepted values, vmDiskType_Dynamic or vmDiskType_FixedSize.
HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)
0x800700b7
The file referenced by the newDiskImagePath parameter already exists.
HRESULT_FROM_WIN32(ERROR_DISK_FULL)
0x80070070
The host volume does not have enough space to merge this virtual hard disk.
VM_E_PARENT_PATH_NOT_FOUND
0xA0040677
The parent of the virtual hard disk referenced by this object does not exist.
VM_E_APP_SHUTTING_DOWN
0xA0040209
The virtual hard disk image cannot be merged because the application is shutting down.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMHardDisk is defined as ffa14ae6-48f5-42a4-8a22-186f2e5c7db0

See also

IVMHardDisk