Rediger

Del via


IVMVirtualPC::CreateDifferencingVirtualHardDisk method

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

Creates a differencing virtual hard disk.

Syntax

HRESULT CreateDifferencingVirtualHardDisk(
  [in]          BSTR    imagePath,
  [in]          BSTR    parentPath,
  [out, retval] IVMTask **diskTask
);

Parameters

imagePath [in]

The path to the new disk image file. The containing folder will be created if it does not exist.

parentPath [in]

The path to the parent disk image file.

diskTask [out, retval]

An IVMTask object that is used to track the creation of the image.

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.
HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
0x80070003
The system cannot find the path specified by the imagePath or parentPath parameter.
HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE)
0x8007000f
The file specified by the imagePath parameter is on a CD-ROM or DVD-ROM.
HRESULT_FROM_WIN32(ERROR_INVALID_NAME)
0x8007007b
The imagePath or parentPath parameter contains an invalid character (one of "*?:<>/|"").
HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME)
0x800700a1
Both the imagePath and parentPath parameter specifies an empty or relative path. At least one of the parameters must be an absolute path.
HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW)
0x8007006f
The path specified by the imagePath or parentPath parameters is too long. The length of the path must be less than 260 characters.
HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)
0x800700b7
The file referenced by the imagePath parameter already exists.
HRESULT_FROM_WIN32(ERROR_DISK_FULL)
0x80070070
The dynamically expanding virtual hard disk image needs at least 8 MB free on the host volume.
VM_E_IMAGE_SIZE_TOO_LARGE
0xA0040683
The parameter size must be less than 2,088,960 MB. If the format is FAT16, then size must be less than 2000 MB.
VM_E_IMAGE_SIZE_TOO_SMALL
0xA0040684
Unformatted and FAT16 formatted virtual hard disk images must be at least 3 MB. FAT32 formatted virtual hard disk images must be at least 514 MB.
VM_E_FILE_TOO_LARGE_FOR_VOLUME
0xA0040679
The host volume cannot support a file this size if the dynamically expanding virtual hard disk image expands to its full limit. The maximum file size for a FAT32 volume is 4 GB. The maximum file size for a FAT16 volume is 2 GB.
VM_E_APP_SHUTTING_DOWN
0xA0040209
The virtual hard disk cannot be created after the application has started shutting down.
VM_E_HARDWARE_VIRTUALIZATION_DISABLED
0xA0040951
The processor does not support Hardware Accelerated Virtualization (HAV) extensions.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Remarks

Although either imagePath or parentPath can be a relative path, at least one of these must be an absolute path. If one path parameter is a relative path, it is assumed to be relative to the other path parameter.

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_IVMVirtualPC is defined as 236ba0d9-a24a-4292-a132-27c1421dfd01

See also

IVMVirtualPC