IVMVirtualPC::CreateFixedVirtualHardDisk method

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

Creates a fixed-size virtual hard disk.

Syntax

HRESULT CreateFixedVirtualHardDisk(
  [in]          BSTR    imagePath,
  [in]          long    size,
  [out, retval] IVMTask **diskTask
);

Parameters

imagePath [in]

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

size [in]

The size, in megabytes, of the image. Maximum size is 2,088,960 MB (2040GB).

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.
E_INVALIDARG
0x80000003
The size parameter is less than or equal to 0.
HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
0x80070003
The system cannot find the path specified by the imagePath 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 parameter contains an invalid character (one of "*?:<>/|"").
HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME)
0x800700a1
Both the imagePath 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 parameter is too long. The length of the path must be less than MAX_PATH (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 size parameter must be less than 2,088,960 MB. If the format is FAT16, then the size parameter 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. 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.

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