1 | /* $Id: VBoxManageModifyVM.cpp 44528 2013-02-04 14:27:54Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - Implementation of modifyvm command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*******************************************************************************
|
---|
19 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #ifndef VBOX_ONLY_DOCS
|
---|
22 | #include <VBox/com/com.h>
|
---|
23 | #include <VBox/com/array.h>
|
---|
24 | #include <VBox/com/ErrorInfo.h>
|
---|
25 | #include <VBox/com/errorprint.h>
|
---|
26 | #include <VBox/com/EventQueue.h>
|
---|
27 |
|
---|
28 | #include <VBox/com/VirtualBox.h>
|
---|
29 | #endif /* !VBOX_ONLY_DOCS */
|
---|
30 |
|
---|
31 | #include <iprt/cidr.h>
|
---|
32 | #include <iprt/ctype.h>
|
---|
33 | #include <iprt/file.h>
|
---|
34 | #include <iprt/param.h>
|
---|
35 | #include <iprt/path.h>
|
---|
36 | #include <iprt/stream.h>
|
---|
37 | #include <iprt/string.h>
|
---|
38 | #include <iprt/getopt.h>
|
---|
39 | #include <VBox/log.h>
|
---|
40 | #include "VBoxManage.h"
|
---|
41 |
|
---|
42 | #ifndef VBOX_ONLY_DOCS
|
---|
43 | using namespace com;
|
---|
44 | /** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
|
---|
45 | #if defined(_MSC_VER)
|
---|
46 | # pragma optimize("g", off)
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | enum
|
---|
50 | {
|
---|
51 | MODIFYVM_NAME = 1000,
|
---|
52 | MODIFYVM_GROUPS,
|
---|
53 | MODIFYVM_OSTYPE,
|
---|
54 | MODIFYVM_MEMORY,
|
---|
55 | MODIFYVM_PAGEFUSION,
|
---|
56 | MODIFYVM_VRAM,
|
---|
57 | MODIFYVM_FIRMWARE,
|
---|
58 | MODIFYVM_ACPI,
|
---|
59 | MODIFYVM_IOAPIC,
|
---|
60 | MODIFYVM_PAE,
|
---|
61 | MODIFYVM_SYNTHCPU,
|
---|
62 | MODIFYVM_HWVIRTEX,
|
---|
63 | MODIFYVM_HWVIRTEXEXCLUSIVE,
|
---|
64 | MODIFYVM_NESTEDPAGING,
|
---|
65 | MODIFYVM_LARGEPAGES,
|
---|
66 | MODIFYVM_VTXVPID,
|
---|
67 | MODIFYVM_CPUS,
|
---|
68 | MODIFYVM_CPUHOTPLUG,
|
---|
69 | MODIFYVM_PLUGCPU,
|
---|
70 | MODIFYVM_UNPLUGCPU,
|
---|
71 | MODIFYVM_SETCPUID,
|
---|
72 | MODIFYVM_DELCPUID,
|
---|
73 | MODIFYVM_DELALLCPUID,
|
---|
74 | MODIFYVM_MONITORCOUNT,
|
---|
75 | MODIFYVM_ACCELERATE3D,
|
---|
76 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
77 | MODIFYVM_ACCELERATE2DVIDEO,
|
---|
78 | #endif
|
---|
79 | MODIFYVM_BIOSLOGOFADEIN,
|
---|
80 | MODIFYVM_BIOSLOGOFADEOUT,
|
---|
81 | MODIFYVM_BIOSLOGODISPLAYTIME,
|
---|
82 | MODIFYVM_BIOSLOGOIMAGEPATH,
|
---|
83 | MODIFYVM_BIOSBOOTMENU,
|
---|
84 | MODIFYVM_BIOSSYSTEMTIMEOFFSET,
|
---|
85 | MODIFYVM_BIOSPXEDEBUG,
|
---|
86 | MODIFYVM_BOOT,
|
---|
87 | MODIFYVM_HDA, // deprecated
|
---|
88 | MODIFYVM_HDB, // deprecated
|
---|
89 | MODIFYVM_HDD, // deprecated
|
---|
90 | MODIFYVM_IDECONTROLLER, // deprecated
|
---|
91 | MODIFYVM_SATAPORTCOUNT, // deprecated
|
---|
92 | MODIFYVM_SATAPORT, // deprecated
|
---|
93 | MODIFYVM_SATA, // deprecated
|
---|
94 | MODIFYVM_SCSIPORT, // deprecated
|
---|
95 | MODIFYVM_SCSITYPE, // deprecated
|
---|
96 | MODIFYVM_SCSI, // deprecated
|
---|
97 | MODIFYVM_DVDPASSTHROUGH, // deprecated
|
---|
98 | MODIFYVM_DVD, // deprecated
|
---|
99 | MODIFYVM_FLOPPY, // deprecated
|
---|
100 | MODIFYVM_NICTRACEFILE,
|
---|
101 | MODIFYVM_NICTRACE,
|
---|
102 | MODIFYVM_NICPROPERTY,
|
---|
103 | MODIFYVM_NICTYPE,
|
---|
104 | MODIFYVM_NICSPEED,
|
---|
105 | MODIFYVM_NICBOOTPRIO,
|
---|
106 | MODIFYVM_NICPROMISC,
|
---|
107 | MODIFYVM_NICBWGROUP,
|
---|
108 | MODIFYVM_NIC,
|
---|
109 | MODIFYVM_CABLECONNECTED,
|
---|
110 | MODIFYVM_BRIDGEADAPTER,
|
---|
111 | MODIFYVM_HOSTONLYADAPTER,
|
---|
112 | MODIFYVM_INTNET,
|
---|
113 | MODIFYVM_NATNET,
|
---|
114 | MODIFYVM_GENERICDRV,
|
---|
115 | MODIFYVM_NATBINDIP,
|
---|
116 | MODIFYVM_NATSETTINGS,
|
---|
117 | MODIFYVM_NATPF,
|
---|
118 | MODIFYVM_NATALIASMODE,
|
---|
119 | MODIFYVM_NATTFTPPREFIX,
|
---|
120 | MODIFYVM_NATTFTPFILE,
|
---|
121 | MODIFYVM_NATTFTPSERVER,
|
---|
122 | MODIFYVM_NATDNSPASSDOMAIN,
|
---|
123 | MODIFYVM_NATDNSPROXY,
|
---|
124 | MODIFYVM_NATDNSHOSTRESOLVER,
|
---|
125 | MODIFYVM_MACADDRESS,
|
---|
126 | MODIFYVM_HIDPTR,
|
---|
127 | MODIFYVM_HIDKBD,
|
---|
128 | MODIFYVM_UARTMODE,
|
---|
129 | MODIFYVM_UART,
|
---|
130 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
131 | MODIFYVM_LPTMODE,
|
---|
132 | MODIFYVM_LPT,
|
---|
133 | #endif
|
---|
134 | MODIFYVM_GUESTMEMORYBALLOON,
|
---|
135 | MODIFYVM_AUDIOCONTROLLER,
|
---|
136 | MODIFYVM_AUDIO,
|
---|
137 | MODIFYVM_CLIPBOARD,
|
---|
138 | MODIFYVM_DRAGANDDROP,
|
---|
139 | MODIFYVM_VRDPPORT, /* VRDE: deprecated */
|
---|
140 | MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
|
---|
141 | MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
|
---|
142 | MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
|
---|
143 | MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
|
---|
144 | MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
|
---|
145 | MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
|
---|
146 | MODIFYVM_VRDP, /* VRDE: deprecated */
|
---|
147 | MODIFYVM_VRDEPROPERTY,
|
---|
148 | MODIFYVM_VRDEPORT,
|
---|
149 | MODIFYVM_VRDEADDRESS,
|
---|
150 | MODIFYVM_VRDEAUTHTYPE,
|
---|
151 | MODIFYVM_VRDEAUTHLIBRARY,
|
---|
152 | MODIFYVM_VRDEMULTICON,
|
---|
153 | MODIFYVM_VRDEREUSECON,
|
---|
154 | MODIFYVM_VRDEVIDEOCHANNEL,
|
---|
155 | MODIFYVM_VRDEVIDEOCHANNELQUALITY,
|
---|
156 | MODIFYVM_VRDE_EXTPACK,
|
---|
157 | MODIFYVM_VRDE,
|
---|
158 | MODIFYVM_RTCUSEUTC,
|
---|
159 | MODIFYVM_USBEHCI,
|
---|
160 | MODIFYVM_USB,
|
---|
161 | MODIFYVM_SNAPSHOTFOLDER,
|
---|
162 | MODIFYVM_TELEPORTER_ENABLED,
|
---|
163 | MODIFYVM_TELEPORTER_PORT,
|
---|
164 | MODIFYVM_TELEPORTER_ADDRESS,
|
---|
165 | MODIFYVM_TELEPORTER_PASSWORD,
|
---|
166 | MODIFYVM_TELEPORTER_PASSWORD_FILE,
|
---|
167 | MODIFYVM_TRACING_ENABLED,
|
---|
168 | MODIFYVM_TRACING_CONFIG,
|
---|
169 | MODIFYVM_TRACING_ALLOW_VM_ACCESS,
|
---|
170 | MODIFYVM_HARDWARE_UUID,
|
---|
171 | MODIFYVM_HPET,
|
---|
172 | MODIFYVM_IOCACHE,
|
---|
173 | MODIFYVM_IOCACHESIZE,
|
---|
174 | MODIFYVM_FAULT_TOLERANCE,
|
---|
175 | MODIFYVM_FAULT_TOLERANCE_ADDRESS,
|
---|
176 | MODIFYVM_FAULT_TOLERANCE_PORT,
|
---|
177 | MODIFYVM_FAULT_TOLERANCE_PASSWORD,
|
---|
178 | MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL,
|
---|
179 | MODIFYVM_CPU_EXECTUION_CAP,
|
---|
180 | MODIFYVM_AUTOSTART_ENABLED,
|
---|
181 | MODIFYVM_AUTOSTART_DELAY,
|
---|
182 | MODIFYVM_AUTOSTOP_TYPE,
|
---|
183 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
184 | MODIFYVM_ATTACH_PCI,
|
---|
185 | MODIFYVM_DETACH_PCI,
|
---|
186 | #endif
|
---|
187 | #ifdef VBOX_WITH_USB_VIDEO
|
---|
188 | MODIFYVM_USBWEBCAM,
|
---|
189 | #endif
|
---|
190 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
191 | MODIFYVM_USBCARDREADER,
|
---|
192 | #endif
|
---|
193 | #ifdef VBOX_WITH_VPX
|
---|
194 | MODIFYVM_VCP,
|
---|
195 | MODIFYVM_VCP_FILENAME,
|
---|
196 | MODIFYVM_VCP_WIDTH,
|
---|
197 | MODIFYVM_VCP_HEIGHT,
|
---|
198 | #endif
|
---|
199 | MODIFYVM_CHIPSET
|
---|
200 | };
|
---|
201 |
|
---|
202 | static const RTGETOPTDEF g_aModifyVMOptions[] =
|
---|
203 | {
|
---|
204 | { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
|
---|
205 | { "--groups", MODIFYVM_GROUPS, RTGETOPT_REQ_STRING },
|
---|
206 | { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
|
---|
207 | { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
|
---|
208 | { "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
209 | { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
|
---|
210 | { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
|
---|
211 | { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
212 | { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
213 | { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
214 | { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
215 | { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
216 | { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
217 | { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
218 | { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
219 | { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
220 | { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
221 | { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
|
---|
222 | { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
|
---|
223 | { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
|
---|
224 | { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
225 | { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
226 | { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
|
---|
227 | { "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32 },
|
---|
228 | { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
229 | { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
230 | { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
231 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
232 | { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
233 | #endif
|
---|
234 | { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
235 | { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
236 | { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
|
---|
237 | { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
|
---|
238 | { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
|
---|
239 | { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
|
---|
240 | { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
241 | { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
242 | { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
|
---|
243 | { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
|
---|
244 | { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
|
---|
245 | { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
|
---|
246 | { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
|
---|
247 | { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
248 | { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
|
---|
249 | { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
250 | { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
|
---|
251 | { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
|
---|
252 | { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
|
---|
253 | { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
|
---|
254 | { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
|
---|
255 | { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
256 | { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
257 | { "--nicproperty", MODIFYVM_NICPROPERTY, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
258 | { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
259 | { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
260 | { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
|
---|
261 | { "--nicpromisc", MODIFYVM_NICPROMISC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
262 | { "--nicbandwidthgroup", MODIFYVM_NICBWGROUP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
263 | { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
264 | { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
265 | { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
266 | { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
267 | { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
268 | { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
269 | { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
270 | { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
271 | { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
272 | { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
273 | { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
274 | { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
275 | { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
276 | { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
277 | { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
278 | { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
279 | { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
|
---|
280 | { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
281 | { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
|
---|
282 | { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
|
---|
283 | { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
284 | { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
285 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
286 | { "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
287 | { "--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
|
---|
288 | #endif
|
---|
289 | { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
|
---|
290 | { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
|
---|
291 | { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
|
---|
292 | { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
|
---|
293 | { "--draganddrop", MODIFYVM_DRAGANDDROP, RTGETOPT_REQ_STRING },
|
---|
294 | { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
295 | { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
296 | { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
297 | { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
298 | { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
299 | { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
300 | { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
|
---|
301 | { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
302 | { "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING },
|
---|
303 | { "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING },
|
---|
304 | { "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING },
|
---|
305 | { "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING },
|
---|
306 | { "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING },
|
---|
307 | { "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
308 | { "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
309 | { "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
310 | { "--vrdevideochannelquality", MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING },
|
---|
311 | { "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING },
|
---|
312 | { "--vrde", MODIFYVM_VRDE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
313 | { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
314 | { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
315 | { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
|
---|
316 | { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
317 | { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
|
---|
318 | { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
|
---|
319 | { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
|
---|
320 | { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
|
---|
321 | { "--teleporterpasswordfile", MODIFYVM_TELEPORTER_PASSWORD_FILE, RTGETOPT_REQ_STRING },
|
---|
322 | { "--tracing-enabled", MODIFYVM_TRACING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
323 | { "--tracing-config", MODIFYVM_TRACING_CONFIG, RTGETOPT_REQ_STRING },
|
---|
324 | { "--tracing-allow-vm-access", MODIFYVM_TRACING_ALLOW_VM_ACCESS, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
325 | { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
|
---|
326 | { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
327 | { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
328 | { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
|
---|
329 | { "--faulttolerance", MODIFYVM_FAULT_TOLERANCE, RTGETOPT_REQ_STRING },
|
---|
330 | { "--faulttoleranceaddress", MODIFYVM_FAULT_TOLERANCE_ADDRESS, RTGETOPT_REQ_STRING },
|
---|
331 | { "--faulttoleranceport", MODIFYVM_FAULT_TOLERANCE_PORT, RTGETOPT_REQ_UINT32 },
|
---|
332 | { "--faulttolerancepassword", MODIFYVM_FAULT_TOLERANCE_PASSWORD, RTGETOPT_REQ_STRING },
|
---|
333 | { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
|
---|
334 | { "--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING },
|
---|
335 | #ifdef VBOX_WITH_VPX
|
---|
336 | { "--vcpenabled", MODIFYVM_VCP, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
337 | { "--vcpfile", MODIFYVM_VCP_FILENAME, RTGETOPT_REQ_STRING },
|
---|
338 | { "--vcpwidth", MODIFYVM_VCP_WIDTH, RTGETOPT_REQ_UINT32 },
|
---|
339 | { "--vcpheight", MODIFYVM_VCP_HEIGHT, RTGETOPT_REQ_UINT32 },
|
---|
340 | #endif
|
---|
341 | { "--autostart-enabled", MODIFYVM_AUTOSTART_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
342 | { "--autostart-delay", MODIFYVM_AUTOSTART_DELAY, RTGETOPT_REQ_UINT32 },
|
---|
343 | { "--autostop-type", MODIFYVM_AUTOSTOP_TYPE, RTGETOPT_REQ_STRING },
|
---|
344 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
345 | { "--pciattach", MODIFYVM_ATTACH_PCI, RTGETOPT_REQ_STRING },
|
---|
346 | { "--pcidetach", MODIFYVM_DETACH_PCI, RTGETOPT_REQ_STRING },
|
---|
347 | #endif
|
---|
348 | #ifdef VBOX_WITH_USB_VIDEO
|
---|
349 | { "--usbwebcam", MODIFYVM_USBWEBCAM, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
350 | #endif
|
---|
351 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
352 | { "--usbcardreader", MODIFYVM_USBCARDREADER, RTGETOPT_REQ_BOOL_ONOFF },
|
---|
353 | #endif
|
---|
354 | };
|
---|
355 |
|
---|
356 | static void vrdeWarningDeprecatedOption(const char *pszOption)
|
---|
357 | {
|
---|
358 | RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
|
---|
359 | }
|
---|
360 |
|
---|
361 | /** Parse PCI address in format 01:02.03 and convert it to the numeric representation. */
|
---|
362 | static int32_t parsePci(const char* szPciAddr)
|
---|
363 | {
|
---|
364 | char* pszNext = (char*)szPciAddr;
|
---|
365 | int rc;
|
---|
366 | uint8_t aVals[3] = {0, 0, 0};
|
---|
367 |
|
---|
368 | rc = RTStrToUInt8Ex(pszNext, &pszNext, 16, &aVals[0]);
|
---|
369 | if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != ':')
|
---|
370 | return -1;
|
---|
371 |
|
---|
372 | rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[1]);
|
---|
373 | if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != '.')
|
---|
374 | return -1;
|
---|
375 |
|
---|
376 | rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[2]);
|
---|
377 | if (RT_FAILURE(rc) || pszNext == NULL)
|
---|
378 | return -1;
|
---|
379 |
|
---|
380 | return (aVals[0] << 8) | (aVals[1] << 3) | (aVals[2] << 0);
|
---|
381 | }
|
---|
382 |
|
---|
383 | void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups)
|
---|
384 | {
|
---|
385 | while (pcszGroups)
|
---|
386 | {
|
---|
387 | char *pComma = RTStrStr(pcszGroups, ",");
|
---|
388 | if (pComma)
|
---|
389 | {
|
---|
390 | Bstr(pcszGroups, pComma - pcszGroups).detachTo(pGroups->appendedRaw());
|
---|
391 | pcszGroups = pComma + 1;
|
---|
392 | }
|
---|
393 | else
|
---|
394 | {
|
---|
395 | Bstr(pcszGroups).detachTo(pGroups->appendedRaw());
|
---|
396 | pcszGroups = NULL;
|
---|
397 | }
|
---|
398 | }
|
---|
399 | }
|
---|
400 |
|
---|
401 | int handleModifyVM(HandlerArg *a)
|
---|
402 | {
|
---|
403 | int c;
|
---|
404 | HRESULT rc;
|
---|
405 | Bstr name;
|
---|
406 | RTGETOPTUNION ValueUnion;
|
---|
407 | RTGETOPTSTATE GetOptState;
|
---|
408 | ComPtr <IMachine> machine;
|
---|
409 | ComPtr <IBIOSSettings> biosSettings;
|
---|
410 |
|
---|
411 | /* VM ID + at least one parameter. Parameter arguments are checked
|
---|
412 | * individually. */
|
---|
413 | if (a->argc < 2)
|
---|
414 | return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
|
---|
415 |
|
---|
416 | /* try to find the given machine */
|
---|
417 | CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
|
---|
418 | machine.asOutParam()), 1);
|
---|
419 |
|
---|
420 |
|
---|
421 | /* Get the number of network adapters */
|
---|
422 | ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine);
|
---|
423 |
|
---|
424 | /* open a session for the VM */
|
---|
425 | CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
|
---|
426 |
|
---|
427 | /* get the mutable session machine */
|
---|
428 | CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1);
|
---|
429 | machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
|
---|
430 |
|
---|
431 | RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
|
---|
432 | RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
433 |
|
---|
434 | while ( SUCCEEDED (rc)
|
---|
435 | && (c = RTGetOpt(&GetOptState, &ValueUnion)))
|
---|
436 | {
|
---|
437 | switch (c)
|
---|
438 | {
|
---|
439 | case MODIFYVM_NAME:
|
---|
440 | {
|
---|
441 | CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
|
---|
442 | break;
|
---|
443 | }
|
---|
444 | case MODIFYVM_GROUPS:
|
---|
445 | {
|
---|
446 | com::SafeArray<BSTR> groups;
|
---|
447 | parseGroups(ValueUnion.psz, &groups);
|
---|
448 | CHECK_ERROR(machine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups)));
|
---|
449 | break;
|
---|
450 | }
|
---|
451 | case MODIFYVM_OSTYPE:
|
---|
452 | {
|
---|
453 | ComPtr<IGuestOSType> guestOSType;
|
---|
454 | CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(),
|
---|
455 | guestOSType.asOutParam()));
|
---|
456 | if (SUCCEEDED(rc) && guestOSType)
|
---|
457 | {
|
---|
458 | CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
|
---|
459 | }
|
---|
460 | else
|
---|
461 | {
|
---|
462 | errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).c_str());
|
---|
463 | rc = E_FAIL;
|
---|
464 | }
|
---|
465 | break;
|
---|
466 | }
|
---|
467 |
|
---|
468 | case MODIFYVM_MEMORY:
|
---|
469 | {
|
---|
470 | CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
|
---|
471 | break;
|
---|
472 | }
|
---|
473 |
|
---|
474 | case MODIFYVM_PAGEFUSION:
|
---|
475 | {
|
---|
476 | CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
|
---|
477 | break;
|
---|
478 | }
|
---|
479 |
|
---|
480 | case MODIFYVM_VRAM:
|
---|
481 | {
|
---|
482 | CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
|
---|
483 | break;
|
---|
484 | }
|
---|
485 |
|
---|
486 | case MODIFYVM_FIRMWARE:
|
---|
487 | {
|
---|
488 | if (!strcmp(ValueUnion.psz, "efi"))
|
---|
489 | {
|
---|
490 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
|
---|
491 | }
|
---|
492 | else if (!strcmp(ValueUnion.psz, "efi32"))
|
---|
493 | {
|
---|
494 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
|
---|
495 | }
|
---|
496 | else if (!strcmp(ValueUnion.psz, "efi64"))
|
---|
497 | {
|
---|
498 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
|
---|
499 | }
|
---|
500 | else if (!strcmp(ValueUnion.psz, "efidual"))
|
---|
501 | {
|
---|
502 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
|
---|
503 | }
|
---|
504 | else if (!strcmp(ValueUnion.psz, "bios"))
|
---|
505 | {
|
---|
506 | CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
|
---|
507 | }
|
---|
508 | else
|
---|
509 | {
|
---|
510 | errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
|
---|
511 | rc = E_FAIL;
|
---|
512 | }
|
---|
513 | break;
|
---|
514 | }
|
---|
515 |
|
---|
516 | case MODIFYVM_ACPI:
|
---|
517 | {
|
---|
518 | CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
|
---|
519 | break;
|
---|
520 | }
|
---|
521 |
|
---|
522 | case MODIFYVM_IOAPIC:
|
---|
523 | {
|
---|
524 | CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
|
---|
525 | break;
|
---|
526 | }
|
---|
527 |
|
---|
528 | case MODIFYVM_PAE:
|
---|
529 | {
|
---|
530 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
|
---|
531 | break;
|
---|
532 | }
|
---|
533 |
|
---|
534 | case MODIFYVM_SYNTHCPU:
|
---|
535 | {
|
---|
536 | CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
|
---|
537 | break;
|
---|
538 | }
|
---|
539 |
|
---|
540 | case MODIFYVM_HWVIRTEX:
|
---|
541 | {
|
---|
542 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
|
---|
543 | break;
|
---|
544 | }
|
---|
545 |
|
---|
546 | case MODIFYVM_HWVIRTEXEXCLUSIVE:
|
---|
547 | {
|
---|
548 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
|
---|
549 | break;
|
---|
550 | }
|
---|
551 |
|
---|
552 | case MODIFYVM_SETCPUID:
|
---|
553 | {
|
---|
554 | uint32_t id = ValueUnion.u32;
|
---|
555 | uint32_t aValue[4];
|
---|
556 |
|
---|
557 | for (unsigned i = 0 ; i < 4 ; i++)
|
---|
558 | {
|
---|
559 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
|
---|
560 | if (RT_FAILURE(vrc))
|
---|
561 | return errorSyntax(USAGE_MODIFYVM,
|
---|
562 | "Missing or Invalid argument to '%s'",
|
---|
563 | GetOptState.pDef->pszLong);
|
---|
564 | aValue[i] = ValueUnion.u32;
|
---|
565 | }
|
---|
566 | CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
|
---|
567 | break;
|
---|
568 | }
|
---|
569 |
|
---|
570 | case MODIFYVM_DELCPUID:
|
---|
571 | {
|
---|
572 | CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
|
---|
573 | break;
|
---|
574 | }
|
---|
575 |
|
---|
576 | case MODIFYVM_DELALLCPUID:
|
---|
577 | {
|
---|
578 | CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
|
---|
579 | break;
|
---|
580 | }
|
---|
581 |
|
---|
582 | case MODIFYVM_NESTEDPAGING:
|
---|
583 | {
|
---|
584 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
|
---|
585 | break;
|
---|
586 | }
|
---|
587 |
|
---|
588 | case MODIFYVM_LARGEPAGES:
|
---|
589 | {
|
---|
590 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
|
---|
591 | break;
|
---|
592 | }
|
---|
593 |
|
---|
594 | case MODIFYVM_VTXVPID:
|
---|
595 | {
|
---|
596 | CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
|
---|
597 | break;
|
---|
598 | }
|
---|
599 |
|
---|
600 | case MODIFYVM_CPUS:
|
---|
601 | {
|
---|
602 | CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
|
---|
603 | break;
|
---|
604 | }
|
---|
605 |
|
---|
606 | case MODIFYVM_RTCUSEUTC:
|
---|
607 | {
|
---|
608 | CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
|
---|
609 | break;
|
---|
610 | }
|
---|
611 |
|
---|
612 | case MODIFYVM_CPUHOTPLUG:
|
---|
613 | {
|
---|
614 | CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
|
---|
615 | break;
|
---|
616 | }
|
---|
617 |
|
---|
618 | case MODIFYVM_PLUGCPU:
|
---|
619 | {
|
---|
620 | CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
|
---|
621 | break;
|
---|
622 | }
|
---|
623 |
|
---|
624 | case MODIFYVM_UNPLUGCPU:
|
---|
625 | {
|
---|
626 | CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
|
---|
627 | break;
|
---|
628 | }
|
---|
629 |
|
---|
630 | case MODIFYVM_CPU_EXECTUION_CAP:
|
---|
631 | {
|
---|
632 | CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
|
---|
633 | break;
|
---|
634 | }
|
---|
635 |
|
---|
636 | case MODIFYVM_MONITORCOUNT:
|
---|
637 | {
|
---|
638 | CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
|
---|
639 | break;
|
---|
640 | }
|
---|
641 |
|
---|
642 | case MODIFYVM_ACCELERATE3D:
|
---|
643 | {
|
---|
644 | CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
|
---|
645 | break;
|
---|
646 | }
|
---|
647 |
|
---|
648 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
649 | case MODIFYVM_ACCELERATE2DVIDEO:
|
---|
650 | {
|
---|
651 | CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
|
---|
652 | break;
|
---|
653 | }
|
---|
654 | #endif
|
---|
655 |
|
---|
656 | case MODIFYVM_BIOSLOGOFADEIN:
|
---|
657 | {
|
---|
658 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
|
---|
659 | break;
|
---|
660 | }
|
---|
661 |
|
---|
662 | case MODIFYVM_BIOSLOGOFADEOUT:
|
---|
663 | {
|
---|
664 | CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
|
---|
665 | break;
|
---|
666 | }
|
---|
667 |
|
---|
668 | case MODIFYVM_BIOSLOGODISPLAYTIME:
|
---|
669 | {
|
---|
670 | CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
|
---|
671 | break;
|
---|
672 | }
|
---|
673 |
|
---|
674 | case MODIFYVM_BIOSLOGOIMAGEPATH:
|
---|
675 | {
|
---|
676 | CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
|
---|
677 | break;
|
---|
678 | }
|
---|
679 |
|
---|
680 | case MODIFYVM_BIOSBOOTMENU:
|
---|
681 | {
|
---|
682 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
683 | {
|
---|
684 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
|
---|
685 | }
|
---|
686 | else if (!strcmp(ValueUnion.psz, "menuonly"))
|
---|
687 | {
|
---|
688 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
|
---|
689 | }
|
---|
690 | else if (!strcmp(ValueUnion.psz, "messageandmenu"))
|
---|
691 | {
|
---|
692 | CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
|
---|
693 | }
|
---|
694 | else
|
---|
695 | {
|
---|
696 | errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
|
---|
697 | rc = E_FAIL;
|
---|
698 | }
|
---|
699 | break;
|
---|
700 | }
|
---|
701 |
|
---|
702 | case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
|
---|
703 | {
|
---|
704 | CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
|
---|
705 | break;
|
---|
706 | }
|
---|
707 |
|
---|
708 | case MODIFYVM_BIOSPXEDEBUG:
|
---|
709 | {
|
---|
710 | CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
|
---|
711 | break;
|
---|
712 | }
|
---|
713 |
|
---|
714 | case MODIFYVM_BOOT:
|
---|
715 | {
|
---|
716 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
717 | {
|
---|
718 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
|
---|
719 | }
|
---|
720 | else if (!strcmp(ValueUnion.psz, "floppy"))
|
---|
721 | {
|
---|
722 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
|
---|
723 | }
|
---|
724 | else if (!strcmp(ValueUnion.psz, "dvd"))
|
---|
725 | {
|
---|
726 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
|
---|
727 | }
|
---|
728 | else if (!strcmp(ValueUnion.psz, "disk"))
|
---|
729 | {
|
---|
730 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
|
---|
731 | }
|
---|
732 | else if (!strcmp(ValueUnion.psz, "net"))
|
---|
733 | {
|
---|
734 | CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
|
---|
735 | }
|
---|
736 | else
|
---|
737 | return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
|
---|
738 | break;
|
---|
739 | }
|
---|
740 |
|
---|
741 | case MODIFYVM_HDA: // deprecated
|
---|
742 | case MODIFYVM_HDB: // deprecated
|
---|
743 | case MODIFYVM_HDD: // deprecated
|
---|
744 | case MODIFYVM_SATAPORT: // deprecated
|
---|
745 | {
|
---|
746 | uint32_t u1 = 0, u2 = 0;
|
---|
747 | Bstr bstrController = L"IDE Controller";
|
---|
748 |
|
---|
749 | switch (c)
|
---|
750 | {
|
---|
751 | case MODIFYVM_HDA: // deprecated
|
---|
752 | u1 = 0;
|
---|
753 | break;
|
---|
754 |
|
---|
755 | case MODIFYVM_HDB: // deprecated
|
---|
756 | u1 = 0;
|
---|
757 | u2 = 1;
|
---|
758 | break;
|
---|
759 |
|
---|
760 | case MODIFYVM_HDD: // deprecated
|
---|
761 | u1 = 1;
|
---|
762 | u2 = 1;
|
---|
763 | break;
|
---|
764 |
|
---|
765 | case MODIFYVM_SATAPORT: // deprecated
|
---|
766 | u1 = GetOptState.uIndex;
|
---|
767 | bstrController = L"SATA";
|
---|
768 | break;
|
---|
769 | }
|
---|
770 |
|
---|
771 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
772 | {
|
---|
773 | machine->DetachDevice(bstrController.raw(), u1, u2);
|
---|
774 | }
|
---|
775 | else
|
---|
776 | {
|
---|
777 | ComPtr<IMedium> hardDisk;
|
---|
778 | rc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
779 | AccessMode_ReadWrite, hardDisk,
|
---|
780 | false /* fForceNewUuidOnOpen */,
|
---|
781 | false /* fSilent */);
|
---|
782 | if (FAILED(rc))
|
---|
783 | break;
|
---|
784 | if (hardDisk)
|
---|
785 | {
|
---|
786 | CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
|
---|
787 | u1, u2,
|
---|
788 | DeviceType_HardDisk,
|
---|
789 | hardDisk));
|
---|
790 | }
|
---|
791 | else
|
---|
792 | rc = E_FAIL;
|
---|
793 | }
|
---|
794 | break;
|
---|
795 | }
|
---|
796 |
|
---|
797 | case MODIFYVM_IDECONTROLLER: // deprecated
|
---|
798 | {
|
---|
799 | ComPtr<IStorageController> storageController;
|
---|
800 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
|
---|
801 | storageController.asOutParam()));
|
---|
802 |
|
---|
803 | if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
|
---|
804 | {
|
---|
805 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
|
---|
806 | }
|
---|
807 | else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
|
---|
808 | {
|
---|
809 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
|
---|
810 | }
|
---|
811 | else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
|
---|
812 | {
|
---|
813 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
|
---|
814 | }
|
---|
815 | else
|
---|
816 | {
|
---|
817 | errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
|
---|
818 | rc = E_FAIL;
|
---|
819 | }
|
---|
820 | break;
|
---|
821 | }
|
---|
822 |
|
---|
823 | case MODIFYVM_SATAPORTCOUNT: // deprecated
|
---|
824 | {
|
---|
825 | ComPtr<IStorageController> SataCtl;
|
---|
826 | CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
|
---|
827 | SataCtl.asOutParam()));
|
---|
828 |
|
---|
829 | if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
|
---|
830 | CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
|
---|
831 | break;
|
---|
832 | }
|
---|
833 |
|
---|
834 | case MODIFYVM_SATA: // deprecated
|
---|
835 | {
|
---|
836 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
837 | {
|
---|
838 | ComPtr<IStorageController> ctl;
|
---|
839 | CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
|
---|
840 | StorageBus_SATA,
|
---|
841 | ctl.asOutParam()));
|
---|
842 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
|
---|
843 | }
|
---|
844 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
845 | CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
|
---|
846 | else
|
---|
847 | return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
|
---|
848 | break;
|
---|
849 | }
|
---|
850 |
|
---|
851 | case MODIFYVM_SCSIPORT: // deprecated
|
---|
852 | {
|
---|
853 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
854 | {
|
---|
855 | rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
|
---|
856 | GetOptState.uIndex, 0);
|
---|
857 | if (FAILED(rc))
|
---|
858 | CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
|
---|
859 | GetOptState.uIndex, 0));
|
---|
860 | }
|
---|
861 | else
|
---|
862 | {
|
---|
863 | ComPtr<IMedium> hardDisk;
|
---|
864 | rc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
865 | AccessMode_ReadWrite, hardDisk,
|
---|
866 | false /* fForceNewUuidOnOpen */,
|
---|
867 | false /* fSilent */);
|
---|
868 | if (FAILED(rc))
|
---|
869 | break;
|
---|
870 | if (hardDisk)
|
---|
871 | {
|
---|
872 | rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
|
---|
873 | GetOptState.uIndex, 0,
|
---|
874 | DeviceType_HardDisk,
|
---|
875 | hardDisk);
|
---|
876 | if (FAILED(rc))
|
---|
877 | CHECK_ERROR(machine,
|
---|
878 | AttachDevice(Bstr("BusLogic").raw(),
|
---|
879 | GetOptState.uIndex, 0,
|
---|
880 | DeviceType_HardDisk,
|
---|
881 | hardDisk));
|
---|
882 | }
|
---|
883 | else
|
---|
884 | rc = E_FAIL;
|
---|
885 | }
|
---|
886 | break;
|
---|
887 | }
|
---|
888 |
|
---|
889 | case MODIFYVM_SCSITYPE: // deprecated
|
---|
890 | {
|
---|
891 | ComPtr<IStorageController> ctl;
|
---|
892 |
|
---|
893 | if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
|
---|
894 | {
|
---|
895 | rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
896 | if (FAILED(rc))
|
---|
897 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
898 |
|
---|
899 | CHECK_ERROR(machine,
|
---|
900 | AddStorageController(Bstr("LsiLogic").raw(),
|
---|
901 | StorageBus_SCSI,
|
---|
902 | ctl.asOutParam()));
|
---|
903 |
|
---|
904 | if (SUCCEEDED(rc))
|
---|
905 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
|
---|
906 | }
|
---|
907 | else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
|
---|
908 | {
|
---|
909 | rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
|
---|
910 | if (FAILED(rc))
|
---|
911 | CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
|
---|
912 |
|
---|
913 | CHECK_ERROR(machine,
|
---|
914 | AddStorageController(Bstr("BusLogic").raw(),
|
---|
915 | StorageBus_SCSI,
|
---|
916 | ctl.asOutParam()));
|
---|
917 |
|
---|
918 | if (SUCCEEDED(rc))
|
---|
919 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
920 | }
|
---|
921 | else
|
---|
922 | return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
|
---|
923 | break;
|
---|
924 | }
|
---|
925 |
|
---|
926 | case MODIFYVM_SCSI: // deprecated
|
---|
927 | {
|
---|
928 | if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
|
---|
929 | {
|
---|
930 | ComPtr<IStorageController> ctl;
|
---|
931 |
|
---|
932 | CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
|
---|
933 | StorageBus_SCSI,
|
---|
934 | ctl.asOutParam()));
|
---|
935 | if (SUCCEEDED(rc))
|
---|
936 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
937 | }
|
---|
938 | else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
939 | {
|
---|
940 | rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
941 | if (FAILED(rc))
|
---|
942 | CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
943 | }
|
---|
944 | break;
|
---|
945 | }
|
---|
946 |
|
---|
947 | case MODIFYVM_DVDPASSTHROUGH: // deprecated
|
---|
948 | {
|
---|
949 | CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
|
---|
950 | 1, 0,
|
---|
951 | !strcmp(ValueUnion.psz, "on")));
|
---|
952 | break;
|
---|
953 | }
|
---|
954 |
|
---|
955 | case MODIFYVM_DVD: // deprecated
|
---|
956 | {
|
---|
957 | ComPtr<IMedium> dvdMedium;
|
---|
958 |
|
---|
959 | /* unmount? */
|
---|
960 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
961 | {
|
---|
962 | /* nothing to do, NULL object will cause unmount */
|
---|
963 | }
|
---|
964 | /* host drive? */
|
---|
965 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
966 | {
|
---|
967 | ComPtr<IHost> host;
|
---|
968 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
969 | rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
970 | dvdMedium.asOutParam());
|
---|
971 | if (!dvdMedium)
|
---|
972 | {
|
---|
973 | /* 2nd try: try with the real name, important on Linux+libhal */
|
---|
974 | char szPathReal[RTPATH_MAX];
|
---|
975 | if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
|
---|
976 | {
|
---|
977 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
978 | rc = E_FAIL;
|
---|
979 | break;
|
---|
980 | }
|
---|
981 | rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
|
---|
982 | dvdMedium.asOutParam());
|
---|
983 | if (!dvdMedium)
|
---|
984 | {
|
---|
985 | errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
|
---|
986 | rc = E_FAIL;
|
---|
987 | break;
|
---|
988 | }
|
---|
989 | }
|
---|
990 | }
|
---|
991 | else
|
---|
992 | {
|
---|
993 | rc = openMedium(a, ValueUnion.psz, DeviceType_DVD,
|
---|
994 | AccessMode_ReadOnly, dvdMedium,
|
---|
995 | false /* fForceNewUuidOnOpen */,
|
---|
996 | false /* fSilent */);
|
---|
997 | if (FAILED(rc))
|
---|
998 | break;
|
---|
999 | if (!dvdMedium)
|
---|
1000 | {
|
---|
1001 | rc = E_FAIL;
|
---|
1002 | break;
|
---|
1003 | }
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
|
---|
1007 | 1, 0,
|
---|
1008 | dvdMedium,
|
---|
1009 | FALSE /* aForce */));
|
---|
1010 | break;
|
---|
1011 | }
|
---|
1012 |
|
---|
1013 | case MODIFYVM_FLOPPY: // deprecated
|
---|
1014 | {
|
---|
1015 | ComPtr<IMedium> floppyMedium;
|
---|
1016 | ComPtr<IMediumAttachment> floppyAttachment;
|
---|
1017 | machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
|
---|
1018 | 0, 0, floppyAttachment.asOutParam());
|
---|
1019 |
|
---|
1020 | /* disable? */
|
---|
1021 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
1022 | {
|
---|
1023 | /* disable the controller */
|
---|
1024 | if (floppyAttachment)
|
---|
1025 | CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
|
---|
1026 | 0, 0));
|
---|
1027 | }
|
---|
1028 | else
|
---|
1029 | {
|
---|
1030 | /* enable the controller */
|
---|
1031 | if (!floppyAttachment)
|
---|
1032 | CHECK_ERROR(machine, AttachDeviceWithoutMedium(Bstr("Floppy Controller").raw(),
|
---|
1033 | 0, 0,
|
---|
1034 | DeviceType_Floppy));
|
---|
1035 |
|
---|
1036 | /* unmount? */
|
---|
1037 | if ( !strcmp(ValueUnion.psz, "none")
|
---|
1038 | || !strcmp(ValueUnion.psz, "empty")) // deprecated
|
---|
1039 | {
|
---|
1040 | /* nothing to do, NULL object will cause unmount */
|
---|
1041 | }
|
---|
1042 | /* host drive? */
|
---|
1043 | else if (!strncmp(ValueUnion.psz, "host:", 5))
|
---|
1044 | {
|
---|
1045 | ComPtr<IHost> host;
|
---|
1046 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1047 | rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
1048 | floppyMedium.asOutParam());
|
---|
1049 | if (!floppyMedium)
|
---|
1050 | {
|
---|
1051 | errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
|
---|
1052 | rc = E_FAIL;
|
---|
1053 | break;
|
---|
1054 | }
|
---|
1055 | }
|
---|
1056 | else
|
---|
1057 | {
|
---|
1058 | rc = openMedium(a, ValueUnion.psz, DeviceType_Floppy,
|
---|
1059 | AccessMode_ReadWrite, floppyMedium,
|
---|
1060 | false /* fForceNewUuidOnOpen */,
|
---|
1061 | false /* fSilent */);
|
---|
1062 | if (FAILED(rc))
|
---|
1063 | break;
|
---|
1064 | if (!floppyMedium)
|
---|
1065 | {
|
---|
1066 | rc = E_FAIL;
|
---|
1067 | break;
|
---|
1068 | }
|
---|
1069 | }
|
---|
1070 | CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
|
---|
1071 | 0, 0,
|
---|
1072 | floppyMedium,
|
---|
1073 | FALSE /* aForce */));
|
---|
1074 | }
|
---|
1075 | break;
|
---|
1076 | }
|
---|
1077 |
|
---|
1078 | case MODIFYVM_NICTRACEFILE:
|
---|
1079 | {
|
---|
1080 | ComPtr<INetworkAdapter> nic;
|
---|
1081 |
|
---|
1082 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1083 | ASSERT(nic);
|
---|
1084 |
|
---|
1085 | CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
|
---|
1086 | break;
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | case MODIFYVM_NICTRACE:
|
---|
1090 | {
|
---|
1091 | ComPtr<INetworkAdapter> nic;
|
---|
1092 |
|
---|
1093 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1094 | ASSERT(nic);
|
---|
1095 |
|
---|
1096 | CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
|
---|
1097 | break;
|
---|
1098 | }
|
---|
1099 |
|
---|
1100 | case MODIFYVM_NICPROPERTY:
|
---|
1101 | {
|
---|
1102 | ComPtr<INetworkAdapter> nic;
|
---|
1103 |
|
---|
1104 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1105 | ASSERT(nic);
|
---|
1106 |
|
---|
1107 | if (nic)
|
---|
1108 | {
|
---|
1109 | /* Parse 'name=value' */
|
---|
1110 | char *pszProperty = RTStrDup(ValueUnion.psz);
|
---|
1111 | if (pszProperty)
|
---|
1112 | {
|
---|
1113 | char *pDelimiter = strchr(pszProperty, '=');
|
---|
1114 | if (pDelimiter)
|
---|
1115 | {
|
---|
1116 | *pDelimiter = '\0';
|
---|
1117 |
|
---|
1118 | Bstr bstrName = pszProperty;
|
---|
1119 | Bstr bstrValue = &pDelimiter[1];
|
---|
1120 | CHECK_ERROR(nic, SetProperty(bstrName.raw(), bstrValue.raw()));
|
---|
1121 | }
|
---|
1122 | else
|
---|
1123 | {
|
---|
1124 | errorArgument("Invalid --nicproperty%d argument '%s'", GetOptState.uIndex, ValueUnion.psz);
|
---|
1125 | rc = E_FAIL;
|
---|
1126 | }
|
---|
1127 | RTStrFree(pszProperty);
|
---|
1128 | }
|
---|
1129 | else
|
---|
1130 | {
|
---|
1131 | RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for --nicproperty%d '%s'\n", GetOptState.uIndex, ValueUnion.psz);
|
---|
1132 | rc = E_FAIL;
|
---|
1133 | }
|
---|
1134 | }
|
---|
1135 | break;
|
---|
1136 | }
|
---|
1137 | case MODIFYVM_NICTYPE:
|
---|
1138 | {
|
---|
1139 | ComPtr<INetworkAdapter> nic;
|
---|
1140 |
|
---|
1141 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1142 | ASSERT(nic);
|
---|
1143 |
|
---|
1144 | if (!strcmp(ValueUnion.psz, "Am79C970A"))
|
---|
1145 | {
|
---|
1146 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
|
---|
1147 | }
|
---|
1148 | else if (!strcmp(ValueUnion.psz, "Am79C973"))
|
---|
1149 | {
|
---|
1150 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
|
---|
1151 | }
|
---|
1152 | #ifdef VBOX_WITH_E1000
|
---|
1153 | else if (!strcmp(ValueUnion.psz, "82540EM"))
|
---|
1154 | {
|
---|
1155 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
|
---|
1156 | }
|
---|
1157 | else if (!strcmp(ValueUnion.psz, "82543GC"))
|
---|
1158 | {
|
---|
1159 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
|
---|
1160 | }
|
---|
1161 | else if (!strcmp(ValueUnion.psz, "82545EM"))
|
---|
1162 | {
|
---|
1163 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
|
---|
1164 | }
|
---|
1165 | #endif
|
---|
1166 | #ifdef VBOX_WITH_VIRTIO
|
---|
1167 | else if (!strcmp(ValueUnion.psz, "virtio"))
|
---|
1168 | {
|
---|
1169 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
|
---|
1170 | }
|
---|
1171 | #endif /* VBOX_WITH_VIRTIO */
|
---|
1172 | else
|
---|
1173 | {
|
---|
1174 | errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1175 | rc = E_FAIL;
|
---|
1176 | }
|
---|
1177 | break;
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | case MODIFYVM_NICSPEED:
|
---|
1181 | {
|
---|
1182 | ComPtr<INetworkAdapter> nic;
|
---|
1183 |
|
---|
1184 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1185 | ASSERT(nic);
|
---|
1186 |
|
---|
1187 | CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
|
---|
1188 | break;
|
---|
1189 | }
|
---|
1190 |
|
---|
1191 | case MODIFYVM_NICBOOTPRIO:
|
---|
1192 | {
|
---|
1193 | ComPtr<INetworkAdapter> nic;
|
---|
1194 |
|
---|
1195 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1196 | ASSERT(nic);
|
---|
1197 |
|
---|
1198 | /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
|
---|
1199 | * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
|
---|
1200 | * 0 for the default lowest priority).
|
---|
1201 | */
|
---|
1202 | if (ValueUnion.u32 > 4)
|
---|
1203 | {
|
---|
1204 | errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
|
---|
1205 | rc = E_FAIL;
|
---|
1206 | }
|
---|
1207 | else
|
---|
1208 | {
|
---|
1209 | CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
|
---|
1210 | }
|
---|
1211 | break;
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | case MODIFYVM_NICPROMISC:
|
---|
1215 | {
|
---|
1216 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
1217 | if (!strcmp(ValueUnion.psz, "deny"))
|
---|
1218 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
|
---|
1219 | else if ( !strcmp(ValueUnion.psz, "allow-vms")
|
---|
1220 | || !strcmp(ValueUnion.psz, "allow-network"))
|
---|
1221 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
|
---|
1222 | else if (!strcmp(ValueUnion.psz, "allow-all"))
|
---|
1223 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
|
---|
1224 | else
|
---|
1225 | {
|
---|
1226 | errorArgument("Unknown promiscuous mode policy '%s'", ValueUnion.psz);
|
---|
1227 | rc = E_INVALIDARG;
|
---|
1228 | break;
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | ComPtr<INetworkAdapter> nic;
|
---|
1232 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1233 | ASSERT(nic);
|
---|
1234 |
|
---|
1235 | CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
|
---|
1236 | break;
|
---|
1237 | }
|
---|
1238 |
|
---|
1239 | case MODIFYVM_NICBWGROUP:
|
---|
1240 | {
|
---|
1241 | ComPtr<INetworkAdapter> nic;
|
---|
1242 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1243 | ASSERT(nic);
|
---|
1244 |
|
---|
1245 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1246 | {
|
---|
1247 | /* Just remove the bandwidth group. */
|
---|
1248 | CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(NULL));
|
---|
1249 | }
|
---|
1250 | else
|
---|
1251 | {
|
---|
1252 | ComPtr<IBandwidthControl> bwCtrl;
|
---|
1253 | ComPtr<IBandwidthGroup> bwGroup;
|
---|
1254 |
|
---|
1255 | CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
|
---|
1256 |
|
---|
1257 | if (SUCCEEDED(rc))
|
---|
1258 | {
|
---|
1259 | CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(ValueUnion.psz).raw(), bwGroup.asOutParam()));
|
---|
1260 | if (SUCCEEDED(rc))
|
---|
1261 | {
|
---|
1262 | CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(bwGroup));
|
---|
1263 | }
|
---|
1264 | }
|
---|
1265 | }
|
---|
1266 | break;
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | case MODIFYVM_NIC:
|
---|
1270 | {
|
---|
1271 | ComPtr<INetworkAdapter> nic;
|
---|
1272 |
|
---|
1273 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1274 | ASSERT(nic);
|
---|
1275 |
|
---|
1276 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1277 | {
|
---|
1278 | CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
|
---|
1279 | }
|
---|
1280 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1281 | {
|
---|
1282 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1283 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Null));
|
---|
1284 | }
|
---|
1285 | else if (!strcmp(ValueUnion.psz, "nat"))
|
---|
1286 | {
|
---|
1287 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1288 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NAT));
|
---|
1289 | }
|
---|
1290 | else if ( !strcmp(ValueUnion.psz, "bridged")
|
---|
1291 | || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
|
---|
1292 | {
|
---|
1293 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1294 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged));
|
---|
1295 | }
|
---|
1296 | else if (!strcmp(ValueUnion.psz, "intnet"))
|
---|
1297 | {
|
---|
1298 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1299 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Internal));
|
---|
1300 | }
|
---|
1301 | else if (!strcmp(ValueUnion.psz, "hostonly"))
|
---|
1302 | {
|
---|
1303 |
|
---|
1304 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1305 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly));
|
---|
1306 | }
|
---|
1307 | else if (!strcmp(ValueUnion.psz, "generic"))
|
---|
1308 | {
|
---|
1309 |
|
---|
1310 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1311 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic));
|
---|
1312 | }
|
---|
1313 | else
|
---|
1314 | {
|
---|
1315 | errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1316 | rc = E_FAIL;
|
---|
1317 | }
|
---|
1318 | break;
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 | case MODIFYVM_CABLECONNECTED:
|
---|
1322 | {
|
---|
1323 | ComPtr<INetworkAdapter> nic;
|
---|
1324 |
|
---|
1325 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1326 | ASSERT(nic);
|
---|
1327 |
|
---|
1328 | CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
|
---|
1329 | break;
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | case MODIFYVM_BRIDGEADAPTER:
|
---|
1333 | {
|
---|
1334 | ComPtr<INetworkAdapter> nic;
|
---|
1335 |
|
---|
1336 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1337 | ASSERT(nic);
|
---|
1338 |
|
---|
1339 | /* remove it? */
|
---|
1340 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1341 | {
|
---|
1342 | CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr().raw()));
|
---|
1343 | }
|
---|
1344 | else
|
---|
1345 | {
|
---|
1346 | CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr(ValueUnion.psz).raw()));
|
---|
1347 | }
|
---|
1348 | break;
|
---|
1349 | }
|
---|
1350 |
|
---|
1351 | case MODIFYVM_HOSTONLYADAPTER:
|
---|
1352 | {
|
---|
1353 | ComPtr<INetworkAdapter> nic;
|
---|
1354 |
|
---|
1355 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1356 | ASSERT(nic);
|
---|
1357 |
|
---|
1358 | /* remove it? */
|
---|
1359 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1360 | {
|
---|
1361 | CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr().raw()));
|
---|
1362 | }
|
---|
1363 | else
|
---|
1364 | {
|
---|
1365 | CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr(ValueUnion.psz).raw()));
|
---|
1366 | }
|
---|
1367 | break;
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | case MODIFYVM_INTNET:
|
---|
1371 | {
|
---|
1372 | ComPtr<INetworkAdapter> nic;
|
---|
1373 |
|
---|
1374 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1375 | ASSERT(nic);
|
---|
1376 |
|
---|
1377 | /* remove it? */
|
---|
1378 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1379 | {
|
---|
1380 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr().raw()));
|
---|
1381 | }
|
---|
1382 | else
|
---|
1383 | {
|
---|
1384 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
1385 | }
|
---|
1386 | break;
|
---|
1387 | }
|
---|
1388 |
|
---|
1389 | case MODIFYVM_GENERICDRV:
|
---|
1390 | {
|
---|
1391 | ComPtr<INetworkAdapter> nic;
|
---|
1392 |
|
---|
1393 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1394 | ASSERT(nic);
|
---|
1395 |
|
---|
1396 | CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw()));
|
---|
1397 | break;
|
---|
1398 | }
|
---|
1399 |
|
---|
1400 | case MODIFYVM_NATNET:
|
---|
1401 | {
|
---|
1402 | ComPtr<INetworkAdapter> nic;
|
---|
1403 | ComPtr<INATEngine> engine;
|
---|
1404 |
|
---|
1405 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1406 | ASSERT(nic);
|
---|
1407 |
|
---|
1408 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1409 |
|
---|
1410 | const char *psz = ValueUnion.psz;
|
---|
1411 | if (!strcmp("default", psz))
|
---|
1412 | psz = "";
|
---|
1413 |
|
---|
1414 | CHECK_ERROR(engine, COMSETTER(Network)(Bstr(psz).raw()));
|
---|
1415 | break;
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 | case MODIFYVM_NATBINDIP:
|
---|
1419 | {
|
---|
1420 | ComPtr<INetworkAdapter> nic;
|
---|
1421 | ComPtr<INATEngine> engine;
|
---|
1422 |
|
---|
1423 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1424 | ASSERT(nic);
|
---|
1425 |
|
---|
1426 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1427 | CHECK_ERROR(engine, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw()));
|
---|
1428 | break;
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | #define ITERATE_TO_NEXT_TERM(ch) \
|
---|
1432 | do { \
|
---|
1433 | while (*ch != ',') \
|
---|
1434 | { \
|
---|
1435 | if (*ch == 0) \
|
---|
1436 | { \
|
---|
1437 | return errorSyntax(USAGE_MODIFYVM, \
|
---|
1438 | "Missing or Invalid argument to '%s'", \
|
---|
1439 | GetOptState.pDef->pszLong); \
|
---|
1440 | } \
|
---|
1441 | ch++; \
|
---|
1442 | } \
|
---|
1443 | *ch = '\0'; \
|
---|
1444 | ch++; \
|
---|
1445 | } while(0)
|
---|
1446 |
|
---|
1447 | case MODIFYVM_NATSETTINGS:
|
---|
1448 | {
|
---|
1449 | ComPtr<INetworkAdapter> nic;
|
---|
1450 | ComPtr<INATEngine> engine;
|
---|
1451 | char *strMtu;
|
---|
1452 | char *strSockSnd;
|
---|
1453 | char *strSockRcv;
|
---|
1454 | char *strTcpSnd;
|
---|
1455 | char *strTcpRcv;
|
---|
1456 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
1457 | char *ch = strRaw;
|
---|
1458 | strMtu = RTStrStrip(ch);
|
---|
1459 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1460 | strSockSnd = RTStrStrip(ch);
|
---|
1461 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1462 | strSockRcv = RTStrStrip(ch);
|
---|
1463 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1464 | strTcpSnd = RTStrStrip(ch);
|
---|
1465 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1466 | strTcpRcv = RTStrStrip(ch);
|
---|
1467 |
|
---|
1468 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1469 | ASSERT(nic);
|
---|
1470 |
|
---|
1471 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1472 | CHECK_ERROR(engine, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
|
---|
1473 | RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
|
---|
1474 | break;
|
---|
1475 | }
|
---|
1476 |
|
---|
1477 |
|
---|
1478 | case MODIFYVM_NATPF:
|
---|
1479 | {
|
---|
1480 | ComPtr<INetworkAdapter> nic;
|
---|
1481 | ComPtr<INATEngine> engine;
|
---|
1482 |
|
---|
1483 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1484 | ASSERT(nic);
|
---|
1485 |
|
---|
1486 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1487 | /* format name:proto:hostip:hostport:guestip:guestport*/
|
---|
1488 | if (RTStrCmp(ValueUnion.psz, "delete") != 0)
|
---|
1489 | {
|
---|
1490 | char *strName;
|
---|
1491 | char *strProto;
|
---|
1492 | char *strHostIp;
|
---|
1493 | char *strHostPort;
|
---|
1494 | char *strGuestIp;
|
---|
1495 | char *strGuestPort;
|
---|
1496 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
1497 | char *ch = strRaw;
|
---|
1498 | strName = RTStrStrip(ch);
|
---|
1499 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1500 | strProto = RTStrStrip(ch);
|
---|
1501 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1502 | strHostIp = RTStrStrip(ch);
|
---|
1503 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1504 | strHostPort = RTStrStrip(ch);
|
---|
1505 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1506 | strGuestIp = RTStrStrip(ch);
|
---|
1507 | ITERATE_TO_NEXT_TERM(ch);
|
---|
1508 | strGuestPort = RTStrStrip(ch);
|
---|
1509 | NATProtocol_T proto;
|
---|
1510 | if (RTStrICmp(strProto, "udp") == 0)
|
---|
1511 | proto = NATProtocol_UDP;
|
---|
1512 | else if (RTStrICmp(strProto, "tcp") == 0)
|
---|
1513 | proto = NATProtocol_TCP;
|
---|
1514 | else
|
---|
1515 | {
|
---|
1516 | errorArgument("Invalid proto '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
|
---|
1517 | rc = E_FAIL;
|
---|
1518 | break;
|
---|
1519 | }
|
---|
1520 | CHECK_ERROR(engine, AddRedirect(Bstr(strName).raw(), proto,
|
---|
1521 | Bstr(strHostIp).raw(),
|
---|
1522 | RTStrToUInt16(strHostPort),
|
---|
1523 | Bstr(strGuestIp).raw(),
|
---|
1524 | RTStrToUInt16(strGuestPort)));
|
---|
1525 | }
|
---|
1526 | else
|
---|
1527 | {
|
---|
1528 | /* delete NAT Rule operation */
|
---|
1529 | int vrc;
|
---|
1530 | vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
1531 | if (RT_FAILURE(vrc))
|
---|
1532 | return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
|
---|
1533 | CHECK_ERROR(engine, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
|
---|
1534 | }
|
---|
1535 | break;
|
---|
1536 | }
|
---|
1537 | #undef ITERATE_TO_NEXT_TERM
|
---|
1538 | case MODIFYVM_NATALIASMODE:
|
---|
1539 | {
|
---|
1540 | ComPtr<INetworkAdapter> nic;
|
---|
1541 | ComPtr<INATEngine> engine;
|
---|
1542 | uint32_t aliasMode = 0;
|
---|
1543 |
|
---|
1544 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1545 | ASSERT(nic);
|
---|
1546 |
|
---|
1547 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1548 | if (RTStrCmp(ValueUnion.psz,"default") == 0)
|
---|
1549 | {
|
---|
1550 | aliasMode = 0;
|
---|
1551 | }
|
---|
1552 | else
|
---|
1553 | {
|
---|
1554 | char *token = (char *)ValueUnion.psz;
|
---|
1555 | while(token)
|
---|
1556 | {
|
---|
1557 | if (RTStrNCmp(token, "log", 3) == 0)
|
---|
1558 | aliasMode |= 0x1;
|
---|
1559 | else if (RTStrNCmp(token, "proxyonly", 9) == 0)
|
---|
1560 | aliasMode |= 0x2;
|
---|
1561 | else if (RTStrNCmp(token, "sameports", 9) == 0)
|
---|
1562 | aliasMode |= 0x4;
|
---|
1563 | token = RTStrStr(token, ",");
|
---|
1564 | if (token == NULL)
|
---|
1565 | break;
|
---|
1566 | token++;
|
---|
1567 | }
|
---|
1568 | }
|
---|
1569 | CHECK_ERROR(engine, COMSETTER(AliasMode)(aliasMode));
|
---|
1570 | break;
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 | case MODIFYVM_NATTFTPPREFIX:
|
---|
1574 | {
|
---|
1575 | ComPtr<INetworkAdapter> nic;
|
---|
1576 | ComPtr<INATEngine> engine;
|
---|
1577 |
|
---|
1578 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1579 | ASSERT(nic);
|
---|
1580 |
|
---|
1581 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1582 | CHECK_ERROR(engine, COMSETTER(TFTPPrefix)(Bstr(ValueUnion.psz).raw()));
|
---|
1583 | break;
|
---|
1584 | }
|
---|
1585 |
|
---|
1586 | case MODIFYVM_NATTFTPFILE:
|
---|
1587 | {
|
---|
1588 | ComPtr<INetworkAdapter> nic;
|
---|
1589 | ComPtr<INATEngine> engine;
|
---|
1590 |
|
---|
1591 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1592 | ASSERT(nic);
|
---|
1593 |
|
---|
1594 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1595 | CHECK_ERROR(engine, COMSETTER(TFTPBootFile)(Bstr(ValueUnion.psz).raw()));
|
---|
1596 | break;
|
---|
1597 | }
|
---|
1598 |
|
---|
1599 | case MODIFYVM_NATTFTPSERVER:
|
---|
1600 | {
|
---|
1601 | ComPtr<INetworkAdapter> nic;
|
---|
1602 | ComPtr<INATEngine> engine;
|
---|
1603 |
|
---|
1604 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1605 | ASSERT(nic);
|
---|
1606 |
|
---|
1607 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1608 | CHECK_ERROR(engine, COMSETTER(TFTPNextServer)(Bstr(ValueUnion.psz).raw()));
|
---|
1609 | break;
|
---|
1610 | }
|
---|
1611 | case MODIFYVM_NATDNSPASSDOMAIN:
|
---|
1612 | {
|
---|
1613 | ComPtr<INetworkAdapter> nic;
|
---|
1614 | ComPtr<INATEngine> engine;
|
---|
1615 |
|
---|
1616 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1617 | ASSERT(nic);
|
---|
1618 |
|
---|
1619 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1620 | CHECK_ERROR(engine, COMSETTER(DNSPassDomain)(ValueUnion.f));
|
---|
1621 | break;
|
---|
1622 | }
|
---|
1623 |
|
---|
1624 | case MODIFYVM_NATDNSPROXY:
|
---|
1625 | {
|
---|
1626 | ComPtr<INetworkAdapter> nic;
|
---|
1627 | ComPtr<INATEngine> engine;
|
---|
1628 |
|
---|
1629 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1630 | ASSERT(nic);
|
---|
1631 |
|
---|
1632 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1633 | CHECK_ERROR(engine, COMSETTER(DNSProxy)(ValueUnion.f));
|
---|
1634 | break;
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | case MODIFYVM_NATDNSHOSTRESOLVER:
|
---|
1638 | {
|
---|
1639 | ComPtr<INetworkAdapter> nic;
|
---|
1640 | ComPtr<INATEngine> engine;
|
---|
1641 |
|
---|
1642 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1643 | ASSERT(nic);
|
---|
1644 |
|
---|
1645 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
1646 | CHECK_ERROR(engine, COMSETTER(DNSUseHostResolver)(ValueUnion.f));
|
---|
1647 | break;
|
---|
1648 | }
|
---|
1649 | case MODIFYVM_MACADDRESS:
|
---|
1650 | {
|
---|
1651 | ComPtr<INetworkAdapter> nic;
|
---|
1652 |
|
---|
1653 | CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1654 | ASSERT(nic);
|
---|
1655 |
|
---|
1656 | /* generate one? */
|
---|
1657 | if (!strcmp(ValueUnion.psz, "auto"))
|
---|
1658 | {
|
---|
1659 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr().raw()));
|
---|
1660 | }
|
---|
1661 | else
|
---|
1662 | {
|
---|
1663 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
1664 | }
|
---|
1665 | break;
|
---|
1666 | }
|
---|
1667 |
|
---|
1668 | case MODIFYVM_HIDPTR:
|
---|
1669 | {
|
---|
1670 | bool fEnableUsb = false;
|
---|
1671 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1672 | {
|
---|
1673 | CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_PS2Mouse));
|
---|
1674 | }
|
---|
1675 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1676 | {
|
---|
1677 | CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBMouse));
|
---|
1678 | if (SUCCEEDED(rc))
|
---|
1679 | fEnableUsb = true;
|
---|
1680 | }
|
---|
1681 | else if (!strcmp(ValueUnion.psz, "usbtablet"))
|
---|
1682 | {
|
---|
1683 | CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBTablet));
|
---|
1684 | if (SUCCEEDED(rc))
|
---|
1685 | fEnableUsb = true;
|
---|
1686 | }
|
---|
1687 | else
|
---|
1688 | {
|
---|
1689 | errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
|
---|
1690 | rc = E_FAIL;
|
---|
1691 | }
|
---|
1692 | if (fEnableUsb)
|
---|
1693 | {
|
---|
1694 | /* Make sure the OHCI controller is enabled. */
|
---|
1695 | ComPtr<IUSBController> UsbCtl;
|
---|
1696 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1697 | if (SUCCEEDED(rc))
|
---|
1698 | {
|
---|
1699 | BOOL fEnabled;
|
---|
1700 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1701 | if (FAILED(rc))
|
---|
1702 | fEnabled = false;
|
---|
1703 | if (!fEnabled)
|
---|
1704 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1705 | }
|
---|
1706 | }
|
---|
1707 | break;
|
---|
1708 | }
|
---|
1709 |
|
---|
1710 | case MODIFYVM_HIDKBD:
|
---|
1711 | {
|
---|
1712 | bool fEnableUsb = false;
|
---|
1713 | if (!strcmp(ValueUnion.psz, "ps2"))
|
---|
1714 | {
|
---|
1715 | CHECK_ERROR(machine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_PS2Keyboard));
|
---|
1716 | }
|
---|
1717 | else if (!strcmp(ValueUnion.psz, "usb"))
|
---|
1718 | {
|
---|
1719 | CHECK_ERROR(machine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_USBKeyboard));
|
---|
1720 | if (SUCCEEDED(rc))
|
---|
1721 | fEnableUsb = true;
|
---|
1722 | }
|
---|
1723 | else
|
---|
1724 | {
|
---|
1725 | errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
|
---|
1726 | rc = E_FAIL;
|
---|
1727 | }
|
---|
1728 | if (fEnableUsb)
|
---|
1729 | {
|
---|
1730 | /* Make sure the OHCI controller is enabled. */
|
---|
1731 | ComPtr<IUSBController> UsbCtl;
|
---|
1732 | rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
|
---|
1733 | if (SUCCEEDED(rc))
|
---|
1734 | {
|
---|
1735 | BOOL fEnabled;
|
---|
1736 | rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
|
---|
1737 | if (FAILED(rc))
|
---|
1738 | fEnabled = false;
|
---|
1739 | if (!fEnabled)
|
---|
1740 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
|
---|
1741 | }
|
---|
1742 | }
|
---|
1743 | break;
|
---|
1744 | }
|
---|
1745 |
|
---|
1746 | case MODIFYVM_UARTMODE:
|
---|
1747 | {
|
---|
1748 | ComPtr<ISerialPort> uart;
|
---|
1749 | char *pszIRQ = NULL;
|
---|
1750 |
|
---|
1751 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1752 | ASSERT(uart);
|
---|
1753 |
|
---|
1754 | if (!strcmp(ValueUnion.psz, "disconnected"))
|
---|
1755 | {
|
---|
1756 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
|
---|
1757 | }
|
---|
1758 | else if ( !strcmp(ValueUnion.psz, "server")
|
---|
1759 | || !strcmp(ValueUnion.psz, "client")
|
---|
1760 | || !strcmp(ValueUnion.psz, "file"))
|
---|
1761 | {
|
---|
1762 | const char *pszMode = ValueUnion.psz;
|
---|
1763 |
|
---|
1764 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
1765 | if (RT_FAILURE(vrc))
|
---|
1766 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1767 | "Missing or Invalid argument to '%s'",
|
---|
1768 | GetOptState.pDef->pszLong);
|
---|
1769 |
|
---|
1770 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
1771 |
|
---|
1772 | if (!strcmp(pszMode, "server"))
|
---|
1773 | {
|
---|
1774 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1775 | CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
|
---|
1776 | }
|
---|
1777 | else if (!strcmp(pszMode, "client"))
|
---|
1778 | {
|
---|
1779 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
1780 | CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
|
---|
1781 | }
|
---|
1782 | else if (!strcmp(pszMode, "file"))
|
---|
1783 | {
|
---|
1784 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
|
---|
1785 | }
|
---|
1786 | }
|
---|
1787 | else
|
---|
1788 | {
|
---|
1789 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
1790 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
|
---|
1791 | }
|
---|
1792 | break;
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 | case MODIFYVM_UART:
|
---|
1796 | {
|
---|
1797 | ComPtr<ISerialPort> uart;
|
---|
1798 |
|
---|
1799 | CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
1800 | ASSERT(uart);
|
---|
1801 |
|
---|
1802 | if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
1803 | CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
|
---|
1804 | else
|
---|
1805 | {
|
---|
1806 | const char *pszIOBase = ValueUnion.psz;
|
---|
1807 | uint32_t uVal = 0;
|
---|
1808 |
|
---|
1809 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
|
---|
1810 | if (RT_FAILURE(vrc))
|
---|
1811 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1812 | "Missing or Invalid argument to '%s'",
|
---|
1813 | GetOptState.pDef->pszLong);
|
---|
1814 |
|
---|
1815 | CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
1816 |
|
---|
1817 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
1818 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
1819 | return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
|
---|
1820 | CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
|
---|
1821 |
|
---|
1822 | CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
|
---|
1823 | }
|
---|
1824 | break;
|
---|
1825 | }
|
---|
1826 |
|
---|
1827 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
1828 | case MODIFYVM_LPTMODE:
|
---|
1829 | {
|
---|
1830 | ComPtr<IParallelPort> lpt;
|
---|
1831 | char *pszIRQ = NULL;
|
---|
1832 |
|
---|
1833 | CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
|
---|
1834 | ASSERT(lpt);
|
---|
1835 |
|
---|
1836 | CHECK_ERROR(lpt, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
1837 | break;
|
---|
1838 | }
|
---|
1839 |
|
---|
1840 | case MODIFYVM_LPT:
|
---|
1841 | {
|
---|
1842 | ComPtr<IParallelPort> lpt;
|
---|
1843 |
|
---|
1844 | CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
|
---|
1845 | ASSERT(lpt);
|
---|
1846 |
|
---|
1847 | if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
|
---|
1848 | CHECK_ERROR(lpt, COMSETTER(Enabled)(FALSE));
|
---|
1849 | else
|
---|
1850 | {
|
---|
1851 | const char *pszIOBase = ValueUnion.psz;
|
---|
1852 | uint32_t uVal = 0;
|
---|
1853 |
|
---|
1854 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_LPT;
|
---|
1855 | if (RT_FAILURE(vrc))
|
---|
1856 | return errorSyntax(USAGE_MODIFYVM,
|
---|
1857 | "Missing or Invalid argument to '%s'",
|
---|
1858 | GetOptState.pDef->pszLong);
|
---|
1859 |
|
---|
1860 | CHECK_ERROR(lpt, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
1861 |
|
---|
1862 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
1863 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
1864 | return errorArgument("Error parsing LPT I/O base '%s'", pszIOBase);
|
---|
1865 | CHECK_ERROR(lpt, COMSETTER(IOBase)(uVal));
|
---|
1866 |
|
---|
1867 | CHECK_ERROR(lpt, COMSETTER(Enabled)(TRUE));
|
---|
1868 | }
|
---|
1869 | break;
|
---|
1870 | }
|
---|
1871 | #endif
|
---|
1872 |
|
---|
1873 | case MODIFYVM_GUESTMEMORYBALLOON:
|
---|
1874 | {
|
---|
1875 | CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
|
---|
1876 | break;
|
---|
1877 | }
|
---|
1878 |
|
---|
1879 | case MODIFYVM_AUDIOCONTROLLER:
|
---|
1880 | {
|
---|
1881 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1882 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1883 | ASSERT(audioAdapter);
|
---|
1884 |
|
---|
1885 | if (!strcmp(ValueUnion.psz, "sb16"))
|
---|
1886 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
|
---|
1887 | else if (!strcmp(ValueUnion.psz, "ac97"))
|
---|
1888 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
|
---|
1889 | else if (!strcmp(ValueUnion.psz, "hda"))
|
---|
1890 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_HDA));
|
---|
1891 | else
|
---|
1892 | {
|
---|
1893 | errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
|
---|
1894 | rc = E_FAIL;
|
---|
1895 | }
|
---|
1896 | break;
|
---|
1897 | }
|
---|
1898 |
|
---|
1899 | case MODIFYVM_AUDIO:
|
---|
1900 | {
|
---|
1901 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
1902 | machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
|
---|
1903 | ASSERT(audioAdapter);
|
---|
1904 |
|
---|
1905 | /* disable? */
|
---|
1906 | if (!strcmp(ValueUnion.psz, "none"))
|
---|
1907 | {
|
---|
1908 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
|
---|
1909 | }
|
---|
1910 | else if (!strcmp(ValueUnion.psz, "null"))
|
---|
1911 | {
|
---|
1912 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
|
---|
1913 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1914 | }
|
---|
1915 | #ifdef RT_OS_WINDOWS
|
---|
1916 | #ifdef VBOX_WITH_WINMM
|
---|
1917 | else if (!strcmp(ValueUnion.psz, "winmm"))
|
---|
1918 | {
|
---|
1919 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
|
---|
1920 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1921 | }
|
---|
1922 | #endif
|
---|
1923 | else if (!strcmp(ValueUnion.psz, "dsound"))
|
---|
1924 | {
|
---|
1925 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
|
---|
1926 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1927 | }
|
---|
1928 | #endif /* RT_OS_WINDOWS */
|
---|
1929 | #ifdef RT_OS_LINUX
|
---|
1930 | # ifdef VBOX_WITH_ALSA
|
---|
1931 | else if (!strcmp(ValueUnion.psz, "alsa"))
|
---|
1932 | {
|
---|
1933 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
|
---|
1934 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1935 | }
|
---|
1936 | # endif
|
---|
1937 | # ifdef VBOX_WITH_PULSE
|
---|
1938 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1939 | {
|
---|
1940 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1941 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1942 | }
|
---|
1943 | # endif
|
---|
1944 | #endif /* !RT_OS_LINUX */
|
---|
1945 | #ifdef RT_OS_SOLARIS
|
---|
1946 | else if (!strcmp(ValueUnion.psz, "solaudio"))
|
---|
1947 | {
|
---|
1948 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
|
---|
1949 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1950 | }
|
---|
1951 | #endif /* !RT_OS_SOLARIS */
|
---|
1952 | #ifdef RT_OS_FREEBSD
|
---|
1953 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1954 | {
|
---|
1955 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1956 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1957 | }
|
---|
1958 | # ifdef VBOX_WITH_PULSE
|
---|
1959 | else if (!strcmp(ValueUnion.psz, "pulse"))
|
---|
1960 | {
|
---|
1961 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
1962 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1963 | }
|
---|
1964 | # endif
|
---|
1965 | #endif /* !RT_OS_FREEBSD */
|
---|
1966 | #ifdef RT_OS_DARWIN
|
---|
1967 | else if (!strcmp(ValueUnion.psz, "coreaudio"))
|
---|
1968 | {
|
---|
1969 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
|
---|
1970 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1971 | }
|
---|
1972 |
|
---|
1973 | #endif /* !RT_OS_DARWIN */
|
---|
1974 | # if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
|
---|
1975 | else if (!strcmp(ValueUnion.psz, "oss"))
|
---|
1976 | {
|
---|
1977 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
1978 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
|
---|
1979 | }
|
---|
1980 | # endif
|
---|
1981 | else
|
---|
1982 | {
|
---|
1983 | errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
|
---|
1984 | rc = E_FAIL;
|
---|
1985 | }
|
---|
1986 | break;
|
---|
1987 | }
|
---|
1988 |
|
---|
1989 | case MODIFYVM_CLIPBOARD:
|
---|
1990 | {
|
---|
1991 | ClipboardMode_T mode;
|
---|
1992 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
1993 | mode = ClipboardMode_Disabled;
|
---|
1994 | else if (!strcmp(ValueUnion.psz, "hosttoguest"))
|
---|
1995 | mode = ClipboardMode_HostToGuest;
|
---|
1996 | else if (!strcmp(ValueUnion.psz, "guesttohost"))
|
---|
1997 | mode = ClipboardMode_GuestToHost;
|
---|
1998 | else if (!strcmp(ValueUnion.psz, "bidirectional"))
|
---|
1999 | mode = ClipboardMode_Bidirectional;
|
---|
2000 | else
|
---|
2001 | {
|
---|
2002 | errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
|
---|
2003 | rc = E_FAIL;
|
---|
2004 | }
|
---|
2005 | if (SUCCEEDED(rc))
|
---|
2006 | {
|
---|
2007 | CHECK_ERROR(machine, COMSETTER(ClipboardMode)(mode));
|
---|
2008 | }
|
---|
2009 | break;
|
---|
2010 | }
|
---|
2011 |
|
---|
2012 | case MODIFYVM_DRAGANDDROP:
|
---|
2013 | {
|
---|
2014 | DragAndDropMode_T mode;
|
---|
2015 | if (!strcmp(ValueUnion.psz, "disabled"))
|
---|
2016 | mode = DragAndDropMode_Disabled;
|
---|
2017 | else if (!strcmp(ValueUnion.psz, "hosttoguest"))
|
---|
2018 | mode = DragAndDropMode_HostToGuest;
|
---|
2019 | else if (!strcmp(ValueUnion.psz, "guesttohost"))
|
---|
2020 | mode = DragAndDropMode_GuestToHost;
|
---|
2021 | else if (!strcmp(ValueUnion.psz, "bidirectional"))
|
---|
2022 | mode = DragAndDropMode_Bidirectional;
|
---|
2023 | else
|
---|
2024 | {
|
---|
2025 | errorArgument("Invalid --draganddrop argument '%s'", ValueUnion.psz);
|
---|
2026 | rc = E_FAIL;
|
---|
2027 | }
|
---|
2028 | if (SUCCEEDED(rc))
|
---|
2029 | {
|
---|
2030 | CHECK_ERROR(machine, COMSETTER(DragAndDropMode)(mode));
|
---|
2031 | }
|
---|
2032 | break;
|
---|
2033 | }
|
---|
2034 |
|
---|
2035 | case MODIFYVM_VRDE_EXTPACK:
|
---|
2036 | {
|
---|
2037 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2038 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2039 | ASSERT(vrdeServer);
|
---|
2040 |
|
---|
2041 | if (vrdeServer)
|
---|
2042 | {
|
---|
2043 | if (strcmp(ValueUnion.psz, "default") != 0)
|
---|
2044 | {
|
---|
2045 | Bstr bstr(ValueUnion.psz);
|
---|
2046 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
|
---|
2047 | }
|
---|
2048 | else
|
---|
2049 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(Bstr().raw()));
|
---|
2050 | }
|
---|
2051 | break;
|
---|
2052 | }
|
---|
2053 |
|
---|
2054 | case MODIFYVM_VRDEPROPERTY:
|
---|
2055 | {
|
---|
2056 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2057 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2058 | ASSERT(vrdeServer);
|
---|
2059 |
|
---|
2060 | if (vrdeServer)
|
---|
2061 | {
|
---|
2062 | /* Parse 'name=value' */
|
---|
2063 | char *pszProperty = RTStrDup(ValueUnion.psz);
|
---|
2064 | if (pszProperty)
|
---|
2065 | {
|
---|
2066 | char *pDelimiter = strchr(pszProperty, '=');
|
---|
2067 | if (pDelimiter)
|
---|
2068 | {
|
---|
2069 | *pDelimiter = '\0';
|
---|
2070 |
|
---|
2071 | Bstr bstrName = pszProperty;
|
---|
2072 | Bstr bstrValue = &pDelimiter[1];
|
---|
2073 | CHECK_ERROR(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw()));
|
---|
2074 | }
|
---|
2075 | else
|
---|
2076 | {
|
---|
2077 | RTStrFree(pszProperty);
|
---|
2078 |
|
---|
2079 | errorArgument("Invalid --vrdeproperty argument '%s'", ValueUnion.psz);
|
---|
2080 | rc = E_FAIL;
|
---|
2081 | break;
|
---|
2082 | }
|
---|
2083 | RTStrFree(pszProperty);
|
---|
2084 | }
|
---|
2085 | else
|
---|
2086 | {
|
---|
2087 | RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for VRDE property '%s'\n", ValueUnion.psz);
|
---|
2088 | rc = E_FAIL;
|
---|
2089 | }
|
---|
2090 | }
|
---|
2091 | break;
|
---|
2092 | }
|
---|
2093 |
|
---|
2094 | case MODIFYVM_VRDPPORT:
|
---|
2095 | vrdeWarningDeprecatedOption("port");
|
---|
2096 |
|
---|
2097 | case MODIFYVM_VRDEPORT:
|
---|
2098 | {
|
---|
2099 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2100 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2101 | ASSERT(vrdeServer);
|
---|
2102 |
|
---|
2103 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
2104 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr("0").raw()));
|
---|
2105 | else
|
---|
2106 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
2107 | break;
|
---|
2108 | }
|
---|
2109 |
|
---|
2110 | case MODIFYVM_VRDPADDRESS:
|
---|
2111 | vrdeWarningDeprecatedOption("address");
|
---|
2112 |
|
---|
2113 | case MODIFYVM_VRDEADDRESS:
|
---|
2114 | {
|
---|
2115 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2116 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2117 | ASSERT(vrdeServer);
|
---|
2118 |
|
---|
2119 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
2120 | break;
|
---|
2121 | }
|
---|
2122 |
|
---|
2123 | case MODIFYVM_VRDPAUTHTYPE:
|
---|
2124 | vrdeWarningDeprecatedOption("authtype");
|
---|
2125 | case MODIFYVM_VRDEAUTHTYPE:
|
---|
2126 | {
|
---|
2127 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2128 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2129 | ASSERT(vrdeServer);
|
---|
2130 |
|
---|
2131 | if (!strcmp(ValueUnion.psz, "null"))
|
---|
2132 | {
|
---|
2133 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
|
---|
2134 | }
|
---|
2135 | else if (!strcmp(ValueUnion.psz, "external"))
|
---|
2136 | {
|
---|
2137 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
|
---|
2138 | }
|
---|
2139 | else if (!strcmp(ValueUnion.psz, "guest"))
|
---|
2140 | {
|
---|
2141 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Guest));
|
---|
2142 | }
|
---|
2143 | else
|
---|
2144 | {
|
---|
2145 | errorArgument("Invalid --vrdeauthtype argument '%s'", ValueUnion.psz);
|
---|
2146 | rc = E_FAIL;
|
---|
2147 | }
|
---|
2148 | break;
|
---|
2149 | }
|
---|
2150 |
|
---|
2151 | case MODIFYVM_VRDEAUTHLIBRARY:
|
---|
2152 | {
|
---|
2153 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2154 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2155 | ASSERT(vrdeServer);
|
---|
2156 |
|
---|
2157 | if (vrdeServer)
|
---|
2158 | {
|
---|
2159 | if (strcmp(ValueUnion.psz, "default") != 0)
|
---|
2160 | {
|
---|
2161 | Bstr bstr(ValueUnion.psz);
|
---|
2162 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
|
---|
2163 | }
|
---|
2164 | else
|
---|
2165 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(Bstr().raw()));
|
---|
2166 | }
|
---|
2167 | break;
|
---|
2168 | }
|
---|
2169 |
|
---|
2170 | case MODIFYVM_VRDPMULTICON:
|
---|
2171 | vrdeWarningDeprecatedOption("multicon");
|
---|
2172 | case MODIFYVM_VRDEMULTICON:
|
---|
2173 | {
|
---|
2174 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2175 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2176 | ASSERT(vrdeServer);
|
---|
2177 |
|
---|
2178 | CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
|
---|
2179 | break;
|
---|
2180 | }
|
---|
2181 |
|
---|
2182 | case MODIFYVM_VRDPREUSECON:
|
---|
2183 | vrdeWarningDeprecatedOption("reusecon");
|
---|
2184 | case MODIFYVM_VRDEREUSECON:
|
---|
2185 | {
|
---|
2186 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2187 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2188 | ASSERT(vrdeServer);
|
---|
2189 |
|
---|
2190 | CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
|
---|
2191 | break;
|
---|
2192 | }
|
---|
2193 |
|
---|
2194 | case MODIFYVM_VRDPVIDEOCHANNEL:
|
---|
2195 | vrdeWarningDeprecatedOption("videochannel");
|
---|
2196 | case MODIFYVM_VRDEVIDEOCHANNEL:
|
---|
2197 | {
|
---|
2198 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2199 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2200 | ASSERT(vrdeServer);
|
---|
2201 |
|
---|
2202 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
|
---|
2203 | ValueUnion.f? Bstr("true").raw(): Bstr("false").raw()));
|
---|
2204 | break;
|
---|
2205 | }
|
---|
2206 |
|
---|
2207 | case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
|
---|
2208 | vrdeWarningDeprecatedOption("videochannelquality");
|
---|
2209 | case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
|
---|
2210 | {
|
---|
2211 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2212 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2213 | ASSERT(vrdeServer);
|
---|
2214 |
|
---|
2215 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
|
---|
2216 | Bstr(ValueUnion.psz).raw()));
|
---|
2217 | break;
|
---|
2218 | }
|
---|
2219 |
|
---|
2220 | case MODIFYVM_VRDP:
|
---|
2221 | vrdeWarningDeprecatedOption("");
|
---|
2222 | case MODIFYVM_VRDE:
|
---|
2223 | {
|
---|
2224 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2225 | machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2226 | ASSERT(vrdeServer);
|
---|
2227 |
|
---|
2228 | CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
|
---|
2229 | break;
|
---|
2230 | }
|
---|
2231 |
|
---|
2232 | case MODIFYVM_USBEHCI:
|
---|
2233 | {
|
---|
2234 | ComPtr<IUSBController> UsbCtl;
|
---|
2235 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
2236 | if (SUCCEEDED(rc))
|
---|
2237 | CHECK_ERROR(UsbCtl, COMSETTER(EnabledEHCI)(ValueUnion.f));
|
---|
2238 | break;
|
---|
2239 | }
|
---|
2240 |
|
---|
2241 | case MODIFYVM_USB:
|
---|
2242 | {
|
---|
2243 | ComPtr<IUSBController> UsbCtl;
|
---|
2244 | CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
|
---|
2245 | if (SUCCEEDED(rc))
|
---|
2246 | CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
|
---|
2247 | break;
|
---|
2248 | }
|
---|
2249 |
|
---|
2250 | case MODIFYVM_SNAPSHOTFOLDER:
|
---|
2251 | {
|
---|
2252 | if (!strcmp(ValueUnion.psz, "default"))
|
---|
2253 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr().raw()));
|
---|
2254 | else
|
---|
2255 | CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
|
---|
2256 | break;
|
---|
2257 | }
|
---|
2258 |
|
---|
2259 | case MODIFYVM_TELEPORTER_ENABLED:
|
---|
2260 | {
|
---|
2261 | CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
|
---|
2262 | break;
|
---|
2263 | }
|
---|
2264 |
|
---|
2265 | case MODIFYVM_TELEPORTER_PORT:
|
---|
2266 | {
|
---|
2267 | CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
|
---|
2268 | break;
|
---|
2269 | }
|
---|
2270 |
|
---|
2271 | case MODIFYVM_TELEPORTER_ADDRESS:
|
---|
2272 | {
|
---|
2273 | CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
2274 | break;
|
---|
2275 | }
|
---|
2276 |
|
---|
2277 | case MODIFYVM_TELEPORTER_PASSWORD:
|
---|
2278 | {
|
---|
2279 | CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
|
---|
2280 | break;
|
---|
2281 | }
|
---|
2282 |
|
---|
2283 | case MODIFYVM_TELEPORTER_PASSWORD_FILE:
|
---|
2284 | {
|
---|
2285 | Utf8Str password;
|
---|
2286 | RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &password);
|
---|
2287 | if (rcExit != RTEXITCODE_SUCCESS)
|
---|
2288 | rc = E_FAIL;
|
---|
2289 | else
|
---|
2290 | CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
|
---|
2291 | break;
|
---|
2292 | }
|
---|
2293 |
|
---|
2294 | case MODIFYVM_TRACING_ENABLED:
|
---|
2295 | {
|
---|
2296 | CHECK_ERROR(machine, COMSETTER(TracingEnabled)(ValueUnion.f));
|
---|
2297 | break;
|
---|
2298 | }
|
---|
2299 |
|
---|
2300 | case MODIFYVM_TRACING_CONFIG:
|
---|
2301 | {
|
---|
2302 | CHECK_ERROR(machine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
|
---|
2303 | break;
|
---|
2304 | }
|
---|
2305 |
|
---|
2306 | case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
|
---|
2307 | {
|
---|
2308 | CHECK_ERROR(machine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
|
---|
2309 | break;
|
---|
2310 | }
|
---|
2311 |
|
---|
2312 | case MODIFYVM_FAULT_TOLERANCE:
|
---|
2313 | {
|
---|
2314 | if (!strcmp(ValueUnion.psz, "master"))
|
---|
2315 | {
|
---|
2316 | CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
|
---|
2317 | }
|
---|
2318 | else
|
---|
2319 | if (!strcmp(ValueUnion.psz, "standby"))
|
---|
2320 | {
|
---|
2321 | CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
|
---|
2322 | }
|
---|
2323 | else
|
---|
2324 | {
|
---|
2325 | errorArgument("Invalid --faulttolerance argument '%s'", ValueUnion.psz);
|
---|
2326 | rc = E_FAIL;
|
---|
2327 | }
|
---|
2328 | break;
|
---|
2329 | }
|
---|
2330 |
|
---|
2331 | case MODIFYVM_FAULT_TOLERANCE_ADDRESS:
|
---|
2332 | {
|
---|
2333 | CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
2334 | break;
|
---|
2335 | }
|
---|
2336 |
|
---|
2337 | case MODIFYVM_FAULT_TOLERANCE_PORT:
|
---|
2338 | {
|
---|
2339 | CHECK_ERROR(machine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
|
---|
2340 | break;
|
---|
2341 | }
|
---|
2342 |
|
---|
2343 | case MODIFYVM_FAULT_TOLERANCE_PASSWORD:
|
---|
2344 | {
|
---|
2345 | CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
|
---|
2346 | break;
|
---|
2347 | }
|
---|
2348 |
|
---|
2349 | case MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL:
|
---|
2350 | {
|
---|
2351 | CHECK_ERROR(machine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
|
---|
2352 | break;
|
---|
2353 | }
|
---|
2354 |
|
---|
2355 | case MODIFYVM_HARDWARE_UUID:
|
---|
2356 | {
|
---|
2357 | CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
|
---|
2358 | break;
|
---|
2359 | }
|
---|
2360 |
|
---|
2361 | case MODIFYVM_HPET:
|
---|
2362 | {
|
---|
2363 | CHECK_ERROR(machine, COMSETTER(HPETEnabled)(ValueUnion.f));
|
---|
2364 | break;
|
---|
2365 | }
|
---|
2366 |
|
---|
2367 | case MODIFYVM_IOCACHE:
|
---|
2368 | {
|
---|
2369 | CHECK_ERROR(machine, COMSETTER(IOCacheEnabled)(ValueUnion.f));
|
---|
2370 | break;
|
---|
2371 | }
|
---|
2372 |
|
---|
2373 | case MODIFYVM_IOCACHESIZE:
|
---|
2374 | {
|
---|
2375 | CHECK_ERROR(machine, COMSETTER(IOCacheSize)(ValueUnion.u32));
|
---|
2376 | break;
|
---|
2377 | }
|
---|
2378 |
|
---|
2379 | case MODIFYVM_CHIPSET:
|
---|
2380 | {
|
---|
2381 | if (!strcmp(ValueUnion.psz, "piix3"))
|
---|
2382 | {
|
---|
2383 | CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
|
---|
2384 | }
|
---|
2385 | else if (!strcmp(ValueUnion.psz, "ich9"))
|
---|
2386 | {
|
---|
2387 | CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
|
---|
2388 | BOOL fIoApic = FALSE;
|
---|
2389 | CHECK_ERROR(biosSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
|
---|
2390 | if (!fIoApic)
|
---|
2391 | {
|
---|
2392 | RTStrmPrintf(g_pStdErr, "*** I/O APIC must be enabled for ICH9, enabling. ***\n");
|
---|
2393 | CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(TRUE));
|
---|
2394 | }
|
---|
2395 | }
|
---|
2396 | else
|
---|
2397 | {
|
---|
2398 | errorArgument("Invalid --chipset argument '%s' (valid: piix3,ich9)", ValueUnion.psz);
|
---|
2399 | rc = E_FAIL;
|
---|
2400 | }
|
---|
2401 | break;
|
---|
2402 | }
|
---|
2403 | #ifdef VBOX_WITH_VPX
|
---|
2404 | case MODIFYVM_VCP:
|
---|
2405 | {
|
---|
2406 | CHECK_ERROR(machine, COMSETTER(VideoCaptureEnabled)(ValueUnion.f));
|
---|
2407 | break;
|
---|
2408 | }
|
---|
2409 | case MODIFYVM_VCP_FILENAME:
|
---|
2410 | {
|
---|
2411 | Bstr bstr(ValueUnion.psz);
|
---|
2412 | CHECK_ERROR(machine, COMSETTER(VideoCaptureFile)(bstr.raw()));
|
---|
2413 | break;
|
---|
2414 | }
|
---|
2415 | case MODIFYVM_VCP_WIDTH:
|
---|
2416 | {
|
---|
2417 | CHECK_ERROR(machine, COMSETTER(VideoCaptureWidth)(ValueUnion.u32));
|
---|
2418 | break;
|
---|
2419 | }
|
---|
2420 | case MODIFYVM_VCP_HEIGHT:
|
---|
2421 | {
|
---|
2422 | CHECK_ERROR(machine, COMSETTER(VideoCaptureHeight)(ValueUnion.u32));
|
---|
2423 | break;
|
---|
2424 | }
|
---|
2425 | #endif
|
---|
2426 | case MODIFYVM_AUTOSTART_ENABLED:
|
---|
2427 | {
|
---|
2428 | CHECK_ERROR(machine, COMSETTER(AutostartEnabled)(ValueUnion.f));
|
---|
2429 | break;
|
---|
2430 | }
|
---|
2431 |
|
---|
2432 | case MODIFYVM_AUTOSTART_DELAY:
|
---|
2433 | {
|
---|
2434 | CHECK_ERROR(machine, COMSETTER(AutostartDelay)(ValueUnion.u32));
|
---|
2435 | break;
|
---|
2436 | }
|
---|
2437 |
|
---|
2438 | case MODIFYVM_AUTOSTOP_TYPE:
|
---|
2439 | {
|
---|
2440 | AutostopType_T enmAutostopType = AutostopType_Disabled;
|
---|
2441 |
|
---|
2442 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
2443 | enmAutostopType = AutostopType_Disabled;
|
---|
2444 | else if (!RTStrICmp(ValueUnion.psz, "savestate"))
|
---|
2445 | enmAutostopType = AutostopType_SaveState;
|
---|
2446 | else if (!RTStrICmp(ValueUnion.psz, "poweroff"))
|
---|
2447 | enmAutostopType = AutostopType_PowerOff;
|
---|
2448 | else if (!RTStrICmp(ValueUnion.psz, "acpishutdown"))
|
---|
2449 | enmAutostopType = AutostopType_AcpiShutdown;
|
---|
2450 | else
|
---|
2451 | {
|
---|
2452 | errorArgument("Invalid --autostop-type argument '%s' (valid: disabled, savestate, poweroff, acpishutdown)", ValueUnion.psz);
|
---|
2453 | rc = E_FAIL;
|
---|
2454 | }
|
---|
2455 |
|
---|
2456 | if (SUCCEEDED(rc))
|
---|
2457 | CHECK_ERROR(machine, COMSETTER(AutostopType)(enmAutostopType));
|
---|
2458 | break;
|
---|
2459 | }
|
---|
2460 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
2461 | case MODIFYVM_ATTACH_PCI:
|
---|
2462 | {
|
---|
2463 | const char* pAt = strchr(ValueUnion.psz, '@');
|
---|
2464 | int32_t iHostAddr, iGuestAddr;
|
---|
2465 |
|
---|
2466 | iHostAddr = parsePci(ValueUnion.psz);
|
---|
2467 | iGuestAddr = pAt != NULL ? parsePci(pAt + 1) : iHostAddr;
|
---|
2468 |
|
---|
2469 | if (iHostAddr == -1 || iGuestAddr == -1)
|
---|
2470 | {
|
---|
2471 | errorArgument("Invalid --pciattach argument '%s' (valid: 'HB:HD.HF@GB:GD.GF' or just 'HB:HD.HF')", ValueUnion.psz);
|
---|
2472 | rc = E_FAIL;
|
---|
2473 | }
|
---|
2474 | else
|
---|
2475 | {
|
---|
2476 | CHECK_ERROR(machine, AttachHostPCIDevice(iHostAddr, iGuestAddr, TRUE));
|
---|
2477 | }
|
---|
2478 |
|
---|
2479 | break;
|
---|
2480 | }
|
---|
2481 | case MODIFYVM_DETACH_PCI:
|
---|
2482 | {
|
---|
2483 | int32_t iHostAddr;
|
---|
2484 |
|
---|
2485 | iHostAddr = parsePci(ValueUnion.psz);
|
---|
2486 | if (iHostAddr == -1)
|
---|
2487 | {
|
---|
2488 | errorArgument("Invalid --pcidetach argument '%s' (valid: 'HB:HD.HF')", ValueUnion.psz);
|
---|
2489 | rc = E_FAIL;
|
---|
2490 | }
|
---|
2491 | else
|
---|
2492 | {
|
---|
2493 | CHECK_ERROR(machine, DetachHostPCIDevice(iHostAddr));
|
---|
2494 | }
|
---|
2495 |
|
---|
2496 | break;
|
---|
2497 | }
|
---|
2498 | #endif
|
---|
2499 |
|
---|
2500 | #ifdef VBOX_WITH_USB_VIDEO
|
---|
2501 | case MODIFYVM_USBWEBCAM:
|
---|
2502 | {
|
---|
2503 | CHECK_ERROR(machine, COMSETTER(EmulatedUSBWebcameraEnabled)(ValueUnion.f));
|
---|
2504 | break;
|
---|
2505 | }
|
---|
2506 | #endif /* VBOX_WITH_USB_VIDEO */
|
---|
2507 |
|
---|
2508 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
2509 | case MODIFYVM_USBCARDREADER:
|
---|
2510 | {
|
---|
2511 | CHECK_ERROR(machine, COMSETTER(EmulatedUSBCardReaderEnabled)(ValueUnion.f));
|
---|
2512 | break;
|
---|
2513 | }
|
---|
2514 | #endif /* VBOX_WITH_USB_CARDREADER */
|
---|
2515 |
|
---|
2516 | default:
|
---|
2517 | {
|
---|
2518 | errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
|
---|
2519 | rc = E_FAIL;
|
---|
2520 | break;
|
---|
2521 | }
|
---|
2522 | }
|
---|
2523 | }
|
---|
2524 |
|
---|
2525 | /* commit changes */
|
---|
2526 | if (SUCCEEDED(rc))
|
---|
2527 | CHECK_ERROR(machine, SaveSettings());
|
---|
2528 |
|
---|
2529 | /* it's important to always close sessions */
|
---|
2530 | a->session->UnlockMachine();
|
---|
2531 |
|
---|
2532 | return SUCCEEDED(rc) ? 0 : 1;
|
---|
2533 | }
|
---|
2534 |
|
---|
2535 | #endif /* !VBOX_ONLY_DOCS */
|
---|