VirtualBox SDK Guide
VirtualBox SDK Guide
VirtualBox SDK Guide
R
VM
VirtualBox
R
Version 6.1.2
c 2004-2020 Oracle Corporation
http://www.virtualbox.org
Contents
1 Introduction 24
1.1 Modularity: the building blocks of VirtualBox . . . . . . . . . . . . . . . . . . . 24
1.2 Two guises of the same “Main API”: the web service or COM/XPCOM . . . . . . 25
1.3 About web services in general . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.4 Running the web service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.4.1 Command line options of vboxwebsrv . . . . . . . . . . . . . . . . . . . 27
1.4.2 Authenticating at web service logon . . . . . . . . . . . . . . . . . . . . 28
2 Environment-specific notes 30
2.1 Using the object-oriented web service (OOWS) . . . . . . . . . . . . . . . . . . . 30
2.1.1 The object-oriented web service for JAX-WS . . . . . . . . . . . . . . . . 30
2.1.2 The object-oriented web service for Python . . . . . . . . . . . . . . . . 32
2.1.3 The object-oriented web service for PHP . . . . . . . . . . . . . . . . . 33
2.2 Using the raw web service with any language . . . . . . . . . . . . . . . . . . . 33
2.2.1 Raw web service example for Java with Axis . . . . . . . . . . . . . . . 34
2.2.2 Raw web service example for Perl . . . . . . . . . . . . . . . . . . . . . 35
2.2.3 Programming considerations for the raw web service . . . . . . . . . . 35
2.3 Using COM/XPCOM directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.1 Python COM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.2 Common Python bindings layer . . . . . . . . . . . . . . . . . . . . . . 40
2.3.3 C++ COM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.3.4 Event queue processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3.5 Visual Basic and Visual Basic Script (VBS) on Windows hosts . . . . . . 42
2.3.6 C binding to VirtualBox API . . . . . . . . . . . . . . . . . . . . . . . . 43
5 Classes (interfaces) 55
5.1 IAdditionsFacility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.1.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2 IAdditionsStateChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . 55
5.2.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3 IAppliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.3.2 addPasswords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3.3 createVFSExplorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3.4 createVirtualSystemDescriptions . . . . . . . . . . . . . . . . . . . . . . 58
5.3.5 getMediumIdsForPasswordId . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3.6 getPasswordIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3.7 getWarnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
2
Contents
5.3.8 importMachines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3.9 interpret . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3.10 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3.11 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.4 IAudioAdapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.4.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.4.2 getProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.4.3 setProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.5 IAudioAdapterChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . 61
5.5.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.6 IBIOSSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.6.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.7 IBandwidthControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7.2 createBandwidthGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.7.3 deleteBandwidthGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.7.4 getAllBandwidthGroups . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.7.5 getBandwidthGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.8 IBandwidthGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.8.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.9 IBandwidthGroupChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . 65
5.9.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.10 IBooleanFormValue (IFormValue) . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.10.1 getSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.10.2 setSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.11 ICPUChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.11.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.12 ICPUExecutionCapChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . 66
5.12.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.13 ICanShowWindowEvent (IVetoEvent) . . . . . . . . . . . . . . . . . . . . . . . . 66
5.13.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.14 ICertificate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.14.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.14.2 isCurrentlyExpired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.14.3 queryInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.15 IChoiceFormValue (IFormValue) . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.15.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.15.2 getSelectedIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.15.3 setSelectedIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.16 IClipboardFileTransferModeChangedEvent (IEvent) . . . . . . . . . . . . . . . . 70
5.16.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.17 IClipboardModeChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . 70
5.17.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.18 ICloudClient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.18.1 createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.18.2 deleteImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.18.3 exportImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.18.4 exportVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.18.5 getExportDescriptionForm . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.18.6 getImageInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.18.7 getImportDescriptionForm . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.18.8 getInstanceInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.18.9 getLaunchDescriptionForm . . . . . . . . . . . . . . . . . . . . . . . . . 72
3
Contents
5.18.10 importImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.18.11 importInstance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.18.12 launchVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.18.13 listImages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.18.14 listInstances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.18.15 pauseInstance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.18.16 startCloudNetworkGateway . . . . . . . . . . . . . . . . . . . . . . . . 73
5.18.17 startInstance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.18.18 terminateInstance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.19 ICloudNetwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.19.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.20 ICloudNetworkGatewayInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.20.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.21 ICloudProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.21.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.21.2 createCloudClient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.21.3 getProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.21.4 getProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.21.5 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.21.6 setProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.21.7 setProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.22 ICloudProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.22.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.22.2 createProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.22.3 getProfileByName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.22.4 getPropertyDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.22.5 importProfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.22.6 prepareUninstall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.22.7 restoreProfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.22.8 saveProfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.23 ICloudProviderManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.23.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.23.2 getProviderById . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.23.3 getProviderByName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.23.4 getProviderByShortName . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.24 IConsole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.24.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.24.2 addDiskEncryptionPassword . . . . . . . . . . . . . . . . . . . . . . . . 81
5.24.3 addDiskEncryptionPasswords . . . . . . . . . . . . . . . . . . . . . . . . 82
5.24.4 attachUSBDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.24.5 clearAllDiskEncryptionPasswords . . . . . . . . . . . . . . . . . . . . . 82
5.24.6 createSharedFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.24.7 detachUSBDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.24.8 findUSBDeviceByAddress . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.24.9 findUSBDeviceById . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.24.10 getDeviceActivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.24.11 getGuestEnteredACPIMode . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.24.12 getPowerButtonHandled . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.24.13 pause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.24.14 powerButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.24.15 powerDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.24.16 powerUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.24.17 powerUpPaused . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4
Contents
5.24.18 removeDiskEncryptionPassword . . . . . . . . . . . . . . . . . . . . . . 86
5.24.19 removeSharedFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.24.20 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.24.21 resume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.24.22 sleepButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.24.23 teleport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.25 ICursorPositionChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . 87
5.25.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.26 IDHCPConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
5.26.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
5.26.2 getAllOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.26.3 getOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.26.4 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.26.5 removeAllOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.26.6 removeOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.26.7 setOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.27 IDHCPGlobalConfig (IDHCPConfig) . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.28 IDHCPGroupCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.28.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.28.2 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.29 IDHCPGroupConfig (IDHCPConfig) . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.29.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.29.2 addCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.29.3 removeAllConditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.30 IDHCPIndividualConfig (IDHCPConfig) . . . . . . . . . . . . . . . . . . . . . . . 91
5.30.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.31 IDHCPServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.31.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.31.2 findLeaseByMAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.31.3 getConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.31.4 restart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.31.5 setConfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.31.6 start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.31.7 stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.32 IDataStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.32.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.32.2 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.33 IDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.33.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.33.2 close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.33.3 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.34 IDisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.34.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.34.2 attachFramebuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.34.3 completeVHWACommand . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.34.4 createGuestScreenInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.34.5 detachFramebuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.34.6 detachScreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.34.7 drawToScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.34.8 getScreenResolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.34.9 getVideoModeHint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.34.10 invalidateAndUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.34.11 invalidateAndUpdateScreen . . . . . . . . . . . . . . . . . . . . . . . . 99
5
Contents
5.34.12 notifyHiDPIOutputPolicyChange . . . . . . . . . . . . . . . . . . . . . . 99
5.34.13 notifyScaleFactorChange . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.34.14 queryFramebuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.34.15 querySourceBitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.34.16 setScreenLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.34.17 setSeamlessMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.34.18 setVideoModeHint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.34.19 takeScreenShot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.34.20 takeScreenShotToArray . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.34.21 viewportChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.35 IDisplaySourceBitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.35.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.35.2 queryBitmapInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.36 IDnDBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.36.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.36.2 addFormats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.36.3 isFormatSupported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.36.4 removeFormats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.37 IDnDModeChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.37.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.38 IDnDSource (IDnDBase) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.38.1 dragIsPending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.38.2 drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.38.3 receiveData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.39 IDnDTarget (IDnDBase) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.39.1 cancel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.39.2 drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.39.3 enter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.39.4 leave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.39.5 move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.39.6 sendData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.40 IEmulatedUSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.40.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.40.2 webcamAttach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.40.3 webcamDetach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.41 IEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.41.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.41.2 setProcessed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.41.3 waitProcessed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.42 IEventListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.42.1 handleEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.43 IEventSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.43.1 createAggregator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.43.2 createListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.43.3 eventProcessed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.43.4 fireEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.43.5 getEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.43.6 registerListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.43.7 unregisterListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.44 IEventSourceChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . 112
5.44.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.45 IExtPack (IExtPackBase) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.45.1 queryObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6
Contents
7
Contents
8
Contents
9
Contents
10
Contents
11
Contents
5.104.24onUSBDeviceAttach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
5.104.25onUSBDeviceDetach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
5.104.26onVMProcessPriorityChange . . . . . . . . . . . . . . . . . . . . . . . . 196
5.104.27onVRDEServerChange . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
5.104.28onlineMergeMedium . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.104.29pauseWithReason . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.104.30reconfigureMediumAttachments . . . . . . . . . . . . . . . . . . . . . . 197
5.104.31resumeWithReason . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.104.32saveStateWithReason . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.104.33uninitialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.104.34updateMachineState . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.105 IKeyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.105.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.105.2 putCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.105.3 putScancode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.105.4 putScancodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.105.5 putUsageCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.105.6 releaseKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.106 IKeyboardLedsChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . 200
5.106.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.107 IMachine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
5.107.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
5.107.2 addStorageController . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.107.3 addUSBController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.107.4 adoptSavedState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.107.5 applyDefaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.107.6 attachDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.107.7 attachDeviceWithoutMedium . . . . . . . . . . . . . . . . . . . . . . . . 215
5.107.8 attachHostPCIDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.107.9 canShowConsoleWindow . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.107.10cloneTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.107.11createSharedFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
5.107.12deleteConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
5.107.13deleteGuestProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
5.107.14deleteSnapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
5.107.15deleteSnapshotAndAllChildren . . . . . . . . . . . . . . . . . . . . . . . 220
5.107.16deleteSnapshotRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
5.107.17detachDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
5.107.18detachHostPCIDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.107.19discardSavedState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.107.20discardSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.107.21enumerateGuestProperties . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.107.22exportTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.107.23findSnapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.107.24getBootOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.107.25getCPUIDLeaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.107.26getCPUIDLeafByOrdinal . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.107.27getCPUProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
5.107.28getCPUStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
5.107.29getEffectiveParavirtProvider . . . . . . . . . . . . . . . . . . . . . . . . 225
5.107.30getExtraData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
5.107.31getExtraDataKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
5.107.32getGuestProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
12
Contents
5.107.33getGuestPropertyTimestamp . . . . . . . . . . . . . . . . . . . . . . . . 226
5.107.34getGuestPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
5.107.35getHWVirtExProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.107.36getMedium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.107.37getMediumAttachment . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.107.38getMediumAttachmentsOfController . . . . . . . . . . . . . . . . . . . . 228
5.107.39getNetworkAdapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.107.40getParallelPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.107.41getSerialPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.107.42getStorageControllerByInstance . . . . . . . . . . . . . . . . . . . . . . 229
5.107.43getStorageControllerByName . . . . . . . . . . . . . . . . . . . . . . . . 229
5.107.44getUSBControllerByName . . . . . . . . . . . . . . . . . . . . . . . . . 229
5.107.45getUSBControllerCountByType . . . . . . . . . . . . . . . . . . . . . . . 229
5.107.46hotPlugCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
5.107.47hotUnplugCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
5.107.48launchVMProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
5.107.49lockMachine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.107.50mountMedium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.107.51moveTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
5.107.52nonRotationalDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
5.107.53passthroughDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
5.107.54queryLogFilename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
5.107.55querySavedGuestScreenInfo . . . . . . . . . . . . . . . . . . . . . . . . 234
5.107.56querySavedScreenshotInfo . . . . . . . . . . . . . . . . . . . . . . . . . 235
5.107.57readLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
5.107.58readSavedScreenshotToArray . . . . . . . . . . . . . . . . . . . . . . . . 235
5.107.59readSavedThumbnailToArray . . . . . . . . . . . . . . . . . . . . . . . . 236
5.107.60removeAllCPUIDLeaves . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.107.61removeCPUIDLeaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.107.62removeSharedFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.107.63removeStorageController . . . . . . . . . . . . . . . . . . . . . . . . . . 237
5.107.64removeUSBController . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
5.107.65restoreSnapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
5.107.66saveSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
5.107.67saveState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
5.107.68setAutoDiscardForDevice . . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.107.69setBandwidthGroupForDevice . . . . . . . . . . . . . . . . . . . . . . . 239
5.107.70setBootOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
5.107.71setCPUIDLeaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
5.107.72setCPUProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
5.107.73setExtraData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
5.107.74setGuestProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
5.107.75setGuestPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
5.107.76setHWVirtExProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
5.107.77setHotPluggableForDevice . . . . . . . . . . . . . . . . . . . . . . . . . 243
5.107.78setNoBandwidthGroupForDevice . . . . . . . . . . . . . . . . . . . . . . 243
5.107.79setSettingsFilePath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
5.107.80setStorageControllerBootable . . . . . . . . . . . . . . . . . . . . . . . 244
5.107.81showConsoleWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
5.107.82takeSnapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
5.107.83temporaryEjectDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
5.107.84unmountMedium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
5.107.85unregister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
13
Contents
14
Contents
5.114.16lockWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
5.114.17mergeTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
5.114.18moveTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
5.114.19openForIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
5.114.20refreshState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
5.114.21reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.114.22resize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.114.23setIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.114.24setProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.114.25setProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.115 IMediumAttachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.115.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
5.116 IMediumChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
5.116.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
5.117 IMediumConfigChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . 279
5.117.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
5.118 IMediumFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
5.118.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
5.118.2 describeFileExtensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
5.118.3 describeProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
5.119 IMediumIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
5.119.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
5.119.2 close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
5.119.3 convertToStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
5.119.4 formatFAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.119.5 initializePartitionTable . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.119.6 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.119.7 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.120 IMediumRegisteredEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . . . . . 283
5.120.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
5.121 IMouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
5.121.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
5.121.2 putEventMultiTouch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
5.121.3 putEventMultiTouchString . . . . . . . . . . . . . . . . . . . . . . . . . 285
5.121.4 putMouseEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
5.121.5 putMouseEventAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . 286
5.122 IMouseCapabilityChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . . . 286
5.122.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
5.123 IMousePointerShape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
5.123.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
5.124 IMousePointerShapeChangedEvent (IEvent) . . . . . . . . . . . . . . . . . . . . 288
5.124.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
5.125 INATEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
5.125.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
5.125.2 addRedirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
5.125.3 getNetworkSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
5.125.4 removeRedirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.125.5 setNetworkSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.126 INATNetwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.126.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.126.2 addLocalMapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
5.126.3 addPortForwardRule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
5.126.4 removePortForwardRule . . . . . . . . . . . . . . . . . . . . . . . . . . 294
15
Contents
16
Contents
17
Contents
18
Contents
19
Contents
5.190.23registerMachine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
5.190.24removeCloudNetwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
5.190.25removeDHCPServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
5.190.26removeNATNetwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
5.190.27removeSharedFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
5.190.28setExtraData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
5.190.29setSettingsSecret . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
5.191 IVirtualBoxClient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
5.191.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
5.191.2 checkMachineError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
5.192 IVirtualBoxErrorInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
5.192.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
5.193 IVirtualBoxSDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
5.193.1 deregisterVBoxSVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
5.193.2 launchVMProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
5.193.3 registerVBoxSVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
5.194 IVirtualSystemDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
5.194.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
5.194.2 addDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
5.194.3 getDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
5.194.4 getDescriptionByType . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
5.194.5 getValuesByType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
5.194.6 removeDescriptionByType . . . . . . . . . . . . . . . . . . . . . . . . . 386
5.194.7 setFinalValues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
5.195 IVirtualSystemDescriptionForm (IForm) . . . . . . . . . . . . . . . . . . . . . . . 387
5.195.1 getVirtualSystemDescription . . . . . . . . . . . . . . . . . . . . . . . . 387
5.196 IWebsessionManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
5.196.1 getSessionObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
5.196.2 logoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
5.196.3 logon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
20
Contents
21
Contents
22
Contents
23
1 Introduction
VirtualBox comes with comprehensive support for third-party developers. This Software Devel-
opment Kit (SDK) contains all the documentation and interface files that are needed to write
code that interacts with VirtualBox.
The orange area represents code that runs in kernel mode, the blue area represents userspace
code.
At the bottom of the stack resides the hypervisor – the core of the virtualization engine, con-
trolling execution of the virtual machines and making sure they do not conflict with each other
or whatever the host computer is doing otherwise.
On top of the hypervisor, additional internal modules provide extra functionality. For example,
the RDP server, which can deliver the graphical output of a VM remotely to an RDP client, is a
separate module that is only loosely tacked into the virtual graphics device. Live Migration and
Resource Monitor are additional modules currently in the process of being added to VirtualBox.
What is primarily of interest for purposes of the SDK is the API layer block that sits on top of
all the previously mentioned blocks. This API, which we call the “Main API”, exposes the entire
feature set of the virtualization engine below. It is completely documented in this SDK Reference
– see chapter 5, Classes (interfaces), page 55 and chapter 6, Enumerations (enums), page 388
– and available to anyone who wishes to control VirtualBox programmatically. We chose the
name “Main API” to differentiate it from other programming interfaces of VirtualBox that may
be publicly accessible.
With the Main API, you can create, configure, start, stop and delete virtual machines, retrieve
performance statistics about running VMs, configure the VirtualBox installation in general, and
24
1 Introduction
more. In fact, internally, the front-end programs VirtualBox and VBoxManage use nothing but
this API as well – there are no hidden backdoors into the virtualization engine for our own front-
ends. This ensures the entire Main API is both well-documented and well-tested. (The same
applies to VBoxHeadless, which is not shown in the image.)
1.2 Two guises of the same “Main API”: the web service or
COM/XPCOM
There are several ways in which the Main API can be called by other code:
1. VirtualBox comes with a web service that maps nearly the entire Main API. The web ser-
vice ships in a stand-alone executable (vboxwebsrv) that, when running, acts as an HTTP
server, accepts SOAP connections and processes them.
Since the entire web service API is publicly described in a web service description file (in
WSDL format), you can write client programs that call the web service in any language with
a toolkit that understands WSDL. These days, that includes most programming languages
that are available: Java, C++, .NET, PHP, Python, Perl and probably many more.
All of this is explained in detail in subsequent chapters of this book.
There are two ways in which you can write client code that uses the web service:
a) For Java as well as Python, the SDK contains easy-to-use classes that allow you to use
the web service in an object-oriented, straightforward manner. We shall refer to this
as the “object-oriented web service (OOWS)“.
The OO bindings for Java are described in chapter 12, Using Java API, page 449, those
for Python in chapter 2.1.2, The object-oriented web service for Python, page 32.
b) Alternatively, you can use the web service directly, without the object-oriented client
layer. We shall refer to this as the “raw web service”.
You will then have neither native object orientation nor full type safety, since web
services are neither object-oriented nor stateful. However, in this way, you can write
client code even in languages for which we do not ship object-oriented client code; all
you need is a programming language with a toolkit that can parse WSDL and generate
client wrapper code from it.
We describe this further in chapter 2.2, Using the raw web service with any language,
page 33, with samples for Java and Perl.
2. Internally, for portability and easier maintenance, the Main API is implemented using the
Component Object Model (COM), an interprocess mechanism for software components
originally introduced by Microsoft for Microsoft Windows. On a Windows host, VirtualBox
will use Microsoft COM; on other hosts where COM is not present, it ships with XPCOM,
a free software implementation of COM originally created by the Mozilla project for their
browsers.
So, if you are familiar with COM and the C++ programming language (or with any other
programming language that can handle COM/XPCOM objects, such as Java, Visual Basic or
C#), then you can use the COM/XPCOM API directly. VirtualBox comes with all necessary
files and documentation to build fully functional COM applications. For an introduction,
please see chapter 2.3, Using COM/XPCOM directly, page 39 below.
The VirtualBox front-ends (the graphical user interfaces as well as the command line),
which are all written in C++, use COM/XPCOM to call the Main API. Technically, the web
service is another front-end to this COM API, mapping almost all of it to SOAP clients.
25
1 Introduction
In the following chapters, we will describe the different ways in which to program VirtualBox,
starting with the method that is easiest to use and then increase complexity as we go along.
1. The VirtualBox web service (the “server”): this is the vboxwebsrv executable shipped with
VirtualBox. Once you start this executable (which acts as a HTTP server on a specific
TCP/IP port), clients can connect to the web service and thus control a VirtualBox installa-
tion.
2. VirtualBox also comes with WSDL files that describe the services provided by the web ser-
vice. You can find these files in the sdk/bindings/webservice/ directory. These files are
understood by the web service toolkits that are shipped with most programming languages
and enable you to easily access a web service even if you don’t use our object-oriented
client layers. VirtualBox is shipped with pregenerated web service glue code for several
languages (Python, Perl, Java).
3. A client that connects to the web service in order to control the VirtualBox installation.
Unless you play with some of the samples shipped with VirtualBox, this needs to be written
by you.
1 Insome ways, web services promise to deliver the same thing as CORBA and DCOM did years ago. However, while
these previous technologies relied on specific binary protocols and thus proved to be difficult to use between diverging
platforms, web services circumvent these incompatibilities by using text-only standards like HTTP and XML. On the
downside (and, one could say, typical of things related to XML), a lot of standards are involved before a web service
can be implemented. Many of the standards invented around XML are used one way or another. As a result, web
services are slow and verbose, and the details can be incredibly messy. The relevant standards here are called SOAP
and WSDL, where SOAP describes the format of the messages that are exchanged (an XML document wrapped in
an HTTP header), and WSDL is an XML format that describes a complete API provided by a web service. WSDL in
turn uses XML Schema to describe types, which is not exactly terse either. However, as you will see from the samples
provided in this chapter, the VirtualBox web service shields you from these details and is easy to use.
26
1 Introduction
Note: The web service executable is not contained with the VirtualBox SDK, but instead
ships with the standard VirtualBox binary package for your specific platform. Since the
SDK contains only platform-independent text files and documentation, the binaries are
instead shipped with the platform-specific packages. For this reason the information
how to run it as a service is included in the VirtualBox documentation.
The vboxwebsrv program, which implements the web service, is a text-mode (console) pro-
gram which, after being started, simply runs until it is interrupted with Ctrl-C or a kill command.
Once the web service is started, it acts as a front-end to the VirtualBox installation of
the user account that it is running under. In other words, if the web service is run under
the user account of user1, it will see and manipulate the virtual machines and other data
represented by the VirtualBox data of that user (for example, on a Linux machine, under
/home/user1/.config/VirtualBox; see the VirtualBox User Manual for details on where this
data is stored).
27
1 Introduction
• --timeout (or -t): This specifies the session timeout, in seconds, and defaults to 300 (five
minutes). A web service client that has logged on but makes no calls to the web service
will automatically be disconnected after the number of seconds specified here, as if it had
called the IWebSessionManager::logoff() method provided by the web service itself.
It is normally vital that each web service client call this method, as the web service can
accumulate large amounts of memory when running, especially if a web service client does
not properly release managed object references. As a result, this timeout value should not
be set too high, especially on machines with a high load on the web service, or the web
service may eventually deny service.
• --check-interval (or -i): This specifies the interval in which the web service checks
for timed-out clients, in seconds, and defaults to 5. This normally does not need to be
changed.
• --threads (or -T): This specifies the maximum number or worker threads, and defaults
to 100. This normally does not need to be changed.
• --keepalive (or -k): This specifies the maximum number of requests which can be sent
in one web service connection, and defaults to 100. This normally does not need to be
changed.
• --authentication (or -A): This specifies the desired web service authentication method.
If the parameter is not specified or the empty string is specified it does not change the
authentication method, otherwise it is set to the specified value. Using this parameter is a
good measure against accidental misconfiguration, as the web service ensures periodically
that it isn’t changed.
• --verbose (or -v): Normally, the web service outputs only brief messages to the console
each time a request is served. With this option, the web service prints much more de-
tailed data about every request and the COM methods that those requests are mapped to
internally, which can be useful for debugging client programs.
• --pidfile (or -P): Name of the PID file which is created when the daemon was started.
• --logfile (or -F) <file>: If this is specified, the web service not only prints its output
to the console, but also writes it to the specified file. The file is created if it does not exist;
if it does exist, new output is appended to it. This is useful if you run the web service
unattended and need to debug problems after they have occurred.
• --logrotate (or -R): Number of old log files to keep, defaults to 10. Log rotation is
disabled if set to 0.
• --logsize (or -S): Maximum size of log file in bytes, defaults to 100MB. Log rotation is
triggered if the file grows beyond this limit.
• --loginterval (or -I): Maximum time interval to be put in a log file before rotation is
triggered, in seconds, and defaults to one day.
28
1 Introduction
For testing purposes, it is recommended that you first disable authentication with this com-
mand:
VBoxManage setproperty websrvauthlibrary null
Warning: This will cause all logons to succeed, regardless of user name or password.
This should of course not be used in a production environment.
Generally, the mechanism by which clients are authenticated is configurable by way of the
VBoxManage command:
This way you can specify any shared object/dynamic link module that conforms with the
specifications for VirtualBox external authentication modules as laid out in section VRDE au-
thentication of the VirtualBox User Manual; the web service uses the same kind of modules as
the VirtualBox VRDE server. For technical details on VirtualBox external authentication modules
see chapter 11, VirtualBox external authentication modules, page 447
By default, after installation, the web service uses the VBoxAuth module that ships with
VirtualBox. This module uses PAM on Linux hosts to authenticate users. Any valid user-
name/password combination is accepted, it does not have to be the username and password
of the user running the web service daemon. Unless vboxwebsrv runs as root, PAM authenti-
cation can fail, because sometimes the file /etc/shadow, which is used by PAM, is not read-
able. On most Linux distribution PAM uses a suid root helper internally, so make sure you test
this before deploying it. One can override this behavior by setting the environment variable
VBOX_PAM_ALLOW_INACTIVE which will suppress failures when unable to read the shadow pass-
word file. Please use this variable carefully, and only if you fully understand what you’re doing.
29
2 Environment-specific notes
The Main API described in chapter 5, Classes (interfaces), page 55 and chapter 6, Enumerations
(enums), page 388 is mostly identical in all the supported programming environments which
have been briefly mentioned in the introduction of this book. As a result, the Main API’s general
concepts described in chapter 3, Basic VirtualBox concepts; some examples, page 50 are the same
whether you use the object-oriented web service (OOWS) for JAX-WS or a raw web service
connection via, say, Perl, or whether you use C++ COM bindings.
Some things are different depending on your environment, however. These differences are
explained in this chapter.
2.1.1.1 Preparations
Since JAX-WS is already integrated into Java 6, no additional preparations are needed for Java
6.
If you are using Java 5 (JDK 1.5.x), you will first need to download and install an external JAX-
WS implementation, as Java 5 does not support JAX-WS out of the box; for example, you can
30
2 Environment-specific notes
1. Open a terminal and change to the directory where the JAX-WS samples reside.1 Examine
the header of Makefile to see if the supplied variables (Java compiler, Java executable)
and a few other details match your system settings.
2. To start the VirtualBox web service, open a second terminal and change to the directory
where the VirtualBox executables are located. Then type:
./vboxwebsrv -v
The web service now waits for connections and will run until you press Ctrl+C in this
second terminal. The -v argument causes it to log all connections to the terminal. (See
chapter 1.4, Running the web service, page 27 for details on how to run the web service.)
3. Back in the first terminal and still in the samples directory, to start a simple client example
just type:
make run16
The clienttest sample imitates a few typical command line tasks that VBoxManage,
VirtualBox’s regular command-line front-end, would provide (see the VirtualBox User Manual
for details). In particular, you can run:
• java clienttest show vms: show the virtual machines that are registered locally.
• java clienttest list hostinfo: show various information about the host this
VirtualBox installation runs on.
• java clienttest startvm <vmname|uuid>: start the given virtual machine.
The clienttest.java sample code illustrates common basic practices how to use the
VirtualBox OOWS for JAX-WS, which we will explain in more detail in the following chapters.
1 In sdk/bindings/glue/java/.
31
2 Environment-specific notes
32
2 Environment-specific notes
install/vboxapi/__init__.py which contains the glue layer for all target platforms (i.e. XP-
COM, MSCOM and web services).
To start the shell, perform the following commands:
/opt/VirtualBox/vboxwebsrv -t 0
# start web service with object autocollection disabled
export VBOX_PROGRAM_PATH=/opt/VirtualBox
# your VirtualBox installation directory
export VBOX_SDK_PATH=/home/youruser/vbox-sdk
# where you’ve extracted the SDK
./vboxshell.py -w
See chapter 4, The VirtualBox shell, page 53 for more details on the shell’s functionality. For
you, as a VirtualBox application developer, the vboxshell sample could be interesting as an exam-
ple of how to write code targeting both local and remote cases (COM/XPCOM and SOAP). The
common part of the shell is the same – the only difference is how it interacts with the invocation
layer. You can use the connect shell command to connect to remote VirtualBox servers; in this
case you can skip starting the local web server.
1. Any COM method call becomes a plain function call in the raw web service, with the
object as an additional first parameter (before the “real” parameters listed in the docu-
mentation). So when the documentation says that the IVirtualBox interface supports
the createMachine() method (see IVirtualBox::createMachine()), the web service op-
eration is IVirtualBox_createMachine(...), and a managed object reference to an
IVirtualBox object must be passed as the first argument.
2. For attributes in interfaces, there will be at least one “get” function; there will also be a
“set” function, unless the attribute is “readonly”. The attribute name will be appended to
the “get” or “set” prefix, with a capitalized first letter. So, the “version” readonly attribute of
the IVirtualBox interface can be retrieved by calling IVirtualBox_getVersion(vbox),
with vbox being the VirtualBox object.
3. Whenever the API documentation says that a method (or an attribute getter) returns an
object, it will returned a managed object reference in the web service instead. As said
above, managed object references should be released if the web service client does not log
off again immediately!
4 See https://www.php.net/soap.
33
2 Environment-specific notes
Use the directory where the Axis JAR files are located. Mind the quotes so that your shell
passes the “*“ character to the java executable without expanding. Alternatively, add a
corresponding -classpath argument to the “java” call above.
If the command executes successfully, you should see an “org” directory with subdirecto-
ries containing Java source files in your working directory. These classes represent the
interfaces that the VirtualBox web service offers, as described by the WSDL file.
This is the bit that makes using web services so attractive to client developers: if a lan-
guage’s toolkit understands WSDL, it can generate large amounts of support code auto-
matically. Clients can then easily use this support code and can be done with just a few
lines of code.
3. Next, compile the clienttest.java source:
javac clienttest.java
The web service now waits for connections and will run until you press Ctrl+C in this
second terminal. The -v argument causes it to log all connections to the terminal. (See
chapter 1.4, Running the web service, page 27 for details on how to run the web service.)
5. Back in the original terminal where you compiled the Java source, run the resulting binary,
which will then connect to the web service:
java clienttest
The client sample will connect to the web service (on localhost, but the code could be
changed to connect remotely if the web service was running on a different machine) and
make a number of method calls. It will output the version number of your VirtualBox
installation and a list of all virtual machines that are currently registered (with a bit of
seemingly random data, which will be explained later).
34
2 Environment-specific notes
1. If SOAP::Lite is not yet installed on your system, you will need to install the package
first. On Debian-based systems, the package is called libsoap-lite-perl; on Gentoo, it’s
dev-perl/SOAP-Lite.
./vboxwebsrv -v
The web service now waits for connections and will run until you press Ctrl+C in this
second terminal. The -v argument causes it to log all connections to the terminal. (See
chapter 1.4, Running the web service, page 27 for details on how to run the web service.)
4. In the first terminal with the Perl sample, run the clienttest.pl script:
• Web services, as expressed by WSDL, are not object-oriented. Even worse, they are nor-
mally stateless (or, in web services terminology, “loosely coupled”). Web service operations
are entirely procedural, and one cannot normally make assumptions about the state of a
web service between function calls.
In particular, this normally means that you cannot work on objects in one method call that
were created by another call.
• By contrast, the VirtualBox Main API, being expressed in COM, is object-oriented and works
entirely on objects, which are grouped into public interfaces, which in turn have attributes
and methods associated with them.
For the VirtualBox web service, this results in three fundamental conventions:
35
2 Environment-specific notes
1. All function names in the VirtualBox web service consist of an interface name and a
method name, joined together by an underscore. This is because there are only functions
(“operations”) in WSDL, but no classes, interfaces, or methods.
In addition, all calls to the VirtualBox web service (except for logon, see below) take a
managed object reference as the first argument, representing the object upon which the
underlying method is invoked. (Managed object references are explained in detail below;
see chapter 2.2.3.3, Managed object references, page 37.)
So, when one would normally code, in the pseudo-code of an object-oriented language, to
invoke a method upon an object:
IMachine machine;
result = machine.getName();
In the VirtualBox web service, this looks something like this (again, pseudo-code):
IMachineRef machine;
result = IMachine_getName(machine);
2. To make the web service stateful, and objects persistent between method calls, the
VirtualBox web service introduces a session manager (by way of the IWebsessionManager
interface), which manages object references. Any client wishing to interact with the web
service must first log on to the session manager and in turn receives a managed object ref-
erence to an object that supports the IVirtualBox interface (the basic interface in the Main
API).
In other words, as opposed to other web services, the VirtualBox web service is both object-
oriented and stateful.
string oVirtualBox;
oVirtualBox = webservice.IWebsessionManager_logon("user", "pass");
(The managed object reference “oVirtualBox” is just a string consisting of digits and dashes.
However, it is a string with a meaning and will be checked by the web service. For details,
see below. As hinted above, IWebsessionManager::logon() is the only operation provided
by the web service which does not take a managed object reference as the first argument!)
36
2 Environment-specific notes
3. The VirtualBox Main API documentation says that the IVirtualBox interface has a version
attribute, which is a string. For each attribute, there is a “get” and a “set” method in
COM, which maps to according operations in the web service. So, to retrieve the “version”
attribute of this IVirtualBox object, the web service client does this:
string version;
version = webservice.IVirtualBox_getVersion(oVirtualBox);
print version;
Internally, in the web service process, each managed object reference is simply a small data
structure, containing a COM pointer to the “real” COM object, the web session ID and the object
ID. This structure is allocated on creation and stored efficiently in hashes, so that the web service
can look up the COM object quickly whenever a web service client wishes to make a method call.
The random session ID also ensures that one web service client cannot intercept the objects of
another.
Managed object references are not destroyed automatically and must be released by explicitly
calling IManagedObjectRef::release(). This is important, as otherwise hundreds or thousands of
managed object references (and corresponding COM objects, which can consume much more
memory!) can pile up in the web service process and eventually cause it to deny service.
To reiterate: The underlying COM object, which the reference points to, is only freed if the
managed object reference is released. It is therefore vital that web service clients properly clean
up after the managed object references that are returned to them.
When a web service client calls IWebsessionManager::logoff(), all managed object references
created during the session are automatically freed. For short-lived sessions that do not create a
lot of objects, logging off may therefore be sufficient, although it is certainly not “best practice”.
37
2 Environment-specific notes
A similar message – the “response” message – would be sent back from the web service to the
client, containing the return value “Hello Peter”.
Most programming languages provide automatic support to generate such messages whenever
code in that programming language makes such a request. In other words, these programming
languages allow for writing something like this (in pseudo-C++ code):
webServiceClass service("localhost", 18083); // server and port
string result = service.SayHello("Peter"); // invoke remote procedure
and would, for these two pseudo-lines, automatically perform these steps:
3. connect to the web service via HTTP and send that message;
4. wait for the web service to send a response message;
5. decode that response message and put the return value of the remote procedure into the
“result” variable.
Service descriptions in WSDL In the above explanations about SOAP, it was left open how
the programming language learns about how to translate function calls in its own syntax into
proper SOAP messages. In other words, the programming language needs to know what opera-
tions the web service supports and what types of arguments are required for the operation’s data
in order to be able to properly serialize and deserialize the data to and from the web service.
For example, if a web service operation expects a number in “double” floating point format for a
particular parameter, the programming language cannot send to it a string instead.
For this, the Web Service Definition Language (WSDL) was invented, another XML substandard
that describes exactly what operations the web service supports and, for each operation, which
parameters and types are needed with each request and response message. WSDL descriptions
38
2 Environment-specific notes
can be incredibly verbose, and one of the few good things that can be said about this standard is
that it is indeed supported by most programming languages.
So, if it is said that a programming language “supports” web services, this typically means
that a programming language has support for parsing WSDL files and somehow integrating the
remote procedure calls into the native language syntax – for example, like in the Java sample
shown in chapter 2.2.1, Raw web service example for Java with Axis, page 34.
For details about how programming languages support web services, please refer to the docu-
mentation that comes with the individual languages. Here are a few pointers:
1. For C++, among many others, the gSOAP toolkit is a good option. Parts of gSOAP are
also used in VirtualBox to implement the VirtualBox web service.
2. For Java, there are several implementations already described in this document (see chap-
ter 2.1.1, The object-oriented web service for JAX-WS, page 30 and chapter 2.2.1, Raw web
service example for Java with Axis, page 34).
3. Perl supports WSDL via the SOAP::Lite package. This in turn comes with a tool called
stubmaker.pl that allows you to turn any WSDL file into a Perl package that you can
import. (You can also import any WSDL file “live” by having it parsed every time the script
runs, but that can take a while.) You can then code (again, assuming the above example):
my $result = servicename->sayHello("Peter");
A sample that uses SOAP::Lite was described in chapter 2.2.2, Raw web service example for
Perl, page 35.
39
2 Environment-specific notes
vbox = win32com.client.Dispatch("VirtualBox.VirtualBox")
session = win32com.client.Dispatch("VirtualBox.Session")
mach = vbox.findMachine("uuid or name of machine to start")
progress = mach.launchVMProcess(session, "gui", "")
progress.waitForCompletion(-1)
We supply the VirtualBoxManager constructor with 2 arguments: style and parameters. Style
defines which bindings style to use (could be “MSCOM”, “XPCOM” or “WEBSERVICE”), and if set
to None defaults to usable platform bindings (MS COM on Windows, XPCOM on other platforms).
The second argument defines parameters, passed to the platform-specific module, as we do in
the second example, where we pass username and password to be used to authenticate against
the web service.
After obtaining the VirtualBoxManager instance, one can perform operations on the IVirtu-
alBox class. For example, the following code will a start virtual machine by name or ID:
from vboxapi import VirtualBoxManager
mgr = VirtualBoxManager(None, None)
vbox = mgr.getVirtualBox()
name = "Linux"
mach = vbox.findMachine(name)
session = mgr.getSessionObject(vbox)
progress = mach.launchVMProcess(session, "gui", "")
progress.waitForCompletion(-1)
mgr.closeMachineSession(session)
Following code will print all registered machines and their log folders
40
2 Environment-specific notes
Code above demonstrates cross-platform access to array properties (certain limitations prevent
one from using vbox.machines to access a list of available virtual machines in case of XPCOM),
and a mechanism of uniform session creation and closing (mgr.getSessionObject()).
In case you want to use the glue layer with a different Python installation, use these steps in a
shell to add the necessary files:
# cd VBOX_INSTALL_PATH/sdk/installer
# PYTHON vboxapisetup.py install
1. Attribute getters and setters. COM has the notion of “attributes” in interfaces, which
roughly compare to C++ member variables in classes. The difference is that for each
attribute declared in an interface, COM automatically provides a “get” method to return
the attribute’s value. Unless the attribute has been marked as “readonly”, a “set” attribute
is also provided.
To illustrate, the IVirtualBox interface has a “version” attribute, which is read-only and of
the “wstring” type (the standard string type in COM). As a result, you can call the “get”
method for this attribute to retrieve the version number of VirtualBox.
Unfortunately, the implementation differs between COM and XPCOM. Microsoft COM
names the “get” method like this: get_Attribute(), whereas XPCOM uses this syn-
tax: GetAttribute() (and accordingly for “set” methods). To hide these differences, the
VirtualBox glue code provides the COMGETTER(attrib) and COMSETTER(attrib) macros.
So, COMGETTER(version)() (note, two pairs of brackets) expands to get_Version() on
Windows and GetVersion() on other platforms.
2. Unicode conversions. While the rest of the modern world has pretty much settled on
encoding strings in UTF-8, COM, unfortunately, uses UCS-16 encoding. This requires a lot
of conversions, in particular between the VirtualBox Main API and the Qt GUI, which, like
the rest of Qt, likes to use UTF-8.
41
2 Environment-specific notes
can be used for both blocking and non-blocking operations. For the Python bindings, a com-
mon layer provides the method
VirtualBoxManager.waitForEvents(ms)
2.3.5 Visual Basic and Visual Basic Script (VBS) on Windows hosts
On Windows hosts, one can control some of the VirtualBox Main API functionality from VBS
scripts, and pretty much everything from Visual Basic programs.5
VBS is scripting language available in any recent Windows environment. As an example, the
following VBS code will print VirtualBox version:
set vb = CreateObject("VirtualBox.VirtualBox")
Wscript.Echo "VirtualBox version " & vb.version
Dim vb As VirtualBox.IVirtualBox
vb = CreateObject("VirtualBox.VirtualBox")
machines = ""
For Each m In vb.Machines
5 The difference results from the way VBS treats COM safearrays, which are used to keep lists in the Main API. VBS
expects every array element to be a VARIANT, which is too strict a limitation for any high performance API. We may
lift this restriction for interface APIs in a future version, or alternatively provide conversion APIs.
42
2 Environment-specific notes
43
2 Environment-specific notes
/*
* VBoxCGlueInit() loads the necessary dynamic library, handles errors
* (producing an error message hinting what went wrong) and gives you
* the pointer to the function table (g_pVBoxFuncs).
*
* Once you get the function table, then how and which functions
* to use is explained below.
*
* g_pVBoxFuncs->pfnClientInitialize does all the necessary startup
* action and provides us with pointers to an IVirtualBoxClient instance.
* It should be matched by a call to g_pVBoxFuncs->pfnClientUninitialize()
* when done.
*/
if (VBoxCGlueInit())
{
fprintf(stderr, "s: FATAL: VBoxCGlueInit failed: %s\n",
argv[0], g_szVBoxErrMsg);
return EXIT_FAILURE;
}
g_pVBoxFuncs->pfnClientInitialize(NULL, &vboxclient);
if (!vboxclient)
{
fprintf(stderr, "%s: FATAL: could not get VirtualBoxClient reference\n",
argv[0]);
return EXIT_FAILURE;
}
If vboxclient is still NULL this means the initializationi failed and the VirtualBox C API cannot
be used.
It is possible to write C applications using multiple threads which all use the VirtualBox API, as
long as you’re initializing the C API in each thread which your application creates. This is done
with g_pVBoxFuncs->pfnClientThreadInitialize() and likewise before the thread is termi-
nated the API must be uninitialized with g_pVBoxFuncs->pfnClientThreadUninitialize().
You don’t have to use these functions in worker threads created by COM/XPCOM (which you
might observe if your code uses active event handling), everything is initialized correctly already.
On Windows the C bindings create a marshaller which supports a wide range of COM threading
models, from STA to MTA, so you don’t have to worry about these details unless you plan to use
active event handlers. See the sample code how to get this to work reliably (in other words think
twice if passive event handling isn’t the better solution after you looked at the sample code).
44
2 Environment-specific notes
an analogous set_ method exists. Let’s apply these rules to get the IVirtualBox reference, an
ISession instance reference and read the IVirtualBox::revision attribute:
rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &vbox);
if (FAILED(rc) || !vbox)
{
PrintErrorInfo(argv[0], "FATAL: could not get VirtualBox reference", rc);
return EXIT_FAILURE;
}
rc = IVirtualBoxClient_get_Session(vboxclient, &session);
if (FAILED(rc) || !session)
{
PrintErrorInfo(argv[0], "FATAL: could not get Session reference", rc);
return EXIT_FAILURE;
}
rc = IVirtualBox_get_Revision(vbox, &revision);
if (SUCCEEDED(rc))
{
printf("Revision: %u\n", revision);
}
The convenience macros for calling a method are named by prepending the method name with
the interface name (using _as the separator).
So far only attribute getters were illustrated, but generic method calls are straightforward,
too:
IMachine *machine = NULL;
BSTR vmname = ...;
...
/*
* Calling IMachine::findMachine(...)
*/
rc = IVirtualBox_FindMachine(vbox, vmname, &machine);
All objects with their methods and attributes are documented in chapter 5, Classes (interfaces),
page 55.
45
2 Environment-specific notes
The ownership of a string determines who is responsible for releasing resources associated with
the string. Whenever the API creates a string (essentially for output parameters), ownership is
transferred to the caller. To avoid resource leaks, the caller should release resources once the
string is no longer needed. There are plenty of examples in the sample code.
Likewise, getting arrays results from output parameters is done using helper functions which
manage memory allocations as part of their other functionality:
SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
ULONG *pData;
ULONG cElements;
IArrayDemo_ReturnArray(pThis, ComSafeArrayAsOutTypeParam(psa, ULONG));
g_pVBoxFuncs->pfnSafeArrayCopyOutParamHelper((void **)&pData, &cElements, VT_I4, psa);
g_pVBoxFuncs->pfnSafeArrayDestroy(psa);
This covers the necessary functionality for all array element types except interface references.
These need special helpers to manage the reference counting correctly. The following code
snippet gets the list of VMs, and passes the first IMachine reference to another API function
(assuming that there is at least one element in the array, to simplify the example):
SAFEARRAY psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
IMachine **machines = NULL;
ULONG machineCnt = 0;
ULONG i;
IVirtualBox_get_Machines(virtualBox, ComSafeArrayAsOutIfaceParam(machinesSA, IMachine *));
g_pVBoxFuncs->pfnSafeArrayCopyOutIfaceParamHelper((IUnknown ***)&machines, &machineCnt, machinesSA);
g_pVBoxFuncs->pfnSafeArrayDestroy(machinesSA);
/* Now "machines" contains the IMachine references, and machineCnt the
* number of elements in the array. */
...
SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayCreateVector(VT_IUNKNOWN, 0, 1);
g_pVBoxFuncs->pfnSafeArrayCopyInParamHelper(psa, (void *)&machines[0], sizeof(machines[0]));
IVirtualBox_GetMachineStates(ComSafeArrayAsInParam(psa), ...);
...
g_pVBoxFuncs->pfnSafeArrayDestroy(psa);
for (i = 0; i < machineCnt; ++i)
{
IMachine *machine = machines[i];
IMachine_Release(machine);
}
free(machines);
Handling output parameters needs more special effort than input parameters, thus only for
the former there are special helpers, and the latter is handled through the generic array support.
46
2 Environment-specific notes
The actual event handler implementation is quite tedious, as it has to implement a complete
API interface. Especially on Windows it is a lot of work to implement the complicated IDispatch
interface, requiring to load COM type information and using it in the IDispatch method imple-
mentation. Overall this is quite tedious compared to passive event handling.
Passive event handling uses a similar event loop structure, which requires calling the following
function in a loop, and processing the returned event appropriately:
rc = IEventSource_GetEvent(pEventSource, pListener, cTimeoutMS, &pEvent);
After processing the event it needs to be marked as processed with the following method call:
rc = IEventSource_EventProcessed(pEventSource, pListener, pEvent);
This is vital for vetoable events, as they would be stuck otherwise, waiting whether the veto
comes or not. It does not do any harm for other event types, and in the end is cheaper than
checking if the event at hand is vetoable or not.
The general event handling concepts are described in the API specification (see chapter 3.4,
VirtualBox events, page 51), including how to aggregate multiple event sources for processing
in one event loop. As mentioned, the sample illustrates the practical aspects of how to use
both types of event handling, active and passive, from a C application. Additional hints are in
the comments documenting the helper methods in VBoxCAPI_v4_3.h. The code complexity of
active event handling (and its inherenly platform/compiler specific aspects) should be motivation
to use passive event handling whereever possible.
...
/*
* Make sure g_pVBoxFuncs->pfnClientUninitialize() is called at exit, no
* matter if we return from the initial call to main or call exit()
* somewhere else. Note that atexit registered functions are not
* called upon abnormal termination, i.e. when calling abort() or
* signal().
47
2 Environment-specific notes
*/
if (atexit(g_pVBoxFuncs->pfnClientUninitialize()) != 0) {
fprintf(stderr, "failed to register g_pVBoxFuncs->pfnClientUninitialize()\n");
exit(EXIT_FAILURE);
}
Another idea would be to write your own void myexit(int status) function, calling
g_pVBoxFuncs->pfnClientUninitialize() followed by the real exit(), and use it instead
of exit() throughout your program and at the end of main.
If you expect the program to be terminated by a signal (e.g. user types CTRL-C sending
SIGINT) you might want to install a signal handler setting a flag noting that a signal was sent
and then calling g_pVBoxFuncs->pfnClientUninitialize() later on, not from the handler
itself.
That said, if a client program forgets to call g_pVBoxFuncs->pfnClientUninitialize() be-
fore it terminates, there is a mechanism in place which will eventually release references held by
the client. On Windows it can take quite a while, in the order of 6-7 minutes.
# Link program.
program: program.o VBoxCAPICGlue.o VirtualBox_i.o
$(CC) -o $@ $^ -ldl -lpthread
48
2 Environment-specific notes
Additionally the VirtualBox_i.c file needs to be compiled and linked to the program, it con-
tains the IIDs relevant for the VirtualBox API, making sure they are not replicated endlessly if the
code refers to them frequently.
The C API client code should include VBoxCAPIGlue.h instead of VBoxXPCOMCGlue.h or
VBoxCAPI_v4_3.h, as this makes sure the correct macros and internal translations are selected.
All API method calls (anything mentioning vtbl) should be rewritten using the convenience
macros for calling methods, as these hide the internal details, are generally easier to use and
shorter to type. You should remove as many as possible (nsISupports **) or similar typecasts,
as the new style should use the correct type in most places, increasing the type safety in case of
an error in the source code.
To gloss over the platform differences, API client code should no longer rely on XPCOM spe-
cific interface names such as nsISupports, nsIException and nsIEventQueue, and replace
them by the platform independent interface names IUnknown and IErrorInfo for the first two
respectively. Event queue handling should be replaced by using the platform independent way
described in chapter 2.3.6.7, Event handling, page 47.
Finally adjust the string and array handling to use the new helpers, as these make sure the
code works without changes with both COM and XPCOM, which are significantly different in
this area. The code should be double checked if it uses the correct way to manage memory, and
is freeing it only after the last use.
Note: This section applies to Linux, Mac OS X and Solaris hosts only and describes
deprecated use of the API from C.
Starting with version 2.2, VirtualBox offers a C binding for its API which works only on plat-
forms using XPCOM. Refer to the old SDK documentation (included in the SDK packages for
version 4.3.6 or earlier), it still applies unchanged. The fundamental concepts are similar (but
the syntactical details are quite different) to the newer cross-platform C binding which should be
used for all new code, as the support for the old C binding will go away in a major release after
version 4.3.
49
3 Basic VirtualBox concepts; some
examples
The following explains some basic VirtualBox concepts such as the VirtualBox object, sessions and
how virtual machines are manipulated and launched using the Main API. The coding examples
use a pseudo-code style closely related to the object-oriented web service (OOWS) for JAX-WS.
Depending on which environment you are using, you will need to adjust the examples.
Boolean attribute getters can sometimes be called isAttribute() due to JAX-WS naming
conventions.
50
3 Basic VirtualBox concepts; some examples
This session object must then be used like a mutex semaphore in common programming envi-
ronments. Before you can change machine settings, you must write-lock the machine by calling
IMachine::lockMachine() with your process’s session object.
After the machine has been locked, the ISession::machine attribute contains a copy of the
original IMachine object upon which the session was opened, but this copy is “mutable”: you can
invoke “set” methods on it.
When done making the changes to the machine, you must call IMachine::saveSettings(), which
will copy the changes you have made from your “mutable” machine back to the real machine and
write them out to the machine settings XML file. This will make your changes permanent.
Finally, it is important to always unlock the machine again, by calling
ISession::unlockMachine(). Otherwise, when the calling process end, the machine will
receive the “aborted” state, which can lead to loss of data.
So, as an example, the sequence to change a machine’s memory to 1024 MB is something like
this:
IWebsessionManager mgr ...;
IVirtualBox vbox = mgr.logon(user, pass);
...
IMachine machine = ...; // read-only machine
ISession session = mgr.getSessionObject();
machine.lockMachine(session, LockType.Write); // machine is now locked for writing
IMachine mutable = session.getMachine(); // obtain the mutable machine copy
mutable.setMemorySize(1024);
mutable.saveSettings(); // write settings to XML
session.unlockMachine();
The caller’s session object can then be used as a sort of remote control to the VM process that
was launched. It contains a “console” object (see ISession::console) with which the VM can be
paused, stopped, snapshotted or other things.
51
3 Basic VirtualBox concepts; some examples
which will then get notified by the server when an event (represented by the IEvent interface)
happens.
The IEvent interface is an abstract parent interface for all events that can occur in VirtualBox.
The actual events that the server sends out are then of one of the specific subclasses, for example
IMachineStateChangedEvent or IMediumChangedEvent.
As an example, the VirtualBox GUI waits for machine events and can thus update its display
when the machine state changes or machine settings are modified, even if this happens in another
client. This is how the GUI can automatically refresh its display even if you manipulate a machine
from another client, for example, from VBoxManage.
To register an event listener to listen to events, use code like this:
EventSource es = console.getEventSource();
IEventListener listener = es.createListener();
VBoxEventType aTypes[] = (VBoxEventType.OnMachineStateChanged);
// list of event types to listen for
es.registerListener(listener, aTypes, false /* active */);
// register passive listener
IEvent ev = es.getEvent(listener, 1000);
// wait up to one second for event to happen
if (ev != null)
{
// downcast to specific event interface (in this case we have only registered
// for one type, otherwise IEvent::type would tell us)
IMachineStateChangedEvent mcse = IMachineStateChangedEvent.queryInterface(ev);
... // inspect and do something
es.eventProcessed(listener, ev);
}
...
es.unregisterListener(listener);
A graphical user interface would probably best start its own thread to wait for events and then
process these in a loop.
The events mechanism was introduced with VirtualBox 3.3 and replaces various callback in-
terfaces which were called for each event in the interface. The callback mechanism was not
compatible with scripting languages, local Java bindings and remote web services as they do not
support callbacks. The new mechanism with events and event listeners works with all of these.
To simplify developement of application using events, concept of event aggregator was intro-
duced. Essentially it’s mechanism to aggregate multiple event sources into single one, and then
work with this single aggregated event source instead of original sources. As an example, one
can evaluate demo recorder in VirtualBox Python shell, shipped with SDK - it records mouse and
keyboard events, represented as separate event sources. Code is essentially like this:
listener = console.eventSource.createListener()
agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource])
agg.registerListener(listener, [ctx[’global’].constants.VBoxEventType_Any], False)
registered = True
end = time.time() + dur
while time.time() < end:
ev = agg.getEvent(listener, 1000)
processEent(ev)
agg.unregisterListener(listener)
Without using aggregators consumer have to poll on both sources, or start multiple threads to
block on those sources.
52
4 The VirtualBox shell
VirtualBox comes with an extensible shell, which allows you to control your virtual machines
from the command line. It is also a nontrivial example of how to use the VirtualBox APIs from
Python, for all three COM/XPCOM/WS styles of the API.
You can easily extend this shell with your own commands. Create a subdirectory named
.config/VirtualBox/shexts below your home directory (respectively .VirtualBox/shexts
on a Windows system and Library/VirtualBox/shexts on OS X) and put a Python file imple-
menting your shell extension commands in this directory. This file must contain an array named
commands containing your command definitions:
commands = {
’cmd1’: [’Command cmd1 help’, cmd1],
’cmd2’: [’Command cmd2 help’, cmd2]
}
For example, to create a command for creating hard drive images, the following code can be
used:
def createHdd(ctx,args):
# Show some meaningful error message on wrong input
if (len(args) < 3):
print "usage: createHdd sizeM location type"
return 0
# Get arguments
size = int(args[1])
loc = args[2]
if len(args) > 3:
format = args[3]
else:
# And provide some meaningful defaults
format = "vdi"
# Report errors
if not hdd.id:
print "cannot create disk (file %s exist?)" %(loc)
return 0
# 0 means continue execution, other values mean exit from the interpreter
return 0
commands = {
53
4 The VirtualBox shell
Just store the above text in the file createHdd (or any other meaningful name) in
.config/VirtualBox/shexts/. Start the VirtualBox shell, or just issue the reloadExts com-
mand, if the shell is already running. Your new command will now be available.
54
5 Classes (interfaces)
5.1 IAdditionsFacility
Note: With the web service, this interface is mapped to a structure. Attributes that
return this interface will not return an object, but a complete structure containing the
attributes listed below as structure members.
5.1.1 Attributes
5.1.1.1 classType (read-only)
AdditionsFacilityClass IAdditionsFacility::classType
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when a Guest Additions property changes. Interested callees should query IGuest
attributes to find out what has changed.
55
5 Classes (interfaces)
5.2.1 Attributes
5.2.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IAdditionsStateChangedEvent::midlDoesNotLikeEmptyInterfaces
5.3 IAppliance
Represents a platform-independent appliance in OVF format. An instance of this is returned by
IVirtualBox::createAppliance(), which can then be used to import and export virtual machines
within an appliance with VirtualBox.
The OVF standard suggests two different physical file formats:
1. If the appliance is distributed as a set of files, there must be at least one XML descriptor file
that conforms to the OVF standard and carries an .ovf file extension. If this descriptor file
references other files such as disk images, as OVF appliances typically do, those additional
files must be in the same directory as the descriptor file.
2. If the appliance is distributed as a single file, it must be in TAR format and have the .ova file
extension. This TAR file must then contain at least the OVF descriptor files and optionally
other files.
At this time, VirtualBox does not not yet support the packed (TAR) variant; support will be
added with a later version.
Importing an OVF appliance into VirtualBox as instances of IMachine involves the following
sequence of API calls:
1. Call IVirtualBox::createAppliance(). This will create an empty IAppliance object.
2. On the new object, call read() with the full path of the OVF file you would like to import.
So long as this file is syntactically valid, this will succeed and fill the appliance object with
the parsed data from the OVF file.
3. Next, call interpret(), which analyzes the OVF data and sets up the contents of the
IAppliance attributes accordingly. These can be inspected by a VirtualBox front-end
such as the GUI, and the suggestions can be displayed to the user. In particular, the
virtualSystemDescriptions[] array contains instances of IVirtualSystemDescription which
represent the virtual systems (machines) in the OVF, which in turn describe the virtual
hardware prescribed by the OVF (network and hardware adapters, virtual disk images,
memory size and so on). The GUI can then give the user the option to confirm and/or
change these suggestions.
4. If desired, call IVirtualSystemDescription::setFinalValues() for each virtual system (ma-
chine) to override the suggestions made by the interpret() routine.
5. Finally, call importMachines() to create virtual machines in VirtualBox as instances of
IMachine that match the information in the virtual system descriptions. After this call
succeeded, the UUIDs of the machines created can be found in the machines[] array at-
tribute.
Exporting VirtualBox machines into an OVF appliance involves the following steps:
1. As with importing, first call IVirtualBox::createAppliance() to create an empty IAppliance
object.
2. For each machine you would like to export, call IMachine::exportTo() with the IAppliance
object you just created. Each such call creates one instance of IVirtualSystemDescription
inside the appliance.
56
5 Classes (interfaces)
4. Finally, call write() with a path specification to have the OVF file written.
5.3.1 Attributes
5.3.1.1 path (read-only)
wstring IAppliance::path
Path to the main file of the OVF appliance, which is either the .ovf or the .ova file passed to
read() (for import) or write() (for export). This attribute is empty until one of these methods
has been called.
Array of virtual disk definitions. One such description exists for each disk definition in the
OVF; each string array item represents one such piece of disk information, with the information
fields separated by tab (\\t) characters.
The caller should be prepared for additional fields being appended to this string in future
versions of VirtualBox and therefore check for the number of tabs in the strings returned.
In the current version, the following eight fields are returned per string in the array:
3. Populated size (optional unsigned integer indicating the current size of the disk; can be
approximate; -1 if unspecified)
4. Format (string identifying the disk format, typically
“http://www.vmware.com/specifications/vmdk.html#sparse”)
5. Reference (where to find the disk image, typically a file name; if empty, then the disk
should be created on import)
6. Image size (optional unsigned integer indicating the size of the image, which need not
necessarily be the same as the values specified above, since the image may be compressed
or sparse; -1 if not specified)
7. Chunk size (optional unsigned integer if the image is split into chunks; presently unsup-
ported and always -1)
8. Compression (optional string equaling “gzip” if the image is gzip-compressed)
Array of virtual system descriptions. One such description is created for each virtual sys-
tem (machine) found in the OVF. This array is empty until either interpret() (for import) or
IMachine::exportTo() (for export) has been called.
57
5 Classes (interfaces)
Contains the UUIDs of the machines created from the information in this appliances. This is
only relevant for the import case, and will only contain data after a call to importMachines()
succeeded.
The X.509 signing certificate, if the imported OVF was signed, null if not signed. This is
available after calling read().
5.3.2 addPasswords
void IAppliance::addPasswords(
[in] wstring identifiers[],
[in] wstring passwords[])
5.3.3 createVFSExplorer
IVFSExplorer IAppliance::createVFSExplorer(
[in] wstring URI)
5.3.4 createVirtualSystemDescriptions
unsigned long IAppliance::createVirtualSystemDescriptions(
[in] unsigned long requested)
5.3.5 getMediumIdsForPasswordId
uuid[] IAppliance::getMediumIdsForPasswordId(
[in] wstring passwordId)
Returns a list of medium identifiers which use the given password identifier.
58
5 Classes (interfaces)
5.3.6 getPasswordIds
wstring[] IAppliance::getPasswordIds()
Returns a list of password identifiers which must be supplied to import or export encrypted
virtual machines.
5.3.7 getWarnings
wstring[] IAppliance::getWarnings()
5.3.8 importMachines
IProgress IAppliance::importMachines(
[in] ImportOptions options[])
Imports the appliance into VirtualBox by creating instances of IMachine and other interfaces
that match the information contained in the appliance as closely as possible, as represented by
the import instructions in the virtualSystemDescriptions[] array.
Calling this method is the final step of importing an appliance into VirtualBox; see IAppliance
for an overview.
Since importing the appliance will most probably involve copying and converting disk images,
which can take a long time, this method operates asynchronously and returns an IProgress object
to allow the caller to monitor the progress.
After the import succeeded, the UUIDs of the IMachine instances created can be retrieved from
the machines[] array attribute.
5.3.9 interpret
void IAppliance::interpret()
Interprets the OVF data that was read when the appliance was constructed. After calling this
method, one can inspect the virtualSystemDescriptions[] array attribute, which will then contain
one IVirtualSystemDescription for each virtual machine found in the appliance.
Calling this method is the second step of importing an appliance into VirtualBox; see
IAppliance for an overview.
After calling this method, one should call getWarnings() to find out if problems were encoun-
tered during the processing which might later lead to errors.
5.3.10 read
IProgress IAppliance::read(
[in] wstring file)
file Name of appliance file to open (either with an .ovf or .ova extension, depending on
whether the appliance is distributed as a set of files or as a single file, respectively).
59
5 Classes (interfaces)
5.3.11 write
IProgress IAppliance::write(
[in] wstring format,
[in] ExportOptions options[],
[in] wstring path)
format Output format, as a string. Currently supported formats are “ovf-0.9”, “ovf-1.0”, “ovf-
2.0” and “opc-1.0”; future versions of VirtualBox may support additional formats. The
“opc-1.0” format is for creating tarballs for the Oracle Public Cloud.
options Options for the exporting operation.
path Name of appliance file to create. There are certain restrictions with regard to the file name
suffix. If the format parameter is “opc-1.0” a .tar.gz suffix is required. Otherwise the
suffix must either be .ovf or .ova, depending on whether the appliance is distributed as a
set of files or as a single file, respectively.
Writes the contents of the appliance exports into a new OVF file.
Calling this method is the final step of exporting an appliance from VirtualBox; see IAppliance
for an overview.
Since exporting the appliance will most probably involve copying and converting disk images,
which can take a long time, this method operates asynchronously and returns an IProgress object
to allow the caller to monitor the progress.
5.4 IAudioAdapter
The IAudioAdapter interface represents the virtual audio adapter of the virtual machine. Used
in IMachine::audioAdapter.
5.4.1 Attributes
5.4.1.1 enabled (read/write)
boolean IAudioAdapter::enabled
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.
Flag whether the audio adapter is enabled for audio input. Only relevant if the adapter is
enabled.
Flag whether the audio adapter is enabled for audio output. Only relevant if the adapter is
enabled.
60
5 Classes (interfaces)
The exact variant of audio codec hardware presented to the guest. For HDA and SB16, only
one variant is available, but for AC’97, there are several.
Audio driver the adapter is connected to. This setting can only be changed when the VM is not
running.
5.4.2 getProperty
wstring IAudioAdapter::getProperty(
[in] wstring key)
5.4.3 setProperty
void IAudioAdapter::setProperty(
[in] wstring key,
[in] wstring value)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when a property of the audio adapter changes. Interested callees should use
IAudioAdapter methods and attributes to find out what has changed.
61
5 Classes (interfaces)
5.5.1 Attributes
5.5.1.1 audioAdapter (read-only)
IAudioAdapter IAudioAdapterChangedEvent::audioAdapter
5.6 IBIOSSettings
The IBIOSSettings interface represents BIOS settings of the virtual machine. This is used only in
the IMachine::BIOSSettings attribute.
5.6.1 Attributes
5.6.1.1 logoFadeIn (read/write)
boolean IBIOSSettings::logoFadeIn
Local file system path for external BIOS splash image. Empty string means the default image
is shown on boot.
I/O-APIC support flag. If set, VirtualBox will provide an I/O-APIC and support IRQs above 15.
62
5 Classes (interfaces)
Offset in milliseconds from the host system time. This allows for guests running with a dif-
ferent system date/time than the host. It is equivalent to setting the system date/time in the
BIOS except it is not an absolute value but a relative one. Guest Additions time synchronization
honors this offset.
PXE debug logging flag. If set, VirtualBox will write extensive PXE trace information to the
release log.
The location of the file storing the non-volatile memory content when the VM is powered off.
The file does not always exist.
Flag to control whether the SMBIOS system UUID is presented in little endian form to the
guest as mandated by the SMBIOS spec chapter 7.2.1. Before VirtualBox version 6.1 it was
always presented in big endian form and to retain the old behavior this flag was introduced so it
can be changed. VMs created with VBox 6.1 will default to true for this flag.
5.7 IBandwidthControl
Controls the bandwidth groups of one machine used to cap I/O done by a VM. This includes
network and disk I/O.
5.7.1 Attributes
5.7.1.1 numGroups (read-only)
unsigned long IBandwidthControl::numGroups
63
5 Classes (interfaces)
5.7.2 createBandwidthGroup
void IBandwidthControl::createBandwidthGroup(
[in] wstring name,
[in] BandwidthGroupType type,
[in] long long maxBytesPerSec)
5.7.3 deleteBandwidthGroup
void IBandwidthControl::deleteBandwidthGroup(
[in] wstring name)
5.7.4 getAllBandwidthGroups
IBandwidthGroup[] IBandwidthControl::getAllBandwidthGroups()
5.7.5 getBandwidthGroup
IBandwidthGroup IBandwidthControl::getBandwidthGroup(
[in] wstring name)
5.8 IBandwidthGroup
Represents one bandwidth group.
5.8.1 Attributes
5.8.1.1 name (read-only)
wstring IBandwidthGroup::name
64
5 Classes (interfaces)
The maximum number of bytes which can be transfered by all entities attached to this group
during one second.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.9.1 Attributes
5.9.1.1 bandwidthGroup (read-only)
IBandwidthGroup IBandwidthGroupChangedEvent::bandwidthGroup
Note: This interface extends IFormValue and therefore supports all its methods and
attributes as well.
5.10.1 getSelected
boolean IBooleanFormValue::getSelected()
5.10.2 setSelected
IProgress IBooleanFormValue::setSelected(
[in] boolean selected)
selected
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
65
5 Classes (interfaces)
5.11.1 Attributes
5.11.1.1 CPU (read-only)
unsigned long ICPUChangedEvent::CPU
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.12.1 Attributes
5.12.1.1 executionCap (read-only)
unsigned long ICPUExecutionCapChangedEvent::executionCap
Note: This interface extends IVetoEvent and therefore supports all its methods and
attributes as well.
5.13.1 Attributes
5.13.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean ICanShowWindowEvent::midlDoesNotLikeEmptyInterfaces
5.14 ICertificate
X.509 certificate details.
66
5 Classes (interfaces)
5.14.1 Attributes
5.14.1.1 versionNumber (read-only)
CertificateVersion ICertificate::versionNumber
Issuer name. Each member of the array is on the format COMPONENT=NAME, e.g. “C=DE”,
“ST=Example”, “L=For Instance”, “O=Beispiel GmbH”, “CN=beispiel.example.org”.
67
5 Classes (interfaces)
Whether this certificate is a certificate authority. Will return E_FAIL if this attribute is not
present.
Array of dotted extended key usage OIDs. Empty array if not present.
68
5 Classes (interfaces)
5.14.2 isCurrentlyExpired
boolean ICertificate::isCurrentlyExpired()
Tests if the certificate has expired at the present time according to the X.509 validity of the
certificate.
5.14.3 queryInfo
wstring ICertificate::queryInfo(
[in] long what)
what
Note: This interface extends IFormValue and therefore supports all its methods and
attributes as well.
5.15.1 Attributes
5.15.1.1 values (read-only)
wstring IChoiceFormValue::values[]
5.15.2 getSelectedIndex
long IChoiceFormValue::getSelectedIndex()
5.15.3 setSelectedIndex
IProgress IChoiceFormValue::setSelectedIndex(
[in] long index)
index
69
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.16.1 Attributes
5.16.1.1 enabled (read-only)
boolean IClipboardFileTransferModeChangedEvent::enabled
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.17.1 Attributes
5.17.1.1 clipboardMode (read-only)
ClipboardMode IClipboardModeChangedEvent::clipboardMode
5.18 ICloudClient
5.18.1 createImage
IProgress ICloudClient::createImage(
[in] wstring parameters[])
5.18.2 deleteImage
IProgress ICloudClient::deleteImage(
[in] wstring uid)
70
5 Classes (interfaces)
5.18.3 exportImage
IProgress ICloudClient::exportImage(
[in] IMedium image,
[in] wstring parameters[])
5.18.4 exportVM
void ICloudClient::exportVM(
[in] IVirtualSystemDescription description,
[in] IProgress progress)
description Virtual system description object which describes the machine and all required pa-
rameters.
progress Progress object to track the operation completion.
Export local VM into the cloud, creating a custom image.
5.18.5 getExportDescriptionForm
IProgress ICloudClient::getExportDescriptionForm(
[in] IVirtualSystemDescription description,
[out] IVirtualSystemDescriptionForm form)
5.18.6 getImageInfo
IProgress ICloudClient::getImageInfo(
[in] wstring uid,
[out] IStringArray infoArray)
5.18.7 getImportDescriptionForm
IProgress ICloudClient::getImportDescriptionForm(
[in] IVirtualSystemDescription description,
[out] IVirtualSystemDescriptionForm form)
71
5 Classes (interfaces)
5.18.8 getInstanceInfo
IProgress ICloudClient::getInstanceInfo(
[in] wstring uid,
[in] IVirtualSystemDescription description)
5.18.9 getLaunchDescriptionForm
IProgress ICloudClient::getLaunchDescriptionForm(
[in] IVirtualSystemDescription description,
[out] IVirtualSystemDescriptionForm form)
5.18.10 importImage
IProgress ICloudClient::importImage(
[in] wstring uid,
[in] wstring parameters[])
5.18.11 importInstance
void ICloudClient::importInstance(
[in] IVirtualSystemDescription description,
[in] IProgress progress)
Import an existing cloud instance to the local host. All needed parameters are passed in the
description (VSD).
5.18.12 launchVM
IProgress ICloudClient::launchVM(
[in] IVirtualSystemDescription description)
description Virtual system description object which describes the machine and all required pa-
rameters.
72
5 Classes (interfaces)
5.18.13 listImages
IProgress ICloudClient::listImages(
[in] CloudImageState imageState[],
[out] IStringArray returnNames,
[out] IStringArray returnIds)
5.18.14 listInstances
IProgress ICloudClient::listInstances(
[in] CloudMachineState machineState[],
[out] IStringArray returnNames,
[out] IStringArray returnIds)
5.18.15 pauseInstance
IProgress ICloudClient::pauseInstance(
[in] wstring uid)
5.18.16 startCloudNetworkGateway
IProgress ICloudClient::startCloudNetworkGateway(
[in] ICloudNetwork network,
[in] wstring sshPublicKey,
[out] ICloudNetworkGatewayInfo gatewayInfo)
5.18.17 startInstance
IProgress ICloudClient::startInstance(
[in] wstring uid)
73
5 Classes (interfaces)
5.18.18 terminateInstance
IProgress ICloudClient::terminateInstance(
[in] wstring uid)
5.19 ICloudNetwork
5.19.1 Attributes
5.19.1.1 networkName (read/write)
wstring ICloudNetwork::networkName
TBD: User-friendly, descriptive name of cloud subnet. For example, domain names of subnet
and vcn, separated by dot.
5.20 ICloudNetworkGatewayInfo
5.20.1 Attributes
5.20.1.1 publicIP (read-only)
wstring ICloudNetworkGatewayInfo::publicIP
5.21 ICloudProfile
5.21.1 Attributes
5.21.1.1 name (read/write)
wstring ICloudProfile::name
74
5 Classes (interfaces)
5.21.2 createCloudClient
ICloudClient ICloudProfile::createCloudClient()
5.21.3 getProperties
wstring[] ICloudProfile::getProperties(
[in] wstring names,
[out] wstring returnNames[])
Note: Currently the value of this argument is ignored and the method always returns
all existing properties.
The method returns two arrays, the array of property names corresponding to the names argu-
ment and the current values of these properties. Both arrays have the same number of elements
with each element at the given index in the first array corresponds to an element at the same
index in the second array.
5.21.4 getProperty
wstring ICloudProfile::getProperty(
[in] wstring name)
Returns the value of the cloud profile property with the given name.
If the requested data name does not exist, this function will succeed and return an empty string
in the value argument.
If this method fails, the following error codes may be reported:
5.21.5 remove
void ICloudProfile::remove()
Deletes a profile.
75
5 Classes (interfaces)
5.21.6 setProperties
void ICloudProfile::setProperties(
[in] wstring names[],
[in] wstring values[])
5.21.7 setProperty
void ICloudProfile::setProperty(
[in] wstring name,
[in] wstring value)
Sets the value of the cloud profile property with the given name.
Setting the property value to null or an empty string is equivalent to deleting the existing
value.
If this method fails, the following error codes may be reported:
5.22 ICloudProvider
5.22.1 Attributes
5.22.1.1 name (read-only)
wstring ICloudProvider::name
Returns the long name of the provider. Includes vendor and precise product name spelled out
in the preferred way.
Returns the short name of the provider. Less than 8 ASCII chars, using acronyms. No vendor
name, but can contain a hint if it’s a 3rd party implementation for this cloud provider, to keep it
unique.
76
5 Classes (interfaces)
5.22.1.3 id (read-only)
uuid ICloudProvider::id
5.22.2 createProfile
void ICloudProvider::createProfile(
[in] wstring profileName,
[in] wstring names[],
[in] wstring values[])
profileName The profile name. Must not exist, otherwise an error is raised.
names Names of properties.
values Values of set properties.
5.22.3 getProfileByName
ICloudProfile ICloudProvider::getProfileByName(
[in] wstring profileName)
profileName
5.22.4 getPropertyDescription
wstring ICloudProvider::getPropertyDescription(
[in] wstring name)
5.22.5 importProfiles
void ICloudProvider::importProfiles()
77
5 Classes (interfaces)
5.22.6 prepareUninstall
void ICloudProvider::prepareUninstall()
The caller requests the cloud provider to cease operation. Should return an error if this is
currently not possible (due to ongoing cloud activity, possibly by a different API client). However,
this must not wait for the completion for a larger amount of time (ideally stays below a second
of execution time). If this succeeds it should leave the cloud provider in a state which does not
allow starting new operations.
5.22.7 restoreProfiles
void ICloudProvider::restoreProfiles()
5.22.8 saveProfiles
void ICloudProvider::saveProfiles()
5.23 ICloudProviderManager
5.23.1 Attributes
5.23.1.1 providers (read-only)
ICloudProvider ICloudProviderManager::providers[]
5.23.2 getProviderById
ICloudProvider ICloudProviderManager::getProviderById(
[in] uuid providerId)
providerId
5.23.3 getProviderByName
ICloudProvider ICloudProviderManager::getProviderByName(
[in] wstring providerName)
providerName
5.23.4 getProviderByShortName
ICloudProvider ICloudProviderManager::getProviderByShortName(
[in] wstring providerName)
providerName
78
5 Classes (interfaces)
5.24 IConsole
The IConsole interface represents an interface to control virtual machine execution.
A console object gets created when a machine has been locked for a particular session (client
process) using IMachine::lockMachine() or IMachine::launchVMProcess(). The console object
can then be found in the session’s ISession::console attribute.
Methods of the IConsole interface allow the caller to query the current virtual machine exe-
cution state, pause the machine or power it down, save the machine state or take a snapshot,
attach and detach removable media and so on.
See also: ISession
5.24.1 Attributes
5.24.1.1 machine (read-only)
IMachine IConsole::machine
Note: This is a convenience property, it has the same value as ISession::machine of the
corresponding session object.
Note: This property always returns the same value as the corresponding property of
the IMachine object for this console session. 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.
Note: If the machine is not running, any attempt to use the returned object will result
in an error.
79
5 Classes (interfaces)
Note: If the machine is not running, any attempt to use the returned object will result
in an error.
Note: If the machine is not running, any attempt to use the returned object will result
in an error.
Debugging interface.
List of USB devices currently attached to the remote VRDE client. Once a new device is phys-
ically attached to the remote host computer, it appears in this list and remains there until de-
tached.
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 IMachine::sharedFolders[] 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 createSharedFolder(). Existing shared
folders can be removed using removeSharedFolder().
80
5 Classes (interfaces)
Whether the guest clipboard should be connected to the host one or whether it should only
be allowed access to the VRDE clipboard. This setting may not affect existing guest clipboard
connections which are already connected to the host clipboard.
5.24.2 addDiskEncryptionPassword
void IConsole::addDiskEncryptionPassword(
[in] wstring id,
[in] wstring password,
[in] boolean clearOnSuspend)
id The identifier used for the password. Must match the identifier used when the encrypted
medium was created.
password The password.
clearOnSuspend Flag whether to clear the password on VM suspend (due to a suspending host
for example). The password must be supplied again before the VM can resume.
81
5 Classes (interfaces)
5.24.3 addDiskEncryptionPasswords
void IConsole::addDiskEncryptionPasswords(
[in] wstring ids[],
[in] wstring passwords[],
[in] boolean clearOnSuspend)
ids List of identifiers for the passwords. Must match the identifier used when the encrypted
medium was created.
passwords List of passwords.
clearOnSuspend Flag whether to clear the given passwords on VM suspend (due to a suspend-
ing host for example). The passwords must be supplied again before the VM can resume.
5.24.4 attachUSBDevice
void IConsole::attachUSBDevice(
[in] uuid id,
[in] wstring captureFilename)
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.
See also: IUSBDeviceFilters::deviceFilters[], USBDeviceState
If this method fails, the following error codes may be reported:
5.24.5 clearAllDiskEncryptionPasswords
void IConsole::clearAllDiskEncryptionPasswords()
5.24.6 createSharedFolder
void IConsole::createSharedFolder(
[in] wstring name,
[in] wstring hostPath,
[in] boolean writable,
[in] boolean automount,
[in] wstring autoMountPoint)
82
5 Classes (interfaces)
hostPath Full path to the shared folder in the host file system.
writable Whether the share is writable or readonly
automount Whether the share gets automatically mounted by the guest or not.
autoMountPoint Where the guest should automatically mount the folder, if possible. For Win-
dows and OS/2 guests this should be a drive letter, while other guests it should be a
absolute directory.
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
ISharedFolder to read more about logical names.
If this method fails, the following error codes may be reported:
5.24.7 detachUSBDevice
IUSBDevice IConsole::detachUSBDevice(
[in] uuid id)
Detaches an USB device with the given UUID from the USB controller of the virtual machine.
After this method succeeds, the VirtualBox server re-initiates 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 re-attachment.
See also: IUSBDeviceFilters::deviceFilters[], USBDeviceState
If this method fails, the following error codes may be reported:
5.24.8 findUSBDeviceByAddress
IUSBDevice IConsole::findUSBDeviceByAddress(
[in] wstring name)
name Address of the USB device (as assigned by the host) to search for.
83
5 Classes (interfaces)
5.24.9 findUSBDeviceById
IUSBDevice IConsole::findUSBDeviceById(
[in] uuid id)
5.24.10 getDeviceActivity
DeviceActivity[] IConsole::getDeviceActivity(
[in] DeviceType type[])
type
5.24.11 getGuestEnteredACPIMode
boolean IConsole::getGuestEnteredACPIMode()
Checks 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.
If this method fails, the following error codes may be reported:
5.24.12 getPowerButtonHandled
boolean IConsole::getPowerButtonHandled()
5.24.13 pause
void IConsole::pause()
84
5 Classes (interfaces)
5.24.14 powerButton
void IConsole::powerButton()
5.24.15 powerDown
IProgress IConsole::powerDown()
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.
If this method fails, the following error codes may be reported:
5.24.16 powerUp
IProgress IConsole::powerUp()
Starts the virtual machine execution using the current machine state (that is, its current exe-
cution state, current settings and current storage devices).
Note: This method is only useful for front-ends that want to actually execute virtual
machines in their own process (like the VirtualBox or VBoxSDL front-ends). Unless you
are intending to write such a front-end, do not call this method. If you simply want to
start virtual machine execution using one of the existing front-ends (for example the
VirtualBox GUI or headless server), use IMachine::launchVMProcess() instead; these
front-ends will power up the machine automatically for you.
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 Saved state, it will continue its execution the point where the state has
been saved.
If the machine IMachine::teleporterEnabled property is enabled on the machine being pow-
ered up, the machine will wait for an incoming teleportation in the TeleportingIn state. The
returned progress object will have at least three operations where the last three are defined as:
(1) powering up and starting TCP server, (2) waiting for incoming teleportations, and (3) per-
form teleportation. These operations will be reflected as the last three operations of the progress
objected returned by IMachine::launchVMProcess() as well.
See also: IMachine::saveState()
If this method fails, the following error codes may be reported:
85
5 Classes (interfaces)
5.24.17 powerUpPaused
IProgress IConsole::powerUpPaused()
Identical to powerUp except that the VM will enter the Paused state, instead of Running.
See also: powerUp()
If this method fails, the following error codes may be reported:
• VBOX_E_INVALID_VM_STATE: Virtual machine already running.
• VBOX_E_HOST_ERROR: Host interface does not exist or name not set.
• VBOX_E_FILE_ERROR: Invalid saved state file.
5.24.18 removeDiskEncryptionPassword
void IConsole::removeDiskEncryptionPassword(
[in] wstring id)
id The identifier used for the password. Must match the identifier used when the encrypted
medium was created.
Removes a password used for hard disk encryption/decryption from the running VM. As soon
as the medium requiring this password is accessed the VM is paused with an error and the
password must be provided again.
5.24.19 removeSharedFolder
void IConsole::removeSharedFolder(
[in] wstring name)
5.24.20 reset
void IConsole::reset()
5.24.21 resume
void IConsole::resume()
86
5 Classes (interfaces)
5.24.22 sleepButton
void IConsole::sleepButton()
5.24.23 teleport
IProgress IConsole::teleport(
[in] wstring hostname,
[in] unsigned long tcpport,
[in] wstring password,
[in] unsigned long maxDowntime)
Note: The current implementation treats this a guideline, not as an absolute rule.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.25.1 Attributes
5.25.1.1 hasData (read-only)
boolean ICursorPositionChangedEvent::hasData
Event contains valid data. If not set, switch back to using the host cursor.
87
5 Classes (interfaces)
5.25.1.2 x (read-only)
unsigned long ICursorPositionChangedEvent::x
Reported X position
5.25.1.3 y (read-only)
unsigned long ICursorPositionChangedEvent::y
Reported Y position
5.26 IDHCPConfig
The DHCP server has several configuration levels: global, group and individual MAC. This inter-
face implements the settings common to each level.
5.26.1 Attributes
5.26.1.1 scope (read-only)
DHCPConfigScope IDHCPConfig::scope
List of DHCP options which should be forced upon the clients in this config scope when they
are available, whether the clients asks for them or not.
List of DHCP options which should not be sent to the clients in this config scope. This is
intended for cases where one client or a group of clients shouldn’t see one or more (typically
global) options.
88
5 Classes (interfaces)
5.26.2 getAllOptions
wstring[] IDHCPConfig::getAllOptions(
[out] DHCPOption options[],
[out] DHCPOptionEncoding encodings[])
5.26.3 getOption
wstring IDHCPConfig::getOption(
[in] DHCPOption option,
[out] DHCPOptionEncoding encoding)
5.26.4 remove
void IDHCPConfig::remove()
Remove this group or individual configuration. Will of course not work on global configura-
tions.
5.26.5 removeAllOptions
void IDHCPConfig::removeAllOptions()
5.26.6 removeOption
void IDHCPConfig::removeOption(
[in] DHCPOption option)
option
Removes the given DHCP option.
5.26.7 setOption
void IDHCPConfig::setOption(
[in] DHCPOption option,
[in] DHCPOptionEncoding encoding,
[in] wstring value)
89
5 Classes (interfaces)
Note: This interface extends IDHCPConfig and therefore supports all its methods and
attributes as well.
5.28 IDHCPGroupCondition
5.28.1 Attributes
5.28.1.1 inclusive (read/write)
boolean IDHCPGroupCondition::inclusive
5.28.2 remove
void IDHCPGroupCondition::remove()
Note: This interface extends IDHCPConfig and therefore supports all its methods and
attributes as well.
5.29.1 Attributes
5.29.1.1 name (read/write)
wstring IDHCPGroupConfig::name
90
5 Classes (interfaces)
5.29.2 addCondition
IDHCPGroupCondition IDHCPGroupConfig::addCondition(
[in] boolean inclusive,
[in] DHCPGroupConditionType type,
[in] wstring value)
inclusive
type
value
5.29.3 removeAllConditions
void IDHCPGroupConfig::removeAllConditions()
Note: This interface extends IDHCPConfig and therefore supports all its methods and
attributes as well.
Configuration for a single NIC, either given directly by MAC address or by VM + adaptor slot
number.
5.30.1 Attributes
5.30.1.1 MACAddress (read-only)
wstring IDHCPIndividualConfig::MACAddress
The MAC address. If a MachineNIC config, this will be queried via the VM ID.
91
5 Classes (interfaces)
5.31 IDHCPServer
The IDHCPServer interface represents the VirtualBox DHCP server configuration.
To enumerate all the DHCP servers on the host, use the IVirtualBox::DHCPServers[] attribute.
5.31.1 Attributes
5.31.1.1 eventSource (read-only)
IEventSource IDHCPServer::eventSource
specifies server IP
92
5 Classes (interfaces)
5.31.2 findLeaseByMAC
void IDHCPServer::findLeaseByMAC(
[in] wstring mac,
[in] long type,
[out] wstring address,
[out] wstring state,
[out] long long issued,
[out] long long expire)
5.31.3 getConfig
IDHCPConfig IDHCPServer::getConfig(
[in] DHCPConfigScope scope,
[in] wstring name,
[in] unsigned long slot,
[in] boolean mayAdd)
93
5 Classes (interfaces)
5.31.4 restart
void IDHCPServer::restart()
5.31.5 setConfiguration
void IDHCPServer::setConfiguration(
[in] wstring IPAddress,
[in] wstring networkMask,
[in] wstring FromIPAddress,
[in] wstring ToIPAddress)
5.31.6 start
void IDHCPServer::start(
[in] wstring trunkName,
[in] wstring trunkType)
5.31.7 stop
void IDHCPServer::stop()
5.32 IDataStream
The IDataStream interface is used to retrieve a data stream. It is returned by
IMediumIO::convertToStream().
94
5 Classes (interfaces)
5.32.1 Attributes
5.32.1.1 readSize (read-only)
unsigned long IDataStream::readSize
Recommended size of a read. Requesting a larger read may be possible in certain situations,
but it is not guaranteed.
5.32.2 read
octet[] IDataStream::read(
[in] unsigned long size,
[in] unsigned long timeoutMS)
5.33 IDirectory
Abstract parent interface for directories handled by VirtualBox.
5.33.1 Attributes
5.33.1.1 directoryName (read-only)
wstring IDirectory::directoryName
5.33.2 close
void IDirectory::close()
Closes this directory. After closing operations like reading the next directory entry will not be
possible anymore.
5.33.3 read
IFsObjInfo IDirectory::read()
95
5 Classes (interfaces)
5.34 IDisplay
The IDisplay interface represents the virtual machine’s display.
The object implementing this interface is contained in each IConsole::display attribute and
represents the visual output of the virtual machine.
The virtual display supports pluggable output targets represented by the IFramebuffer inter-
face. Examples of the output target are a window on the host computer or an RDP session’s
display on a remote computer.
5.34.1 Attributes
5.34.1.1 guestScreenLayout (read-only)
IGuestScreenInfo IDisplay::guestScreenLayout[]
5.34.2 attachFramebuffer
uuid IDisplay::attachFramebuffer(
[in] unsigned long screenId,
[in] IFramebuffer framebuffer)
screenId
framebuffer
5.34.3 completeVHWACommand
void IDisplay::completeVHWACommand(
[in] [ptr] octet command)
5.34.4 createGuestScreenInfo
IGuestScreenInfo IDisplay::createGuestScreenInfo(
[in] unsigned long display,
[in] GuestMonitorStatus status,
[in] boolean primary,
[in] boolean changeOrigin,
[in] long originX,
[in] long originY,
[in] unsigned long width,
[in] unsigned long height,
[in] unsigned long bitsPerPixel)
96
5 Classes (interfaces)
5.34.5 detachFramebuffer
void IDisplay::detachFramebuffer(
[in] unsigned long screenId,
[in] uuid id)
screenId
id
5.34.6 detachScreens
void IDisplay::detachScreens(
[in] long screenIds[])
screenIds
5.34.7 drawToScreen
void IDisplay::drawToScreen(
[in] unsigned long screenId,
[in] [ptr] octet address,
[in] unsigned long x,
[in] unsigned long y,
[in] unsigned long width,
[in] unsigned long height)
97
5 Classes (interfaces)
Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM
display.
If this method fails, the following error codes may be reported:
5.34.8 getScreenResolution
void IDisplay::getScreenResolution(
[in] unsigned long screenId,
[out] unsigned long width,
[out] unsigned long height,
[out] unsigned long bitsPerPixel,
[out] long xOrigin,
[out] long yOrigin,
[out] GuestMonitorStatus guestMonitorStatus)
screenId
width
height
bitsPerPixel
xOrigin
yOrigin
guestMonitorStatus
Queries certain attributes such as display width, height, color depth and the X and Y origin for
a given guest screen.
The parameters xOrigin and yOrigin return the X and Y coordinates of the framebuffer’s
origin.
All return parameters are optional.
5.34.9 getVideoModeHint
void IDisplay::getVideoModeHint(
[in] unsigned long display,
[out] boolean enabled,
[out] boolean changeOrigin,
[out] long originX,
[out] long originY,
[out] unsigned long width,
[out] unsigned long height,
[out] unsigned long bitsPerPixel)
98
5 Classes (interfaces)
Queries the monitor information for a given guest output. See setVideoModeHint. If no
monitor information has been set yet by a front-end the preferred mode values returned will be
zero.
@todo Rename this to getMonitorInfo for 7.0.
If this method fails, the following error codes may be reported:
5.34.10 invalidateAndUpdate
void IDisplay::invalidateAndUpdate()
Does a full invalidation of the VM display and instructs the VM to update it.
If this method fails, the following error codes may be reported:
5.34.11 invalidateAndUpdateScreen
void IDisplay::invalidateAndUpdateScreen(
[in] unsigned long screenId)
5.34.12 notifyHiDPIOutputPolicyChange
void IDisplay::notifyHiDPIOutputPolicyChange(
[in] boolean fUnscaledHiDPI)
fUnscaledHiDPI
Notify OpenGL HGCM host service about HiDPI monitor scaling policy change.
5.34.13 notifyScaleFactorChange
void IDisplay::notifyScaleFactorChange(
[in] unsigned long screenId,
[in] unsigned long u32ScaleFactorWMultiplied,
[in] unsigned long u32ScaleFactorHMultiplied)
screenId
u32ScaleFactorWMultiplied
u32ScaleFactorHMultiplied
Notify OpenGL HGCM host service about graphics content scaling factor change.
99
5 Classes (interfaces)
5.34.14 queryFramebuffer
IFramebuffer IDisplay::queryFramebuffer(
[in] unsigned long screenId)
screenId
5.34.15 querySourceBitmap
void IDisplay::querySourceBitmap(
[in] unsigned long screenId,
[out] IDisplaySourceBitmap displaySourceBitmap)
screenId
displaySourceBitmap
5.34.16 setScreenLayout
void IDisplay::setScreenLayout(
[in] ScreenLayoutMode screenLayoutMode,
[in] IGuestScreenInfo guestScreenInfo[])
screenLayoutMode
guestScreenInfo
5.34.17 setSeamlessMode
void IDisplay::setSeamlessMode(
[in] boolean enabled)
enabled
Enables or disables seamless guest display rendering (seamless desktop integration) mode.
100
5 Classes (interfaces)
5.34.18 setVideoModeHint
void IDisplay::setVideoModeHint(
[in] unsigned long display,
[in] boolean enabled,
[in] boolean changeOrigin,
[in] long originX,
[in] long originY,
[in] unsigned long width,
[in] unsigned long height,
[in] unsigned long bitsPerPixel,
[in] boolean notify)
Changes the monitor information reported by a given output of the guest graphics device. This
information can be read by the guest if suitable drivers and driver tools are available, including
but not limited to those in the Guest Additions. The guest will receive monitor hotplug notifica-
tion when the monitor information is changed, and the information itself will be available to the
guest until the next change. The information should not be resent if the guest does not resize in
response. The guest might have chosen to ignore the change, or the resize might happen later
when a suitable driver is started.
Specifying 0 for either width, height or bitsPerPixel parameters means that the corre-
sponding values should be taken from the current video mode (i.e. left unchanged).
@todo Rename this to setMonitorInfo for 7.0.
If this method fails, the following error codes may be reported:
• E_INVALIDARG: The display value is higher then the number of outputs.
5.34.19 takeScreenShot
void IDisplay::takeScreenShot(
[in] unsigned long screenId,
[in] [ptr] octet address,
[in] unsigned long width,
[in] unsigned long height,
[in] BitmapFormat bitmapFormat)
101
5 Classes (interfaces)
screenId
address
width
height
bitmapFormat
Takes a screen shot of the requested size and format and copies it to the buffer allocated by the
caller and pointed to by address. The buffer size must be enough for a 32 bits per pixel bitmap,
i.e. width * height * 4 bytes.
Note: This API can be used only locally by a VM process through the COM/XPCOM
C++ API as it requires pointer support. It is not available for scripting languages,
Java or any webservice clients. Unless you are writing a new VM frontend use
takeScreenShotToArray().
5.34.20 takeScreenShotToArray
octet[] IDisplay::takeScreenShotToArray(
[in] unsigned long screenId,
[in] unsigned long width,
[in] unsigned long height,
[in] BitmapFormat bitmapFormat)
5.34.21 viewportChanged
void IDisplay::viewportChanged(
[in] unsigned long screenId,
[in] unsigned long x,
[in] unsigned long y,
[in] unsigned long width,
[in] unsigned long height)
102
5 Classes (interfaces)
5.35 IDisplaySourceBitmap
5.35.1 Attributes
5.35.1.1 screenId (read-only)
unsigned long IDisplaySourceBitmap::screenId
5.35.2 queryBitmapInfo
void IDisplaySourceBitmap::queryBitmapInfo(
[out] [ptr] octet address,
[out] unsigned long width,
[out] unsigned long height,
[out] unsigned long bitsPerPixel,
[out] unsigned long bytesPerLine,
[out] BitmapFormat bitmapFormat)
address
width
height
bitsPerPixel
bytesPerLine
bitmapFormat
5.36 IDnDBase
Base abstract interface for drag’n drop.
5.36.1 Attributes
5.36.1.1 formats (read-only)
wstring IDnDBase::formats[]
Returns the protocol version which is used to communicate with the guest.
103
5 Classes (interfaces)
5.36.2 addFormats
void IDnDBase::addFormats(
[in] wstring formats[])
5.36.3 isFormatSupported
boolean IDnDBase::isFormatSupported(
[in] wstring format)
5.36.4 removeFormats
void IDnDBase::removeFormats(
[in] wstring formats[])
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.37.1 Attributes
5.37.1.1 dndMode (read-only)
DnDMode IDnDModeChangedEvent::dndMode
Note: This interface extends IDnDBase and therefore supports all its methods and
attributes as well.
104
5 Classes (interfaces)
5.38.1 dragIsPending
DnDAction IDnDSource::dragIsPending(
[in] unsigned long screenId,
[out] wstring formats[],
[out] DnDAction allowedActions[])
screenId The screen ID where the drag and drop event occurred.
formats On return the supported mime types.
allowedActions On return the actions which are allowed.
Ask the source if there is any drag and drop operation pending. If no drag and drop operation
is pending currently, DnDAction_Ignore is returned.
If this method fails, the following error codes may be reported:
• VBOX_E_VM_ERROR: VMM device is not available.
5.38.2 drop
IProgress IDnDSource::drop(
[in] wstring format,
[in] DnDAction action)
5.38.3 receiveData
octet[] IDnDSource::receiveData()
Receive the data of a previously drag and drop event from the source.
If this method fails, the following error codes may be reported:
• VBOX_E_VM_ERROR: VMM device is not available.
Note: This interface extends IDnDBase and therefore supports all its methods and
attributes as well.
5.39.1 cancel
boolean IDnDTarget::cancel()
Requests cancelling the current operation. The target can veto the request in case the operation
is not cancelable at the moment.
If this method fails, the following error codes may be reported:
• VBOX_E_VM_ERROR: VMM device is not available.
105
5 Classes (interfaces)
5.39.2 drop
DnDAction IDnDTarget::drop(
[in] unsigned long screenId,
[in] unsigned long x,
[in] unsigned long y,
[in] DnDAction defaultAction,
[in] DnDAction allowedActions[],
[in] wstring formats[],
[out] wstring format)
screenId The screen ID where the Drag and Drop event occurred.
5.39.3 enter
DnDAction IDnDTarget::enter(
[in] unsigned long screenId,
[in] unsigned long y,
[in] unsigned long x,
[in] DnDAction defaultAction,
[in] DnDAction allowedActions[],
[in] wstring formats[])
screenId The screen ID where the drag and drop event occurred.
y Y-position of the event.
106
5 Classes (interfaces)
5.39.4 leave
void IDnDTarget::leave(
[in] unsigned long screenId)
screenId The screen ID where the drag and drop event occurred.
5.39.5 move
DnDAction IDnDTarget::move(
[in] unsigned long screenId,
[in] unsigned long x,
[in] unsigned long y,
[in] DnDAction defaultAction,
[in] DnDAction allowedActions[],
[in] wstring formats[])
screenId The screen ID where the drag and drop event occurred.
x X-position of the event.
y Y-position of the event.
defaultAction The default action to use.
allowedActions The actions which are allowed.
formats The supported MIME types.
5.39.6 sendData
IProgress IDnDTarget::sendData(
[in] unsigned long screenId,
[in] wstring format,
[in] octet data[])
screenId The screen ID where the drag and drop event occurred.
format The MIME type the data is in.
data The actual data.
5.40 IEmulatedUSB
Manages emulated USB devices.
107
5 Classes (interfaces)
5.40.1 Attributes
5.40.1.1 webcams (read-only)
wstring IEmulatedUSB::webcams[]
5.40.2 webcamAttach
void IEmulatedUSB::webcamAttach(
[in] wstring path,
[in] wstring settings)
Attaches the emulated USB webcam to the VM, which will use a host video capture device.
5.40.3 webcamDetach
void IEmulatedUSB::webcamDetach(
[in] wstring path)
5.41 IEvent
Abstract parent interface for VirtualBox events. Actual events will typically implement a more
specific interface which derives from this (see below).
Introduction to VirtualBox events
Generally speaking, an event (represented by this interface) signals that something happened,
while an event listener (see IEventListener) represents an entity that is interested in certain
events. In order for this to work with unidirectional protocols (i.e. web services), the concepts
of passive and active listener are used.
Event consumers can register themselves as listeners, providing an array of events they are in-
terested in (see IEventSource::registerListener()). When an event triggers, the listener is notified
about the event. The exact mechanism of the notification depends on whether the listener was
registered as an active or passive listener:
108
5 Classes (interfaces)
Waitable events are useful in situations where the event generator wants to track delivery or
a party wants to wait until all listeners have completed the event. A typical example would be a
vetoable event (see IVetoEvent) where a listeners might veto a certain action, and thus the event
producer has to make sure that all listeners have processed the event and not vetoed before
taking the action.
A given event may have both passive and active listeners at the same time.
Using events
Any VirtualBox object capable of producing externally visible events provides an eventSource
read-only attribute, which is of the type IEventSource. This event source object is notified by
VirtualBox once something has happened, so consumers may register event listeners with this
event source. To register a listener, an object implementing the IEventListener interface must
be provided. For active listeners, such an object is typically created by the consumer, while
for passive listeners IEventSource::createListener() should be used. Please note that a listener
created with IEventSource::createListener() must not be used as an active listener.
Once created, the listener must be registered to listen for the desired events (see
IEventSource::registerListener()), providing an array of VBoxEventType enums. Those elements
can either be the individual event IDs or wildcards matching multiple event IDs.
After registration, the callback’s IEventListener::handleEvent() method is called automatically
when the event is triggered, while passive listeners have to call IEventSource::getEvent() and
IEventSource::eventProcessed() in an event processing loop.
The IEvent interface is an abstract parent interface for all such VirtualBox events coming in. As
a result, the standard use pattern inside IEventListener::handleEvent() or the event processing
loop is to check the type attribute of the event and then cast to the appropriate specific interface
using QueryInterface().
5.41.1 Attributes
5.41.1.1 type (read-only)
VBoxEventType IEvent::type
Event type.
If we can wait for this event being processed. If false, waitProcessed() returns immediately,
and setProcessed() doesn’t make sense. Non-waitable events are generally better performing, as
no additional overhead associated with waitability imposed. Waitable events are needed when
one need to be able to wait for particular event processed, for example for vetoable changes, or
if event refers to some resource which need to be kept immutable until all consumers confirmed
events.
5.41.2 setProcessed
void IEvent::setProcessed()
Internal method called by the system when all listeners of a particular event have called
IEventSource::eventProcessed(). This should not be called by client code.
109
5 Classes (interfaces)
5.41.3 waitProcessed
boolean IEvent::waitProcessed(
[in] long timeout)
timeout Maximum time to wait for event processing, in ms; 0 = no wait, -1 = indefinite wait.
Wait until time outs, or this event is processed. Event must be waitable for this operation to
have described semantics, for non-waitable returns true immediately.
5.42 IEventListener
Event listener. An event listener can work in either active or passive mode, depending on the
way it was registered. See IEvent for an introduction to VirtualBox event handling.
5.42.1 handleEvent
void IEventListener::handleEvent(
[in] IEvent event)
Handle event callback for active listeners. It is not called for passive listeners. After
calling handleEvent() on all active listeners and having received acknowledgement from all
passive listeners via IEventSource::eventProcessed(), the event is marked as processed and
IEvent::waitProcessed() will return immediately.
5.43 IEventSource
Event source. Generally, any object which could generate events can be an event source, or aggre-
gate one. To simplify using one-way protocols such as webservices running on top of HTTP(S),
an event source can work with listeners in either active or passive mode. In active mode it is
up to the IEventSource implementation to call IEventListener::handleEvent(), in passive mode
the event source keeps track of pending events for each listener and returns available events on
demand.
See IEvent for an introduction to VirtualBox event handling.
5.43.1 createAggregator
IEventSource IEventSource::createAggregator(
[in] IEventSource subordinates[])
Creates an aggregator event source, collecting events from multiple sources. This way a single
listener can listen for events coming from multiple sources, using a single blocking getEvent()
on the returned aggregator.
5.43.2 createListener
IEventListener IEventSource::createListener()
110
5 Classes (interfaces)
5.43.3 eventProcessed
void IEventSource::eventProcessed(
[in] IEventListener listener,
[in] IEvent event)
5.43.4 fireEvent
boolean IEventSource::fireEvent(
[in] IEvent event,
[in] long timeout)
5.43.5 getEvent
IEvent IEventSource::getEvent(
[in] IEventListener listener,
[in] long timeout)
5.43.6 registerListener
void IEventSource::registerListener(
[in] IEventListener listener,
[in] VBoxEventType interesting[],
[in] boolean active)
111
5 Classes (interfaces)
Note: To avoid system overload, the VirtualBox server process checks if pas-
sive event listeners call getEvent() frequently enough. In the current implemen-
tation, if more than 500 pending events are detected for a passive event listener,
it is forcefully unregistered by the system, and further getEvent() calls will return
VBOX_E_OBJECT_NOT_FOUND.
5.43.7 unregisterListener
void IEventSource::unregisterListener(
[in] IEventListener listener)
Unregister an event listener. If listener is passive, and some waitable events are still in queue
they are marked as processed automatically.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.44.1 Attributes
5.44.1.1 listener (read-only)
IEventListener IEventSourceChangedEvent::listener
Note: This interface extends IExtPackBase and therefore supports all its methods and
attributes as well.
Interface for querying information about an extension pack as well as accessing COM objects
within it.
112
5 Classes (interfaces)
5.45.1 queryObject
$unknown IExtPack::queryObject(
[in] wstring objUuid)
Queries the IUnknown interface to an object in the extension pack main module. This allows
plug-ins and others to talk directly to an extension pack.
5.46 IExtPackBase
Interface for querying information about an extension pack as well as accessing COM objects
within it.
5.46.1 Attributes
5.46.1.1 name (read-only)
wstring IExtPackBase::name
The extension pack version string. This is restricted to the dotted version number and op-
tionally a build indicator. No tree revision or tag will be included in the string as those
things are available as separate properties. An optional publisher tag may be present like for
IVirtualBox::version.
Examples: “1.2.3”, “1.2.3_BETA1” and “1.2.3_RC2”.
113
5 Classes (interfaces)
The name of the VRDE module if the extension pack sports one.
String indicating why the extension pack is not usable. This is an empty string if usable and
always a non-empty string if not usable.
The default HTML license text for the extension pack. Same as calling queryLicense with
preferredLocale and preferredLanguage as empty strings and format set to html.
5.46.2 queryLicense
wstring IExtPackBase::queryLicense(
[in] wstring preferredLocale,
[in] wstring preferredLanguage,
[in] wstring format)
preferredLocale The preferred license locale. Pass an empty string to get the default license.
preferredLanguage The preferred license language. Pass an empty string to get the default
language for the locale.
format The license format: html, rtf or txt. If a license is present there will always be an HTML
of it, the rich text format (RTF) and plain text (txt) versions are optional. If
Full feature version of the license attribute.
114
5 Classes (interfaces)
Note: This interface extends IExtPackBase and therefore supports all its methods and
attributes as well.
5.47.1 Attributes
5.47.1.1 filePath (read-only)
wstring IExtPackFile::filePath
5.47.2 install
IProgress IExtPackFile::install(
[in] boolean replace,
[in] wstring displayInfo)
replace Set this to automatically uninstall any existing extension pack with the same name as
the one being installed.
displayInfo Platform specific display information. Reserved for future hacks.
5.48 IExtPackManager
5.48.1 Attributes
5.48.1.1 installedExtPacks (read-only)
IExtPack IExtPackManager::installedExtPacks[]
115
5 Classes (interfaces)
5.48.2 cleanup
void IExtPackManager::cleanup()
5.48.3 find
IExtPack IExtPackManager::find(
[in] wstring name)
5.48.4 isExtPackUsable
boolean IExtPackManager::isExtPackUsable(
[in] wstring name)
5.48.5 openExtPackFile
IExtPackFile IExtPackManager::openExtPackFile(
[in] wstring path)
path The path of the extension pack tarball. This can optionally be followed by a “::SHA-
256=hex-digit” of the tarball.
5.48.6 queryAllPlugInsForFrontend
wstring[] IExtPackManager::queryAllPlugInsForFrontend(
[in] wstring frontendName)
Gets the path to all the plug-in modules for a given frontend.
This is a convenience method that is intended to simplify the plug-in loading process for a
frontend.
116
5 Classes (interfaces)
5.48.7 uninstall
IProgress IExtPackManager::uninstall(
[in] wstring name,
[in] boolean forcedRemoval,
[in] wstring displayInfo)
5.49 IExtPackPlugIn
Interface for keeping information about a plug-in that ships with an extension pack.
5.49.1 Attributes
5.49.1.1 name (read-only)
wstring IExtPackPlugIn::name
The name of the frontend or component name this plug-in plugs into.
Note: This interface extends IVetoEvent and therefore supports all its methods and
attributes as well.
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.
117
5 Classes (interfaces)
5.50.1 Attributes
5.50.1.1 machineId (read-only)
uuid IExtraDataCanChangeEvent::machineId
ID of the machine this event relates to. Null for global extra data changes.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.51.1 Attributes
5.51.1.1 machineId (read-only)
uuid IExtraDataChangedEvent::machineId
ID of the machine this event relates to. Null for global extra data changes.
5.52 IFile
Abstract parent interface for files handled by VirtualBox.
118
5 Classes (interfaces)
5.52.1 Attributes
5.52.1.1 eventSource (read-only)
IEventSource IFile::eventSource
5.52.1.2 id (read-only)
unsigned long IFile::id
Note: This will not always be correct with older guest additions (version 5.2.30 and
earlier, as well as versions 6.0.0 thru 6.0.8) after a calling readAt() or writeAt(), or
after calling write() on a file in append mode. The correct file offset can be obtained
using seek().
119
5 Classes (interfaces)
5.52.2 close
void IFile::close()
Closes this file. After closing operations like reading data, writing data or querying information
will not be possible anymore.
5.52.3 queryInfo
IFsObjInfo IFile::queryInfo()
5.52.4 querySize
long long IFile::querySize()
5.52.5 read
octet[] IFile::read(
[in] unsigned long toRead,
[in] unsigned long timeoutMS)
5.52.6 readAt
octet[] IFile::readAt(
[in] long long offset,
[in] unsigned long toRead,
[in] unsigned long timeoutMS)
120
5 Classes (interfaces)
5.52.7 seek
long long IFile::seek(
[in] long long offset,
[in] FileSeekOrigin whence)
5.52.8 setACL
void IFile::setACL(
[in] wstring acl,
[in] unsigned long mode)
5.52.9 setSize
void IFile::setSize(
[in] long long size)
5.52.10 write
unsigned long IFile::write(
[in] octet data[],
[in] unsigned long timeoutMS)
data Array of bytes to write. The size of the array also specifies how much to write.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
121
5 Classes (interfaces)
5.52.11 writeAt
unsigned long IFile::writeAt(
[in] long long offset,
[in] octet data[],
[in] unsigned long timeoutMS)
offset Offset in bytes to start writing. If the file was opened with the accessMode set to
AppendOnly or AppendRead, the offset is ignored and the write always goes to the end
of the file.
data Array of bytes to write. The size of the array also specifies how much to write.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
5.53 IForm
5.53.1 Attributes
5.53.1.1 values (read-only)
IFormValue IForm::values[]
5.54 IFormValue
5.54.1 Attributes
5.54.1.1 type (read-only)
FormValueType IFormValue::type
122
5 Classes (interfaces)
5.55 IFramebuffer
5.55.1 Attributes
5.55.1.1 width (read-only)
unsigned long IFramebuffer::width
Frame buffer pixel format. It’s one of the values defined by BitmapFormat.
Note: This attribute must never (and will never) return Opaque – the format of the
frame buffer must be always known.
Hint from the frame buffer 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 frame buffer. 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 guar-
anteed 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.
123
5 Classes (interfaces)
Platform-dependent identifier of the window where context of this frame buffer is drawn, or
zero if there’s no such window.
5.55.2 getVisibleRegion
Note: The address of the provided array must be in the process space of this IFrame-
buffer object.
5.55.3 notify3DEvent
void IFramebuffer::notify3DEvent(
[in] unsigned long type,
[in] octet data[])
124
5 Classes (interfaces)
5.55.4 notifyChange
void IFramebuffer::notifyChange(
[in] unsigned long screenId,
[in] unsigned long xOrigin,
[in] unsigned long yOrigin,
[in] unsigned long width,
[in] unsigned long height)
5.55.5 notifyUpdate
void IFramebuffer::notifyUpdate(
[in] unsigned long x,
[in] unsigned long y,
[in] unsigned long width,
[in] unsigned long height)
x X position of update.
y Y position of update.
width Width of update.
Informs about an update. Gets called by the display object where this buffer is registered.
5.55.6 notifyUpdateImage
void IFramebuffer::notifyUpdateImage(
[in] unsigned long x,
[in] unsigned long y,
[in] unsigned long width,
[in] unsigned long height,
[in] octet image[])
x X position of update.
y Y position of update.
width Width of update.
125
5 Classes (interfaces)
5.55.7 processVHWACommand
void IFramebuffer::processVHWACommand(
[in] [ptr] octet command,
[in] long enmCmd,
[in] boolean fromGuest)
Posts a Video HW Acceleration Command to the frame buffer for processing. The commands
used for 2D video acceleration (DDraw surface creation/destroying, blitting, scaling, color con-
version, overlaying, etc.) are posted from quest to the host to be processed by the host hardware.
Note: The address of the provided command must be in the process space of this
IFramebuffer object.
5.55.8 setVisibleRegion
void IFramebuffer::setVisibleRegion(
[in] [ptr] octet rectangles,
[in] unsigned long count)
Suggests a new visible region to this frame buffer. 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.
Note: The address of the provided array must be in the process space of this IFrame-
buffer object.
Note: The IFramebuffer implementation must make a copy of the provided array of
rectangles.
126
5 Classes (interfaces)
5.55.9 videoModeSupported
boolean IFramebuffer::videoModeSupported(
[in] unsigned long width,
[in] unsigned long height,
[in] unsigned long bpp)
width
height
bpp
Returns whether the frame buffer 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.
Note: This interface extends IFramebuffer and therefore supports all its methods and
attributes as well.
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.
5.56.1 Attributes
5.56.1.1 x (read-only)
unsigned long IFramebufferOverlay::x
5.56.1.2 y (read-only)
unsigned long IFramebufferOverlay::y
The global alpha value for the overlay. This may or may not be supported by a given front end.
127
5 Classes (interfaces)
5.56.2 move
void IFramebufferOverlay::move(
[in] unsigned long x,
[in] unsigned long y)
x
y
5.57 IFsObjInfo
Abstract parent interface for VirtualBox file system object information. This can be information
about a file or a directory, for example.
5.57.1 Attributes
5.57.1.1 name (read-only)
wstring IFsObjInfo::name
The logical size (st_size). For normal files this is the size of the file. For symbolic links, this is
the length of the path name contained in the symbolic link. For other objects this fields needs to
be specified.
128
5 Classes (interfaces)
The user owning the filesystem object (st_uid). This is -1 if not available.
The group the filesystem object is assigned (st_gid). This is -1 if not available.
The unique identifier (within the filesystem) of this filesystem object (st_ino). This is zero if
not availalbe.
The device number of the device which this filesystem object resides on (st_dev).
129
5 Classes (interfaces)
5.58 IGraphicsAdapter
The IGraphicsAdapter interface represents the graphics adapter of the virtual machine.
5.58.1 Attributes
5.58.1.1 graphicsControllerType (read/write)
GraphicsControllerType IGraphicsAdapter::graphicsControllerType
This setting determines whether VirtualBox allows this machine to make use of the 3D graphics
support available on the host.
This setting determines whether VirtualBox allows this machine to make use of the 2D video
acceleration support available on the host.
130
5 Classes (interfaces)
Note: Only effective on Windows XP and later guests with Guest Additions installed.
5.59 IGuest
The IGuest interface represents information about the operating system running inside the virtual
machine. Used in IConsole::guest.
IGuest provides information about the guest operating system, whether Guest Additions are
installed and other OS-specific virtual machine properties.
5.59.1 Attributes
5.59.1.1 OSTypeId (read-only)
wstring IGuest::OSTypeId
Identifier of the Guest OS type as reported by the Guest Additions. You may use
IVirtualBox::getGuestOSType() to obtain an IGuestOSType object representing details about the
given Guest OS type.
Note: If Guest Additions are not installed, this value will be the same as
IMachine::OSTypeId.
Retrieves the drag’n drop source implementation for the guest side, that is, handling and
retrieving drag’n drop data from the guest.
131
5 Classes (interfaces)
Retrieves the drag’n drop source implementation for the host side. This will allow the host to
handle and initiate a drag’n drop operation to copy data from the host to the guest.
Returns a collection of current known facilities. Only returns facilities where a status is known,
e.g. facilities with an unknown status will not be returned.
5.59.2 createSession
IGuestSession IGuest::createSession(
[in] wstring user,
[in] wstring password,
[in] wstring domain,
[in] wstring sessionName)
user User name this session will be using to control the guest; has to exist and have the appro-
priate rights to execute programs in the VM. Must not be empty.
password Password of the user account to be used. Empty passwords are allowed.
domain Domain name of the user account to be used if the guest is part of a domain. Optional.
This feature is not implemented yet.
sessionName The session’s friendly name. Optional, can be empty.
132
5 Classes (interfaces)
Creates a new guest session for controlling the guest. The new session will be started asyn-
chronously, meaning on return of this function it is not guaranteed that the guest session is in a
started and/or usable state. To wait for successful startup, use the IGuestSession::waitFor() call.
A guest session represents one impersonated user account in the guest, so every operation
will use the same credentials specified when creating the session object via createSession().
Anonymous sessions, that is, sessions without specifying a valid user account in the guest are not
allowed reasons of security.
There can be a maximum of 32 sessions at once per VM. An error will be returned if this has
been reached.
For more information please consult IGuestSession
If this method fails, the following error codes may be reported:
5.59.3 findSession
IGuestSession[] IGuest::findSession(
[in] wstring sessionName)
sessionName The session’s friendly name to find. Wildcards like ? and * are allowed.
Finds guest sessions by their friendly name and returns an interface array with all found guest
sessions.
5.59.4 getAdditionsStatus
boolean IGuest::getAdditionsStatus(
[in] AdditionsRunLevelType level)
5.59.5 getFacilityStatus
AdditionsFacilityStatus IGuest::getFacilityStatus(
[in] AdditionsFacilityType facility,
[out] long long timestamp)
133
5 Classes (interfaces)
5.59.6 internalGetStatistics
void IGuest::internalGetStatistics(
[out] unsigned long cpuUser,
[out] unsigned long cpuKernel,
[out] unsigned long cpuIdle,
[out] unsigned long memTotal,
[out] unsigned long memFree,
[out] unsigned long memBalloon,
[out] unsigned long memShared,
[out] unsigned long memCache,
[out] unsigned long pagedTotal,
[out] unsigned long memAllocTotal,
[out] unsigned long memFreeTotal,
[out] unsigned long memBalloonTotal,
[out] unsigned long memSharedTotal)
cpuUser Percentage of processor time spent in user mode as seen by the guest.
cpuKernel Percentage of processor time spent in kernel mode as seen by the guest.
cpuIdle Percentage of processor time spent idling as seen by the guest.
memTotal Total amount of physical guest RAM.
memFree Free amount of physical guest RAM.
memBalloon Amount of ballooned physical guest RAM.
memShared Amount of shared physical guest RAM.
memCache Total amount of guest (disk) cache memory.
pagedTotal Total amount of space in the page file.
memAllocTotal Total amount of memory allocated by the hypervisor.
memFreeTotal Total amount of free memory available in the hypervisor.
memBalloonTotal Total amount of memory ballooned by the hypervisor.
memSharedTotal Total amount of shared memory in the hypervisor.
5.59.7 setCredentials
void IGuest::setCredentials(
[in] wstring userName,
[in] wstring password,
[in] wstring domain,
[in] boolean allowInteractiveLogon)
134
5 Classes (interfaces)
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.
If this method fails, the following error codes may be reported:
5.59.8 updateGuestAdditions
IProgress IGuest::updateGuestAdditions(
[in] wstring source,
[in] wstring arguments[],
[in] AdditionsUpdateFlag flags[])
source Path to the Guest Additions .ISO file to use for the update.
arguments Optional command line arguments to use for the Guest Additions installer. Useful
for retrofitting features which weren’t installed before in the guest.
flags AdditionsUpdateFlag flags.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.60.1 Attributes
5.60.1.1 facility (read-only)
AdditionsFacilityType IGuestAdditionsStatusChangedEvent::facility
135
5 Classes (interfaces)
Note: This interface extends IDirectory and therefore supports all its methods and
attributes as well.
5.61.1 Attributes
5.61.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestDirectory::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IDnDSource and therefore supports all its methods and
attributes as well.
Implementation of the IDnDSource object for source drag’n drop operations on the guest.
5.62.1 Attributes
5.62.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestDnDSource::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IDnDTarget and therefore supports all its methods and
attributes as well.
Implementation of the IDnDTarget object for target drag’n drop operations on the guest.
136
5 Classes (interfaces)
5.63.1 Attributes
5.63.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestDnDTarget::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IFile and therefore supports all its methods and attributes
as well.
5.64.1 Attributes
5.64.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestFile::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IGuestSessionEvent and therefore supports all its methods
and attributes as well.
5.65.1 Attributes
5.65.1.1 file (read-only)
IGuestFile IGuestFileEvent::file
Note: This interface extends IGuestFileEvent and therefore supports all its methods
and attributes as well.
Base abstract interface for all guest file input/output (IO) events.
5.66.1 Attributes
5.66.1.1 offset (read-only)
long long IGuestFileIOEvent::offset
137
5 Classes (interfaces)
Note: This interface extends IGuestFileIOEvent and therefore supports all its methods
and attributes as well.
Notification when a guest file changed its current offset via IFile::seek().
5.67.1 Attributes
5.67.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestFileOffsetChangedEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IGuestFileIOEvent and therefore supports all its methods
and attributes as well.
5.68.1 Attributes
5.68.1.1 data (read-only)
octet IGuestFileReadEvent::data[]
Note: This interface extends IGuestFileEvent and therefore supports all its methods
and attributes as well.
5.69.1 Attributes
5.69.1.1 registered (read-only)
boolean IGuestFileRegisteredEvent::registered
138
5 Classes (interfaces)
Note: This interface extends IGuestFileEvent and therefore supports all its methods
and attributes as well.
5.70.1 Attributes
5.70.1.1 newSize (read-only)
long long IGuestFileSizeChangedEvent::newSize
Note: This interface extends IGuestFileEvent and therefore supports all its methods
and attributes as well.
5.71.1 Attributes
5.71.1.1 status (read-only)
FileStatus IGuestFileStateChangedEvent::status
Note: This interface extends IGuestFileIOEvent and therefore supports all its methods
and attributes as well.
5.72.1 Attributes
5.72.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestFileWriteEvent::midlDoesNotLikeEmptyInterfaces
139
5 Classes (interfaces)
Note: This interface extends IFsObjInfo and therefore supports all its methods and
attributes as well.
5.73.1 Attributes
5.73.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestFsObjInfo::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.74.1 Attributes
5.74.1.1 scancodes (read-only)
long IGuestKeyboardEvent::scancodes[]
Array of scancodes.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.75.1 Attributes
5.75.1.1 changeType (read-only)
GuestMonitorChangedEventType IGuestMonitorChangedEvent::changeType
140
5 Classes (interfaces)
Physical X origin relative to the primary screen. Valid for Enabled and NewOrigin.
Physical Y origin relative to the primary screen. Valid for Enabled and NewOrigin.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.76.1 Attributes
5.76.1.1 output (read-only)
unsigned long IGuestMonitorInfoChangedEvent::output
Note: This interface extends IReusableEvent and therefore supports all its methods and
attributes as well.
5.77.1 Attributes
5.77.1.1 mode (read-only)
GuestMouseEventMode IGuestMouseEvent::mode
141
5 Classes (interfaces)
5.77.1.2 x (read-only)
long IGuestMouseEvent::x
5.77.1.3 y (read-only)
long IGuestMouseEvent::y
5.77.1.4 z (read-only)
long IGuestMouseEvent::z
Z delta.
5.77.1.5 w (read-only)
long IGuestMouseEvent::w
W delta.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.78.1 Attributes
5.78.1.1 contactCount (read-only)
long IGuestMultiTouchEvent::contactCount
X positions.
Y positions.
142
5 Classes (interfaces)
Contact identifiers.
Timestamp of the event in milliseconds. Only relative time between events is important.
5.79 IGuestOSType
Note: With the web service, this interface is mapped to a structure. Attributes that
return this interface will not return an object, but a complete structure containing the
attributes listed below as structure members.
5.79.1 Attributes
5.79.1.1 familyId (read-only)
wstring IGuestOSType::familyId
5.79.1.3 id (read-only)
wstring IGuestOSType::id
143
5 Classes (interfaces)
144
5 Classes (interfaces)
Returns true if using USB Human Interface Devices, such as keyboard and mouse recom-
mended.
145
5 Classes (interfaces)
Returns true if using VCPU reset on triple fault is recommended for this OS type.
Note: This interface extends IProcess and therefore supports all its methods and at-
tributes as well.
Implementation of the IProcess object for processes the host has started in the guest.
146
5 Classes (interfaces)
5.80.1 Attributes
5.80.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IGuestProcess::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IGuestSessionEvent and therefore supports all its methods
and attributes as well.
5.81.1 Attributes
5.81.1.1 process (read-only)
IGuestProcess IGuestProcessEvent::process
Note: This interface extends IGuestProcessEvent and therefore supports all its methods
and attributes as well.
Base abstract interface for all guest process input/output (IO) events.
5.82.1 Attributes
5.82.1.1 handle (read-only)
unsigned long IGuestProcessIOEvent::handle
Input/output (IO) handle involved in this event. Usually 0 is stdin, 1 is stdout and 2 is stderr.
147
5 Classes (interfaces)
5.83 IGuestProcessInputNotifyEvent
(IGuestProcessIOEvent)
Note: This interface extends IGuestProcessIOEvent and therefore supports all its meth-
ods and attributes as well.
5.83.1 Attributes
5.83.1.1 status (read-only)
ProcessInputStatus IGuestProcessInputNotifyEvent::status
Note: This interface extends IGuestProcessIOEvent and therefore supports all its meth-
ods and attributes as well.
5.84.1 Attributes
5.84.1.1 data (read-only)
octet IGuestProcessOutputEvent::data[]
Note: This interface extends IGuestProcessEvent and therefore supports all its methods
and attributes as well.
5.85.1 Attributes
5.85.1.1 registered (read-only)
boolean IGuestProcessRegisteredEvent::registered
148
5 Classes (interfaces)
5.86 IGuestProcessStateChangedEvent
(IGuestProcessEvent)
Note: This interface extends IGuestProcessEvent and therefore supports all its methods
and attributes as well.
5.86.1 Attributes
5.86.1.1 status (read-only)
ProcessStatus IGuestProcessStateChangedEvent::status
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
5.87.1 Attributes
5.87.1.1 name (read-only)
wstring IGuestPropertyChangedEvent::name
149
5 Classes (interfaces)
5.88 IGuestScreenInfo
5.88.1 Attributes
5.88.1.1 screenId (read-only)
unsigned long IGuestScreenInfo::screenId
5.89 IGuestSession
A guest session represents one impersonated user account in the guest, so every operation will
use the same credentials specified when creating the session object via IGuest::createSession().
There can be a maximum of 32 sessions at once per VM, whereas session 0 always is reserved
for the root session (the root session is part of that limit).
This root session is controlling all other guest sessions and also is responsible for actions which
require system level privileges.
Each guest session keeps track of the guest directories and files that it opened as well as guest
processes it has created. To work on guest files or directories a guest session offers methods to
150
5 Classes (interfaces)
open or create such objects (see fileOpen() or directoryOpen() for instance). Similarly, there a
methods for creating guest processes.
There can be up to 2048 objects (guest processes, files and directories) a time per guest session.
Exceeding the limit will result in an error (see the corresponding functions for more).
When done with either of these objects, including the guest session itself, use the appropriate
close() method to let the object do its cleanup work.
Closing a session via close() will try to close all the mentioned objects above unless these
objects are still used by a client.
A set of environment variables changes is associated with each session
(environmentChanges[]). These are applied to the base environment of the impersonated
guest user when creating a new guest process. For additional flexibility the processCreate()
and processCreateEx() methods allows you to specify individual environment changes for each
process you create. With newer guest addition versions, the base environment is also made
available via environmentBase[]. (One reason for why we record changes to a base environment
instead of working directly on an environment block is that we need to be compatible with older
guest additions. Another reason is that this way it is always possible to undo all the changes
you’ve scheduled.)
5.89.1 Attributes
5.89.1.1 user (read-only)
wstring IGuestSession::user
Returns the user name used by this session to impersonate users in the guest.
Returns the domain name used by this session to impersonate users in the guest.
5.89.1.4 id (read-only)
unsigned long IGuestSession::id
Returns the protocol version which is used by this session to communicate with the guest.
151
5 Classes (interfaces)
The set of scheduled environment changes to the base environment of the session. They are
in putenv format, i.e. “VAR=VALUE” for setting and “VAR” for unsetting. One entry per variable
(change). The changes are applied when creating new guest processes.
This is writable, so to undo all the scheduled changes, assign it an empty array.
The base environment of the session. They are on the “VAR=VALUE” form, one array entry
per variable.
Access fails with VBOX_E_NOT_SUPPORTED if the guest additions does not support the ses-
sion base environment feature. Support for this was introduced with protocol version XXXX.
Access fails with VBOX_E_INVALID_OBJECT_STATE if the guest additions has yet to report the
session base environment.
The style of paths used by the guest. Handy for giving the right kind of path specifications to
fileOpen() and similar methods.
Gets or sets the current directory of the session. Guest path style.
152
5 Classes (interfaces)
5.89.2 close
void IGuestSession::close()
Closes this session. All opened guest directories, files and processes which are not referenced
by clients anymore will be closed. Guest processes which fall into this category and still are
running in the guest will be terminated automatically.
5.89.3 copyFromGuest
IProgress IGuestSession::copyFromGuest(
[in] wstring sources[],
[in] wstring filters[],
[in] wstring flags[],
[in] wstring destination)
sources Paths to directories and/or files on the guest side that should be copied to the host.
If the path ends with a path delimiter, only the directory’s content is being copied. Guest
path style.
filters Array of source filters. This uses the DOS/NT style wildcard characters ’?’ and ’*’.
flags Array of comma-separated list of source flags.
The following flags are available for directory sources:
CopyIntoExistingAllow copying into an existing destination directory.
The following flags are available for file sources:
NoReplaceDo not replace any destination object.FollowLinksFollows (and handles) (sym-
bolic) links.UpdateOnly copy when the source file is newer than the destination file or
when the destination file is missing.
destination Where to put the sources on the host. Host path style.
153
5 Classes (interfaces)
5.89.4 copyToGuest
IProgress IGuestSession::copyToGuest(
[in] wstring sources[],
[in] wstring filters[],
[in] wstring flags[],
[in] wstring destination)
sources Paths to directories and/or files on the host side that should be copied to the guest. If
the path ends with a path delimiter, only the directory’s content is being copied. Host path
style.
filters Array of source filters. This uses the DOS/NT style wildcard characters ’?’ and ’*’.
flags Array of comma-separated list of source flags.
The following flags are available for directory sources:
CopyIntoExistingAllow copying into an existing destination directory.
The following flags are available for file sources:
NoReplaceDo not replace any destination object.FollowLinksFollows (and handles) (sym-
bolic) links.UpdateOnly copy when the source file is newer than the destination file or
when the destination file is missing.
destination Where to put the sources on the guest. Guest path style.
Copies directories and/or files from host to the guest.
This function requires several parallel arrays to be supplied, one set for each source.
5.89.5 directoryCopy
IProgress IGuestSession::directoryCopy(
[in] wstring source,
[in] wstring destination,
[in] DirectoryCopyFlag flags[])
source The path to the directory to copy (in the guest). Guest path style.
destination The path to the target directory (in the guest). Unless the CopyIntoExisting flag is
given, the directory shall not already exist. Guest path style.
flags Zero or more DirectoryCopyFlag values.
Recursively copies a directory from one guest location to another.
If this method fails, the following error codes may be reported:
• E_NOTIMPL: Not yet implemented.
5.89.6 directoryCopyFromGuest
IProgress IGuestSession::directoryCopyFromGuest(
[in] wstring source,
[in] wstring destination,
[in] DirectoryCopyFlag flags[])
source Path to the directory on the guest side that should be copied to the host. Guest path
style.
destination Where to put the directory on the host. Unless the CopyIntoExisting flag is given,
the directory shall not already exist. Host path style.
flags Zero or more DirectoryCopyFlag values.
Recursively copies a directory from the guest to the host.
154
5 Classes (interfaces)
5.89.7 directoryCopyToGuest
IProgress IGuestSession::directoryCopyToGuest(
[in] wstring source,
[in] wstring destination,
[in] DirectoryCopyFlag flags[])
source Path to the directory on the host side that should be copied to the guest. Host path style.
destination Where to put the file in the guest. Unless the CopyIntoExisting flag is given, the
directory shall not already exist. Guest style path.
flags Zero or more DirectoryCopyFlag values.
5.89.8 directoryCreate
void IGuestSession::directoryCreate(
[in] wstring path,
[in] unsigned long mode,
[in] DirectoryCreateFlag flags[])
5.89.9 directoryCreateTemp
wstring IGuestSession::directoryCreateTemp(
[in] wstring templateName,
[in] unsigned long mode,
[in] wstring path,
[in] boolean secure)
templateName Template for the name of the directory to create. This must contain at least one
’X’ character. The first group of consecutive ’X’ characters in the template will be replaced
by a random alphanumeric string to produce a unique name.
mode The UNIX-style access mode mask to create the directory with. Whether/how all three
access groups and associated access rights are realized is guest OS dependent. The API
does the best it can on each OS.
This parameter is ignore if the secure parameter is set to true.
155
5 Classes (interfaces)
path The path to the directory in which the temporary directory should be created. Guest path
style.
secure Whether to fail if the directory can not be securely created. Currently this means that
another unprivileged user cannot manipulate the path specified or remove the temporary
directory after it has been created. Also causes the mode specified to be ignored. May not
be supported on all guest types.
5.89.10 directoryExists
boolean IGuestSession::directoryExists(
[in] wstring path,
[in] boolean followSymlinks)
5.89.11 directoryOpen
IGuestDirectory IGuestSession::directoryOpen(
[in] wstring path,
[in] wstring filter,
[in] DirectoryOpenFlag flags[])
Opens a directory in the guest and creates a IGuestDirectory object that can be used for further
operations.
Note: This method follows symbolic links by default at the moment, this may change
in the future.
156
5 Classes (interfaces)
Note: One idiosyncrasy of the current implementation is that you will NOT get
VBOX_E_OBJECT_NOT_FOUND returned here if the directory doesn’t exist. Instead
the read function will fail with VBOX_E_IPRT_ERROR. This will be fixed soon.
5.89.12 directoryRemove
void IGuestSession::directoryRemove(
[in] wstring path)
path Path to the directory that should be removed. Guest path style.
Note: Symbolic links in the final component will not be followed, instead an not-a-
directory error is reported.
5.89.13 directoryRemoveRecursive
IProgress IGuestSession::directoryRemoveRecursive(
[in] wstring path,
[in] DirectoryRemoveRecFlag flags[])
path Path of the directory that is to be removed recursively. Guest path style.
flags Zero or more DirectoryRemoveRecFlag flags.
Note: WARNING!! THE FLAGS ARE NOT CURRENTLY IMPLEMENTED. THE IMPLE-
MENTATION WORKS AS IF FLAGS WAS SET TO ContentAndDir.
Note: If the final path component is a symbolic link, this method will fail as it can only
be applied to directories.
157
5 Classes (interfaces)
5.89.14 environmentDoesBaseVariableExist
boolean IGuestSession::environmentDoesBaseVariableExist(
[in] wstring name)
name Name of the environment variable to look for. This cannot be empty nor can it contain
any equal signs.
Checks if the given environment variable exists in the session’s base environment
(environmentBase[]).
If this method fails, the following error codes may be reported:
• VBOX_E_NOT_SUPPORTED: If the guest additions does not support the session base envi-
ronment feature. Support for this was introduced with protocol version XXXX.
• VBOX_E_INVALID_OBJECT_STATE: If the guest additions has yet to report the session base
environment.
5.89.15 environmentGetBaseVariable
wstring IGuestSession::environmentGetBaseVariable(
[in] wstring name)
name Name of the environment variable to get.This cannot be empty nor can it contain any
equal signs.
• VBOX_E_NOT_SUPPORTED: If the guest additions does not support the session base envi-
ronment feature. Support for this was introduced with protocol version XXXX.
• VBOX_E_INVALID_OBJECT_STATE: If the guest additions has yet to report the session base
environment.
5.89.16 environmentScheduleSet
void IGuestSession::environmentScheduleSet(
[in] wstring name,
[in] wstring value)
name Name of the environment variable to set. This cannot be empty nor can it contain any
equal signs.
value Value to set the session environment variable to.
Schedules setting an environment variable when creating the next guest process. This affects
the environmentChanges[] attribute.
5.89.17 environmentScheduleUnset
void IGuestSession::environmentScheduleUnset(
[in] wstring name)
name Name of the environment variable to unset. This cannot be empty nor can it contain any
equal signs.
Schedules unsetting (removing) an environment variable when creating the next guest pro-
cess. This affects the environmentChanges[] attribute.
158
5 Classes (interfaces)
5.89.18 fileCopy
IProgress IGuestSession::fileCopy(
[in] wstring source,
[in] wstring destination,
[in] FileCopyFlag flags[])
source The path to the file to copy (in the guest). Guest path style.
destination The path to the target file (in the guest). This cannot be a directory. Guest path
style.
flags Zero or more FileCopyFlag values.
Copies a file from one guest location to another.
5.89.19 fileCopyFromGuest
IProgress IGuestSession::fileCopyFromGuest(
[in] wstring source,
[in] wstring destination,
[in] FileCopyFlag flags[])
source Path to the file on the guest side that should be copied to the host. Guest path style.
destination Where to put the file on the host (file, not directory). Host path style.
flags Zero or more FileCopyFlag values.
Copies a file from the guest to the host.
5.89.20 fileCopyToGuest
IProgress IGuestSession::fileCopyToGuest(
[in] wstring source,
[in] wstring destination,
[in] FileCopyFlag flags[])
source Path to the file on the host side that should be copied to the guest. Host path style.
destination Where to put the file in the guest (file, not directory). Guest style path.
flags Zero or more FileCopyFlag values.
Copies a file from the host to the guest.
159
5 Classes (interfaces)
5.89.21 fileCreateTemp
IGuestFile IGuestSession::fileCreateTemp(
[in] wstring templateName,
[in] unsigned long mode,
[in] wstring path,
[in] boolean secure)
templateName Template for the name of the file to create. This must contain at least one ’X’
character. The first group of consecutive ’X’ characters in the template will be replaced by
a random alphanumeric string to produce a unique name.
mode The UNIX-style access mode mask to create the file with. Whether/how all three access
groups and associated access rights are realized is guest OS dependent. The API does the
best it can on each OS.
This parameter is ignore if the secure parameter is set to true.
path The path to the directory in which the temporary file should be created.
secure Whether to fail if the file can not be securely created. Currently this means that another
unprivileged user cannot manipulate the path specified or remove the temporary file after
it has been created. Also causes the mode specified to be ignored. May not be supported
on all guest types.
5.89.22 fileExists
boolean IGuestSession::fileExists(
[in] wstring path,
[in] boolean followSymlinks)
160
5 Classes (interfaces)
5.89.23 fileOpen
IGuestFile IGuestSession::fileOpen(
[in] wstring path,
[in] FileAccessMode accessMode,
[in] FileOpenAction openAction,
[in] unsigned long creationMode)
5.89.24 fileOpenEx
IGuestFile IGuestSession::fileOpenEx(
[in] wstring path,
[in] FileAccessMode accessMode,
[in] FileOpenAction openAction,
[in] FileSharingMode sharingMode,
[in] unsigned long creationMode,
[in] FileOpenExFlag flags[])
161
5 Classes (interfaces)
5.89.25 fileQuerySize
long long IGuestSession::fileQuerySize(
[in] wstring path,
[in] boolean followSymlinks)
path Path to the file which size is requested. Guest path style.
followSymlinks It true, symbolic links in the final path component will be followed to their
target, and the size of the target is returned. If false, symbolic links in the final path
component will make the method call fail (symblink is not a regular file).
5.89.26 fsObjCopyArray
IProgress IGuestSession::fsObjCopyArray(
[in] wstring source[],
[in] wstring destination,
[in] FileCopyFlag flags[])
source Array of paths to the file system objects to copy. Guest style path.
destination Where to copy the file system objects to (directory). Guest path style.
flags Zero or more FileCopyFlag values.
Copies file system objects (files, directories, symlinks, etc) from one guest location to another.
If this method fails, the following error codes may be reported:
5.89.27 fsObjExists
boolean IGuestSession::fsObjExists(
[in] wstring path,
[in] boolean followSymlinks)
path Path to the file system object to check the existance of. Guest path style.
followSymlinks If true, symbolic links in the final component will be followed and the method
will instead check if the target exists. If false, symbolic links in the final component will
satisfy the method and it will return true in exists.
Checks whether a file system object (file, directory, etc) exists in the guest or not.
If this method fails, the following error codes may be reported:
162
5 Classes (interfaces)
5.89.28 fsObjMove
IProgress IGuestSession::fsObjMove(
[in] wstring source,
[in] wstring destination,
[in] FsObjMoveFlag flags[])
Moves a file system object (file, directory, symlink, etc) from one guest location to another.
This differs from fsObjRename() in that it can move accross file system boundraries. In that
case it will perform a copy and then delete the original. For directories, this can take a while and
is subject to races.
If this method fails, the following error codes may be reported:
5.89.29 fsObjMoveArray
IProgress IGuestSession::fsObjMoveArray(
[in] wstring source[],
[in] wstring destination,
[in] FsObjMoveFlag flags[])
source Array of paths to the file system objects to move. Guest style path.
destination Where to move the file system objects to (directory). Guest path style.
Moves file system objects (files, directories, symlinks, etc) from one guest location to another.
If this method fails, the following error codes may be reported:
5.89.30 fsObjQueryInfo
IGuestFsObjInfo IGuestSession::fsObjQueryInfo(
[in] wstring path,
[in] boolean followSymlinks)
path Path to the file system object to gather information about. Guest path style.
followSymlinks Information about symbolic links is returned if false. Otherwise, symbolic
links are followed and the returned information concerns itself with the symlink target if
true.
Queries information about a file system object (file, directory, etc) in the guest.
If this method fails, the following error codes may be reported:
163
5 Classes (interfaces)
5.89.31 fsObjRemove
void IGuestSession::fsObjRemove(
[in] wstring path)
path Path to the file system object to remove. Guest style path.
Removes a file system object (file, symlink, etc) in the guest. Will not work on directories, use
directoryRemove() to remove directories.
Note: This method will remove symbolic links in the final path component, not follow
them.
5.89.32 fsObjRemoveArray
IProgress IGuestSession::fsObjRemoveArray(
[in] wstring path[])
path Array of paths to the file system objects to remove. Guest style path.
Removes multiple file system objects (files, directories, symlinks, etc) in the guest. Use with
caution.
Note: This method is not implemented yet and will return E_NOTIMPL.
Note: This method will remove symbolic links in the final path component, not follow
them.
5.89.33 fsObjRename
void IGuestSession::fsObjRename(
[in] wstring oldPath,
[in] wstring newPath,
[in] FsObjRenameFlag flags[])
164
5 Classes (interfaces)
5.89.34 fsObjSetACL
void IGuestSession::fsObjSetACL(
[in] wstring path,
[in] boolean followSymlinks,
[in] wstring acl,
[in] unsigned long mode)
path Full path of the file system object which ACL to set
followSymlinks If true symbolic links in the final component will be followed, otherwise, if
false, the method will work directly on a symbolic link in the final component.
Sets the access control list (ACL) of a file system object (file, directory, etc) in the guest.
If this method fails, the following error codes may be reported:
5.89.35 processCreate
IGuestProcess IGuestSession::processCreate(
[in] wstring executable,
[in] wstring arguments[],
[in] wstring environmentChanges[],
[in] ProcessCreateFlag flags[],
[in] unsigned long timeoutMS)
executable Full path to the file to execute in the guest. The file has to exists in the guest VM
with executable right to the session user in order to succeed. If empty/null, the first entry
in the arguments array will be used instead (i.e. argv[0]).
arguments Array of arguments passed to the new process.
Note: Starting with VirtualBox 5.0 this array starts with argument 0 instead of argu-
ment 1 as in previous versions. Whether the zeroth argument can be passed to the
guest depends on the VBoxService version running there. If you depend on this, check
that the protocolVersion is 3 or higher.
165
5 Classes (interfaces)
Creates a new process running in the guest. The new process will be started asynchronously,
meaning on return of this function it is not be guaranteed that the guest process is in a started
state. To wait for successful startup, use the IProcess::waitFor() call.
Note: Starting at VirtualBox 4.2 guest process execution by is default limited to serve
up to 255 guest processes at a time. If all 255 guest processes are active and running,
creating a new guest process will result in an error.
If ProcessCreateFlag_WaitForStdOut and/or ProcessCreateFlag_WaitForStdErr are set,
the guest process will not enter the terminated state until all data from the specified
streams have been read read.
5.89.36 processCreateEx
IGuestProcess IGuestSession::processCreateEx(
[in] wstring executable,
[in] wstring arguments[],
[in] wstring environmentChanges[],
[in] ProcessCreateFlag flags[],
[in] unsigned long timeoutMS,
[in] ProcessPriority priority,
[in] long affinity[])
executable Full path to the file to execute in the guest. The file has to exists in the guest VM
with executable right to the session user in order to succeed. If empty/null, the first entry
in the arguments array will be used instead (i.e. argv[0]).
arguments Array of arguments passed to the new process.
Note: Starting with VirtualBox 5.0 this array starts with argument 0 instead of argu-
ment 1 as in previous versions. Whether the zeroth argument can be passed to the
guest depends on the VBoxService version running there. If you depend on this, check
that the protocolVersion is 3 or higher.
flags Process creation flags, see ProcessCreateFlag for detailed description of available flags.
timeoutMS Timeout (in ms) for limiting the guest process’ running time. Pass 0 for an infi-
nite timeout. On timeout the guest process will be killed and its status will be put to an
appropriate value. See ProcessStatus for more information.
166
5 Classes (interfaces)
priority Process priority to use for execution, see ProcessPriority for available priority levels.
affinity Processor affinity to set for the new process. This is a list of guest CPU numbers the
process is allowed to run on.
Note: This is silently ignored if the guest does not support setting the affinity of pro-
cesses, or if the guest additions does not implemet this feature.
Creates a new process running in the guest with the extended options for setting the process
priority and affinity.
See processCreate() for more information.
5.89.37 processGet
IGuestProcess IGuestSession::processGet(
[in] unsigned long pid)
5.89.38 symlinkCreate
void IGuestSession::symlinkCreate(
[in] wstring symlink,
[in] wstring target,
[in] SymlinkType type)
symlink Path to the symbolic link that should be created. Guest path style.
target The path to the symbolic link target. If not an absolute, this will be relative to the
symlink location at access time. Guest path style.
type The symbolic link type (mainly for Windows). See SymlinkType for more information.
5.89.39 symlinkExists
boolean IGuestSession::symlinkExists(
[in] wstring symlink)
167
5 Classes (interfaces)
5.89.40 symlinkRead
wstring IGuestSession::symlinkRead(
[in] wstring symlink,
[in] SymlinkReadFlag flags[])
5.89.41 waitFor
GuestSessionWaitResult IGuestSession::waitFor(
[in] unsigned long waitFor,
[in] unsigned long timeoutMS)
waitFor Specifies what to wait for; see GuestSessionWaitForFlag for more information.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
5.89.42 waitForArray
GuestSessionWaitResult IGuestSession::waitForArray(
[in] GuestSessionWaitForFlag waitFor[],
[in] unsigned long timeoutMS)
waitFor Specifies what to wait for; see GuestSessionWaitForFlag for more information.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.90.1 Attributes
5.90.1.1 session (read-only)
IGuestSession IGuestSessionEvent::session
168
5 Classes (interfaces)
Note: This interface extends IGuestSessionEvent and therefore supports all its methods
and attributes as well.
5.91.1 Attributes
5.91.1.1 registered (read-only)
boolean IGuestSessionRegisteredEvent::registered
5.92 IGuestSessionStateChangedEvent
(IGuestSessionEvent)
Note: This interface extends IGuestSessionEvent and therefore supports all its methods
and attributes as well.
5.92.1 Attributes
5.92.1.1 id (read-only)
unsigned long IGuestSessionStateChangedEvent::id
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
169
5 Classes (interfaces)
5.93.1 Attributes
5.93.1.1 name (read-only)
wstring IGuestUserStateChangedEvent::name
Name of the FQDN (fully qualified domain name) this user is bound to. Optional.
What was changed for this guest user. See GuestUserState for more information.
5.94 IHost
The IHost interface represents the physical machine that this VirtualBox installation runs on.
An object implementing this interface is returned by the IVirtualBox::host attribute. This inter-
face 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 ma-
nipulating some of the host’s hardware, such as global USB device filters and host interface
networking.
5.94.1 Attributes
5.94.1.1 DVDDrives (read-only)
IMedium IHost::DVDDrives[]
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.
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
170
5 Classes (interfaces)
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
(IUSBDeviceFilters::deviceFilters[]) are applied to it.
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
171
5 Classes (interfaces)
172
5 Classes (interfaces)
5.94.2 addUSBDeviceSource
void IHost::addUSBDeviceSource(
[in] wstring backend,
[in] wstring id,
[in] wstring address,
[in] wstring propertyNames[],
[in] wstring propertyValues[])
5.94.3 createHostOnlyNetworkInterface
IProgress IHost::createHostOnlyNetworkInterface(
[out] IHostNetworkInterface hostInterface)
5.94.4 createUSBDeviceFilter
IHostUSBDeviceFilter IHost::createUSBDeviceFilter(
[in] wstring name)
Creates a new USB device filter. All attributes except the filter name are set to empty (any
match), active is false (the filter is not active).
The created filter can be added to the list of filters using insertUSBDeviceFilter().
See also: USBDeviceFilters[]
5.94.5 findHostDVDDrive
IMedium IHost::findHostDVDDrive(
[in] wstring name)
173
5 Classes (interfaces)
5.94.6 findHostFloppyDrive
IMedium IHost::findHostFloppyDrive(
[in] wstring name)
5.94.7 findHostNetworkInterfaceById
IHostNetworkInterface IHost::findHostNetworkInterfaceById(
[in] uuid id)
Note: The method returns an error if the given GUID does not correspond to any host
network interface.
5.94.8 findHostNetworkInterfaceByName
IHostNetworkInterface IHost::findHostNetworkInterfaceByName(
[in] wstring name)
Note: The method returns an error if the given name does not correspond to any host
network interface.
5.94.9 findHostNetworkInterfacesOfType
IHostNetworkInterface[] IHost::findHostNetworkInterfacesOfType(
[in] HostNetworkInterfaceType type)
5.94.10 findUSBDeviceByAddress
IHostUSBDevice IHost::findUSBDeviceByAddress(
[in] wstring name)
name Address of the USB device (as assigned by the host) to search for.
Searches for a USB device with the given host address.
See also: IUSBDevice::address
If this method fails, the following error codes may be reported:
• VBOX_E_OBJECT_NOT_FOUND: Given name does not correspond to any USB device.
174
5 Classes (interfaces)
5.94.11 findUSBDeviceById
IHostUSBDevice IHost::findUSBDeviceById(
[in] uuid id)
5.94.12 generateMACAddress
wstring IHost::generateMACAddress()
5.94.13 getProcessorCPUIDLeaf
void IHost::getProcessorCPUIDLeaf(
[in] unsigned long cpuId,
[in] unsigned long leaf,
[in] unsigned long subLeaf,
[out] unsigned long valEax,
[out] unsigned long valEbx,
[out] unsigned long valEcx,
[out] unsigned long valEdx)
Note: The current implementation might not necessarily return the description for this
exact CPU.
175
5 Classes (interfaces)
5.94.14 getProcessorDescription
wstring IHost::getProcessorDescription(
[in] unsigned long cpuId)
Note: The current implementation might not necessarily return the description for this
exact CPU.
5.94.15 getProcessorFeature
boolean IHost::getProcessorFeature(
[in] ProcessorFeature feature)
5.94.16 getProcessorSpeed
unsigned long IHost::getProcessorSpeed(
[in] unsigned long cpuId)
5.94.17 insertUSBDeviceFilter
void IHost::insertUSBDeviceFilter(
[in] unsigned long position,
[in] IHostUSBDeviceFilter filter)
Note: Duplicates are not allowed, so an attempt to insert a filter already in the list is
an error.
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
176
5 Classes (interfaces)
5.94.18 removeHostOnlyNetworkInterface
IProgress IHost::removeHostOnlyNetworkInterface(
[in] uuid id)
id Adapter GUID.
5.94.19 removeUSBDeviceFilter
void IHost::removeUSBDeviceFilter(
[in] unsigned long position)
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.
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
5.94.20 removeUSBDeviceSource
void IHost::removeUSBDeviceSource(
[in] wstring id)
5.95 IHostNameResolutionConfigurationChangeEvent
(IEvent)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.95.1 Attributes
5.95.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IHostNameResolutionConfigurationChangeEvent::midlDoesNotLikeEmptyInterfaces
177
5 Classes (interfaces)
5.96 IHostNetworkInterface
Represents one of host’s network interfaces. IP V6 address and network mask are strings
of 32 hexadecimal digits grouped by four. Groups are separated by colons. For example,
fe80:0000:0000:0000:021e:c2ff:fed2:b030.
5.96.1 Attributes
5.96.1.1 name (read-only)
wstring IHostNetworkInterface::name
5.96.1.3 id (read-only)
uuid IHostNetworkInterface::id
Returns the name of a virtual network the interface gets attached to.
178
5 Classes (interfaces)
5.96.2 DHCPRediscover
void IHostNetworkInterface::DHCPRediscover()
5.96.3 enableDynamicIPConfig
void IHostNetworkInterface::enableDynamicIPConfig()
179
5 Classes (interfaces)
5.96.4 enableStaticIPConfig
void IHostNetworkInterface::enableStaticIPConfig(
[in] wstring IPAddress,
[in] wstring networkMask)
IPAddress IP address.
networkMask network mask.
sets and enables the static IP V4 configuration for the given interface.
5.96.5 enableStaticIPConfigV6
void IHostNetworkInterface::enableStaticIPConfigV6(
[in] wstring IPV6Address,
[in] unsigned long IPV6NetworkMaskPrefixLength)
IPV6Address IP address.
IPV6NetworkMaskPrefixLength network mask.
sets and enables the static IP V6 configuration for the given interface.
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
Notification when host PCI device is plugged/unplugged. Plugging usually takes place on VM
startup, unplug - when IMachine::detachHostPCIDevice() is called.
See also: IMachine::detachHostPCIDevice()
5.97.1 Attributes
5.97.1.1 plugged (read-only)
boolean IHostPCIDevicePlugEvent::plugged
180
5 Classes (interfaces)
Note: This interface extends IUSBDevice and therefore supports all its methods and
attributes as well.
The IHostUSBDevice interface represents a physical USB device attached to the host computer.
Besides properties inherited from IUSBDevice, this interface adds the state property that holds
the current state of the USB device.
See also: IHost::USBDevices[], IHost::USBDeviceFilters[]
5.98.1 Attributes
5.98.1.1 state (read-only)
USBDeviceState IHostUSBDevice::state
Note: This interface extends IUSBDeviceFilter and therefore supports all its methods
and attributes as well.
The IHostUSBDeviceFilter interface represents a global filter for a physical USB device used by
the host computer. Used indirectly in IHost::USBDeviceFilters[].
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.
5.99.1 Attributes
5.99.1.1 action (read/write)
USBDeviceFilterAction IHostUSBDeviceFilter::action
Action performed by the host when an attached USB device matches this filter.
5.100 IHostUpdate
Represents the state of the update checking logic (a singleton returned by IHost::update at-
tribute).
5.101 IHostVideoInputDevice
Represents one of host’s video capture devices, for example a webcam.
181
5 Classes (interfaces)
5.101.1 Attributes
5.101.1.1 name (read-only)
wstring IHostVideoInputDevice::name
5.102 IInternalMachineControl
5.102.1 authenticateExternal
void IInternalMachineControl::authenticateExternal(
[in] wstring authParams[],
[out] wstring result)
5.102.2 autoCaptureUSBDevices
void IInternalMachineControl::autoCaptureUSBDevices()
Requests a capture all matching USB devices attached to the host. When the request is com-
pleted, the VM process will get a IInternalSessionControl::onUSBDeviceAttach() notification per
every captured device.
5.102.3 beginPowerUp
void IInternalMachineControl::beginPowerUp(
[in] IProgress progress)
progress
Tells VBoxSVC that IConsole::powerUp() is under ways and gives it the progress object that
should be part of any pending IMachine::launchVMProcess() operations. The progress object
may be called back to reflect an early cancelation, so some care have to be taken with respect to
any cancelation callbacks. The console object will call endPowerUp() to signal the completion of
the progress object.
182
5 Classes (interfaces)
5.102.4 beginPoweringDown
void IInternalMachineControl::beginPoweringDown(
[out] IProgress progress)
progress Progress object created by VBoxSVC to wait until the VM is powered down.
Called by the VM process to inform the server it wants to stop the VM execution and power
down.
5.102.5 captureUSBDevice
void IInternalMachineControl::captureUSBDevice(
[in] uuid id,
[in] wstring captureFilename)
id
captureFilename
Requests a capture of the given host USB device. When the request is completed, the VM
process will get a IInternalSessionControl::onUSBDeviceAttach() notification.
5.102.6 clipboardAreaAttach
void IInternalMachineControl::clipboardAreaAttach(
[in] unsigned long id)
5.102.7 clipboardAreaDetach
void IInternalMachineControl::clipboardAreaDetach(
[in] unsigned long id)
5.102.8 clipboardAreaGetMostRecent
void IInternalMachineControl::clipboardAreaGetMostRecent(
[out] unsigned long id)
5.102.9 clipboardAreaGetRefCount
void IInternalMachineControl::clipboardAreaGetRefCount(
[in] unsigned long id,
[out] unsigned long refcount)
183
5 Classes (interfaces)
5.102.10 clipboardAreaRegister
void IInternalMachineControl::clipboardAreaRegister(
[in] wstring parms[],
[out] unsigned long id)
5.102.11 clipboardAreaUnregister
void IInternalMachineControl::clipboardAreaUnregister(
[in] unsigned long id)
5.102.12 detachAllUSBDevices
void IInternalMachineControl::detachAllUSBDevices(
[in] boolean done)
done
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 inten-
tions, while when done = true the VM is reporting what it has done.
Note: 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.
5.102.13 detachUSBDevice
void IInternalMachineControl::detachUSBDevice(
[in] uuid id,
[in] boolean done)
id
done
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 IInternalSessionControl::onUSBDeviceDetach() notification.
Note: 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.
184
5 Classes (interfaces)
5.102.14 ejectMedium
IMediumAttachment IInternalMachineControl::ejectMedium(
[in] IMediumAttachment attachment)
Tells VBoxSVC that the guest has ejected the medium associated with the medium attachment.
5.102.15 endPowerUp
void IInternalMachineControl::endPowerUp(
[in] long result)
result
Tells VBoxSVC that IConsole::powerUp() has completed. This method may query status infor-
mation from the progress object it received in beginPowerUp() and copy it over to any in-progress
IMachine::launchVMProcess() call in order to complete that progress object.
5.102.16 endPoweringDown
void IInternalMachineControl::endPoweringDown(
[in] long result,
[in] wstring errMsg)
Called by the VM process to inform the server that powering down previously requested by
#beginPoweringDown is either successfully finished or there was a failure.
If this method fails, the following error codes may be reported:
5.102.17 finishOnlineMergeMedium
void IInternalMachineControl::finishOnlineMergeMedium()
5.102.18 lockMedia
void IInternalMachineControl::lockMedia()
Locks all media attached to the machine for writing and parents of attached differencing media
(if any) for reading. This operation is atomic so that if it fails no media is actually locked.
This method is intended to be called when the machine is in Starting or Restoring state. The
locked media will be automatically unlocked when the machine is powered off or crashed.
185
5 Classes (interfaces)
5.102.19 onSessionEnd
IProgress IInternalMachineControl::onSessionEnd(
[in] ISession session)
Triggered by the given session object when the session is about to close normally.
5.102.20 pullGuestProperties
void IInternalMachineControl::pullGuestProperties(
[out] wstring names[],
[out] wstring values[],
[out] long long timestamps[],
[out] wstring flags[])
Get the list of the guest properties matching a set of patterns along with their values, times-
tamps and flags and give responsibility for managing properties to the console.
5.102.21 pushGuestProperty
void IInternalMachineControl::pushGuestProperty(
[in] wstring name,
[in] wstring value,
[in] long long timestamp,
[in] wstring flags)
5.102.22 reportVmStatistics
void IInternalMachineControl::reportVmStatistics(
[in] unsigned long validStats,
[in] unsigned long cpuUser,
[in] unsigned long cpuKernel,
[in] unsigned long cpuIdle,
[in] unsigned long memTotal,
[in] unsigned long memFree,
[in] unsigned long memBalloon,
186
5 Classes (interfaces)
validStats Mask defining which parameters are valid. For example: 0x11 means that cpuIdle
and XXX are valid. Other parameters should be ignored.
cpuUser Percentage of processor time spent in user mode as seen by the guest.
cpuKernel Percentage of processor time spent in kernel mode as seen by the guest.
cpuIdle Percentage of processor time spent idling as seen by the guest.
memTotal Total amount of physical guest RAM.
memFree Free amount of physical guest RAM.
memBalloon Amount of ballooned physical guest RAM.
memShared Amount of shared physical guest RAM.
memCache Total amount of guest (disk) cache memory.
pagedTotal Total amount of space in the page file.
memAllocTotal Total amount of memory allocated by the hypervisor.
memFreeTotal Total amount of free memory available in the hypervisor.
memBalloonTotal Total amount of memory ballooned by the hypervisor.
memSharedTotal Total amount of shared memory in the hypervisor.
vmNetRx Network receive rate for VM.
vmNetTx Network transmit rate for VM.
Passes statistics collected by VM (including guest statistics) to VBoxSVC.
5.102.23 runUSBDeviceFilters
void IInternalMachineControl::runUSBDeviceFilters(
[in] IUSBDevice device,
[out] boolean matched,
[out] unsigned long maskedInterfaces)
device
matched
maskedInterfaces
Asks the server to run USB devices filters of the associated machine against the given USB
device and tell if there is a match.
Note: 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).
187
5 Classes (interfaces)
5.102.24 unlockMedia
void IInternalMachineControl::unlockMedia()
5.102.25 updateState
void IInternalMachineControl::updateState(
[in] MachineState state)
state
Note: 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.
5.103 IInternalProgressControl
5.103.1 notifyComplete
void IInternalProgressControl::notifyComplete(
[in] long resultCode,
[in] IVirtualBoxErrorInfo errorInfo)
resultCode
errorInfo
5.103.2 notifyPointOfNoReturn
void IInternalProgressControl::notifyPointOfNoReturn()
5.103.3 setCurrentOperationProgress
void IInternalProgressControl::setCurrentOperationProgress(
[in] unsigned long percent)
percent
188
5 Classes (interfaces)
5.103.4 setNextOperation
void IInternalProgressControl::setNextOperation(
[in] wstring nextOperationDescription,
[in] unsigned long nextOperationsWeight)
nextOperationDescription
nextOperationsWeight
5.103.5 waitForOtherProgressCompletion
void IInternalProgressControl::waitForOtherProgressCompletion(
[in] IProgress progressOther,
[in] unsigned long timeoutMS)
5.104 IInternalSessionControl
5.104.1 Attributes
5.104.1.1 PID (read-only)
unsigned long IInternalSessionControl::PID
189
5 Classes (interfaces)
Returns suitable machine state for the VM execution state. Useful for choosing a sensible ma-
chine state after a complex operation which failed or otherwise resulted in an unclear situation.
5.104.2 accessGuestProperty
void IInternalSessionControl::accessGuestProperty(
[in] wstring name,
[in] wstring value,
[in] wstring flags,
[in] unsigned long accessMode,
[out] wstring retValue,
[out] long long retTimestamp,
[out] wstring retFlags)
5.104.3 assignRemoteMachine
void IInternalSessionControl::assignRemoteMachine(
[in] IMachine machine,
[in] IConsole console)
machine
console
Assigns the machine and the (remote) console object associated with this remote-type session.
If this method fails, the following error codes may be reported:
5.104.4 cancelSaveStateWithReason
void IInternalSessionControl::cancelSaveStateWithReason()
190
5 Classes (interfaces)
5.104.5 enableVMMStatistics
void IInternalSessionControl::enableVMMStatistics(
[in] boolean enable)
5.104.6 enumerateGuestProperties
void IInternalSessionControl::enumerateGuestProperties(
[in] wstring patterns,
[out] wstring keys[],
[out] wstring values[],
[out] long long timestamps[],
[out] wstring flags[])
patterns The patterns to match the properties against as a comma-separated string. If this is
empty, all properties currently set will be returned.
keys The key names of the properties returned.
values The values of the properties returned. The array entries match the corresponding entries
in the key array.
timestamps The timestamps of the properties returned. The array entries match the corre-
sponding entries in the key array.
flags The flags of the properties returned. The array entries match the corresponding entries in
the key array.
Return a list of the guest properties matching a set of patterns along with their values, times-
tamps and flags.
If this method fails, the following error codes may be reported:
5.104.7 onAudioAdapterChange
void IInternalSessionControl::onAudioAdapterChange(
[in] IAudioAdapter audioAdapter)
audioAdapter
Triggerd when settings of the audio adapter of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
191
5 Classes (interfaces)
5.104.8 onBandwidthGroupChange
void IInternalSessionControl::onBandwidthGroupChange(
[in] IBandwidthGroup bandwidthGroup)
5.104.9 onCPUChange
void IInternalSessionControl::onCPUChange(
[in] unsigned long cpu,
[in] boolean add)
5.104.10 onCPUExecutionCapChange
void IInternalSessionControl::onCPUExecutionCapChange(
[in] unsigned long executionCap)
5.104.11 onClipboardFileTransferModeChange
void IInternalSessionControl::onClipboardFileTransferModeChange(
[in] boolean enabled)
5.104.12 onClipboardModeChange
void IInternalSessionControl::onClipboardModeChange(
[in] ClipboardMode clipboardMode)
5.104.13 onDnDModeChange
void IInternalSessionControl::onDnDModeChange(
[in] DnDMode dndMode)
192
5 Classes (interfaces)
5.104.14 onMediumChange
void IInternalSessionControl::onMediumChange(
[in] IMediumAttachment mediumAttachment,
[in] boolean force)
Triggered when attached media of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.15 onNetworkAdapterChange
void IInternalSessionControl::onNetworkAdapterChange(
[in] INetworkAdapter networkAdapter,
[in] boolean changeAdapter)
networkAdapter
changeAdapter
Triggered when settings of a network adapter of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.16 onParallelPortChange
void IInternalSessionControl::onParallelPortChange(
[in] IParallelPort parallelPort)
parallelPort
Triggered when settings of a parallel port of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.17 onRecordingChange
void IInternalSessionControl::onRecordingChange(
[in] boolean enable)
enable TODO
193
5 Classes (interfaces)
5.104.18 onSerialPortChange
void IInternalSessionControl::onSerialPortChange(
[in] ISerialPort serialPort)
serialPort
Triggered when settings of a serial port of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.19 onSharedFolderChange
void IInternalSessionControl::onSharedFolderChange(
[in] boolean global)
global
Triggered when a permanent (global or machine) shared folder has been created or removed.
Note: 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.
5.104.20 onShowWindow
void IInternalSessionControl::onShowWindow(
[in] boolean check,
[out] boolean canShow,
[out] long long winId)
check
canShow
winId
194
5 Classes (interfaces)
5.104.21 onStorageControllerChange
void IInternalSessionControl::onStorageControllerChange(
[in] uuid machineId,
[in] wstring controllerName)
Triggered when settings of a storage controller of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.22 onStorageDeviceChange
void IInternalSessionControl::onStorageDeviceChange(
[in] IMediumAttachment mediumAttachment,
[in] boolean remove,
[in] boolean silent)
Triggered when attached storage devices of the associated virtual machine have changed.
If this method fails, the following error codes may be reported:
5.104.23 onUSBControllerChange
void IInternalSessionControl::onUSBControllerChange()
Triggered when settings of the USB controller object of the associated virtual machine have
changed.
If this method fails, the following error codes may be reported:
5.104.24 onUSBDeviceAttach
void IInternalSessionControl::onUSBDeviceAttach(
[in] IUSBDevice device,
[in] IVirtualBoxErrorInfo error,
[in] unsigned long maskedInterfaces,
[in] wstring captureFilename)
device
195
5 Classes (interfaces)
error
maskedInterfaces
captureFilename
Triggered when a request to capture a USB device (as a result of matched USB filters or di-
rect call to IConsole::attachUSBDevice()) has completed. A nullerror object means success,
otherwise it describes a failure.
If this method fails, the following error codes may be reported:
• VBOX_E_INVALID_VM_STATE: Session state prevents operation.
• VBOX_E_INVALID_OBJECT_STATE: Session type prevents operation.
5.104.25 onUSBDeviceDetach
void IInternalSessionControl::onUSBDeviceDetach(
[in] uuid id,
[in] IVirtualBoxErrorInfo error)
id
error
Triggered when a request to release the USB device (as a result of machine termination or
direct call to IConsole::detachUSBDevice()) has completed. A nullerror object means success,
otherwise it describes a failure.
If this method fails, the following error codes may be reported:
• VBOX_E_INVALID_VM_STATE: Session state prevents operation.
• VBOX_E_INVALID_OBJECT_STATE: Session type prevents operation.
5.104.26 onVMProcessPriorityChange
void IInternalSessionControl::onVMProcessPriorityChange(
[in] VMProcPriority priority)
5.104.27 onVRDEServerChange
void IInternalSessionControl::onVRDEServerChange(
[in] boolean restart)
196
5 Classes (interfaces)
5.104.28 onlineMergeMedium
void IInternalSessionControl::onlineMergeMedium(
[in] IMediumAttachment mediumAttachment,
[in] unsigned long sourceIdx,
[in] unsigned long targetIdx,
[in] IProgress progress)
Triggers online merging of a hard disk. Used internally when deleting a snapshot while a VM
referring to the same hard disk chain is running.
If this method fails, the following error codes may be reported:
5.104.29 pauseWithReason
void IInternalSessionControl::pauseWithReason(
[in] Reason reason)
Internal method for triggering a VM pause with a specified reason code. The reason code can
be interpreted by device/drivers and thus it might behave slightly differently than a normal VM
pause.
See also: IConsole::pause()
If this method fails, the following error codes may be reported:
5.104.30 reconfigureMediumAttachments
void IInternalSessionControl::reconfigureMediumAttachments(
[in] IMediumAttachment attachments[])
Reconfigure all specified medium attachments in one go, making sure the current state corre-
sponds to the specified medium.
If this method fails, the following error codes may be reported:
197
5 Classes (interfaces)
5.104.31 resumeWithReason
void IInternalSessionControl::resumeWithReason(
[in] Reason reason)
Internal method for triggering a VM resume with a specified reason code. The reason code can
be interpreted by device/drivers and thus it might behave slightly differently than a normal VM
resume.
See also: IConsole::resume()
If this method fails, the following error codes may be reported:
5.104.32 saveStateWithReason
boolean IInternalSessionControl::saveStateWithReason(
[in] Reason reason,
[in] IProgress progress,
[in] ISnapshot snapshot,
[in] wstring stateFilePath,
[in] boolean pauseVM)
pauseVM The VM should be paused before saving state. It is automatically unpaused on error
in the “vanilla save state” case.
Internal method for triggering a VM save state with a specified reason code. The reason code
can be interpreted by device/drivers and thus it might behave slightly differently than a normal
VM save state.
This call is fully synchronous, and the caller is expected to have set the machine state appro-
priately (and has to set the follow-up machine state if this call failed).
See also: IMachine::saveState()
If this method fails, the following error codes may be reported:
5.104.33 uninitialize
void IInternalSessionControl::uninitialize()
Uninitializes (closes) this session. Used by VirtualBox to close the corresponding remote ses-
sion when the direct session dies or gets closed.
If this method fails, the following error codes may be reported:
198
5 Classes (interfaces)
5.104.34 updateMachineState
void IInternalSessionControl::updateMachineState(
[in] MachineState machineState)
machineState
Updates the machine state in the VM process. Must be called only in certain cases (see the
method implementation).
If this method fails, the following error codes may be reported:
5.105 IKeyboard
The IKeyboard interface represents the virtual machine’s keyboard. Used in IConsole::keyboard.
Use this interface to send keystrokes or the Ctrl-Alt-Del sequence to the virtual machine.
5.105.1 Attributes
5.105.1.1 keyboardLEDs (read-only)
KeyboardLED IKeyboard::keyboardLEDs[]
5.105.2 putCAD
void IKeyboard::putCAD()
Sends the Ctrl-Alt-Del sequence to the keyboard. This function is nothing special, it is just a
convenience function calling putScancodes() with the proper scancodes.
If this method fails, the following error codes may be reported:
5.105.3 putScancode
void IKeyboard::putScancode(
[in] long scancode)
scancode
199
5 Classes (interfaces)
5.105.4 putScancodes
unsigned long IKeyboard::putScancodes(
[in] long scancodes[])
scancodes
5.105.5 putUsageCode
void IKeyboard::putUsageCode(
[in] long usageCode,
[in] long usagePage,
[in] boolean keyRelease)
usageCode
usagePage
keyRelease
Sends a USB HID usage code and page to the keyboard. The keyRelease flag is set when the
key is being released.
If this method fails, the following error codes may be reported:
5.105.6 releaseKeys
void IKeyboard::releaseKeys()
Causes the virtual keyboard to release any keys which are currently pressed. Useful when host
and guest keyboard may be out of sync.
If this method fails, the following error codes may be reported:
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when the guest OS executes the KBD_CMD_SET_LEDS command to alter the state
of the keyboard LEDs.
5.106.1 Attributes
5.106.1.1 numLock (read-only)
boolean IKeyboardLedsChangedEvent::numLock
NumLock status.
200
5 Classes (interfaces)
CapsLock status.
ScrollLock status.
5.107 IMachine
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 IVirtualBox::machines[] 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 ISession 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 IVirtualBox::machines[] 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 the lockMachine() or launchVMProcess() methods. After the machine has been successfully
locked for a session, 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 IMachine 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 interface called
IConsole.
See also: ISession, IConsole
5.107.1 Attributes
5.107.1.1 parent (read-only)
IVirtualBox IMachine::parent
201
5 Classes (interfaces)
• parent
• id
• settingsFilePath
• accessible
• accessError
Note: 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 limi-
tation may be removed in future releases.
202
5 Classes (interfaces)
• 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 saveSettings() is called.
If any of the above limitations are hit, saveSettings() will return an appropriate error message
explaining the exact reason and the changes you made to this machine will not be saved.
Starting with VirtualBox 4.0, a “.vbox” extension of the settings file is recommended, but not
enforced. (Previous versions always used a generic “.xml” extension.)
5.107.1.7 id (read-only)
uuid IMachine::id
Array of machine group names of which this machine is a member. "" and "/" are synonyms
for the toplevel group. Each group is only listed once, however they are listed in no particular
order and there is no guarantee that there are no gaps in the group hierarchy (i.e. "/group",
"/group/subgroup/subsubgroup" is a valid result).
Note: This value may differ from the value returned by IGuest::OSTypeId if Guest
Additions are installed to the guest OS.
203
5 Classes (interfaces)
The UUID presented to the guest via memory tables, hardware and guest properties. For most
VMs this is the same as the id, but for VMs which have been cloned or teleported it may be the
same as the source VM. The latter is because the guest shouldn’t notice that it was cloned or
teleported.
This setting determines whether VirtualBox allows CPU hotplugging for this machine.
Means to limit the number of CPU cycles a guest can use. The unit is percentage of host CPU
cycles per second. The valid range is 1 - 100. 100 (the default) implies no limit.
Virtual CPUID portability level, the higher number the fewer newer or vendor specific CPU
feature is reported to the guest (via the CPUID instruction). The default level of zero (0) means
that all virtualized features supported by the host is pass thru to the guest. While the three (3)
is currently the level supressing the most features.
Exactly which of the CPUID features are left out by the VMM at which level is subject to change
with each major version.
This setting determines whether VirtualBox allows page fusion for this machine (64-bit hosts
only).
204
5 Classes (interfaces)
Type of firmware (such as legacy BIOS or EFI), used for initial bootstrap in this VM.
Type of pointing HID (such as mouse or tablet) used in this VM. The default is typically
“PS2Mouse” but can vary depending on the requirements of the guest operating system.
Type of keyboard HID used in this VM. The default is typically “PS2Keyboard” but can vary
depending on the requirements of the guest operating system.
This attribute controls if High Precision Event Timer (HPET) is enabled in this VM. Use this
property if you want to provide guests with additional time source, or if guest requires HPET to
function correctly. Default is false.
205
5 Classes (interfaces)
Full path to the directory used to store snapshot data (differencing media 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.
Note: Setting this property to null or to an empty string will restore the initial value.
Note: 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.
Note: The specified path may not exist, it will be created when necessary.
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
206
5 Classes (interfaces)
Note: If USB functionality is not available in the given edition of VirtualBox, this
method will set the result code to E_NOTIMPL.
Whether the settings of this machine have been modified (but neither yet saved nor discarded).
Note: For newly created unregistered machines, the value of this property is al-
ways true until saveSettings() 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).
207
5 Classes (interfaces)
Name of the session. If sessionState is Spawning or Locked, this attribute contains the same
value as passed to the launchVMProcess() method in the name parameter. If the session was
established with lockMachine(), it is the name of the session (if set, otherwise empty string). If
sessionState is SessionClosed, the value of this attribute is an empty string.
Identifier of the session process. This attribute contains the platform-dependent identifier of
the process whose session was used with lockMachine() call. The returned value is only valid if
sessionState is Locked or Unlocking by the time this property is read.
Timestamp 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 Saved state.
Note: When the machine is not in the Saved state, this attribute is an empty string.
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 (up to VBox.log.3 in the current version).
Current snapshot of this machine. This is null if the machine currently has no snapshots. If
it is not null, then it was set by one of takeSnapshot(), deleteSnapshot() or restoreSnapshot(),
depending on which was called last. See ISnapshot for details.
208
5 Classes (interfaces)
Number of snapshots taken on this machine. Zero means the machine doesn’t have any snap-
shots.
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 only directly after one of the following
calls are made:
• restoreSnapshot()
• takeSnapshot() (issued on a “powered off” or “saved” machine, for which settingsModified
returns false)
The current state remains identical until one of the following happens:
Note: 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 createSharedFolder(). Existing shared
folders can be removed using removeSharedFolder().
Synchronization mode between the host OS clipboard and the guest OS clipboard.
209
5 Classes (interfaces)
When set to true, the virtual machine becomes a target teleporter the next time it is powered
on. This can only set to true when the VM is in the PoweredOff or Aborted state.
The TCP port the target teleporter will listen for incoming teleportations on.
0 means the port is automatically selected upon power on. The actual value can be read from
this property while the machine is waiting for incoming teleportations.
The address the target teleporter will listen on. If set to an empty string, it will listen on all
addresses.
The password to check for on the target teleporter. This is just a very basic measure to prevent
simple hacks and operators accidentally beaming a virtual machine to the wrong place.
Note that you SET a plain text password while reading back a HASHED password. Setting a
hashed password is currently not supported.
When set to true, the RTC device of the virtual machine will run in UTC time, otherwise in
local time. Especially Unix guests prefer the time in UTC.
When set to true, the builtin I/O cache of the virtual machine will be enabled.
210
5 Classes (interfaces)
Array of PCI devices assigned to this machine, to get list of all PCI devices attached to the
machine use IConsole::attachedPCIDevices[] attribute, as this attribute is intended to list only
devices additional to what described in virtual hardware config. Usually, this list keeps host’s
physical devices assigned to the particular machine.
Enables the tracing facility in the VMM (including PDM devices + drivers). The VMM will
consume about 0.5MB of more memory when enabled and there may be some extra overhead
from tracepoints that are always enabled.
Tracepoint configuration to apply at startup when tracingEnabled is true. The string speci-
fies a space separated of tracepoint group names to enable. The special group ’all’ enables all
tracepoints. Check DBGFR3TracingConfig for more details on available tracepoint groups and
such.
Note that on hosts supporting DTrace (or similar), a lot of the tracepoints may be implemented
exclusively as DTrace probes. So, the effect of the same config may differ between Solaris and
Windows for example.
Enables tracepoints in PDM devices and drivers to use the VMCPU or VM structures when
firing off trace points. This is especially useful with DTrace tracepoints, as it allows you to use
the VMCPU or VM pointer to obtain useful information such as guest register state.
This is disabled by default because devices and drivers normally has no business accessing the
VMCPU or VM structures, and are therefore unable to get any pointers to these.
211
5 Classes (interfaces)
Number of seconds to wait until the VM should be started during system boot.
Selects which VM frontend should be used by default when launching this VM through the
launchVMProcess() method. Empty or null strings do not define a particular default, it is up
to launchVMProcess() to select one. See the description of launchVMProcess() for the valid
frontend types.
This per-VM setting overrides the default defined by ISystemProperties::defaultFrontend at-
tribute, and is overridden by a frontend type passed to launchVMProcess().
Sets the priority of the VM process. It is a VM setting which can be changed both before
starting the VM and at runtime.
The default value is ’Default’, which selects the default process priority.
Experimental feature to select the guest CPU profile. The default is “host”, which indicates the
host CPU. All other names are subject to change.
The profiles are found in src/VBox/VMM/VMMR3/cpus/.
212
5 Classes (interfaces)
5.107.2 addStorageController
IStorageController IMachine::addStorageController(
[in] wstring name,
[in] StorageBus connectionType)
name
connectionType
Adds a new storage controller (SCSI, SAS or SATA controller) to the machine and returns it as
an instance of IStorageController.
name identifies the controller for subsequent calls such as getStorageControllerByName(),
getStorageControllerByInstance(), removeStorageController(), attachDevice() or
mountMedium().
After the controller has been added, you can set its exact type by setting the
IStorageController::controllerType.
If this method fails, the following error codes may be reported:
• VBOX_E_OBJECT_IN_USE: A storage controller with given name exists already.
• E_INVALIDARG: Invalid controllerType.
5.107.3 addUSBController
IUSBController IMachine::addUSBController(
[in] wstring name,
[in] USBControllerType type)
name
type
Adds a new USB controller to the machine and returns it as an instance of IUSBController.
If this method fails, the following error codes may be reported:
• VBOX_E_OBJECT_IN_USE: A USB controller with given type exists already.
• E_INVALIDARG: Invalid controllerType.
5.107.4 adoptSavedState
void IMachine::adoptSavedState(
[in] wstring savedStateFile)
Note: 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, storage disk configuration etc.). If there is a mismatch, the behavior of the virtual
machine is undefined.
213
5 Classes (interfaces)
5.107.5 applyDefaults
void IMachine::applyDefaults(
[in] wstring flags)
Applies the defaults for the configured guest OS type. This is primarily for getting sane settings
straight after creating a new VM, but it can also be applied later.
Note: This is primarily a shortcut, centralizing the tedious job of getting the recom-
mended settings and translating them into settings updates. The settings are made at
the end of the call, but not saved.
• VBOX_E_OBJECT_IN_USE: Some of the applied objects already exist. The method has
been called to already configured machine.
5.107.6 attachDevice
void IMachine::attachDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] DeviceType type,
[in] IMedium medium)
type Device type of the attached device. For media opened by IVirtualBox::openMedium(), this
must match the device type specified there.
medium Medium to mount or null for an empty drive.
Attaches a device and optionally mounts a medium to the given storage controller
(IStorageController, identified by name), at the indicated port and device.
This method is intended for managing storage devices in general while a machine is powered
off. It can be used to attach and detach fixed and removable media. The following kind of media
can be attached to a machine:
• For fixed and removable media, you can pass in a medium that was previously opened
using IVirtualBox::openMedium().
214
5 Classes (interfaces)
• Only for storage devices supporting removable media (such as DVDs and floppies), you
can also specify a null pointer to indicate an empty drive or one of the medium objects
listed in the IHost::DVDDrives[] and IHost::floppyDrives[] arrays to indicate a host drive.
For removable devices, you can also use mountMedium() to change the media while the
machine is running.
In a VM’s default configuration of virtual machines, the secondary master of the IDE controller
is used for a CD/DVD drive.
After calling this returns successfully, a new instance of IMediumAttachment will appear in the
machine’s list of medium attachments (see mediumAttachments[]).
See IMedium and IMediumAttachment for more information about attaching media.
The specified device slot must not have a device attached to it, or this method will fail.
Note: You cannot attach a device to a newly created machine until this machine’s
settings are saved to disk using saveSettings().
Note: If the medium is being attached indirectly, a new differencing medium will
implicitly be created for it and attached instead. If the changes made to the machine
settings (including this indirect attachment) are later cancelled using discardSettings(),
this implicitly created differencing medium will implicitly be deleted.
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range, or file or UUID
not found.
• VBOX_E_INVALID_OBJECT_STATE: Machine must be registered before media can be at-
tached.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
• VBOX_E_OBJECT_IN_USE: A medium is already attached to this or another virtual ma-
chine.
5.107.7 attachDeviceWithoutMedium
void IMachine::attachDeviceWithoutMedium(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] DeviceType type)
215
5 Classes (interfaces)
Attaches a device and optionally mounts a medium to the given storage controller
(IStorageController, identified by name), at the indicated port and device.
This method is intended for managing storage devices in general while a machine is powered
off. It can be used to attach and detach fixed and removable media. The following kind of media
can be attached to a machine:
• For fixed and removable media, you can pass in a medium that was previously opened
using IVirtualBox::openMedium().
• Only for storage devices supporting removable media (such as DVDs and floppies) with
an empty drive or one of the medium objects listed in the IHost::DVDDrives[] and
IHost::floppyDrives[] arrays to indicate a host drive. For removable devices, you can also
use mountMedium() to change the media while the machine is running.
In a VM’s default configuration of virtual machines, the secondary master of the IDE controller
is used for a CD/DVD drive. IMediumAttachment will appear in the machine’s list of medium
attachments (see mediumAttachments[]).
See IMedium and IMediumAttachment for more information about attaching media.
The specified device slot must not have a device attached to it, or this method will fail.
Note: You cannot attach a device to a newly created machine until this machine’s
settings are saved to disk using saveSettings().
Note: If the medium is being attached indirectly, a new differencing medium will
implicitly be created for it and attached instead. If the changes made to the machine
settings (including this indirect attachment) are later cancelled using discardSettings(),
this implicitly created differencing medium will implicitly be deleted.
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range, or file or UUID
not found.
• VBOX_E_INVALID_OBJECT_STATE: Machine must be registered before media can be at-
tached.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
• VBOX_E_OBJECT_IN_USE: A medium is already attached to this or another virtual ma-
chine.
5.107.8 attachHostPCIDevice
void IMachine::attachHostPCIDevice(
[in] long hostAddress,
[in] long desiredGuestAddress,
[in] boolean tryToUnbind)
216
5 Classes (interfaces)
Attaches host PCI device with the given (host) PCI address to the PCI bus of the virtual ma-
chine. Please note, that this operation is two phase, as real attachment will happen when VM
will start, and most information will be delivered as IHostPCIDevicePlugEvent on IVirtualBox
event source.
See also: IHostPCIDevicePlugEvent
If this method fails, the following error codes may be reported:
• VBOX_E_INVALID_VM_STATE: Virtual machine state is not stopped (PCI hotplug not yet
implemented).
• VBOX_E_PDM_ERROR: Virtual machine does not have a PCI controller allowing attachment
of physical devices.
• VBOX_E_NOT_SUPPORTED: Hardware or host OS doesn’t allow PCI device passthrough.
5.107.9 canShowConsoleWindow
boolean IMachine::canShowConsoleWindow()
Returns true if the VM console process can activate the console window and bring it to fore-
ground on the desktop of the host PC.
Note: This method will fail if a session for this machine is not currently open.
5.107.10 cloneTo
IProgress IMachine::cloneTo(
[in] IMachine target,
[in] CloneMode mode,
[in] CloneOptions options[])
Creates a clone of this machine, either as a full clone (which means creating independent
copies of the hard disk media, save states and so on), or as a linked clone (which uses its own
differencing media, sharing the parent media with the source machine).
The target machine object must have been created previously with
IVirtualBox::createMachine(), and all the settings will be transferred except the VM name
and the hardware UUID. You can set the VM name and the new hardware UUID when creating
the target machine. The network MAC addresses are newly created for all enabled network
adapters. You can change that behaviour with the options parameter. The operation is performed
asynchronously, so the machine object will be not be usable until the progress object signals
completion.
If this method fails, the following error codes may be reported:
217
5 Classes (interfaces)
5.107.11 createSharedFolder
void IMachine::createSharedFolder(
[in] wstring name,
[in] wstring hostPath,
[in] boolean writable,
[in] boolean automount,
[in] wstring autoMountPoint)
hostPath Full path to the shared folder in the host file system.
writable Whether the share is writable or read-only.
automount Whether the share gets automatically mounted by the guest or not.
autoMountPoint Where the guest should automatically mount the folder, if possible. For Win-
dows and OS/2 guests this should be a drive letter, while other guests it should be a
absolute directory.
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 ISharedFolder to read more about logical names.
If this method fails, the following error codes may be reported:
5.107.12 deleteConfig
IProgress IMachine::deleteConfig(
[in] IMedium media[])
media List of media to be closed and whose storage files will be deleted.
Deletes the files associated with this machine from disk. If medium objects are passed in
with the aMedia argument, they are closed and, if closing was successful, their storage files are
deleted as well. For convenience, this array of media files can be the same as the one returned
from a previous unregister() call.
This method must only be called on machines which are either write-locked (i.e. on instances
returned by ISession::machine) or on unregistered machines (i.e. not yet registered machines
created by IVirtualBox::createMachine() or opened by IVirtualBox::openMachine(), or after hav-
ing called unregister()).
The following files will be deleted by this method:
• If unregister() had been previously called with a cleanupMode argument other than “Un-
registerOnly”, this will delete all saved state files that the machine had in use; possibly one
if the machine was in “Saved” state and one for each online snapshot that the machine had.
• On each medium object passed in the aMedia array, this will call IMedium::close().
If that succeeds, this will attempt to delete the medium’s storage on disk. Since the
IMedium::close() call will fail if the medium is still in use, e.g. because it is still attached
to a second machine; in that case the storage will not be deleted.
• Finally, the machine’s own XML file will be deleted.
218
5 Classes (interfaces)
Since deleting large disk image files can be a time-consuming I/O operation, this method oper-
ates asynchronously and returns an IProgress object to allow the caller to monitor the progress.
There will be one sub-operation for each file that is being deleted (saved state or medium storage
file).
Note: settingsModified will return true after this method successfully returns.
5.107.13 deleteGuestProperty
void IMachine::deleteGuestProperty(
[in] wstring name)
5.107.14 deleteSnapshot
IProgress IMachine::deleteSnapshot(
[in] uuid id)
Starts deleting the specified snapshot asynchronously. See ISnapshot for an introduction to
snapshots.
The execution state and settings of the associated machine stored in the snapshot will be
deleted. The contents of all differencing media of this snapshot will be merged with the contents
of their dependent child media to keep the medium chain valid (in other words, all changes
represented by media being deleted will be propagated to their child medium). After that, this
snapshot’s differencing medium will be deleted. The parent of this snapshot will become a new
parent for all its child snapshots.
If the deleted 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 media based on media of the deleted snapshot will be also merged as
described above.
If the deleted snapshot is the first or current snapshot, then the respective IMachine attributes
will be adjusted. Deleting the current snapshot will also implicitly call saveSettings() to make all
current machine settings permanent.
Deleting a snapshot has the following preconditions:
• Child media of all normal media of the deleted snapshot must be accessible (see
IMedium::state) for this operation to succeed. If only one running VM refers to all images
which participates in merging the operation can be performed while the VM is running.
Otherwise all virtual machines whose media are directly or indirectly based on the media
of deleted snapshot must be powered off. In any case, online snapshot deleting usually is
slower than the same operation without any running VM.
219
5 Classes (interfaces)
• You cannot delete the snapshot if a medium attached to it has more than one child medium
(differencing images) because otherwise merging would be impossible. This might be the
case if there is more than one child snapshot or differencing images were created for other
reason (e.g. implicitly because of multiple machine attachments).
Note: Merging medium contents can be very time and disk space consuming, if these
media are big in size and have many children. However, if the snapshot being deleted
is the last (head) snapshot on the branch, the operation will be rather quick.
5.107.15 deleteSnapshotAndAllChildren
IProgress IMachine::deleteSnapshotAndAllChildren(
[in] uuid id)
Starts deleting the specified snapshot and all its children asynchronously. See ISnapshot
for an introduction to snapshots. The conditions and many details are the same as with
deleteSnapshot().
This operation is very fast if the snapshot subtree does not include the current state. It is still
significantly faster than deleting the snapshots one by one if the current state is in the subtree and
there are more than one snapshots from current state to the snapshot which marks the subtree,
since it eliminates the incremental image merging.
5.107.16 deleteSnapshotRange
IProgress IMachine::deleteSnapshotRange(
[in] uuid startId,
[in] uuid endId)
220
5 Classes (interfaces)
Starts deleting the specified snapshot range. This is limited to linear snapshot lists, which
means there may not be any other child snapshots other than the direct sequence between the
start and end snapshot. If the start and end snapshot point to the same snapshot this method is
completely equivalent to deleteSnapshot(). See ISnapshot for an introduction to snapshots. The
conditions and many details are the same as with deleteSnapshot().
This operation is generally faster than deleting snapshots one by one and often also needs less
extra disk space before freeing up disk space by deleting the removed disk images corresponding
to the snapshot.
5.107.17 detachDevice
void IMachine::detachDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device)
221
5 Classes (interfaces)
5.107.18 detachHostPCIDevice
void IMachine::detachHostPCIDevice(
[in] long hostAddress)
5.107.19 discardSavedState
void IMachine::discardSavedState(
[in] boolean fRemoveFile)
Note: This operation is equivalent to resetting or powering off the machine without
doing a proper shutdown of the guest operating system; as with resetting a running
phyiscal computer, it can can lead to data loss.
If fRemoveFile is true, the file in the machine directory into which the machine state was
saved is also deleted. If this is false, then the state can be recovered and later re-inserted into
a machine using adoptSavedState(). The location of the file can be found in the stateFilePath
attribute.
If this method fails, the following error codes may be reported:
• VBOX_E_INVALID_VM_STATE: Virtual machine not in state Saved.
5.107.20 discardSettings
void IMachine::discardSettings()
Discards any changes to the machine settings made since the session has been opened or since
the last call to saveSettings() or discardSettings().
222
5 Classes (interfaces)
5.107.21 enumerateGuestProperties
void IMachine::enumerateGuestProperties(
[in] wstring patterns,
[out] wstring names[],
[out] wstring values[],
[out] long long timestamps[],
[out] wstring flags[])
patterns The patterns to match the properties against, separated by ’|’ characters. If this is
empty or null, all properties will match.
names The names of the properties returned.
values The values of the properties returned. The array entries match the corresponding entries
in the name array.
timestamps The timestamps of the properties returned. The array entries match the corre-
sponding entries in the name array.
flags The flags of the properties returned. The array entries match the corresponding entries in
the name array.
Return a list of the guest properties matching a set of patterns along with their values, times-
tamps and flags.
5.107.22 exportTo
IVirtualSystemDescription IMachine::exportTo(
[in] IAppliance appliance,
[in] wstring location)
Exports the machine to an OVF appliance. See IAppliance for the steps required to export
VirtualBox machines to OVF.
5.107.23 findSnapshot
ISnapshot IMachine::findSnapshot(
[in] wstring nameOrId)
223
5 Classes (interfaces)
5.107.24 getBootOrder
DeviceType IMachine::getBootOrder(
[in] unsigned long position)
position Position in the boot order (1 to the total number of devices the machine can boot from,
as returned by ISystemProperties::maxBootPosition).
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 Null is returned.
@todo getHardDiskBootOrder(), getNetworkBootOrder()
If this method fails, the following error codes may be reported:
5.107.25 getCPUIDLeaf
void IMachine::getCPUIDLeaf(
[in] unsigned long idx,
[in] unsigned long idxSub,
[out] unsigned long valEax,
[out] unsigned long valEbx,
[out] unsigned long valEcx,
[out] unsigned long valEdx)
Returns the virtual CPU cpuid information for the specified leaf.
Currently supported index values for cpuid: Standard CPUID leaves: 0 - 0x1f Extended CPUID
leaves: 0x80000000 - 0x8000001f VIA CPUID leaves: 0xc0000000 - 0xc000000f
See the Intel, AMD and VIA programmer’s manuals for detailed information about the CPUID
instruction and its leaves.
If this method fails, the following error codes may be reported:
5.107.26 getCPUIDLeafByOrdinal
void IMachine::getCPUIDLeafByOrdinal(
[in] unsigned long ordinal,
[out] unsigned long idx,
[out] unsigned long idxSub,
[out] unsigned long valEax,
[out] unsigned long valEbx,
[out] unsigned long valEcx,
[out] unsigned long valEdx)
224
5 Classes (interfaces)
5.107.27 getCPUProperty
boolean IMachine::getCPUProperty(
[in] CPUPropertyType property)
5.107.28 getCPUStatus
boolean IMachine::getCPUStatus(
[in] unsigned long cpu)
5.107.29 getEffectiveParavirtProvider
ParavirtProvider IMachine::getEffectiveParavirtProvider()
5.107.30 getExtraData
wstring IMachine::getExtraData(
[in] wstring key)
225
5 Classes (interfaces)
5.107.31 getExtraDataKeys
wstring[] IMachine::getExtraDataKeys()
Returns an array representing the machine-specific extra data keys which currently have values
defined.
5.107.32 getGuestProperty
void IMachine::getGuestProperty(
[in] wstring name,
[out] wstring value,
[out] long long timestamp,
[out] wstring flags)
5.107.33 getGuestPropertyTimestamp
long long IMachine::getGuestPropertyTimestamp(
[in] wstring property)
5.107.34 getGuestPropertyValue
wstring IMachine::getGuestPropertyValue(
[in] wstring property)
226
5 Classes (interfaces)
5.107.35 getHWVirtExProperty
boolean IMachine::getHWVirtExProperty(
[in] HWVirtExPropertyType property)
5.107.36 getMedium
IMedium IMachine::getMedium(
[in] wstring name,
[in] long controllerPort,
[in] long device)
Returns the virtual medium attached to a device slot of the specified bus.
Note that if the medium was indirectly attached by mountMedium() to the given device slot
then this method will return not the same object as passed to the mountMedium() call. See
IMedium for more detailed information about mounting a medium.
If this method fails, the following error codes may be reported:
5.107.37 getMediumAttachment
IMediumAttachment IMachine::getMediumAttachment(
[in] wstring name,
[in] long controllerPort,
[in] long device)
name
controllerPort
device
Returns a medium attachment which corresponds to the controller with the given name, on
the given port and device slot.
If this method fails, the following error codes may be reported:
227
5 Classes (interfaces)
5.107.38 getMediumAttachmentsOfController
IMediumAttachment[] IMachine::getMediumAttachmentsOfController(
[in] wstring name)
name
Returns an array of medium attachments which are attached to the the controller with the
given name.
If this method fails, the following error codes may be reported:
5.107.39 getNetworkAdapter
INetworkAdapter IMachine::getNetworkAdapter(
[in] unsigned long slot)
slot
Returns the network adapter associated with the given slot. Slots are numbered sequen-
tially, starting with zero. The total number of adapters per machine is defined by the
ISystemProperties::getMaxNetworkAdapters() property, so the maximum slot number is one less
than that property’s value.
If this method fails, the following error codes may be reported:
5.107.40 getParallelPort
IParallelPort IMachine::getParallelPort(
[in] unsigned long slot)
slot
Returns the parallel port associated with the given slot. Slots are numbered sequen-
tially, starting with zero. The total number of parallel ports per machine is defined by the
ISystemProperties::parallelPortCount property, so the maximum slot number is one less than
that property’s value.
If this method fails, the following error codes may be reported:
5.107.41 getSerialPort
ISerialPort IMachine::getSerialPort(
[in] unsigned long slot)
slot
Returns the serial port associated with the given slot. Slots are numbered sequen-
tially, starting with zero. The total number of serial ports per machine is defined by the
ISystemProperties::serialPortCount property, so the maximum slot number is one less than that
property’s value.
If this method fails, the following error codes may be reported:
228
5 Classes (interfaces)
5.107.42 getStorageControllerByInstance
IStorageController IMachine::getStorageControllerByInstance(
[in] StorageBus connectionType,
[in] unsigned long instance)
connectionType
instance
Returns a storage controller of a specific storage bus with the given instance number.
If this method fails, the following error codes may be reported:
5.107.43 getStorageControllerByName
IStorageController IMachine::getStorageControllerByName(
[in] wstring name)
name
5.107.44 getUSBControllerByName
IUSBController IMachine::getUSBControllerByName(
[in] wstring name)
name
5.107.45 getUSBControllerCountByType
unsigned long IMachine::getUSBControllerCountByType(
[in] USBControllerType type)
type
Returns the number of USB controllers of the given type attached to the VM.
5.107.46 hotPlugCPU
void IMachine::hotPlugCPU(
[in] unsigned long cpu)
229
5 Classes (interfaces)
5.107.47 hotUnplugCPU
void IMachine::hotUnplugCPU(
[in] unsigned long cpu)
5.107.48 launchVMProcess
IProgress IMachine::launchVMProcess(
[in] ISession session,
[in] wstring name,
[in] wstring environmentChanges[])
session Client session object to which the VM process will be connected (this must be in “Un-
locked” state).
name Front-end to use for the new VM process. The following are currently supported:
• "gui": VirtualBox Qt GUI front-end
• "headless": VBoxHeadless (VRDE Server) front-end
• "sdl": VirtualBox SDL front-end
• "emergencystop": reserved value, used for aborting the currently running VM or
session owner. In this case the session parameter may be null (if it is non-null
it isn’t used in any way), and the progress return value will be always null. The
operation completes immediately.
• "": use the per-VM default frontend if set, otherwise the global default defined in
the system properties. If neither are set, the API will launch a "gui" session, which
may fail if there is no windowing environment available. See defaultFrontend and
ISystemProperties::defaultFrontend.
environmentChanges The list of putenv-style changes to the VM process environment.
Spawns a new process that will execute the virtual machine and obtains a shared lock on the
machine for the calling session.
If launching the VM succeeds, the new VM process will create its own session and write-lock
the machine for it, preventing conflicting changes from other processes. If the machine is already
locked (because it is already running or because another session has a write lock), launching the
VM process will therefore fail. Reversely, future attempts to obtain a write lock will also fail
while the machine is running.
The caller’s session object remains separate from the session opened by the new VM process.
It receives its own IConsole object which can be used to control machine execution, but it cannot
be used to change all VM settings which would be available after a lockMachine() call.
The caller must eventually release the session’s shared lock by calling
ISession::unlockMachine() on the local session object once this call has returned. How-
ever, the session’s state (see ISession::state) will not return to “Unlocked” until the remote
session has also unlocked the machine (i.e. the machine has stopped running).
Launching a VM process 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 IProgress object is returned to
allow the caller to wait for this asynchronous operation to be completed. Until then, the caller’s
session object remains in the “Unlocked” state, and its ISession::machine and ISession::console
attributes cannot be accessed. It is recommended to use IProgress::waitForCompletion() or simi-
lar calls to wait for completion. Completion is signalled when the VM is powered on. If launching
the VM fails, error messages can be queried via the progress object, if available.
230
5 Classes (interfaces)
The progress object will have at least 2 sub-operations. The first operation covers the
period up to the new VM process calls powerUp. The subsequent operations mirror the
IConsole::powerUp() progress object. Because IConsole::powerUp() may require some extra
sub-operations, the IProgress::operationCount may change at the completion of operation.
For details on the teleportation progress operation, see IConsole::powerUp().
The environmentChanges argument is a list of strings where every string contains environ-
ment variable in the putenv style, i.e. “VAR=VALUE” for setting/replacing and “VAR” for unset-
ting. These environment variables will be applied 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 list is empty, the
server environment is inherited by the started process as is.
If this method fails, the following error codes may be reported:
5.107.49 lockMachine
void IMachine::lockMachine(
[in] ISession session,
[in] LockType lockType)
Locks the machine for the given session to enable the caller to make changes to the machine
or start the VM or control VM execution.
There are two ways to lock a machine for such uses:
• If you want to make changes to the machine settings, you must obtain an exclusive write
lock on the machine by setting lockType to Write.
This will only succeed if no other process has locked the machine to prevent conflicting
changes. Only after an exclusive write lock has been obtained using this method, one
can change all VM settings or execute the VM in the process space of the session object.
(Note that the latter is only of interest if you actually want to write a new front-end for
virtual machines; but this API gets called internally by the existing front-ends such as
VBoxHeadless and the VirtualBox GUI to acquire a write lock on the machine that they are
running.)
On success, write-locking the machine for a session creates a second copy of the IMachine
object. It is this second object upon which changes can be made; in VirtualBox terminology,
the second copy is “mutable”. It is only this second, mutable machine object upon which
you can call methods that change the machine state. After having called this method, you
can obtain this second, mutable machine object using the ISession::machine attribute.
231
5 Classes (interfaces)
• If you only want to check the machine state or control machine execution without actually
changing machine settings (e.g. to get access to VM statistics or take a snapshot or save
the machine state), then set the lockType argument to Shared.
If no other session has obtained a lock, you will obtain an exclusive write lock as described
above. However, if another session has already obtained such a lock, then a link to that
existing session will be established which allows you to control that existing session.
To find out which type of lock was obtained, you can inspect ISession::type, which will
have been set to either WriteLock or Shared.
In either case, you can get access to the IConsole object which controls VM execution.
Also in all of the above cases, one must always call ISession::unlockMachine() to release the
lock on the machine, or the machine’s state will eventually be set to “Aborted”.
To change settings on a machine, the following sequence is typically performed:
1. Call this method to obtain an exclusive write lock for the current session.
2. Obtain a mutable IMachine object from ISession::machine.
3. Change the settings of the machine by invoking IMachine methods.
4. Call saveSettings().
5. Release the write lock by calling ISession::unlockMachine().
5.107.50 mountMedium
void IMachine::mountMedium(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] IMedium medium,
[in] boolean force)
force Allows to force unmount/mount of a medium which is locked by the device slot in the
given port to attach the medium to.
Mounts a medium (IMedium, identified by the given UUID id) to the given storage controller
(IStorageController, identified by name), at the indicated port and device. The device must
already exist; see attachDevice() for how to attach a new device.
232
5 Classes (interfaces)
This method is intended only for managing removable media, where the device is fixed but
media is changeable at runtime (such as DVDs and floppies). It cannot be used for fixed media
such as hard disks.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
The specified device slot can have a medium mounted, which will be unmounted first. Speci-
fying a zero UUID (or an empty string) for medium does just an unmount.
See IMedium for more detailed information about attaching media.
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to attach medium to an unregistered virtual
machine.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
• VBOX_E_OBJECT_IN_USE: Medium already attached to this or another virtual machine.
5.107.51 moveTo
IProgress IMachine::moveTo(
[in] wstring folder,
[in] wstring type)
5.107.52 nonRotationalDevice
void IMachine::nonRotationalDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean nonRotational)
233
5 Classes (interfaces)
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to modify an unregistered virtual machine.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
5.107.53 passthroughDevice
void IMachine::passthroughDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean passthrough)
Sets the passthrough mode of an existing DVD device. Changing the setting while the VM is
running is forbidden. The setting is only used if at VM start the device is configured as a host
DVD drive, in all other cases it is ignored. The device must already exist; see attachDevice() for
how to attach a new device.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to modify an unregistered virtual machine.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
5.107.54 queryLogFilename
wstring IMachine::queryLogFilename(
[in] unsigned long idx)
Queries for the VM log file name of an given index. Returns an empty string if a log file with
that index doesn’t exists.
5.107.55 querySavedGuestScreenInfo
void IMachine::querySavedGuestScreenInfo(
[in] unsigned long screenId,
[out] unsigned long originX,
[out] unsigned long originY,
[out] unsigned long width,
[out] unsigned long height,
[out] boolean enabled)
234
5 Classes (interfaces)
width Guest width at the time of the saved state was taken.
height Guest height at the time of the saved state was taken.
enabled Whether the monitor is enabled in the guest.
5.107.56 querySavedScreenshotInfo
BitmapFormat[] IMachine::querySavedScreenshotInfo(
[in] unsigned long screenId,
[out] unsigned long width,
[out] unsigned long height)
Returns available formats and size of the screenshot from saved state.
5.107.57 readLog
octet[] IMachine::readLog(
[in] unsigned long idx,
[in] long long offset,
[in] long long size)
Reads the VM log file. The chunk size is limited, so even if you ask for a big piece there might
be less data returned.
5.107.58 readSavedScreenshotToArray
octet[] IMachine::readSavedScreenshotToArray(
[in] unsigned long screenId,
[in] BitmapFormat bitmapFormat,
[out] unsigned long width,
[out] unsigned long height)
235
5 Classes (interfaces)
5.107.59 readSavedThumbnailToArray
octet[] IMachine::readSavedThumbnailToArray(
[in] unsigned long screenId,
[in] BitmapFormat bitmapFormat,
[out] unsigned long width,
[out] unsigned long height)
5.107.60 removeAllCPUIDLeaves
void IMachine::removeAllCPUIDLeaves()
5.107.61 removeCPUIDLeaf
void IMachine::removeCPUIDLeaf(
[in] unsigned long idx,
[in] unsigned long idxSub)
Removes the virtual CPU cpuid leaf for the specified index
If this method fails, the following error codes may be reported:
5.107.62 removeSharedFolder
void IMachine::removeSharedFolder(
[in] wstring name)
Removes the permanent shared folder with the given name previously created by
createSharedFolder() from the collection of shared folders and stops sharing it.
If this method fails, the following error codes may be reported:
236
5 Classes (interfaces)
5.107.63 removeStorageController
void IMachine::removeStorageController(
[in] wstring name)
name
Removes a storage controller from the machine with all devices attached to it.
If this method fails, the following error codes may be reported:
5.107.64 removeUSBController
void IMachine::removeUSBController(
[in] wstring name)
name
5.107.65 restoreSnapshot
IProgress IMachine::restoreSnapshot(
[in] ISnapshot snapshot)
Starts resetting the machine’s current state to the state contained in the given snapshot, asyn-
chronously. All current settings of the machine will be reset and changes stored in differencing
media will be lost. See ISnapshot for an introduction to snapshots.
After this operation is successfully completed, new empty differencing media are created for
all normal media of the machine.
If the given snapshot is an online snapshot, the machine will go to the Saved, so that the next
time it is powered on, the execution state will be restored from the state of the snapshot.
Note: The machine must not be running, otherwise the operation will fail.
Note: If the machine state is Saved prior to this operation, the saved state file will be
implicitly deleted (as if discardSavedState() were called).
237
5 Classes (interfaces)
5.107.66 saveSettings
void IMachine::saveSettings()
Saves any changes to machine settings made since the session has been opened or a new ma-
chine has been created, or since the last call to saveSettings() or discardSettings(). For registered
machines, new settings become visible to all other VirtualBox clients after successful invocation
of this method.
Note: The method sends IMachineDataChangedEvent notification event after the con-
figuration has been successfully saved (only for registered machines).
Note: Calling this method is only valid on instances returned by ISession::machine and
on new machines created by IVirtualBox::createMachine() but not yet registered, or on
unregistered machines after calling unregister().
5.107.67 saveState
IProgress IMachine::saveState()
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 differenc-
ing media. 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.
Note: On success, this method implicitly calls saveSettings() to save all current ma-
chine settings (including runtime changes to the DVD medium, etc.). Together with
the impossibility to change any VM settings when it is in the Saved state, this guar-
antees adequate hardware configuration of the machine when it is restored from the
saved state file.
Note: The machine must be in the Running or Paused state, otherwise the operation
will fail.
238
5 Classes (interfaces)
5.107.68 setAutoDiscardForDevice
void IMachine::setAutoDiscardForDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean discard)
Sets a flag in the device information which indicates that the medium supports discarding
unused blocks (called trimming for SATA or unmap for SCSI devices) .This may or may not be
supported by a particular drive, and is silently ignored in the latter case. At the moment only
hard disks (which is a misnomer in this context) accept this setting. Changing the setting while
the VM is running is forbidden. The device must already exist; see attachDevice() for how to
attach a new device.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
If this method fails, the following error codes may be reported:
5.107.69 setBandwidthGroupForDevice
void IMachine::setBandwidthGroupForDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] IBandwidthGroup bandwidthGroup)
Sets the bandwidth group of an existing storage device. The device must already exist; see
attachDevice() for how to attach a new device.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to modify an unregistered virtual machine.
• VBOX_E_INVALID_VM_STATE: Invalid machine state.
239
5 Classes (interfaces)
5.107.70 setBootOrder
void IMachine::setBootOrder(
[in] unsigned long position,
[in] DeviceType device)
position Position in the boot order (1 to the total number of devices the machine can boot from,
as returned by ISystemProperties::maxBootPosition).
device The type of the device used to boot at the given position.
Puts the given device to the specified position in the boot order.
To indicate that no device is associated with the given position, Null should be used.
@todo setHardDiskBootOrder(), setNetworkBootOrder()
If this method fails, the following error codes may be reported:
5.107.71 setCPUIDLeaf
void IMachine::setCPUIDLeaf(
[in] unsigned long idx,
[in] unsigned long idxSub,
[in] unsigned long valEax,
[in] unsigned long valEbx,
[in] unsigned long valEcx,
[in] unsigned long valEdx)
Sets the virtual CPU cpuid information for the specified leaf. Note that these values are not
passed unmodified. VirtualBox clears features that it doesn’t support.
Currently supported index values for cpuid: Standard CPUID leaves: 0 - 0x1f Extended CPUID
leaves: 0x80000000 - 0x8000001f VIA CPUID leaves: 0xc0000000 - 0xc000000f
The subleaf index is only applicable to certain leaves (see manuals as this is subject to change).
See the Intel, AMD and VIA programmer’s manuals for detailed information about the cpuid
instruction and its leaves.
Do not use this method unless you know exactly what you’re doing. Misuse can lead to random
crashes inside VMs.
If this method fails, the following error codes may be reported:
240
5 Classes (interfaces)
5.107.72 setCPUProperty
void IMachine::setCPUProperty(
[in] CPUPropertyType property,
[in] boolean value)
5.107.73 setExtraData
void IMachine::setExtraData(
[in] wstring key,
[in] wstring value)
Note: Before performing the actual data change, this method will ask all registered
event listeners using the IExtraDataCanChangeEvent notification for a permission. If
one of the listeners refuses the new value, the change will not be performed.
Note: 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.
241
5 Classes (interfaces)
5.107.74 setGuestProperty
void IMachine::setGuestProperty(
[in] wstring property,
[in] wstring value,
[in] wstring flags)
5.107.75 setGuestPropertyValue
void IMachine::setGuestPropertyValue(
[in] wstring property,
[in] wstring value)
5.107.76 setHWVirtExProperty
void IMachine::setHWVirtExProperty(
[in] HWVirtExPropertyType property,
[in] boolean value)
242
5 Classes (interfaces)
5.107.77 setHotPluggableForDevice
void IMachine::setHotPluggableForDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean hotPluggable)
Sets a flag in the device information which indicates that the attached device is hot pluggable
or not. This may or may not be supported by a particular controller and/or drive, and is silently
ignored in the latter case. Changing the setting while the VM is running is forbidden. The device
must already exist; see attachDevice() for how to attach a new device.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to modify an unregistered virtual machine.
5.107.78 setNoBandwidthGroupForDevice
void IMachine::setNoBandwidthGroupForDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device)
Sets no bandwidth group for an existing storage device. The device must already exist; see
attachDevice() for how to attach a new device. The controllerPort and device parameters
specify the device slot and have have the same meaning as with attachDevice().
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to modify an unregistered virtual machine.
243
5 Classes (interfaces)
5.107.79 setSettingsFilePath
IProgress IMachine::setSettingsFilePath(
[in] wstring settingsFilePath)
settingsFilePath New settings file path, will be used to determine the new location for the
attached media if it is in the same directory or below as the original settings file.
Currently, it is an error to change this property on any machine. Later this will allow setting a
new path for the settings file, with automatic relocation of all files (including snapshots and disk
images) which are inside the base directory. This operation is only allowed when there are no
pending unsaved settings.
Note: Setting this property to null or to an empty string is forbidden. When setting
this property, the specified path must be absolute. The specified path may not exist, it
will be created when necessary.
5.107.80 setStorageControllerBootable
void IMachine::setStorageControllerBootable(
[in] wstring name,
[in] boolean bootable)
name
bootable
Sets the bootable flag of the storage controller with the given name.
If this method fails, the following error codes may be reported:
5.107.81 showConsoleWindow
long long IMachine::showConsoleWindow()
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.
Note: This method will fail if a session for this machine is not currently open.
244
5 Classes (interfaces)
5.107.82 takeSnapshot
IProgress IMachine::takeSnapshot(
[in] wstring name,
[in] wstring description,
[in] boolean pause,
[out] uuid id)
Note: This method implicitly calls saveSettings() to save all current machine settings
before taking an offline snapshot.
5.107.83 temporaryEjectDevice
void IMachine::temporaryEjectDevice(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean temporaryEject)
245
5 Classes (interfaces)
5.107.84 unmountMedium
void IMachine::unmountMedium(
[in] wstring name,
[in] long controllerPort,
[in] long device,
[in] boolean force)
Unmounts any currently mounted medium (IMedium, identified by the given UUID id) to
the given storage controller (IStorageController, identified by name), at the indicated port and
device. The device must already exist;
This method is intended only for managing removable media, where the device is fixed but
media is changeable at runtime (such as DVDs and floppies). It cannot be used for fixed media
such as hard disks.
The controllerPort and device parameters specify the device slot and have have the same
meaning as with attachDevice().
The specified device slot must have a medium mounted, which will be unmounted. If there
is no mounted medium it will do nothing. See IMedium for more detailed information about
attaching/unmounting media.
If this method fails, the following error codes may be reported:
• E_INVALIDARG: SATA device, SATA port, IDE port or IDE slot out of range.
• VBOX_E_INVALID_OBJECT_STATE: Attempt to unmount medium that is not removable -
not DVD or floppy.
5.107.85 unregister
IMedium[] IMachine::unregister(
[in] CleanupMode cleanupMode)
246
5 Classes (interfaces)
• With “UnregisterOnly”, the machine will only be unregistered, but no additional cleanup
will be performed. The call will fail if the machine is in “Saved” state or has any snapshots
or any media attached (see IMediumAttachment). It is the responsibility of the caller to
delete all such configuration in this mode. In this mode, the API behaves like the former
IVirtualBox::unregisterMachine() API which it replaces.
• With “DetachAllReturnNone”, the call will succeed even if the machine is in “Saved” state
or if it has snapshots or media attached. All media attached to the current machine state
or in snapshots will be detached. No medium objects will be returned; all of the machine’s
media will remain open.
• With “DetachAllReturnHardDisksOnly”, the call will behave like with “DetachAllReturn-
None”, except that all the hard disk medium objects which were detached from the machine
will be returned as an array. This allows for quickly passing them to the deleteConfig() API
for closing and deletion.
• With “Full”, the call will behave like with “DetachAllReturnHardDisksOnly”, except that all
media will be returned in the array, including removable media like DVDs and floppies.
This might be useful if the user wants to inspect in detail which media were attached to the
machine. Be careful when passing the media array to deleteConfig() in that case because
users will typically want to preserve ISO and RAW image files.
A typical implementation will use “DetachAllReturnHardDisksOnly” and then pass the result-
ing IMedium array to deleteConfig(). This way, the machine is completely deleted with all its
saved states and hard disk images, but images for removable drives (such as ISO and RAW files)
will remain on disk.
This API does not verify whether the media files returned in the array are still attached to
other machines (i.e. shared between several machines). If such a shared image is passed to
deleteConfig() however, closing the image will fail there and the image will be silently skipped.
This API may, however, move media from this machine’s media registry to other media reg-
istries (see IMedium for details on media registries). For machines created with VirtualBox 4.0 or
later, if media from this machine’s media registry are also attached to another machine (shared
attachments), each such medium will be moved to another machine’s registry. This is because
without this machine’s media registry, the other machine cannot find its media any more and
would become inaccessible.
This API implicitly calls saveSettings() to save all current machine settings before unregister-
ing it. It may also silently call saveSettings() on other machines if media are moved to other
machines’ media registries.
After successful method invocation, the IMachineRegisteredEvent event is fired.
The call will fail if the machine is currently locked (see ISession).
Note: If the given machine is inaccessible (see accessible), 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.
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
247
5 Classes (interfaces)
5.108.1 Attributes
5.108.1.1 temporary (read-only)
boolean IMachineDataChangedEvent::temporary
true if the settings change is temporary. All permanent settings changes will trigger an event,
and only temporary settings changes for running VMs will trigger an event. Note: sending events
for temporary changes is NOT IMPLEMENTED.
5.109 IMachineDebugger
5.109.1 Attributes
5.109.1.1 singleStep (read/write)
boolean IMachineDebugger::singleStep
Whether to execute all the code in the instruction interpreter. This is mainly for testing the
interpreter and not an execution mode intended for general consumption.
248
5 Classes (interfaces)
Flag indicating whether the VM is currently making use of CPU hardware virtualization exten-
sions.
Superseeded by mainExecutionMode.
Flag indicating whether the VM is currently making use of the nested paging CPU hardware
virtualization extension.
249
5 Classes (interfaces)
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 unrestricted execution feature
of VT-x.
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%.
5.109.1.23 VM (read-only)
long long IMachineDebugger::VM
Gets the user-mode VM handle, with a reference. Must be passed to VMR3ReleaseUVM when
done. This is only for internal use while we carve the details of this interface.
VM uptime in milliseconds, i.e. time in which it could have been executing guest code. Ex-
cludes the time when the VM was paused.
250
5 Classes (interfaces)
5.109.2 detectOS
wstring IMachineDebugger::detectOS()
5.109.3 dumpGuestCore
void IMachineDebugger::dumpGuestCore(
[in] wstring filename,
[in] wstring compression)
filename The name of the output file. The file must not exist.
compression Reserved for future compression method indicator.
5.109.4 dumpGuestStack
wstring IMachineDebugger::dumpGuestStack(
[in] unsigned long cpuId)
5.109.5 dumpHostProcessCore
void IMachineDebugger::dumpHostProcessCore(
[in] wstring filename,
[in] wstring compression)
filename The name of the output file. The file must not exist.
5.109.6 dumpStats
void IMachineDebugger::dumpStats(
[in] wstring pattern)
pattern The selection pattern. A bit similar to filename globbing. Wildchars are ’*’ and ’?’,
where the asterisk matches zero or more characters and question mark matches exactly
one character. Multiple pattern can be joined by putting ’|’ between them.
Dumps VM statistics.
251
5 Classes (interfaces)
5.109.7 getCPULoad
long long IMachineDebugger::getCPULoad(
[in] unsigned long cpuId,
[out] unsigned long pctExecuting,
[out] unsigned long pctHalted,
[out] unsigned long pctOther)
cpuId The ID of the virtual CPU to retrieve stats for, pass 0x7fffffff or higher for the average
accross all CPUs.
pctExecuting Percentage of the interval that the CPU(s) spend executing guest code.
pctHalted Percentage of the interval that the CPU(s) spend halted.
pctOther Percentage of the interval that the CPU(s) preempted by the host scheduler, on virtu-
alization overhead and on other tasks.
Get the load percentages (as observed by the VMM) for all virtual CPUs or a specific one.
5.109.8 getRegister
wstring IMachineDebugger::getRegister(
[in] unsigned long cpuId,
[in] wstring name)
5.109.9 getRegisters
void IMachineDebugger::getRegisters(
[in] unsigned long cpuId,
[out] wstring names[],
[out] wstring values[])
5.109.10 getStats
wstring IMachineDebugger::getStats(
[in] wstring pattern,
[in] boolean withDescriptions)
pattern The selection pattern. A bit similar to filename globbing. Wildchars are ’*’ and ’?’,
where the asterisk matches zero or more characters and question mark matches exactly
one character. Multiple pattern can be joined by putting ’|’ between them.
withDescriptions Whether to include the descriptions.
Get the VM statistics in a XMLish format.
252
5 Classes (interfaces)
5.109.11 info
wstring IMachineDebugger::info(
[in] wstring name,
[in] wstring args)
5.109.12 injectNMI
void IMachineDebugger::injectNMI()
5.109.13 loadPlugIn
wstring IMachineDebugger::loadPlugIn(
[in] wstring name)
name The plug-in name or DLL. Special name ’all’ loads all installed plug-ins.
5.109.14 modifyLogDestinations
void IMachineDebugger::modifyLogDestinations(
[in] wstring settings)
settings The destination settings string. See iprt/log.h for details. To target the release logger,
prefix the string with “release:“.
5.109.15 modifyLogFlags
void IMachineDebugger::modifyLogFlags(
[in] wstring settings)
settings The flags settings string. See iprt/log.h for details. To target the release logger, prefix
the string with “release:“.
5.109.16 modifyLogGroups
void IMachineDebugger::modifyLogGroups(
[in] wstring settings)
settings The group settings string. See iprt/log.h for details. To target the release logger, prefix
the string with “release:“.
253
5 Classes (interfaces)
5.109.17 queryOSKernelLog
wstring IMachineDebugger::queryOSKernelLog(
[in] unsigned long maxMessages)
maxMessages Max number of messages to return, counting from the end of the log. If 0, there
is no limit.
5.109.18 readPhysicalMemory
octet[] IMachineDebugger::readPhysicalMemory(
[in] long long address,
[in] unsigned long size)
5.109.19 readVirtualMemory
octet[] IMachineDebugger::readVirtualMemory(
[in] unsigned long cpuId,
[in] long long address,
[in] unsigned long size)
5.109.20 resetStats
void IMachineDebugger::resetStats(
[in] wstring pattern)
pattern The selection pattern. A bit similar to filename globbing. Wildchars are ’*’ and ’?’,
where the asterisk matches zero or more characters and question mark matches exactly
one character. Multiple pattern can be joined by putting ’|’ between them.
Reset VM statistics.
5.109.21 setRegister
void IMachineDebugger::setRegister(
[in] unsigned long cpuId,
[in] wstring name,
[in] wstring value)
254
5 Classes (interfaces)
value The new register value. Hexadecimal, decimal and octal formattings are supported in
addition to any special formattings returned by the getters.
5.109.22 setRegisters
void IMachineDebugger::setRegisters(
[in] unsigned long cpuId,
[in] wstring names[],
[in] wstring values[])
5.109.23 unloadPlugIn
void IMachineDebugger::unloadPlugIn(
[in] wstring name)
name The plug-in name or DLL. Special name ’all’ unloads all plug-ins.
5.109.24 writePhysicalMemory
void IMachineDebugger::writePhysicalMemory(
[in] long long address,
[in] unsigned long size,
[in] octet bytes[])
5.109.25 writeVirtualMemory
void IMachineDebugger::writeVirtualMemory(
[in] unsigned long cpuId,
[in] long long address,
[in] unsigned long size,
[in] octet bytes[])
255
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.110.1 Attributes
5.110.1.1 machineId (read-only)
uuid IMachineEvent::machineId
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
The given machine was registered or unregistered within this VirtualBox installation.
5.111.1 Attributes
5.111.1.1 registered (read-only)
boolean IMachineRegisteredEvent::registered
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
256
5 Classes (interfaces)
5.112.1 Attributes
5.112.1.1 state (read-only)
MachineState IMachineStateChangedEvent::state
5.113 IManagedObjectRef
Note: This interface is supported in the web service only, not in COM/XPCOM.
5.113.1 getInterfaceName
wstring IManagedObjectRef::getInterfaceName()
Returns the name of the interface that this managed object represents, for example, “IMa-
chine”, as a string.
5.113.2 release
void IManagedObjectRef::release()
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.
5.114 IMedium
The IMedium interface represents virtual storage for a machine’s hard disks, CD/DVD or floppy
drives. It will typically represent a disk image on the host, for example a VDI or VMDK file
representing a virtual hard disk, or an ISO or RAW file representing virtual removable media,
but can also point to a network location (e.g. for iSCSI targets).
Instances of IMedium are connected to virtual machines by way of medium attachments, which
link the storage medium to a particular device slot of a storage controller of the virtual machine.
In the VirtualBox API, virtual storage is therefore always represented by the following chain of
object links:
257
5 Classes (interfaces)
Existing media are opened using IVirtualBox::openMedium(); new hard disk media can be
created with the VirtualBox API using the IVirtualBox::createMedium() method. Differencing
hard disks (see below) are usually implicitly created by VirtualBox as needed, but may also be
created explicitly using createDiffStorage(). VirtualBox cannot create CD/DVD or floppy images
(ISO and RAW files); these should be created with external tools and then opened from within
VirtualBox.
Only for CD/DVDs and floppies, an IMedium instance can also represent a host drive. In
that case the id attribute contains the UUID of one of the drives in IHost::DVDDrives[] or
IHost::floppyDrives[].
Media registries
When a medium has been opened or created using one of the aforementioned APIs, it be-
comes “known” to VirtualBox. Known media can be attached to virtual machines and re-found
through IVirtualBox::openMedium(). They also appear in the global IVirtualBox::hardDisks[],
IVirtualBox::DVDImages[] and IVirtualBox::floppyImages[] arrays.
Prior to VirtualBox 4.0, opening a medium added it to a global media registry in the
VirtualBox.xml file, which was shared between all machines and made transporting machines
and their media from one host to another difficult.
Starting with VirtualBox 4.0, media are only added to a registry when they are attached to a
machine using IMachine::attachDevice(). For backwards compatibility, which registry a medium
is added to depends on which VirtualBox version created a machine:
• If the medium has first been attached to a machine which was created by VirtualBox 4.0
or later, it is added to that machine’s media registry in the machine XML settings file. This
way all information about a machine’s media attachments is contained in a single file and
can be transported easily.
• For older media attachments (i.e. if the medium was first attached to a machine which was
created with a VirtualBox version before 4.0), media continue to be registered in the global
VirtualBox settings file, for backwards compatibility.
258
5 Classes (interfaces)
<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 methods that create a new hard disk storage unit and they will use the generated
UUID and file name.
5.114.1 Attributes
5.114.1.1 id (read-only)
uuid IMedium::id
UUID of the medium. For a newly created medium, this value is a randomly generated UUID.
259
5 Classes (interfaces)
Optional description of the medium. For a newly created medium the value of this attribute is
an empty string.
Medium types that don’t support this attribute will return E_NOTIMPL in attempt to get or set
this attribute’s value.
Note: For some storage types, reading this attribute may return an outdated (last
known) value when state is Inaccessible or LockedWrite because the value of this at-
tribute 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 LockedRead state.
Returns the current medium state, which is the last state set by the accessibility check per-
formed by refreshState(). If that method has not yet been called on the medium, the state is
“Inaccessible”; as opposed to truly inaccessible media, the value of lastAccessError will be an
empty string in that case.
Returns the storage format variant information for this medium as an array of the flags de-
scribed at MediumVariant. Before refreshState() is called this method returns an undefined
value.
260
5 Classes (interfaces)
Physical size of the storage unit used to hold medium data (in bytes).
Note: For media whose state is Inaccessible, the value of this property is the last known
size. For NotCreated media, the returned value is zero.
Note: null is returned if there is no associated medium format object. This can e.g.
happen for medium objects representing host drives and other special medium objects.
261
5 Classes (interfaces)
• If a medium 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 medium has children, its type cannot be set to Writethrough.
• The type of all differencing media is Normal and cannot be changed.
The type of a newly created or opened medium is set to Normal, except for DVD and floppy
media, which have a type of Writethrough.
Parent of this medium (the medium this medium is directly based on).
Only differencing media have parents. For base (non-differencing) media, null is returned.
Children of this medium (all differencing media directly based on this medium). A null array
is returned if this medium does not have any children.
262
5 Classes (interfaces)
by creating a new differencing child medium for that. See the interface description for more
information.
Note that all Immutable media are always read-only while all Writethrough media are always
not.
Note: The read-only condition represented by this attribute is related to the medium
type and usage, not to the current medium state and not to the read-only state of the
storage unit.
Logical size of this medium (in bytes), as reported to the guest OS running inside the virtual
machine this medium is attached to. The logical size is defined when the medium is created and
cannot be changed later.
Note: For media whose state is state is Inaccessible, the value of this property is the
last known logical size. For NotCreated media, the returned value is zero.
Whether this differencing medium will be automatically reset each time a virtual machine it
is attached to is powered up. This attribute is automatically set to true for the last differencing
image of an “immutable” medium (see MediumType).
See reset() for more information about resetting differencing media.
Note: Reading this property on a base (non-differencing) medium will always false.
Changing the value of this property in this case is not supported.
Text message that represents the result of the last accessibility check performed by
refreshState().
An empty string is returned if the last accessibility check was successful or has not yet been
called. As a result, if state is “Inaccessible” and this attribute is empty, then refreshState() has
yet to be called; this is the default value of media after VirtualBox initialization. A non-empty
string indicates a failure and should normally describe a reason of the failure (for example, a file
read error).
263
5 Classes (interfaces)
Note: 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 getSnapshotIds() for details.
5.114.2 changeEncryption
IProgress IMedium::changeEncryption(
[in] wstring currentPassword,
[in] wstring cipher,
[in] wstring newPassword,
[in] wstring newPasswordId)
currentPassword The current password the medium is protected with. Use an empty string to
indicate that the medium isn’t encrypted.
cipher The cipher to use for encryption. An empty string indicates no encryption for the result.
newPassword The new password the medium should be protected with. An empty password
and password ID will result in the medium being encrypted with the current password.
newPasswordId The ID of the new password when unlocking the medium.
Starts encryption of this medium. This means that the stored data in the medium is encrypted.
This medium will be placed to LockedWrite state.
Please note that the results can be either returned straight away, or later as the result of the
background operation via the object returned via the progress parameter.
If this method fails, the following error codes may be reported:
5.114.3 checkEncryptionPassword
void IMedium::checkEncryptionPassword(
[in] wstring password)
264
5 Classes (interfaces)
5.114.4 cloneTo
IProgress IMedium::cloneTo(
[in] IMedium target,
[in] MediumVariant variant[],
[in] IMedium parent)
Starts creating a clone of this medium in the format and at the location defined by the target
argument.
The target medium must be either in NotCreated state (i.e. must not have an existing storage
unit) or in Created state (i.e. created and not locked, and big enough to hold the data or else the
copy will be partial). Upon successful completion, the cloned medium will contain exactly the
same sector data as the medium being cloned, except that in the first case a new UUID for the
clone will be randomly generated, and in the second case the UUID will remain unchanged.
The parent argument defines which medium will be the parent of the clone. Passing a null
reference indicates that the clone will be a base image, i.e. completely independent. It is possible
to specify an arbitrary medium for this parameter, including the parent of the medium which is
being cloned. Even cloning to a child of the source medium is possible. Note that when cloning
to an existing image, the parent argument is ignored.
After the returned progress object reports that the operation is successfully complete, the tar-
get medium gets remembered by this VirtualBox installation and may be attached to virtual
machines.
Note: This medium will be placed to LockedRead state for the duration of this opera-
tion.
5.114.5 cloneToBase
IProgress IMedium::cloneToBase(
[in] IMedium target,
[in] MediumVariant variant[])
Starts creating a clone of this medium in the format and at the location defined by the target
argument.
The target medium must be either in NotCreated state (i.e. must not have an existing storage
unit) or in Created state (i.e. created and not locked, and big enough to hold the data or else the
copy will be partial). Upon successful completion, the cloned medium will contain exactly the
same sector data as the medium being cloned, except that in the first case a new UUID for the
clone will be randomly generated, and in the second case the UUID will remain unchanged.
The parent argument defines which medium will be the parent of the clone. In this case the
clone will be a base image, i.e. completely independent. It is possible to specify an arbitrary
medium for this parameter, including the parent of the medium which is being cloned. Even
265
5 Classes (interfaces)
cloning to a child of the source medium is possible. Note that when cloning to an existing image,
the parent argument is ignored.
After the returned progress object reports that the operation is successfully complete, the tar-
get medium gets remembered by this VirtualBox installation and may be attached to virtual
machines.
Note: This medium will be placed to LockedRead state for the duration of this opera-
tion.
5.114.6 close
void IMedium::close()
5.114.7 compact
IProgress IMedium::compact()
Starts compacting of this medium. This means that the medium is transformed into a possibly
more compact storage representation. This potentially creates temporary images, which can
require a substantial amount of additional disk space.
This medium will be placed to LockedWrite state and all its parent media (if any) will be
placed to LockedRead state for the duration of this operation.
Please note that the results can be either returned straight away, or later as the result of the
background operation via the object returned via the progress parameter.
If this method fails, the following error codes may be reported:
266
5 Classes (interfaces)
5.114.8 createBaseStorage
IProgress IMedium::createBaseStorage(
[in] long long logicalSize,
[in] MediumVariant variant[])
Starts creating a hard disk storage unit (fixed/dynamic, according to the variant flags) in the
background. The previous storage unit created for this object, if any, must first be deleted using
deleteStorage(), otherwise the operation will fail.
Before the operation starts, the medium is placed in Creating state. If the create operation
fails, the medium will be placed back in NotCreated state.
After the returned progress object reports that the operation has successfully completed, the
medium state will be set to Created, the medium will be remembered by this VirtualBox instal-
lation and may be attached to virtual machines.
If this method fails, the following error codes may be reported:
5.114.9 createDiffStorage
IProgress IMedium::createDiffStorage(
[in] IMedium target,
[in] MediumVariant variant[])
Starts creating an empty differencing storage unit based on this medium in the format and at
the location defined by the target argument.
The target medium must be in NotCreated state (i.e. must not have an existing storage unit).
Upon successful completion, this operation will set the type of the target medium to Normal and
create a storage unit necessary to represent the differencing medium 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 tar-
get medium gets remembered by this VirtualBox installation and may be attached to virtual
machines.
Note: The medium will be set to LockedRead state for the duration of this operation.
5.114.10 deleteStorage
IProgress IMedium::deleteStorage()
267
5 Classes (interfaces)
Note: If the deletion operation fails, it is not guaranteed that the storage unit still
exists. You may check the state value to answer this question.
5.114.11 getEncryptionSettings
wstring IMedium::getEncryptionSettings(
[out] wstring cipher)
5.114.12 getProperties
wstring[] IMedium::getProperties(
[in] wstring names,
[out] wstring returnNames[])
Note: Currently the value of this argument is ignored and the method always returns
all existing properties.
268
5 Classes (interfaces)
The list of all properties supported by the given medium format can be obtained with
IMediumFormat::describeProperties().
The method returns two arrays, the array of property names corresponding to the names argu-
ment and the current values of these properties. Both arrays have the same number of elements
with each element at the given index in the first array corresponds to an element at the same
index in the second array.
For properties that do not have assigned values, an empty string is returned at the appropriate
index in the returnValues array.
5.114.13 getProperty
wstring IMedium::getProperty(
[in] wstring name)
Returns the value of the custom medium property with the given name.
The list of all properties supported by the given medium format can be obtained with
IMediumFormat::describeProperties().
Note: If this method returns an empty string in value, the requested property is sup-
ported but currently not assigned any value.
5.114.14 getSnapshotIds
uuid[] IMedium::getSnapshotIds(
[in] uuid machineId)
Returns an array of UUIDs of all snapshots of the given machine where this medium is attached
to.
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 machineId argument),
followed by snapshot 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 the snapshots.
5.114.15 lockRead
IToken IMedium::lockRead()
269
5 Classes (interfaces)
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). That includes an attempt to start a
virtual machine that wants to write to the medium.
When the virtual machine is started up, it locks for reading all media it uses in read-only
mode. If some medium cannot be locked for reading, the startup procedure will fail. A medium
is typically locked for reading while it is used by a running virtual machine but has a depending
differencing image that receives the actual write operations. This way one base medium can have
multiple child differencing images which can be written to simultaneously. Read-only media such
as DVD and floppy images are also locked for reading only (so they can be in use by multiple
machines simultaneously).
A medium is also locked for reading when it is the source of a write operation such as cloneTo()
or mergeTo().
The medium locked for reading must be unlocked by abandoning the returned token object,
see IToken. Calls to lockRead() can be nested and the lock is actually released when all callers
have abandoned the token.
This method sets the medium state (see state) to “LockedRead” on success. The medium’s
previous state must be one of “Created”, “Inaccessible” or “LockedRead”.
Locking an inaccessible medium is not an error; this method performs a logical lock that
prevents modifications of this medium through the VirtualBox API, not a physical file-system
lock of the underlying storage unit.
This method returns the current state of the medium before the operation.
If this method fails, the following error codes may be reported:
5.114.16 lockWrite
IToken IMedium::lockWrite()
270
5 Classes (interfaces)
5.114.17 mergeTo
IProgress IMedium::mergeTo(
[in] IMedium target)
Starts merging the contents of this medium and all intermediate differencing media in the
chain to the given target medium.
The target medium must be either a descendant of this medium 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 medium chain:
Base <- Diff_1 <- Diff_2
Here, calling this method on the Base medium 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 medium will be the same, the only difference is
the medium 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 medium.
Upon successful operation completion, the storage units of all media in the chain between this
(source) medium and the target medium, including the source medium itself, will be automati-
cally deleted and the relevant medium objects (including this medium) 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 media. Note that Diff_2 in
this case will become a base medium itself since it will no longer be based on any other medium.
Considering the above, all of the following conditions must be met in order for the merge
operation to succeed:
• Neither this (source) medium nor any intermediate differencing medium in the chain be-
tween it and the target medium is attached to any virtual machine.
• Neither the source medium nor the target medium is an Immutable medium.
• The part of the medium tree from the source medium to the target medium is a linear
chain, i.e. all medium in this chain have exactly one child which is the next medium in
this chain. The only exception from this rule is the target medium in the forward merge
operation; it is allowed to have any number of child media because the merge operation
will not change its logical contents (as it is seen by the guest OS or by children).
• None of the involved media are in LockedRead or LockedWrite state.
Note: This (source) medium and all intermediates will be placed to Deleting state and
the target medium will be placed to LockedWrite state and for the duration of this
operation.
271
5 Classes (interfaces)
5.114.18 moveTo
IProgress IMedium::moveTo(
[in] wstring location)
5.114.19 openForIO
IMediumIO IMedium::openForIO(
[in] boolean writable,
[in] wstring password)
writable Set this to open the medium for both reading and writing. When not set the medium
is opened readonly.
password Password for accessing an encrypted medium. Must be empty if not encrypted.
Open the medium for I/O.
5.114.20 refreshState
MediumState IMedium::refreshState()
If the current medium state (see MediumState) is one of “Created”, “Inaccessible” or “Locke-
dRead”, then this performs an accessibility check on the medium and sets the value of the state
attribute accordingly; that value is also returned for convenience.
For all other state values, this does not perform a refresh but returns the state only.
The refresh, if performed, may take a long time (several seconds or even minutes, depending
on the storage unit location and format) because it performs an accessibility check of the storage
unit. 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. In that case, the call will not return until a timeout interval defined by the host OS
for this operation expires. For this reason, it is recommended to never read this attribute on the
main UI thread to avoid making the UI unresponsive.
If the last known state of the medium is “Created” and the accessibility check fails, then the
state would be set to “Inaccessible”, and lastAccessError may be used to get more details about
the failure. If the state of the medium is “LockedRead”, then it remains the same, and a non-
empty value of lastAccessError will indicate a failed accessibility check in this case.
Note that not all medium states are applicable to all medium types.
272
5 Classes (interfaces)
5.114.21 reset
IProgress IMedium::reset()
5.114.22 resize
IProgress IMedium::resize(
[in] long long logicalSize)
Starts resizing this medium. This means that the nominal size of the medium is set to the new
value. Both increasing and decreasing the size is possible, and there are no safety checks, since
VirtualBox does not make any assumptions about the medium contents.
Resizing usually needs additional disk space, and possibly also some temporary disk space.
Note that resize does not create a full temporary copy of the medium, so the additional disk
space requirement is usually much lower than using the clone operation.
This medium will be placed to LockedWrite state for the duration of this operation.
Please note that the results can be either returned straight away, or later as the result of the
background operation via the object returned via the progress parameter.
If this method fails, the following error codes may be reported:
5.114.23 setIds
void IMedium::setIds(
[in] boolean setImageId,
[in] uuid imageId,
[in] boolean setParentId,
[in] uuid parentId)
imageId New UUID for the image. If an empty string is passed, then a new UUID is automatically
created, provided that setImageId is true. Specifying a zero UUID is not allowed.
setParentId Select whether a new parent UUID is set or not.
parentId New parent UUID for the image. If an empty string is passed, then a new UUID is
automatically created, provided setParentId is true. A zero UUID is valid.
Changes the UUID and parent UUID for a hard disk medium.
273
5 Classes (interfaces)
5.114.24 setProperties
void IMedium::setProperties(
[in] wstring names[],
[in] wstring values[])
5.114.25 setProperty
void IMedium::setProperty(
[in] wstring name,
[in] wstring value)
Sets the value of the custom medium property with the given name.
The list of all properties supported by the given medium format can be obtained with
IMediumFormat::describeProperties().
Note: Setting the property value to null or an empty string is equivalent to deleting
the existing value. A default value (if it is defined for this property) will be used by the
format backend in this case.
5.115 IMediumAttachment
Note: With the web service, this interface is mapped to a structure. Attributes that
return this interface will not return an object, but a complete structure containing the
attributes listed below as structure members.
274
5 Classes (interfaces)
The IMediumAttachment interface links storage media to virtual machines. For each medium
(IMedium) which has been attached to a storage controller (IStorageController) of a machine
(IMachine) via the IMachine::attachDevice() method, one instance of IMediumAttachment is
added to the machine’s IMachine::mediumAttachments[] array attribute.
Each medium attachment specifies the storage controller as well as a port and device number
and the IMedium instance representing a virtual hard disk or floppy or DVD image.
For removable media (DVDs or floppies), there are two additional options. For one, the
IMedium instance can be null to represent an empty drive with no media inserted (see
IMachine::mountMedium()); secondly, the medium can be one of the pseudo-media for host
drives listed in IHost::DVDDrives[] or IHost::floppyDrives[].
Attaching Hard Disks
Hard disks are attached to virtual machines using the IMachine::attachDevice() method and
detached using the IMachine::detachDevice() method. Depending on a medium’s type (see
IMedium::type), 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
IMachine::attachDevice() performs a direct attachment then the same hard disk will be returned
in response to the subsequent IMachine::getMedium() call; however if an indirect attachment is
performed then IMachine::getMedium() will return the implicitly created differencing hard disk,
not the original one passed to IMachine::attachDevice(). In detail:
• 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 break-
ing the integrity of the dependent party. The IMedium::readOnly 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 hard disks are like normal base hard disks: they are 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 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 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.
• Shareable hard disks are always attached directly, also as designed. This also means that
shareable hard disks cannot have other hard disks linked to them at all. They behave
almost like writethrough hard disks, except that shareable hard disks can be attached to
several virtual machines which are running, allowing concurrent accesses. You need special
cluster software running in the virtual machines to make use of such disks.
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 IMachine::detachDevice() call until
275
5 Classes (interfaces)
IMachine::saveSettings() 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 IMachine::discardSettings() before the settings are saved (committed).
Note that if IMachine::discardSettings() is called after indirectly attaching some hard disks
to the machine but before a call to IMachine::saveSettings() is made, it will implicitly delete
all differencing hard disks implicitly created by IMachine::attachDevice() for these indirect at-
tachments. Such implicitly created hard disks will also be immediately deleted when detached
explicitly using the IMachine::detachDevice() call if it is made before IMachine::saveSettings().
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
IMachine::attachDevice() before the last IMachine::saveSettings() call will not implicitly delete
them as they may already contain some data (for example, as a result of virtual machine exe-
cution). If these hard disks are no more necessary, the caller can always delete them explicitly
using IMedium::deleteStorage() after they are actually de-associated from this machine by the
IMachine::saveSettings() call.
Smart Attachment
When normal base or immutable hard disks are indirectly attached to a virtual machine then
some additional 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:
NOT
...
CurState (D3->B.vdi)
The first column is the virtual machine configuration before the base hard disk B.vdi is at-
tached, 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.
276
5 Classes (interfaces)
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 configuration is changed for the first time after the last
IMachine::saveSettings() call and used by IMachine::discardSettings() to undo the recent hard
disk changes. When such a descendant is found in this backup copy, it will be simply re-attached
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.
5.115.1 Attributes
5.115.1.1 machine (read-only)
IMachine IMediumAttachment::machine
Medium object associated with this attachment; it can be null for removable devices.
Name of the storage controller of this attachment; this refers to one of the controllers in
IMachine::storageControllers[] by name.
Port number of this attachment. See IMachine::attachDevice() for the meaning of this value
for the different controller types.
Device slot number of this attachment. See IMachine::attachDevice() for the meaning of this
value for the different controller types.
277
5 Classes (interfaces)
Signals that the removable medium has been ejected. This is not necessarily equivalent to
having a null medium association.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.116.1 Attributes
5.116.1.1 mediumAttachment (read-only)
IMediumAttachment IMediumChangedEvent::mediumAttachment
278
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
The configuration of the given medium was changed (location, properties, child/parent or
anything else).
5.117.1 Attributes
5.117.1.1 medium (read-only)
IMedium IMediumConfigChangedEvent::medium
5.118 IMediumFormat
The IMediumFormat interface represents a medium format.
Each medium format has an associated backend which is used to handle media stored in this
format. This interface provides information about the properties of the associated backend.
Each medium format is identified by a string represented by the id attribute. This string is
used in calls like IVirtualBox::createMedium() to specify the desired format.
The list of all supported medium formats can be obtained using
ISystemProperties::mediumFormats[].
See also: IMedium
5.118.1 Attributes
5.118.1.1 id (read-only)
wstring IMediumFormat::id
"VDI"
"vdi"
"VdI"
279
5 Classes (interfaces)
5.118.2 describeFileExtensions
void IMediumFormat::describeFileExtensions(
[out] wstring extensions[],
[out] DeviceType types[])
5.118.3 describeProperties
void IMediumFormat::describeProperties(
[out] wstring names[],
[out] wstring descriptions[],
[out] DataType types[],
[out] unsigned long flags[],
[out] wstring defaults[])
5.119 IMediumIO
The IMediumIO interface is used to access and modify the content of a medium. It is returned
by IMedium::openForIO().
280
5 Classes (interfaces)
5.119.1 Attributes
5.119.1.1 medium (read-only)
IMedium IMediumIO::medium
Whether the medium can be written to. (It can always be read from.)
5.119.2 close
void IMediumIO::close()
Explictly close the medium I/O rather than waiting for garbage collection and the destructor.
This will wait for any pending reads and writes to complete and then close down the I/O
access without regard for open explorer instances or anything like that.
5.119.3 convertToStream
IProgress IMediumIO::convertToStream(
[in] wstring format,
[in] MediumVariant variant[],
[in] unsigned long bufferSize,
[out] IDataStream stream)
281
5 Classes (interfaces)
Converts the currently opened image into a stream of the specified image type/variant. It is
sufficient to open the image in read-only mode. Only few types and variants are supported due
to the inherent restrictions of the output style.
If this method fails, the following error codes may be reported:
5.119.4 formatFAT
void IMediumIO::formatFAT(
[in] boolean quick)
Formats the medium as FAT. Generally only useful for floppy images as no partition table will
be created.
5.119.5 initializePartitionTable
void IMediumIO::initializePartitionTable(
[in] PartitionTableType format,
[in] boolean wholeDiskInOneEntry)
wholeDiskInOneEntry When true a partition table entry for the whole disk is created. Other-
wise the partition table is empty.
5.119.6 read
octet[] IMediumIO::read(
[in] long long offset,
[in] unsigned long size)
offset The byte offset into the medium to start reading at.
5.119.7 write
unsigned long IMediumIO::write(
[in] long long offset,
[in] octet data[])
offset The byte offset into the medium to start reading at.
data Array of data to write.
282
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
The given medium was registered or unregistered within this VirtualBox installation.
5.120.1 Attributes
5.120.1.1 mediumId (read-only)
uuid IMediumRegisteredEvent::mediumId
5.121 IMouse
The IMouse interface represents the virtual machine’s mouse. Used in IConsole::mouse.
Through this interface, the virtual machine’s virtual mouse can be controlled.
5.121.1 Attributes
5.121.1.1 absoluteSupported (read-only)
boolean IMouse::absoluteSupported
283
5 Classes (interfaces)
Whether the guest OS can currently switch to drawing it’s own mouse cursor on demand.
5.121.2 putEventMultiTouch
void IMouse::putEventMultiTouch(
[in] long count,
[in] long long contacts[],
[in] unsigned long scanTime)
Sends a multi-touch pointer event. The coordinates are expressed in pixels and start from
[1,1] which corresponds to the top left corner of the virtual display.
284
5 Classes (interfaces)
Note: The guest may not understand or may choose to ignore this event.
5.121.3 putEventMultiTouchString
void IMouse::putEventMultiTouchString(
[in] long count,
[in] wstring contacts,
[in] unsigned long scanTime)
5.121.4 putMouseEvent
void IMouse::putMouseEvent(
[in] long dx,
[in] long dy,
[in] long dz,
[in] long dw,
[in] long buttonState)
dx Amount of pixels the mouse should move to the right. Negative values move the mouse to
the left.
dy Amount of pixels the mouse should move downwards. Negative values move the mouse
upwards.
dz Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative
values describe counterclockwise rotations.
dw Amount of horizontal mouse wheel moves. Positive values describe a movement to the left,
negative values describe a movement to the right.
buttonState The current state of mouse buttons. Every bit represents a mouse button as follows:
Bit 0 (0x01)left mouse buttonBit 1 (0x02)right mouse buttonBit 2 (0x04)middle mouse
button A value of 1 means the corresponding button is pressed. otherwise it is released.
Initiates a mouse event using relative pointer movements along x and y axis.
If this method fails, the following error codes may be reported:
285
5 Classes (interfaces)
5.121.5 putMouseEventAbsolute
void IMouse::putMouseEventAbsolute(
[in] long x,
[in] long y,
[in] long dz,
[in] long dw,
[in] long buttonState)
Positions the mouse pointer using absolute x and y coordinates. These coordinates are ex-
pressed in pixels and start from [1,1] which corresponds to the top left corner of the virtual
display. The values [-1,-1] and [0x7fffffff,0x7fffffff] have special meanings as respec-
tively “no data” (to signal that the host wishes to report absolute pointer data in future) and “out
of range” (the host pointer is outside of all guest windows).
Note: This method will have effect only if absolute mouse positioning is supported by
the guest OS.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when the mouse capabilities reported by the guest have changed. The new capa-
bilities are passed.
5.122.1 Attributes
5.122.1.1 supportsAbsolute (read-only)
boolean IMouseCapabilityChangedEvent::supportsAbsolute
286
5 Classes (interfaces)
5.123 IMousePointerShape
The guest mouse pointer description.
5.123.1 Attributes
5.123.1.1 visible (read-only)
boolean IMousePointerShape::visible
287
5 Classes (interfaces)
Shape bitmaps.
The shape buffer contains a 1bpp (bits per pixel) AND mask followed by a 32bpp 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.
An AND mask is provided for pointers with alpha channel, so if the client does not support
alpha, the pointer could be displayed as a normal color pointer.
The AND mask is a 1bpp bitmap with byte aligned scanlines. The size of the AND mask
therefore is cbAnd = (width + 7) / 8 * height. The padding bits at the end of each scanline
are undefined.
The XOR mask follows the AND mask on the next 4-byte aligned offset: uint8_t *pu8Xor
= pu8And + (cbAnd + 3) & ~3. Bytes in the gap between the AND and the XOR mask are
undefined. The XOR mask scanlines have no gap between them and the size of the XOR mask is:
cbXor = width * 4 * height.
Note: If shape size is 0, then the shape is not known or did not change. This can
happen if only the pointer visibility is changed.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when the guest mouse pointer shape has changed. The new shape data is given.
5.124.1 Attributes
5.124.1.1 visible (read-only)
boolean IMousePointerShapeChangedEvent::visible
288
5 Classes (interfaces)
5.125 INATEngine
Interface for managing a NAT engine which is used with a virtual machine. This allows
for changing NAT behavior such as port-forwarding rules. This interface is used in the
INetworkAdapter::NATEngine attribute.
5.125.1 Attributes
5.125.1.1 network (read/write)
wstring INATEngine::network
The network attribute of the NAT engine (the same value is used with built-in DHCP server to
fill corresponding fields of DHCP leases).
289
5 Classes (interfaces)
TFTP prefix attribute which is used with the built-in DHCP server to fill the corresponding
fields of DHCP leases.
TFTP boot file attribute which is used with the built-in DHCP server to fill the corresponding
fields of DHCP leases.
TFTP server attribute which is used with the built-in DHCP server to fill the corresponding
fields of DHCP leases.
Whether the DHCP server should pass the DNS domain used by the host.
Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS
proxy and process traffic using DNS servers registered on the host.
Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS
proxy and process traffic using the host resolver mechanism.
290
5 Classes (interfaces)
5.125.2 addRedirect
void INATEngine::addRedirect(
[in] wstring name,
[in] NATProtocol proto,
[in] wstring hostIP,
[in] unsigned short hostPort,
[in] wstring guestIP,
[in] unsigned short guestPort)
name The name of the rule. An empty name is acceptable, in which case the NAT engine auto-
generates one using the other parameters.
proto Protocol handled with the rule.
hostIP IP of the host interface to which the rule should apply. An empty ip address is acceptable,
in which case the NAT engine binds the handling socket to any interface.
5.125.3 getNetworkSettings
void INATEngine::getNetworkSettings(
[out] unsigned long mtu,
[out] unsigned long sockSnd,
[out] unsigned long sockRcv,
[out] unsigned long TcpWndSnd,
[out] unsigned long TcpWndRcv)
mtu
sockSnd
sockRcv
TcpWndSnd
TcpWndRcv
Returns network configuration of NAT engine. See setNetworkSettings() for parameter de-
scriptions.
291
5 Classes (interfaces)
5.125.4 removeRedirect
void INATEngine::removeRedirect(
[in] wstring name)
5.125.5 setNetworkSettings
void INATEngine::setNetworkSettings(
[in] unsigned long mtu,
[in] unsigned long sockSnd,
[in] unsigned long sockRcv,
[in] unsigned long TcpWndSnd,
[in] unsigned long TcpWndRcv)
sockRcv Capacity of the socket receive buffer in bytes when creating a new socket.
TcpWndSnd Initial size of the NAT engine’s sending TCP window in bytes when establishing a
new TCP connection.
TcpWndRcv Initial size of the NAT engine’s receiving TCP window in bytes when establishing
a new TCP connection.
5.126 INATNetwork
5.126.1 Attributes
5.126.1.1 networkName (read/write)
wstring INATNetwork::networkName
TBD: the idea, technically we can start any number of the NAT networks, but we should expect
that at some point we will get collisions because of port-forwanding rules. so perhaps we should
support only single instance of NAT network.
This is CIDR IPv4 string. Specifying it user defines IPv4 addresses of gateway (low address +
1) and DHCP server (= low address + 2). Note: If there are defined IPv4 port-forward rules
update of network will be ignored (because new assignment could break existing rules).
292
5 Classes (interfaces)
This attribute is read-only. It’s recalculated on changing network attribute (low address of
network + 1).
This a CIDR IPv6 defining prefix for link-local addresses autoconfiguration within network.
Note: ignored if attribute IPv6Enabled is false.
Offset in ipv6 network from network id for address mapped into loopback6 interface of the
host.
293
5 Classes (interfaces)
5.126.2 addLocalMapping
void INATNetwork::addLocalMapping(
[in] wstring hostid,
[in] long offset)
hostid
offset
5.126.3 addPortForwardRule
void INATNetwork::addPortForwardRule(
[in] boolean isIpv6,
[in] wstring ruleName,
[in] NATProtocol proto,
[in] wstring hostIP,
[in] unsigned short hostPort,
[in] wstring guestIP,
[in] unsigned short guestPort)
isIpv6
ruleName
guestIP The IP address of the guest which the NAT engine will forward matching packets to.
An empty IP address is not acceptable.
guestPort The port number to forward.
5.126.4 removePortForwardRule
void INATNetwork::removePortForwardRule(
[in] boolean iSipv6,
[in] wstring ruleName)
iSipv6
ruleName
5.126.5 start
void INATNetwork::start()
5.126.6 stop
void INATNetwork::stop()
294
5 Classes (interfaces)
Note: This interface extends INATNetworkChangedEvent and therefore supports all its
methods and attributes as well.
5.127.1 Attributes
5.127.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean INATNetworkAlterEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.128.1 Attributes
5.128.1.1 networkName (read-only)
wstring INATNetworkChangedEvent::networkName
5.129 INATNetworkCreationDeletionEvent
(INATNetworkAlterEvent)
Note: This interface extends INATNetworkAlterEvent and therefore supports all its
methods and attributes as well.
5.129.1 Attributes
5.129.1.1 creationEvent (read-only)
boolean INATNetworkCreationDeletionEvent::creationEvent
5.130 INATNetworkPortForwardEvent
(INATNetworkAlterEvent)
Note: This interface extends INATNetworkAlterEvent and therefore supports all its
methods and attributes as well.
5.130.1 Attributes
5.130.1.1 create (read-only)
boolean INATNetworkPortForwardEvent::create
295
5 Classes (interfaces)
Note: This interface extends INATNetworkAlterEvent and therefore supports all its
methods and attributes as well.
5.131.1 Attributes
5.131.1.1 enabled (read-only)
boolean INATNetworkSettingEvent::enabled
296
5 Classes (interfaces)
5.132 INATNetworkStartStopEvent
(INATNetworkChangedEvent)
Note: This interface extends INATNetworkChangedEvent and therefore supports all its
methods and attributes as well.
5.132.1 Attributes
5.132.1.1 startEvent (read-only)
boolean INATNetworkStartStopEvent::startEvent
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
5.133.1 Attributes
5.133.1.1 slot (read-only)
unsigned long INATRedirectEvent::slot
297
5 Classes (interfaces)
5.134 INetworkAdapter
Represents a virtual network adapter that is attached to a virtual machine. Each virtual machine
has a fixed number of network adapter slots with one instance of this attached to each of them.
Call IMachine::getNetworkAdapter() to get the network adapter that is attached to a given slot
in a given machine.
Each network adapter can be in one of five attachment modes, which are represented by the
NetworkAttachmentType enumeration; see the attachmentType attribute.
5.134.1 Attributes
5.134.1.1 adapterType (read/write)
NetworkAdapterType INetworkAdapter::adapterType
Type of the virtual network adapter. Depending on this value, VirtualBox will provide a differ-
ent virtual network hardware to the guest.
Slot number this adapter is plugged into. Corresponds to the value you pass to
IMachine::getNetworkAdapter() 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 or
an empty string for an enabled adapter, VirtualBox will generate a unique MAC address. Disabled
adapters can have an empty MAC address.
298
5 Classes (interfaces)
Name of the driver to use for the “Generic” network attachment type.
Flag whether the adapter reports the cable as connected or not. It can be used to report offline
situations to a VM.
299
5 Classes (interfaces)
The promiscuous mode policy of the network adapter when attached to an internal network,
host only network or a bridge.
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.
Points to the NAT engine which handles the network address translation for this interface. This
is active only when the interface actually uses NAT.
Network boot priority of the adapter. Priority 1 is highest. If not set, the priority is considered
to be at the lowest possible setting.
5.134.2 getProperties
wstring[] INetworkAdapter::getProperties(
[in] wstring names,
[out] wstring returnNames[])
Note: Currently the value of this argument is ignored and the method always returns
all existing properties.
The method returns two arrays, the array of property names corresponding to the names argu-
ment and the current values of these properties. Both arrays have the same number of elements
with each element at the given index in the first array corresponds to an element at the same
index in the second array.
300
5 Classes (interfaces)
5.134.3 getProperty
wstring INetworkAdapter::getProperty(
[in] wstring key)
Returns the value of the network attachment property with the given name.
If the requested data key does not exist, this function will succeed and return an empty string
in the value argument.
If this method fails, the following error codes may be reported:
5.134.4 setProperty
void INetworkAdapter::setProperty(
[in] wstring key,
[in] wstring value)
Sets the value of the network attachment property with the given name.
Setting the property value to null or an empty string is equivalent to deleting the existing
value.
If this method fails, the following error codes may be reported:
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
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.
5.135.1 Attributes
5.135.1.1 networkAdapter (read-only)
INetworkAdapter INetworkAdapterChangedEvent::networkAdapter
5.136 IPCIAddress
Address on the PCI bus.
301
5 Classes (interfaces)
5.136.1 Attributes
5.136.1.1 bus (read/write)
short IPCIAddress::bus
Bus number.
Device number.
5.136.2 asLong
long IPCIAddress::asLong()
5.136.3 fromLong
void IPCIAddress::fromLong(
[in] long number)
number
5.137 IPCIDeviceAttachment
Note: With the web service, this interface is mapped to a structure. Attributes that
return this interface will not return an object, but a complete structure containing the
attributes listed below as structure members.
5.137.1 Attributes
5.137.1.1 name (read-only)
wstring IPCIDeviceAttachment::name
Device name.
302
5 Classes (interfaces)
5.138 IParallelPort
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.
See also: IMachine::getParallelPort()
5.138.1 Attributes
5.138.1.1 slot (read-only)
unsigned long IParallelPort::slot
Slot number this parallel port is plugged into. Corresponds to the value you pass to
IMachine::getParallelPort() to obtain this instance.
Flag whether the parallel port is enabled. If disabled, the parallel port will not be reported to
the guest OS.
Host parallel device name. If this parallel port is enabled, setting a null or an empty string as
this attribute’s value will result in the parallel port behaving as if not connected to any device.
303
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
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.
5.139.1 Attributes
5.139.1.1 parallelPort (read-only)
IParallelPort IParallelPortChangedEvent::parallelPort
5.140 IPerformanceCollector
The IPerformanceCollector interface represents a service that collects and stores performance
metrics data.
Performance metrics are associated with objects of interfaces like IHost and IMachine. Each
object has a distinct set of performance metrics. The set can be obtained with getMetrics().
Metric data is collected at the specified intervals and is retained internally. The interval and
the number of retained samples can be set with setupMetrics(). Both metric data and collection
settings are not persistent, they are discarded as soon as VBoxSVC process terminates. Moreover,
metric settings and data associated with a particular VM only exist while VM is running. They
disappear as soon as VM shuts down. It is not possible to set up metrics for machines that are
powered off. One needs to start VM first, then set up metric collection parameters.
Metrics are organized hierarchically, with each level separated by a slash (/) character. Gener-
ally, the scheme for metric names is like this:
Category/Metric[/SubMetric][:aggregation]
“Category/Metric” together form the 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 queryMetricsData().
For example “CPU/Load/User:avg” metric name stands for the “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
When setting up metric parameters, querying metric data, enabling or disabling metrics wild-
cards 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
304
5 Classes (interfaces)
• RAM/Usage
• RAM/VMM
The general sequence for collecting and retrieving the metrics is:
• Obtain an instance of IPerformanceCollector with IVirtualBox::performanceCollector
• 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 setupMetrics(). 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 queryMetricsData(). 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
5.140.1 Attributes
5.140.1.1 metricNames (read-only)
wstring IPerformanceCollector::metricNames[]
5.140.2 disableMetrics
IPerformanceMetric[] IPerformanceCollector::disableMetrics(
[in] wstring metricNames[],
[in] $unknown objects[])
metricNames Metric name filter. Comma-separated list of metrics with wildcard support.
objects Set of objects to disable metrics for.
Turns off collecting specified base metrics. Returns an array of IPerformanceMetric describing
the metrics have been affected.
Note: Null or empty metric name array means all metrics. 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.
305
5 Classes (interfaces)
5.140.3 enableMetrics
IPerformanceMetric[] IPerformanceCollector::enableMetrics(
[in] wstring metricNames[],
[in] $unknown objects[])
metricNames Metric name filter. Comma-separated list of metrics with wildcard support.
objects Set of objects to enable metrics for.
Note: Null or empty metric name array means all metrics. 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.
5.140.4 getMetrics
IPerformanceMetric[] IPerformanceCollector::getMetrics(
[in] wstring metricNames[],
[in] $unknown objects[])
metricNames Metric name filter. Currently, only a comma-separated list of metrics is supported.
objects Set of objects to return metric parameters for.
Note: Null metrics array means all metrics. Null object array means all existing
objects.
5.140.5 queryMetricsData
long[] IPerformanceCollector::queryMetricsData(
[in] wstring metricNames[],
[in] $unknown objects[],
[out] wstring returnMetricNames[],
[out] $unknown returnObjects[],
[out] wstring returnUnits[],
[out] unsigned long returnScales[],
[out] unsigned long returnSequenceNumbers[],
[out] unsigned long returnDataIndices[],
[out] unsigned long returnDataLengths[])
metricNames Metric name filter. Comma-separated list of metrics with wildcard support.
objects Set of objects to query metrics for.
returnMetricNames Names of metrics returned in returnData.
returnObjects Objects associated with metrics returned in returnData.
returnUnits Units of measurement for each returned metric.
306
5 Classes (interfaces)
returnScales Divisor that should be applied to return values in order to get float-
ing 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.
Note: Null or empty metric name array means all metrics. 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.
Note: Data collection continues behind the scenes after call to queryMetricsData.
The return data can be seen as the snapshot of the current state at the time of
queryMetricsData call. The internally kept metric values are not cleared by the
call. This allows querying different subsets of metrics or aggregates with subsequent
calls. If periodic querying is needed it is highly suggested to query the values with
interval*count period to avoid confusion. This way a completely new set of data
values will be provided by each query.
5.140.6 setupMetrics
IPerformanceMetric[] IPerformanceCollector::setupMetrics(
[in] wstring metricNames[],
[in] $unknown objects[],
[in] unsigned long period,
[in] unsigned long count)
metricNames Metric name filter. Comma-separated list of metrics with wildcard support.
objects Set of objects to setup metric parameters for.
period Time interval in seconds between two consecutive samples of performance data.
count Number of samples to retain in performance data history. Older samples get discarded.
Sets parameters of specified base metrics for a set of objects. Returns an array of
IPerformanceMetric describing the metrics have been affected.
307
5 Classes (interfaces)
Note: Null or empty metric name array means all metrics. 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.
5.141 IPerformanceMetric
The IPerformanceMetric interface represents parameters of the given performance metric.
5.141.1 Attributes
5.141.1.1 metricName (read-only)
wstring IPerformanceMetric::metricName
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.
308
5 Classes (interfaces)
5.142 IProcess
Abstract parent interface for processes handled by VirtualBox.
5.142.1 Attributes
5.142.1.1 arguments (read-only)
wstring IProcess::arguments[]
The exit code. Only available when the process has been terminated normally.
309
5 Classes (interfaces)
5.142.2 read
octet[] IProcess::read(
[in] unsigned long handle,
[in] unsigned long toRead,
[in] unsigned long timeoutMS)
5.142.3 terminate
void IProcess::terminate()
Note: It can take up to 30 seconds to get a guest process killed. In case a guest process
could not be killed an appropriate error is returned.
5.142.4 waitFor
ProcessWaitResult IProcess::waitFor(
[in] unsigned long waitFor,
[in] unsigned long timeoutMS)
waitFor Specifies what to wait for; see ProcessWaitForFlag for more information.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
5.142.5 waitForArray
ProcessWaitResult IProcess::waitForArray(
[in] ProcessWaitForFlag waitFor[],
[in] unsigned long timeoutMS)
waitFor Specifies what to wait for; see ProcessWaitForFlag for more information.
timeoutMS Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout.
310
5 Classes (interfaces)
5.142.6 write
unsigned long IProcess::write(
[in] unsigned long handle,
[in] unsigned long flags,
[in] octet data[],
[in] unsigned long timeoutMS)
5.142.7 writeArray
unsigned long IProcess::writeArray(
[in] unsigned long handle,
[in] ProcessInputFlag flags[],
[in] octet data[],
[in] unsigned long timeoutMS)
5.143 IProgress
The IProgress interface is used to track and control asynchronous tasks within VirtualBox.
An instance of this is returned every time VirtualBox starts an asynchronous task (in other
words, a separate thread) which continues to run after a method call returns. For example,
IMachine::saveState(), which saves the state of a running virtual machine, can take a long time
to complete. To be able to display a progress bar, a user interface such as the VirtualBox graphical
user interface can use the IProgress object returned by that method.
Note that IProgress is a “read-only” interface in the sense that only the VirtualBox internals
behind the Main API can create and manipulate progress objects, whereas client code can only
use the IProgress object to monitor a task’s progress and, if cancelable is true, cancel the task by
calling cancel().
A task represented by IProgress consists of either one or several sub-operations that run se-
quentially, one by one (see operation and operationCount). Every operation is identified by a
number (starting from 0) and has a separate description.
You can find the individual percentage of completion of the current operation in
operationPercent and the percentage of completion of the task as a whole in percent.
Similarly, you can wait for the completion of a particular operation via
waitForOperationCompletion() or for the completion of the whole task via waitForCompletion().
311
5 Classes (interfaces)
5.143.1 Attributes
5.143.1.1 id (read-only)
uuid IProgress::id
ID of the task.
Current progress value of the task as a whole, in percent. This value depends on how many
operations are already complete. Returns 100 if completed is true.
Estimated remaining time until the task completes, in seconds. Returns 0 once the task has
completed; returns -1 if the remaining time cannot be computed, in particular if the current
progress is 0.
Even if a value is returned, the estimate will be unreliable for low progress values. It will
become more reliable as the task progresses; it is not recommended to display an ETA before at
least 20% of a task have completed.
312
5 Classes (interfaces)
Extended information about the unsuccessful result of the progress operation. May be null if
no extended information is available. Valid only if completed is true and resultCode indicates a
failure.
Number of sub-operations this task is divided into. Every task consists of at least one suboper-
ation.
When non-zero, this specifies the number of milliseconds after which the operation will auto-
matically be canceled. This can only be set on cancelable objects.
313
5 Classes (interfaces)
5.143.2 cancel
void IProgress::cancel()
5.143.3 waitForCompletion
void IProgress::waitForCompletion(
[in] long timeout)
Waits until the task is done (including all sub-operations) with a given timeout in milliseconds;
specify -1 for an indefinite wait.
Note that the VirtualBox/XPCOM/COM/native event queues of the calling thread are not pro-
cessed while waiting. Neglecting event queues may have dire consequences (degrade perfor-
mance, resource hogs, deadlocks, etc.), this is specially so for the main thread on platforms
using XPCOM. Callers are advised wait for short periods and service their event queues between
calls, or to create a worker thread to do the waiting.
If this method fails, the following error codes may be reported:
5.143.4 waitForOperationCompletion
void IProgress::waitForOperationCompletion(
[in] unsigned long operation,
[in] long timeout)
operation Number of the operation to wait for. Must be less than operationCount.
timeout Maximum time in milliseconds to wait or -1 to wait indefinitely.
Waits until the given operation is done with a given timeout in milliseconds; specify -1 for an
indefinite wait.
See for event queue considerations.
If this method fails, the following error codes may be reported:
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
314
5 Classes (interfaces)
5.144.1 Attributes
5.144.1.1 progressId (read-only)
uuid IProgressEvent::progressId
Note: This interface extends IProgressEvent and therefore supports all its methods and
attributes as well.
5.145.1 Attributes
5.145.1.1 percent (read-only)
long IProgressPercentageChangedEvent::percent
New percent
Note: This interface extends IProgressEvent and therefore supports all its methods and
attributes as well.
5.146.1 Attributes
5.146.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IProgressTaskCompletedEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IFormValue and therefore supports all its methods and
attributes as well.
5.147.1 Attributes
5.147.1.1 suffix (read-only)
wstring IRangedIntegerFormValue::suffix
Counterpart of the IFormValue::label attribute. May be null or empty. Usually used for units.
315
5 Classes (interfaces)
5.147.2 getInteger
long IRangedIntegerFormValue::getInteger()
5.147.3 setInteger
IProgress IRangedIntegerFormValue::setInteger(
[in] long value)
value
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.148.1 Attributes
5.148.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IRecordingChangedEvent::midlDoesNotLikeEmptyInterfaces
5.149 IRecordingScreenSettings
The IRecordingScreenSettings interface represents recording settings of a single virtual screen.
This is used only in the IRecordingSettings interface.
5.149.1 Attributes
5.149.1.1 id (read-only)
unsigned long IRecordingScreenSettings::id
316
5 Classes (interfaces)
This setting determines all enabled recording features for this screen.
This setting determines the filename VirtualBox uses to save the recorded content. This setting
cannot be changed while video recording is enabled.
Note: When setting this attribute, the specified path has to be absolute (full path).
When reading this attribute, a full path is always returned.
This setting defines the maximum amount of time in seconds to record. Recording will stop as
soon as the defined time interval has elapsed. If this value is zero, recording will not be limited
by time. This setting cannot be changed while recording is enabled.
This setting determines the maximal number of recording file size in MB. Recording will stop
as soon as the file size has reached the defined value. If this value is zero, recording will not be
limited by the file size. This setting cannot be changed while recording is enabled.
, otherwise set to
false
to disable.
This feature is considered being experimental.
317
5 Classes (interfaces)
Determines the audio codec to use for encoding the recorded audio data. This setting cannot
be changed while recording is enabled.
Determines the Hertz (Hz) rate of the recorded audio data. This setting cannot be changed
while recording is enabled.
Determines the bits per sample of the recorded audio data. This setting cannot be changed
while recording is enabled.
Determines the audio channels of the recorded audio data. Specifiy 2 for stereo or 1 for mono.
More than stereo (2) channels are not supported at the moment. This setting cannot be changed
while recording is enabled.
Determines the video codec to use for encoding the recorded video data. This setting cannot
be changed while recording is enabled.
Determines the horizontal resolution of the recorded video data. This setting cannot be
changed while recording is enabled.
Determines the vertical resolution of the recorded video data. This setting cannot be changed
while recording is enabled.
Determines the bitrate in kilobits per second. Increasing this value makes the video look
better for the cost of an increased file size or transfer rate. This setting cannot be changed while
recording is enabled.
318
5 Classes (interfaces)
Determines the rate control mode. This setting cannot be changed while recording is enabled.
Determines the maximum number of frames per second (FPS). Frames with a higher frequency
will be skipped. Reducing this value increases the number of skipped frames and reduces the file
size or transfer rate. This setting cannot be changed while recording is enabled.
Determines the video scaling method to use. This setting cannot be changed while recording
is enabled.
5.149.2 isFeatureEnabled
boolean IRecordingScreenSettings::isFeatureEnabled(
[in] RecordingFeature feature)
Returns whether a particular recording feature is enabled for this screen or not.
5.150 IRecordingSettings
The IRecordingSettings interface represents recording settings of the virtual machine. This is
used only in the IMachine::recordingSettings attribute.
5.150.1 Attributes
5.150.1.1 enabled (read/write)
boolean IRecordingSettings::enabled
This setting returns an array for recording settings of all configured virtual screens.
5.150.2 getScreenSettings
IRecordingScreenSettings IRecordingSettings::getScreenSettings(
[in] unsigned long screenId)
319
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.151.1 Attributes
5.151.1.1 generation (read-only)
unsigned long IReusableEvent::generation
5.151.2 reuse
void IReusableEvent::reuse()
Marks an event as reused, increments ’generation’, fields shall no longer be considered valid.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
320
5 Classes (interfaces)
• "HostMemoryLow"
• "HostAudioNotResponding"
• "VDIStorageFull"
• "3DSupportIncompatibleAdditions"
5.152.1 Attributes
5.152.1.1 fatal (read-only)
boolean IRuntimeErrorEvent::fatal
5.152.1.2 id (read-only)
wstring IRuntimeErrorEvent::id
Error identifier.
5.153 ISerialPort
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.
See also: IMachine::getSerialPort()
5.153.1 Attributes
5.153.1.1 slot (read-only)
unsigned long ISerialPort::slot
Slot number this serial port is plugged into. Corresponds to the value you pass to
IMachine::getSerialPort() to obtain this instance.
321
5 Classes (interfaces)
Flag whether the serial port is enabled. If disabled, the serial port will not be reported to the
guest OS.
Note: Changing this attribute may fail if the conditions for path are not met.
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 hostMode is PortMode_HostPipe or
PortMode_TCP.
Path to the serial port’s pipe on the host when hostMode is PortMode_HostPipe, the host
serial device name when hostMode is PortMode_HostDevice or the TCP port (server) or host-
name:port (client) when hostMode is PortMode_TCP. For those cases, setting a null or empty
string as the attribute’s value is an error. Otherwise, the value of this property is ignored.
322
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
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.
5.154.1 Attributes
5.154.1.1 serialPort (read-only)
ISerialPort ISerialPortChangedEvent::serialPort
5.155 ISession
The ISession interface represents a client process and allows for locking virtual machines (repre-
sented by IMachine objects) to prevent conflicting changes to the machine.
Any caller wishing to manipulate a virtual machine needs to create a session object first, which
lives in its own process space. Such session objects are then associated with IMachine objects
living in the VirtualBox server process to coordinate such changes.
There are two typical scenarios in which sessions are used:
• To alter machine settings or control a running virtual machine, one needs to lock a machine
for a given session (client process) by calling IMachine::lockMachine().
Whereas multiple sessions may control a running virtual machine, only one process can
obtain a write lock on the machine to prevent conflicting changes. A write lock is also
needed if a process wants to actually run a virtual machine in its own context, such as the
VirtualBox GUI or VBoxHeadless front-ends. They must also lock a machine for their own
sessions before they are allowed to power up the virtual machine.
As a result, no machine settings can be altered while another process is already using
it, either because that process is modifying machine settings or because the machine is
running.
• To start a VM using one of the existing VirtualBox front-ends (e.g. the VirtualBox GUI or
VBoxHeadless), one would use IMachine::launchVMProcess(), which also takes a session
object as its first parameter. This session then identifies the caller and lets the caller control
the started machine (for example, pause machine execution or power it down) as well as
be notified about machine execution state changes.
How sessions objects are created in a client process 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 a
session object automatically whenever IWebsessionManager::logon() is called. A
managed object reference to that session object can be retrieved by calling
IWebsessionManager::getSessionObject().
323
5 Classes (interfaces)
5.155.1 Attributes
5.155.1.1 state (read-only)
SessionState ISession::state
Type of this session. The value of this attribute is valid only if the session currently has a
machine locked (i.e. its state is Locked), otherwise an error will be returned.
Name of this session. Important only for VM sessions, otherwise it it will be remembered, but
not used for anything significant (and can be left at the empty string which is the default). The
value can only be changed when the session state is SessionState_Unlocked. Make sure that you
use a descriptive name which does not conflict with the VM process session names: “GUI/Qt”,
“GUI/SDL” and “headless”.
Console object associated with this session. Only sessions which locked the machine for a VM
process have a non-null console.
5.155.2 unlockMachine
void ISession::unlockMachine()
Unlocks a machine that was previously locked for the current session.
Calling this method is required every time a machine has been locked for a particular session
using the IMachine::launchVMProcess() or IMachine::lockMachine() calls. Otherwise the state
of the machine will be set to Aborted on the server, and changes made to the machine settings
will be lost.
Generally, it is recommended to unlock all machines explicitly before terminating the applica-
tion (regardless of the reason for the termination).
Note: Do not expect the session state (state to return to “Unlocked” immediately after
you invoke this method, particularly if you have started a new VM process. The session
state will automatically return to “Unlocked” once the VM is no longer executing, which
can of course take a very long time.
324
5 Classes (interfaces)
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
The state of the session for the given machine was changed. See also: IMachine::sessionState
5.156.1 Attributes
5.156.1.1 state (read-only)
SessionState ISessionStateChangedEvent::state
5.157 ISharedFolder
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:
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.
Note: Global shared folders are not implemented in the current version of the product.
325
5 Classes (interfaces)
5.157.1 Attributes
5.157.1.1 name (read-only)
wstring ISharedFolder::name
Whether the folder defined by the host path is currently accessible or not.
For example, the folder can be inaccessible if it is placed on the network share that is not
available by the time this property is read.
Desired mount point in the guest for automatically mounting the folder when autoMount is
set. For Windows and OS/2 guests this should be a drive letter, while other guests it should be
a absolute directory. It is possible to combine the two, e.g. “T:/mnt/testrsrc” will be attached to
“T:“ by windows and OS/2 while the unixy guests will mount it at “/mnt/testrsrc”.
When empty the guest will choose a mount point. The guest may do so too should the specified
mount point be in use or otherwise unusable.
Text message that represents the result of the last accessibility check.
Accessibility checks are performed each time the accessible attribute is read. An empty string
is returned if the last accessibility check was successful. A non-empty string indicates a failure
and should normally describe a reason of the failure (for example, a file read error).
326
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when a shared folder is added or removed. The 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.
5.158.1 Attributes
5.158.1.1 scope (read-only)
Scope ISharedFolderChangedEvent::scope
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.159.1 Attributes
5.159.1.1 winId (read/write)
long long IShowWindowEvent::winId
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.
327
5 Classes (interfaces)
5.160 ISnapshot
The ISnapshot interface represents a snapshot of the virtual machine.
Together with the differencing media that are created when a snapshot is taken, a machine
can be brought back to the exact state it was in when the snapshot was taken.
The ISnapshot interface has no methods, only attributes; snapshots are controlled through
methods of the IMachine interface which also manage the media associated with the snapshot.
The following operations exist:
Each snapshot contains a copy of virtual machine’s settings (hardware configuration etc.). This
copy is contained in an immutable (read-only) instance of IMachine which is available from the
snapshot’s machine attribute. When restoring the snapshot, these settings are copied back to the
original machine.
In addition, if the machine was running when the snapshot was taken (IMachine::state is
Running), the current VM state is saved in the snapshot (similarly to what happens when a VM’s
state is saved). The snapshot is then said to be online because when restoring it, the VM will be
running.
If the machine was in Saved saved, the snapshot receives a copy of the execution state file
(IMachine::stateFilePath).
Otherwise, if the machine was not running (PoweredOff or Aborted), the snapshot is offline; it
then contains a so-called “zero execution state”, representing a machine that is powered off.
328
5 Classes (interfaces)
5.160.1 Attributes
5.160.1.1 id (read-only)
uuid ISnapshot::id
Virtual machine this snapshot is taken on. This object stores all settings the machine had when
taking this snapshot.
Note: The returned machine object is immutable, i.e. no any settings can be changed.
329
5 Classes (interfaces)
Parent snapshot (a snapshot this one is based on), or null if the snapshot has no parent (i.e.
is the first snapshot).
Child snapshots (all snapshots having this one as a parent). By inspecting this attribute starting
with a machine’s root snapshot (which can be obtained by calling IMachine::findSnapshot() with
a null UUID), a machine’s snapshots tree can be iterated over.
Note: This interface extends ISnapshotEvent and therefore supports all its methods
and attributes as well.
Snapshot properties (name and/or description) have been changed. See also: ISnapshot
5.161.1 Attributes
5.161.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean ISnapshotChangedEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends ISnapshotEvent and therefore supports all its methods
and attributes as well.
Note: 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).
5.162.1 Attributes
5.162.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean ISnapshotDeletedEvent::midlDoesNotLikeEmptyInterfaces
330
5 Classes (interfaces)
Note: This interface extends IMachineEvent and therefore supports all its methods and
attributes as well.
5.163.1 Attributes
5.163.1.1 snapshotId (read-only)
uuid ISnapshotEvent::snapshotId
Note: This interface extends ISnapshotEvent and therefore supports all its methods
and attributes as well.
Snapshot of the given machine has been restored. See also: ISnapshot
5.164.1 Attributes
5.164.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean ISnapshotRestoredEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends ISnapshotEvent and therefore supports all its methods
and attributes as well.
A new snapshot of the machine has been taken. See also: ISnapshot
5.165.1 Attributes
5.165.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean ISnapshotTakenEvent::midlDoesNotLikeEmptyInterfaces
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when the execution state of the machine has changed. The new state is given.
331
5 Classes (interfaces)
5.166.1 Attributes
5.166.1.1 state (read-only)
MachineState IStateChangedEvent::state
5.167 IStorageController
Represents a storage controller that is attached to a virtual machine (IMachine). Just as drives
(hard disks, DVDs, FDs) are attached to storage controllers in a real computer, virtual drives
(represented by IMediumAttachment) are attached to virtual storage controllers, represented by
this interface.
As opposed to physical hardware, VirtualBox has a very generic concept of a storage controller,
and for purposes of the Main API, all virtual storage is attached to virtual machines via instances
of this interface. There are five types of such virtual storage controllers: IDE, SCSI, SATA, SAS
and Floppy (see bus). Depending on which of these four is used, certain sub-types may be
available and can be selected in controllerType.
Depending on these settings, the guest operating system might see significantly different vir-
tual hardware.
5.167.1 Attributes
5.167.1.1 name (read/write)
wstring IStorageController::name
332
5 Classes (interfaces)
The number of currently usable ports on the controller. The minimum and maximum number
of ports for one controller are stored in minPortCount and maxPortCount.
The bus type of the storage controller (IDE, SATA, SCSI, SAS or Floppy).
The exact variant of storage controller hardware presented to the guest. Depending on this
value, VirtualBox will provide a different virtual storage controller hardware to the guest. For
SATA, SAS and floppy controllers, only one variant is available, but for IDE and SCSI, there are
several.
For SCSI controllers, the default type is LsiLogic.
If true, the storage controller emulation will use a dedicated I/O thread, enable the host I/O
caches and use synchronous file APIs on the host. This was the only option in the API before
VirtualBox 3.2 and is still the default for IDE controllers.
If false, the host I/O cache will be disabled for image files attached to this storage controller.
Instead, the storage controller emulation will use asynchronous I/O APIs on the host. This makes
it possible to turn off the host I/O caches because the emulation can handle unaligned access to
the file. This should be used on OS X and Linux hosts if a high I/O load is expected or many
virtual machines are running at the same time to prevent I/O cache related hangs. This option
new with the API of VirtualBox 3.2 and is now the default for non-IDE storage controllers.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.168.1 Attributes
5.168.1.1 machinId (read-only)
uuid IStorageControllerChangedEvent::machinId
333
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.169.1 Attributes
5.169.1.1 storageDevice (read-only)
IMediumAttachment IStorageDeviceChangedEvent::storageDevice
5.170 IStringArray
When you need to return an array of strings asynchronously (under a progress) you cannot use
by-value out parameter type="wstring" safearray="yes" dir="out", hence this wrapper.
5.170.1 Attributes
5.170.1.1 values (read-only)
wstring IStringArray::values[]
Note: This interface extends IFormValue and therefore supports all its methods and
attributes as well.
334
5 Classes (interfaces)
5.171.1 Attributes
5.171.1.1 multiline (read-only)
boolean IStringFormValue::multiline
5.171.2 getString
wstring IStringFormValue::getString()
5.171.3 setString
IProgress IStringFormValue::setString(
[in] wstring text)
text
5.172 ISystemProperties
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.
5.172.1 Attributes
5.172.1.1 minGuestRAM (read-only)
unsigned long ISystemProperties::minGuestRAM
335
5 Classes (interfaces)
Maximum size of a virtual disk image in bytes. Informational value, does not reflect the limits
of any virtual disk image format.
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. See also: IMachine::setBootOrder()
336
5 Classes (interfaces)
Full path to the default directory used to create new or open existing machines when a machine
settings file name contains no path.
Starting with VirtualBox 4.0, by default, this attribute contains the full path of folder named
“VirtualBox VMs” in the user’s home directory, which depends on the host platform.
When setting this attribute, a full path must be specified. Setting this property to null or an
empty string or the special value “Machines” (for compatibility reasons) will restore that default
value.
If the folder specified herein does not exist, it will be created automatically as needed.
See also: IVirtualBox::createMachine(), IVirtualBox::openMachine()
"VDI"
"vdi"
"VdI"
Note: Setting this property to null or empty string will restore the initial value.
337
5 Classes (interfaces)
Issue a warning if the free disk space is below (or in some disk intensive operation is expected
to go below) the given size in bytes.
Issue a warning if the free disk space is below (or in some disk intensive operation is expected
to go below) the given percentage.
Issue an error if the free disk space is below (or in some disk intensive operation is expected
to go below) the given size in bytes.
Issue an error if the free disk space is below (or in some disk intensive operation is expected
to go below) the given percentage.
Library that provides authentication for Remote Desktop 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 "VBoxAuth". 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.
Note: Setting this property to null or empty string 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 IWebsessionManager::logon() implementation.
As opposed to VRDEAuthLibrary, 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 IWebsessionManager::logon() will
always succeed, no matter what user name and password are supplied.
338
5 Classes (interfaces)
The initial value of this property is "VBoxAuth", meaning that the webservice will use the
same authentication library that is used by default for VRDE (again, see VRDEAuthLibrary). The
format and calling convention of authentication libraries is the same for the webservice as it is
for VRDE.
Note: Setting this property to null or empty string will restore the initial value.
This value specifies how many old release log files are kept.
This value hold the default audio driver for the current system.
The path to the autostart database. Depending on the host this might be a filesystem path or
something else.
The path to the default Guest Additions ISO image. Can be empty if the location is not known
in this installation.
339
5 Classes (interfaces)
Supported bitmap formats which can be used with takeScreenShot and takeScreenShotToArray
methods.
Note: The password is currently stored as plain text! Use the System mode if you
consider the proxy password to be sensitive.
An empty string will cause the behavior to be identical to System. For compatibility with
libproxy, an URL starting with “direct://“ will cause NoProxy behavior.
Returns an array of officially supported values for enum ParavirtProvider, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum ClipboardMode, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum DnDMode, in the sense of what is e.g.
worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum FirmwareType, in the sense of what is
e.g. worth offering in the VirtualBox GUI.
340
5 Classes (interfaces)
Returns an array of officially supported values for enum PointingHIDType, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum KeyboardHIDType, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum VFSType, in the sense of what is e.g.
worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum ImportOptions, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum ExportOptions, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum RecordingAudioCodec, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum RecordingVideoCodec, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
341
5 Classes (interfaces)
Returns an array of officially supported values for enum GraphicsControllerType, in the sense
of what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum CloneOptions, in the sense of what is
e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum AutostopType, in the sense of what is
e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum VMProcPriority, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum NetworkAttachmentType, in the sense
of what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum NetworkAdapterType, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum PortMode, in the sense of what is e.g.
worth offering in the VirtualBox GUI.
342
5 Classes (interfaces)
Returns an array of officially supported values for enum UartType, in the sense of what is e.g.
worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum USBControllerType, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum AudioDriverType, in the sense of what
is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum AudioControllerType, in the sense of
what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum StorageBus, in the sense of what is
e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum StorageControllerType, in the sense
of what is e.g. worth offering in the VirtualBox GUI.
Returns an array of officially supported values for enum ChipsetType, in the sense of what is
e.g. worth offering in the VirtualBox GUI.
5.172.2 getDefaultIoCacheSettingForStorageController
boolean ISystemProperties::getDefaultIoCacheSettingForStorageController(
[in] StorageControllerType controllerType)
Returns the default I/O cache setting for the given storage controller
343
5 Classes (interfaces)
5.172.3 getDeviceTypesForStorageBus
DeviceType[] ISystemProperties::getDeviceTypesForStorageBus(
[in] StorageBus bus)
Returns list of all the supported device types (DeviceType) for the given type of storage bus.
5.172.4 getMaxDevicesPerPortForStorageBus
unsigned long ISystemProperties::getMaxDevicesPerPortForStorageBus(
[in] StorageBus bus)
Returns the maximum number of devices which can be attached to a port for the given storage
bus.
5.172.5 getMaxInstancesOfStorageBus
unsigned long ISystemProperties::getMaxInstancesOfStorageBus(
[in] ChipsetType chipset,
[in] StorageBus bus)
Returns the maximum number of storage bus instances which can be configured for each VM.
This corresponds to the number of storage controllers one can have. Value may depend on
chipset type used.
5.172.6 getMaxInstancesOfUSBControllerType
unsigned long ISystemProperties::getMaxInstancesOfUSBControllerType(
[in] ChipsetType chipset,
[in] USBControllerType type)
Returns the maximum number of USB controller instances which can be configured for each
VM. This corresponds to the number of USB controllers one can have. Value may depend on
chipset type used.
5.172.7 getMaxNetworkAdapters
unsigned long ISystemProperties::getMaxNetworkAdapters(
[in] ChipsetType chipset)
Maximum total number of network adapters associated with every IMachine instance.
344
5 Classes (interfaces)
5.172.8 getMaxNetworkAdaptersOfType
unsigned long ISystemProperties::getMaxNetworkAdaptersOfType(
[in] ChipsetType chipset,
[in] NetworkAttachmentType type)
Maximum number of network adapters of a given attachment type, associated with every
IMachine instance.
5.172.9 getMaxPortCountForStorageBus
unsigned long ISystemProperties::getMaxPortCountForStorageBus(
[in] StorageBus bus)
Returns the maximum number of ports the given storage bus supports.
5.172.10 getMinPortCountForStorageBus
unsigned long ISystemProperties::getMinPortCountForStorageBus(
[in] StorageBus bus)
Returns the minimum number of ports the given storage bus supports.
5.172.11 getStorageBusForStorageControllerType
StorageBus ISystemProperties::getStorageBusForStorageControllerType(
[in] StorageControllerType storageControllerType)
Returns the StorageBus enum value for a given storage controller type.
5.172.12 getStorageControllerHotplugCapable
boolean ISystemProperties::getStorageControllerHotplugCapable(
[in] StorageControllerType controllerType)
5.172.13 getStorageControllerTypesForStorageBus
StorageControllerType[] ISystemProperties::getStorageControllerTypesForStorageBus(
[in] StorageBus storageBus)
Returns the possible StorageControllerType enum values for a given storage bus.
345
5 Classes (interfaces)
5.173 IToken
The IToken interface represents a token passed to an API client, which triggers cleanup actions
when it is explicitly released by calling the abandon() method (preferred, as it is accurately
defined when the release happens), or when the object reference count drops to 0. The latter
way is implicitly used when an API client crashes, however the discovery that there was a crash
can take rather long, depending on the platform (COM needs 6 minutes). So better don’t rely on
the crash behavior too much.
5.173.1 abandon
void IToken::abandon()
Releases this token. Cannot be undone in any way, and makes the token object unusable (even
the dummy() method will return an error), ready for releasing. It is a more defined way than
just letting the reference count drop to 0, because the latter (depending on the platform) can
trigger asynchronous cleanup activity.
5.173.2 dummy
void IToken::dummy()
Purely a NOOP. Useful when using proxy type API bindings (e.g. the webservice) which man-
age objects on behalf of the actual client, using an object reference expiration time based garbage
collector.
5.174 IUSBController
5.174.1 Attributes
5.174.1.1 name (read/write)
wstring IUSBController::name
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.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when a property of the virtual USB controllers changes. Interested callees should
use IUSBController methods and attributes to find out what has changed.
346
5 Classes (interfaces)
5.175.1 Attributes
5.175.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IUSBControllerChangedEvent::midlDoesNotLikeEmptyInterfaces
5.176 IUSBDevice
The IUSBDevice interface represents a virtual USB device attached to the virtual machine.
A collection of objects implementing this interface is stored in the IConsole::USBDevices[]
attribute which lists all USB devices attached to a running virtual machine’s USB controller.
5.176.1 Attributes
5.176.1.1 id (read-only)
uuid IUSBDevice::id
Unique USB device ID. This ID is built from #vendorId, #productId, #revision and #serial-
Number.
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.
347
5 Classes (interfaces)
Host-specific address of the device, uniquely identifying a physically connected device in the
system. Note that the address of a USB device may change across device re-plugs and host
suspend/resume cycles or reboots.
Host USB port number on the hub the device is physically connected to.
Host-specific identifier of the port (including hub) the USB device is physically connected to.
Note that hubs may be dynamically added and removed, and that hub enumeration may not be
consistent across host reboots.
Whether the device is physically connected to a remote VRDE client or to a local host machine.
348
5 Classes (interfaces)
5.177 IUSBDeviceFilter
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
doesn’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.
Note: On the Windows host platform, interval filters are not currently available. Also
all string filter attributes (manufacturer, product, serialNumber) are ignored, so they
behave as any match no matter what string expression is specified.
5.177.1 Attributes
5.177.1.1 name (read/write)
wstring IUSBDeviceFilter::name
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.
349
5 Classes (interfaces)
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.
350
5 Classes (interfaces)
Note: This filter makes sense only for machine USB filters, i.e. it is ignored by IHos-
tUSBDeviceFilter objects.
This is an advanced option for hiding one or more USB interfaces from the guest. The value is
a bit mask 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.
5.178 IUSBDeviceFilters
5.178.1 Attributes
5.178.1.1 deviceFilters (read-only)
IUSBDeviceFilter IUSBDeviceFilters::deviceFilters[]
5.178.2 createDeviceFilter
IUSBDeviceFilter IUSBDeviceFilters::createDeviceFilter(
[in] wstring name)
Creates a new USB device filter. All attributes except the filter name are set to empty (any
match), active is false (the filter is not active).
The created filter can then be added to the list of filters using insertDeviceFilter().
See also: deviceFilters[]
If this method fails, the following error codes may be reported:
351
5 Classes (interfaces)
5.178.3 insertDeviceFilter
void IUSBDeviceFilters::insertDeviceFilter(
[in] unsigned long position,
[in] IUSBDeviceFilter filter)
Note: Duplicates are not allowed, so an attempt to insert a filter that is already in the
collection, will return an error.
5.178.4 removeDeviceFilter
IUSBDeviceFilter IUSBDeviceFilters::removeDeviceFilter(
[in] unsigned long position)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
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
IConsole::attachUSBDevice() or IConsole::detachUSBDevice().
This notification is sent in case of both a succeeded and a failed request completion. When the
request succeeds, the error parameter is null, and the given device has been already added to
(when attached is true) or removed from (when attached is false) the collection represented
by IConsole::USBDevices[]. On failure, the collection doesn’t change and the error parameter
represents the error message describing the failure.
352
5 Classes (interfaces)
5.179.1 Attributes
5.179.1.1 device (read-only)
IUSBDevice IUSBDeviceStateChangedEvent::device
5.180 IUSBProxyBackend
The USBProxyBackend interface represents a source for USB devices available to the host for
attaching to the VM.
5.180.1 Attributes
5.180.1.1 name (read-only)
wstring IUSBProxyBackend::name
5.181 IUnattended
The IUnattended interface represents the pipeline for preparing the Guest OS for fully automated
install.
The typical workflow is:
3. Create, configure and register a machine according to detectedOSTypeId and the other
detectedOS* attributes.
4. Set machine to the new IMachine instance.
5. Set the other IUnattended attributes as desired.
353
5 Classes (interfaces)
6. Call prepare() for the object to check the attribute values and create an internal installer
instance.
5.181.1 Attributes
5.181.1.1 isoPath (read/write)
wstring IUnattended::isoPath
Assign a password to the user. The password is the same for both normal user and for Admin-
istrator / ’root’ accounts.
The full name of the user. This is optional and defaults to user. Please note that not all guests
picks up this attribute.
354
5 Classes (interfaces)
VirtualBox ValidationKit ISO image path. This is used when installTestExecService is set to
true.
Indicates whether the test execution service (TXS) from the VBox ValidationKit should be
installed.
The TXS binary will be taken from the ISO indicated by validationKitIsoPath.
355
5 Classes (interfaces)
This is more or less a Windows specific setting for choosing the UI language setting of the
installer.
The value should be from the list availble via detectedOSLanguages. The typical format is
{language-code}-{COUNTRY} but windows may also use {16-bit code}:{32-bit code} or insert
another component between the language and country codes. We consider the format guest OS
specific.
Note that it is crucial that this is correctly specified for Windows installations. If an unsup-
ported value is given the installer will ask for an installation language and wait for user input.
Best to leave it to the default value.
The default is the first one from detectedOSLanguages.
The path + basename for auxiliary files generated by the unattended installation. This defaults
to the VM folder + Unattended + VM UUID.
The files which gets generated depends on the OS being installed. When installing Win-
dows there is currently only a auxiliaryBasePath + “floppy.img” being created. But for linux,
a “cdrom.viso” and one or more configuration files are generate generated.
356
5 Classes (interfaces)
357
5 Classes (interfaces)
Space separated list of other stuff detected about the OS and the installation ISO.
Set by detectIsoOS() or prepare().
Not yet implemented.
5.181.2 constructMedia
void IUnattended::constructMedia()
Constructors the necessary ISO/VISO/Floppy images, with unattended scripts and all neces-
sary bits on them.
5.181.3 detectIsoOS
void IUnattended::detectIsoOS()
5.181.4 done
void IUnattended::done()
5.181.5 prepare
void IUnattended::prepare()
358
5 Classes (interfaces)
5.181.6 reconfigureVM
void IUnattended::reconfigureVM()
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when VBoxSVC becomes unavailable (due to a crash or similar unexpected cir-
cumstances) or available again.
5.182.1 Attributes
5.182.1.1 available (read-only)
boolean IVBoxSVCAvailabilityChangedEvent::available
5.183 IVBoxSVCRegistration
Implemented by the VirtualBox class factory and registered with VBoxSDS so it can retrieve
IVirtualBox on behalf of other VBoxSVCs.
5.183.1 getVirtualBox
$unknown IVBoxSVCRegistration::getVirtualBox()
5.184 IVFSExplorer
The VFSExplorer interface unifies access to different file system types. This includes local file
systems as well remote file systems like S3. For a list of supported types see VFSType. An
instance of this is returned by IAppliance::createVFSExplorer().
5.184.1 Attributes
5.184.1.1 path (read-only)
wstring IVFSExplorer::path
359
5 Classes (interfaces)
5.184.2 cd
IProgress IVFSExplorer::cd(
[in] wstring dir)
5.184.3 cdUp
IProgress IVFSExplorer::cdUp()
5.184.4 entryList
void IVFSExplorer::entryList(
[out] wstring names[],
[out] unsigned long types[],
[out] long long sizes[],
[out] unsigned long modes[])
modes The list of file modes (in octal form) for the entries.
Returns a list of files/directories after a call to update(). The user is responsible for keeping
this internal list up do date.
5.184.5 exists
wstring[] IVFSExplorer::exists(
[in] wstring names[])
Checks if the given file list exists in the current directory level.
5.184.6 remove
IProgress IVFSExplorer::remove(
[in] wstring names[])
360
5 Classes (interfaces)
5.184.7 update
IProgress IVFSExplorer::update()
Updates the internal list of files/directories from the current directory level. Use entryList() to
get the full list after a call to this method.
5.185 IVRDEServer
5.185.1 Attributes
5.185.1.1 enabled (read/write)
boolean IVRDEServer::enabled
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 estab-
lished by the VRDE server, when a new client connects in single connection mode.
The name of Extension Pack providing VRDE for this VM. Overrides
ISystemProperties::defaultVRDEExtPack.
361
5 Classes (interfaces)
5.185.2 getVRDEProperty
wstring IVRDEServer::getVRDEProperty(
[in] wstring key)
5.185.3 setVRDEProperty
void IVRDEServer::setVRDEProperty(
[in] wstring key,
[in] wstring value)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when a property of the VRDE server changes. Interested callees should use IVRDE-
Server methods and attributes to find out what has changed.
5.186.1 Attributes
5.186.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IVRDEServerChangedEvent::midlDoesNotLikeEmptyInterfaces
5.187 IVRDEServerInfo
Note: With the web service, this interface is mapped to a structure. Attributes that
return this interface will not return an object, but a complete structure containing the
attributes listed below as structure members.
Contains information about the remote desktop (VRDE) server capabilities and status. This is
used in the IConsole::VRDEServerInfo attribute.
362
5 Classes (interfaces)
5.187.1 Attributes
5.187.1.1 active (read-only)
boolean IVRDEServerInfo::active
VRDE server port number. If this property is equal to 0, then the VRDE server failed to start,
usually because there are no free IP ports to bind to. If this property is equal to -1, then the
VRDE server has not yet been started.
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 received in last or current, if still active, connection.
363
5 Classes (interfaces)
Public key exchange method used when connection was established. Values: 0 - RDP4 public
key exchange scheme. 1 - X509 certificates were sent to client.
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
Notification when the status of the VRDE server changes. Interested callees should use
IVRDEServerInfo attributes to find out what is the current status.
5.188.1 Attributes
5.188.1.1 midlDoesNotLikeEmptyInterfaces (read-only)
boolean IVRDEServerInfoChangedEvent::midlDoesNotLikeEmptyInterfaces
364
5 Classes (interfaces)
Note: This interface extends IEvent and therefore supports all its methods and at-
tributes as well.
5.189.1 addApproval
void IVetoEvent::addApproval(
[in] wstring reason)
5.189.2 addVeto
void IVetoEvent::addVeto(
[in] wstring reason)
5.189.3 getApprovals
wstring[] IVetoEvent::getApprovals()
5.189.4 getVetos
wstring[] IVetoEvent::getVetos()
5.189.5 isApproved
boolean IVetoEvent::isApproved()
5.189.6 isVetoed
boolean IVetoEvent::isVetoed()
365
5 Classes (interfaces)
5.190 IVirtualBox
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 machines[] attribute.
Error information handling is a bit special with IVirtualBox: creating an instance will always
succeed. The return of the actual error code/information is postponed to any attribute or method
call. The reason for this is that COM likes to mutilate the error code and lose the detailed error
information returned by instance creation.
5.190.1 Attributes
5.190.1.1 version (read-only)
wstring IVirtualBox::version
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.
This may be followed by a _ALPHA[0-9]*, _BETA[0-9]* or _RC[0-9]* tag in prerelease builds.
Non-Oracle builds may (/shall) also have a publisher tag, at the end. The publisher tag starts
with an underscore just like the prerelease build type tag.
A string representing the version number of the product, without the publisher information
(but still with other tags). See version.
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.
A string representing the VirtualBox API version number. The format is 2 integer numbers
divided by an underscore (e.g. 1_0). After the first public release of packages with a particular
API version the API will not be changed in an incompatible way. Note that this guarantee does
not apply to development builds, and also there is no guarantee that this version is identical to
the first two integer numbers of the package version.
366
5 Classes (interfaces)
This is mainly intended for the VBox Validation Kit so it can fluently deal with incompatible
API changes and new functionality during development (i.e. on trunk).
The high 7 bits (62:56) is the major version number, the next 8 bits (55:48) are the minor
version number, the next 8 bits (47:40) are the build number, and the rest (39:0) is the API
revision number.
The API revision number is manually increased on trunk when making incompatible changes
that the validation kit or others needs to be able to detect and cope with dynamically. It can also
be used to indicate the presence of new features on both trunk and branches.
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
homeFolder plus /VirtualBox.xml.
Array of all machine group names which are used by the machines which are accessible. Each
group is only listed once, however they are listed in no particular order and there is no guarantee
that there are no gaps in the group hierarchy (i.e. "/", "/group/subgroup" is a valid result).
367
5 Classes (interfaces)
Collection of global shared folders. Global shared folders are available to all virtual machines.
New shared folders are added to the collection using createSharedFolder(). Existing shared
folders can be removed using removeSharedFolder().
Note: In the current version of the product, global shared folders are not implemented
and therefore this collection is always empty.
DHCP servers.
368
5 Classes (interfaces)
5.190.2 checkFirmwarePresent
boolean IVirtualBox::checkFirmwarePresent(
[in] FirmwareType firmwareType,
[in] wstring version,
[out] wstring url,
[out] wstring file)
Check if this VirtualBox installation has a firmware of the given type available, either system-
wide or per-user. Optionally, this may return a hint where this firmware can be downloaded
from.
369
5 Classes (interfaces)
5.190.3 composeMachineFilename
wstring IVirtualBox::composeMachineFilename(
[in] wstring name,
[in] wstring group,
[in] wstring createFlags,
[in] wstring baseFolder)
Returns a recommended full path of the settings file name for a new virtual machine.
This API serves two purposes:
See IMachine::name and createMachine() for more details about the machine name.
groupName defines which additional subdirectory levels should be included. It must be either a
valid group name or null or empty string which designates that the machine will not be related
to a machine group.
If baseFolder is a null or empty string (which is recommended), the default machine set-
tings folder (see ISystemProperties::defaultMachineFolder) will be used as a base folder for the
created machine, resulting in a file name like “/home/user/VirtualBox VMs/name/name.vbox”.
Otherwise the given base folder will be used.
This method does not access the host disks. In particular, it does not check for whether a
machine with this name already exists.
5.190.4 createAppliance
IAppliance IVirtualBox::createAppliance()
Creates a new appliance object, which represents an appliance in the Open Virtual Machine
Format (OVF). This can then be used to import an OVF appliance into VirtualBox or to export
machines as an OVF appliance; see the documentation for IAppliance for details.
5.190.5 createCloudNetwork
ICloudNetwork IVirtualBox::createCloudNetwork(
[in] wstring networkName)
networkName
370
5 Classes (interfaces)
5.190.6 createDHCPServer
IDHCPServer IVirtualBox::createDHCPServer(
[in] wstring name)
Creates a DHCP server settings to be used for the given internal network name
If this method fails, the following error codes may be reported:
5.190.7 createMachine
IMachine IVirtualBox::createMachine(
[in] wstring settingsFile,
[in] wstring name,
[in] wstring groups[],
[in] wstring osTypeId,
[in] wstring flags)
settingsFile Fully qualified path where the settings file should be created, empty string or null
for a default folder and file based on the name argument and the primary group. (see
composeMachineFilename()).
name Machine name.
groups Array of group names. null or an empty array have the same meaning as an array with
just the empty string or "/", i.e. create a machine without group association.
osTypeId Guest OS Type ID.
flags Additional property parameters, passed as a comma-separated list of “name=value”
type entries. The following ones are recognized: forceOverwrite=1 to overwrite
an existing machine settings file, UUID=<uuid> to specify a machine UUID and
directoryIncludesUUID=1 to switch to a special VM directory naming scheme which
should not be used unless necessary.
Creates a new virtual machine by creating a machine settings file at the given location.
VirtualBox machine settings files use a custom XML dialect. Starting with VirtualBox 4.0,
a “.vbox” extension is recommended, but not enforced, and machine files can be created at
arbitrary locations.
However, it is recommended that machines are created in the default
machine folder (e.g. “/home/user/VirtualBox VMs/name/name.vbox”; see
ISystemProperties::defaultMachineFolder). If you specify null or empty string (which is
recommended) for the settingsFile argument, composeMachineFilename() is called auto-
matically to have such a recommended name composed based on the machine name given in
the name argument and the primary group.
If the resulting settings file already exists, this method will fail, unless the forceOverwrite flag
is set.
The new machine is created unregistered, with the initial configuration set according to the
specified guest OS type. A typical sequence of actions to create a new virtual machine is as
follows:
1. Call this method to have a new machine created. The returned machine object will be
“mutable” allowing to change any machine property.
2. Configure the machine using the appropriate attributes and methods.
371
5 Classes (interfaces)
3. Call IMachine::saveSettings() to write the settings to the machine’s XML settings file. The
configuration of the newly created machine will not be saved to disk until this method is
called.
4. Call registerMachine() to add the machine to the list of machines known to VirtualBox.
The specified guest OS type identifier must match an ID of one of known guest OS types listed
in the guestOSTypes[] array.
Note: IMachine::settingsModified will return false for the created machine, until any
of machine settings are changed.
Note: There is no way to change the name of the settings file or subfolder of the created
machine directly.
5.190.8 createMedium
IMedium IVirtualBox::createMedium(
[in] wstring format,
[in] wstring location,
[in] AccessMode accessMode,
[in] DeviceType aDeviceTypeType)
format Identifier of the storage format to use for the new medium.
location Location of the storage unit for the new medium.
accessMode Whether to open the image in read/write or read-only mode. For a “DVD” device
type, this is ignored and read-only mode is always assumed.
aDeviceTypeType Must be one of “HardDisk”, “DVD” or “Floppy”.
Creates a new base medium object that will use the given storage format and location for
medium data.
The actual storage unit is not created by this method. In order to do it, and before you are able
to attach the created medium to virtual machines, you must call one of the following methods to
allocate a format-specific storage unit at the specified location:
• IMedium::createBaseStorage()
• IMedium::createDiffStorage()
Some medium attributes, such as IMedium::id, may remain uninitialized until the medium
storage unit is successfully created by one of the above methods.
Depending on the given device type, the file at the storage location must be in one of the media
formats understood by VirtualBox:
372
5 Classes (interfaces)
• With a “HardDisk” device type, the file must be a hard disk image in one of the formats
supported by VirtualBox (see ISystemProperties::mediumFormats[]). After the storage unit
is successfully created and this method succeeds, if the medium is a base medium, it will
be added to the hardDisks[] array attribute.
• With a “DVD” device type, the file must be an ISO 9960 CD/DVD image. After this method
succeeds, the medium will be added to the DVDImages[] array attribute.
• With a “Floppy” device type, the file must be an RAW floppy image. After this method
succeeds, the medium will be added to the floppyImages[] array attribute.
The list of all storage formats supported by this VirtualBox installation can be obtained using
ISystemProperties::mediumFormats[]. If the format attribute is empty or null then the default
storage format specified by ISystemProperties::defaultHardDiskFormat will be used for disks r
creating a storage unit of the medium.
Note that the format of the location string is storage format specific. See IMedium::location
and IMedium for more details.
If this method fails, the following error codes may be reported:
5.190.9 createNATNetwork
INATNetwork IVirtualBox::createNATNetwork(
[in] wstring networkName)
networkName
5.190.10 createSharedFolder
void IVirtualBox::createSharedFolder(
[in] wstring name,
[in] wstring hostPath,
[in] boolean writable,
[in] boolean automount,
[in] wstring autoMountPoint)
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
ISharedFolder to read more about logical names.
373
5 Classes (interfaces)
5.190.11 createUnattendedInstaller
IUnattended IVirtualBox::createUnattendedInstaller()
Creates a new IUnattended guest installation object. This can be used to analyze an installation
ISO to create and configure a new machine for it to be installed on. It can also be used to
(re)install an existing machine.
5.190.12 findCloudNetworkByName
ICloudNetwork IVirtualBox::findCloudNetworkByName(
[in] wstring networkName)
networkName
5.190.13 findDHCPServerByNetworkName
IDHCPServer IVirtualBox::findDHCPServerByNetworkName(
[in] wstring name)
Searches a DHCP server settings to be used for the given internal network name
If this method fails, the following error codes may be reported:
5.190.14 findMachine
IMachine IVirtualBox::findMachine(
[in] wstring nameOrId)
nameOrId What to search for. This can either be the UUID or the name of a virtual machine.
Note: Inaccessible machines cannot be found by name, only by UUID, because their
name cannot safely be determined.
5.190.15 findNATNetworkByName
INATNetwork IVirtualBox::findNATNetworkByName(
[in] wstring networkName)
networkName
374
5 Classes (interfaces)
5.190.16 getExtraData
wstring IVirtualBox::getExtraData(
[in] wstring key)
5.190.17 getExtraDataKeys
wstring[] IVirtualBox::getExtraDataKeys()
Returns an array representing the global extra data keys which currently have values defined.
5.190.18 getGuestOSType
IGuestOSType IVirtualBox::getGuestOSType(
[in] wstring id)
5.190.19 getMachineStates
MachineState[] IVirtualBox::getMachineStates(
[in] IMachine machines[])
5.190.20 getMachinesByGroups
IMachine[] IVirtualBox::getMachinesByGroups(
[in] wstring groups[])
groups What groups to match. The usual group list rules apply, i.e. passing an empty list will
match VMs in the toplevel group, likewise the empty string.
Gets all machine references which are in one of the specified groups.
375
5 Classes (interfaces)
5.190.21 openMachine
IMachine IVirtualBox::openMachine(
[in] wstring settingsFile)
Opens a virtual machine from the existing settings file. The opened machine remains unregis-
tered until you call registerMachine().
The specified settings file name must be fully qualified. The file must exist and be a valid
machine XML settings file whose contents will be used to construct the machine object.
Note: IMachine::settingsModified will return false for the opened machine, until any
of machine settings are changed.
5.190.22 openMedium
IMedium IVirtualBox::openMedium(
[in] wstring location,
[in] DeviceType deviceType,
[in] AccessMode accessMode,
[in] boolean forceNewUuid)
location Location of the storage unit that contains medium data in one of the supported storage
formats.
deviceType Must be one of “HardDisk”, “DVD” or “Floppy”.
accessMode Whether to open the image in read/write or read-only mode. For a “DVD” device
type, this is ignored and read-only mode is always assumed.
forceNewUuid Allows the caller to request a completely new medium UUID for the image which
is to be opened. Useful if one intends to open an exact copy of a previously opened image,
as this would normally fail due to the duplicate UUID.
• With a “HardDisk” device type, the file must be a hard disk image in one of the formats
supported by VirtualBox (see ISystemProperties::mediumFormats[]). After this method
succeeds, if the medium is a base medium, it will be added to the hardDisks[] array at-
tribute.
• With a “DVD” device type, the file must be an ISO 9960 CD/DVD image. After this method
succeeds, the medium will be added to the DVDImages[] array attribute.
• With a “Floppy” device type, the file must be an RAW floppy image. After this method
succeeds, the medium will be added to the floppyImages[] array attribute.
376
5 Classes (interfaces)
After having been opened, the medium can be re-found by this method and can be attached to
virtual machines. See IMedium for more details.
The UUID of the newly opened medium will either be retrieved from the storage location, if
the format supports it (e.g. for hard disk images), or a new UUID will be randomly generated
(e.g. for ISO and RAW files). If for some reason you need to change the medium’s UUID, use
IMedium::setIds().
If a differencing hard disk medium is to be opened by this method, the operation will suc-
ceed only if its parent medium and all ancestors, if any, are already known to this VirtualBox
installation (for example, were opened by this method before).
This method attempts to guess the storage format of the specified medium by reading medium
data at the specified location.
If accessMode is ReadWrite (which it should be for hard disks and floppies), the image is
opened for read/write access and must have according permissions, as VirtualBox may actually
write status information into the disk’s metadata sections.
Note that write access is required for all typical hard disk usage in VirtualBox, since VirtualBox
may need to write metadata such as a UUID into the image. The only exception is opening a
source image temporarily for copying and cloning (see IMedium::cloneTo() when the image will
be closed again soon.
The format of the location string is storage format specific. See IMedium::location and
IMedium for more details.
If this method fails, the following error codes may be reported:
• VBOX_E_FILE_ERROR: Invalid medium storage file location or could not find the medium
at the specified location.
• VBOX_E_IPRT_ERROR: Could not get medium storage format.
• E_INVALIDARG: Invalid medium storage format.
• VBOX_E_INVALID_OBJECT_STATE: Medium has already been added to a media registry.
5.190.23 registerMachine
void IVirtualBox::registerMachine(
[in] IMachine machine)
machine
Registers the machine previously created using createMachine() or opened using
openMachine() within this VirtualBox installation. After successful method invocation, the
IMachineRegisteredEvent event is fired.
Note: This method implicitly calls IMachine::saveSettings() to save all current machine
settings before registering it.
5.190.24 removeCloudNetwork
void IVirtualBox::removeCloudNetwork(
[in] ICloudNetwork network)
network
377
5 Classes (interfaces)
5.190.25 removeDHCPServer
void IVirtualBox::removeDHCPServer(
[in] IDHCPServer server)
5.190.26 removeNATNetwork
void IVirtualBox::removeNATNetwork(
[in] INATNetwork network)
network
5.190.27 removeSharedFolder
void IVirtualBox::removeSharedFolder(
[in] wstring name)
Removes the global shared folder with the given name previously created by
createSharedFolder() from the collection of shared folders and stops sharing it.
5.190.28 setExtraData
void IVirtualBox::setExtraData(
[in] wstring key,
[in] wstring value)
Note: Before performing the actual data change, this method will ask all registered
event listeners using the IExtraDataCanChangeEvent notification for a permission. If
one of the listeners refuses the new value, the change will not be performed.
378
5 Classes (interfaces)
5.190.29 setSettingsSecret
void IVirtualBox::setSettingsSecret(
[in] wstring password)
Unlocks the secret data by passing the unlock password to the server. The server will cache
the password for that machine.
If this method fails, the following error codes may be reported:
5.191 IVirtualBoxClient
Convenience interface for client applications. Treat this as a singleton, i.e. never create more
than one instance of this interface.
At the moment only available for clients of the local API (not usable via the webservice). Once
the session logic is redesigned this might change.
Error information handling is a bit special with IVirtualBoxClient: creating an instance will
always succeed. The return of the actual error code/information is postponed to any attribute
or method call. The reason for this is that COM likes to mutilate the error code and lose the
detailed error information returned by instance creation.
5.191.1 Attributes
5.191.1.1 virtualBox (read-only)
IVirtualBox IVirtualBoxClient::virtualBox
379
5 Classes (interfaces)
5.191.2 checkMachineError
void IVirtualBoxClient::checkMachineError(
[in] IMachine machine)
Perform error checking before using an IMachine object. Generally useful before starting a VM
and all other uses. If anything is not as it should be then this method will return an appropriate
error.
5.192 IVirtualBoxErrorInfo
The IVirtualBoxErrorInfo interface represents extended error information.
Extended error information can be set by VirtualBox components after unsuccessful or par-
tially 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 nsIExcep-
tion 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
next 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: 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 next attribute is the previous error and so on, up to the first error (which is
the last in the chain).
5.192.1 Attributes
5.192.1.1 resultCode (read-only)
long IVirtualBoxErrorInfo::resultCode
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. Value is typed ’long’, not ’result’, to make interface
usable from scripting languages.
380
5 Classes (interfaces)
Optional result data of this error. This will vary depending on the actual error usage. By
default this attribute is not being used.
Note: In MS COM, it is the same as IErrorInfo::GetGUID, except for the data type. In
XPCOM, there is no equivalent.
5.193 IVirtualBoxSDS
381
5 Classes (interfaces)
5.193.1 deregisterVBoxSVC
void IVirtualBoxSDS::deregisterVBoxSVC(
[in] IVBoxSVCRegistration vboxSVC,
[in] long pid)
5.193.2 launchVMProcess
unsigned long IVirtualBoxSDS::launchVMProcess(
[in] wstring machine,
[in] wstring comment,
[in] wstring frontend,
[in] wstring environmentChanges[],
[in] wstring cmdOptions,
[in] unsigned long sessionId)
382
5 Classes (interfaces)
5.193.3 registerVBoxSVC
$unknown IVirtualBoxSDS::registerVBoxSVC(
[in] IVBoxSVCRegistration vboxSVC,
[in] long pid)
5.194 IVirtualSystemDescription
Represents one virtual system (machine) in an appliance. This interface is used in the
IAppliance::virtualSystemDescriptions[] array. After IAppliance::interpret() has been called, that
array contains information about how the virtual systems described in the OVF should best be
imported into VirtualBox virtual machines. See IAppliance for the steps required to import an
OVF into VirtualBox.
5.194.1 Attributes
5.194.1.1 count (read-only)
unsigned long IVirtualSystemDescription::count
5.194.2 addDescription
void IVirtualSystemDescription::addDescription(
[in] VirtualSystemDescriptionType type,
[in] wstring VBoxValue,
[in] wstring extraConfigValue)
type
VBoxValue
extraConfigValue
This method adds an additional description entry to the stack of already available descrip-
tions for this virtual system. This is handy for writing values which aren’t directly supported by
VirtualBox. One example would be the License type of VirtualSystemDescriptionType.
5.194.3 getDescription
void IVirtualSystemDescription::getDescription(
[out] VirtualSystemDescriptionType types[],
[out] wstring refs[],
[out] wstring OVFValues[],
[out] wstring VBoxValues[],
[out] wstring extraConfigValues[])
383
5 Classes (interfaces)
types
refs
OVFValues
VBoxValues
extraConfigValues
Returns information about the virtual system as arrays of instruction items. In each array,
the items with the same indices correspond and jointly represent an import instruction for
VirtualBox.
The list below identifies the value sets that are possible depending on the
VirtualSystemDescriptionType enum value in the array item in aTypes[]. In each case,
the array item with the same index in OVFValues[] will contain the original value as contained
in the OVF file (just for informational purposes), and the corresponding item in aVBoxValues[]
will contain a suggested value to be used for VirtualBox. Depending on the description type, the
aExtraConfigValues[] array item may also be used.
• “OS”: the guest operating system type. There must be exactly one such array item on
import. The corresponding item in aVBoxValues[] contains the suggested guest operating
system for VirtualBox. This will be one of the values listed in IVirtualBox::guestOSTypes[].
The corresponding item in OVFValues[] will contain a numerical value that described the
operating system in the OVF.
• “Name”: the name to give to the new virtual machine. There can be at most one such
array item; if none is present on import, then an automatic name will be created from the
operating system type. The corresponding item im OVFValues[] will contain the suggested
virtual machine name from the OVF file, and aVBoxValues[] will contain a suggestion for
a unique VirtualBox IMachine name that does not exist yet.
• “Description”: an arbitrary description.
• “License”: the EULA section from the OVF, if present. It is the responsibility of the calling
code to display such a license for agreement; the Main API does not enforce any such policy.
• Miscellaneous: reserved for future use.
• “CPU”: the number of CPUs. There can be at most one such item, which will presently be
ignored.
• “Memory”: the amount of guest RAM, in bytes. There can be at most one such array item;
if none is present on import, then VirtualBox will set a meaningful default based on the
operating system type.
• “HardDiskControllerIDE”: an IDE hard disk controller. There can be at most two such
items. An optional value in OVFValues[] and aVBoxValues[] can be “PIIX3” or “PIIX4” to
specify the type of IDE controller; this corresponds to the ResourceSubType element which
VirtualBox writes into the OVF. The matching item in the aRefs[] array will contain an
integer that items of the “Harddisk” type can use to specify which hard disk controller a
virtual disk should be connected to. Note that in OVF, an IDE controller has two chan-
nels, corresponding to “master” and “slave” in traditional terminology, whereas the IDE
storage controller that VirtualBox supports in its virtual machines supports four channels
(primary master, primary slave, secondary master, secondary slave) and thus maps to two
IDE controllers in the OVF sense.
384
5 Classes (interfaces)
• “HardDiskControllerSATA”: an SATA hard disk controller. There can be at most one such
item. This has no value in OVFValues[] or aVBoxValues[]. The matching item in the
aRefs[] array will be used as with IDE controllers (see above).
• “HardDiskControllerSCSI”: a SCSI hard disk controller. There can be at most one such
item. The items in OVFValues[] and aVBoxValues[] will either be “LsiLogic”, “Bus-
Logic” or “LsiLogicSas”. (Note that in OVF, the LsiLogicSas controller is treated as a SCSI
controller whereas VirtualBox considers it a class of storage controllers of its own; see
StorageControllerType). The matching item in the aRefs[] array will be used as with IDE
controllers (see above).
• “HardDiskImage”: a virtual hard disk, most probably as a reference to an image file. There
can be an arbitrary number of these items, one for each virtual disk image that accompanies
the OVF.
The array item in OVFValues[] will contain the file specification from the OVF file (without
a path since the image file should be in the same location as the OVF file itself), whereas the
item in aVBoxValues[] will contain a qualified path specification to where VirtualBox uses
the hard disk image. This means that on import the image will be copied and converted
from the “ovf” location to the “vbox” location; on export, this will be handled the other
way round.
The matching item in the aExtraConfigValues[] array must contain a string of the fol-
lowing format: “controller=<index>;channel=<c>“ In this string, <index> must be an
integer specifying the hard disk controller to connect the image to. That number must be
the index of an array item with one of the hard disk controller types (HardDiskController-
SCSI, HardDiskControllerSATA, HardDiskControllerIDE). In addition, <c> must specify
the channel to use on that controller. For IDE controllers, this can be 0 or 1 for master or
slave, respectively. For compatibility with VirtualBox versions before 3.2, the values 2 and
3 (for secondary master and secondary slave) are also supported, but no longer exported.
For SATA and SCSI controllers, the channel can range from 0-29.
• “CDROM”: a virtual CD-ROM drive. The matching item in aExtraConfigValue[] contains
the same attachment information as with “HardDiskImage” items.
• “CDROM”: a virtual floppy drive. The matching item in aExtraConfigValue[] contains
the same attachment information as with “HardDiskImage” items.
• “NetworkAdapter”: a network adapter. The array item in aVBoxValues[] will specify the
hardware for the network adapter, whereas the array item in aExtraConfigValues[] will
have a string of the “type=<X>“ format, where <X> must be either “NAT” or “Bridged”.
• “USBController”: a USB controller. There can be at most one such item. If, and only if,
such an item is present, USB support will be enabled for the new virtual machine.
• “SoundCard”: a sound card. There can be at most one such item. If and only if such an item
is present, sound support will be enabled for the new virtual machine. Note that the virtual
machine in VirtualBox will always be presented with the standard VirtualBox soundcard,
which may be different from the virtual soundcard expected by the appliance.
5.194.4 getDescriptionByType
void IVirtualSystemDescription::getDescriptionByType(
[in] VirtualSystemDescriptionType type,
[out] VirtualSystemDescriptionType types[],
[out] wstring refs[],
[out] wstring OVFValues[],
[out] wstring VBoxValues[],
[out] wstring extraConfigValues[])
385
5 Classes (interfaces)
type
types
refs
OVFValues
VBoxValues
extraConfigValues
This is the same as getDescription() except that you can specify which types should be re-
turned.
5.194.5 getValuesByType
wstring[] IVirtualSystemDescription::getValuesByType(
[in] VirtualSystemDescriptionType type,
[in] VirtualSystemDescriptionValueType which)
type
which
This is the same as getDescriptionByType() except that you can specify which value types
should be returned. See VirtualSystemDescriptionValueType for possible values.
5.194.6 removeDescriptionByType
void IVirtualSystemDescription::removeDescriptionByType(
[in] VirtualSystemDescriptionType type)
type
Delete all records which are equal to the passed type from the list
5.194.7 setFinalValues
void IVirtualSystemDescription::setFinalValues(
[in] boolean enabled[],
[in] wstring VBoxValues[],
[in] wstring extraConfigValues[])
enabled
VBoxValues
extraConfigValues
This method allows the appliance’s user to change the configuration for the virtual system
descriptions. For each array item returned from getDescription(), you must pass in one boolean
value and one configuration value.
Each item in the boolean array determines whether the particular configuration item should
be enabled. You can only disable items of the types HardDiskControllerIDE, HardDiskCon-
trollerSATA, HardDiskControllerSCSI, HardDiskImage, CDROM, Floppy, NetworkAdapter, USB-
Controller and SoundCard.
For the “vbox” and “extra configuration” values, if you pass in the same arrays as returned in
the aVBoxValues and aExtraConfigValues arrays from getDescription(), the configuration remains
unchanged. Please see the documentation for getDescription() for valid configuration values for
the individual array item types. If the corresponding item in the aEnabled array is false, the
configuration value is ignored.
386
5 Classes (interfaces)
Note: This interface extends IForm and therefore supports all its methods and at-
tributes as well.
5.195.1 getVirtualSystemDescription
IVirtualSystemDescription IVirtualSystemDescriptionForm::getVirtualSystemDescription()
5.196 IWebsessionManager
Note: This interface is supported in the web service only, not in COM/XPCOM.
5.196.1 getSessionObject
ISession IWebsessionManager::getSessionObject(
[in] IVirtualBox refIVirtualBox)
refIVirtualBox
Returns a managed object reference to a new ISession object for every call to this method.
See also: ISession
5.196.2 logoff
void IWebsessionManager::logoff(
[in] IVirtualBox refIVirtualBox)
refIVirtualBox
Logs off the client who has previously logged on with logon() and destroys all resources as-
sociated with the websession (most importantly, all managed objects created in the server while
the websession was active).
5.196.3 logon
IVirtualBox IWebsessionManager::logon(
[in] wstring username,
[in] wstring password)
username
password
Logs a new client onto the webservice and returns a managed object reference to the IVirtu-
alBox 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.
387
6 Enumerations (enums)
6.1 APICMode
BIOS APIC initialization mode. If the hardware does not support the mode then the code falls
back to a lower mode.
Disabled
APIC
X2APIC
6.2 AccessMode
Access mode for opening files.
ReadOnly
ReadWrite
6.3 AdditionsFacilityClass
Guest Additions facility classes.
Driver Driver.
Service System service.
Program Program.
Feature Feature.
6.4 AdditionsFacilityStatus
Guest Additions facility states.
388
6 Enumerations (enums)
6.5 AdditionsFacilityType
Guest Additions facility IDs.
6.6 AdditionsRunLevelType
Guest Additions run level type.
6.7 AdditionsUpdateFlag
Guest Additions update flags.
389
6 Enumerations (enums)
6.8 AudioCodecType
The exact variant of audio codec hardware presented to the guest; see
IAudioAdapter::audioCodec.
6.9 AudioControllerType
Virtual audio controller type.
AC97
SB16
HDA
6.10 AudioDriverType
Host audio driver type.
WinMM Windows multimedia (Windows hosts only, not supported at the moment).
OSS Open Sound System (Linux / Unix hosts only).
ALSA Advanced Linux Sound Architecture (Linux hosts only).
DirectSound DirectSound (Windows hosts only).
SolAudio Solaris audio (Solaris hosts only, not supported at the moment).
6.11 AuthType
VirtualBox authentication type.
390
6 Enumerations (enums)
6.12 AutostopType
Autostop types, used with IMachine::autostopType.
6.13 BIOSBootMenuMode
BIOS boot menu mode.
Disabled
MenuOnly
MessageAndMenu
6.14 BandwidthGroupType
Type of a bandwidth control group.
6.15 BitmapFormat
Format of a bitmap. Generic values for formats used by the source bitmap, the screen shot or
image update APIs.
Opaque Unknown buffer format (the user may not assume any particular format of the buffer).
BGR Generic BGR format without alpha channel. Pixel layout depends on the number of bits
per pixel:
• 32 - bits 31:24 undefined, bits 23:16 R, bits 15:8 G, bits 7:0 B.
• 16 - bits 15:11 R, bits 10:5 G, bits 4:0 B.
391
6 Enumerations (enums)
6.16 CPUPropertyType
Virtual CPU property type. This enumeration represents possible values of the IMachine get- and
setCPUProperty methods.
TripleFaultReset This setting determines whether a triple fault within a guest will trigger an in-
ternal error condition and stop the VM (default) or reset the virtual CPU/VM and continue
execution.
APIC This setting determines whether an APIC is part of the virtual CPU. This feature can only
be turned off when the X2APIC feature is off.
X2APIC This setting determines whether an x2APIC is part of the virtual CPU. Since this feature
implies that the APIC feature is present, it automatically enables the APIC feature when
set.
IBPBOnVMExit If set, force an indirect branch prediction barrier on VM exits if the host CPU
supports it. This setting will significantly slow down workloads causing many VM exits, so
it is only recommended for situation where there is a real need to be paranoid.
IBPBOnVMEntry If set, force an indirect branch prediction barrier on VM entry if the host CPU
supports it. This setting will significantly slow down workloads causing many VM exits, so
it is only recommended for situation where there is a real need to be paranoid.
HWVirt Enabled the hardware virtualization (AMD-V/VT-x) feature on the guest CPU. This re-
quires hardware virtualization on the host CPU.
SpecCtrl If set, the speculation control CPUID bits and MSRs, when available on the host, are
exposed to the guest. Depending on the host CPU and operating system, this may signifi-
cantly slow down workloads causing many VM exits.
SpecCtrlByHost If set, the speculation controls are managed by the host. This is intended for
guests which do not set the speculation controls themselves. Note! This has not yet been
implemented beyond leaving everything to the host OS.
L1DFlushOnEMTScheduling If set and the host is affected by CVE-2018-3646, flushes the
level 1 data cache when the EMT is scheduled to do ring-0 guest execution. There could be
a small performance penalty for certain typs of workloads. For security reasons this setting
will be enabled by default.
L1DFlushOnVMEntry If set and the host is affected by CVE-2018-3646, flushes the level 1 data
on every VM entry. This setting may significantly slow down workloads causing many VM
exits, so it is only recommended for situation where there is a real need to be paranoid.
392
6 Enumerations (enums)
6.17 CertificateVersion
X.509 certificate version numbers.
V1
V2
V3
Unknown
6.18 ChipsetType
Type of emulated chipset (mostly southbridge).
6.19 CleanupMode
Cleanup mode, used with IMachine::unregister().
UnregisterOnly Unregister only the machine, but neither delete snapshots nor detach media.
DetachAllReturnNone Delete all snapshots and detach all media but return none; this will keep
all media registered.
DetachAllReturnHardDisksOnly Delete all snapshots, detach all media and return hard disks
for closing, but not removable media.
Full Delete all snapshots, detach all media and return all media for closing.
6.20 ClipboardMode
Host-Guest clipboard interchange mode.
Disabled
HostToGuest
GuestToHost
Bidirectional
393
6 Enumerations (enums)
6.21 CloneMode
Clone mode, used with IMachine::cloneTo().
6.22 CloneOptions
Clone options, used with IMachine::cloneTo().
Link Create a clone VM where all virtual disks are linked to the original VM.
KeepAllMACs Don’t generate new MAC addresses of the attached network adapters.
KeepNATMACs Don’t generate new MAC addresses of the attached network adapters when
they are using NAT.
KeepDiskNames Don’t change the disk names.
KeepHwUUIDs Don’t change UUID of the machine hardware.
6.23 CloudImageState
Cloud image state
6.24 CloudMachineState
Cloud instance execution state
394
6 Enumerations (enums)
6.25 DHCPConfigScope
Global IDHCPServer::globalConfig
Group IDHCPServer::groupConfigs[]
MachineNIC IDHCPServer::individualConfigs[]
MAC IDHCPServer::individualConfigs[]
6.26 DHCPGroupConditionType
MAC MAC address
MACWildcard MAC address wildcard pattern.
vendorClassID Vendor class ID
6.27 DHCPOption
SubnetMask IPv4 netmask. Set to IDHCPServer::networkMask by default.
TimeOffset UTC offset in seconds (32-bit decimal value).
Routers Space separated list of IPv4 router addresses.
TimeServers Space separated list of IPv4 time server (RFC 868) addresses.
NameServers Space separated list of IPv4 name server (IEN 116) addresses.
DomainNameServers Space separated list of IPv4 DNS addresses.
LogServers Space separated list of IPv4 log server addresses.
CookieServers Space separated list of IPv4 cookie server (RFC 865) addresses.
LPRServers Space separated list of IPv4 line printer server (RFC 1179) addresses.
ImpressServers Space separated list of IPv4 imagen impress server addresses.
ResourseLocationServers Space separated list of IPv4 resource location (RFC 887) addresses.
HostName The client name. See RFC 1035 for character limits.
395
6 Enumerations (enums)
BootFileSize Number of 512 byte blocks making up the boot file (16-bit decimal value).
MeritDumpFile Client core file.
DomainName Domain name for the client.
SwapServer IPv4 address of the swap server that the client should use.
RootPath The path to the root disk the client should use.
ExtensionPath Path to a file containing additional DHCP options (RFC2123).
IPForwarding Whether IP forwarding should be enabled by the client (boolean).
OptNonLocalSourceRouting Whether non-local datagrams should be forwarded by the client
(boolean)
PolicyFilter List of IPv4 addresses and masks paris controlling non-local source routing.
MaxDgramReassemblySize The maximum datagram size the client should reassemble (16-bit
decimal value).
DefaultIPTTL The default time-to-leave on outgoing (IP) datagrams (8-bit decimal value).
PathMTUAgingTimeout RFC1191 path MTU discovery timeout value in seconds (32-bit deci-
mal value).
PathMTUPlateauTable RFC1191 path MTU discovery size table, sorted in ascending order (list
of 16-bit decimal values).
InterfaceMTU The MTU size for the interface (16-bit decimal value).
AllSubnetsAreLocal Indicates whether the MTU size is the same for all subnets (boolean).
BroadcastAddress Broadcast address (RFC1122) for the client to use (IPv4 address).
PerformMaskDiscovery Whether to perform subnet mask discovery via ICMP (boolean).
MaskSupplier Whether to respond to subnet mask requests via ICMP (boolean).
PerformRouterDiscovery Whether to perform router discovery (RFC1256) (boolean).
RouterSolicitationAddress Where to send router solicitation requests (RFC1256) (IPv4 ad-
dress).
StaticRoute List of network and router address pairs addresses.
TrailerEncapsulation Whether to negotiate the use of trailers for ARP (RTF893) (boolean).
ARPCacheTimeout The timeout in seconds for ARP cache entries (32-bit decimal value).
EthernetEncapsulation Whether to use IEEE 802.3 (RTF1042) rather than of v2 (RFC894)
ethernet encapsulation (boolean).
TCPDefaultTTL Default time-to-live for TCP sends (non-zero 8-bit decimal value).
TCPKeepaliveInterval The interface in seconds between TCP keepalive messages (32-bit deci-
mal value).
TCPKeepaliveGarbage Whether to include a byte of garbage in TCP keepalive messages for
backward compatibility (boolean).
NISDomain The NIS (Sun Network Information Services) domain name (string).
396
6 Enumerations (enums)
397
6 Enumerations (enums)
6.28 DHCPOptionEncoding
Normal Value format is specific to the option and generally user friendly.
Hex Value format is a series of hex bytes (09314f3200fe), optionally colons as byte separators
(9:31:4f:32::fe).
6.29 DataFlags
None
Mandatory
Expert
Array
FlagMask
6.30 DataType
Int32
Int8
String
6.31 DeviceActivity
Device activity for IConsole::getDeviceActivity().
Null
Idle
Reading
Writing
6.32 DeviceType
Device type.
Null Null value, may also mean “no device” (not allowed for IConsole::getDeviceActivity()).
Floppy Floppy device.
DVD CD/DVD-ROM device.
HardDisk Hard disk device.
Network Network device.
USB USB device.
SharedFolder Shared folder device.
Graphics3D Graphics device 3D activity.
398
6 Enumerations (enums)
6.33 DirectoryCopyFlag
Directory copying flags.
6.34 DirectoryCreateFlag
Directory creation flags.
6.35 DirectoryOpenFlag
Directory open flags.
6.36 DirectoryRemoveRecFlag
Directory recursive removement flags.
Note: WARNING!! THE FLAGS ARE CURRENTLY IGNORED. THE METHOD APPLIES
ContentAndDir REGARDLESS OF THE INPUT.
ContentAndDir Delete the content of the directory and the directory itself.
ContentOnly Only delete the content of the directory, omit the directory it self.
6.37 DnDAction
Possible actions of a drag’n drop operation.
Ignore Do nothing.
Copy Copy the item to the target.
399
6 Enumerations (enums)
6.38 DnDMode
Drag and drop interchange mode.
Disabled
HostToGuest
GuestToHost
Bidirectional
6.39 ExportOptions
Export options, used with IAppliance::write().
CreateManifest Write the optional manifest file (.mf) which is used for integrity checks prior
import.
ExportDVDImages Export DVD images. Default is not to export them as it is rarely needed for
typical VMs.
StripAllMACs Do not export any MAC address information. Default is to keep them to avoid
losing information which can cause trouble after import, at the price of risking duplicate
MAC addresses, if the import options are used to keep them.
StripAllNonNATMACs Do not export any MAC address information, except for adapters using
NAT. Default is to keep them to avoid losing information which can cause trouble after
import, at the price of risking duplicate MAC addresses, if the import options are used to
keep them.
6.40 FileAccessMode
File open access mode for use with IGuestSession::fileOpen() and IGuestSession::fileOpenEx().
AppendRead Open the file for appending and read. Writes always goes to the end of the file
while reads are done at the current or specified file position.
400
6 Enumerations (enums)
6.41 FileCopyFlag
File copying flags.
Update Only copy when the source file is newer than the destination file or when the destination
file is missing.
6.42 FileOpenAction
What action IGuestSession::fileOpen() and IGuestSession::fileOpenEx() should take whether the
file being opened exists or not.
Note: Currently undefined whether we will inherit mode and ACLs from the existing
file or replace them.
OpenExistingTruncated Opens and truncate an existing file, fails if no file exists. (Was “ot”.)
AppendOrCreate Opens an existing file and places the file pointer at the end of the file, creates
the file if it does not exist. This action implies write access. (Was “oa”.)
401
6 Enumerations (enums)
6.43 FileOpenExFlag
Open flags for IGuestSession::fileOpenEx().
6.44 FileSeekOrigin
What a file seek (IFile::seek()) is relative to.
6.45 FileSharingMode
File sharing mode for IGuestSession::fileOpenEx().
WriteDelete Share write and delete access to the file, denying reading.
All Share all access, i.e. read, write and delete, to the file.
6.46 FileStatus
File statuses.
402
6 Enumerations (enums)
6.47 FirmwareType
Firmware type.
BIOS BIOS Firmware.
EFI EFI Firmware, bitness detected basing on OS type.
EFI32 EFI firmware, 32-bit.
EFI64 EFI firmware, 64-bit.
EFIDUAL EFI firmware, combined 32 and 64-bit.
6.48 FormValueType
Boolean
String
Choice
RangedInteger
6.49 FramebufferCapabilities
Framebuffer capability flags.
UpdateImage Requires NotifyUpdateImage. NotifyUpdate must not be called.
VHWA Supports VHWA interface. If set, then IFramebuffer::processVHWACommand can be
called.
VisibleRegion Supports visible region. If set, then IFramebuffer::setVisibleRegion can be called.
RenderCursor This framebuffer implementation can render a pointer cursor itself. Unless the
MoveCursor capability is also set the cursor will always be rendered at the location of (and
usually using) the host pointer.
MoveCursor Supports rendering a pointer cursor anywhere within the guest screen. Implies
RenderCursor.
6.50 FsObjMoveFlag
File moving flags.
None No flag set.
Replace Replace the destination file, symlink, etc if it exists, however this does not allow re-
placing any directories.
FollowLinks Follow symbolic links in the final components or not (only applied to the given
source and target paths, not to anything else).
AllowDirectoryMoves Allow moving directories accross file system boundraries. Because it is
could be a big undertaking, we require extra assurance that we should do it when re-
quested.
403
6 Enumerations (enums)
6.51 FsObjRenameFlag
Flags for use when renaming file system objects (files, directories, symlink, etc), see
IGuestSession::fsObjRename().
6.52 FsObjType
File system object (file) types.
Unknown Used either if the object has type that is not in this enum, or if the type has not yet
been determined or set.
Fifo FIFO or named pipe, depending on the platform/terminology.
6.53 GraphicsControllerType
Graphics controller type, used with IGraphicsAdapter::graphicsControllerType.
6.54 GuestMonitorChangedEventType
How the guest monitor has been changed.
404
6 Enumerations (enums)
6.55 GuestMonitorStatus
The current status of the guest display.
Blank The guest monitor is enabled in the guest but should display nothing.
6.56 GuestMouseEventMode
The mode (relative, absolute, multi-touch) of a pointer event.
@todo A clear pattern seems to be emerging that we should usually have multiple input devices
active for different types of reporting, so we should really have different event types for relative
(including wheel), absolute (not including wheel) and multi-touch events.
6.57 GuestSessionStatus
Guest session status. This enumeration represents possible values of the IGuestSession::status
attribute.
TimedOutAbnormally Guest session timed out and was not killed successfully.
Down Service/OS is stopping, guest session was killed.
Error Something went wrong.
6.58 GuestSessionWaitForFlag
Guest session waiting flags.
405
6 Enumerations (enums)
6.59 GuestSessionWaitResult
Guest session waiting results. Depending on the session waiting flags (for more information see
GuestSessionWaitForFlag) the waiting result can vary based on the session’s current status.
To wait for a guest session to terminate after it has been created by IGuest::createSession()
one would specify GuestSessionWaitResult_Terminate.
6.60 GuestUserState
State a guest user has been changed to.
LoggedOut A guest user has been successfully logged out of the guest OS.
Locked A guest user has locked its account. This might include running a password-protected
screensaver in the guest.
406
6 Enumerations (enums)
Note: Currently only available for Windows guests since Windows 2000 SP2.
Note: On Windows guests this function currently only supports reporting contiguous
idle times up to 49.7 days per user.
The event will be triggered if a guest user is not active for at least 5 seconds. This threshold
can be adjusted by either altering VBoxService’s command line in the guest to
--vminfo-user-idle-threshold <ms>
/VirtualBox/GuestAdd/VBoxService/--vminfo-user-idle-threshold <ms>
with the RDONLYGUEST flag on the host. In both cases VBoxService needs to be restarted
in order to get the changes applied.
InUse A guest user continued using the guest OS after being idle.
Created A guest user has been successfully created.
RoleChanged To guest OS has changed the role of a user permanently, e.g. granting / denying
administrative rights.
407
6 Enumerations (enums)
6.61 HWVirtExPropertyType
Hardware virtualization property type. This enumeration represents possible values for the
IMachine::getHWVirtExProperty() and IMachine::setHWVirtExProperty() methods.
Null Null value (never used by the API).
Enabled Whether hardware virtualization (VT-x/AMD-V) is enabled at all. If such extensions
are not available, they will not be used.
VPID Whether VT-x VPID is enabled. If this extension is not available, it will not be used.
NestedPaging Whether Nested Paging is enabled. If this extension is not available, it will not
be used.
UnrestrictedExecution Whether VT-x unrestricted execution is enabled. If this feature is not
available, it will not be used.
LargePages Whether large page allocation is enabled; requires nested paging and a 64-bit host.
Force Whether the VM should fail to start if hardware virtualization (VT-x/AMD-V) cannot be
used. If not set, there will be an automatic fallback to software virtualization.
UseNativeApi Use the native hypervisor API instead of the VirtualBox one (HM) for VT-X/AMD-
V. This is ignored if Enabled isn’t set.
6.62 HostNetworkInterfaceMediumType
Type of encapsulation. Ethernet encapsulation includes both wired and wireless Ethernet con-
nections. See also: IHostNetworkInterface
Unknown The type of interface cannot be determined.
Ethernet Ethernet frame encapsulation.
PPP Point-to-point protocol encapsulation.
SLIP Serial line IP encapsulation.
408
6 Enumerations (enums)
6.63 HostNetworkInterfaceStatus
Current status of the interface. See also: IHostNetworkInterface
6.64 HostNetworkInterfaceType
Network interface type.
Bridged
HostOnly
6.65 ImportOptions
Import options, used with IAppliance::importMachines().
KeepAllMACs Don’t generate new MAC addresses of the attached network adapters.
KeepNATMACs Don’t generate new MAC addresses of the attached network adapters when
they are using NAT.
ImportToVDI Import all disks to VDI format
6.66 KeyboardHIDType
Type of keyboard device used in a virtual machine.
None No keyboard.
6.67 KeyboardLED
Keyboard LED indicators.
NumLock
CapsLock
ScrollLock
409
6 Enumerations (enums)
6.68 LockType
Used with IMachine::lockMachine().
Write Lock the machine for writing. This requests an exclusive lock, i.e. there cannot be any
other API client holding any type of lock for this VM concurrently. Remember that a VM
process counts as an API client which implicitly holds the equivalent of a shared lock during
the entire VM runtime.
VM Lock the machine for writing, and create objects necessary for running a VM in this process.
6.69 MachineState
Virtual machine execution state.
This enumeration represents possible values of the IMachine::state attribute.
Below is the basic virtual machine state diagram. It shows how the state changes during virtual
machine execution. The text in square braces shows a method of the IConsole or IMachine
interface that performs the given state transition.
Note that states to the right from PoweredOff, Aborted and Saved in the above diagram are
called online VM states. These states represent the virtual machine which is being executed in
a dedicated process (usually with a GUI window attached to it where you can see the activity
of the virtual machine and interact with it). There are two special pseudo-states, FirstOnline
and LastOnline, that can be used in relational expressions to detect if the given machine state is
online or not:
When the virtual machine is in one of the online VM states (that is, being executed), only a few
machine settings can be modified. Methods working with such settings contain an explicit note
410
6 Enumerations (enums)
about that. An attempt to change any other setting or perform a modifying operation during this
time will result in the VBOX_E_INVALID_VM_STATE error.
All online states except Running, Paused and Stuck are transitional: they represent temporary
conditions of the virtual machine that will last as long as the operation that initiated such a
condition.
The Stuck state is a special case. It means that execution of the machine has reached the “Guru
Meditation” condition. This condition indicates an internal VMM (virtual machine manager)
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).
Note also that any online VM state may transit to the Aborted state. This happens if the process
that is executing the virtual machine terminates unexpectedly (for example, crashes). Other than
that, the Aborted state is equivalent to PoweredOff.
There are also a few additional state diagrams that do not deal with virtual machine execution
and therefore are shown separately. The states shown on these diagrams are called offline VM
states (this includes PoweredOff, Aborted and Saved too).
The first diagram shows what happens when a lengthy setup operation is being executed (such
as IMachine::attachDevice()).
The next two diagrams demonstrate the process of taking a snapshot of a powered off virtual
machine, restoring the state to that as of a snapshot or deleting a snapshot, respectively.
Saved The machine is not currently running, but the execution state of the machine has been
saved to an external file when it was running, from where it can be resumed.
Teleported The machine was teleported to a different host (or process) and then powered off.
Take care when powering it on again may corrupt resources it shares with the teleportation
target (e.g. disk and network).
411
6 Enumerations (enums)
Aborted The process running the machine has terminated abnormally. This may indicate a
crash of the VM process in host execution context, or the VM process has been terminated
externally.
Running The machine is currently being executed.
Paused Execution of the machine has been paused.
Stuck Execution of the machine has reached the “Guru Meditation” condition. This indicates a
severe error in the hypervisor itself.
Teleporting The machine is about to be teleported to a different host or process. It is possible
to pause a machine in this state, but it will go to the TeleportingPausedVM state and it
will not be possible to resume it again unless the teleportation fails.
LiveSnapshotting A live snapshot is being taken. The machine is running normally, but some
of the runtime configuration options are inaccessible. Also, if paused while in this state it
will transition to OnlineSnapshotting and it will not be resume the execution until the
snapshot operation has completed.
Starting Machine is being started after powering it on from a zero execution state.
Stopping Machine is being normally stopped powering it off, or after the guest OS has initiated
a shutdown sequence.
Saving Machine is saving its execution state to a file.
Restoring Execution state of the machine is being restored from a file after powering it on from
the saved execution state.
TeleportingPausedVM The machine is being teleported to another host or process, but it is not
running. This is the paused variant of the Teleporting state.
TeleportingIn Teleporting the machine state in from another host or process.
412
6 Enumerations (enums)
6.70 MediumFormatCapabilities
Medium format capability flags.
6.71 MediumState
Virtual medium state. See also: IMedium
NotCreated Associated medium storage does not exist (either was not created yet or was
deleted).
Created Associated storage exists and accessible; this gets set if the accessibility check per-
formed by IMedium::refreshState() was successful.
LockedRead Medium is locked for reading (see IMedium::lockRead()), no data modification is
possible.
LockedWrite Medium is locked for writing (see IMedium::lockWrite()), no concurrent data
reading or modification is possible.
Inaccessible Medium accessibility check (see IMedium::refreshState()) has not yet been
performed, or else, associated medium storage is not accessible. In the first case,
IMedium::lastAccessError is empty, in the second case, it describes the error that occurred.
Creating Associated medium storage is being created.
Deleting Associated medium storage is being deleted.
413
6 Enumerations (enums)
6.72 MediumType
Virtual medium type. For each IMedium, this defines how the medium is attached to a virtual
machine (see IMediumAttachment) and what happens when a snapshot (see ISnapshot) is taken
of a virtual machine which has the medium attached. At the moment DVD and floppy media are
always of type “writethrough”.
Normal Normal medium (attached directly or indirectly, preserved when taking snapshots).
Immutable Immutable medium (attached indirectly, changes are wiped out the next time the
virtual machine is started).
Writethrough Write through medium (attached directly, ignored when taking snapshots).
Shareable Allow using this medium concurrently by several machines.
MultiAttach A medium which is indirectly attached, so that one base medium can be used for
several VMs which have their own differencing medium to store their modifications. In
some sense a variant of Immutable with unset AutoReset flag in each differencing medium.
6.73 MediumVariant
Virtual medium image variant. More than one flag may be set. See also: IMedium
Standard No particular variant requested, results in using the backend default.
VmdkSplit2G VMDK image split in chunks of less than 2GByte.
VmdkRawDisk VMDK image representing a raw disk.
VmdkStreamOptimized VMDK streamOptimized image. Special import/export format which
is read-only/append-only.
VmdkESX VMDK format variant used on ESX products.
VdiZeroExpand Fill new blocks with zeroes while expanding image file.
Fixed Fixed image. Only allowed for base images.
Diff Differencing image. Only allowed for child images.
Formatted Special flag which requests formatting the disk image. Right now supported for
floppy images only.
NoCreateDir Special flag which suppresses automatic creation of the subdirectory. Only used
when passing the medium variant as an input parameter.
414
6 Enumerations (enums)
6.74 MouseButtonState
Mouse button state.
LeftButton
RightButton
MiddleButton
WheelUp
WheelDown
XButton1
XButton2
MouseStateMask
6.75 NATAliasMode
AliasLog
AliasProxyOnly
AliasUseSamePorts
6.76 NATProtocol
Protocol definitions used with NAT port-forwarding rules.
6.77 NetworkAdapterPromiscModePolicy
The promiscuous mode policy of an interface.
415
6 Enumerations (enums)
6.78 NetworkAdapterType
Network adapter type.
6.79 NetworkAttachmentType
Network attachment type.
HostOnly
Generic
NATNetwork
Cloud
6.80 ParavirtProvider
The paravirtualized guest interface provider. This enumeration represents possible values for the
IMachine::paravirtProvider attribute.
416
6 Enumerations (enums)
6.81 PartitionTableType
Partition table types.
MBR
GPT
6.82 PathStyle
The path style of a system. (Values matches the RTPATH_STR_F_STYLE_XXX defines in
iprt/path.h!)
DOS DOS-style paths with forward and backward slashes, drive letters and UNC. Known from
DOS, OS/2 and Windows.
UNIX UNIX-style paths with forward slashes only.
Unknown The path style is not known, most likely because the guest additions aren’t active yet.
6.83 PointingHIDType
Type of pointing device used in a virtual machine.
None No mouse.
PS2Mouse PS/2 auxiliary device, a.k.a. mouse.
USBMouse USB mouse (relative pointer).
USBTablet USB tablet (absolute pointer). Also enables a relative USB mouse in addition.
ComboMouse Combined device, working as PS/2 or USB mouse, depending on guest behavior.
Using this device can have negative performance implications.
USBMultiTouch USB multi-touch device. Also enables the USB tablet and mouse devices.
6.84 PortMode
The PortMode enumeration represents possible communication modes for the virtual serial port
device.
417
6 Enumerations (enums)
6.85 ProcessCreateFlag
Guest process execution flags.
Note: The values are passed to the guest additions, so its not possible to change (move)
or reuse values.here. See EXECUTEPROCESSFLAG_XXX in GuestControlSvc.h.
Note: This is not yet implemented and is currently silently ignored. We will document
the protocolVersion number for this feature once it appears, so don’t use it till then.
UnquotedArguments Work around for Windows and OS/2 applications not following normal
argument quoting and escaping rules. The arguments are passed to the application without
any extra quoting, just a single space between each.
6.86 ProcessInputFlag
Guest process input flags.
None No flag set.
EndOfFile End of file (input) reached.
6.87 ProcessInputStatus
Process input statuses.
Undefined Undefined state.
Broken Input pipe is broken.
Available Input pipe became available for writing.
Written Data has been successfully written.
Overflow Too much input data supplied, data overflow.
418
6 Enumerations (enums)
6.88 ProcessOutputFlag
Guest process output flags for specifying which type of output to retrieve.
6.89 ProcessPriority
Process priorities.
6.90 ProcessStatus
Process execution statuses.
6.91 ProcessWaitForFlag
Process waiting flags.
419
6 Enumerations (enums)
6.92 ProcessWaitResult
Process waiting results. Depending on the process waiting flags (for more information see
ProcessWaitForFlag) the waiting result can vary based on the processes’ current status.
To wait for a guest process to terminate after it has been created by
IGuestSession::processCreate() or IGuestSession::processCreateEx() one would specify Process-
WaitFor_Terminate.
If a guest process has been started with ProcessCreateFlag_WaitForStdOut a client can wait
with ProcessWaitResult_StdOut for new data to arrive on stdout; same applies for ProcessCre-
ateFlag_WaitForStdErr and ProcessWaitResult_StdErr.
6.93 ProcessorFeature
CPU features.
HWVirtEx
PAE
LongMode
NestedPaging
UnrestrictedGuest
NestedHWVirt
6.94 ProxyMode
Proxy setting: System (default), NoProxy and Manual. ISystemProperties::proxyMode
420
6 Enumerations (enums)
6.95 Reason
Internal event reason type.
6.96 RecordingAudioCodec
Recording audio codec enumeration.
6.97 RecordingDestination
Recording destination enumeration.
None No destination.
File Destination is a regular file.
6.98 RecordingFeature
Recording features enumeration.
6.99 RecordingVideoCodec
Recording video codec enumeration.
421
6 Enumerations (enums)
6.100 RecordingVideoRateControlMode
Recording video rate control mode enumeration.
6.101 RecordingVideoScalingMethod
Recording video scaling method enumeration.
6.102 Scope
Scope of the operation.
A generic enumeration used in various methods to define the action or argument scope.
Global
Machine
Session
6.103 ScreenLayoutMode
How IDisplay::setScreenLayout() method should work.
Apply If the guest is already at desired mode then the API might avoid setting the mode.
Reset Always set the new mode even if the guest is already at desired mode.
Attach Attach new screens and always set the new mode for existing screens.
Silent Do not notify the guest of the change. Normally this is wished, but it might not be when
re-setting monitor information from the last session (no hotplug happened, as it is still the
same virtual monitor).
6.104 SessionState
Session state. This enumeration represents possible values of IMachine::sessionState and
ISession::state attributes.
422
6 Enumerations (enums)
Locked In IMachine::sessionState, this means that the machine is currently locked for a session,
whose process identifier can then be found in the IMachine::sessionPID attribute.
In ISession::state, this means that a machine is currently locked for this session,
and the mutable machine object can be found in the ISession::machine attribute (see
IMachine::lockMachine() for details).
Spawning A new process is being spawned for the machine as a result of
IMachine::launchVMProcess() call. This state also occurs as a short transient state
during an IMachine::lockMachine() call.
Unlocking The session is being unlocked.
6.105 SessionType
Session type. This enumeration represents possible values of the ISession::type attribute.
6.106 SettingsVersion
Settings version of VirtualBox settings files. This is written to the “version” attribute of the root
“VirtualBox” element in the settings file XML and indicates which VirtualBox version wrote the
file.
423
6 Enumerations (enums)
6.107 StorageBus
The bus type of the storage controller (IDE, SATA, SCSI, SAS or Floppy); see
IStorageController::bus.
6.108 StorageControllerType
The exact variant of storage controller hardware presented to the guest; see
IStorageController::controllerType.
424
6 Enumerations (enums)
6.109 SymlinkReadFlag
Symbolic link reading flags.
6.110 SymlinkType
Symbolic link types. This is significant when creating links on the Windows platform, ignored
elsewhere.
6.111 TouchContactState
Touch event contact state.
6.112 USBConnectionSpeed
USB device/port speed state. This enumeration represents speeds at which a USB device can
communicate with the host.
The speed is a function of both the device itself and the port which it is attached to, including
hubs and cables in the path.
Note: Due to differences in USB stack implementations on various hosts, the reported
speed may not exactly match the actual speed.
425
6 Enumerations (enums)
6.113 USBControllerType
The USB controller type. IUSBController::type.
6.114 USBDeviceFilterAction
Actions for host USB device filters. See also: IHostUSBDeviceFilter, USBDeviceState
6.115 USBDeviceState
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
(IHost::USBDeviceFilters[]) are activated. They can either ignore the device, or put it to
USBDeviceState_Held state, or do nothing. Unless the device is ignored by global filters, filters
of all currently running guests (IUSBDeviceFilters::deviceFilters[]) are activated that can put it
to USBDeviceState_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 USBDeviceState_Unavailable, USBDeviceState_Busy or USBDeviceS-
tate_Available, depending on the current device usage.
Besides auto-capturing based on filters, the device can be manually captured by guests
(IConsole::attachUSBDevice()) if its state is USBDeviceState_Busy, USBDeviceState_Available or
USBDeviceState_Held.
Note: Due to differences in USB stack implementations in Linux and Win32, states US-
BDeviceState_Busy and USBDeviceState_Unavailable are applicable only to the Linux
version of the product. This also means that (IConsole::attachUSBDevice()) can only
succeed on Win32 if the device state is USBDeviceState_Held.
426
6 Enumerations (enums)
Unavailable Being used by the host computer exclusively, not available to guests.
Busy Being used by the host computer, potentially available to guests.
Available Not used by the host computer, available to guests (the host computer can also start
using the device at any time).
Held Held by the VirtualBox server (ignored by the host computer), available to guests.
Captured Captured by one of the guest computers, not available to anybody else.
6.116 UartType
The UART type represents the emulated UART chip for the serial port device.
U16450 The most basic emulated UART which doesn’t support FIFO operation.
U16550A The successor of the 16450 UART introducing a 16 byte FIFO to reduce operational
overhead.
U16750 This UART developed by Texas Instruments introduced a 64 byte FIFO and hardware
flow control.
6.117 VBoxEventType
Type of an event. See IEvent for an introduction to VirtualBox event handling.
427
6 Enumerations (enums)
428
6 Enumerations (enums)
429
6 Enumerations (enums)
6.118 VFSType
Virtual file systems supported by VFSExplorer.
File
Cloud
S3
WebDav
6.119 VMExecutionEngine
The main execution engine of a VM.
6.120 VMProcPriority
Virtual machine process priorities.
Flat Assumes a scheduling policy which puts the process at the default priority and with all
thread at the same priority
Low Assumes a scheduling policy which puts the process mostly below the default priority of
the host OS.
Normal Assume a scheduling policy which shares the CPU resources fairly with other processes
running with the default priority of the host OS.
High Assumes a scheduling policy which puts the task above the default priority of the host OS.
This policy might easily cause other tasks in the system to starve.
6.121 VirtualSystemDescriptionType
Used with IVirtualSystemDescription to describe the type of a configuration value.
Ignore
OS
Name
Product
Vendor
430
6 Enumerations (enums)
Version
ProductUrl
VendorUrl
Description
License
Miscellaneous
CPU
Memory
HardDiskControllerIDE
HardDiskControllerSATA
HardDiskControllerSCSI
HardDiskControllerSAS
HardDiskImage
Floppy
CDROM
NetworkAdapter
USBController
SoundCard
SettingsFile Optional, may be unset by the API caller. If this is changed by the API caller it
defines the absolute path of the VM settings file and therefore also the VM folder with
highest priority.
BaseFolder Optional, may be unset by the API caller. If set (and SettingsFile is not changed),
defines the VM base folder (taking the primary group into account if also set).
PrimaryGroup Optional, empty by default and may be unset by the API caller. Defines the pri-
mary group of the VM after import. May influence the selection of the VM folder. Additional
groups may be configured later using IMachine::groups[], after importing.
CloudInstanceShape
CloudDomain
CloudBootDiskSize
CloudBucket
CloudOCIVCN
CloudPublicIP
CloudProfileName
CloudOCISubnet
CloudKeepObject
431
6 Enumerations (enums)
CloudLaunchInstance
CloudInstanceId
CloudImageId
CloudInstanceState
CloudImageState
CloudInstanceDisplayName
CloudImageDisplayName
CloudOCILaunchMode
CloudPrivateIP
CloudBootVolumeId
CloudOCIVCNCompartment
CloudOCISubnetCompartment
CloudPublicSSHKey
BootingFirmware
6.122 VirtualSystemDescriptionValueType
Used with IVirtualSystemDescription::getValuesByType() to describe the value type to fetch.
Reference
Original
Auto
ExtraConfig
432
7 Working with the Cloud
VirtualBox supports and goes towards the Oracle tendencies like “move to the Cloud”.
Parameter “description” must contain all information and settings needed for creation a custom
image in OCI. At least next entries must be presented there before the call:
433
7 Working with the Cloud
434
7 Working with the Cloud
As the result of operation user will have a file with the suffix “.oci” on the local host. This file is
a TAR archive which contains a bootable instance image in QCOW2 format and a JSON file with
some metadata related to the imported instance. The function takes the parameter “description”
(which is IVirtualSystemDescription) Parameter “description” must contain all information and
settings needed for successful operation result. At least next entries must be presented there
before the call:
435
8 Host-Guest Communication Manager
The VirtualBox Host-Guest Communication Manager (HGCM) allows a guest application or a
guest driver to call a host shared library. The following features of VirtualBox are implemented
using HGCM:
• Shared Folders
• Shared Clipboard
• Guest configuration interface
The shared library contains a so called HGCM service. The guest HGCM clients establish
connections to the service to call it. When calling a HGCM service the client supplies a function
code and a number of parameters for the function.
Name Description
size Size of the entire request.
version Version of the header, must be set to 0x10001.
type Type of the request.
rc HGCM return code, which will be set by the VMM device.
reserved1 A reserved field 1.
reserved2 A reserved field 2.
flags HGCM flags, set by the VMM device.
result The HGCM result code, set by the VMM device.
436
8 Host-Guest Communication Manager
Note:
8.2.2 Connect
The connection request must be issued by the guest HGCM client before it can call the HGCM
service (VMMDevHGCMConnect):
Name Description
header The generic HGCM request header with type equal to
VMMDevReq_HGCMConnect (60).
type The type of the service location information (32 bit).
loca- The service location information (128 bytes).
tion
clien- The client identifier assigned to the connecting client by the HGCM subsystem
tId (32-bit).
The type field tells the HGCM how to look for the requested service:
437
8 Host-Guest Communication Manager
• VBoxSharedFolders
• VBoxSharedClipboard
• VBoxGuestPropSvc
• VBoxSharedOpenGL
There is no difference between both types of HGCM services, only the location mechanism is
different.
The client identifier is returned by the host and must be used in all subsequent requests by the
client.
8.2.3 Disconnect
This request disconnects the client and makes the client identifier invalid (VMMDevHGCMDis-
connect):
Name Description
header The generic HGCM request header with type equal to
VMMDevReq_HGCMDisconnect (61).
clien- The client identifier previously returned by the connect request (32-bit).
tId
Name Description
header The generic HGCM request header with type equal to either
VMMDevReq_HGCMCall32 (62) or VMMDevReq_HGCMCall64 (63).
clien- The client identifier previously returned by the connect request (32-bit).
tId
func- The function code to be processed by the service (32 bit).
tion
cParms The number of following parameters (32-bit). This value is 0 if the function
requires no parameters.
parms An array of parameter description structures (HGCMFunctionParameter32 or
HGCMFunctionParameter64).
438
8 Host-Guest Communication Manager
The
8.2.5 Cancel
This request cancels a call request (VMMDevHGCMCancel):
Name Description
header The generic HGCM request header with type equal to VMMDevReq_HGCMCancel
(64).
VBoxGuestHGCMConnectInfo data;
439
8 Host-Guest Communication Manager
memset(&data, sizeof(VBoxGuestHGCMConnectInfo));
data.result = VINF_SUCCESS;
data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
strcpy (data.Loc.u.host.achName, "VBoxSharedFolders");
if (RT_SUCCESS (rc))
{
rc = data.result;
}
if (RT_SUCCESS (rc))
{
/* Get the assigned client identifier. */
ulClientID = data.u32ClientID;
}
VBoxGuestHGCMDisconnectInfo data;
data.result = VINF_SUCCESS;
data.u32ClientID = ulClientID;
440
8 Host-Guest Communication Manager
} VBoxSFRead;
...
VBoxSFRead data;
/* Initialize parameters. */
data.root.type = VMMDevHGCMParmType_32bit;
data.root.u.value32 = pMap->root;
data.handle.type = VMMDevHGCMParmType_64bit;
data.handle.u.value64 = hFile;
data.offset.type = VMMDevHGCMParmType_64bit;
data.offset.u.value64 = offset;
data.cb.type = VMMDevHGCMParmType_32bit;
data.cb.u.value32 = *pcbBuffer;
data.buffer.type = VMMDevHGCMParmType_LinAddr_Out;
data.buffer.u.Pointer.size = *pcbBuffer;
data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
if (RT_SUCCESS (rc))
{
rc = data.callInfo.result;
*pcbBuffer = data.cb.u.value32; /* This is returned by the HGCM service. */
}
• VBOXGUEST_IOCTL_HGCM_CONNECT
• VBOXGUEST_IOCTL_HGCM_DISCONNECT
• VBOXGUEST_IOCTL_HGCM_CALL
These IOCTL’s get the same input buffer as VbglHGCM* functions and the output buffer has the
same format as the input buffer. The same address can be used as the input and output buffers.
For example see the guest part of shared clipboard, which runs as an application and uses the
HGCM interface.
441
8 Host-Guest Communication Manager
The service must check the ptable->cbSize and ptable->u32Version fields of the input
structure and fill the remaining fields with function pointers of entry points and the size of the
required client buffer size.
The HGCM service gets a dedicated thread, which calls service entry points synchronously, that
is the service will be called again only when a previous call has returned. However, the guest
calls can be processed asynchronously. The service must call a completion callback when the
operation is actually completed. The callback can be issued from another thread as well.
Service entry points are listed in the VBox/hgcmsvc.h in the VBOXHGCMSVCFNTABLE structure.
Entry Description
pf- The service is being unloaded.
nUn-
load
pfn- A client u32ClientID is connected to the service. The pvClient parameter points
Con- to an allocated memory buffer which can be used by the service to store the client
nect information.
pfnDis- A client is being disconnected.
con-
nect
pfn- A guest client calls a service function. The callHandle must be used in the
Call VBOXHGCMSVCHELPERS::pfnCallComplete callback when the call has been
processed.
pfn- Called by the VirtualBox host components to perform functions which should be
Host- not accessible by the guest. Usually this entry point is used by VirtualBox to
Call configure the service.
pfn- The VM state is being saved and the service must save relevant information using
SaveS- the SSM API (VBox/ssm.h).
tate
pfn- The VM is being restored from the saved state and the service must load the saved
Load- information and be able to continue operations from the saved state.
State
442
9 RDP Web Control
The VirtualBox RDP Web Control (RDPWeb) provides remote access to a running VM. RDPWeb is
a RDP (Remote Desktop Protocol) client based on Flash technology and can be used from a Web
browser with a Flash plugin.
<div id="FlashRDP">
</div>
would have ElementId equal to FlashRDP and Element equal to the div element.
• RDPWebClient.embedSWF(SWFFileName, ElementId)
Uses SWFObject library to replace the HTML element with the Flash movie.
• RDPWebClient.isRDPWebControlById(ElementId)
Returns true if the given id refers to a RDPWeb Flash element.
443
9 RDP Web Control
• RDPWebClient.isRDPWebControlByElement(Element)
Returns true if the given element is a RDPWeb Flash element.
• RDPWebClient.getFlashById(ElementId)
Returns an element, which is referenced by the given id. This function will try to resolve
any element, event if it is not a Flash movie.
• getProperty(Name)
• setProperty(Name)
• connect()
• disconnect()
• keyboardSendCAD()
• Rebranding to Oracle.
444
10 Drag and Drop
Since VirtualBox 4.2 it’s possible to transfer files from host to the Linux guests by dragging files,
directories or text from the host into the guest’s screen. This is called drag and drop (DnD).
In version 5.0 support for Windows guests has been added, as well as the ability to transfer
data the other way around, that is, from the guest to the host.
Note: Currently only the VirtualBox Manager frontend supports drag and drop.
This chapter will show how to use the required interfaces provided by VirtualBox for adding
drag and drop functionality to third-party frontends.
• text/uri-list - A list of URIs (Uniform Resource Identifier, see RFC 3986) pointing to the
file and/or directory paths already transferred from the source to the target.
• text/plain;charset=utf-8 and UTF8_STRING - text in UTF-8 format.
• text/plain, TEXT and STRING - plain ASCII text, depending on the source’s active ANSI
page (if any).
If, for whatever reason, a certain default format should not be supported or a new format
should be registered, IDnDSource and IDnDTarget have methods derived from IDnDBase which
provide adding, removing and enumerating specific formats.
445
10 Drag and Drop
Note: Registering new or removing default formats on the guest side currently is not
implemented.
446
11 VirtualBox external authentication
modules
VirtualBox supports arbitrary external modules to perform authentication. The module is
used when the authentication method is set to “external” for a particular VM VRDE access
and the library was specified with VBoxManage setproperty vrdeauthlibrary. Web ser-
vice also use the authentication module which was specified with VBoxManage setproperty
websrvauthlibrary.
This library will be loaded by the VM or web service process on demand, i.e. when the first
remote desktop connection is made by a client or when a client that wants to use the web service
logs on.
External authentication is the most flexible as the external handler can both choose to grant
access to everyone (like the “null” authentication method would) and delegate the request to
the guest authentication component. When delegating the request to the guest component, the
handler will still be called afterwards with the option to override the result.
An authentication library is required to implement exactly one entry point:
#include "VBoxAuth.h"
/**
* Authentication library entry point.
*
* Parameters:
*
* szCaller The name of the component which calls the library (UTF8).
* pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
* guestJudgement Result of the guest authentication.
* szUser User name passed in by the client (UTF8).
* szPassword Password passed in by the client (UTF8).
* szDomain Domain passed in by the client (UTF8).
* fLogon Boolean flag. Indicates whether the entry point is called
* for a client logon or the client disconnect.
* clientId Server side unique identifier of the client.
*
* Return code:
*
* AuthResultAccessDenied Client access has been denied.
* AuthResultAccessGranted Client has the right to use the
* virtual machine.
* AuthResultDelegateToGuest Guest operating system must
* authenticate the client and the
* library must be called again with
* the result of the guest
* authentication.
*
* Note: When ’fLogon’ is 0, only pszCaller, pUuid and clientId are valid and the return
* code is ignored.
*/
AuthResult AUTHCALL AuthEntry(
const char *szCaller,
PAUTHUUID pUuid,
AuthGuestJudgement guestJudgement,
const char *szUser,
const char *szPassword
const char *szDomain
int fLogon,
447
11 VirtualBox external authentication modules
unsigned clientId)
{
/* Process request against your authentication source of choice. */
// if (authSucceeded(...))
// return AuthResultAccessGranted;
return AuthResultAccessDenied;
}
A note regarding the UUID implementation of the pUuid argument: VirtualBox uses a consis-
tent binary representation of UUIDs on all platforms. For this reason the integer fields comprising
the UUID are stored as little endian values. If you want to pass such UUIDs to code which as-
sumes that the integer fields are big endian (often also called network byte order), you need to
adjust the contents of the UUID to e.g. achieve the same string representation. The required
changes are:
Using this conversion you will get identical results when converting the binary UUID to the string
representation.
The guestJudgement argument contains information about the guest authentication status.
For the first call, it is always set to AuthGuestNotAsked. In case the AuthEntry function returns
AuthResultDelegateToGuest, a guest authentication will be attempted and another call to the
AuthEntry is made with its result. This can be either granted / denied or no judgement (the
guest component chose for whatever reason to not make a decision). In case there is a problem
with the guest authentication module (e.g. the Additions are not installed or not running or the
guest did not respond within a timeout), the “not reacted” status will be returned.
448
12 Using Java API
12.1 Introduction
VirtualBox can be controlled by a Java API, both locally (COM/XPCOM) and from remote (SOAP)
clients. As with the Python bindings, a generic glue layer tries to hide all platform differences,
allowing for source and binary compatibility on different platforms.
12.2 Requirements
To use the Java bindings, there are certain requirements depending on the platform. First of all,
you need JDK 1.5 (Java 5) or later. Also please make sure that the version of the VirtualBox API
.jar file exactly matches the version of VirtualBox you use. To avoid confusion, the VirtualBox API
provides versioning in the Java package name, e.g. the package is named org.virtualbox_3_2
for VirtualBox version 3.2.
• XPCOM - for all platforms, but Microsoft Windows. A Java bridge based on JavaXPCOM is
shipped with VirtualBox. The classpath must contain vboxjxpcom.jar and the vbox.home
property must be set to location where the VirtualBox binaries are. Please make sure that
the JVM bitness matches bitness of VirtualBox you use as the XPCOM bridge relies on native
libraries.
Start your application like this:
• COM - for Microsoft Windows. We rely on Jacob - a generic Java to COM bridge - which
has to be installed seperately. See http://sourceforge.net/projects/jacob-project/ for in-
stallation instructions. Also, the VirtualBox provided vboxjmscom.jar must be in the class
path.
Start your application like this:
• SOAP - all platforms. Java 6 is required, as it comes with builtin support for SOAP via the
JAX-WS library. Also, the VirtualBox provided vbojws.jar must be in the class path. In
the SOAP case it’s possible to create several VirtualBoxManager instances to communicate
with multiple VirtualBox hosts.
Start your application like this:
Exception handling is also generalized by the generic glue layer, so that all methods could
throw VBoxException containing human-readable text message (see getMessage() method)
along with wrapped original exception (see getWrapped() method).
449
12 Using Java API
12.3 Example
This example shows a simple use case of the Java API. Differences for SOAP vs. local version
are minimal, and limited to the connection setup phase (see ws variable). In the SOAP case it’s
possible to create several VirtualBoxManager instances to communicate with multiple VirtualBox
hosts.
import org.virtualbox_4_3.*;
....
VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
boolean ws = false; // or true, if we need the SOAP version
if (ws)
{
String url = "http://myhost:18034";
String user = "test";
String passwd = "test";
mgr.connect(url, user, passwd);
}
IVirtualBox vbox = mgr.getVBox();
System.out.println("VirtualBox version: " + vbox.getVersion() + "\n");
// get first VM name
String m = vbox.getMachines().get(0).getName();
System.out.println("\nAttempting to start VM ’" + m + "’");
// start it
mgr.startVm(m, null, 7000);
if (ws)
mgr.disconnect();
mgr.cleanup();
For more a complete example, see TestVBox.java, shipped with the SDK. It contains excep-
tion handling and error printing code, which is important for reliable larger scale projects.
It is good practice in long-running API clients to process the system events every now and then
in the main thread (does not work in other threads). As a rule of thumb it makes sense to process
them every few 100msec to every few seconds). This is done by calling
mgr.waitForEvents(0);
This avoids that a large number of system events accumulate, which can need a significant
amount of memory, and as they also play a role in object cleanup it helps freeing additional
memory in a timely manner which is used by the API implementation itself. Java’s garbage
collection approach already needs more memory due to the delayed freeing of memory used
by no longer accessible objects, and not processing the system events exacerbates the memory
usage. The TestVBox.java example code sprinkles such lines over the code to achieve the
desired effect. In multi-threaded applications it can be called from the main thread periodically.
Sometimes it’s possible to use the non-zero timeout variant of the method, which then waits
the specified number of milliseconds for events, processing them immediately as they arrive. It
achieves better runtime behavior than separate sleeping/processing.
450
13 License information
The sample code files shipped with the SDK are generally licensed liberally to make it easy for
anyone to use this code for their own application code.
The Java files under bindings/webservice/java/jax-ws/ (library files for the object-
oriented web service) are, by contrast, licensed under the GNU Lesser General Public License
(LGPL) V2.1.
See sdk/bindings/webservice/java/jax-ws/src/COPYING.LIB for the full text of the
LGPL 2.1.
When in doubt, please refer to the individual source code files shipped with this SDK.
451
14 Main API change log
Generally, VirtualBox will maintain API compatibility within a major release; a major release
occurs when the first or the second of the three version components of VirtualBox change (that
is, in the x.y.z scheme, a major release is one where x or y change, but not when only z changes).
In other words, updates like those from 2.0.0 to 2.0.2 will not come with API breakages.
Migration between major releases most likely will lead to API breakage, so please make sure
you updated code accordingly. The OOWS Java wrappers enforce that mechanism by putting
VirtualBox classes into version-specific packages such as org.virtualbox_2_2. This approach
allows for connecting to multiple VirtualBox versions simultaneously from the same Java appli-
cation.
The following sections list incompatible changes that the Main API underwent since the origi-
nal release of this SDK Reference with VirtualBox 2.0. A change is deemed “incompatible” only
if it breaks existing client code (e.g. changes in method parameter lists, renamed or removed
interfaces and similar). In other words, the list does not contain new interfaces, methods or
attributes or other changes that do not affect existing client code.
Note: For now all screen settings will share the same settings, e.g. different settings on
a per-screen basis is not implemented yet.
452
14 Main API change log
• The webservice version of the ISharedFolder interface was changed from a struct to
a managed object. This causes incompatiblities on the protocol level as the shared
folder attributes are not returned in the responses of IVirtualBox::getSharedFolders and
IMachine::getSharedFolders anymore. They return object UUIDs instead which need be
wrapped by stub objects. The change is not visible when using the appropriate client bind-
ings from the most recent VirtualBox SDK.
453
14 Main API change log
• A new event has been introduced, which signals when a snapshot has been restored:
ISnapshotRestoredEvent. Previously the event ISnapshotDeletedEvent was signalled,
which isn’t logical (but could be distinguished from actual deletion by the fact that the
snapshot was still there).
• The method IVirtualBox::createMedium() replaces VirtualBox::createHardDisk().
Adjusting existing code needs adding two parameters with value AccessMode_ReadWrite
and DeviceType_HardDisk respectively. The new method supports creating floppy and
DVD images, and (less obviously) further API functionality such as cloning floppy images.
• The method IMachine::getStorageControllerByInstance() now has an additional parameter
(first parameter), for specifying the storage bus which the storage controller must be using.
The method was not useful before, as the instance numbers are only unique for a specfic
storage bus.
• The attribute IMachine::sessionType has been renamed to IMachine::sessionName().
This cleans up the confusing terminology (as the session type is something different).
• The attribute IMachine::guestPropertyNotificationPatterns has been removed. In
practice it was not usable because it is too global and didn’t distinguish between API clients.
• Drag and drop APIs were changed as follows:
– Methods for providing host to guest drag and drop functionality, such
as IGuest::dragHGEnter, IGuest::dragHGMove(), IGuest::dragHGLeave(),
IGuest::dragHGDrop() and IGuest::dragHGPutData(), have been moved to an
abstract base class called IDnDTarget. VirtualBox implements this base class in
the IGuestDnDTarget interface. The implementation can be used by using the
IGuest::dnDTarget() method.
Methods for providing guest to host drag and drop functionality,
such as IGuest::dragGHPending(), IGuest::dragGHDropped() and
IGuest::dragGHGetData(), have been moved to an abstract base class called
IDnDSource. VirtualBox implements this base class in the IGuestDnDSource inter-
face. The implementation can be used by using the IGuest::dnDSource() method.
– The DragAndDropAction enumeration has been renamed to DnDAction.
– The DragAndDropMode enumeration has been renamed to DnDMode.
– The attribute IMachine::dragAndDropMode has been renamed to
IMachine::dnDMode().
– The event IDragAndDropModeChangedEvent has been renamed to
IDnDModeChangedEvent.
• IDisplay and IFramebuffer interfaces were changed to allow IFramebuffer object to reside
in a separate frontend process:
– IDisplay::ResizeCompleted() has been removed, because the IFramebuffer object does
not provide the screen memory anymore.
– IDisplay::SetFramebuffer() has been replaced with IDisplay::AttachFramebuffer() and
IDisplay::DetachFramebuffer().
– IDisplay::GetFramebuffer() has been replaced with IDisplay::QueryFramebuffer().
– IDisplay::GetScreenResolution() has a new output parameter guestMonitorStatus
which tells whether the monitor is enabled in the guest.
– IDisplay::TakeScreenShot() and IDisplay::TakeScreenShotToArray() have
a new parameter bitmapFormat. As a consequence of this, IDis-
play::TakeScreenShotPNGToArray() has been removed.
454
14 Main API change log
455
14 Main API change log
456
14 Main API change log
457
14 Main API change log
• The IGuestFile APIs are now implemented to provide native guest file access from the host.
• The parameter list for IMedium::updateGuestAdditions() was modified. It now supports
specifying optional command line arguments for the Guest Additions installer performing
the actual update on the guest.
• A new event IGuestUserStateChangedEvent was introduced to provide guest user status
updates to the host via event listeners. To use this event there needs to be at least the 4.3
Guest Additions installed on the guest. At the moment only the states “Idle” and “InUse” of
the GuestUserState enumeration arei supported on Windows guests, starting at Windows
2000 SP2.
• The attribute IGuestSession::protocolVersion was added to provide a convenient way to
lookup the guest session’s protocol version it uses to communicate with the installed Guest
Additions on the guest. Older Guest Additions will set the protocol version to 1, whereas
Guest Additions 4.3 will set the protocol version to 2. This might change in the future as
new features arise.
• IDisplay::getScreenResolution has been extended to return the display position in
the guest.
• The IUSBController class is not a singleton of IMachine anymore but IMachine contains
a list of USB controllers present in the VM. The USB device filter handling was moved to
IUSBDeviceFilters.
458
14 Main API change log
• The use of acronyms in API enumeration, interface, attribute and method names has been
made much more consistent, previously they sometimes were lowercase and sometimes
mixed case. They are now consistently all caps:
459
14 Main API change log
• The method IVirtualBox::openMedium() has one more parameter now, which allows re-
solving duplicate medium UUIDs without the need for external tools.
• The INetworkAdapter interface has been cleaned up. The various methods to activate an
attachment type have been replaced by the INetworkAdapter::attachmentType setter.
460
14 Main API change log
Additionally each attachment mode now has its own attribute, which means that host only
networks no longer share the settings with bridged interfaces.
To allow introducing new network attachment implementations without making API
changes, the concept of a generic network attachment driver has been introduced, which
is configurable through key/value properties.
• This version introduces the guest facilities concept. A guest facility either represents a mod-
ule or feature the guest is running or offering, which is defined by AdditionsFacilityType.
Each facility is member of a AdditionsFacilityClass and has a current status indicated by
AdditionsFacilityStatus, together with a timestamp (in ms) of the last status update.
To address the above concept, the following changes were made:
– In the IGuest interface, the following were removed:
∗ the supportsSeamless attribute;
∗ the supportsGraphics attribute;
– The function IGuest::getFacilityStatus() was added. It quickly provides a facility’s
status without the need to get the facility collection with IGuest::facilities.
– The attribute IGuest::facilities was added to provide an easy to access collection of
all currently known guest facilities, that is, it contains all facilies where at least one
status update was made since the guest was started.
– The interface IAdditionsFacility was added to represent a single facility returned by
IGuest::facilities.
– AdditionsFacilityStatus was added to represent a facility’s overall status.
– AdditionsFacilityType and AdditionsFacilityClass were added to represent the facility’s
type and class.
• The confusingly named and impractical session APIs were changed. In existing client code,
the following changes need to be made:
– Replace any IVirtualBox::openSession(uuidMachine, ...) API call with the
machine’s IMachine::lockMachine() call and a LockType.Write argument. The func-
tionality is unchanged, but instead of “opening a direct session on a machine” all
documentation now refers to “obtaining a write lock on a machine for the client ses-
sion”.
– Similarly, replace any IVirtualBox::openExistingSession(uuidMachine, ...)
call with the machine’s IMachine::lockMachine() call and a LockType.Shared argu-
ment. Whereas it was previously impossible to connect a client session to a run-
ning VM process in a race-free manner, the new API will atomically either write-
lock the machine for the current session or establish a remote link to an exist-
ing session. Existing client code which tried calling both openSession() and
openExistingSession() can now use this one call instead.
– Third, replace any IVirtualBox::openRemoteSession(uuidMachine, ...) call
with the machine’s IMachine::launchVMProcess() call. The functionality is un-
changed.
461
14 Main API change log
– The SessionState enum was adjusted accordingly: “Open” is now “Locked”, “Closed”
is now “Unlocked”, “Closing” is now “Unlocking”.
• Virtual machines created with VirtualBox 4.0 or later no longer register their media in the
global media registry in the VirtualBox.xml file. Instead, such machines list all their
media in their own machine XML files. As a result, a number of media-related APIs had to
be modified again.
– Neither IVirtualBox::createHardDisk() nor IVirtualBox::openMedium() register
media automatically any more.
– IMachine::attachDevice() and IMachine::mountMedium() now take an IMedium ob-
ject instead of a UUID as an argument. It is these two calls which add media to a
registry now (either a machine registry for machines created with VirtualBox 4.0 or
later or the global registry otherwise). As a consequence, if a medium is opened but
never attached to a machine, it is no longer added to any registry any more.
– To reduce code duplication, the APIs IVirtualBox::findHardDisk(), getHard-
Disk(), findDVDImage(), getDVDImage(), findFloppyImage() and getFloppyIm-
age() have all been merged into IVirtualBox::findMedium(), and IVirtual-
Box::openHardDisk(), openDVDImage() and openFloppyImage() have all been
merged into IVirtualBox::openMedium().
– The rare use case of changing the UUID and parent UUID of a medium previously
handled by openHardDisk() is now in a separate IMedium::setIDs method.
– ISystemProperties::get/setDefaultHardDiskFolder() have been removed
since disk images are now by default placed in each machine’s folder.
– The ISystemProperties::infoVDSize attribute replaces the getMaxVDISize() API call;
this now uses bytes instead of megabytes.
• Machine management APIs were enhanced as follows:
– IVirtualBox::createMachine() is no longer restricted to creating machines in the de-
fault “Machines” folder, but can now create machines at arbitrary locations. For this
to work, the parameter list had to be changed.
– The long-deprecated IVirtualBox::createLegacyMachine() API has been re-
moved.
– To reduce code duplication and for consistency with the aforementioned media APIs,
IVirtualBox::getMachine() has been merged with IVirtualBox::findMachine(),
and IMachine::getSnapshot() has been merged with IMachine::findSnapshot().
– IVirtualBox::unregisterMachine() was replaced with IMachine::unregister()
with additional functionality for cleaning up machine files.
– IMachine::deleteSettings has been replaced by IMachine::delete, which allows
specifying which disk images are to be deleted as part of the deletion, and because it
can take a while it also returns a IProgress object reference, so that the completion
of the asynchronous activities can be monitored.
– IConsole::forgetSavedState has been renamed to
IConsole::discardSavedState().
• All event callbacks APIs were replaced with a new, generic event mechanism that can be
used both locally (COM, XPCOM) and remotely (web services). Also, the new mechanism
is usable from scripting languages and a local Java. See events for details. The new concept
will require changes to all clients that used event callbacks.
• additionsActive() was replaced with additionsRunLevel() and getAdditionsStatus() in
order to support a more detailed status of the current Guest Additions loading/readiness
462
14 Main API change log
• To address shared folders auto-mounting support, the following APIs were extended to
require an additional automount parameter:
– IVirtualBox::createSharedFolder()
– IMachine::createSharedFolder()
– IConsole::createSharedFolder()
Also, a new property named autoMount was added to the ISharedFolder interface.
• The appliance (OVF) APIs were enhanced as follows:
– IMachine::export received an extra parameter location, which is used to decide
for the disk naming.
– IAppliance::write() received an extra parameter manifest, which can suppress creat-
ing the manifest file on export.
– IVFSExplorer::entryList() received two extra parameters sizes and modes, which
contains the sizes (in bytes) and the file access modes (in octal form) of the returned
files.
• Support for remote desktop access to virtual machines has been cleaned up to allow third
party implementations of the remote desktop server. This is called the VirtualBox Remote
Desktop Extension (VRDE) and can be added to VirtualBox by installing the corresponding
extension package; see the VirtualBox User Manual for details.
The following API changes were made to support the VRDE interface:
– IVRDPServer has been renamed to IVRDEServer.
– IRemoteDisplayInfo has been renamed to IVRDEServerInfo.
– IMachine::VRDEServer replaces VRDPServer.
– IConsole::VRDEServerInfo replaces RemoteDisplayInfo.
– ISystemProperties::VRDEAuthLibrary replaces RemoteDisplayAuthLibrary.
– The following methods have been implemented in IVRDEServer to support generic
VRDE properties:
∗ IVRDEServer::setVRDEProperty
∗ IVRDEServer::getVRDEProperty
∗ IVRDEServer::VRDEProperties
A few implementation-specific attributes of the old IVRDPServer interface have been
removed and replaced with properties:
∗ IVRDPServer::Ports has been replaced with the "TCP/Ports" property. The
property value is a string, which contains a comma-separated list of ports or
ranges of ports. Use a dash between two port numbers to specify a range. Exam-
ple: "5000,5010-5012"
∗ IVRDPServer::NetAddress has been replaced with the "TCP/Address" prop-
erty. The property value is an IP address string. Example: "127.0.0.1"
∗ IVRDPServer::VideoChannel has been replaced with the
"VideoChannel/Enabled" property. The property value is either "true"
or "false"
463
14 Main API change log
464
14 Main API change log
and IMachine interfaces were affected the most. Existing code using them to configure
storage and media needs to be carefully checked.
All media (hard disks, floppies and CDs/DVDs) are now uniformly handled through
the IMedium interface. The device-specific interfaces (IHardDisk, IDVDImage,
IHostDVDDrive, IFloppyImage and IHostFloppyDrive) have been merged into
IMedium; CD/DVD and floppy media no longer need special treatment. The device type of
a medium determines in which context it can be used. Some functionality was moved to
the other storage-related interfaces.
IMachine::attachHardDisk and similar methods have been renamed and generalized to
deal with any type of drive and medium. IMachine::attachDevice() is the API method for
adding any drive to a storage controller. The floppy and DVD/CD drives are no longer
handled specially, and that means you can have more than one of them. As before, drives
can only be changed while the VM is powered off. Mounting (or unmounting) removable
media at runtime is possible with IMachine::mountMedium().
Newly created virtual machines have no storage controllers associated with them. Even
the IDE Controller needs to be created explicitly. The floppy controller is now visible as
a separate controller, with a new storage bus type. For each storage bus type you can
query the device types which can be attached, so that it is not necessary to hardcode any
attachment rules.
This required matching changes e.g. in the callback interfaces (the medium specific change
notification was replaced by a generic medium change notification) and removing associ-
ated enums (e.g. DriveState). In many places the incorrect use of the plural form “media”
was replaced by “medium”, to improve consistency.
465
14 Main API change log
466
14 Main API change log
• The interfaces having a “2” suffix attached to them with version 2.1 were renamed again
to have that suffix removed. This time around, this change involves only the name, there
are no functional differences.
As a result, IDVDImage2 is now IDVDImage; IHardDisk2 is now IHardDisk; IHard-
Disk2Attachment is now IHardDiskAttachment.
Consequentially, all related methods and attributes that had a “2” suffix have
been renamed; for example, IMachine::attachHardDisk2 now becomes IMa-
chine::attachHardDisk().
• IVirtualBox::openHardDisk has an extra parameter for opening a disk read/write or read-
only.
• The remaining collections were replaced by more performant safe-arrays. This affects the
following collections:
– IGuestOSTypeCollection
– IHostDVDDriveCollection
– IHostFloppyDriveCollection
– IHostUSBDeviceCollection
– IHostUSBDeviceFilterCollection
– IProgressCollection
– ISharedFolderCollection
– ISnapshotCollection
– IUSBDeviceCollection
– IUSBDeviceFilterCollection
• Since “Host Interface Networking” was renamed to “bridged networking” and host-only
networking was introduced, all associated interfaces needed renaming as well. In detail:
– The HostNetworkInterfaceType enum has been renamed to
HostNetworkInterfaceMediumType
– The IHostNetworkInterface::type attribute has been renamed to
IHostNetworkInterface::mediumType
– INetworkAdapter::attachToHostInterface() has been renamed to INet-
workAdapter::attachToBridgedInterface
– In the IHost interface, createHostNetworkInterface() has been renamed to
createHostOnlyNetworkInterface()
– Similarly, removeHostNetworkInterface() has been renamed to
removeHostOnlyNetworkInterface()
467
14 Main API change log
– Previously, the old IHardDisk interface had several derivatives called IVirtualDiskIm-
age, IVMDKImage, IVHDImage, IISCSIHardDisk and ICustomHardDisk for the various
disk formats supported by VirtualBox. The new IHardDisk2 interface that comes with
version 2.1 now supports all hard disk image formats itself.
– IHardDiskFormat is a new interface to describe the available back-ends for hard disk
images (e.g. VDI, VMDK, VHD or iSCSI). The IHardDisk2::format attribute can be
used to find out the back-end that is in use for a particular hard disk image. ISys-
temProperties::hardDiskFormats[] contains a list of all back-ends supported by the
system. ISystemProperties::defaultHardDiskFormat contains the default system for-
mat.
– In addition, the new IMedium interface is a generic interface for hard disk, DVD and
floppy images that contains the attributes and methods shared between them. It can
be considered a parent class of the more specific interfaces for those images, which
are now IHardDisk2, IDVDImage2 and IFloppyImage2.
In each case, the “2” versions of these interfaces replace the earlier versions that did
not have the “2” suffix. Previously, the IDVDImage and IFloppyImage interfaces were
entirely unrelated to IHardDisk.
– As a result, all parts of the API that previously referenced IHardDisk, IDVDIm-
age or IFloppyImage or any of the old subclasses are gone and will have replace-
ments that use IHardDisk2, IDVDImage2 and IFloppyImage2; see, for example, IMa-
chine::attachHardDisk2.
– In particular, the IVirtualBox::hardDisks2 array replaces the earlier IVirtual-
Box::hardDisks collection.
• IGuestOSType was extended to group operating systems into families and for 64-bit sup-
port.
• The IHostNetworkInterface interface was completely rewritten to account for the changes
in how Host Interface Networking is now implemented in VirtualBox 2.1.
• The IVirtualBox::machines2[] array replaces the former IVirtualBox::machines collection.
468