Collapse All
Parallels Virtualization SDK
ContentsIndex
PreviousUpNext
PrlVm_RegEx Function
PHT_VIRTUAL_MACHINE

Creates a new virtual machine and registers it with the Parallels Service.

Syntax
PRL_HANDLE PrlVm_RegEx(
    PRL_HANDLE hVm, 
    PRL_CONST_STR sVmParentPath, 
    PRL_UINT32 nFlags
);
File

PrlApiVm.h

Parameters

hVm
A handle of type PHT_VIRTUAL_MACHINE identifying the virtual machine.
sVmParentPath
Optional. Name and path of the parent directory where the virtual machine directory should be created. If this parameter is omitted (null pointer or empty string is passed), the new virtual machine directory will be created in the default directory for this Parallels Service.
nFlags
Flags set which specifies way of virtual machine creation. Use PACF_NON_INTERACTIVE_MODE flag here instead of deprecated bNonInteractiveMode parameter. Other bitset of flags - from enum PRL_CREATE_DISK_IMAGE_FLAGS

Returns

A handle of type PHT_JOB containing the results of this asynchronous operation or PRL_INVALID_HANDLE if there's not enough memory to instantiate the job object.

Remarks

The steps involved in creating a typical virtual machine are:

  1. Obtain a handle to a new virtual machine object using the PrlSrv_CreateVm function.
  2. Populate the object with the desired configuration data.
  3. Choose a name for the virtual machine and set it using the PrlVmCfg_SetName function.
  4. Create and register the new machine with a Parallels Service using the PrlVm_Reg function. This step will create the necessary virtual machine files on the host and will add the machine to the Parallels Service VM registry. The directory containing the virtual machine files will have the same name as the name you've chosen for your virtual machine. The directory will be created in the default VM root directory for this Parallels Service. If you would like to create the virtual machine directory in a different location, you may specify the desired parent directory name and path.

To get the return code from the PHT_JOB object, use the PrlJob_GetRetCode function. Possible values are: 

PRL_ERR_INVALID_ARG - invalid handle or null pointer was passed. 

PRL_ERR_SUCCESS - function completed successfully. 

Links
© 2021 Parallels International GmbH. All rights reserved.