/* currenty, nsISupportsImpl.h lacks the below-like macros */ #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1_CI NS_IMPL_QUERY_INTERFACE1_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2_CI NS_IMPL_QUERY_INTERFACE2_CI #ifndef NS_IMPL_THREADSAFE_ISUPPORTS1_CI # define NS_IMPL_THREADSAFE_ISUPPORTS1_CI(_class, _interface) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE1_CI(_class, _interface) \ NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS2_CI # define NS_IMPL_THREADSAFE_ISUPPORTS2_CI(_class, _i1, _i2) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE2_CI(_class, _i1, _i2) \ NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) #endif #ifndef NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI # define NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_INTERFACE_MAP_BEGIN(_class) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i1, _ic1) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _ic1) \ NS_IMPL_QUERY_CLASSINFO(_class) \ NS_INTERFACE_MAP_END #endif #ifndef NS_IMPL_QUERY_INTERFACE2_AMBGUOUS_CI # define NS_IMPL_QUERY_INTERFACE2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_INTERFACE_MAP_BEGIN(_class) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i1, _ic1) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_i2, _ic2) \ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _ic1) \ NS_IMPL_QUERY_CLASSINFO(_class) \ NS_INTERFACE_MAP_END #endif #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1_AMBIGUOUS_CI NS_IMPL_QUERY_INTERFACE1_AMBIGUOUS_CI #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2_AMBIGUOUS_CI NS_IMPL_QUERY_INTERFACE2_AMBIGUOUS_CI #ifndef NS_IMPL_THREADSAFE_ISUPPORTS1_AMBIGUOUS_CI # define NS_IMPL_THREADSAFE_ISUPPORTS1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE1_AMBIGUOUS_CI(_class, _i1, _ic1) \ NS_IMPL_CI_INTERFACE_GETTER1(_class, _i1) #endif #ifndef NS_IMPL_THREADSAFE_ISUPPORTS2_AMBIGUOUS_CI # define NS_IMPL_THREADSAFE_ISUPPORTS2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ NS_IMPL_THREADSAFE_QUERY_INTERFACE2_AMBIGUOUS_CI(_class, _i1, _ic1, \ _i2, _ic2) \ NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2) #endif Boolean variable having a third state, default. Virtual machine execution state. This enumeration represents possible values of the attribute. null value. Never used by the API. The machine is not running. The machine is not currently running, but the execution state of the machine has been saved to an external file when it was running. No any machine settings can be altered when the machine is in this state. A process that run the machine has abnormally terminated. Other than that, this value is equivalent to #PoweredOff. The machine is currently being executed. This value can be used in comparison expressions: all state values below it describe a virtual machine that is not currently being executed (i.e., it is completely out of action). For whoever decides to touch this enum: In order to keep the aforementioned comparisons valid, this state must immediately preceed the Paused state. Execution of the machine has been paused. This value can be used in comparison expressions: all state values above it represent unstable states of the running virtual machine. Unless explicitly stated otherwise, no machine settings can be altered when it is in one of the unstable states. For whoever decides to touch this enum: In order to keep the aforementioned comparisons valid, this state must immediately follow the Running state. Execution of the machine has reached the "Guru Meditaion" condition. This condition indicates an internal VMM failure which may happen as a result of either an unhandled low-level virtual hardware exception or one of the recompiler exceptions (such as the too-many-traps condition). Machine is being started after powering it on from a zero execution state. Machine is being normally stopped (after explicitly powering it off, or after the guest OS has initiated a shutdown sequence). Machine is saving its execution state to a file as a result of calling or an online snapshot of the machine is being taken using . Execution state of the machine is being restored from a file after powering it on from a saved execution state. Snapshot of the machine is being discarded after calling or its current state is being discarded after . Lengthy setup operation is in progress (e.g. ). Session state. This enumeration represents possible values of and attributes. Individual value descriptions contain the appropriate meaning for every case. null value. Never used by the API. The machine has no open sessions (); the session is closed () The machine has an open direct session (); the session is open () A new (direct) session is being opened for the machine as a result of call (); the session is currently being opened as a result of call () The direct session is being closed (); the session is being closed () Session type. This enumeration represents possible values of the attribute. null value. Never used by the API. Direct session (opened by ) Remote session (opened by ) Existing session (opened by ) Device type. null value which may also mean "no device". This value is not allowed for Floppy device. CD/DVD-ROM device. Hard disk device. Network device. USB device. Shared folder device. Device activity for . Interface bus type for storage devices. null value. Never used by the API. Host-Guest clipboard interchange mode. Scope of the operation. A generic enumeration used in various methods to define the action or argument scope. Statistics type for . Idle CPU load (0-100%) for last interval. Kernel CPU load (0-100%) for last interval. User CPU load (0-100%) for last interval. Total number of threads in the system. Total number of processes in the system. Total number of handles in the system. Memory load (0-100%). Total physical memory in megabytes. Free physical memory in megabytes. Ballooned physical memory in megabytes. Total amount of memory in the committed state in megabytes. Total amount of memory used by the guest OS's kernel in megabytes. Total amount of paged memory used by the guest OS's kernel in megabytes. Total amount of nonpaged memory used by the guest OS's kernel in megabytes. Total amount of memory used by the guest OS's system cache in megabytes. Pagefile size in megabytes. Statistics sample number BIOS boot menu mode. IDE controller type. null value. Never used by the API. null value. Never used by the API. The IVirtualBoxErrorInfo interface represents extended error information. Extended error information can be set by VirtualBox components after unsuccessful or partially successful method invocation. This information can be retrieved by the calling party as an IVirtualBoxErrorInfo object and then shown to the client in addition to the plain 32-bit result code. In MS COM, this interface extends the IErrorInfo interface, in XPCOM, it extends the nsIException interface. In both cases, it provides a set of common attributes to retrieve error information. Sometimes invocation of some component's method may involve methods of other components that may also fail (independently of this method's failure), or a series of non-fatal errors may precede a fatal error that causes method failure. In cases like that, it may be desirable to preserve information about all errors happened during method invocation and deliver it to the caller. The attribute is intended specifically for this purpose and allows to represent a chain of errors through a single IVirtualBoxErrorInfo object set after method invocation. Note that errors are stored to a chain in the reverse order, i.e. the initial error object you query right after method invocation is the last error set by the callee, the object it points to in the @a next attribute is the previous error and so on, up to the first error (which is the last in the chain). Result code of the error. Usually, it will be the same as the result code returned by the method that provided this error information, but not always. For example, on Win32, CoCreateInstance() will most likely return E_NOINTERFACE upon unsuccessful component instantiation attempt, but not the value the component factory returned. In MS COM, there is no equivalent. In XPCOM, it is the same as nsIException::result. UUID of the interface that defined the error. In MS COM, it is the same as IErrorInfo::GetGUID. In XPCOM, there is no equivalent. Name of the component that generated the error. In MS COM, it is the same as IErrorInfo::GetSource. In XPCOM, there is no equivalent. Text description of the error. In MS COM, it is the same as IErrorInfo::GetDescription. In XPCOM, it is the same as nsIException::message. Next error object if there is any, or @c null otherwise. In MS COM, there is no equivalent. In XPCOM, it is the same as nsIException::inner. The execution state of the given machine has changed. IMachine::state ID of the machine this event relates to. New execution state. Any of the settings of the given machine has changed. ID of the machine this event relates to. Notification when someone tries to change extra data for either the given machine or (if null) global extra data. This gives the chance to veto against changes. ID of the machine this event relates to (null ID for global extra data change requests). Extra data key for the attempted write. Extra data value for the given key. Optional error message describing the reason of the veto (ignored if this notification returns @c true). Flag to indicate whether the callee agrees (@ true) or vetoes against the change (@ false). Notification when machine specific or global extra data has changed. ID of the machine this event relates to. Null for global extra data changes. Extra data key that has changed. Extra data value for the given key. The given media was registered or unregistered within this VirtualBox installation. The @a mediaType parameter describes what type of media the specified @a mediaId refers to. Possible values are:
  • : the media is a hard disk that, if registered, can be obtained using the call.
  • : the media is a CD/DVD image that, if registered, can be obtained using the call.
  • : the media is a Floppy image that, if registered, can be obtained using the call.
Note that if this is a deregistration notification, there is no way to access the object representing the unregistered media. It is supposed that the application will do required cleanup based on the @a mediaId value.
ID of the media this event relates to. Type of the media this event relates to. If true, the media was registered, otherwise it was unregistered.
The given machine was registered or unregistered within this VirtualBox installation. ID of the machine this event relates to. If true, the machine was registered, otherwise it was unregistered. The state of the session for the given machine was changed. IMachine::sessionState ID of the machine this event relates to. New session state. A new snapshot of the machine has been taken. ISnapshot ID of the machine this event relates to. ID of the new snapshot. Snapshot of the given machine has been discarded. This notification is delivered after the snapshot object has been uninitialized on the server (so that any attempt to call its methods will return an error). ISnapshot ID of the machine this event relates to. ID of the discarded snapshot. null means the current machine state has been discarded (restored from the current snapshot). Snapshot properties (name and/or description) have been changed. ISnapshot ID of the machine this event relates to. ID of the changed snapshot. Notification when a guest property has changed. ID of the machine this event relates to. The name of the property that has changed. The new property value. The new property flags.
The IVirtualBox interface represents the main interface exposed by the product that provides virtual machine management. An instance of IVirtualBox is required for the product to do anything useful. Even though the interface does not expose this, internally, IVirtualBox is implemented as a singleton and actually lives in the process of the VirtualBox server (VBoxSVC.exe). This makes sure that IVirtualBox can track the state of all virtual machines on a particular host, regardless of which frontend started them. To enumerate all the virtual machines on the host, use the attribute. A string representing the version number of the product. The format is 3 integer numbers divided by dots (e.g. 1.0.1). The last number represents the build number and will frequently change. The internal build revision number of the product. A string representing the package type of this product. The format is OS_ARCH_DIST where OS is either WINDOWS, LINUX, SOLARIS, DARWIN. ARCH is either 32BITS or 64BITS. DIST is either GENERIC, UBUNTU_606, UBUNTU_710, or something like this. Full path to the directory where the global settings file, VirtualBox.xml, is stored. In this version of VirtualBox, the value of this property is always <user_dir>/.VirtualBox (where <user_dir> is the path to the user directory, as determined by the host OS), and cannot be changed. This path is also used as the base to resolve relative paths in places where relative paths are allowed (unless otherwise expressly indicated). Full name of the global settings file. The value of this property corresponds to the value of plus /VirtualBox.xml. Current version of the format of the global VirtualBox settings file (VirtualBox.xml). The version string has the following format:
          x.y-platform
        
where x and y are the major and the minor format versions, and platform is the platform identifier. The current version usually matches the value of the attribute unless the settings file was created by an older version of VirtualBox and there was a change of the settings file format since then. Note that VirtualBox automatically converts settings files from older versions to the most recent version when reading them (usually at VirtualBox startup) but it doesn't save the changes back until you call a method that implicitly saves settings (such as ) or call explicitly. Therefore, if the value of this attribute differs from the value of , then it means that the settings file was converted but the result of the conversion is not yet saved to disk. The above feature may be used by interactive front-ends to inform users about the settings file format change and offer them to explicitly save all converted settings files (the global and VM-specific ones), optionally create backup copies of the old settings files before saving, etc. settingsFormatVersion, saveSettingsWithBackup()
Most recent version of the settings file format. The version string has the following format:
          x.y-platform
        
where x and y are the major and the minor format versions, and platform is the platform identifier. VirtualBox uses this version of the format when saving settings files (either as a result of method calls that require to save settings or as a result of an explicit call to ). settingsFileVersion
Associated host object. Associated system information object. Array of machine objects registered within this VirtualBox instance. Array of hard disk objects known to this VirtualBox installation. This array contains only base (root) hard disks. All differencing hard disks of the given base hard disk can be enumerated using . Array of CD/DVD image objects registered with this VirtualBox instance. Array of floppy image objects registered with this VirtualBox instance. Collection of global shared folders. Global shared folders are available to all virtual machines. New shared folders are added to the collection using . Existing shared folders can be removed using . In the current version of the product, global shared folders are not implemented and therefore this collection is always empty. Associated performance collector object. Creates a new virtual machine. The new machine will have "empty" default settings and will not yet be registered. The typical sequence to create a virtual machine is therefore something like this:
  1. Call this method (IVirtualBox::createMachine) to have a new machine created. The machine object returned is "mutable", i.e. automatically locked for the current session, as if had been called on it.
  2. Assign meaningful settings to the new machine by calling the respective methods.
  3. Call to have the settings written to the machine's XML settings file. The configuration of the newly created machine will not be saved to disk (and the settings subfolder and file, as described below, will not be created) until this method is called.
  4. Call to have the machine show up in the list of machines registered with VirtualBox.
Every machine has a settings file that is used to store the machine configuration. This file is stored in the directory called machine settings subfolder. Unless specified otherwise, both the subfolder and the settings file will have a name that corresponds to the name of the virtual machine. You can specify where to create the machine settings subfolder using the @a baseFolder argument. The base folder can be absolute (full path) or relative to the VirtualBox home directory. If a null or empty string is given as the base folder (which is recommended), the default machine settings folder will be used as the base folder to create the machine settings subfolder and file. In any case, the full path to the settings file will look like:
          <base_folder>/<machine_name>/<machine_name>.xml
        
Optionally the UUID of the machine can be predefined. If this is not desired (i.e. a new UUID should be generated), pass just an empty or null UUID. You should also specify a valid name for the machine. See the property description for more details about the machine name. The created machine remains unregistered until you call . There is no way to change the name of the settings file or subfolder of the created machine directly.
Name of the folder where to create the machine settings subfolder containing the settings file. Machine name. UUID of the newly created VM, when non-null or non-empty. Otherwise a UUID is automatically generated. Created machine object.
Creates a new virtual machine in "legacy" mode, using the specified settings file to store machine settings. As opposed to machines created by , the settings file of the machine created in "legacy" mode is not automatically renamed when the machine name is changed -- it will always remain the same as specified in this method call. The specified settings file name can be absolute (full path) or relative to the VirtualBox home directory. If the file name doesn't contain an extension, the default extension (.xml) will be appended. Optionally the UUID of the machine can be predefined. If this is not desired (i.e. a new UUID should be generated), pass just an empty or null UUID. Note that the configuration of the newly created machine is not saved to disk (and therefore no settings file is created) until is called. If the specified settings file already exists, will return an error. You should also specify a valid name for the machine. See the property description for more details about the machine name. The created machine remains unregistered until you call . @deprecated This method may be removed later. It is better to use . There is no way to change the name of the settings file of the created machine. Name of the file where to store machine settings. Machine name. UUID of the newly created VM, when non-null or non-empty. Otherwise a UUID is automatically generated. Created machine object. Opens a virtual machine from the existing settings file. The opened machine remains unregistered until you call . The specified settings file name can be absolute (full path) or relative to the VirtualBox home directory. This file must exist and must be a valid machine settings file whose contents will be used to construct the machine object. @deprecated Will be removed soon. Name of the machine settings file. Opened machine object. will return false for the created machine, until any of machine settings are changed. Registers the machine previously created using or opened using within this VirtualBox installation. After successful method invocation, the signal is sent to all registered callbacks. This method implicitly calls to save all current machine settings before registering it. Attempts to find a virtual machine given its UUID. To look up a machine by name, use instead. Attempts to find a virtual machine given its name. To look up a machine by UUID, use instead. Unregisters the machine previously registered using . After successful method invocation, the signal is sent to all registered callbacks. The specified machine must not be in the Saved state, have an open (or a spawning) direct session associated with it, have snapshots or have hard disks attached. This method implicitly calls to save all current machine settings before unregistering it. If the given machine is inaccessible (see ), it will be unregistered and fully uninitialized right afterwards. As a result, the returned machine object will be unusable and an attempt to call any method will return the "Object not ready" error. UUID of the machine to unregister. Unregistered machine object. Creates a new base hard disk object that will use the given storage format and location for hard disk data. Note that the actual storage unit is not created by this method. In order to do it, and before you are able to attach the created hard disk to virtual machiens, you must call one of the following methods to allocate a format-specific storage unit at the specified location:
Some hard disk attributes, such as , may remain uninitialized until the hard disk storage unit is successfully created by one of the above methods. After the storage unit is successfully created, the hard disk gets remembered by this VirtualBox installation and will be accessible trhough and methods. Remembered root (base) hard disks are also returned as part of the array. See IHardDisk2 for more details. The list of all storage formats supported by this VirtualBox installation can be obtained using . Note that the format of the location string is storage format specific. See , IHardDisk2 and for more details.
Storage format to use for the new hard disk. Location of the storage unit for the new hard disk. Created hard disk object.
Opens a hard disk from an existing location. After the hard disk is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible trhough and methods. Remembered root (base) hard disks are also returned as part of the array and can be attached to virtual machines. See IHardDisk2 for more details. If a differencing hard disk is to be opened by this method, the operation will succeed only if its parent hard disk and all ancestors, if any, are already known to this VirtualBox installation (for example, were opened by this method before). This method tries to guess the storage format of the specified hard disk by reading hard disk data at the specified location. Note that the format of the location string is storage format specific. See , IHardDisk2 and for more details. Location of the storage unit that contains hard disk data in one of the supported storage formats. Opened hard disk object. Returns a hard disk with the given UUID. The hard disk with the given UUID must be known to this VirtualBox installation, i.e. it must be previously created by or opened by , or attached to some known virtual machine. UUID of the hard disk to look for. Found hard disk object. Returns a hard disk that uses the given location to store hard disk data. The given hard disk must be known to this VirtualBox installation, i.e. it must be previously created by or opened by , or attached to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known hard disk. For locations repesented by file names in the host's filesystem, the requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default hard disk folder will be prepended to the file name before seacrhing. Note that on case sensitive filesystems, a case sensitive comparison is performed, otherwise the case of symbols in the file path is ignored. Location string to search for. Found hard disk object. Opens a CD/DVD image contained in the specified file of the supported format and assigns it the given UUID. After the image is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible trhough and methods. Remembered images are also returned as part of the array and can be mounted to virtual machines. See IMedium for more details. See to get more details about the format of the location string. Currently, only ISO CD/DVD images are supported by VirtualBox. Full path to the file that contains a valid CD/DVD image. UUID to assign to the given image within this VirtualBox installation. If an empty (null) UUID is specified, the system will randomly generate a new UUID. Opened CD/DVD image object. Returns a CD/DVD image with the given UUID. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. UUID of the image to look for. Found CD/DVD image object. Returns a CD/DVD image with the given image location. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known CD/DVD image. The requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default hard disk folder will be prepended to the file name before seacrhing. Note that on case sensitive filesystems, a case sensitive comparison is performed, otherwise the case of symbols in the file path is ignored. CD/DVD image file path to look for. Found CD/DVD image object. Opens a floppy image contained in the specified file of the supported format and assigns it the given UUID. After the image is successfully opened by this method, it gets remembered by (known to) this VirtualBox installation and will be accessible trhough and methods. Remembered images are also returned as part of the array and can be mounted to virtual machines. See IMedium for more details. See to get more details about the format of the location string. Currently, only raw floppy images are supported by VirtualBox. Full path to the file that contains a valid floopy image. UUID to assign to the given image file within this VirtualBox installation. If an empty (null) UUID is specified, the system will randomly generate a new UUID. Opened floppy image object. Returns a floppy image with the given UUID. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. UUID of the image to look for. Found floppy image object. Returns a floppy image with the given image location. The image with the given UUID must be known to this VirtualBox installation, i.e. it must be previously opened by , or mounted to some known virtual machine. The search is done by comparing the value of the @a location argument to the attribute of each known floppy image. The requested location can be a path relative to the VirtualBox home folder. If only a file name without any path is given, the default hard disk folder will be prepended to the file name before seacrhing. Note that on case sensitive filesystems, a case sensitive comparison is performed, otherwise the case of symbols in the file path is ignored. Floppy image file path to look for. Found floppy image object. Returns an object describing the specified guest OS type. The requested guest OS type is specified using a string which is a mnemonic identifier of the guest operating system, such as "win31" or "ubuntu". The guest OS type ID of a particular virtual machine can be read or set using the attribute. The collection contains all available guest OS type objects. Each object has an attribute which contains an identifier of the guest OS this object describes. Guest OS type ID string. Guest OS type object. Creates a new global shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes the global shared folder with the given name previously created by from the collection of shared folders and stops sharing it. Logical name of the shared folder to remove. Returns the global extra data key name following the supplied key. An error is returned if the supplied @a key does not exist. @c NULL is returned in @a nextKey if the supplied key is the last key. When supplying @c NULL for the @a key, the first key item is returned in @a nextKey (if there is any). @a nextValue is an optional parameter and if supplied, the next key's value is returned in it. Name of the data key to follow. Name of the next data key. Value of the next data key. Returns associated global extra data. If the requested data @a key does not exist, this function will succeed and return @c NULL in the @a value argument. Name of the data key to get. Value of the requested data key. Sets associated global extra data. If you pass @c NULL as a key @a value, the given @a key will be deleted. Before performing the actual data change, this method will ask all registered callbacks using the notification for a permission. If one of the callbacks refuses the new value, the change will not be performed. On success, the notification is called to inform all registered callbacks about a successful data change. Name of the data key to set. Value to assign to the key. Opens a new direct session with the given virtual machine. A direct session acts as a local lock on the given VM. There can be only one direct session open at a time for every virtual machine, protecting the VM from being manipulated by conflicting actions from different processes. Only after a direct session has been opened, one can change all VM settings and execute the VM in the process space of the session object. Sessions therefore can be compared to mutex semaphores that lock a given VM for modification and execution. See ISession for details. Unless you are writing a new VM frontend, you will not want to execute a VM in the current process. To spawn a new process that executes a VM, use instead. Upon successful return, the session object can be used to get access to the machine and to the VM console. In VirtualBox terminology, the machine becomes "mutable" after a session has been opened. Note that the "mutable" machine object, on which you may invoke IMachine methods to change its settings, will be a different object from the immutable IMachine objects returned by various IVirtualBox methods. To obtain a mutable IMachine object (upon which you can invoke settings methods), use the attribute. One must always call to release the lock on the machine, or the machine's state will eventually be set to "Aborted". In other words, to change settings on a machine, the following sequence is typically performed:
  1. Call this method (openSession) to have a machine locked for the current session.
  2. Obtain a mutable IMachine object from .
  3. Change the settings of the machine.
  4. Call .
  5. Close the session by calling .
Session object that will represent the opened session after successful method invocation. This object must not represent the already open session. This session will be automatically closed if the VirtualBox server is terminated for some reason. ID of the virtual machine to open a session with.
Spawns a new process that executes a virtual machine (called a "remote session"). Opening a remote session causes the VirtualBox server to start a new process that opens a direct session with the given VM. As a result, the VM is locked by that direct session in the new process, preventing conflicting changes from other processes. Since sessions act as locks that such prevent conflicting changes, one cannot open a remote session for a VM that already has another open session (direct or remote), or is currently in the process of opening one (see ). While the remote session still provides some level of control over the VM execution to the caller (using the interface), not all VM settings are available for modification within the remote session context. This operation can take some time (a new VM is started in a new process, for which memory and other resources need to be set up). Because of this, an is returned to allow the caller to wait for this asynchronous operation to be completed. Until then, the remote session object remains in the closed state, and accessing the machine or its console through it is invalid. It is recommended to use or similar calls to wait for completion. As with all objects, it is recommended to call on the local session object once openRemoteSession() has been called. However, the session's state (see ) will not return to "Closed" until the remote session has also closed (i.e. until the VM is no longer running). In that case, however, the state of the session will automatically change back to "Closed". Currently supported session types (values of the @a type argument) are:
  • gui: VirtualBox Qt GUI session
  • vrdp: VirtualBox VRDP Server session
The @a environment argument is a string containing definitions of environment variables in the following format: @code NAME[=VALUE]\n NAME[=VALUE]\n ... @endcode where \\n is the new line character. These environment variables will be appended to the environment of the VirtualBox server process. If an environment variable exists both in the server process and in this list, the value from this list takes precedence over the server's variable. If the value of the environment variable is omitted, this variable will be removed from the resulting environment. If the environment string is @c null, the server environment is inherited by the started process as is. openExistingSession
Session object that will represent the opened remote session after successful method invocation (this object must not represent an already open session). ID of the virtual machine to open a session with. Type of the remote session (case sensitive). Environment to pass to the opened session (may be @c null). Progress object to track the operation completion.
Opens a new remote session with the virtual machine for which a direct session is already open. The remote session provides some level of control over the VM execution (using the IConsole interface) to the caller; however, within the remote session context, not all VM settings are available for modification. As opposed to , the number of remote sessions opened this way is not limited by the API It is an error to open a remote session with the machine that doesn't have an open direct session. openRemoteSession Session object that will represent the open remote session after successful method invocation. This object must not represent an already open session. This session will be automatically closed when the peer (direct) session dies or gets closed. ID of the virtual machine to open a session with. Registers a new global VirtualBox callback. The methods of the given callback object will be called by VirtualBox when an appropriate event occurs. Callback object to register. Unregisters the previously registered global VirtualBox callback. Callback object to unregister. Blocks the caller until any of the properties represented by the @a what argument changes the value or until the given timeout interval expires. The @a what argument is a comma separated list of property masks that describe properties the caller is interested in. The property mask is a string in the following format:
        [[group.]subgroup.]name
        
where @c name is the property name and @c group, @c subgroup are zero or or more property group specifiers. Each element (group or name) in the property mask may be either a Latin string or an asterisk symbol (@c "*") which is used to match any string for the given element. A property mask that doesn't contain asterisk symbols represents a single fully qualified property name. Groups in the fully qualified property name go from more generic (the left-most part) to more specific (the right-most part). The first element is usually a name of the object the property belongs to. The second element may be either a property name, or a child object name, or an index if the preceding element names an object which is one of many objects of the same type. This way, property names form a hierarchy of properties. Here are some examples of property names:
VirtualBox.version property
Machine.<UUID>.name property of the machine with the given UUID
Most property names directly correspond to the properties of objects (components) provided by the VirtualBox library and may be used to track changes to these properties. However, there may be pseudo-property names that don't correspond to any existing object's property directly, as well as there may be object properties that don't have a corresponding property name that is understood by this method, and therefore changes to such properties cannot be tracked. See individual object's property descriptions to get a fully qualified property name that can be used with this method (if any). There is a special property mask @c "*" (i.e. a string consisting of a single asterisk symbol) that can be used to match all properties. Below are more examples of property masks:
VirtualBox.* Track all properties of the VirtualBox object
Machine.*.name Track changes to the property of all registered virtual machines
Comma separated list of property masks. Wait timeout in milliseconds. Specify -1 for an indefinite wait. Comma separated list of properties that have been changed and caused this method to return to the caller. Reserved, not currently used.
Saves the global settings to the global settings file (). This method is only useful for explicitly saving the global settings file after it has been auto-converted from the old format to the most recent format (see for details). Normally, the global settings file is implicitly saved when a global setting is changed. Creates a backup copy of the global settings file () in case of auto-conversion, and then calls . Note that the backup copy is created only if the settings file auto-conversion took place (see for details). Otherwise, this call is fully equivalent to and no backup copying is done. The backup copy is created in the same directory where the original settings file is located. It is given the following file name:
          original.xml.x.y-platform.bak
        
where original.xml is the original settings file name (excluding path), and x.y-platform is the version of the old format of the settings file (before auto-conversion). If the given backup file already exists, this method will try to add the .N suffix to the backup file name (where N counts from 0 to 9) and copy it again until it succeeds. If all suffixes are occupied, or if any other copy error occurs, this method will return a failure. If the copy operation succeeds, the @a bakFileName return argument will receive a full path to the created backup file (for informational purposes). Note that this will happen even if the subsequent call performed by this method after the copy operation, fails. The VirtualBox API never calls this method. It is intended purely for the purposes of creating backup copies of the settings files by front-ends before saving the results of the automatically performed settings conversion to disk. settingsFileVersion
Full path to the created backup copy.
Updates the VM state. This operation will also update the settings file with the correct information about the saved state file and delete this file from disk when appropriate. Asks the server to run USB devices filters of the associated machine against the given USB device and tell if there is a match. Intended to be used only for remote USB devices. Local ones don't require to call this method (this is done implicitly by the Host and USBProxyService). Requests a capture of the given host USB device. When the request is completed, the VM process will get a notification. Notification that a VM is going to detach (done = false) or has already detached (done = true) the given USB device. When the done = true request is completed, the VM process will get a notification. In the done = true case, the server must run its own filters and filters of all VMs but this one on the detached device as if it were just attached to the host computer. Requests a capture all matching USB devices attached to the host. When the request is completed, the VM process will get a notification per every captured device. Notification that a VM that is being powered down. The done parameter indicates whether which stage of the power down we're at. When done = false the VM is announcing its intentions, while when done = true the VM is reporting what it has done. In the done = true case, the server must run its own filters and filters of all VMs but this one on all detach devices as if they were just attached to the host computer. Triggered by the given session object when the session is about to close normally. Session that is being closed Used to wait until the corresponding machine is actually deassociated from the given session on the server. Returned only when this session is a direct one. Called by the VM process to inform the server it wants to save the current state and stop the VM execution. Progress object created by the VM process to wait until the state is saved. File path the VM process must save the execution state to. Called by the VM process to inform the server that saving the state previously requested by #beginSavingState is either successfully finished or there was a failure. true to indicate success and false otherwise Gets called by IConsole::adoptSavedState. Path to the saved state file to adopt. Called by the VM process to inform the server it wants to take a snapshot. The console object that initiated this call. Snapshot name Snapshot description Progress object created by the VM process to wait until the state is saved (only for online snapshots). File path the VM process must save the execution state to. Progress object created by the server process to wait until the snapshot is taken (VDI diff creation, etc.). Called by the VM process to inform the server that the snapshot previously requested by #beginTakingSnapshot is either successfully taken or there was a failure. true to indicate success and false otherwise Gets called by IConsole::discardSnapshot. The console object that initiated this call. UUID of the snapshot to discard. New machine state after this operation is started. Progress object to track the operation completion. Gets called by IConsole::discardCurrentState. The console object that initiated this call. New machine state after this operation is started. Progress object to track the operation completion. Gets called by IConsole::discardCurrentSnapshotAndState. The console object that initiated this call. New machine state after this operation is started. Progress object to track the operation completion. Get the list of the guest properties matching a set of patterns along with their values, timestamps and flags and give responsibility for managing properties to the console. The names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a name array. The timestamps of the properties returned. The array entries match the corresponding entries in the @a name array. The flags of the properties returned. The array entries match the corresponding entries in the @a name array. Set the list of the guest properties matching a set of patterns along with their values, timestamps and flags and return responsibility for managing properties to IMachine. The names of the properties. The values of the properties. The array entries match the corresponding entries in the @a name array. The timestamps of the properties. The array entries match the corresponding entries in the @a name array. The flags of the properties. The array entries match the corresponding entries in the @a name array. Update a single guest property in IMachine. The name of the property to be updated. The value of the property. The timestamp of the property. The flags of the property. The IBIOSSettings interface represents BIOS settings of the virtual machine. This is used only in the attribute. Fade in flag for BIOS logo animation. Fade out flag for BIOS logo animation. BIOS logo display time in milliseconds (0 = default). Local file system path for external BIOS image. Mode of the BIOS boot device menu. ACPI support flag. IO APIC support flag. If set, VirtualBox will provide an IO APIC and support IRQs above 15. Offset in milliseconds from the host system time. This allows for guests running with a different system date/time than the host. It is equivalent to setting the system date/time in the BIOS other than it's not an absolute value but a relative one. Guest Additions time synchronization also honors this offset. PXE debug logging flag. If set, VirtualBox will write extensive PXE trace information to the release log. Type of the virtual IDE controller. Depending on this value, VirtualBox will provide different virtual IDE hardware devices to the guest. The IMachine interface represents a virtual machine, or guest, created in VirtualBox. This interface is used in two contexts. First of all, a collection of objects implementing this interface is stored in the attribute which lists all the virtual machines that are currently registered with this VirtualBox installation. Also, once a session has been opened for the given virtual machine (e.g. the virtual machine is running), the machine object associated with the open session can be queried from the session object; see for details. The main role of this interface is to expose the settings of the virtual machine and provide methods to change various aspects of the virtual machine's configuration. For machine objects stored in the collection, all attributes are read-only unless explicitly stated otherwise in individual attribute and method descriptions. In order to change a machine setting, a session for this machine must be opened using one of , or methods. After the session has been successfully opened, a mutable machine object needs to be queried from the session object and then the desired settings changes can be applied to the returned object using IMachine attributes and methods. See the ISession interface description for more information about sessions. Note that the IMachine interface does not provide methods to control virtual machine execution (such as start the machine, or power it down) -- these methods are grouped in a separate IConsole interface. Refer to the IConsole interface description to get more information about this topic. ISession, IConsole Associated parent obect. Whether this virtual machine is currently accessible or not. The machine is considered to be inaccessible when:
  • It is a registered virtual machine, and
  • Its settings file is inaccessible (for example, it is located on a network share that is not accessible during VirtualBox startup, or becomes inaccessible later, or if the settings file can be read but is invalid).
Otherwise, the value of this property is always true. Every time this property is read, the accessibility state of this machine is re-evaluated. If the returned value is |false|, the property may be used to get the detailed error information describing the reason of inaccessibility. When the machine is inaccessible, only the following properties can be used on it:
An attempt to access any other property or method will return an error. The only possible action you can perform on an inaccessible machine is to unregister it using the call (or, to check for the accessibility state once more by querying this property). In the current implementation, once this property returns true, the machine will never become inaccessible later, even if its settings file cannot be successfully read/written any more (at least, until the VirtualBox server is restarted). This limitation may be removed in future releases.
Error information describing the reason of machine inaccessibility. Reading this property is only valid after the last call to returned false (i.e. the machine is currently unaccessible). Otherwise, a null IVirtualBoxErrorInfo object will be returned. Name of the virtual machine. Besides being used for human-readable identification purposes everywhere in VirtualBox, the virtual machine name is also used as a name of the machine's settings file and as a name of the subdirectory this settings file resides in. Thus, every time you change the value of this property, the settings file will be renamed once you call to confirm the change. The containing subdirectory will be also renamed, but only if it has exactly the same name as the settings file itself prior to changing this property (for backward compatibility with previous API releases). The above implies the following limitations:
  • The machine name cannot be empty.
  • The machine name can contain only characters that are valid file name characters according to the rules of the file system used to store VirtualBox configuration.
  • You cannot have two or more machines with the same name if they use the same subdirectory for storing the machine settings files.
  • You cannot change the name of the machine if it is running, or if any file in the directory containing the settings file is being used by another running machine or by any other process in the host operating system at a time when is called.
If any of the above limitations are hit, will return an appropriate error message explaining the exact reason and the changes you made to this machine will not be saved. For "legacy" machines created using the call, the above naming limitations do not apply because the machine name does not affect the settings file name. The settings file name remains the same as it was specified during machine creation and never changes.
Description of the virtual machine. The description attribute can contain any text and is typically used to describe the hardware and software configuration of the virtual machine in detail (i.e. network settings, versions of the installed software and so on). UUID of the virtual machine. User-defined identifier of the Guest OS type. You may use to obtain an IGuestOSType object representing details about the given Guest OS type. This value may differ from the value returned by if Guest Additions are installed to the guest OS. System memory size in megabytes. Initial memory balloon size in megabytes. Initial interval to update guest statistics in seconds. Video memory size in megabytes. Number of virtual monitors. Only effective on Windows XP and later guests with Guest Additions installed. Object containing all BIOS settings. This setting determines whether VirtualBox will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V. Note that in case such extensions are not available, they will not be used. This setting determines whether VirtualBox will try to make use of the nested paging extension of Intel VT-x and AMD-V. Note that in case such extensions are not available, they will not be used. This setting determines whether VirtualBox will try to make use of the VPID extension of Intel VT-x. Note that in case such extensions are not available, they will not be used. This setting determines whether VirtualBox will expose the Physical Address Extension (PAE) feature of the host CPU to the guest. Note that in case PAE is not available, it will not be reported. Full path to the directory used to store snapshot data (differencing hard disks and saved state files) of this machine. The initial value of this property is < path_to_settings_file>/< machine_uuid >. Currently, it is an error to try to change this property on a machine that has snapshots (because this would require to move possibly large files to a different location). A separate method will be available for this purpose later. Setting this property to null will restore the initial value. When setting this property, the specified path can be absolute (full path) or relative to the directory where the machine settings file is located. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. VRDP server object. Array of hard disks attached to this machine. Associated DVD drive object. Associated floppy drive object. Associated USB controller object. This method may set a @ref com_warnings "warning result code". If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. Associated audio adapter, always present. Associated SATA controller object. Full name of the file containing machine settings data. Current version of the format of the settings file of this machine (). The version string has the following format:
          x.y-platform
        
where x and y are the major and the minor format versions, and platform is the platform identifier. The current version usually matches the value of the attribute unless the settings file was created by an older version of VirtualBox and there was a change of the settings file format since then. Note that VirtualBox automatically converts settings files from older versions to the most recent version when reading them (usually at VirtualBox startup) but it doesn't save the changes back until you call a method that implicitly saves settings (such as ) or call explicitly. Therefore, if the value of this attribute differs from the value of , then it means that the settings file was converted but the result of the conversion is not yet saved to disk. The above feature may be used by interactive front-ends to inform users about the settings file format change and offer them to explicitly save all converted settings files (the global and VM-specific ones), optionally create backup copies of the old settings files before saving, etc. IVirtualBox::settingsFormatVersion, saveSettingsWithBackup()
Whether the settings of this machine have been modified (but neither yet saved nor discarded). Reading this property is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . For all other cases, the settings can never be modified. For newly created unregistered machines, the value of this property is always TRUE until is called (no matter if any machine settings have been changed after the creation or not). For opened machines the value is set to FALSE (and then follows to normal rules). Current session state for this machine. Type of the session. If is SessionSpawning or SessionOpen, this attribute contains the same value as passed to the method in the @a type parameter. If the session was opened directly using , or if is SessionClosed, the value of this attribute is @c null. Identifier of the session process. This attribute contains the platform-dependent identifier of the process that has opened a direct session for this machine using the call. The returned value is only valid if is SessionOpen or SessionClosing (i.e. a session is currently open or being closed) by the time this property is read. Current execution state of this machine. Time stamp of the last execution state change, in milliseconds since 1970-01-01 UTC. Full path to the file that stores the execution state of the machine when it is in the state. When the machine is not in the Saved state, this attribute null. Full path to the folder that stores a set of rotated log files recorded during machine execution. The most recent log file is named VBox.log, the previous log file is named VBox.log.1 and so on (upto VBox.log.3 in the current version). Current snapshot of this machine. A null object is returned if the machine doesn't have snapshots. Number of snapshots taken on this machine. Zero means the machine doesn't have any snapshots. Returns true if the current state of the machine is not identical to the state stored in the current snapshot. The current state is identical to the current snapshot right after one of the following calls are made:
  • or
  • (issued on a powered off or saved machine, for which returns false)
The current state remains identical until one of the following happens:
  • settings of the machine are changed
  • the saved state is discarded
  • the current snapshot is discarded
  • an attempt to execute the machine is made
For machines that don't have snapshots, this property is always false.
Collection of shared folders for this machine (permanent shared folders). These folders are shared automatically at machine startup and available only to the guest OS installed within this machine. New shared folders are added to the collection using . Existing shared folders can be removed using . Synchronization mode between the host OS clipboard and the guest OS clipboard. A comma-separated list of simple glob patterns. Changes to guest properties whose name matches one of the patterns will generate an signal. Puts the given device to the specified position in the boot order. To indicate that no device is associated with the given position, should be used. @todo setHardDiskBootOrder(), setNetworkBootOrder() Position in the boot order (1 to the total number of devices the machine can boot from, as returned by ). The type of the device used to boot at the given position. Returns the device type that occupies the specified position in the boot order. @todo [remove?] If the machine can have more than one device of the returned type (such as hard disks), then a separate method should be used to retrieve the individual device that occupies the given position. If here are no devices at the given position, then is returned. @todo getHardDiskBootOrder(), getNetworkBootOrder() Position in the boot order (1 to the total number of devices the machine can boot from, as returned by ). Device at the given position. Attaches a virtual hard disk identified by the given UUID to a device slot of the specified bus. For the IDE bus, the @a channel parameter can be either @c 0 or @c 1, to specify the primary or secondary IDE controller, respectively. The SATA bus supports 30 channels, so this parameter can be a number in range from @c 0 to @c 29. For the primary controller of the IDE bus, the @a device number can be either @c 0 or @c 1, to specify the master or the slave device, respectively. For the scondary IDE controller, the device number is always @c 1 because the master device is reserved for the CD-ROM drive. For the SATA bus, the @a device parameter is not currently used and must always be @c 0. The specified device slot must not have another disk attached to it, or this method will fail. See for more detailed information about attaching hard disks. You cannot attach a hard disk to a running machine. Also, you cannot attach a hard disk to a newly created machine until this machine's settings are saved to disk using . If the hard disk is being attached indirectly, a new differencing hard disk will be implicitly created for it and attached instead. If the changes made to the machine settings (icluding this indirect attachment) are later cancelled using , this implicitly created diffrerencing hard disk will be implicitly deleted. UUID of the hard disk to attach. Type of the storage bus to use (IDE or SATA). Channel to attach the hard disk to. Device slot in the given channel to attach the hard disk to. Returns the virtual hard disk attached to a device slot of the specified bus. Note that if the hard disk was indirectly attached by to the given device slot then this method will return not the same object as passed to the call. See for more detailed information about attaching hard disks. Type of the storage bus to query (IDE or SATA). Channel to query. Device slot in the given channel to query. Attached hard disk object. Detaches the virtual hard disk attached to a device slot of the specified bus. Detaching the hard disk from the virtual machine is deferred. This means that the hard disk remains associated with the machine when this methor returns and gets actually de-associated only after a successful call. See for more detailed information about attaching hard disks. You cannot detach the hard disk from a running machine. Detaching differencing hard disks implicitly created by for the indirect attachment using this method will not implicitly delete them. The operation should be explicitly performed by the caller after the hard disk is successfully detached and the settings are saved with , if it is the desired action. Bus to detach the hard disk from. Channel number to detach the hard disk from. Device slot number to detach the hard disk from. Returns the network adapter associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of adapters per every machine is defined by the property, so the maximum slot number is one less than that property's value. Returns the serial port associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of serial ports per every machine is defined by the property, so the maximum slot number is one less than that property's value. Returns the parallel port associated with the given slot. Slots are numbered sequentially, starting with zero. The total number of parallel ports per every machine is defined by the property, so the maximum slot number is one less than that property's value. Returns the machine-specific extra data key name following the supplied key. An error is returned if the supplied @a key does not exist. @c NULL is returned in @a nextKey if the supplied key is the last key. When supplying @c NULL for the @a key, the first key item is returned in @a nextKey (if there is any). @a nextValue is an optional parameter and if supplied, the next key's value is returned in it. Name of the data key to follow. Name of the next data key. Value of the next data key. Returns associated machine-specific extra data. If the requested data @a key does not exist, this function will succeed and return @c NULL in the @a value argument. Name of the data key to get. Value of the requested data key. Sets associated machine-specific extra data. If you pass @c NULL as a key @a value, the given @a key will be deleted. Before performing the actual data change, this method will ask all registered callbacks using the notification for a permission. If one of the callbacks refuses the new value, the change will not be performed. On success, the notification is called to inform all registered callbacks about a successful data change. This method can be called outside the machine session and therefore it's a caller's responsibility to handle possible race conditions when several clients change the same key at the same time. Name of the data key to set. Value to assign to the key. Saves any changes to machine settings made since the session has been opened or a new machine has been created, or since the last call to or . For registered machines, new settings become visible to all other VirtualBox clients after successful invocation of this method. The method sends notification event after the configuration has been successfully saved (only for registered machines). Calling this method is only valid on instances returned by and on new machines created by but not yet registered, or on unregistered machines after calling . Creates a backup copy of the machine settings file () in case of auto-conversion, and then calls . Note that the backup copy is created only if the settings file auto-conversion took place (see for details). Otherwise, this call is fully equivalent to and no backup copying is done. The backup copy is created in the same directory where the original settings file is located. It is given the following file name:
          original.xml.x.y-platform.bak
        
where original.xml is the original settings file name (excluding path), and x.y-platform is the version of the old format of the settings file (before auto-conversion). If the given backup file already exists, this method will try to add the .N suffix to the backup file name (where N counts from 0 to 9) and copy it again until it succeeds. If all suffixes are occupied, or if any other copy error occurs, this method will return a failure. If the copy operation succeeds, the @a bakFileName return argument will receive a full path to the created backup file (for informational purposes). Note that this will happen even if the subsequent call performed by this method after the copy operation, fails. The VirtualBox API never calls this method. It is intended purely for the purposes of creating backup copies of the settings files by front-ends before saving the results of the automatically performed settings conversion to disk. settingsFileVersion
Full path to the created backup copy.
Discards any changes to the machine settings made since the session has been opened or since the last call to or . Calling this method is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . Deletes the settings file of this machine from disk. The machine must not be registered in order for this operation to succeed. will return TRUE after this method successfully returns. Calling this method is only valid on instances returned by and on new machines created by or opened by but not yet registered, or on unregistered machines after calling . The deleted machine settings file can be restored (saved again) by calling . Returns a snapshot of this machine with the given UUID. A null UUID can be used to obtain the first snapshot taken on this machine. This is useful if you want to traverse the whole tree of snapshots starting from the root. UUID of the snapshot to get Snapshot object with the given UUID. Returns a snapshot of this machine with the given name. Name of the snapshot to find Snapshot object with the given name. Sets the current snapshot of this machine. In the current implementation, this operation is not implemented. UUID of the snapshot to set as the current snapshot. Creates a new permanent shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes the permanent shared folder with the given name previously created by from the collection of shared folders and stops sharing it. Logical name of the shared folder to remove. Returns @c true if the VM console process can activate the console window and bring it to foreground on the desktop of the host PC. This method will fail if a session for this machine is not currently open. @c true if the console window can be shown and @c false otherwise. Activates the console window and brings it to foreground on the desktop of the host PC. Many modern window managers on many platforms implement some sort of focus stealing prevention logic, so that it may be impossible to activate a window without the help of the currently active application. In this case, this method will return a non-zero identifier that represents the top-level window of the VM console process. The caller, if it represents a currently active process, is responsible to use this identifier (in a platform-dependent manner) to perform actual window activation. This method will fail if a session for this machine is not currently open. Platform-dependent identifier of the top-level VM console window, or zero if this method has performed all actions necessary to implement the show window semantics for the given platform and/or VirtualBox front-end. Reads an entry from the machine's guest property store. The name of the property to read. The value of the property. If the property does not exist then this will be empty. The time at which the property was last modified, as seen by the server process. Additional property parameters, passed as a comma-separated list of "name=value" type entries. Reads a value from the machine's guest property store. The name of the property to read. The value of the property. If the property does not exist then this will be empty. Reads a property timestamp from the machine's guest property store. The name of the property to read. The timestamp. If the property does not exist then this will be empty. Sets, changes or deletes an entry in the machine's guest property store. The name of the property to set, change or delete. The new value of the property to set, change or delete. If the property does not yet exist and value is non-empty, it will be created. If the value is empty, the key will be deleted if it exists. Additional property parameters, passed as a comma-separated list of "name=value" type entries. Sets, changes or deletes a value in the machine's guest property store. The flags field will be left unchanged or created empty for a new property. The name of the property to set, change or delete. The new value of the property to set, change or delete. If the property does not yet exist and value is non-empty, it will be created. If value is empty, the property will be deleted if it exists. Return a list of the guest properties matching a set of patterns along with their values, timestamps and flags. The patterns to match the properties against, separated by '|' characters. If this is empty or NULL, all properties will match. The names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a name array. The timestamps of the properties returned. The array entries match the corresponding entries in the @a name array. The flags of the properties returned. The array entries match the corresponding entries in the @a name array.
Notification when the guest mouse pointer shape has changed. The new shape data is given. Flag whether the pointer is visible. Flag whether the pointer has an alpha channel. The pointer hot spot x coordinate. The pointer hot spot y coordinate. Width of the pointer shape in pixels. Height of the pointer shape in pixels. Address of the shape buffer. The buffer contains 1 bpp (bits per pixel) AND mask followed by 32 bpp XOR (color) mask. For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values. AND mask presents for pointers with alpha channel, so if the callback does not support alpha, the pointer could be displayed as a normal color pointer. The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask, therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the end of any scanline are undefined. The XOR mask follows the AND mask on the next 4 bytes aligned offset: uint8_t *pXor = pAnd + (cbAnd + 3) & ~3 Bytes in the gap between the AND and the XOR mask are undefined. XOR mask scanlines have no gap between them and size of XOR mask is: cXor = width * 4 * height. If 'shape' is equal to 0, only pointer visibility is being changed. Notification when the mouse capabilities reported by the guest have changed. The new capabilities are passed. Notification when the guest OS executes the KBD_CMD_SET_LEDS command to alter the state of the keyboard LEDs. Notification when the execution state of the machine has changed. The new state will be given. Notification when a Guest Additions property changes. Interested callees should query IGuest attributes to find out what has changed. Notification when a property of the virtual DVD drive changes. Interested callees should use IDVDDrive methods to find out what has changed. Notification when a property of the virtual floppy drive changes. Interested callees should use IFloppyDrive methods to find out what has changed. Notification when a property of one of the virtual network adapters changes. Interested callees should use INetworkAdapter methods and attributes to find out what has changed. Network adapter that is subject to change. Notification when a property of one of the virtual serial ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed. Serial port that is subject to change. Notification when a property of one of the virtual parallel ports changes. Interested callees should use ISerialPort methods and attributes to find out what has changed. Parallel port that is subject to change. Notification when a property of the VRDP server changes. Interested callees should use IVRDPServer methods and attributes to find out what has changed. Notification when a property of the virtual USB controller changes. Interested callees should use IUSBController methods and attributes to find out what has changed. Notification when a USB device is attached to or detached from the virtual USB controller. This notification is sent as a result of the indirect request to attach the device because it matches one of the machine USB filters, or as a result of the direct request issued by or . This notification is sent in case of both a succeeded and a failed request completion. When the request succeeds, the @a error parameter is @c null, and the given device has been already added to (when @a attached is @c true) or removed from (when @a attached is @c false) the collection represented by . On failure, the collection doesn't change and the @a error parameter represents the error message describing the failure. Device that is subject to state change. true if the device was attached and false otherwise. null on success or an error message object on failure. Notification when a shared folder is added or removed. The @a scope argument defines one of three scopes: global shared folders (Global), permanent shared folders of the machine (Machine) or transient shared folders of the machine (Session). Interested callees should use query the corresponding collections to find out what has changed. Sope of the notification. Notification when an error happens during the virtual machine execution. There are three kinds of runtime errors:
  • fatal
  • non-fatal with retry
  • non-fatal warnings
Fatal errors are indicated by the @a fatal parameter set to true. In case of fatal errors, the virtual machine execution is always paused before calling this notification, and the notification handler is supposed either to immediately save the virtual machine state using or power it off using . Resuming the execution can lead to unpredictable results. Non-fatal errors and warnings are indicated by the @a fatal parameter set to false. If the virtual machine is in the Paused state by the time the error notification is received, it means that the user can try to resume the machine execution after attempting to solve the problem that caused the error. In this case, the notification handler is supposed to show an appropriate message to the user (depending on the value of the @a id parameter) that offers several actions such as Retry, Save or Power Off. If the user wants to retry, the notification handler should continue the machine execution using the call. If the machine execution is not Paused during this notification, then it means this notification is a warning (for example, about a fatal condition that can happen very soon); no immediate action is required from the user, the machine continues its normal execution. Note that in either case the notification handler must not perform any action directly on a thread where this notification is called. Everything it is allowed to do is to post a message to another thread that will then talk to the user and take the corresponding action. Currently, the following error identificators are known:
  • "HostMemoryLow"
  • "HostAudioNotResponding"
  • "VDIStorageFull"
This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return @c S_OK from all but one of them that does actual user notification and performs necessary actions.
Whether the error is fatal or not Error identificator Optional error message
Notification when a call to is made by a front-end to check if a subsequent call to can succeed. The callee should give an answer appropriate to the current machine state in the @a canShow argument. This answer must remain valid at least until the next machine state change. This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return @c true and @c S_OK from all but one of them that actually manages console window activation. @c true if the console window can be shown and @c false otherwise. Notification when a call to requests the console window to be activated and brought to foreground on the desktop of the host PC. This notification should cause the VM console process to perform the requested action as described above. If it is impossible to do it at a time of this notification, this method should return a failure. Note that many modern window managers on many platforms implement some sort of focus stealing prevention logic, so that it may be impossible to activate a window without the help of the currently active application (which is supposedly an initiator of this notification). In this case, this method must return a non-zero identifier that represents the top-level window of the VM console process. The caller, if it represents a currently active process, is responsible to use this identifier (in a platform-dependent manner) to perform actual window activation. This method must set @a winId to zero if it has performed all actions necessary to complete the request and the console window is now active and in foreground, to indicate that no further action is required on the caller's side. This notification is not designed to be implemented by more than one callback at a time. If you have multiple IConsoleCallback instances registered on the given IConsole object, make sure you simply do nothing but return@c S_OK from all but one of them that actually manages console window activation. Platform-dependent identifier of the top-level VM console window, or zero if this method has performed all actions necessary to implement the show window semantics for the given platform and/or this VirtualBox front-end.
Contains information about the remote display (VRDP) capabilities and status. This is used in the attribute. Whether the remote display connection is active. How many times a client connected. When the last connection was established, in milliseconds since 1970-01-01 UTC. When the last connection was terminated or the current time, if connection is still active, in milliseconds since 1970-01-01 UTC. How many bytes were sent in last or current, if still active, connection. How many bytes were sent in all connections. How many bytes were received in last or current, if still active, connection. How many bytes were received in all connections. Login user name supplied by the client. Login domain name supplied by the client. The client name supplied by the client. The IP address of the client. The client software version number. Public key exchange method used when connection was established. Values: 0 - RDP4 public key exchange scheme. 1 - X509 certificates were sent to client. The IConsole interface represents an interface to control virtual machine execution. The console object that implements the IConsole interface is obtained from a session object after the session for the given machine has been opened using one of , or methods. Methods of the IConsole interface allow the caller to query the current virtual machine execution state, pause the machine or power it down, save the machine state or take a snapshot, attach and detach removable media and so on. ISession Machine object this console is sessioned with. This is a convenience property, it has the same value as of the corresponding session object. Current execution state of the machine. This property always returns the same value as the corresponding property of the IMachine object this console is sessioned with. For the process that owns (executes) the VM, this is the preferable way of querying the VM state, because no IPC calls are made. Guest object. Virtual keyboard object. If the machine is not running, any attempt to use the returned object will result in an error. Virtual mouse object. If the machine is not running, any attempt to use the returned object will result in an error. Virtual display object. If the machine is not running, any attempt to use the returned object will result in an error. Debugging interface. Collection of USB devices currently attached to the virtual USB controller. The collection is empty if the machine is not running. List of USB devices currently attached to the remote VRDP client. Once a new device is physically attached to the remote host computer, it appears in this list and remains there until detached. Collection of shared folders for the current session. These folders are called transient shared folders because they are available to the guest OS running inside the associated virtual machine only for the duration of the session (as opposed to which represent permanent shared folders). When the session is closed (e.g. the machine is powered down), these folders are automatically discarded. New shared folders are added to the collection using . Existing shared folders can be removed using . Interface that provides information on Remote Display (VRDP) connection. Starts the virtual machine execution using the current machine state (i.e. its current execution state, current settings and current hard disks). If the machine is powered off or aborted, the execution will start from the beginning (as if the real hardware were just powered on). If the machine is in the state, it will continue its execution the point where the state has been saved. Unless you are trying to write a new VirtualBox front-end that performs direct machine execution (like the VirtualBox or VBoxSDL front-ends), don't call in a direct session opened by and use this session only to change virtual machine settings. If you simply want to start virtual machine execution using one of the existing front-ends (for example the VirtualBox GUI or headless server), simply use ; these front-ends will power up the machine automatically for you. #saveState Progress object to track the operation completion. Identical to powerUp except that the VM will enter the state, instead of . #powerUp Progress object to track the operation completion. Stops the virtual machine execution. After this operation completes, the machine will go to the PoweredOff state. @deprecated This method will be removed in VirtualBox 2.1 where the powerDownAsync() method will take its name. Do not use this method in the code. Initiates the power down procedure to stop the virtual machine execution. The completion of the power down procedure is tracked using the returned IProgress object. After the operation is complete, the machine will go to the PoweredOff state. @warning This method will be renamed to "powerDown" in VirtualBox 2.1 where the original powerDown() method will be removed. You will need to rename "powerDownAsync" to "powerDown" in your sources to make them build with version 2.1. Progress object to track the operation completion. Resets the virtual machine. Pauses the virtual machine execution. Resumes the virtual machine execution. Send the ACPI power button event to the guest. Send the ACPI sleep button event to the guest. Check if the last power button event was handled by guest. Check if the guest entered the ACPI mode G0 (working) or G1 (sleeping). If this method returns false, the guest will most likely not respond to external ACPI events. Saves the current execution state of a running virtual machine and stops its execution. After this operation completes, the machine will go to the Saved state. Next time it is powered up, this state will be restored and the machine will continue its execution from the place where it was saved. This operation differs from taking a snapshot to the effect that it doesn't create new differencing hard disks. Also, once the machine is powered up from the state saved using this method, the saved state is deleted, so it will be impossible to return to this state later. On success, this method implicitly calls to save all current machine settings (including runtime changes to the DVD drive, etc.). Together with the impossibility to change any VM settings when it is in the Saved state, this guarantees the adequate hardware configuration of the machine when it is restored from the saved state file. The machine must be in the Running or Paused state, otherwise the operation will fail. Progress object to track the operation completion. Associates the given saved state file to the virtual machine. On success, the machine will go to the Saved state. Next time it is powered up, it will be restored from the adopted saved state and continue execution from the place where the saved state file was created. The specified saved state file path may be full or relative to the folder the VM normally saves the state to (usually, ). It's a caller's responsibility to make sure the given saved state file is compatible with the settings of this virtual machine that represent its virtual hardware (memory size, hard disk configuration etc.). If there is a mismatch, the behavior of the virtual machine is undefined. Path to the saved state file to adopt. Discards (deletes) the saved state of the virtual machine previously created by . Next time the machine is powered up, a clean boot will occur. This operation is equivalent to resetting or powering off the machine without doing a proper shutdown in the guest OS. Gets the current activity type of a given device or device group. Attaches a host USB device with the given UUID to the USB controller of the virtual machine. The device needs to be in one of the following states: Busy, Available or Held, otherwise an error is immediately returned. When the device state is Busy, an error may also be returned if the host computer refuses to release it for some reason. IUSBController::deviceFilters, USBDeviceState UUID of the host USB device to attach. Detaches an USB device with the given UUID from the USB controller of the virtual machine. After this method succeeds, the VirtualBox server reinitiates all USB filters as if the device were just physically attached to the host, but filters of this machine are ignored to avoid a possible automatic reattachment. IUSBController::deviceFilters, USBDeviceState UUID of the USB device to detach. Detached USB device. Creates a transient new shared folder by associating the given logical name with the given host path, adds it to the collection of shared folders and starts sharing it. Refer to the description of to read more about logical names. Unique logical name of the shared folder. Full path to the shared folder in the host file system. Whether the share is writable or readonly Removes a transient shared folder with the given name previously created by from the collection of shared folders and stops sharing it. Logical name of the shared folder to remove. Saves the current execution state and all settings of the machine and creates differencing images for all normal (non-independent) hard disks. This method can be called for a PoweredOff, Saved, Running or Paused virtual machine. When the machine is PoweredOff, an offline snapshot is created, in all other cases -- an online snapshot. The taken snapshot is always based on the current snapshot of the associated virtual machine and becomes a new current snapshot. This method implicitly calls to save all current machine settings before taking an offline snapshot. ISnapshot, Short name for the snapshot. Optional description of the snapshot. Progress object to track the operation completion. Starts discarding the specified snapshot. The execution state and settings of the associated machine stored in the snapshot will be deleted. The contents of all differencing hard disks of this snapshot will be merged with the contents of their dependent child hard disks to keep the, disks valid (in other words, all changes represented by hard disks being discarded will be propagated to their child hard disks). After that, this snapshot's differencing hard disks will be deleted. The parent of this snapshot will become a new parent for all its child snapshots. If the discarded snapshot is the current one, its parent snapshot will become a new current snapshot. The current machine state is not directly affected in this case, except that currently attached differencing hard disks based on hard disks of the discarded snapshot will be also merged as described above. If the discarded snapshot is the first one (the root snapshot) and it has exactly one child snapshot, this child snapshot will become the first snapshot after discarding. If there are no children at all (i.e. the first snapshot is the only snapshot of the machine), both the current and the first snapshot of the machine will be set to null. In all other cases, the first snapshot cannot be discarded. You cannot discard the snapshot if it stores normal (non-differencing) hard disks that have differencing hard disks based on them. Snapshots of such kind can be discarded only when every normal hard disk has either no children at all or exactly one child. In the former case, the normal hard disk simply becomes unused (i.e. not attached to any VM). In the latter case, it receives all the changes stored in the child hard disk, and then it replaces the child hard disk in the configuration of the corresponding snapshot or machine. Also, you cannot discard the snapshot if it stores hard disks (of any type) having differencing child hard disks that belong to other machines. Such snapshots can be only discarded after you discard all snapshots of other machines containing "foreign" child disks, or detach these "foreign" child disks from machines they are attached to. One particular example of the snapshot storing normal hard disks is the first snapshot of a virtual machine that had normal hard disks attached when taking the snapshot. Be careful when discarding such snapshots because this implicitly commits changes (made since the snapshot being discarded has been taken) to normal hard disks (as described above), which may be not what you want. The virtual machine is put to the Discarding state until the discard operation is completed. The machine must not be running, otherwise the operation will fail. Child hard disks of all normal hard disks of the discarded snapshot must be accessible for this operation to succeed. In particular, this means that all virtual machines, whose hard disks are directly or indirectly based on the hard disks of discarded snapshot, must be powered off. Merging hard disk contents can be very time and disk space consuming, if these disks are big in size and have many children. However, if the snapshot being discarded is the last (head) snapshot on the branch, the operation will be rather quick. Note that discarding the current snapshot will implicitly call to make all current machine settings permanent. UUID of the snapshot to discard. Progress object to track the operation completion. This operation is similar to but affects the current machine state. This means that the state stored in the current snapshot will become a new current state, and all current settings of the machine and changes stored in differencing hard disks will be lost. After this operation is successfully completed, new empty differencing hard disks are created for all normal hard disks of the machine. If the current snapshot of the machine is an online snapshot, the machine will go to the saved state, so that the next time it is powered on, the execution state will be restored from the current snapshot. The machine must not be running, otherwise the operation will fail. If the machine state is Saved prior to this operation, the saved state file will be implicitly discarded (as if were called). Progress object to track the operation completion. This method is equivalent to doing discardSnapshot (currentSnapshot.id(), progress) followed by . As a result, the machine will be fully restored from the snapshot preceding the current snapshot, while both the current snapshot and the current machine state will be discarded. If the current snapshot is the first snapshot of the machine (i.e. it has the only snapshot), the current machine state will be discarded before discarding the snapshot. In other words, the machine will be restored from its last snapshot, before discarding it. This differs from performing a single call (note that no will be possible after it) to the effect that the latter will preserve the current state instead of discarding it. Unless explicitly mentioned otherwise, all remarks and limitations of the above two methods also apply to this method. The machine must not be running, otherwise the operation will fail. If the machine state is Saved prior to this operation, the saved state file will be implicitly discarded (as if were called). This method is more efficient than calling two above methods separately: it requires less IPC calls and provides a single progress object. Progress object to track the operation completion. Registers a new console callback on this instance. The methods of the callback interface will be called by this instance when the appropriate event occurs. Unregisters the console callback previously registered using . The IHostDVDDrive interface represents the physical CD/DVD drive hardware on the host. Used indirectly in . Returns the platform-specific device identifier. On DOS-like platforms, it is a drive name (e.g. R:). On Unix-like platforms, it is a device name (e.g. /dev/hdc). Returns a human readable description for the drive. This description usually contains the product and vendor name. A @c null string is returned if the description is not available. Returns the unique device identifier for the drive. This attribute is reserved for future use instead of . Currently it is not used and may return @c null on some platforms. Searches this collection for a host drive with the given name. The method returns an error if the given name does not correspond to any host drive in the collection. Name of the host drive to search for Found host drive object The IHostFloppyDrive interface represents the physical floppy drive hardware on the host. Used indirectly in . Returns the platform-specific device identifier. On DOS-like platforms, it is a drive name (e.g. A:). On Unix-like platforms, it is a device name (e.g. /dev/fd0). Returns a human readable description for the drive. This description usually contains the product and vendor name. A @c null string is returned if the description is not available. Returns the unique device identifier for the drive. This attribute is reserved for future use instead of . Currently it is not used and may return @c null on some platforms. Searches this collection for a host drive with the given name. The method returns an error if the given name does not correspond to any host drive in the collection. Name of the host drive to search for Found host drive object Returns the host network interface name. Returns the interface UUID. Searches this collection for a host network interface with the given name. The method returns an error if the given name does not correspond to any host network interface in the collection. Name of the host network interface to search for. Found host network interface object. Searches this collection for a host network interface with the given GUID. The method returns an error if the given GUID does not correspond to any host network interface in the collection. GUID of the host network interface to search for. Found host network interface object. The IHost interface represents the physical machine that this VirtualBox installation runs on. An object implementing this interface is returned by the attribute. This interface contains read-only information about the host's physical hardware (such as what processors, and disks are available, what the host operating system is, and so on) and also allows for manipulating some of the host's hardware, such as global USB device filters and host interface networking. List of DVD drives available on the host. List of floppy drives available on the host. List of USB devices currently attached to the host. Once a new device is physically attached to the host computer, it appears in this list and remains there until detached. This method may set a @ref com_warnings "warning result code". If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. List of USB device filters in action. When a new device is physically attached to the host computer, filters from this list are applied to it (in order they are stored in the list). The first matched filter will determine the action performed on the device. Unless the device is ignored by these filters, filters of all currently running virtual machines () are applied to it. This method may set a @ref com_warnings "warning result code". If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. IHostUSBDeviceFilter, USBDeviceState List of host network interfaces currently defined on the host. Number of (logical) CPUs installed in the host system. Number of (logical) CPUs online in the host system. Query the (approximate) maximum speed of a specified host CPU in Megahertz. Identifier of the CPU. Speed value. 0 is returned if value is not known or @a cpuId is invalid. Query the model string of a specified host CPU. Identifier of the CPU. Model string. A NULL string is returned if value is not known or @a cpuId is invalid. Amount of system memory in megabytes installed in the host system. Available system memory in the host system. Name of the host system's operating system. Host operating system's version string. Returns the current host time in milliseconds since 1970-01-01 UTC. Creates a new adapter for Host Interface Networking. Adapter name. Created host interface object. Progress object to track the operation completion. Removes the given host network interface. Adapter GUID. Removed host interface object. Progress object to track the operation completion. Creates a new USB device filter. All attributes except the filter name are set to null (any match), active is false (the filter is not active). The created filter can be added to the list of filters using . #USBDeviceFilters Filter name. See for more info. Created filter object. Inserts the given USB device to the specified position in the list of filters. Positions are numbered starting from 0. If the specified position is equal to or greater than the number of elements in the list, the filter is added to the end of the collection. Duplicates are not allowed, so an attempt to insert a filter that is already in the list, will return an error. This method may set a @ref com_warnings "warning result code". If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. #USBDeviceFilters Position to insert the filter to. USB device filter to insert. Removes a USB device filter from the specified position in the list of filters. Positions are numbered starting from 0. Specifying a position equal to or greater than the number of elements in the list will produce an error. This method may set a @ref com_warnings "warning result code". If USB functionality is not available in the given edition of VirtualBox, this method will set the result code to @c E_NOTIMPL. #USBDeviceFilters Position to remove the filter from. Removed USB device filter. The ISystemProperties interface represents global properties of the given VirtualBox installation. These properties define limits and default values for various attributes and parameters. Most of the properties are read-only, but some can be changed by a user. Minium guest system memory in Megabytes. Maximum guest system memory in Megabytes. Minimum guest video memory in Megabytes. Maximum guest video memory in Megabytes. Maximum size of a virtual disk image in Megabytes. Number of network adapters associated with every instance. Number of serial ports associated with every instance. Number of parallel ports associated with every instance. Maximum device position in the boot order. This value corresponds to the total number of devices a machine can boot from, to make it possible to include all possible devices to the boot list. Full path to the default directory used to create new or open existing machines when a settings file name contains no path. The initial value of this property is < VirtualBox_home>/Machines. Setting this property to null will restore the initial value. When settings this property, the specified path can be absolute (full path) or relative to the VirtualBox home directory. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. , Full path to the default directory used to create new or open existing virtual disks. This path is used when the storage unit of a hard disk is a regular file in the host's filesystem and only a file name that contains no path is given. The initial value of this property is < VirtualBox_home >/HardDisks. Setting this property to null will restore the initial value. When settings this property, the specified path can be relative to the VirtualBox home directory or absolute. When reading this property, a full path is always returned. The specified path may not exist, it will be created when necessary. IHardDisk2, , , List of all hard disk storage formats supported by this VirtualBox installation. Note that the virtual hard disk framework is backend-based, therefore the list of supported formats depends on what backends are currently installed. , Library that provides authentication for VRDP clients. The library is used if a virtual machine's authentication type is set to "external" in the VM RemoteDisplay configuration. The system library extension (".DLL" or ".so") must be omitted. A full path can be specified; if not, then the library must reside on the system's default library path. The default value of this property is VRDPAuth. There is a library of that name in one of the default VirtualBox library directories. For details about VirtualBox authentication libraries and how to implement them, please refer to the VirtualBox manual. Setting this property to null will restore the initial value. Library that provides authentication for webservice clients. The library is used if a virtual machine's authentication type is set to "external" in the VM RemoteDisplay configuration and will be called from within the implementation. As opposed to , there is no per-VM setting for this, as the webservice is a global resource (if it is running). Only for this setting (for the webservice), setting this value to a literal "null" string disables authentication, meaning that will always succeed, no matter what user name and password are supplied. The initial value of this property is VRDPAuth, meaning that the webservice will use the same authentication library that is used by default for VBoxVRDP (again, see ). The format and calling convetion of authentication libraries is the same for the webservice as it is for VBoxVRDP. This specifies the default value for hardware virtualization extensions. If enabled, virtual machines will make use of hardware virtualization extensions such as Intel VT-x and AMD-V by default. This value can be overridden by each VM using their property. This value specifies how many old release log files are kept. Guest OS identifier string. Human readable description of the guest OS. Recommended RAM size in Megabytes. Recommended video RAM size in Megabytes. Recommended hard disk size in Megabytes. The IGuest interface represents information about the operating system running inside the virtual machine. Used in . IGuest provides information about the guest operating system, whether Guest Additions are installed and other OS-specific virtual machine properties. Identifier of the Guest OS type as reported by the Guest Additions. You may use to obtain an IGuestOSType object representing details about the given Guest OS type. If Guest Additions are not installed, this value will be the same as . Flag whether the Guest Additions are installed and active in which case their version will be returned by the property. Version of the Guest Additions (3 decimal numbers separated by dots) or empty when the Additions are not installed. The Additions may also report a version but yet not be active as the version might be refused by VirtualBox (incompatible) or other failures occurred. Flag whether seamless guest display rendering (seamless desktop integration) is supported. Flag whether the guest is in graphics mode. If it is not, then seamless rendering will not work, resize hints are not immediately acted on and guest display resizes are probably not initiated by the guest additions. Guest system memory balloon size in megabytes. Interval to update guest statistics in seconds. Store login credentials that can be queried by guest operating systems with Additions installed. The credentials are transient to the session and the guest may also choose to erase them. Note that the caller cannot determine whether the guest operating system has queried or made use of the credentials. User name string, can be empty Password string, can be empty Domain name (guest logon scheme specific), can be emtpy Flag whether the guest should alternatively allow the user to interactively specify different credentials. This flag might not be supported by all versions of the Additions. Query specified guest statistics as reported by the VirtualBox Additions. Virtual CPU id; not relevant for all statistic types Statistic type. Statistics value The IProgress interface represents a task progress object that allows to wait for the completion of some asynchronous task. The task consists of one or more operations that run sequentially, one after one. There is an individual percent of completion of the current operation and the percent of completion of the task as a whole. Similarly, you can wait for the completion of a particular operation or for the completion of the whole task. Every operation is identified by a number (starting from 0) and has a separate description. ID of the task. Description of the task. Initiator of the task. Whether the task can be interrupted. Current task progress value in percent. This value depends on how many operations are already complete. Whether the task has been completed. Whether the task has been canceled. Result code of the progress task. Valid only if is true. Extended information about the unsuccessful result of the progress operation. May be NULL when no extended information is available. Valid only if is true and indicates a failure. Number of operations this task is divided into. Every task consists of at least one operation. Number of the operation being currently executed. Description of the operation being currently executed. Current operation progress value in percent. Waits until the task is done (including all operations) with a given timeout. Timeout value in milliseconds. Specify -1 for an indefinite wait. Waits until the given operation is done with a given timeout. Number of the operation to wait for. Must be less than . Timeout value in milliseconds. Specify -1 for an indefinite wait. Cancels the task. If is false, then this method will fail. The ISnapshot interface represents a snapshot of the virtual machine. The snapshot stores all the information about a virtual machine necessary to bring it to exactly the same state as it was at the time of taking the snapshot. The snapshot includes:
  • all settings of the virtual machine (i.e. its hardware configuration: RAM size, attached hard disks, etc.)
  • the execution state of the virtual machine (memory contents, CPU state, etc.).
Snapshots can be offline (taken when the VM is powered off) or online (taken when the VM is running). The execution state of the offline snapshot is called a zero execution state (it doesn't actually contain any information about memory contents or the CPU state, assuming that all hardware is just powered off).

Snapshot branches

Snapshots can be chained. Chained snapshots form a branch where every next snapshot is based on the previous one. This chaining is mostly related to hard disk branching (see description). This means that every time a new snapshot is created, a new differencing hard disk is implicitly created for all normal hard disks attached to the given virtual machine. This allows to fully restore hard disk contents when the machine is later reverted to a particular snapshot. In the current implementation, multiple snapshot branches within one virtual machine are not allowed. Every machine has a single branch, and operation adds a new snapshot to the top of that branch. Existings snapshots can be discarded using .

Current snapshot

Every virtual machine has a current snapshot, identified by . This snapshot is used as a base for the current machine state (see below), to the effect that all normal hard disks of the machine and its execution state are based on this snapshot. In the current implementation, the current snapshot is always the last taken snapshot (i.e. the head snapshot on the branch) and it cannot be changed. The current snapshot is null if the machine doesn't have snapshots at all; in this case the current machine state is just current settings of this machine plus its current execution state.

Current machine state

The current machine state is what represented by IMachine instances got directly from IVirtualBox using getMachine(), findMachine(), etc. (as opposed to instances returned by ). This state is always used when the machine is powered on. The current machine state also includes the current execution state. If the machine is being currently executed ( is and above), its execution state is just what's happening now. If it is powered off ( or ), it has a zero execution state. If the machine is saved (), its execution state is what saved in the execution state file (). If the machine is in the saved state, then, next time it is powered on, its execution state will be fully restored from the saved state file and the execution will continue from the point where the state was saved. Similarly to snapshots, the current machine state can be discarded using .

Taking and discarding snapshots

The table below briefly explains the meaning of every snapshot operation:
OperationMeaningRemarks
Save the current state of the virtual machine, including all settings, contents of normal hard disks and the current modifications to immutable hard disks (for online snapshots) The current state is not changed (the machine will continue execution if it is being executed when the snapshot is taken)
Forget the state of the virtual machine stored in the snapshot: dismiss all saved settings and delete the saved execution state (for online snapshots) Other snapshots (including child snapshots, if any) and the current state are not directly affected
Restore the current state of the virtual machine from the state stored in the current snapshot, including all settings and hard disk contents The current state of the machine existed prior to this operation is lost
Completely revert the virtual machine to the state it was in before the current snapshot has been taken The current state, as well as the current snapshot, are lost
UUID of the snapshot. Short name of the snapshot. Optional description of the snapshot. Time stamp of the snapshot, in milliseconds since 1970-01-01 UTC. true if this snapshot is an online snapshot and false otherwise. When this attribute is true, the attribute of the object associated with this snapshot will point to the saved state file. Otherwise, it will be null. Virtual machine this snapshot is taken on. This object stores all settings the machine had when taking this snapshot. The returned machine object is immutable, i.e. no any settings can be changed. Parent snapshot (a snapshot this one is based on). It's not an error to read this attribute on a snapshot that doesn't have a parent -- a null object will be returned to indicate this. Child snapshots (all snapshots having this one as a parent). In the current implementation, there can be only one child snapshot, or no children at all, meaning this is the last (head) snapshot.
Virtual media state. IMedia Associated media storage does not exist (either was not created yet or was deleted). Associated storage exists and accessible. Media is locked for reading, no data modification is possible. Media is locked for writing, no concurrent data reading or modification is possible. Associated media storage is not accessible. Associated media storage is being created. Associated media storage is being deleted. The IMedium interface is a common interface for all objects representing virtual media such as hard disks, DVD images. Each medium is associated with a storage unit (such as a file on the host computer or a network resource) that holds actual data. The location of the storage unit is represented by the #location attribute. The value of this attribute is media type dependent. The exact media type may be determined by querying the appropriate interface such as:
  • IHardDisk2 (virtual hard disks)
  • IDVDImage2 (standard CD/DVD ISO image files)
  • IFloppyImage2 (raw floppy image files)
Existing media are opened using the following methods, depending on the media type:
New hard disk media are created using the method. CD/DVD and floppy images are created outside VirtualBox, usually by storing a copy of the real medium of the corresponding type in a regular file.

Known Media

When an existing medium gets opened for the first time, it gets automatically remembered by the given VirtualBox installation or, in other words, becomes a known medium. Known media are stored in the media registry transparently maintaned by VirtualBox and stored in settings files so that this registry is preserved when VirtualBox is not running. Newly created virtual hard disks get remembered only when the associated storage unit is actually created (see IHardDisk2 for more details). All known media can be enumerated using , and attributes. Individual media can be quickly found by by UUID using and similar methods or by location using and similar methods. Only known media can be attached to virtual machines. Removing known media from the media registry is performed when the given medium is closed using the method or when its associated storage unit is deleted (only for hard disks).

Accessibility Checks

The given medium (with the created storage unit) is considered to be accessible when its storage unit can be successfully read from. Accessible media are indicated by the value of the attribute. When the storage unit cannot be read (for example, because it is located on a disconnected network resource, or was accidentially deleted outside VirtualBox), the medium is considered to be inaccessible which is indicated by the state. The details about the reason of being inaccessible can be obtained using the attribute. A new accessiblity check is performed each time the attribute is read. Please note that this check may take long time (several seconds or even minutes, depending on the storage unit location and format), and will block the calling thread until finished. For this reason, it is recommended to never read this attribute on the main UI thread to avoid making the UI unresponsive. Note that when VirtualBox starts up (e.g. the VirtualBox object gets created for the first time), all known media are in the state but the value of the attribute is null because no actual accessibility check is made on startup. This is done to make the VirtualBox object ready for serving requests as fast as possible and let the end-user application decide if it needs to check media accessibility right away or not.
UUID of the medium. For a newly created medium, this value is a randomly generated UUID. Optional description of the medium. For newly created media, the value of this attribute value is null. Media types that don't support this attribute will return E_NOTIMPL in attempt to get or set this attribute's value. For some storage types, reading this attribute may return an outdated (last known) value when is or because the value of this attribute is stored within the storage unit itself. Also note that changing the attribute value is not possible in such case, as well as when the medium is the state. Current media state. Inspect values for details. Reading this attribute may take long time because a new accessibility check of the storage unit is performed every time the attribute is read. This check may cause a significant delay if the storage unit of the given medium is, for example, a file located on a network share which is not currently accessible due to connectivity problems -- the call will not return until a timeout interval defined by the host OS for this operation expires. If the last known state of the medium is and the accessibility check fails then the state wull be set to and may be used to get more details about the failure. If the state of the medium is or then it remains the same, and a non-null value of will indicate a failed accessibility check in this case. Note that not all media states are applicable to certain media types. For example, states , , , are meaningless for IDVDImage2 and IFloppyImage2 media. Location of the storage unit holding media data. The format of the loocation string is media type specific. For media types that use regular files in a host's file system, the location string is just a full file name. Some media types may support changing the storage unit location by simply changing the value of this property. If this operation is not supported, the implementation will return E_NOTIMPL in attempt to set this attribute's value. When setting a value of the location attribute which is a regular file in the host's file system, the given file name may be either relative to the VirtualBox home folder or absolute. Note that if the given location specification does not contain the file extension part then a proper default extension will be automatically appended by the implementation depending on the media type. Name of the storage unit holding media data. The returned string is a short version of the attribute that is suitable for representing the medium in situations where the full location specification is too long (such as lists and comboboxes in GUI frontends). This string is also used by frontends to sort the media list alphabetically when needed. For example, for locations that are regular files in the host's file system, the value of this attribute is just a file name (+ extension), without the path specification. Note that as opposed to the attribute, the name name attribute will not necessary be unique for a list of media of the given type and format. Physical size of the storage unit used to hold media data (in bytes). For media whose is , the value of this property is the last known size. For media, the returned value is zero. Text message that represents the result of the last acccessibility check. Accessibility checks are performed each time the attribute is read. A @c null string is returned if the last accessibility check was succeessful. A non-null string indicates a failure and should normally describe a reason of the failure (for example, a file read error). Array of UUIDs of all machines this medium is attached to. A null array is returned if this medium is not attached to any machine or to any machine's snapshot. The returned array will include a machine even if this medium is not attached to that machine in the current state but attached to it in one of the machine's snapshots. See for details. Returns an array of UUIDs of all snapshots of the given machine where this medium is attached to it. If the medium is attached to the machine in the current state, then the first element in the array will always be the ID of the queried machine (i.e. the value equal to the @c machineId argument), followed by snapshit IDs (if any). If the medium is not attached to the machine in the current state, then the array will contain only snapshot IDs. The returned array may be null if this medium is not attached to the given machine at all, neither in the current state nor in one of snapshots. UUID of the machine to query. Array of snapshot UUIDs of the given machine using this medium. Locks this medium for reading. The read lock is shared: many clients can simultaneously lock the same media for reading unless it is already locked for writing (see ) in which case an error is returned. When the medium is locked for reading, it cannot be modified from within VirtualBox. This means that any method that changes the properties of this medium or contents of the storage unit will return an error (unless explicitly stated otherwise) and that an attempt to start a virtual machine that wants to modify the medium will also fail. When the virtual machine is started up, it locks for reading all media it uses in read-only mode. If some media cannot be locked for reading, the startup procedure will fail. The medium locked for reading must be unlocked using the method. Calls to can be nested and must be followed by the same number of paired calls. This method sets the media state to on success. The state proir to this call must be , or . As you can see, inacessible media can be locked too. This is not an error; this method performs a logical lock that prevents modifications of this media through the VirtualBox API, not a physical lock of the underlying storage unit. Either on success or on failure, this method returns the current state of the medium before the operation. State of the medium after the operation. Cancels the read lock previously set by . Either on success or on failure, this method returns the current state of the medium after the operation. See for more details. State of the medium after the operation. Locks this medium for writing. The write lock, as opposed to , is exclusive: there may be only one client that holds a write lock and there may be no read locks while the write lock is held. When the medium is locked for writing, it cannot be modified from within VirtualBox and it is not guaranteed that the values of its properties are up-to-date. Any method that changes the properties of this medium or contents of the storage unit will return an error ((unless explicitly stated otherwise) and an attempt to start a virtual machine that wants to modify or to read the medium will also fail. When the virtual machine is started up, it locks for writing all media it uses to write data to. If some media cannot be locked for writing, the startup procedure will fail. The medium locked for writing must be unlocked using the method. Calls to can not be nested and must be followed by a paired call. This method sets the media state to on success. The state proir to this call must be or . As you can see, inacessible media can be locked too. This is not an error; this method performs a logical lock that prevents modifications of this media through the VirtualBox API, not a physical lock of the underlying storage unit. Either on success or on failure, this method returns the current state of the medium before the operation. State of the medium after the operation. Cancels the write lock previously set by . Either on success or on failure, this method returns the current state of the medium after the operation. See for more details. State of the medium after the operation. Closes this media. The hard disk must not be attahced to any known virtual machine and must not have any known child hard disks, otherwise the operation will fail. When the hard disk is successfully closed, it gets removed from the list of remembered hard disks, but its storage unit is not deleted. In particular, this means that this hard disk can be later opened again using the call. Note that after this method successfully returns, the given hard disk object becomes uninitialized. This means that any attempt to call any of its methods or attributes will fail with the "Object not ready" (E_ACCESSDENIED) error. #deleteStorage()
Virtual hard disk type. IHardDisk Normal hard disk (attached directly or indirectly, preserved when taking snapshots). Immutable hard disk (attached indirectly, changes are wiped out after powering off the virtual machine). Write through hard disk (attached directly, ignored when taking snapshots). The IHardDisk2Attachment interface represents a hard disk attachment of a virtual machine. Every hard disk attachments specifies a slot of the virtual hard disk controller and a virtual virtual hard disk attached to this slot. The array of hard disk attachments is returned by . With the COM API, this is an interface like all the others. With the webservice, this is mapped to a structure, so querying the attribute will not return an object, but a complete structure. Hard disk object associated with this attachment. Interface bus of this attachment. Channel number of this attachment. Device slot number of this attachment. The IHardDisk2 interface represents a virtual hard disk drive used by a virtual machine. Virtual hard disk objects virtualize the hard disk hardware and look like regular hard disks for the guest OS running inside the virtual machine.

Hard Disk Types

There are three types of hard disks: Normal, Immutable and Writethrough. The type of the hard disk defines how the hard disk is attached to a virtual machine and what happens when a snapshot of the virtual machine with the attached hard disk is taken. The type of the hard disk is defined by the attribute. All hard disks can be also divided in two big groups: base hard disks and differencing hard disks. A base hard disk contains all sectors of the hard disk data in its storage unit and therefore can be used independently. On the contrary, a differencing hard disk contains only some part of the hard disk data (a subset of sectors) and needs another hard disk to get access to the missing sectors of data. This another hard disk is called a parent hard disk and defines a hard disk to which this differencing hard disk is known to be linked to. The parent hard disk may be itself a differencing hard disk. This way, differencing hard disks form a linked hard disk chain. This chain always ends with the base hard disk which is sometimes referred to as the root hard disk of this chain. Note that several differencing hard disks may be linked to the same parent hard disk. This way, all known hard disks form a hard disk tree which is based on their parent-child relationship. Differencing hard disks can be distinguished from base hard disks by querying the attribute: base hard disks do not have parents they would depend on, so the value of this attribute is always null for them. Using this attribute, it is possible to walk up the hard disk tree (from the child hard disk to its parent). It is also possible to walk down the tree using the attribute. Note that the type of all differencing hard disks is Normal; all other values are meaningless for them. Base hard disks may be of any type.

Creating Hard Disks

New base hard disks are created using . Existing hard disks are opened using . Differencing hard disks are usually implicitly created by VirtualBox when needed but may also be created explicitly using . After the hard disk is successfully created (including the storage unit) or opened, it becomes a known hard disk (remembered in the internal media registry). Known hard disks can be attached to a virtual machine, accessed through and methods or enumerated using the array (only for base hard disks). The following methods, besides , automatically remove the hard disk from the media registry:
If the storage unit of the hard disk is a regular file in the host's filesystem then the rules stated in the description of the attribute apply when setting its value. In addition, a plain file name without any path may be given, in which case the default hard disk folder will be prepended to it.

Automatic composition of the file name part

Another extension to the attribute is that there is a possibility to cause VirtualBox to compose a unique value for the file name part of the location using the UUID of the hard disk. This applies only to hard disks in state, e.g. before the storage unit is created, and works as follows. You set the value of the attribute to a location specification which only contains the path specification but not the file name part and ends with either a forward slash or a backslash character. In response, VirtualBox will genereate a new UUID for the hard disk and compose the file name using the following pattern:
        <path>/{<uuid>}.<ext>
      
where <path> is the supplied path specification, <uuid> is the newly generated UUID and <ext> is the default extension for the storage format of this hard disk. After that, you may call any of the metods that create a new hard disk storage unit and they will use the generated UUID and file name.

Attaching Hard Disks

Hard disks are attached to virtual machines using the method and detached using the method. Depending on their , hard disks are attached either directly or indirectly. When a hard disk is being attached directly, it is associated with the virtual machine and used for hard disk operations when the machine is running. When a hard disk is being attached indirectly, a new differencing hard disk linked to it is implicitly created and this differencing hard disk is associated with the machine and used for hard disk operations. This also means that if performs a direct attachment then the same hard disk will be returned in response to the subsequent call; however if an indirect attachment is performed then will return the implicitly created differencing hard disk, not the original one passed to . The following table shows the dependency of the attachment type on the hard disk type:
Hard Disk Type Direct or Indirect?
Normal (Base) Normal base hard disks that do not have children (i.e. differencing hard disks linked to them) and that are not already attached to virtual machines in snapshots are attached directly. Otherwise, they are attached indirectly because having dependent children or being part of the snapshot makes it impossible to modify hard disk contents without breaking the integrity of the dependent party. The attribute allows to quickly determine the kind of the attachment for the given hard disk. Note that if a normal base hard disk is to be indirectly attached to a virtual machine with snapshots then a special procedure called smart attachment is performed (see below).
Normal (Differencing) Differencing hard disks are like normal base hard disks: attached directly if they do not have children and are not attached to virtual machines in snapshots, and indirectly otherwise. Note that the smart attachment procedure is never performed for differencing hard disks.
Immutable Immutabe hard disks are always attached indirectly because they are designed to be non-writable. If an immutable hard disk is attached to a virtual machine with snapshots then a special procedure called smart attachment is performed (see below).
Writethrough Writethrough hard disks are always attached directly, also as designed. This also means that writethrough hard disks cannot have other hard disks linked to them at all.
Note that the same hard disk, regardless of its type, may be attached to more than one virtual machine at a time. In this case, the machine that is started first gains exclusive access to the hard disk and attempts to start other machines having this hard disk attached will fail until the first machine is powered down. Detaching hard disks is performed in a deferred fashion. This means that the given hard disk remains associated with the given machine after a successful call until is called to save all changes to machine settings to disk. This deferring is necessary to guarantee that the hard disk configuration may be restored at any time by a call to before the settings are saved (committed). Note that if is called after indirectly attaching some hard disks to the machine but before a call to is made, it will implicitly delete all differencing hard disks implicitly created by for these indirect attachments. Such implicitly created hard disks will also be immediately deleted when detached explicitly using the call if it is made before . This implicit deletion is safe because newly created differencing hard disks do not contain any user data. However, keep in mind that detaching differencing hard disks that were implicitly created by before the last call will not implicitly delete them as they may already contain some data (for example, as a result of virtual machine execution). If these hard disks are no more necessary, the caller can always delete them explicitly using after they are actually de-associated from this machine by the call.

Smart Attachment

When normal base or immutable hard disks are indirectly attached to a virtual machine then some additionals steps are performed to make sure the virtual machine will have the most recent "view" of the hard disk being attached. These steps include walking through the machine's snapshots starting from the current one and going through ancestors up to the first snapshot. Hard disks attached to the virtual machine in all of the encountered snapshots are checked whether they are descendants of the given normal base or immutable hard disk. The first found child (which is the differencing hard disk) will be used instead of the normal base or immutable hard disk as a parent for creating a new differencing hard disk that will be actually attached to the machine. And only if no descendants are found or if the virtual machine does not have any snapshots then the normal base or immutable hard disk will be used itself as a parent for this differencing hard disk. It is easier to explain what smart attachment does using the following example:
BEFORE attaching B.vdi:       AFTER attaching B.vdi:

Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 Snapshot 2 (D1->B.vdi)        Snapshot 2 (D1->B.vdi)
  Snapshot 3 (D2->D1.vdi)       Snapshot 3 (D2->D1.vdi)
   Snapshot 4 (none)             Snapshot 4 (none)
    CurState   (none)             CurState   (D3->D2.vdi)

                              NOT
                                 ...
                                  CurState   (D3->B.vdi)
      
The first column is the virtual machine configuration before the base hard disk B.vdi is attached, the second column shows the machine after this hard disk is attached. Constructs like D1->B.vdi and similar mean that the hard disk that is actually attached to the machine is a differencing hard disk, D1.vdi, which is linked to (based on) another hard disk, B.vdi. As we can see from the example, the hard disk B.vdi was detached from the machine before taking Snapshot 4. Later, after Snapshot 4 was taken, the user decides to attach B.vdi again. B.vdi has dependent child hard disks (D1.vdi, D2.vdi), therefore it cannot be attached directly and needs an indirect attachment (i.e. implicit creation of a new differencing hard disk). Due to the smart attachment procedure, the new differencing hard disk (D3.vdi) will be based on D2.vdi, not on B.vdi itself, since D2.vdi is the most recent view of B.vdi existing for this snapshot branch of the given virtual machine. Note that if there is more than one descendant hard disk of the given base hard disk found in a snapshot, and there is an exact device, channel and bus match, then this exact match will be used. Otherwise, the youngest descendant will be picked up. There is one more important aspect of the smart attachment procedure which is not related to snapshots at all. Before walking through the snapshots as described above, the backup copy of the current list of hard disk attachment is searched for descendants. This backup copy is created when the hard disk configuartion is changed for the first time after the last call and used by to undo the recent hard disk changes. When such a descendant is found in this backup copy, it will be simply reattached back, without creating a new differencing hard disk for it. This optimization is necessary to make it possible to re-attach the base or immutable hard disk to a different bus, channel or device slot without losing the contents of the differencing hard disk actually attached to the machine in place of it.
Storage format of this hard disk. The value of this attribute is a string that specifies a backend used to store hard disk data. The storage format is defined when you create a new hard disk or automatically detected when you open an existing hard disk medium, and cannot be changed later. The list of all storage formats supported by this VirtualBox installation can be obtained using . Type (role) of this hard disk. The following constraints apply when changing the value of this attribute:
  • If a hard disk is attached to a virtual machine (either in the current state or in one of the snapshots), its type cannot be changed.
  • As long as the hard disk has children, its type cannot be set to .
  • The type of all differencing hard disks is and cannot be changed.
The type of a newly created or opened hard disk is set to .
Parent of this hard disk (a hard disk this hard disk is directly based on). Only differencing hard disks have parents. For base (non-differencing) hard disks, null is returned. Children of this hard disk (all differencing hard disks directly based on this hard disk). A null array is returned if this hard disk does not have any children. Root hard disk of this hard disk. If this is a differencing hard disk, its root hard disk is the base hard disk the given hard disk branch starts from. For all other types of hard disks, this property returns the hard disk object itself (i.e. the same object this property is read on). Returns true if this hard disk is read-only and false otherwise. A hard disk is considered to be read-only when its contents cannot be modified without breaking the integrity of other parties that depednd on this hard disk such as its child hard disks or snapshots of virtual machines where this hard disk is attached to these machines. If there are no children and no such snapshots then there is no dependency and the hard disk is not read-only. The value of this attribute can be used to determine the kind of the attachment that will take place when attaching this hard disk to a virtual machine. If the value is false then the hard disk will be attached directly. If the value is true then the hard disk will be attached indirectly by creating a new differencing child hard disk for that. See the interface description for more information. Note that all Immutable hard disks are always read-only while all Writethrough hard disks are always not. The read-only condition represented by this attribute is related to the hard disk type and usage, not to the current media state and not to the read-only state of the storage unit. Logical size of this hard disk (in megabytes), as reported to the guest OS running inside the vurtual machine this disk is attached to. The logical size is defined when the hard disk is created and cannot be changed later. Reading this property on a differencing hard disk will return the size of its hard disk. For hard disks whose state is is , the value of this property is the last known logical size. For hard disks, the returned value is zero. Starts creating a dymically expanding hard disk storage unit in the background. The previous storage unit created for this this object, if any, must be first deleted using , otherwise the operation will fail. Before the operation starts, the hard disk is placed to state. If the create operation fails, the media will placed back to state. After the returned progress object reports that the operation is successfully complete, the media state will be set to , the hard disk will be remembered by this VirtualBox installation and may be attached to virtual machines. Maximum logical size of the hard disk in megabytes. Progress object to track the operation completion. Starts creating a fixed-size hard disk storage unit in the background. The previous storage unit created for this this object, if any, must be first deleted using , otherwise the operation will fail. Before the operation starts, the hard disk is placed to state. If the create operation fails, the media will placed back to state. After the returned progress object reports that the operation is successfully complete, the media state will be set to , the hard disk will be remembered by this VirtualBox installation and may be attached to virtual machines. Logical size of the hard disk in megabytes. Progress object to track the operation completion. Starts deleting the storage unit of this hard disk. The hard disk must not be attahced to any known virtual machine and must not have any known child hard disks, otherwise the operation will fail. It will also fail if there is no storage unit to delete or if deletion is already in progress, or if the hard disk is being in use (locked for read or for write) or inaccessible. Therefore, the only valid state for this operation to succeed is . Before the operation starts, the hard disk is placed to state and gets removed from the list of remembered hard disks (media registry). If the delete operation fails, the media will be remembered again and placed back to state. After the returned progress object reports that the operation is complete, the media state will be set to and you will be able to use one of the storage creation methods to create it again. #close() Progress object to track the operation completion. Starts creating an empty differencing storage unit based on this hard disk in the format and at the location defined by the @a target argument. The target hard disk must be in state (i.e. must not have an existing storage unit). Upon successful completion, this operation will set the type of the target hard disk to and create a storage unit necessary to represent the differencing hard disk data in the given format (according to the storage format of the target object). After the returned progress object reports that the operation is successfully complete, the target hard disk gets remembered by this VirtualBox installation and may be attached to virtual machines. The hard disk will be placed to state for the duration of this operation. Target hard disk. Progress object to track the operation completion. Starts merging the contents of this hard disk and all intermediate differencing hard disks in the chain to the given target hard disk. The target hard disk must be either a descendant of this hard disk or its ancestor (otherwise this method will immediately return a failure). It follows that there are two logical directions of the merge operation: from ancestor to descendant (forward merge) and from descendant to ancestor (backward merge). Let us consider the following hard disk chain:
Base <- Diff_1 <- Diff_2
Here, calling this method on the Base hard disk object with Diff_2 as an argument will be a forward merge; calling it on Diff_2 with Base as an argument will be a backward merge. Note that in both cases the contents of the resulting hard disk will be the same, the only difference is the hard disk object that takes the result of the merge operation. In case of the forward merge in the above example, the result will be written to Diff_2; in case of the backward merge, the result will be written to Base. In other words, the result of the operation is always stored in the target hard disk. Upon successful operation completion, the storage units of all hard disks in the chain between this (source) hard disk and the target hard disk, including the source hard disk itself, will be automatically deleted and the relevant hard disk objects (including this hard disk) will become uninitialized. This means that any attempt to call any of their methods or attributes will fail with the "Object not ready" (E_ACCESSDENIED) error. Applied to the above example, the forward merge of Base to Diff_2 will delete and uninitialize both Base and Diff_1 hard disks. Note that Diff_2 in this case will become a base hard disk itself since it will no longer be based on any other hard disk. Considering the above, all of the following condtions must be met in order for the merge operation to succeed:
  • Neither this (source) hard disk nor any intermediate differencing hard disk in the chain between it and the target hard disk is attached to any virtual machine.
  • Neither the source hard disk nor the target hard disk is an hard disk.
  • The part of the hard disk tree from the source hard disk to the target hard disk is a linear chain, i.e. all hard disks in this chain have exactly one child which is the next hard disk in this chain. The only exception from this rule is the target hard disk in the forward merge operation; it is allowed to have any number of child hard disks because the merge operation will hot change its logical contents (as it is seen by the guest OS or by children).
  • None of the involved hard disks are in or state.
This (source) hard disk and all intermediates will be placed to state and the target hard disk will be placed to state and for the duration of this operation.
UUID of the target ancestor or descendant hard disk. Progress object to track the operation completion.
Starts creating a clone of this hard disk in the format and at the location defined by the @a target argument. The target hard disk must be in state (i.e. must not have an existing storage unit). Upon successful completion, the cloned hard disk will contain exactly the same sector data as the hard disk being cloned, except that a new UUID for the clone will be randomly generated. After the returned progress object reports that the operation is successfully complete, the target hard disk gets remembered by this VirtualBox installation and may be attached to virtual machines. If the cloned hard disk is a differencing hard disk, it will inherit parent dependency of the original hard disk. This hard disk will be placed to state for the duration of this operation. Target hard disk. Progress object to track the operation completion. Starts creating a deep (independent) clone of this hard disk in the format and at the location defined by the @a target argument. This operation is similar to except that when applied to a differencing hard disk, it will also copy missing hard disk data from all parent hard disks it is linked to. This will make the created clone an independent base hard disk that contains all hard disk data and does not need any other hard disks to operate. After the returned progress object reports that the operation is successfully complete, the target hard disk gets remembered by this VirtualBox installation and may be attached to virtual machines. For base hard disks, this operation is identical to . This hard disk and all its parent hard disks will be placed to state for the duration of this operation. Target hard disk. Progress object to track the operation completion.
The IHardDiskFormat interface represents a virtual hard disk format. Each hard disk format has an associated backend which is used to handle hard disks stored in this format. This interface provides information about the properties of the associated backend. Each hard disk format is identified by a string represented by the attribute. This string is used in calls like to specify the desired format. The list of all supported hard disk formats can be obtained using . IHardDisk2 Identfier of this format. This string is used in methods of other interfaces where it is necessary to specify a hard disk format, such as . Supports UUIDs as expected by VirtualBox code. Supports creating fixed size images, allocating all space instantly. Supports creating dynamically growing images, allocating space on demand. Supports creating images split in chunks of a bit less than 2GBytes. Supports being used as differencing image format backend. Supports asynchronous I/O operations for at least some configurations. The backend operates on files. The caller needs to know to handle the location appropriately. For a list of supported file extentions see . The backend uses the config interface. The caller needs to know how to provide the mandatory configuration parts this way. Array of strings containing the supported file extensions. The first extension in the array is the extension preferred by the backend. It is recommended to use this extension when specifyng a location of the storage unit for a new hard disk. Note that some backends do not work on files, so this array may be empty. IHardDiskFormat::supportFile The IFloppyImage2 interface represents a medium containing the image of a floppy disk. The IDVDImage2 interface represents a medium containing the image of a CD or DVD disk in the ISO format. The IDVDDrive interface represents the virtual CD/DVD drive of the virtual machine. An object of this type is returned by . Current drive state. When a host drive is mounted and passthrough is enabled the guest OS will be able to directly send SCSI commands to the host drive. This enables the guest OS to use CD/DVD writers but is potentially dangerous. Mounts a CD/DVD image with the specified UUID. Captures the specified host CD/DVD drive. Unmounts the currently mounted image or host drive. Returns the currently mounted CD/DVD image. Returns the currently mounted host CD/DVD drive. The IFloppyDrive interface represents the virtual floppy drive of the virtual machine. An object of this type is returned by . Flag whether the floppy drive is enabled. If it is disabled, the floppy drive will not be reported to the guest OS. Current drive state. Mounts a floppy image with the specified UUID. Captures the specified host floppy drive. Unmounts the currently mounted image or host drive. Returns the currently mounted floppy image. Returns the currently mounted host floppy drive. The IKeyboard interface represents the virtual machine's keyboard. Used in . Through this interface, the virtual machine's virtual keyboard can be controlled. One can send keystrokes to the virtual machine and send the Ctrl-Alt-Del sequence to it. Sends a scancode to the keyboard. Sends an array of scancode to the keyboard. Sends the Ctrl-Alt-Del sequence to the keyboard. Mouse button state. The IMouse interface represents the virtual machine's mouse. Used in . Through this interface, the virtual machine's virtual mouse can be controlled. Whether the guest OS supports absolute mouse pointer positioning or not. VirtualBox Guest Tools need to be installed to the guest OS in order to enable absolute mouse positioning support. You can use the callback to be instantly informed about changes of this attribute during virtual machine execution. Initiates a mouse event using relative pointer movements along x and y axis. Amout of pixels the mouse should move to the right. Negative values move the mouse to the left. Amout of pixels the mouse should move downwards. Negative values move the mouse upwards. Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations. The current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)left mouse button
Bit 1 (0x02)right mouse button
Bit 2 (0x04)middle mouse button
A value of 1 means the corresponding button is pressed. otherwise it is released.
Positions the mouse pointer using absolute x and y coordinates. These coordinates are expressed in pixels and start from [1,1] which corresponds to the top left corner of the virtual display. This method will have effect only if absolute mouse positioning is supported by the guest OS. X coordinate of the pointer in pixels, starting from 1. Y coordinate of the pointer in pixels, starting from 1. Amout of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations. The current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)left mouse button
Bit 1 (0x02)right mouse button
Bit 2 (0x04)middle mouse button
A value of 1 means the corresponding button is pressed. otherwise it is released.
Framebuffer acceleration operation. Format of the video memory buffer. Constants represented by this enum can be used to test for particular values of . See also . See also www.fourcc.org for more information about FOURCC pixel formats. Unknown buffer format. The user may not assume any particular format of the buffer. Basic RGB format. determines the bit layout. Address of the start byte of the framebuffer. Framebuffer width, in pixels. Framebuffer height, in pixels. Color depth, in bits per pixel. When is FOURCC_RGB, valid values are: 8, 15, 16, 24 and 32. Scan line size, in bytes. When is FOURCC_RGB, the size of the scan line must be aligned to 32 bits. Framebuffer pixel format. It's either one of the values defined by or a raw FOURCC code. This attribute must never return -- the format of the buffer points to must be always known. Defines whether this framebuffer uses the virtual video card's memory buffer (guest VRAM) directly or not. See for more information. Hint from the framebuffer about how much of the standard screen height it wants to use for itself. This information is exposed to the guest through the VESA BIOS and VMMDev interface so that it can use it for determining its video mode table. It is not guaranteed that the guest respects the value. An alpha-blended overlay which is superposed over the framebuffer. The initial purpose is to allow the display of icons providing information about the VM state, including disk activity, in front ends which do not have other means of doing that. The overlay is designed to controlled exclusively by IDisplay. It has no locking of its own, and any changes made to it are not guaranteed to be visible until the affected portion of IFramebuffer is updated. The overlay can be created lazily the first time it is requested. This attribute can also return NULL to signal that the overlay is not implemented. Platform-dependent identifier of the window where context of this framebuffer is drawn, or zero if there's no such window. Locks the framebuffer. Gets called by the IDisplay object where this framebuffer is bound to. Unlocks the framebuffer. Gets called by the IDisplay object where this framebuffer is bound to. Informs about an update. Gets called by the display object where this buffer is registered. Requests a size and pixel format change. There are two modes of working with the video buffer of the virtual machine. The indirect mode implies that the IFramebuffer implementation allocates a memory buffer for the requested display mode and provides it to the virtual machine. In direct mode, the IFramebuffer implementation uses the memory buffer allocated and owned by the virtual machine. This buffer represents the video memory of the emulated video adapter (so called guest VRAM). The direct mode is usually faster because the implementation gets a raw pointer to the guest VRAM buffer which it can directly use for visualizing the contents of the virtual display, as opposed to the indirect mode where the contents of guest VRAM are copied to the memory buffer provided by the implementation every time a display update occurs. It is important to note that the direct mode is really fast only when the implementation uses the given guest VRAM buffer directly, for example, by blitting it to the window representing the virtual machine's display, which saves at least one copy operation comparing to the indirect mode. However, using the guest VRAM buffer directly is not always possible: the format and the color depth of this buffer may be not supported by the target window, or it may be unknown (opaque) as in case of text or non-linear multi-plane VGA video modes. In this case, the indirect mode (that is always available) should be used as a fallback: when the guest VRAM contents are copied to the implementation-provided memory buffer, color and format conversion is done automatically by the underlying code. The @a pixelFormat parameter defines whether the direct mode is available or not. If @a pixelFormat is then direct access to the guest VRAM buffer is not available -- the @a VRAM, @a bitsPerPixel and @a bytesPerLine parameters must be ignored and the implementation must use the indirect mode (where it provides its own buffer in one of the supported formats). In all other cases, @a pixelFormat together with @a bitsPerPixel and @a bytesPerLine define the format of the video memory buffer pointed to by the @a VRAM parameter and the implementation is free to choose which mode to use. To indicate that this framebuffer uses the direct mode, the implementation of the attribute must return true and must return exactly the same address that is passed in the @a VRAM parameter of this method; otherwise it is assumed that the indirect strategy is chosen. The @a width and @a height parameters represent the size of the requested display mode in both modes. In case of indirect mode, the provided memory buffer should be big enough to store data of the given display mode. In case of direct mode, it is guaranteed that the given @a VRAM buffer contains enough space to represent the display mode of the given size. Note that this framebuffer's and attributes must return exactly the same values as passed to this method after the resize is completed (see below). The @a finished output parameter determines if the implementation has finished resizing the framebuffer or not. If, for some reason, the resize cannot be finished immediately during this call, @a finished must be set to @c false, and the implementation must call after it has returned from this method as soon as possible. If @a finished is @c false, the machine will not call any framebuffer methods until is called. Note that if the direct mode is chosen, the , and attributes of this framebuffer must return exactly the same values as specified in the parameters of this method, after the resize is completed. If the indirect mode is chosen, these attributes must return values describing the format of the implementation's own memory buffer points to. Note also that the value must always correlate with . Note that the attribute must never return regardless of the selected mode. This method is called by the IDisplay object under the provided by this IFramebuffer implementation. If this method returns @c false in @a finished, then this lock is not released until is called. Logical screen number. Must be used in the corresponding call to if this call is made. Pixel format of the memory buffer pointed to by @a VRAM. See also . Pointer to the virtual video card's VRAM (may be @c null). Color depth, bits per pixel. Size of one scan line, in bytes. Width of the guest display, in pixels. Height of the guest display, in pixels. Can the VM start using the new framebuffer immediately after this method returns or it should wait for . Returns whether the given acceleration operation is supported by the IFramebuffer implementation. If not, the display object will not attempt to call the corresponding IFramebuffer entry point. Even if an operation is indicated to supported, the IFramebuffer implementation always has the option to return non supported from the corresponding acceleration method in which case the operation will be performed by the display engine. This allows for reduced IFramebuffer implementation complexity where only common cases are handled. Returns whether the framebuffer implementation is willing to support a given video mode. In case it is not able to render the video mode (or for some reason not willing), it should return false. Usually this method is called when the guest asks the VMM device whether a given video mode is supported so the information returned is directly exposed to the guest. It is important that this method returns very quickly. Fills the specified rectangle on screen with a solid color. Copies specified rectangle on the screen. Returns the visible region of this framebuffer. If the @a rectangles parameter is NULL then the value of the @a count parameter is ignored and the number of elements necessary to describe the current visible region is returned in @a countCopied. If @a rectangles is not NULL but @a count is less than the required number of elements to store region data, the method will report a failure. If @a count is equal or greater than the required number of elements, then the actual number of elements copied to the provided array will be returned in @a countCopied. The address of the provided array must be in the process space of this IFramebuffer object. Pointer to the RTRECT array to receive region data. Number of RTRECT elements in the @a rectangles array. Number of elements copied to the @a rectangles array. Suggests a new visible region to this framebuffer. This region represents the area of the VM display which is a union of regions of all top-level windows of the guest operating system running inside the VM (if the Guest Additions for this system support this functionality). This information may be used by the frontends to implement the seamless desktop integration feature. The address of the provided array must be in the process space of this IFramebuffer object. The IFramebuffer implementation must make a copy of the provided array of rectangles. Pointer to the RTRECT array. Number of RTRECT elements in the @a rectangles array. The IFramebufferOverlay interface represents an alpha blended overlay for displaying status icons above an IFramebuffer. It is always created not visible, so that it must be explicitly shown. It only covers a portion of the IFramebuffer, determined by its width, height and co-ordinates. It is always in packed pixel little-endian 32bit ARGB (in that order) format, and may be written to directly. Do re-read the width though, after setting it, as it may be adjusted (increased) to make it more suitable for the front end. X position of the overlay, relative to the framebuffer. Y position of the overlay, relative to the framebuffer. Whether the overlay is currently visible. The global alpha value for the overlay. This may or may not be supported by a given front end. Changes the overlay's position relative to the IFramebuffer. The IDisplay interface represents the virtual machine's display. The object implementing this interface is contained in each attribute and represents the visual output of the virtual machine. The virtual display supports pluggable output targets represented by the IFramebuffer interface. Examples of the output target are a window on the host computer or an RDP session's display on a remote computer. Current display width. Current display height. Current guest display color depth. Note that this may differ from . Prepares an internally managed framebuffer. Requests access to the internal framebuffer. Releases access to the internal framebuffer. Registers an external framebuffer. Sets the framebuffer for given screen. Queries the framebuffer for given screen. Asks VirtualBox to request the given video mode from the guest. This is just a hint and it cannot be guaranteed that the requested resolution will be used. Guest Additions are required for the request to be seen by guests. The caller should issue the request and wait for a resolution change and after a timeout retry. Specifying 0 for either @a width, @a height or @a bitsPerPixel parameters means that the corresponding values should be taken from the current video mode (i.e. left unchanged). If the guest OS supports multi-monitor configuration then the @a display parameter specifies the number of the guest display to send the hint to: 0 is the primary display, 1 is the first secondary and so on. If the multi-monitor configuration is not supported, @a display must be 0. Enables or disables seamless guest display rendering (seamless desktop integration) mode. Calling this method has no effect if returns false. Takes a screen shot of the requested size and copies it to the 32-bpp buffer allocated by the caller. Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display. Does a full invalidation of the VM display and instructs the VM to update it. Signals that a framebuffer has completed the resize operation. Signals that a framebuffer has completed the update operation. Network attachment type. null value. Also means "not attached". Network adapter type. null value. Never used by the API. Type of the virtual network adapter. Depending on this value, VirtualBox will provide a different virtual network hardware to the guest. Slot number this adapter is plugged into. Corresponds to the value you pass to to obtain this instance. Flag whether the network adapter is present in the guest system. If disabled, the virtual guest hardware will not contain this network adapter. Can only be changed when the VM is not running. Ethernet MAC address of the adapter, 12 hexadecimal characters. When setting it to NULL, VirtualBox will generate a unique MAC address. Name of the Host Network Interface that is currently in use. NULL will be returned if no device has been allocated. On Linux, setting this refers to a permanent TAP device. However, a file descriptor has precedence over the interface name on Linux. Note that when VirtualBox allocates a TAP device, this property will not be set, i.e. the interface name would have to be determined using the file descriptor and /proc/self/fd. File descriptor of the TAP device. It can either be setup by the caller which has to supply an existing valid file handle allocated in the parent process of the VM process or allocated by VirtualBox. The value is -1 if it has not been defined. This property is non persistent, i.e. it will not be stored in the VM's configuration data and thus has to be set at each startup. Application to start to configure the TAP device. It is being passed two parameters, 1) the file handle (as ASCII), 2) the TAP device name if it is available. Application to start before closing a TAP device. It is being passed two parameters, 1) the file handle (as ASCII), 2) the TAP device name if it is available. Name of the internal network the VM is attached to. Name of the NAT network the VM is attached to. Flag whether the adapter reports the cable as connected or not. It can be used to report offline situations to a VM. Line speed reported by custom drivers, in units of 1 kbps. Flag whether network traffic from/to the network card should be traced. Can only be toggled when the VM is turned off. Filename where a network trace will be stored. If not set, VBox-pid.pcap will be used. Attach the network adapter to the Network Address Translation (NAT) interface. Attach the network adapter to a host interface. On Linux, the TAP setup application will be executed if configured and unless a device name and/or file descriptor has been set, a new TAP interface will be created. Attach the network adapter to an internal network. Detach the network adapter The PortMode enumeration represents possible communication modes for the virtual serial port device. Virtual device is not attached to any real host device. Virtual device is attached to a host pipe. Virtual device is attached to a host device. The ISerialPort interface represents the virtual serial port device. The virtual serial port device acts like an ordinary serial port inside the virtual machine. This device communicates to the real serial port hardware in one of two modes: host pipe or host device. In host pipe mode, the #path attribute specifies the path to the pipe on the host computer that represents a serial port. The #server attribute determines if this pipe is created by the virtual machine process at machine startup or it must already exist before starting machine execution. In host device mode, the #path attribute specifies the name of the serial port device on the host computer. There is also a third communication mode: the disconnected mode. In this mode, the guest OS running inside the virtual machine will be able to detect the serial port, but all port write operations will be discarded and all port read operations will return no data. IMachine::getSerialPort Slot number this serial port is plugged into. Corresponds to the value you pass to to obtain this instance. Flag whether the serial port is enabled. If disabled, the serial port will not be reported to the guest OS. Base I/O address of the serial port. IRQ number of the serial port. How is this port connected to the host. Flag whether this serial port acts as a server (creates a new pipe on the host) or as a client (uses the existing pipe). This attribute is used only when is PortMode::HostPipe. Path to the serial port's pipe on the host when is PortMode::HostPipe, or the host serial device name when is PortMode::HostDevice. In either of the above cases, setting a @c null or an empty string as the attribute's value will result into an error. Otherwise, the value of this property is ignored. The IParallelPort interface represents the virtual parallel port device. The virtual parallel port device acts like an ordinary parallel port inside the virtual machine. This device communicates to the real parallel port hardware using the name of the parallel device on the host computer specified in the #path attribute. Each virtual parallel port device is assigned a base I/O address and an IRQ number that will be reported to the guest operating system and used to operate the given parallel port from within the virtual machine. IMachine::getParallelPort Slot number this parallel port is plugged into. Corresponds to the value you pass to to obtain this instance. Flag whether the parallel port is enabled. If disabled, the parallel port will not be reported to the guest OS. Base I/O address of the parallel port. IRQ number of the parallel port. Host parallel device name. If this parallel port is enabled, setting a @c null or an empty string as this attribute's value will result into an error. Reset VM statistics. The selection pattern. A bit similar to filename globbing. Dumps VM statistics. The selection pattern. A bit similar to filename globbing. Get the VM statistics in a XMLish format. The selection pattern. A bit similar to filename globbing. Whether to include the descriptions. The XML document containing the statistics. Switch for enabling singlestepping. Switch for forcing code recompilation for user mode code. Switch for forcing code recompilation for supervisor mode code. Switch for enabling and disabling the PATM component. Switch for enabling and disabling the CSAM component. Switch for enabling and disabling logging. Flag indicating whether the VM is currently making use of CPU hardware virtualization extensions. Flag indicating whether the VM is currently making use of the nested paging CPU hardware virtualization extension. Flag indicating whether the VM is currently making use of the VPID VT-x extension. Flag indicating whether the VM is currently making use of the Physical Address Extension CPU feature. The rate at which the virtual time runs expressed as a percentage. The accepted range is 2% to 20000%. Gets the VM handle. This is only for internal use while we carve the details of this interface. Flag whether the USB controller is present in the guest system. If disabled, the virtual guest hardware will not contain any USB controller. Can only be changed when the VM is powered off. Flag whether the USB EHCI controller is present in the guest system. If disabled, the virtual guest hardware will not contain a USB EHCI controller. Can only be changed when the VM is powered off. USB standard version which the controller implements. This is a BCD which means that the major version is in the high byte and minor version is in the low byte. List of USB device filters associated with the machine. If the machine is currently running, these filters are activated every time a new (supported) USB device is attached to the host computer that was not ignored by global filters (). These filters are also activated when the machine is powered up. They are run against a list of all currently available USB devices (in states Available, Busy, Held) that were not previously ignored by global filters. If at least one filter matches the USB device in question, this device is automatically captured (attached to) the virtual USB controller of this machine. IUSBDeviceFilter, ::IUSBController Creates a new USB device filter. All attributes except the filter name are set to null (any match), active is false (the filter is not active). The created filter can then be added to the list of filters using . #deviceFilters Filter name. See for more info. Created filter object. Inserts the given USB device to the specified position in the list of filters. Positions are numbered starting from 0. If the specified position is equal to or greater than the number of elements in the list, the filter is added to the end of the collection. Duplicates are not allowed, so an attempt to insert a filter that is already in the collection, will return an error. #deviceFilters Position to insert the filter to. USB device filter to insert. Removes a USB device filter from the specified position in the list of filters. Positions are numbered starting from 0. Specifying a position equal to or greater than the number of elements in the list will produce an error. #deviceFilters Position to remove the filter from. Removed USB device filter. Searches this collection for a USB device with the given UUID. The method returns an error if the given UUID does not correspond to any USB device in the collection. IUSBDevice::id UUID of the USB device to search for. Found USB device object. Searches this collection for a USB device with the given host address. The method returns an error if the given address does not correspond to any USB device in the collection. IUSBDevice::address Address of the USB device (as assigned by the host) to search for. Found USB device object. The IUSBDevice interface represents a virtual USB device attached to the virtual machine. A collection of objects implementing this interface is stored in the attribute which lists all USB devices attached to a running virtual machine's USB controller. Unique USB device ID. This ID is built from #vendorId, #productId, #revision and #serialNumber. Vendor ID. Product ID. Product revision number. This is a packed BCD represented as unsigned short. The high byte is the integer part and the low byte is the decimal. Manufacturer string. Product string. Serial number string. Host specific address of the device. Host USB port number the device is physically coonected to. The major USB version of the device - 1 or 2. The major USB version of the host USB port the device is physically connected to - 1 or 2. For devices not connected to anything this will have the same value as the version attribute. Whether the device is physically connected to a remote VRDP client or to a local host machine. The IUSBDeviceFilter interface represents an USB device filter used to perform actions on a group of USB devices. This type of filters is used by running virtual machines to automatically capture selected USB devices once they are physically attached to the host computer. A USB device is matched to the given device filter if and only if all attributes of the device match the corresponding attributes of the filter (that is, attributes are joined together using the logical AND operation). On the other hand, all together, filters in the list of filters carry the semantics of the logical OR operation. So if it is desirable to create a match like "this vendor id OR this product id", one needs to create two filters and specify "any match" (see below) for unused attributes. All filter attributes used for matching are strings. Each string is an expression representing a set of values of the corresponding device attribute, that will match the given filter. Currently, the following filtering expressions are supported:
  • Interval filters. Used to specify valid intervals for integer device attributes (Vendor ID, Product ID and Revision). The format of the string is: int:((m)|([m]-[n]))(,(m)|([m]-[n]))* where m and n are integer numbers, either in octal (starting from 0), hexadecimal (starting from 0x) or decimal (otherwise) form, so that m < n. If m is omitted before a dash (-), the minimum possible integer is assumed; if n is omitted after a dash, the maximum possible integer is assumed.
  • Boolean filters. Used to specify acceptable values for boolean device attributes. The format of the string is: true|false|yes|no|0|1
  • Exact match. Used to specify a single value for the given device attribute. Any string that does't start with int: represents the exact match. String device attributes are compared to this string including case of symbols. Integer attributes are first converted to a string (see individual filter attributes) and then compared ignoring case.
  • Any match. Any value of the corresponding device attribute will match the given filter. An empty or null string is used to construct this type of filtering expressions.
On the Windows host platform, interval filters are not currently available. Also all string filter attributes (, , ) are ignored, so they behave as any match no matter what string expression is specified. IUSBController::deviceFilters, IHostUSBDeviceFilter
Visible name for this filter. This name is used to visually distinguish one filter from another, so it can neither be null nor an empty string. Whether this filter active or has been temporarily disabled. Vendor ID filter. The string representation for the exact matching has the form XXXX, where X is the hex digit (including leading zeroes). Product ID filter. The string representation for the exact matching has the form XXXX, where X is the hex digit (including leading zeroes). Product revision number filter. The string representation for the exact matching has the form IIFF, where I is the decimal digit of the integer part of the revision, and F is the decimal digit of its fractional part (including leading and trailing zeros). Note that for interval filters, it's best to use the hexadecimal form, because the revision is stored as a 16 bit packed BCD value; so the expression int:0x0100-0x0199 will match any revision from 1.0 to 1.99. Manufacturer filter. Product filter. Serial number filter. Host USB port filter. Remote state filter. This filter makes sense only for machine USB filters, i.e. it is ignored by IHostUSBDeviceFilter objects. This is an advanced option for hiding one or more USB interfaces from the guest. The value is a bitmask where the bits that are set means the corresponding USB interface should be hidden, masked off if you like. This feature only works on Linux hosts.
USB device state. This enumeration represents all possible states of the USB device physically attached to the host computer regarding its state on the host computer and availability to guest computers (all currently running virtual machines). Once a supported USB device is attached to the host, global USB filters () are activated. They can either ignore the device, or put ot to #Held state, or do nothing. Unless the device is ignored by global filters, filters of all currently running guests () are activated that can put it to #Captured state. If the device was ignored by global filters, or didn't match any filters at all (including guest ones), it is handled by the host in a normal way. In this case, the device state is determined by the host and can be one of #Unavailable, #Busy or #Available, depending on the current device usage. Besides auto-capturing based on filters, the device can be manually captured by guests () if its state is #Busy, #Available or #Held. Due to differences in USB stack implementations in Linux and Win32, states #Busy and #Available are applicable only to the Linux version of the product. This also means that () can only succeed on Win32 if the device state is #Held. IHostUSBDevice, IHostUSBDeviceFilter Not supported by the VirtualBox server, not available to guests. Being used by the host computer exclusively, not available to guests. Being used by the host computer, potentially available to guests. Not used by the host computer, available to guests. The host computer can also start using the device at any time. Held by the VirtualBox server (ignored by the host computer), available to guests. Captured by one of the guest computers, not available to anybody else. Searches this collection for a USB device with the given UUID. The method returns an error if the given UUID does not correspond to any USB device in the collection. IHostUSBDevice::id UUID of the USB device to search for. Found USB device object. Searches this collection for a USB device with the given host address. The method returns an error if the given address does not correspond to any USB device in the collection. IHostUSBDevice::address Address of the USB device (as assigned by the host) to search for. Found USB device object. The IHostUSBDevice interface represents a physical USB device attached to the host computer. Besides properties inherited from IUSBDevice, this interface adds the property that holds the current state of the USB device. IHost::USBDevices, IHost::USBDeviceFilters Current state of the device. Actions for host USB device filters. IHostUSBDeviceFilter, USBDeviceState null value. Never used by the API. Ignore the matched USB device. Hold the matched USB device. The IHostUSBDeviceFilter interface represents a global filter for a physical USB device used by the host computer. Used indirectly in . Using filters of this type, the host computer determines the initial state of the USB device after it is physically attached to the host's USB controller. The attribute is ignored by this type of filters, because it makes sense only for machine USB filters. IHost::USBDeviceFilters Action performed by the host when an attached USB device matches this filter. Host audio driver type. null value. Also means "dummy audio driver". Virtual audio controller type. The IAudioAdapter interface represents the virtual audio adapter of the virtual machine. Used in . Flag whether the audio adapter is present in the guest system. If disabled, the virtual guest hardware will not contain any audio adapter. Can only be changed when the VM is not running. The audio hardware we emulate. Audio driver the adapter is connected to. This setting can only be changed when the VM is not running. VRDP authentication type. null value. Also means "no authentication". VRDP server status. VRDP server port number. Setting the value of this property to 0 will reset the port number to the default value which is currently 3389. Reading this property will always return a real port number, even after it has been set to 0 (in which case the default port is returned). VRDP server address. VRDP authentication method. Timeout for guest authentication. Milliseconds. Flag whether multiple simultaneous connections to the VM are permitted. Note that this will be replaced by a more powerful mechanism in the future. Flag whether the existing connection must be dropped and a new connection must be established by the VRDP server, when a new client connects in single connection mode. Searches this collection for a shared folder with the given logical name. The method returns an error if the given name does not correspond to any shared folder in the collection. Logical name of the shared folder to search for Found shared folder object The ISharedFolder interface represents a folder in the host computer's file system accessible from the guest OS running inside a virtual machine using an associated logical name. There are three types of shared folders:
  • Global (), shared folders available to all virtual machines.
  • Permanent (), VM-specific shared folders available to the given virtual machine at startup.
  • Transient (), VM-specific shared folders created in the session context (for example, when the virtual machine is running) and automatically discarded when the session is closed (the VM is powered off).
Logical names of shared folders must be unique within the given scope (global, permanent or transient). However, they do not need to be unique across scopes. In this case, the definition of the shared folder in a more specific scope takes precedence over definitions in all other scopes. The order of precedence is (more specific to more general):
  1. Transient definitions
  2. Permanent definitions
  3. Global definitions
For example, if MyMachine has a shared folder named C_DRIVE (that points to C:\\), then creating a transient shared folder named C_DRIVE (that points to C:\\\\WINDOWS) will change the definition of C_DRIVE in the guest OS so that \\\\VBOXSVR\\C_DRIVE will give access to C:\\WINDOWS instead of C:\\ on the host PC. Removing the transient shared folder C_DRIVE will restore the previous (permanent) definition of C_DRIVE that points to C:\\ if it still exists. Note that permanent and transient shared folders of different machines are in different name spaces, so they don't overlap and don't need to have unique logical names. Global shared folders are not implemented in the current version of the product.
Logical name of the shared folder. Full path to the shared folder in the host file system. Whether the folder defined by the host path is currently accessible or not. For example, the folder can be unaccessible if it is placed on the network share that is not available by the time this property is read. Whether the folder defined by the host path is writable or not.
PID of the process that has created this Session object. Returns the console object suitable for remote control. Assigns the machine object associated with this direct-type session or informs the session that it will be a remote one (if machine = NULL). Assigns the machine and the (remote) console object associated with this remote-type session. Updates the machine state in the VM process. Must be called only in certain cases (see the method implementation). Uninitializes (closes) this session. Used by VirtualBox to close the corresponding remote session when the direct session dies or gets closed. Triggered when settings of the DVD drive object of the associated virtual machine have changed. Triggered when settings of the floppy drive object of the associated virtual machine have changed. Triggered when settings of a network adapter of the associated virtual machine have changed. Triggered when settions of a serial port of the associated virtual machine have changed. Triggered when settings of a parallel port of the associated virtual machine have changed. Triggered when settings of the VRDP server object of the associated virtual machine have changed. Triggered when settings of the USB controller object of the associated virtual machine have changed. Triggered when a permanent (global or machine) shared folder has been created or removed. We don't pass shared folder parameters in this notification because the order in which parallel notifications are delivered is not defined, therefore it could happen that these parameters were outdated by the time of processing this notification. Triggered when a request to capture a USB device (as a result of matched USB filters or direct call to ) has completed. A @c null @a error object means success, otherwise it describes a failure. Triggered when a request to release the USB device (as a result of machine termination or direct call to ) has completed. A @c null @a error object means success, otherwise it Called by and by in order to notify console callbacks and . Called by and by in order to read and modify guest properties. Return a list of the guest properties matching a set of patterns along with their values, timestamps and flags. The patterns to match the properties against as a comma-separated string. If this is empty, all properties currently set will be returned. The key names of the properties returned. The values of the properties returned. The array entries match the corresponding entries in the @a key array. The timestamps of the properties returned. The array entries match the corresponding entries in the @a key array. The flags of the properties returned. The array entries match the corresponding entries in the @a key array. The ISession interface represents a serialization primitive for virtual machines. With VirtualBox, every time one wishes to manipulate a virtual machine (e.g. change its settings or start execution), a session object is required. Such an object must be passed to one of the session methods that open the given session, which then initiates the machine manipulation. A session serves several purposes: it identifies to the inter-process VirtualBox code which process is currently working with the virtual machine, and it ensures that there are no incompatible requests from several processes for the same virtual machine. Session objects can therefore be thought of as mutex semaphores that lock virtual machines to prevent conflicting accesses from several processes. How sessions objects are used depends on whether you use the Main API via COM or via the webservice:
  • When using the COM API directly, an object of the Session class from the VirtualBox type library needs to be created. In regular COM C++ client code, this can be done by calling createLocalObject(), a standard COM API. This object will then act as a local session object in further calls to open a session.
  • In the webservice, the session manager (IWebsessionManager) instead creates one session object automatically when is called. A managed object reference to that session object can be retrieved by calling . This session object reference can then be used to open sessions.
Sessions are mainly used in two variations:
  • To start a virtual machine in a separate process, one would call , which requires a session object as its first parameter. This session then identifies the caller and lets him control the started machine (for example, pause machine execution or power it down) as well as be notified about machine execution state changes.
  • To alter machine settings, or to start machine execution within the current process, one needs to open a direct session for the machine first by calling . While a direct session is open within one process, no any other process may open another direct session for the same machine. This prevents the machine from being changed by other processes while it is running or while the machine is being configured.
One also can attach to an existing direct session already opened by another process (for example, in order to send a control request to the virtual machine such as the pause or the reset request). This is done by calling . Unless you are trying to write a new VirtualBox front-end that performs direct machine execution (like the VirtualBox or VBoxSDL front-ends), don't call in a direct session opened by and use this session only to change virtual machine settings. If you simply want to start virtual machine execution using one of the existing front-ends (for example the VirtualBox GUI or headless server), simply use ; these front-ends will power up the machine automatically for you.
Current state of this session. Type of this session. The value of this attribute is valid only if the session is currently open (i.e. its #state is SessionType::SessionOpen), otherwise an error will be returned. Machine object associated with this session. Console object associated with this session. Closes a session that was previously opened. It is recommended that every time an "open session" method (such as or ) has been called to manipulate a virtual machine, the caller invoke ISession::close() when it's done doing so. Since sessions are serialization primitives much like ordinary mutexes, they are best used the same way: for each "open" call, there should be a matching "close" call, even when errors occur. Otherwise, if a direct session for a machine opened with is not explicitly closed when the application terminates, the state of the machine will be set to on the server. Generally, it is recommended to close all open sessions explicitly before terminating the application (no matter what is the reason of the termination). Do not expect the session state ( to return to "Closed" immediately after you invoke ISession::close(), particularly if you have started a remote session to execute the VM in a new process. The session state will automatically return to "Closed" once the VM is no longer executing, which can of course take a very long time.
Flag whether the SATA controller is present in the guest system. If disabled, the virtual guest hardware will not contain any SATA controller. Can only be changed when the VM is powered off. The number of usable ports on the SATA controller. It ranges from 1 to 30. Gets the corresponding port number which is emulated as an IDE device. Sets the port number which is emulated as an IDE device. Managed object reference. Only within the webservice, a managed object reference (which is really an opaque number) allows a webservice client to address an object that lives in the address space of the webservice server. Behind each managed object reference, there is a COM object that lives in the webservice server's address space. The COM object is not freed until the managed object reference is released, either by an explicit call to or by logging off from the webservice (), which releases all objects created during the webservice session. Whenever a method call of the VirtualBox API returns a COM object, the webservice representation of that method will instead return a managed object reference, which can then be used to invoke methods on that object. Returns the name of the interface that this managed object represents, for example, "IMachine", as a string. Releases this managed object reference and frees the resources that were allocated for it in the webservice server process. After calling this method, the identifier of the reference can no longer be used. Websession manager. This provides essential services to webservice clients. Logs a new client onto the webservice and returns a managed object reference to the IVirtualBox instance, which the client can then use as a basis to further queries, since all calls to the VirtualBox API are based on the IVirtualBox interface, in one way or the other. Returns a managed object reference to the internal ISession object that was created for this web service session when the client logged on. ISession Logs off the client who has previously logged on with and destroys all resources associated with the session (most importantly, all managed objects created in the server while the session was active). The IPerformanceMetric interface represents parameters of the given performance metric. Name of the metric. Object this metric belongs to. Textual description of the metric. Time interval between samples, measured in seconds. Number of recent samples retained by the performance collector for this metric. When the collected sample count exceeds this number, older samples are discarded. Unit of measurement. Minimum possible value of this metric. Maximum possible value of this metric. The IPerformanceCollector interface represents a service that collects and stores performance metrics data. Performance metrics are associated with objects like IHost and IMachine. Each object has a distinct set of performance metrics. The set can be obtained with . Metric data are collected at the specified intervals and are retained internally. The interval and the number of samples retained can be set with . Metrics are organized hierarchically, each level separated by slash (/). General scheme for metric name is "Category/Metric[/SubMetric][:aggregation]". For example CPU/Load/User:avg metric name stands for: CPU category, Load metric, User submetric, average aggregate. An aggregate function is computed over all retained data. Valid aggregate functions are:
  • avg -- average
  • min -- minimum
  • max -- maximum
"Category/Metric" together form base metric name. A base metric is the smallest unit for which a sampling interval and the number of retained samples can be set. Only base metrics can be enabled and disabled. All sub-metrics are collected when their base metric is collected. Collected values for any set of sub-metrics can be queried with . When setting up metric parameters, querying metric data, enabling or disabling metrics wildcards can be used in metric names to specify a subset of metrics. For example, to select all CPU-related metrics use CPU/*, all averages can be queried using *:avg and so on. To query metric values without aggregates *: can be used. The valid names for base metrics are:
  • CPU/Load
  • CPU/MHz
  • RAM/Usage
The general sequence for collecting and retrieving the metrics is:
  • Obtain an instance of IPerfromanceCollector with
  • Allocate and populate an array with references to objects the metrics will be collected for. Use references to IHost and IMachine objects.
  • Allocate and populate an array with base metric names the data will be collected for.
  • Call . From now on the metric data will be collected and stored.
  • Wait for the data to get collected.
  • Allocate and populate an array with references to objects the metric values will be queried for. You can re-use the object array used for setting base metrics.
  • Allocate and populate an array with metric names the data will be collected for. Note that metric names differ from base metric names.
  • Call . The data that have been collected so far are returned. Note that the values are still retained internally and data collection continues.
For an example of usage refer to the following files in VirtualBox SDK:
  • Java: bindings/webservice/java/jax-ws/samples/metrictest.java
  • Python: bindings/xpcom/python/sample/shellcommon.py
Array of unique names of metrics. This array represents all metrics supported by the performance collector. Individual objects do not necessarily support all of them. can be used to get the list of supported metrics for a particular object. Returns parameters of specified metrics for a set of objects. @c Null metrics array means all metrics. @c Null object array means all existing objects. Metric name filter. Currently, only a comma-separated list of metrics is supported. Set of objects to return metric parameters for. Array of returned metric parameters. Sets parameters of specified base metrics for a set of objects. Returns an array of describing the metrics have been affected. @c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to setup metric parameters for. Time interval in seconds between two consecutive samples of performance data. Number of samples to retain in performance data history. Older samples get discarded. Array of metrics that have been modified by the call to this method. Turns on collecting specified base metrics. Returns an array of describing the metrics have been affected. @c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to enable metrics for. Array of metrics that have been modified by the call to this method. Turns off collecting specified base metrics. Returns an array of describing the metrics have been affected. @c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to disable metrics for. Array of metrics that have been modified by the call to this method. Queries collected metrics data for a set of objects. The data itself and related metric information are returned in seven parallel and one flattened array of arrays. Elements of returnMetricNames, returnObjects, returnUnits, returnScales, returnSequenceNumbers, returnDataIndices and returnDataLengths with the same index describe one set of values corresponding to a single metric. The returnData parameter is a flattened array of arrays. Each start and length of a sub-array is indicated by returnDataIndices and returnDataLengths. The first value for metric metricNames[i] is at returnData[returnIndices[i]]. @c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metric name array contains a single element and object array contains many, the single metric name array element is applied to each object array element to form metric/object pairs. Data collection continues behind the scenes after call to @c queryMetricsData. The return data can be seen as the snapshot of the current state at the time of @c queryMetricsData call. The internally kept metric values are not cleared by the call. This makes possible querying different subsets of metrics or aggregates with subsequent calls. If periodic querying is needed it is highly suggested to query the values with @c interval*count period to avoid confusion. This way a completely new set of data values will be provided by each query. Metric name filter. Comma-separated list of metrics with wildcard support. Set of objects to query metrics for. Names of metrics returned in @c returnData. Objects associated with metrics returned in @c returnData. Units of measurement for each returned metric. Divisor that should be applied to return values in order to get floating point values. For example: (double)returnData[returnDataIndices[0]+i] / returnScales[0] will retrieve the floating point value of i-th sample of the first metric. Sequence numbers of the first elements of value sequences of particular metrics returned in @c returnData. For aggregate metrics it is the sequence number of the sample the aggregate started calculation from. Indices of the first elements of value sequences of particular metrics returned in @c returnData. Lengths of value sequences of particular metrics. Flattened array of all metric data containing sequences of values for each metric.