1 | /* $Id: VBoxManageModifyVM.cpp 106384 2024-10-16 13:58:41Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - Implementation of modifyvm command.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #include <VBox/com/com.h>
|
---|
33 | #include <VBox/com/array.h>
|
---|
34 | #include <VBox/com/ErrorInfo.h>
|
---|
35 | #include <VBox/com/errorprint.h>
|
---|
36 | #include <VBox/com/VirtualBox.h>
|
---|
37 |
|
---|
38 | #include <iprt/cidr.h>
|
---|
39 | #include <iprt/ctype.h>
|
---|
40 | #include <iprt/file.h>
|
---|
41 | #include <iprt/param.h>
|
---|
42 | #include <iprt/path.h>
|
---|
43 | #include <iprt/stream.h>
|
---|
44 | #include <iprt/string.h>
|
---|
45 | #include <iprt/getopt.h>
|
---|
46 | #include <VBox/log.h>
|
---|
47 | #include "VBoxManage.h"
|
---|
48 | #include "VBoxManageUtils.h"
|
---|
49 |
|
---|
50 | DECLARE_TRANSLATION_CONTEXT(ModifyVM);
|
---|
51 |
|
---|
52 | using namespace com;
|
---|
53 | /** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
|
---|
54 | #if defined(_MSC_VER)
|
---|
55 | # pragma optimize("g", off)
|
---|
56 | # if _MSC_VER < RT_MSC_VER_VC120
|
---|
57 | # pragma warning(disable:4748)
|
---|
58 | # endif
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | enum
|
---|
62 | {
|
---|
63 | MODIFYVM_NAME = 1000,
|
---|
64 | MODIFYVM_GROUPS,
|
---|
65 | MODIFYVM_DESCRIPTION,
|
---|
66 | MODIFYVM_OSTYPE,
|
---|
67 | MODIFYVM_ICONFILE,
|
---|
68 | MODIFYVM_MEMORY,
|
---|
69 | MODIFYVM_PAGEFUSION,
|
---|
70 | MODIFYVM_VRAM,
|
---|
71 | MODIFYVM_FIRMWARE,
|
---|
72 | MODIFYVM_ACPI,
|
---|
73 | MODIFYVM_IOAPIC,
|
---|
74 | MODIFYVM_CPUID_PORTABILITY,
|
---|
75 | MODIFYVM_PARAVIRTPROVIDER,
|
---|
76 | MODIFYVM_PARAVIRTDEBUG,
|
---|
77 | MODIFYVM_CPUS,
|
---|
78 | MODIFYVM_CPUHOTPLUG,
|
---|
79 | MODIFYVM_CPU_PROFILE,
|
---|
80 | MODIFYVM_PLUGCPU,
|
---|
81 | MODIFYVM_UNPLUGCPU,
|
---|
82 | MODIFYVM_GRAPHICSCONTROLLER,
|
---|
83 | MODIFYVM_MONITORCOUNT,
|
---|
84 | MODIFYVM_ACCELERATE3D,
|
---|
85 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
86 | MODIFYVM_ACCELERATE2DVIDEO,
|
---|
87 | #endif
|
---|
88 | /*
|
---|
89 | * Firmware-specific stuff.
|
---|
90 | */
|
---|
91 | MODIFYVM_FWLOGOFADEIN,
|
---|
92 | MODIFYVM_FWLOGOFADEOUT,
|
---|
93 | MODIFYVM_FWLOGODISPLAYTIME,
|
---|
94 | MODIFYVM_FWLOGOIMAGEPATH,
|
---|
95 | MODIFYVM_FWBOOTMENU,
|
---|
96 | MODIFYVM_FWAPIC,
|
---|
97 | MODIFYVM_FWSYSTEMTIMEOFFSET,
|
---|
98 | MODIFYVM_FWPXEDEBUG,
|
---|
99 | MODIFYVM_SYSTEMUUIDLE,
|
---|
100 | MODIFYVM_FWAUTOSERIALNUMGEN,
|
---|
101 | MODIFYVM_BOOT,
|
---|
102 | MODIFYVM_HDA, // deprecated
|
---|
103 | MODIFYVM_HDB, // deprecated
|
---|
104 | MODIFYVM_HDD, // deprecated
|
---|
105 | MODIFYVM_IDECONTROLLER, // deprecated
|
---|
106 | MODIFYVM_SATAPORTCOUNT, // deprecated
|
---|
107 | MODIFYVM_SATAPORT, // deprecated
|
---|
108 | MODIFYVM_SATA, // deprecated
|
---|
109 | MODIFYVM_SCSIPORT, // deprecated
|
---|
110 | MODIFYVM_SCSITYPE, // deprecated
|
---|
111 | MODIFYVM_SCSI, // deprecated
|
---|
112 | MODIFYVM_DVDPASSTHROUGH, // deprecated
|
---|
113 | MODIFYVM_DVD, // deprecated
|
---|
114 | MODIFYVM_FLOPPY, // deprecated
|
---|
115 | MODIFYVM_NICTRACEFILE,
|
---|
116 | MODIFYVM_NICTRACE,
|
---|
117 | MODIFYVM_NICPROPERTY,
|
---|
118 | MODIFYVM_NICTYPE,
|
---|
119 | MODIFYVM_NICSPEED,
|
---|
120 | MODIFYVM_NICBOOTPRIO,
|
---|
121 | MODIFYVM_NICPROMISC,
|
---|
122 | MODIFYVM_NICBWGROUP,
|
---|
123 | MODIFYVM_NIC,
|
---|
124 | MODIFYVM_CABLECONNECTED,
|
---|
125 | MODIFYVM_BRIDGEADAPTER,
|
---|
126 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
127 | MODIFYVM_CLOUDNET,
|
---|
128 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
129 | MODIFYVM_HOSTONLYADAPTER,
|
---|
130 | #ifdef VBOX_WITH_VMNET
|
---|
131 | MODIFYVM_HOSTONLYNET,
|
---|
132 | #endif /* VBOX_WITH_VMNET */
|
---|
133 | MODIFYVM_INTNET,
|
---|
134 | MODIFYVM_GENERICDRV,
|
---|
135 | MODIFYVM_NATNETWORKNAME,
|
---|
136 | MODIFYVM_NATNET,
|
---|
137 | MODIFYVM_NATBINDIP,
|
---|
138 | MODIFYVM_NATSETTINGS,
|
---|
139 | MODIFYVM_NATPF,
|
---|
140 | MODIFYVM_NATALIASMODE,
|
---|
141 | MODIFYVM_NATTFTPPREFIX,
|
---|
142 | MODIFYVM_NATTFTPFILE,
|
---|
143 | MODIFYVM_NATTFTPSERVER,
|
---|
144 | MODIFYVM_NATDNSPASSDOMAIN,
|
---|
145 | MODIFYVM_NATDNSPROXY,
|
---|
146 | MODIFYVM_NATDNSHOSTRESOLVER,
|
---|
147 | MODIFYVM_NATLOCALHOSTREACHABLE,
|
---|
148 | MODIFYVM_MACADDRESS,
|
---|
149 | MODIFYVM_HIDPTR,
|
---|
150 | MODIFYVM_HIDKBD,
|
---|
151 | MODIFYVM_UARTMODE,
|
---|
152 | MODIFYVM_UARTTYPE,
|
---|
153 | MODIFYVM_UART,
|
---|
154 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
155 | MODIFYVM_LPTMODE,
|
---|
156 | MODIFYVM_LPT,
|
---|
157 | #endif
|
---|
158 | MODIFYVM_GUESTMEMORYBALLOON,
|
---|
159 | MODIFYVM_AUDIOCONTROLLER,
|
---|
160 | MODIFYVM_AUDIOCODEC,
|
---|
161 | MODIFYVM_AUDIODRIVER,
|
---|
162 | MODIFYVM_AUDIOENABLED,
|
---|
163 | MODIFYVM_AUDIO, /* Deprecated; remove in the next major version. */
|
---|
164 | MODIFYVM_AUDIOIN,
|
---|
165 | MODIFYVM_AUDIOOUT,
|
---|
166 | #ifdef VBOX_WITH_SHARED_CLIPBOARD
|
---|
167 | MODIFYVM_CLIPBOARD_MODE,
|
---|
168 | # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
|
---|
169 | MODIFYVM_CLIPBOARD_FILE_TRANSFERS,
|
---|
170 | # endif
|
---|
171 | #endif
|
---|
172 | MODIFYVM_DRAGANDDROP,
|
---|
173 | MODIFYVM_VRDPPORT, /* VRDE: deprecated */
|
---|
174 | MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
|
---|
175 | MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
|
---|
176 | MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
|
---|
177 | MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
|
---|
178 | MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
|
---|
179 | MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
|
---|
180 | MODIFYVM_VRDP, /* VRDE: deprecated */
|
---|
181 | MODIFYVM_VRDEPROPERTY,
|
---|
182 | MODIFYVM_VRDEPORT,
|
---|
183 | MODIFYVM_VRDEADDRESS,
|
---|
184 | MODIFYVM_VRDEAUTHTYPE,
|
---|
185 | MODIFYVM_VRDEAUTHLIBRARY,
|
---|
186 | MODIFYVM_VRDEMULTICON,
|
---|
187 | MODIFYVM_VRDEREUSECON,
|
---|
188 | MODIFYVM_VRDEVIDEOCHANNEL,
|
---|
189 | MODIFYVM_VRDEVIDEOCHANNELQUALITY,
|
---|
190 | MODIFYVM_VRDE_EXTPACK,
|
---|
191 | MODIFYVM_VRDE,
|
---|
192 | MODIFYVM_RTCUSEUTC,
|
---|
193 | MODIFYVM_USBRENAME,
|
---|
194 | MODIFYVM_USBXHCI,
|
---|
195 | MODIFYVM_USBEHCI,
|
---|
196 | MODIFYVM_USBOHCI,
|
---|
197 | MODIFYVM_SNAPSHOTFOLDER,
|
---|
198 | MODIFYVM_TELEPORTER_ENABLED,
|
---|
199 | MODIFYVM_TELEPORTER_PORT,
|
---|
200 | MODIFYVM_TELEPORTER_ADDRESS,
|
---|
201 | MODIFYVM_TELEPORTER_PASSWORD,
|
---|
202 | MODIFYVM_TELEPORTER_PASSWORD_FILE,
|
---|
203 | MODIFYVM_TRACING_ENABLED,
|
---|
204 | MODIFYVM_TRACING_CONFIG,
|
---|
205 | MODIFYVM_TRACING_ALLOW_VM_ACCESS,
|
---|
206 | MODIFYVM_HARDWARE_UUID,
|
---|
207 | MODIFYVM_IOCACHE,
|
---|
208 | MODIFYVM_IOCACHESIZE,
|
---|
209 | MODIFYVM_CPU_EXECTUION_CAP,
|
---|
210 | MODIFYVM_AUTOSTART_ENABLED,
|
---|
211 | MODIFYVM_AUTOSTART_DELAY,
|
---|
212 | MODIFYVM_AUTOSTOP_TYPE,
|
---|
213 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
214 | MODIFYVM_ATTACH_PCI,
|
---|
215 | MODIFYVM_DETACH_PCI,
|
---|
216 | #endif
|
---|
217 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
218 | MODIFYVM_USBCARDREADER,
|
---|
219 | #endif
|
---|
220 | #ifdef VBOX_WITH_RECORDING
|
---|
221 | MODIFYVM_RECORDING,
|
---|
222 | MODIFYVM_RECORDING_FEATURES,
|
---|
223 | MODIFYVM_RECORDING_SCREENS,
|
---|
224 | MODIFYVM_RECORDING_FILENAME,
|
---|
225 | MODIFYVM_RECORDING_VIDEO_WIDTH,
|
---|
226 | MODIFYVM_RECORDING_VIDEO_HEIGHT,
|
---|
227 | MODIFYVM_RECORDING_VIDEO_RES,
|
---|
228 | MODIFYVM_RECORDING_VIDEO_RATE,
|
---|
229 | MODIFYVM_RECORDING_VIDEO_FPS,
|
---|
230 | MODIFYVM_RECORDING_MAXTIME,
|
---|
231 | MODIFYVM_RECORDING_MAXSIZE,
|
---|
232 | MODIFYVM_RECORDING_OPTIONS,
|
---|
233 | #endif
|
---|
234 | MODIFYVM_CHIPSET,
|
---|
235 | #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL)
|
---|
236 | MODIFYVM_IOMMU,
|
---|
237 | #endif
|
---|
238 | #if defined(VBOX_WITH_TPM)
|
---|
239 | MODIFYVM_TPM_LOCATION,
|
---|
240 | MODIFYVM_TPM_TYPE,
|
---|
241 | #endif
|
---|
242 | MODIFYVM_DEFAULTFRONTEND,
|
---|
243 | MODIFYVM_VMPROC_PRIORITY,
|
---|
244 | MODIFYVM_VMEXEC_ENGINE,
|
---|
245 | MODIFYVM_TESTING_ENABLED,
|
---|
246 | MODIFYVM_TESTING_MMIO,
|
---|
247 | MODIFYVM_TESTING_CFG_DWORD,
|
---|
248 | MODIFYVM_GUEST_DEBUG_PROVIDER,
|
---|
249 | MODIFYVM_GUEST_DEBUG_IO_PROVIDER,
|
---|
250 | MODIFYVM_GUEST_DEBUG_ADDRESS,
|
---|
251 | MODIFYVM_GUEST_DEBUG_PORT,
|
---|
252 |
|
---|
253 | /*
|
---|
254 | * Stuff common between x86 and ARM.
|
---|
255 | */
|
---|
256 | MODIFYVM_NESTED_HW_VIRT,
|
---|
257 |
|
---|
258 | /*
|
---|
259 | * x86-specific stuff.
|
---|
260 | */
|
---|
261 | MODIFYVM_X86_APIC,
|
---|
262 | MODIFYVM_X86_DELCPUID,
|
---|
263 | MODIFYVM_X86_DELCPUID_OLD, // legacy, different syntax from MODIFYVM_DELCPUID
|
---|
264 | MODIFYVM_X86_DELALLCPUID,
|
---|
265 | MODIFYVM_X86_HPET,
|
---|
266 | MODIFYVM_X86_HWVIRTEX,
|
---|
267 | MODIFYVM_X86_IBPB_ON_VM_ENTRY,
|
---|
268 | MODIFYVM_X86_IBPB_ON_VM_EXIT,
|
---|
269 | MODIFYVM_X86_L1D_FLUSH_ON_SCHED,
|
---|
270 | MODIFYVM_X86_L1D_FLUSH_ON_VM_ENTRY,
|
---|
271 | MODIFYVM_X86_LARGEPAGES,
|
---|
272 | MODIFYVM_X86_LONGMODE,
|
---|
273 | MODIFYVM_X86_MDS_CLEAR_ON_SCHED,
|
---|
274 | MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY,
|
---|
275 | MODIFYVM_X86_NESTEDPAGING,
|
---|
276 | MODIFYVM_X86_PAE,
|
---|
277 | MODIFYVM_X86_SETCPUID,
|
---|
278 | MODIFYVM_X86_SPEC_CTRL,
|
---|
279 | MODIFYVM_X86_TFRESET,
|
---|
280 | MODIFYVM_X86_VIRT_VMSAVE_VMLOAD,
|
---|
281 | MODIFYVM_X86_VTXUX,
|
---|
282 | MODIFYVM_X86_VTXVPID,
|
---|
283 | MODIFYVM_X86_X2APIC
|
---|
284 | };
|
---|
285 |
|
---|
286 | static const RTGETOPTDEF g_aModifyVMOptions[] =
|
---|
287 | {
|
---|
288 | OPT1("--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING),
|
---|
289 | OPT1("--groups", MODIFYVM_GROUPS, RTGETOPT_REQ_STRING),
|
---|
290 | OPT1("--description", MODIFYVM_DESCRIPTION, RTGETOPT_REQ_STRING),
|
---|
291 | OPT2("--os-type", "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING),
|
---|
292 | OPT2("--icon-file", "--iconfile", MODIFYVM_ICONFILE, RTGETOPT_REQ_STRING),
|
---|
293 | OPT1("--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32),
|
---|
294 | OPT2("--page-fusion", "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
295 | OPT1("--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32),
|
---|
296 | OPT1("--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING),
|
---|
297 | OPT1("--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
298 | OPT1("--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
299 | OPT1("--cpuid-portability-level", MODIFYVM_CPUID_PORTABILITY, RTGETOPT_REQ_UINT32),
|
---|
300 | OPT2("--paravirt-provider", "--paravirtprovider", MODIFYVM_PARAVIRTPROVIDER, RTGETOPT_REQ_STRING),
|
---|
301 | OPT2("--paravirt-debug", "--paravirtdebug", MODIFYVM_PARAVIRTDEBUG, RTGETOPT_REQ_STRING),
|
---|
302 | OPT1("--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32),
|
---|
303 | OPT2("--cpu-hotplug", "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
304 | OPT1("--cpu-profile", MODIFYVM_CPU_PROFILE, RTGETOPT_REQ_STRING),
|
---|
305 | OPT2("--plug-cpu", "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32),
|
---|
306 | OPT2("--unplug-cpu", "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32),
|
---|
307 | OPT2("--cpu-execution-cap", "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32),
|
---|
308 | OPT2("--rtc-use-utc", "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
309 | OPT2("--graphicscontroller", "--graphicscontroller", MODIFYVM_GRAPHICSCONTROLLER, RTGETOPT_REQ_STRING),
|
---|
310 | OPT2("--monitor-count", "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32),
|
---|
311 | OPT2("--accelerate-3d", "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
312 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
313 | OPT2("--accelerate-2d-video", "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
314 | #endif
|
---|
315 | OPT1("--firmware-logo-fade-in", MODIFYVM_FWLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
316 | OPT1("--firmware-logo-fade-out", MODIFYVM_FWLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
317 | OPT1("--firmware-logo-image-path", MODIFYVM_FWLOGOIMAGEPATH, RTGETOPT_REQ_STRING),
|
---|
318 | OPT1("--firmware-logo-display-time", MODIFYVM_FWLOGODISPLAYTIME, RTGETOPT_REQ_UINT32),
|
---|
319 | OPT1("--firmware-boot-menu", MODIFYVM_FWBOOTMENU, RTGETOPT_REQ_STRING),
|
---|
320 | OPT1("--firmware-system-time-offset", MODIFYVM_FWSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64),
|
---|
321 | OPT1("--firmware-apic", MODIFYVM_FWAPIC, RTGETOPT_REQ_STRING),
|
---|
322 | OPT1("--firmware-pxe-debug", MODIFYVM_FWPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
323 | /* { Kept for backwards-compatibility */
|
---|
324 | OPT2("--bios-logo-fade-in", "--bioslogofadein", MODIFYVM_FWLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
325 | OPT1("--firmware-fade-out", MODIFYVM_FWLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
326 | OPT2("--bios-logo-fade-out", "--bioslogofadeout", MODIFYVM_FWLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
327 | OPT2("--bios-logo-display-time", "--bioslogodisplaytime", MODIFYVM_FWLOGODISPLAYTIME, RTGETOPT_REQ_UINT32),
|
---|
328 | OPT2("--bios-logo-image-path", "--bioslogoimagepath", MODIFYVM_FWLOGOIMAGEPATH, RTGETOPT_REQ_STRING),
|
---|
329 | OPT2("--bios-boot-menu", "--biosbootmenu", MODIFYVM_FWBOOTMENU, RTGETOPT_REQ_STRING),
|
---|
330 | OPT2("--bios-system-time-offset", "--biossystemtimeoffset", MODIFYVM_FWSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64),
|
---|
331 | OPT2("--bios-apic", "--biosapic", MODIFYVM_FWAPIC, RTGETOPT_REQ_STRING),
|
---|
332 | OPT2("--bios-pxe-debug", "--biospxedebug", MODIFYVM_FWPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
333 | /* } */
|
---|
334 | OPT2("--system-uuid-le", "--system-uuid-le", MODIFYVM_SYSTEMUUIDLE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
335 | OPT2("--bios-auto-serial-num-gen", "--biosautoserialnumgen", MODIFYVM_FWAUTOSERIALNUMGEN, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
336 | OPT1("--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
337 | OPT1("--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
338 | OPT1("--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
339 | OPT1("--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
340 | OPT2("--idec-ontroller", "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
341 | OPT2("--sata-port-count", "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32), /* deprecated */
|
---|
342 | OPT2("--sata-port", "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX), /* deprecated */
|
---|
343 | OPT1("--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
344 | OPT2("--scsi-port", "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX), /* deprecated */
|
---|
345 | OPT2("--scsi-type", "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
346 | OPT1("--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
347 | OPT2("--dvd-pass-through", "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
348 | OPT1("--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
349 | OPT1("--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
350 | OPT2("--nic-trace-file", "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
351 | OPT2("--nic-trace", "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
352 | OPT2("--nic-property", "--nicproperty", MODIFYVM_NICPROPERTY, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
353 | OPT2("--nic-type", "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
354 | OPT2("--nic-speed", "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX),
|
---|
355 | OPT2("--nic-boot-prio", "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX),
|
---|
356 | OPT2("--nic-promisc", "--nicpromisc", MODIFYVM_NICPROMISC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
357 | OPT2("--nic-bandwidth-group", "--nicbandwidthgroup", MODIFYVM_NICBWGROUP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
358 | OPT1("--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
359 | OPT2("--cable-connected", "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
360 | OPT2("--bridge-adapter", "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
361 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
362 | OPT2("--cloud-network", "--cloudnetwork", MODIFYVM_CLOUDNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
363 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
364 | OPT2("--host-only-adapter", "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
365 | #ifdef VBOX_WITH_VMNET
|
---|
366 | OPT2("--host-only-net", "--hostonlynet", MODIFYVM_HOSTONLYNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
367 | #endif
|
---|
368 | OPT1("--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
369 | OPT2("--nic-generic-drv", "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
370 | OPT2("--nat-network", "--natnetwork", MODIFYVM_NATNETWORKNAME, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
371 | OPT2("--nat-net", "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
372 | OPT2("--nat-bind-ip", "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
373 | OPT2("--nat-settings", "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
374 | OPT2("--nat-pf", "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
375 | OPT2("--nat-alias-mode", "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
376 | OPT2("--nat-tftp-prefix", "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
377 | OPT2("--nat-tftp-file", "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
378 | OPT2("--nat-tftp-server", "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
379 | OPT2("--nat-dns-pass-domain", "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
380 | OPT2("--nat-dns-proxy", "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
381 | OPT2("--nat-dns-host-resolver", "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
382 | OPT2("--nat-localhostreachable", "--natlocalhostreachable", MODIFYVM_NATLOCALHOSTREACHABLE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX),
|
---|
383 | OPT2("--mac-address", "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
384 | OPT1("--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING),
|
---|
385 | OPT1("--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING),
|
---|
386 | OPT2("--uart-mode", "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
387 | OPT2("--uart-type", "--uarttype", MODIFYVM_UARTTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
388 | OPT1("--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
389 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
390 | OPT2("--lpt-mode", "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
391 | OPT1("--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX),
|
---|
392 | #endif
|
---|
393 | OPT2("--guest-memory-balloon", "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32),
|
---|
394 | OPT2("--audio-controller", "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING),
|
---|
395 | OPT2("--audio-codec", "--audiocodec", MODIFYVM_AUDIOCODEC, RTGETOPT_REQ_STRING),
|
---|
396 | OPT1("--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING),
|
---|
397 | OPT2("--audio-driver", "--audiodriver", MODIFYVM_AUDIODRIVER, RTGETOPT_REQ_STRING),
|
---|
398 | OPT2("--audio-enabled", "--audioenabled", MODIFYVM_AUDIOENABLED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
399 | OPT2("--audio-in", "--audioin", MODIFYVM_AUDIOIN, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
400 | OPT2("--audio-out", "--audioout", MODIFYVM_AUDIOOUT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
401 | #ifdef VBOX_WITH_SHARED_CLIPBOARD
|
---|
402 | OPT1("--clipboard-mode", MODIFYVM_CLIPBOARD_MODE, RTGETOPT_REQ_STRING),
|
---|
403 | OPT1("--clipboard", MODIFYVM_CLIPBOARD_MODE, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
404 | # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
|
---|
405 | OPT1("--clipboard-file-transfers", MODIFYVM_CLIPBOARD_FILE_TRANSFERS, RTGETOPT_REQ_STRING),
|
---|
406 | # endif
|
---|
407 | #endif
|
---|
408 | OPT2("--drag-and-drop", "--draganddrop", MODIFYVM_DRAGANDDROP, RTGETOPT_REQ_STRING),
|
---|
409 | OPT2("--vrdp-port", "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
410 | OPT2("--vrdp-address", "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
411 | OPT2("--vrdp-auth-type", "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
412 | OPT2("--vrdp-multi-con", "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
413 | OPT2("--vrdp-reuse-con", "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
414 | OPT2("--vrdp-video-channel", "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
415 | OPT2("--vrdp-video-channel-quality", "--vrdpvideochannelquality",MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING), /* deprecated */
|
---|
416 | OPT1("--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
417 | OPT2("--vrde-property", "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING),
|
---|
418 | OPT2("--vrde-port", "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING),
|
---|
419 | OPT2("--vrde-address", "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING),
|
---|
420 | OPT2("--vrde-auth-type", "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING),
|
---|
421 | OPT2("--vrde-auth-library", "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING),
|
---|
422 | OPT2("--vrde-multi-con", "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
423 | OPT2("--vrde-reuse-con", "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
424 | OPT2("--vrde-video-channel", "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
425 | OPT2("--vrde-video-channel-quality", "--vrdevideochannelquality",MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING),
|
---|
426 | OPT2("--vrde-extpack", "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING),
|
---|
427 | OPT1("--vrde", MODIFYVM_VRDE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
428 | OPT2("--usb-rename", "--usbrename", MODIFYVM_USBRENAME, RTGETOPT_REQ_STRING),
|
---|
429 | OPT2("--usb-xhci", "--usbxhci", MODIFYVM_USBXHCI, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
430 | OPT2("--usb-ehci", "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
431 | OPT2("--usb-ohci", "--usbohci", MODIFYVM_USBOHCI, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
432 | OPT1("--usb", MODIFYVM_USBOHCI, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
433 | OPT2("--snapshot-folder", "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING),
|
---|
434 | OPT1("--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
435 | OPT2("--teleporter-enabled", "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF), /* deprecated */
|
---|
436 | OPT2("--teleporter-port", "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32),
|
---|
437 | OPT2("--teleporter-address", "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING),
|
---|
438 | OPT2("--teleporter-password", "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING),
|
---|
439 | OPT2("--teleporter-password-file", "--teleporterpasswordfile", MODIFYVM_TELEPORTER_PASSWORD_FILE, RTGETOPT_REQ_STRING),
|
---|
440 | OPT1("--tracing-enabled", MODIFYVM_TRACING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
441 | OPT1("--tracing-config", MODIFYVM_TRACING_CONFIG, RTGETOPT_REQ_STRING),
|
---|
442 | OPT1("--tracing-allow-vm-access", MODIFYVM_TRACING_ALLOW_VM_ACCESS, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
443 | OPT2("--hardware-uuid", "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING),
|
---|
444 | OPT1("--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
445 | OPT2("--iocache-size", "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32),
|
---|
446 | OPT1("--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING),
|
---|
447 | #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL)
|
---|
448 | OPT1("--iommu", MODIFYVM_IOMMU, RTGETOPT_REQ_STRING),
|
---|
449 | #endif
|
---|
450 | #if defined(VBOX_WITH_TPM)
|
---|
451 | OPT1("--tpm-type", MODIFYVM_TPM_TYPE, RTGETOPT_REQ_STRING),
|
---|
452 | OPT1("--tpm-location", MODIFYVM_TPM_LOCATION, RTGETOPT_REQ_STRING),
|
---|
453 | #endif
|
---|
454 | #ifdef VBOX_WITH_RECORDING
|
---|
455 | OPT1("--recording", MODIFYVM_RECORDING, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
456 | OPT2("--recording-screens", "--recordingscreens", MODIFYVM_RECORDING_SCREENS, RTGETOPT_REQ_STRING),
|
---|
457 | OPT2("--recording-file", "--recordingfile", MODIFYVM_RECORDING_FILENAME, RTGETOPT_REQ_STRING),
|
---|
458 | OPT2("--recording-max-time", "--recordingmaxtime", MODIFYVM_RECORDING_MAXTIME, RTGETOPT_REQ_INT32),
|
---|
459 | OPT2("--recording-max-size", "--recordingmaxsize", MODIFYVM_RECORDING_MAXSIZE, RTGETOPT_REQ_INT32),
|
---|
460 | OPT2("--recording-opts", "--recordingopts", MODIFYVM_RECORDING_OPTIONS, RTGETOPT_REQ_STRING),
|
---|
461 | OPT2("--recording-options", "--recordingoptions", MODIFYVM_RECORDING_OPTIONS, RTGETOPT_REQ_STRING),
|
---|
462 | OPT2("--recording-video-res", "--recordingvideores", MODIFYVM_RECORDING_VIDEO_RES, RTGETOPT_REQ_STRING),
|
---|
463 | OPT2("--recording-video-resolution", "--recordingvideoresolution",MODIFYVM_RECORDING_VIDEO_RES, RTGETOPT_REQ_STRING),
|
---|
464 | OPT2("--recording-video-rate", "--recordingvideorate", MODIFYVM_RECORDING_VIDEO_RATE, RTGETOPT_REQ_UINT32),
|
---|
465 | OPT2("--recording-video-fps", "--recordingvideofps", MODIFYVM_RECORDING_VIDEO_FPS, RTGETOPT_REQ_UINT32),
|
---|
466 | #endif
|
---|
467 | OPT1("--autostart-enabled", MODIFYVM_AUTOSTART_ENABLED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
468 | OPT1("--autostart-delay", MODIFYVM_AUTOSTART_DELAY, RTGETOPT_REQ_UINT32),
|
---|
469 | OPT1("--autostop-type", MODIFYVM_AUTOSTOP_TYPE, RTGETOPT_REQ_STRING),
|
---|
470 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
471 | OPT2("--pci-attach", "--pciattach", MODIFYVM_ATTACH_PCI, RTGETOPT_REQ_STRING),
|
---|
472 | OPT2("--pci-detach", "--pcidetach", MODIFYVM_DETACH_PCI, RTGETOPT_REQ_STRING),
|
---|
473 | #endif
|
---|
474 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
475 | OPT2("--usb-card-reader", "--usbcardreader", MODIFYVM_USBCARDREADER, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
476 | #endif
|
---|
477 | OPT2("--default-frontend", "--defaultfrontend", MODIFYVM_DEFAULTFRONTEND, RTGETOPT_REQ_STRING),
|
---|
478 | OPT1("--vm-process-priority", MODIFYVM_VMPROC_PRIORITY, RTGETOPT_REQ_STRING),
|
---|
479 | OPT1("--vm-execution-engine", MODIFYVM_VMEXEC_ENGINE, RTGETOPT_REQ_STRING),
|
---|
480 | OPT1("--testing-enabled", MODIFYVM_TESTING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
481 | OPT1("--testing-mmio", MODIFYVM_TESTING_MMIO, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
482 | OPT1("--testing-cfg-dword", MODIFYVM_TESTING_CFG_DWORD, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX),
|
---|
483 | OPT1("--guest-debug-provider", MODIFYVM_GUEST_DEBUG_PROVIDER, RTGETOPT_REQ_STRING),
|
---|
484 | OPT1("--guest-debug-io-provider", MODIFYVM_GUEST_DEBUG_IO_PROVIDER, RTGETOPT_REQ_STRING),
|
---|
485 | OPT1("--guest-debug-address", MODIFYVM_GUEST_DEBUG_ADDRESS, RTGETOPT_REQ_STRING),
|
---|
486 | OPT1("--guest-debug-port", MODIFYVM_GUEST_DEBUG_PORT, RTGETOPT_REQ_UINT32),
|
---|
487 |
|
---|
488 | /*
|
---|
489 | * x86-only stuff.
|
---|
490 | *
|
---|
491 | * Note: The non-prefixed options (e.g. "hpet" vs. "x86-hpet") are being kept
|
---|
492 | * to maintain backwards compatibility, at least for a while. Remove them before going on pension.
|
---|
493 | *
|
---|
494 | * Sorted after their MODIFYVM_X86_XXX values.
|
---|
495 | */
|
---|
496 | OPT1("--x86-apic", MODIFYVM_X86_APIC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
497 | OPT1("--apic", MODIFYVM_X86_APIC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
498 | OPT1("--x86-cpuid-remove", MODIFYVM_X86_DELCPUID, RTGETOPT_REQ_UINT32_OPTIONAL_PAIR | RTGETOPT_FLAG_HEX),
|
---|
499 | OPT1("--cpuid-remove", MODIFYVM_X86_DELCPUID, RTGETOPT_REQ_UINT32_OPTIONAL_PAIR | RTGETOPT_FLAG_HEX),
|
---|
500 | OPT1("--cpuidremove", MODIFYVM_X86_DELCPUID_OLD, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX), /* legacy - syntax differs */
|
---|
501 | OPT1("--x86-cpuid-remove-all", MODIFYVM_X86_DELALLCPUID, RTGETOPT_REQ_NOTHING),
|
---|
502 | OPT2("--cpuid-remove-all", "--cpuidremoveall", MODIFYVM_X86_DELALLCPUID, RTGETOPT_REQ_NOTHING),
|
---|
503 | OPT1("--x86-hpet", MODIFYVM_X86_HPET, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
504 | OPT1("--hpet", MODIFYVM_X86_HPET, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
505 | OPT1("--x86-hwvirtex", MODIFYVM_X86_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
506 | OPT1("--hwvirtex", MODIFYVM_X86_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
507 | OPT1("--x86-ibpb-on-vm-entry", MODIFYVM_X86_IBPB_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
508 | OPT1("--ibpb-on-vm-entry", MODIFYVM_X86_IBPB_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
509 | OPT1("--x86-ibpb-on-vm-exit", MODIFYVM_X86_IBPB_ON_VM_EXIT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
510 | OPT1("--ibpb-on-vm-exit", MODIFYVM_X86_IBPB_ON_VM_EXIT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
511 | OPT1("--x86-l1d-flush-on-sched", MODIFYVM_X86_L1D_FLUSH_ON_SCHED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
512 | OPT1("--l1d-flush-on-sched", MODIFYVM_X86_L1D_FLUSH_ON_SCHED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
513 | OPT1("--x86-l1d-flush-on-vm-entry", MODIFYVM_X86_L1D_FLUSH_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
514 | OPT1("--l1d-flush-on-vm-entry", MODIFYVM_X86_L1D_FLUSH_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
515 | OPT1("--x86-large-pages", MODIFYVM_X86_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
516 | OPT2("--large-pages", "--largepages", MODIFYVM_X86_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
517 | OPT1("--x86-long-mode", MODIFYVM_X86_LONGMODE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
518 | OPT2("--long-mode", "--longmode", MODIFYVM_X86_LONGMODE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
519 | OPT1("--x86-mds-clear-on-sched", MODIFYVM_X86_MDS_CLEAR_ON_SCHED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
520 | OPT1("--mds-clear-on-sched", MODIFYVM_X86_MDS_CLEAR_ON_SCHED, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
521 | OPT1("--x86-mds-clear-on-vm-entry", MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
522 | OPT1("--mds-clear-on-vm-entry", MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
523 | OPT1("--x86-nested-hw-virt", MODIFYVM_NESTED_HW_VIRT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
524 | OPT1("--nested-hw-virt", MODIFYVM_NESTED_HW_VIRT, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
525 | OPT1("--x86-nested-paging", MODIFYVM_X86_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
526 | OPT2("--nested-paging", "--nestedpaging", MODIFYVM_X86_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
527 | OPT1("--x86-pae", MODIFYVM_X86_PAE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
528 | OPT1("--pae", MODIFYVM_X86_PAE, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
529 | OPT1("--x86-cpuid-set", MODIFYVM_X86_SETCPUID, RTGETOPT_REQ_UINT32_OPTIONAL_PAIR | RTGETOPT_FLAG_HEX),
|
---|
530 | OPT2("--cpuid-set", "--cpuidset", MODIFYVM_X86_SETCPUID, RTGETOPT_REQ_UINT32_OPTIONAL_PAIR | RTGETOPT_FLAG_HEX),
|
---|
531 | OPT1("--x86-spec-ctrl", MODIFYVM_X86_SPEC_CTRL, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
532 | OPT1("--spec-ctrl", MODIFYVM_X86_SPEC_CTRL, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
533 | OPT1("--x86-triple-fault-reset", MODIFYVM_X86_TFRESET, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
534 | OPT2("--triple-fault-reset", "--triplefaultreset", MODIFYVM_X86_TFRESET, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
535 | OPT1("--virt-vmsave-vmload", MODIFYVM_X86_VIRT_VMSAVE_VMLOAD, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
536 | OPT1("--x86-virt-vmsave-vmload", MODIFYVM_X86_VIRT_VMSAVE_VMLOAD, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
537 | OPT1("--x86-vtx-ux", MODIFYVM_X86_VTXUX, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
538 | OPT2("--vtx-ux", "--vtxux", MODIFYVM_X86_VTXUX, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
539 | OPT1("--x86-vtx-vpid", MODIFYVM_X86_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
540 | OPT2("--vtx-vpid", "--vtxvpid", MODIFYVM_X86_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
541 | OPT1("--x86-x2apic", MODIFYVM_X86_X2APIC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
542 | OPT1("--x2apic", MODIFYVM_X86_X2APIC, RTGETOPT_REQ_BOOL_ONOFF),
|
---|
543 | };
|
---|
544 |
|
---|
545 | static void vrdeWarningDeprecatedOption(const char *pszOption)
|
---|
546 | {
|
---|
547 | RTStrmPrintf(g_pStdErr, ModifyVM::tr("Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n"), pszOption, pszOption);
|
---|
548 | }
|
---|
549 |
|
---|
550 |
|
---|
551 | /**
|
---|
552 | * Wrapper around IMachine::SetExtraData that does the error reporting.
|
---|
553 | *
|
---|
554 | * @returns COM result code.
|
---|
555 | * @param rSessionMachine The IMachine.
|
---|
556 | * @param pszVariable The variable to set.
|
---|
557 | * @param pszValue The value to set. To delete pass empty string, not
|
---|
558 | * NULL.
|
---|
559 | */
|
---|
560 | static HRESULT setExtraData(ComPtr<IMachine> &rSessionMachine, const char *pszVariable, const char *pszValue)
|
---|
561 | {
|
---|
562 | HRESULT hrc = rSessionMachine->SetExtraData(Bstr(pszVariable).raw(), Bstr(pszValue).raw());
|
---|
563 | if (FAILED(hrc))
|
---|
564 | {
|
---|
565 | char *pszContext = RTStrAPrintf2("IMachine::SetExtraData('%s', '%s')", pszVariable, pszValue);
|
---|
566 | com::GlueHandleComError(rSessionMachine, pszContext, hrc, __FILE__, __LINE__);
|
---|
567 | RTStrFree(pszContext);
|
---|
568 | }
|
---|
569 | return hrc;
|
---|
570 | }
|
---|
571 |
|
---|
572 |
|
---|
573 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
574 | /** Parse PCI address in format 01:02.03 and convert it to the numeric representation. */
|
---|
575 | static int32_t parsePci(const char* szPciAddr)
|
---|
576 | {
|
---|
577 | uint8_t aVals[3] = {0, 0, 0};
|
---|
578 |
|
---|
579 | char *pszNext;
|
---|
580 | int vrc = RTStrToUInt8Ex(pszNext, &pszNext, 16, &aVals[0]);
|
---|
581 | if (RT_FAILURE(vrc) || pszNext == NULL || *pszNext != ':')
|
---|
582 | return -1;
|
---|
583 |
|
---|
584 | vrc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[1]);
|
---|
585 | if (RT_FAILURE(vrc) || pszNext == NULL || *pszNext != '.')
|
---|
586 | return -1;
|
---|
587 |
|
---|
588 | vrc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[2]);
|
---|
589 | if (RT_FAILURE(vrc) || pszNext == NULL)
|
---|
590 | return -1;
|
---|
591 |
|
---|
592 | return (aVals[0] << 8) | (aVals[1] << 3) | (aVals[2] << 0);
|
---|
593 | }
|
---|
594 | #endif
|
---|
595 |
|
---|
596 | void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups)
|
---|
597 | {
|
---|
598 | while (pcszGroups)
|
---|
599 | {
|
---|
600 | char *pComma = RTStrStr(pcszGroups, ",");
|
---|
601 | if (pComma)
|
---|
602 | {
|
---|
603 | Bstr(pcszGroups, pComma - pcszGroups).detachTo(pGroups->appendedRaw());
|
---|
604 | pcszGroups = pComma + 1;
|
---|
605 | }
|
---|
606 | else
|
---|
607 | {
|
---|
608 | Bstr(pcszGroups).detachTo(pGroups->appendedRaw());
|
---|
609 | pcszGroups = NULL;
|
---|
610 | }
|
---|
611 | }
|
---|
612 | }
|
---|
613 |
|
---|
614 | #ifdef VBOX_WITH_RECORDING
|
---|
615 | int parseScreens(const char *pcszScreens, com::SafeArray<BOOL> *pScreens)
|
---|
616 | {
|
---|
617 | if (!RTStrICmp(pcszScreens, "all"))
|
---|
618 | {
|
---|
619 | for (uint32_t i = 0; i < pScreens->size(); i++)
|
---|
620 | (*pScreens)[i] = TRUE;
|
---|
621 | return VINF_SUCCESS;
|
---|
622 | }
|
---|
623 | if (!RTStrICmp(pcszScreens, "none"))
|
---|
624 | {
|
---|
625 | for (uint32_t i = 0; i < pScreens->size(); i++)
|
---|
626 | (*pScreens)[i] = FALSE;
|
---|
627 | return VINF_SUCCESS;
|
---|
628 | }
|
---|
629 | while (pcszScreens && *pcszScreens)
|
---|
630 | {
|
---|
631 | char *pszNext;
|
---|
632 | uint32_t iScreen;
|
---|
633 | int vrc = RTStrToUInt32Ex(pcszScreens, &pszNext, 0, &iScreen);
|
---|
634 | if (RT_FAILURE(vrc))
|
---|
635 | return VERR_PARSE_ERROR;
|
---|
636 | if (iScreen >= pScreens->size())
|
---|
637 | return VERR_PARSE_ERROR;
|
---|
638 | if (pszNext && *pszNext)
|
---|
639 | {
|
---|
640 | pszNext = RTStrStripL(pszNext);
|
---|
641 | if (*pszNext != ',')
|
---|
642 | return VERR_PARSE_ERROR;
|
---|
643 | pszNext++;
|
---|
644 | }
|
---|
645 | (*pScreens)[iScreen] = true;
|
---|
646 | pcszScreens = pszNext;
|
---|
647 | }
|
---|
648 | return VINF_SUCCESS;
|
---|
649 | }
|
---|
650 | #endif
|
---|
651 |
|
---|
652 | static int parseNum(uint32_t uIndex, unsigned cMaxIndex, const char *pszName)
|
---|
653 | {
|
---|
654 | if ( uIndex >= 1
|
---|
655 | && uIndex <= cMaxIndex)
|
---|
656 | return uIndex;
|
---|
657 | errorArgument(ModifyVM::tr("Invalid %s number %u"), pszName, uIndex);
|
---|
658 | return 0;
|
---|
659 | }
|
---|
660 |
|
---|
661 | VMProcPriority_T nameToVMProcPriority(const char *pszName)
|
---|
662 | {
|
---|
663 | if (!RTStrICmp(pszName, "default"))
|
---|
664 | return VMProcPriority_Default;
|
---|
665 | if (!RTStrICmp(pszName, "flat"))
|
---|
666 | return VMProcPriority_Flat;
|
---|
667 | if (!RTStrICmp(pszName, "low"))
|
---|
668 | return VMProcPriority_Low;
|
---|
669 | if (!RTStrICmp(pszName, "normal"))
|
---|
670 | return VMProcPriority_Normal;
|
---|
671 | if (!RTStrICmp(pszName, "high"))
|
---|
672 | return VMProcPriority_High;
|
---|
673 |
|
---|
674 | return VMProcPriority_Invalid;
|
---|
675 | }
|
---|
676 |
|
---|
677 | static VMExecutionEngine_T nameToVMExecEngine(const char *pszName)
|
---|
678 | {
|
---|
679 | if (!RTStrICmp(pszName, "default"))
|
---|
680 | return VMExecutionEngine_Default;
|
---|
681 | if ( !RTStrICmp(pszName, "hwvirt")
|
---|
682 | || !RTStrICmp(pszName, "hm"))
|
---|
683 | return VMExecutionEngine_HwVirt;
|
---|
684 | if ( !RTStrICmp(pszName, "nem")
|
---|
685 | || !RTStrICmp(pszName, "native-api"))
|
---|
686 | return VMExecutionEngine_NativeApi;
|
---|
687 | if (!RTStrICmp(pszName, "interpreter"))
|
---|
688 | return VMExecutionEngine_Interpreter;
|
---|
689 | if ( !RTStrICmp(pszName, "recompiler"))
|
---|
690 | return VMExecutionEngine_Recompiler;
|
---|
691 |
|
---|
692 | return VMExecutionEngine_NotSet;
|
---|
693 | }
|
---|
694 |
|
---|
695 | /**
|
---|
696 | * Handles the x86-specific modifyvm options.
|
---|
697 | *
|
---|
698 | * @returns HRESULT
|
---|
699 | * @retval E_INVALIDARG if handed-in option was not being handled.
|
---|
700 | * @param pGetOptState Pointer to GetOpt state to use.
|
---|
701 | * @param c Current GetOpt value (short form).
|
---|
702 | * @param pValueUnion Pointer to current value union.
|
---|
703 | * @param sessionMachine Session machine to use.
|
---|
704 | * @param platformX86 x86-specific platform object to use.
|
---|
705 | */
|
---|
706 | static HRESULT handleModifyVM_x86(PRTGETOPTSTATE pGetOptState, int c, PRTGETOPTUNION pValueUnion,
|
---|
707 | ComPtr<IMachine> &sessionMachine, ComPtr<IPlatformX86> &platformX86)
|
---|
708 | {
|
---|
709 | RT_NOREF(sessionMachine);
|
---|
710 |
|
---|
711 | HRESULT hrc = S_OK;
|
---|
712 |
|
---|
713 | switch (c)
|
---|
714 | {
|
---|
715 | case MODIFYVM_X86_APIC:
|
---|
716 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_APIC, pValueUnion->f));
|
---|
717 | break;
|
---|
718 |
|
---|
719 | case MODIFYVM_X86_DELCPUID:
|
---|
720 | CHECK_ERROR(platformX86, RemoveCPUIDLeaf(pValueUnion->PairU32.uFirst, pValueUnion->PairU32.uSecond));
|
---|
721 | break;
|
---|
722 |
|
---|
723 | case MODIFYVM_X86_DELCPUID_OLD:
|
---|
724 | CHECK_ERROR(platformX86, RemoveCPUIDLeaf(pValueUnion->u32, UINT32_MAX));
|
---|
725 | break;
|
---|
726 |
|
---|
727 | case MODIFYVM_X86_DELALLCPUID:
|
---|
728 | CHECK_ERROR(platformX86, RemoveAllCPUIDLeaves());
|
---|
729 | break;
|
---|
730 |
|
---|
731 | case MODIFYVM_X86_HPET:
|
---|
732 | CHECK_ERROR(platformX86, COMSETTER(HPETEnabled)(pValueUnion->f));
|
---|
733 | break;
|
---|
734 |
|
---|
735 | case MODIFYVM_X86_TFRESET:
|
---|
736 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_TripleFaultReset, pValueUnion->f));
|
---|
737 | break;
|
---|
738 |
|
---|
739 | case MODIFYVM_X86_PAE:
|
---|
740 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_PAE, pValueUnion->f));
|
---|
741 | break;
|
---|
742 |
|
---|
743 | case MODIFYVM_X86_LONGMODE:
|
---|
744 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_LongMode, pValueUnion->f));
|
---|
745 | break;
|
---|
746 |
|
---|
747 | case MODIFYVM_X86_X2APIC:
|
---|
748 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_X2APIC, pValueUnion->f));
|
---|
749 | break;
|
---|
750 |
|
---|
751 | case MODIFYVM_X86_NESTEDPAGING:
|
---|
752 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, pValueUnion->f));
|
---|
753 | break;
|
---|
754 |
|
---|
755 | case MODIFYVM_X86_LARGEPAGES:
|
---|
756 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, pValueUnion->f));
|
---|
757 | break;
|
---|
758 |
|
---|
759 | case MODIFYVM_X86_VTXVPID:
|
---|
760 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_VPID, pValueUnion->f));
|
---|
761 | break;
|
---|
762 |
|
---|
763 | case MODIFYVM_X86_VTXUX:
|
---|
764 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, pValueUnion->f));
|
---|
765 | break;
|
---|
766 |
|
---|
767 | case MODIFYVM_X86_VIRT_VMSAVE_VMLOAD:
|
---|
768 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_VirtVmsaveVmload, pValueUnion->f));
|
---|
769 | break;
|
---|
770 |
|
---|
771 | case MODIFYVM_X86_IBPB_ON_VM_EXIT:
|
---|
772 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_IBPBOnVMExit, pValueUnion->f));
|
---|
773 | break;
|
---|
774 |
|
---|
775 | case MODIFYVM_X86_IBPB_ON_VM_ENTRY:
|
---|
776 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_IBPBOnVMEntry, pValueUnion->f));
|
---|
777 | break;
|
---|
778 |
|
---|
779 | case MODIFYVM_X86_SPEC_CTRL:
|
---|
780 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_SpecCtrl, pValueUnion->f));
|
---|
781 | break;
|
---|
782 |
|
---|
783 | case MODIFYVM_X86_L1D_FLUSH_ON_SCHED:
|
---|
784 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_L1DFlushOnEMTScheduling, pValueUnion->f));
|
---|
785 | break;
|
---|
786 |
|
---|
787 | case MODIFYVM_X86_L1D_FLUSH_ON_VM_ENTRY:
|
---|
788 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_L1DFlushOnVMEntry, pValueUnion->f));
|
---|
789 | break;
|
---|
790 |
|
---|
791 | case MODIFYVM_X86_MDS_CLEAR_ON_SCHED:
|
---|
792 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_MDSClearOnEMTScheduling, pValueUnion->f));
|
---|
793 | break;
|
---|
794 |
|
---|
795 | case MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY:
|
---|
796 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_MDSClearOnVMEntry, pValueUnion->f));
|
---|
797 | break;
|
---|
798 |
|
---|
799 | case MODIFYVM_NESTED_HW_VIRT:
|
---|
800 | CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_HWVirt, pValueUnion->f));
|
---|
801 | break;
|
---|
802 |
|
---|
803 | case MODIFYVM_X86_HWVIRTEX:
|
---|
804 | CHECK_ERROR(platformX86, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, pValueUnion->f));
|
---|
805 | break;
|
---|
806 |
|
---|
807 | case MODIFYVM_X86_SETCPUID:
|
---|
808 | {
|
---|
809 | uint32_t const idx = c == MODIFYVM_X86_SETCPUID ? pValueUnion->PairU32.uFirst : pValueUnion->u32;
|
---|
810 | uint32_t const idxSub = c == MODIFYVM_X86_SETCPUID ? pValueUnion->PairU32.uSecond : UINT32_MAX;
|
---|
811 | uint32_t aValue[4];
|
---|
812 | for (unsigned i = 0; i < 4; i++)
|
---|
813 | {
|
---|
814 | int vrc = RTGetOptFetchValue(pGetOptState, pValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
|
---|
815 | if (RT_FAILURE(vrc))
|
---|
816 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"),
|
---|
817 | pGetOptState->pDef->pszLong);
|
---|
818 | aValue[i] = pValueUnion->u32;
|
---|
819 | }
|
---|
820 | CHECK_ERROR(platformX86, SetCPUIDLeaf(idx, idxSub, aValue[0], aValue[1], aValue[2], aValue[3]));
|
---|
821 | break;
|
---|
822 | }
|
---|
823 |
|
---|
824 | default:
|
---|
825 | hrc = E_INVALIDARG;
|
---|
826 | break;
|
---|
827 | }
|
---|
828 |
|
---|
829 | return hrc;
|
---|
830 | }
|
---|
831 |
|
---|
832 | /**
|
---|
833 | * Handles the x86-specific modifyvm options.
|
---|
834 | *
|
---|
835 | * @returns HRESULT
|
---|
836 | * @retval E_INVALIDARG if handed-in option was not being handled.
|
---|
837 | * @param pGetOptState Pointer to GetOpt state to use.
|
---|
838 | * @param c Current GetOpt value (short form).
|
---|
839 | * @param pValueUnion Pointer to current value union.
|
---|
840 | * @param sessionMachine Session machine to use.
|
---|
841 | * @param platformARM ARM-specific platform object to use.
|
---|
842 | */
|
---|
843 | static HRESULT handleModifyVM_ARM(PRTGETOPTSTATE pGetOptState, int c, PRTGETOPTUNION pValueUnion,
|
---|
844 | ComPtr<IMachine> &sessionMachine, ComPtr<IPlatformARM> &platformARM)
|
---|
845 | {
|
---|
846 | RT_NOREF(pGetOptState, sessionMachine);
|
---|
847 |
|
---|
848 | HRESULT hrc = S_OK;
|
---|
849 |
|
---|
850 | switch (c)
|
---|
851 | {
|
---|
852 | case MODIFYVM_NESTED_HW_VIRT:
|
---|
853 | CHECK_ERROR(platformARM, SetCPUProperty(CPUPropertyTypeARM_HWVirt, pValueUnion->f));
|
---|
854 | break;
|
---|
855 |
|
---|
856 | default:
|
---|
857 | hrc = E_INVALIDARG;
|
---|
858 | break;
|
---|
859 | }
|
---|
860 |
|
---|
861 | return hrc;
|
---|
862 | }
|
---|
863 |
|
---|
864 | RTEXITCODE handleModifyVM(HandlerArg *a)
|
---|
865 | {
|
---|
866 | int c;
|
---|
867 | HRESULT hrc;
|
---|
868 | Bstr name;
|
---|
869 |
|
---|
870 | /* VM ID + at least one parameter. Parameter arguments are checked
|
---|
871 | * individually. */
|
---|
872 | if (a->argc < 2)
|
---|
873 | return errorSyntax(ModifyVM::tr("Not enough parameters"));
|
---|
874 |
|
---|
875 | /* try to find the given sessionMachine */
|
---|
876 | ComPtr<IMachine> machine;
|
---|
877 | CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
|
---|
878 | machine.asOutParam()), RTEXITCODE_FAILURE);
|
---|
879 |
|
---|
880 |
|
---|
881 | /* Get the number of network adapters */
|
---|
882 | ULONG NetworkAdapterCount = getMaxNics(machine);
|
---|
883 |
|
---|
884 | /* open a session for the VM */
|
---|
885 | CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE);
|
---|
886 |
|
---|
887 | /* get the mutable session sessionMachine */
|
---|
888 | ComPtr<IMachine> sessionMachine;
|
---|
889 | CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), RTEXITCODE_FAILURE);
|
---|
890 |
|
---|
891 | ComPtr<IFirmwareSettings> firmwareSettings;
|
---|
892 | CHECK_ERROR_RET(sessionMachine, COMGETTER(FirmwareSettings)(firmwareSettings.asOutParam()), RTEXITCODE_FAILURE);
|
---|
893 |
|
---|
894 | ComPtr<IPlatform> platform;
|
---|
895 | CHECK_ERROR_RET(sessionMachine, COMGETTER(Platform)(platform.asOutParam()), RTEXITCODE_FAILURE);
|
---|
896 |
|
---|
897 | ComPtr<IGraphicsAdapter> pGraphicsAdapter;
|
---|
898 | sessionMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam());
|
---|
899 |
|
---|
900 | RTGETOPTSTATE GetOptState;
|
---|
901 | RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
|
---|
902 | RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
903 |
|
---|
904 | RTGETOPTUNION ValueUnion;
|
---|
905 | while ( SUCCEEDED (hrc)
|
---|
906 | && (c = RTGetOpt(&GetOptState, &ValueUnion)))
|
---|
907 | {
|
---|
908 | switch (c)
|
---|
909 | {
|
---|
910 | case MODIFYVM_NAME:
|
---|
911 | {
|
---|
912 | CHECK_ERROR(sessionMachine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
|
---|
913 | break;
|
---|
914 | }
|
---|
915 | case MODIFYVM_GROUPS:
|
---|
916 | {
|
---|
917 | com::SafeArray<BSTR> groups;
|
---|
918 | parseGroups(ValueUnion.psz, &groups);
|
---|
919 | CHECK_ERROR(sessionMachine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups)));
|
---|
920 | break;
|
---|
921 | }
|
---|
922 | case MODIFYVM_DESCRIPTION:
|
---|
923 | {
|
---|
924 | CHECK_ERROR(sessionMachine, COMSETTER(Description)(Bstr(ValueUnion.psz).raw()));
|
---|
925 | break;
|
---|
926 | }
|
---|
927 | case MODIFYVM_OSTYPE:
|
---|
928 | {
|
---|
929 | CHECK_ERROR(sessionMachine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
|
---|
930 | break;
|
---|
931 | }
|
---|
932 |
|
---|
933 | case MODIFYVM_ICONFILE:
|
---|
934 | {
|
---|
935 | RTFILE iconFile;
|
---|
936 | int vrc = RTFileOpen(&iconFile, ValueUnion.psz, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
|
---|
937 | if (RT_FAILURE(vrc))
|
---|
938 | {
|
---|
939 | RTMsgError(ModifyVM::tr("Cannot open file \"%s\": %Rrc"), ValueUnion.psz, vrc);
|
---|
940 | hrc = E_FAIL;
|
---|
941 | break;
|
---|
942 | }
|
---|
943 | uint64_t cbSize;
|
---|
944 | vrc = RTFileQuerySize(iconFile, &cbSize);
|
---|
945 | if (RT_FAILURE(vrc))
|
---|
946 | {
|
---|
947 | RTMsgError(ModifyVM::tr("Cannot get size of file \"%s\": %Rrc"), ValueUnion.psz, vrc);
|
---|
948 | hrc = E_FAIL;
|
---|
949 | break;
|
---|
950 | }
|
---|
951 | if (cbSize > _256K)
|
---|
952 | {
|
---|
953 | RTMsgError(ModifyVM::tr("File \"%s\" is bigger than 256KByte"), ValueUnion.psz);
|
---|
954 | hrc = E_FAIL;
|
---|
955 | break;
|
---|
956 | }
|
---|
957 | SafeArray<BYTE> icon((size_t)cbSize);
|
---|
958 | hrc = RTFileRead(iconFile, icon.raw(), (size_t)cbSize, NULL);
|
---|
959 | if (RT_FAILURE(vrc))
|
---|
960 | {
|
---|
961 | RTMsgError(ModifyVM::tr("Cannot read contents of file \"%s\": %Rrc"), ValueUnion.psz, vrc);
|
---|
962 | hrc = E_FAIL;
|
---|
963 | break;
|
---|
964 | }
|
---|
965 | RTFileClose(iconFile);
|
---|
966 | CHECK_ERROR(sessionMachine, COMSETTER(Icon)(ComSafeArrayAsInParam(icon)));
|
---|
967 | break;
|
---|
968 | }
|
---|
969 |
|
---|
970 | case MODIFYVM_MEMORY:
|
---|
971 | {
|
---|
972 | CHECK_ERROR(sessionMachine, COMSETTER(MemorySize)(ValueUnion.u32));
|
---|
973 | break;
|
---|
974 | }
|
---|
975 |
|
---|
976 | case MODIFYVM_PAGEFUSION:
|
---|
977 | {
|
---|
978 | CHECK_ERROR(sessionMachine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
|
---|
979 | break;
|
---|
980 | }
|
---|
981 |
|
---|
982 | case MODIFYVM_VRAM:
|
---|
983 | {
|
---|
984 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(VRAMSize)(ValueUnion.u32));
|
---|
985 | break;
|
---|
986 | }
|
---|
987 |
|
---|
988 | case MODIFYVM_FIRMWARE:
|
---|
989 | {
|
---|
990 | if (!RTStrICmp(ValueUnion.psz, "efi"))
|
---|
991 | {
|
---|
992 | CHECK_ERROR(firmwareSettings, COMSETTER(FirmwareType)(FirmwareType_EFI));
|
---|
993 | }
|
---|
994 | else if (!RTStrICmp(ValueUnion.psz, "efi32"))
|
---|
995 | {
|
---|
996 | CHECK_ERROR(firmwareSettings, COMSETTER(FirmwareType)(FirmwareType_EFI32));
|
---|
997 | }
|
---|
998 | else if (!RTStrICmp(ValueUnion.psz, "efi64"))
|
---|
999 | {
|
---|
1000 | CHECK_ERROR(firmwareSettings, COMSETTER(FirmwareType)(FirmwareType_EFI64));
|
---|
1001 | }
|
---|
1002 | else if (!RTStrICmp(ValueUnion.psz, "efidual"))
|
---|
1003 | {
|
---|
1004 | CHECK_ERROR(firmwareSettings, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
|
---|
1005 | }
|
---|
1006 | else if (!RTStrICmp(ValueUnion.psz, "bios"))
|
---|
1007 | {
|
---|
1008 | CHECK_ERROR(firmwareSettings, COMSETTER(FirmwareType)(FirmwareType_BIOS));
|
---|
1009 | }
|
---|
1010 | else
|
---|
1011 | {
|
---|
1012 | errorArgument(ModifyVM::tr("Invalid --firmware argument '%s'"), ValueUnion.psz);
|
---|
1013 | hrc = E_FAIL;
|
---|
1014 | }
|
---|
1015 | break;
|
---|
1016 | }
|
---|
1017 |
|
---|
1018 | case MODIFYVM_ACPI:
|
---|
1019 | {
|
---|
1020 | CHECK_ERROR(firmwareSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
|
---|
1021 | break;
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | case MODIFYVM_IOAPIC:
|
---|
1025 | {
|
---|
1026 | CHECK_ERROR(firmwareSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
|
---|
1027 | break;
|
---|
1028 | }
|
---|
1029 |
|
---|
1030 | case MODIFYVM_CPUID_PORTABILITY:
|
---|
1031 | {
|
---|
1032 | CHECK_ERROR(sessionMachine, COMSETTER(CPUIDPortabilityLevel)(ValueUnion.u32));
|
---|
1033 | break;
|
---|
1034 | }
|
---|
1035 |
|
---|
1036 | case MODIFYVM_PARAVIRTPROVIDER:
|
---|
1037 | {
|
---|
1038 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
1039 | || !RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
1040 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_None));
|
---|
1041 | else if (!RTStrICmp(ValueUnion.psz, "default"))
|
---|
1042 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Default));
|
---|
1043 | else if (!RTStrICmp(ValueUnion.psz, "legacy"))
|
---|
1044 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Legacy));
|
---|
1045 | else if (!RTStrICmp(ValueUnion.psz, "minimal"))
|
---|
1046 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Minimal));
|
---|
1047 | else if (!RTStrICmp(ValueUnion.psz, "hyperv"))
|
---|
1048 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_HyperV));
|
---|
1049 | else if (!RTStrICmp(ValueUnion.psz, "kvm"))
|
---|
1050 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_KVM));
|
---|
1051 | else
|
---|
1052 | {
|
---|
1053 | errorArgument(ModifyVM::tr("Invalid --paravirtprovider argument '%s'"), ValueUnion.psz);
|
---|
1054 | hrc = E_FAIL;
|
---|
1055 | }
|
---|
1056 | break;
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | case MODIFYVM_PARAVIRTDEBUG:
|
---|
1060 | {
|
---|
1061 | CHECK_ERROR(sessionMachine, COMSETTER(ParavirtDebug)(Bstr(ValueUnion.psz).raw()));
|
---|
1062 | break;
|
---|
1063 | }
|
---|
1064 |
|
---|
1065 | case MODIFYVM_CPUS:
|
---|
1066 | {
|
---|
1067 | CHECK_ERROR(sessionMachine, COMSETTER(CPUCount)(ValueUnion.u32));
|
---|
1068 | break;
|
---|
1069 | }
|
---|
1070 |
|
---|
1071 | case MODIFYVM_RTCUSEUTC:
|
---|
1072 | {
|
---|
1073 | CHECK_ERROR(platform, COMSETTER(RTCUseUTC)(ValueUnion.f));
|
---|
1074 | break;
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | case MODIFYVM_CPUHOTPLUG:
|
---|
1078 | {
|
---|
1079 | CHECK_ERROR(sessionMachine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
|
---|
1080 | break;
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | case MODIFYVM_CPU_PROFILE:
|
---|
1084 | {
|
---|
1085 | CHECK_ERROR(sessionMachine, COMSETTER(CPUProfile)(Bstr(ValueUnion.psz).raw()));
|
---|
1086 | break;
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | case MODIFYVM_PLUGCPU:
|
---|
1090 | {
|
---|
1091 | CHECK_ERROR(sessionMachine, HotPlugCPU(ValueUnion.u32));
|
---|
1092 | break;
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 | case MODIFYVM_UNPLUGCPU:
|
---|
1096 | {
|
---|
1097 | CHECK_ERROR(sessionMachine, HotUnplugCPU(ValueUnion.u32));
|
---|
1098 | break;
|
---|
1099 | }
|
---|
1100 |
|
---|
1101 | case MODIFYVM_CPU_EXECTUION_CAP:
|
---|
1102 | {
|
---|
1103 | CHECK_ERROR(sessionMachine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
|
---|
1104 | break;
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | case MODIFYVM_GRAPHICSCONTROLLER:
|
---|
1108 | {
|
---|
1109 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
1110 | || !RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
1111 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(GraphicsControllerType)(GraphicsControllerType_Null));
|
---|
1112 | else if ( !RTStrICmp(ValueUnion.psz, "vboxvga")
|
---|
1113 | || !RTStrICmp(ValueUnion.psz, "vbox")
|
---|
1114 | || !RTStrICmp(ValueUnion.psz, "vga")
|
---|
1115 | || !RTStrICmp(ValueUnion.psz, "vesa"))
|
---|
1116 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VBoxVGA));
|
---|
1117 | #ifdef VBOX_WITH_VMSVGA
|
---|
1118 | else if ( !RTStrICmp(ValueUnion.psz, "vmsvga")
|
---|
1119 | || !RTStrICmp(ValueUnion.psz, "vmware"))
|
---|
1120 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VMSVGA));
|
---|
1121 | else if ( !RTStrICmp(ValueUnion.psz, "vboxsvga")
|
---|
1122 | || !RTStrICmp(ValueUnion.psz, "svga"))
|
---|
1123 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VBoxSVGA));
|
---|
1124 | #endif
|
---|
1125 | else
|
---|
1126 | {
|
---|
1127 | errorArgument(ModifyVM::tr("Invalid --graphicscontroller argument '%s'"), ValueUnion.psz);
|
---|
1128 | hrc = E_FAIL;
|
---|
1129 | }
|
---|
1130 | break;
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | case MODIFYVM_MONITORCOUNT:
|
---|
1134 | {
|
---|
1135 | CHECK_ERROR(pGraphicsAdapter, COMSETTER(MonitorCount)(ValueUnion.u32));
|
---|
1136 | break;
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | case MODIFYVM_ACCELERATE3D:
|
---|
1140 | {
|
---|
1141 | CHECK_ERROR(pGraphicsAdapter, SetFeature(GraphicsFeature_Acceleration3D, ValueUnion.f));
|
---|
1142 | break;
|
---|
1143 | }
|
---|
1144 |
|
---|
1145 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
1146 | case MODIFYVM_ACCELERATE2DVIDEO:
|
---|
1147 | {
|
---|
1148 | CHECK_ERROR(pGraphicsAdapter, SetFeature(GraphicsFeature_Acceleration2DVideo, ValueUnion.f));
|
---|
1149 | break;
|
---|
1150 | }
|
---|
1151 | #endif
|
---|
1152 | case MODIFYVM_FWLOGOFADEIN:
|
---|
1153 | {
|
---|
1154 | CHECK_ERROR(firmwareSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
|
---|
1155 | break;
|
---|
1156 | }
|
---|
1157 |
|
---|
1158 | case MODIFYVM_FWLOGOFADEOUT:
|
---|
1159 | {
|
---|
1160 | CHECK_ERROR(firmwareSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
|
---|
1161 | break;
|
---|
1162 | }
|
---|
1163 |
|
---|
1164 | case MODIFYVM_FWLOGODISPLAYTIME:
|
---|
1165 | {
|
---|
1166 | CHECK_ERROR(firmwareSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
|
---|
1167 | break;
|
---|
1168 | }
|
---|
1169 |
|
---|
1170 | case MODIFYVM_FWLOGOIMAGEPATH:
|
---|
1171 | {
|
---|
1172 | CHECK_ERROR(firmwareSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
|
---|
1173 | break;
|
---|
1174 | }
|
---|
1175 |
|
---|
1176 | case MODIFYVM_FWBOOTMENU:
|
---|
1177 | {
|
---|
1178 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
1179 | {
|
---|
1180 | CHECK_ERROR(firmwareSettings, COMSETTER(BootMenuMode)(FirmwareBootMenuMode_Disabled));
|
---|
1181 | }
|
---|
1182 | else if (!RTStrICmp(ValueUnion.psz, "menuonly"))
|
---|
1183 | {
|
---|
1184 | CHECK_ERROR(firmwareSettings, COMSETTER(BootMenuMode)(FirmwareBootMenuMode_MenuOnly));
|
---|
1185 | }
|
---|
1186 | else if (!RTStrICmp(ValueUnion.psz, "messageandmenu"))
|
---|
1187 | {
|
---|
1188 | CHECK_ERROR(firmwareSettings, COMSETTER(BootMenuMode)(FirmwareBootMenuMode_MessageAndMenu));
|
---|
1189 | }
|
---|
1190 | else
|
---|
1191 | {
|
---|
1192 | errorArgument(ModifyVM::tr("Invalid --biosbootmenu argument '%s'"), ValueUnion.psz);
|
---|
1193 | hrc = E_FAIL;
|
---|
1194 | }
|
---|
1195 | break;
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | case MODIFYVM_FWAPIC:
|
---|
1199 | {
|
---|
1200 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
1201 | {
|
---|
1202 | CHECK_ERROR(firmwareSettings, COMSETTER(APICMode)(APICMode_Disabled));
|
---|
1203 | }
|
---|
1204 | else if ( !RTStrICmp(ValueUnion.psz, "apic")
|
---|
1205 | || !RTStrICmp(ValueUnion.psz, "lapic")
|
---|
1206 | || !RTStrICmp(ValueUnion.psz, "xapic"))
|
---|
1207 | {
|
---|
1208 | CHECK_ERROR(firmwareSettings, COMSETTER(APICMode)(APICMode_APIC));
|
---|
1209 | }
|
---|
1210 | else if (!RTStrICmp(ValueUnion.psz, "x2apic"))
|
---|
1211 | {
|
---|
1212 | CHECK_ERROR(firmwareSettings, COMSETTER(APICMode)(APICMode_X2APIC));
|
---|
1213 | }
|
---|
1214 | else
|
---|
1215 | {
|
---|
1216 | errorArgument(ModifyVM::tr("Invalid --biosapic argument '%s'"), ValueUnion.psz);
|
---|
1217 | hrc = E_FAIL;
|
---|
1218 | }
|
---|
1219 | break;
|
---|
1220 | }
|
---|
1221 |
|
---|
1222 | case MODIFYVM_FWSYSTEMTIMEOFFSET:
|
---|
1223 | {
|
---|
1224 | CHECK_ERROR(firmwareSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
|
---|
1225 | break;
|
---|
1226 | }
|
---|
1227 |
|
---|
1228 | case MODIFYVM_FWPXEDEBUG:
|
---|
1229 | {
|
---|
1230 | CHECK_ERROR(firmwareSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
|
---|
1231 | break;
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | case MODIFYVM_SYSTEMUUIDLE:
|
---|
1235 | {
|
---|
1236 | CHECK_ERROR(firmwareSettings, COMSETTER(SMBIOSUuidLittleEndian)(ValueUnion.f));
|
---|
1237 | break;
|
---|
1238 | }
|
---|
1239 |
|
---|
1240 | case MODIFYVM_FWAUTOSERIALNUMGEN:
|
---|
1241 | {
|
---|
1242 | CHECK_ERROR(firmwareSettings, COMSETTER(AutoSerialNumGen)(ValueUnion.f));
|
---|
1243 | break;
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | case MODIFYVM_BOOT:
|
---|
1247 | {
|
---|
1248 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1249 | {
|
---|
1250 | CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
|
---|
1251 | }
|
---|
1252 | else if (!RTStrICmp(ValueUnion.psz, "floppy"))
|
---|
1253 | {
|
---|
1254 | CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
|
---|
1255 | }
|
---|
1256 | else if (!RTStrICmp(ValueUnion.psz, "dvd"))
|
---|
1257 | {
|
---|
1258 | CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
|
---|
1259 | }
|
---|
1260 | else if (!RTStrICmp(ValueUnion.psz, "disk"))
|
---|
1261 | {
|
---|
1262 | CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
|
---|
1263 | }
|
---|
1264 | else if (!RTStrICmp(ValueUnion.psz, "net"))
|
---|
1265 | {
|
---|
1266 | CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
|
---|
1267 | }
|
---|
1268 | else
|
---|
1269 | return errorArgument(ModifyVM::tr("Invalid boot device '%s'"), ValueUnion.psz);
|
---|
1270 | break;
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | case MODIFYVM_HDA: // deprecated
|
---|
1274 | case MODIFYVM_HDB: // deprecated
|
---|
1275 | case MODIFYVM_HDD: // deprecated
|
---|
1276 | case MODIFYVM_SATAPORT: // deprecated
|
---|
1277 | {
|
---|
1278 | uint32_t u1 = 0, u2 = 0;
|
---|
1279 | Bstr bstrController = L"IDE Controller";
|
---|
1280 |
|
---|
1281 | switch (c)
|
---|
1282 | {
|
---|
1283 | case MODIFYVM_HDA: // deprecated
|
---|
1284 | u1 = 0;
|
---|
1285 | break;
|
---|
1286 |
|
---|
1287 | case MODIFYVM_HDB: // deprecated
|
---|
1288 | u1 = 0;
|
---|
1289 | u2 = 1;
|
---|
1290 | break;
|
---|
1291 |
|
---|
1292 | case MODIFYVM_HDD: // deprecated
|
---|
1293 | u1 = 1;
|
---|
1294 | u2 = 1;
|
---|
1295 | break;
|
---|
1296 |
|
---|
1297 | case MODIFYVM_SATAPORT: // deprecated
|
---|
1298 | u1 = GetOptState.uIndex;
|
---|
1299 | bstrController = L"SATA";
|
---|
1300 | break;
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1304 | {
|
---|
1305 | sessionMachine->DetachDevice(bstrController.raw(), u1, u2);
|
---|
1306 | }
|
---|
1307 | else
|
---|
1308 | {
|
---|
1309 | ComPtr<IMedium> hardDisk;
|
---|
1310 | hrc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
1311 | AccessMode_ReadWrite, hardDisk,
|
---|
1312 | false /* fForceNewUuidOnOpen */,
|
---|
1313 | false /* fSilent */);
|
---|
1314 | if (FAILED(hrc))
|
---|
1315 | break;
|
---|
1316 | if (hardDisk)
|
---|
1317 | {
|
---|
1318 | CHECK_ERROR(sessionMachine, AttachDevice(bstrController.raw(),
|
---|
1319 | u1, u2,
|
---|
1320 | DeviceType_HardDisk,
|
---|
1321 | hardDisk));
|
---|
1322 | }
|
---|
1323 | else
|
---|
1324 | hrc = E_FAIL;
|
---|
1325 | }
|
---|
1326 | break;
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | case MODIFYVM_IDECONTROLLER: // deprecated
|
---|
1330 | {
|
---|
1331 | ComPtr<IStorageController> storageController;
|
---|
1332 | CHECK_ERROR(sessionMachine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
|
---|
1333 | storageController.asOutParam()));
|
---|
1334 |
|
---|
1335 | if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
|
---|
1336 | {
|
---|
1337 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
|
---|
1338 | }
|
---|
1339 | else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
|
---|
1340 | {
|
---|
1341 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
|
---|
1342 | }
|
---|
1343 | else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
|
---|
1344 | {
|
---|
1345 | CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
|
---|
1346 | }
|
---|
1347 | else
|
---|
1348 | {
|
---|
1349 | errorArgument(ModifyVM::tr("Invalid --idecontroller argument '%s'"), ValueUnion.psz);
|
---|
1350 | hrc = E_FAIL;
|
---|
1351 | }
|
---|
1352 | break;
|
---|
1353 | }
|
---|
1354 |
|
---|
1355 | case MODIFYVM_SATAPORTCOUNT: // deprecated
|
---|
1356 | {
|
---|
1357 | ComPtr<IStorageController> SataCtl;
|
---|
1358 | CHECK_ERROR(sessionMachine, GetStorageControllerByName(Bstr("SATA").raw(),
|
---|
1359 | SataCtl.asOutParam()));
|
---|
1360 |
|
---|
1361 | if (SUCCEEDED(hrc) && ValueUnion.u32 > 0)
|
---|
1362 | CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
|
---|
1363 | break;
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 | case MODIFYVM_SATA: // deprecated
|
---|
1367 | {
|
---|
1368 | if (!RTStrICmp(ValueUnion.psz, "on") || !RTStrICmp(ValueUnion.psz, "enable"))
|
---|
1369 | {
|
---|
1370 | ComPtr<IStorageController> ctl;
|
---|
1371 | CHECK_ERROR(sessionMachine, AddStorageController(Bstr("SATA").raw(),
|
---|
1372 | StorageBus_SATA,
|
---|
1373 | ctl.asOutParam()));
|
---|
1374 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
|
---|
1375 | }
|
---|
1376 | else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
|
---|
1377 | CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("SATA").raw()));
|
---|
1378 | else
|
---|
1379 | return errorArgument(ModifyVM::tr("Invalid --usb argument '%s'"), ValueUnion.psz);
|
---|
1380 | break;
|
---|
1381 | }
|
---|
1382 |
|
---|
1383 | case MODIFYVM_SCSIPORT: // deprecated
|
---|
1384 | {
|
---|
1385 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1386 | {
|
---|
1387 | hrc = sessionMachine->DetachDevice(Bstr("LsiLogic").raw(),
|
---|
1388 | GetOptState.uIndex, 0);
|
---|
1389 | if (FAILED(hrc))
|
---|
1390 | CHECK_ERROR(sessionMachine, DetachDevice(Bstr("BusLogic").raw(),
|
---|
1391 | GetOptState.uIndex, 0));
|
---|
1392 | }
|
---|
1393 | else
|
---|
1394 | {
|
---|
1395 | ComPtr<IMedium> hardDisk;
|
---|
1396 | hrc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
|
---|
1397 | AccessMode_ReadWrite, hardDisk,
|
---|
1398 | false /* fForceNewUuidOnOpen */,
|
---|
1399 | false /* fSilent */);
|
---|
1400 | if (FAILED(hrc))
|
---|
1401 | break;
|
---|
1402 | if (hardDisk)
|
---|
1403 | {
|
---|
1404 | hrc = sessionMachine->AttachDevice(Bstr("LsiLogic").raw(),
|
---|
1405 | GetOptState.uIndex, 0,
|
---|
1406 | DeviceType_HardDisk,
|
---|
1407 | hardDisk);
|
---|
1408 | if (FAILED(hrc))
|
---|
1409 | CHECK_ERROR(sessionMachine,
|
---|
1410 | AttachDevice(Bstr("BusLogic").raw(),
|
---|
1411 | GetOptState.uIndex, 0,
|
---|
1412 | DeviceType_HardDisk,
|
---|
1413 | hardDisk));
|
---|
1414 | }
|
---|
1415 | else
|
---|
1416 | hrc = E_FAIL;
|
---|
1417 | }
|
---|
1418 | break;
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 | case MODIFYVM_SCSITYPE: // deprecated
|
---|
1422 | {
|
---|
1423 | ComPtr<IStorageController> ctl;
|
---|
1424 |
|
---|
1425 | if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
|
---|
1426 | {
|
---|
1427 | hrc = sessionMachine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
1428 | if (FAILED(hrc))
|
---|
1429 | CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
1430 |
|
---|
1431 | CHECK_ERROR(sessionMachine,
|
---|
1432 | AddStorageController(Bstr("LsiLogic").raw(),
|
---|
1433 | StorageBus_SCSI,
|
---|
1434 | ctl.asOutParam()));
|
---|
1435 |
|
---|
1436 | if (SUCCEEDED(hrc))
|
---|
1437 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
|
---|
1438 | }
|
---|
1439 | else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
|
---|
1440 | {
|
---|
1441 | hrc = sessionMachine->RemoveStorageController(Bstr("LsiLogic").raw());
|
---|
1442 | if (FAILED(hrc))
|
---|
1443 | CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("BusLogic").raw()));
|
---|
1444 |
|
---|
1445 | CHECK_ERROR(sessionMachine,
|
---|
1446 | AddStorageController(Bstr("BusLogic").raw(),
|
---|
1447 | StorageBus_SCSI,
|
---|
1448 | ctl.asOutParam()));
|
---|
1449 |
|
---|
1450 | if (SUCCEEDED(hrc))
|
---|
1451 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
1452 | }
|
---|
1453 | else
|
---|
1454 | return errorArgument(ModifyVM::tr("Invalid --scsitype argument '%s'"), ValueUnion.psz);
|
---|
1455 | break;
|
---|
1456 | }
|
---|
1457 |
|
---|
1458 | case MODIFYVM_SCSI: // deprecated
|
---|
1459 | {
|
---|
1460 | if (!RTStrICmp(ValueUnion.psz, "on") || !RTStrICmp(ValueUnion.psz, "enable"))
|
---|
1461 | {
|
---|
1462 | ComPtr<IStorageController> ctl;
|
---|
1463 |
|
---|
1464 | CHECK_ERROR(sessionMachine, AddStorageController(Bstr("BusLogic").raw(),
|
---|
1465 | StorageBus_SCSI,
|
---|
1466 | ctl.asOutParam()));
|
---|
1467 | if (SUCCEEDED(hrc))
|
---|
1468 | CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
|
---|
1469 | }
|
---|
1470 | else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
|
---|
1471 | {
|
---|
1472 | hrc = sessionMachine->RemoveStorageController(Bstr("BusLogic").raw());
|
---|
1473 | if (FAILED(hrc))
|
---|
1474 | CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("LsiLogic").raw()));
|
---|
1475 | }
|
---|
1476 | break;
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | case MODIFYVM_DVDPASSTHROUGH: // deprecated
|
---|
1480 | {
|
---|
1481 | CHECK_ERROR(sessionMachine, PassthroughDevice(Bstr("IDE Controller").raw(),
|
---|
1482 | 1, 0,
|
---|
1483 | !RTStrICmp(ValueUnion.psz, "on")));
|
---|
1484 | break;
|
---|
1485 | }
|
---|
1486 |
|
---|
1487 | case MODIFYVM_DVD: // deprecated
|
---|
1488 | {
|
---|
1489 | ComPtr<IMedium> dvdMedium;
|
---|
1490 |
|
---|
1491 | /* unmount? */
|
---|
1492 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1493 | {
|
---|
1494 | /* nothing to do, NULL object will cause unmount */
|
---|
1495 | }
|
---|
1496 | /* host drive? */
|
---|
1497 | else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
|
---|
1498 | {
|
---|
1499 | ComPtr<IHost> host;
|
---|
1500 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1501 | hrc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
1502 | dvdMedium.asOutParam());
|
---|
1503 | if (!dvdMedium)
|
---|
1504 | {
|
---|
1505 | /* 2nd try: try with the real name, important on Linux+libhal */
|
---|
1506 | char szPathReal[RTPATH_MAX];
|
---|
1507 | if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
|
---|
1508 | {
|
---|
1509 | errorArgument(ModifyVM::tr("Invalid host DVD drive name \"%s\""), ValueUnion.psz + 5);
|
---|
1510 | hrc = E_FAIL;
|
---|
1511 | break;
|
---|
1512 | }
|
---|
1513 | hrc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
|
---|
1514 | dvdMedium.asOutParam());
|
---|
1515 | if (!dvdMedium)
|
---|
1516 | {
|
---|
1517 | errorArgument(ModifyVM::tr("Invalid host DVD drive name \"%s\""), ValueUnion.psz + 5);
|
---|
1518 | hrc = E_FAIL;
|
---|
1519 | break;
|
---|
1520 | }
|
---|
1521 | }
|
---|
1522 | }
|
---|
1523 | else
|
---|
1524 | {
|
---|
1525 | hrc = openMedium(a, ValueUnion.psz, DeviceType_DVD,
|
---|
1526 | AccessMode_ReadOnly, dvdMedium,
|
---|
1527 | false /* fForceNewUuidOnOpen */,
|
---|
1528 | false /* fSilent */);
|
---|
1529 | if (FAILED(hrc))
|
---|
1530 | break;
|
---|
1531 | if (!dvdMedium)
|
---|
1532 | {
|
---|
1533 | hrc = E_FAIL;
|
---|
1534 | break;
|
---|
1535 | }
|
---|
1536 | }
|
---|
1537 |
|
---|
1538 | CHECK_ERROR(sessionMachine, MountMedium(Bstr("IDE Controller").raw(),
|
---|
1539 | 1, 0,
|
---|
1540 | dvdMedium,
|
---|
1541 | FALSE /* aForce */));
|
---|
1542 | break;
|
---|
1543 | }
|
---|
1544 |
|
---|
1545 | case MODIFYVM_FLOPPY: // deprecated
|
---|
1546 | {
|
---|
1547 | ComPtr<IMedium> floppyMedium;
|
---|
1548 | ComPtr<IMediumAttachment> floppyAttachment;
|
---|
1549 | sessionMachine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
|
---|
1550 | 0, 0, floppyAttachment.asOutParam());
|
---|
1551 |
|
---|
1552 | /* disable? */
|
---|
1553 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
1554 | {
|
---|
1555 | /* disable the controller */
|
---|
1556 | if (floppyAttachment)
|
---|
1557 | CHECK_ERROR(sessionMachine, DetachDevice(Bstr("Floppy Controller").raw(),
|
---|
1558 | 0, 0));
|
---|
1559 | }
|
---|
1560 | else
|
---|
1561 | {
|
---|
1562 | /* enable the controller */
|
---|
1563 | if (!floppyAttachment)
|
---|
1564 | CHECK_ERROR(sessionMachine, AttachDeviceWithoutMedium(Bstr("Floppy Controller").raw(),
|
---|
1565 | 0, 0,
|
---|
1566 | DeviceType_Floppy));
|
---|
1567 |
|
---|
1568 | /* unmount? */
|
---|
1569 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
1570 | || !RTStrICmp(ValueUnion.psz, "empty")) // deprecated
|
---|
1571 | {
|
---|
1572 | /* nothing to do, NULL object will cause unmount */
|
---|
1573 | }
|
---|
1574 | /* host drive? */
|
---|
1575 | else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
|
---|
1576 | {
|
---|
1577 | ComPtr<IHost> host;
|
---|
1578 | CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
1579 | hrc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
|
---|
1580 | floppyMedium.asOutParam());
|
---|
1581 | if (!floppyMedium)
|
---|
1582 | {
|
---|
1583 | errorArgument(ModifyVM::tr("Invalid host floppy drive name \"%s\""), ValueUnion.psz + 5);
|
---|
1584 | hrc = E_FAIL;
|
---|
1585 | break;
|
---|
1586 | }
|
---|
1587 | }
|
---|
1588 | else
|
---|
1589 | {
|
---|
1590 | hrc = openMedium(a, ValueUnion.psz, DeviceType_Floppy,
|
---|
1591 | AccessMode_ReadWrite, floppyMedium,
|
---|
1592 | false /* fForceNewUuidOnOpen */,
|
---|
1593 | false /* fSilent */);
|
---|
1594 | if (FAILED(hrc))
|
---|
1595 | break;
|
---|
1596 | if (!floppyMedium)
|
---|
1597 | {
|
---|
1598 | hrc = E_FAIL;
|
---|
1599 | break;
|
---|
1600 | }
|
---|
1601 | }
|
---|
1602 | CHECK_ERROR(sessionMachine, MountMedium(Bstr("Floppy Controller").raw(),
|
---|
1603 | 0, 0,
|
---|
1604 | floppyMedium,
|
---|
1605 | FALSE /* aForce */));
|
---|
1606 | }
|
---|
1607 | break;
|
---|
1608 | }
|
---|
1609 |
|
---|
1610 | case MODIFYVM_NICTRACEFILE:
|
---|
1611 | {
|
---|
1612 |
|
---|
1613 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1614 | break;
|
---|
1615 |
|
---|
1616 | ComPtr<INetworkAdapter> nic;
|
---|
1617 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1618 | ASSERT(nic);
|
---|
1619 |
|
---|
1620 | CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
|
---|
1621 | break;
|
---|
1622 | }
|
---|
1623 |
|
---|
1624 | case MODIFYVM_NICTRACE:
|
---|
1625 | {
|
---|
1626 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1627 | break;
|
---|
1628 |
|
---|
1629 | ComPtr<INetworkAdapter> nic;
|
---|
1630 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1631 | ASSERT(nic);
|
---|
1632 |
|
---|
1633 | CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
|
---|
1634 | break;
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | case MODIFYVM_NICPROPERTY:
|
---|
1638 | {
|
---|
1639 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1640 | break;
|
---|
1641 |
|
---|
1642 | ComPtr<INetworkAdapter> nic;
|
---|
1643 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1644 | ASSERT(nic);
|
---|
1645 |
|
---|
1646 | if (nic)
|
---|
1647 | {
|
---|
1648 | /* Parse 'name=value' */
|
---|
1649 | char *pszProperty = RTStrDup(ValueUnion.psz);
|
---|
1650 | if (pszProperty)
|
---|
1651 | {
|
---|
1652 | char *pDelimiter = strchr(pszProperty, '=');
|
---|
1653 | if (pDelimiter)
|
---|
1654 | {
|
---|
1655 | *pDelimiter = '\0';
|
---|
1656 |
|
---|
1657 | Bstr bstrName = pszProperty;
|
---|
1658 | Bstr bstrValue = &pDelimiter[1];
|
---|
1659 | CHECK_ERROR(nic, SetProperty(bstrName.raw(), bstrValue.raw()));
|
---|
1660 | }
|
---|
1661 | else
|
---|
1662 | {
|
---|
1663 | errorArgument(ModifyVM::tr("Invalid --nicproperty%d argument '%s'"), GetOptState.uIndex, ValueUnion.psz);
|
---|
1664 | hrc = E_FAIL;
|
---|
1665 | }
|
---|
1666 | RTStrFree(pszProperty);
|
---|
1667 | }
|
---|
1668 | else
|
---|
1669 | {
|
---|
1670 | RTStrmPrintf(g_pStdErr, ModifyVM::tr("Error: Failed to allocate memory for --nicproperty%d '%s'\n"),
|
---|
1671 | GetOptState.uIndex, ValueUnion.psz);
|
---|
1672 | hrc = E_FAIL;
|
---|
1673 | }
|
---|
1674 | }
|
---|
1675 | break;
|
---|
1676 | }
|
---|
1677 | case MODIFYVM_NICTYPE:
|
---|
1678 | {
|
---|
1679 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1680 | break;
|
---|
1681 |
|
---|
1682 | ComPtr<INetworkAdapter> nic;
|
---|
1683 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1684 | ASSERT(nic);
|
---|
1685 |
|
---|
1686 | if (!RTStrICmp(ValueUnion.psz, "Am79C970A"))
|
---|
1687 | {
|
---|
1688 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
|
---|
1689 | }
|
---|
1690 | else if (!RTStrICmp(ValueUnion.psz, "Am79C973"))
|
---|
1691 | {
|
---|
1692 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
|
---|
1693 | }
|
---|
1694 | else if (!RTStrICmp(ValueUnion.psz, "Am79C960"))
|
---|
1695 | {
|
---|
1696 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C960));
|
---|
1697 | }
|
---|
1698 | #ifdef VBOX_WITH_E1000
|
---|
1699 | else if (!RTStrICmp(ValueUnion.psz, "82540EM"))
|
---|
1700 | {
|
---|
1701 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
|
---|
1702 | }
|
---|
1703 | else if (!RTStrICmp(ValueUnion.psz, "82543GC"))
|
---|
1704 | {
|
---|
1705 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
|
---|
1706 | }
|
---|
1707 | else if (!RTStrICmp(ValueUnion.psz, "82545EM"))
|
---|
1708 | {
|
---|
1709 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
|
---|
1710 | }
|
---|
1711 | #endif
|
---|
1712 | #ifdef VBOX_WITH_VIRTIO
|
---|
1713 | else if (!RTStrICmp(ValueUnion.psz, "virtio"))
|
---|
1714 | {
|
---|
1715 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
|
---|
1716 | }
|
---|
1717 | #endif /* VBOX_WITH_VIRTIO */
|
---|
1718 | else if (!RTStrICmp(ValueUnion.psz, "NE1000"))
|
---|
1719 | {
|
---|
1720 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_NE1000));
|
---|
1721 | }
|
---|
1722 | else if (!RTStrICmp(ValueUnion.psz, "NE2000"))
|
---|
1723 | {
|
---|
1724 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_NE2000));
|
---|
1725 | }
|
---|
1726 | else if (!RTStrICmp(ValueUnion.psz, "WD8003"))
|
---|
1727 | {
|
---|
1728 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_WD8003));
|
---|
1729 | }
|
---|
1730 | else if (!RTStrICmp(ValueUnion.psz, "WD8013"))
|
---|
1731 | {
|
---|
1732 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_WD8013));
|
---|
1733 | }
|
---|
1734 | else if (!RTStrICmp(ValueUnion.psz, "3C503"))
|
---|
1735 | {
|
---|
1736 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_ELNK2));
|
---|
1737 | }
|
---|
1738 | else if (!RTStrICmp(ValueUnion.psz, "3C501"))
|
---|
1739 | {
|
---|
1740 | CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_ELNK1));
|
---|
1741 | }
|
---|
1742 | else
|
---|
1743 | {
|
---|
1744 | errorArgument(ModifyVM::tr("Invalid NIC type '%s' specified for NIC %u"),
|
---|
1745 | ValueUnion.psz, GetOptState.uIndex);
|
---|
1746 | hrc = E_FAIL;
|
---|
1747 | }
|
---|
1748 | break;
|
---|
1749 | }
|
---|
1750 |
|
---|
1751 | case MODIFYVM_NICSPEED:
|
---|
1752 | {
|
---|
1753 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1754 | break;
|
---|
1755 |
|
---|
1756 | ComPtr<INetworkAdapter> nic;
|
---|
1757 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1758 | ASSERT(nic);
|
---|
1759 |
|
---|
1760 | CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
|
---|
1761 | break;
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | case MODIFYVM_NICBOOTPRIO:
|
---|
1765 | {
|
---|
1766 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1767 | break;
|
---|
1768 |
|
---|
1769 | ComPtr<INetworkAdapter> nic;
|
---|
1770 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1771 | ASSERT(nic);
|
---|
1772 |
|
---|
1773 | /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
|
---|
1774 | * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
|
---|
1775 | * 0 for the default lowest priority).
|
---|
1776 | */
|
---|
1777 | if (ValueUnion.u32 > 4)
|
---|
1778 | {
|
---|
1779 | errorArgument(ModifyVM::tr("Invalid boot priority '%u' specfied for NIC %u"), ValueUnion.u32, GetOptState.uIndex);
|
---|
1780 | hrc = E_FAIL;
|
---|
1781 | }
|
---|
1782 | else
|
---|
1783 | {
|
---|
1784 | CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
|
---|
1785 | }
|
---|
1786 | break;
|
---|
1787 | }
|
---|
1788 |
|
---|
1789 | case MODIFYVM_NICPROMISC:
|
---|
1790 | {
|
---|
1791 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
1792 | if (!RTStrICmp(ValueUnion.psz, "deny"))
|
---|
1793 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
|
---|
1794 | else if ( !RTStrICmp(ValueUnion.psz, "allow-vms")
|
---|
1795 | || !RTStrICmp(ValueUnion.psz, "allow-network"))
|
---|
1796 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
|
---|
1797 | else if (!RTStrICmp(ValueUnion.psz, "allow-all"))
|
---|
1798 | enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
|
---|
1799 | else
|
---|
1800 | {
|
---|
1801 | errorArgument(ModifyVM::tr("Unknown promiscuous mode policy '%s'"), ValueUnion.psz);
|
---|
1802 | hrc = E_INVALIDARG;
|
---|
1803 | break;
|
---|
1804 | }
|
---|
1805 |
|
---|
1806 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1807 | break;
|
---|
1808 |
|
---|
1809 | ComPtr<INetworkAdapter> nic;
|
---|
1810 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1811 | ASSERT(nic);
|
---|
1812 |
|
---|
1813 | CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
|
---|
1814 | break;
|
---|
1815 | }
|
---|
1816 |
|
---|
1817 | case MODIFYVM_NICBWGROUP:
|
---|
1818 | {
|
---|
1819 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1820 | break;
|
---|
1821 |
|
---|
1822 | ComPtr<INetworkAdapter> nic;
|
---|
1823 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1824 | ASSERT(nic);
|
---|
1825 |
|
---|
1826 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1827 | {
|
---|
1828 | /* Just remove the bandwidth group. */
|
---|
1829 | CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(NULL));
|
---|
1830 | }
|
---|
1831 | else
|
---|
1832 | {
|
---|
1833 | ComPtr<IBandwidthControl> bwCtrl;
|
---|
1834 | ComPtr<IBandwidthGroup> bwGroup;
|
---|
1835 |
|
---|
1836 | CHECK_ERROR(sessionMachine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
|
---|
1837 |
|
---|
1838 | if (SUCCEEDED(hrc))
|
---|
1839 | {
|
---|
1840 | CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(ValueUnion.psz).raw(), bwGroup.asOutParam()));
|
---|
1841 | if (SUCCEEDED(hrc))
|
---|
1842 | {
|
---|
1843 | CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(bwGroup));
|
---|
1844 | }
|
---|
1845 | }
|
---|
1846 | }
|
---|
1847 | break;
|
---|
1848 | }
|
---|
1849 |
|
---|
1850 | case MODIFYVM_NIC:
|
---|
1851 | {
|
---|
1852 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1853 | break;
|
---|
1854 |
|
---|
1855 | ComPtr<INetworkAdapter> nic;
|
---|
1856 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1857 | ASSERT(nic);
|
---|
1858 |
|
---|
1859 | /*
|
---|
1860 | * Check if the NIC is already enabled. Do not try to
|
---|
1861 | * enable it if it already is. That makes a
|
---|
1862 | * difference for saved VMs for which you can change
|
---|
1863 | * the NIC attachment, but can't change the NIC
|
---|
1864 | * enabled status (yes, the setter also should not
|
---|
1865 | * freak out about a no-op request).
|
---|
1866 | */
|
---|
1867 | BOOL fEnabled;;
|
---|
1868 | CHECK_ERROR(nic, COMGETTER(Enabled)(&fEnabled));
|
---|
1869 |
|
---|
1870 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1871 | {
|
---|
1872 | if (RT_BOOL(fEnabled))
|
---|
1873 | CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
|
---|
1874 | }
|
---|
1875 | else if (!RTStrICmp(ValueUnion.psz, "null"))
|
---|
1876 | {
|
---|
1877 | if (!fEnabled)
|
---|
1878 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1879 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Null));
|
---|
1880 | }
|
---|
1881 | else if (!RTStrICmp(ValueUnion.psz, "nat"))
|
---|
1882 | {
|
---|
1883 | if (!fEnabled)
|
---|
1884 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1885 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NAT));
|
---|
1886 | }
|
---|
1887 | else if ( !RTStrICmp(ValueUnion.psz, "bridged")
|
---|
1888 | || !RTStrICmp(ValueUnion.psz, "hostif")) /* backward compatibility */
|
---|
1889 | {
|
---|
1890 | if (!fEnabled)
|
---|
1891 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1892 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged));
|
---|
1893 | }
|
---|
1894 | else if (!RTStrICmp(ValueUnion.psz, "intnet"))
|
---|
1895 | {
|
---|
1896 | if (!fEnabled)
|
---|
1897 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1898 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Internal));
|
---|
1899 | }
|
---|
1900 | else if (!RTStrICmp(ValueUnion.psz, "hostonly"))
|
---|
1901 | {
|
---|
1902 | if (!fEnabled)
|
---|
1903 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1904 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly));
|
---|
1905 | }
|
---|
1906 | #ifdef VBOX_WITH_VMNET
|
---|
1907 | else if (!RTStrICmp(ValueUnion.psz, "hostonlynet"))
|
---|
1908 | {
|
---|
1909 | if (!fEnabled)
|
---|
1910 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1911 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnlyNetwork));
|
---|
1912 | }
|
---|
1913 | #endif /* VBOX_WITH_VMNET */
|
---|
1914 | else if (!RTStrICmp(ValueUnion.psz, "generic"))
|
---|
1915 | {
|
---|
1916 | if (!fEnabled)
|
---|
1917 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1918 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic));
|
---|
1919 | }
|
---|
1920 | else if (!RTStrICmp(ValueUnion.psz, "natnetwork"))
|
---|
1921 | {
|
---|
1922 | if (!fEnabled)
|
---|
1923 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1924 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork));
|
---|
1925 | }
|
---|
1926 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
1927 | else if (!RTStrICmp(ValueUnion.psz, "cloud"))
|
---|
1928 | {
|
---|
1929 | if (!fEnabled)
|
---|
1930 | CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
|
---|
1931 | CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Cloud));
|
---|
1932 | }
|
---|
1933 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
1934 | else
|
---|
1935 | {
|
---|
1936 | errorArgument(ModifyVM::tr("Invalid type '%s' specfied for NIC %u"), ValueUnion.psz, GetOptState.uIndex);
|
---|
1937 | hrc = E_FAIL;
|
---|
1938 | }
|
---|
1939 | break;
|
---|
1940 | }
|
---|
1941 |
|
---|
1942 | case MODIFYVM_CABLECONNECTED:
|
---|
1943 | {
|
---|
1944 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1945 | break;
|
---|
1946 |
|
---|
1947 | ComPtr<INetworkAdapter> nic;
|
---|
1948 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1949 | ASSERT(nic);
|
---|
1950 |
|
---|
1951 | CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
|
---|
1952 | break;
|
---|
1953 | }
|
---|
1954 |
|
---|
1955 | case MODIFYVM_BRIDGEADAPTER:
|
---|
1956 | {
|
---|
1957 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1958 | break;
|
---|
1959 |
|
---|
1960 | ComPtr<INetworkAdapter> nic;
|
---|
1961 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1962 | ASSERT(nic);
|
---|
1963 |
|
---|
1964 | /* remove it? */
|
---|
1965 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1966 | {
|
---|
1967 | CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr().raw()));
|
---|
1968 | }
|
---|
1969 | else
|
---|
1970 | {
|
---|
1971 | CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr(ValueUnion.psz).raw()));
|
---|
1972 | verifyHostNetworkInterfaceName(a->virtualBox, ValueUnion.psz,
|
---|
1973 | HostNetworkInterfaceType_Bridged);
|
---|
1974 | }
|
---|
1975 | break;
|
---|
1976 | }
|
---|
1977 |
|
---|
1978 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
1979 | case MODIFYVM_CLOUDNET:
|
---|
1980 | {
|
---|
1981 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
1982 | break;
|
---|
1983 |
|
---|
1984 | ComPtr<INetworkAdapter> nic;
|
---|
1985 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
1986 | ASSERT(nic);
|
---|
1987 |
|
---|
1988 | /* remove it? */
|
---|
1989 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
1990 | {
|
---|
1991 | CHECK_ERROR(nic, COMSETTER(CloudNetwork)(Bstr().raw()));
|
---|
1992 | }
|
---|
1993 | else
|
---|
1994 | {
|
---|
1995 | CHECK_ERROR(nic, COMSETTER(CloudNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
1996 | }
|
---|
1997 | break;
|
---|
1998 | }
|
---|
1999 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
2000 |
|
---|
2001 | case MODIFYVM_HOSTONLYADAPTER:
|
---|
2002 | {
|
---|
2003 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2004 | break;
|
---|
2005 |
|
---|
2006 | ComPtr<INetworkAdapter> nic;
|
---|
2007 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2008 | ASSERT(nic);
|
---|
2009 |
|
---|
2010 | /* remove it? */
|
---|
2011 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
2012 | {
|
---|
2013 | CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr().raw()));
|
---|
2014 | }
|
---|
2015 | else
|
---|
2016 | {
|
---|
2017 | CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr(ValueUnion.psz).raw()));
|
---|
2018 | verifyHostNetworkInterfaceName(a->virtualBox, ValueUnion.psz,
|
---|
2019 | HostNetworkInterfaceType_HostOnly);
|
---|
2020 | }
|
---|
2021 | break;
|
---|
2022 | }
|
---|
2023 |
|
---|
2024 | #ifdef VBOX_WITH_VMNET
|
---|
2025 | case MODIFYVM_HOSTONLYNET:
|
---|
2026 | {
|
---|
2027 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2028 | break;
|
---|
2029 |
|
---|
2030 | ComPtr<INetworkAdapter> nic;
|
---|
2031 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2032 | ASSERT(nic);
|
---|
2033 |
|
---|
2034 | /* remove it? */
|
---|
2035 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
2036 | {
|
---|
2037 | CHECK_ERROR(nic, COMSETTER(HostOnlyNetwork)(Bstr().raw()));
|
---|
2038 | }
|
---|
2039 | else
|
---|
2040 | {
|
---|
2041 | CHECK_ERROR(nic, COMSETTER(HostOnlyNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
2042 | }
|
---|
2043 | break;
|
---|
2044 | }
|
---|
2045 | #endif /* VBOX_WITH_VMNET */
|
---|
2046 |
|
---|
2047 | case MODIFYVM_INTNET:
|
---|
2048 | {
|
---|
2049 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2050 | break;
|
---|
2051 |
|
---|
2052 | ComPtr<INetworkAdapter> nic;
|
---|
2053 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2054 | ASSERT(nic);
|
---|
2055 |
|
---|
2056 | /* remove it? */
|
---|
2057 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
2058 | {
|
---|
2059 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr().raw()));
|
---|
2060 | }
|
---|
2061 | else
|
---|
2062 | {
|
---|
2063 | CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
2064 | }
|
---|
2065 | break;
|
---|
2066 | }
|
---|
2067 |
|
---|
2068 | case MODIFYVM_GENERICDRV:
|
---|
2069 | {
|
---|
2070 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2071 | break;
|
---|
2072 |
|
---|
2073 | ComPtr<INetworkAdapter> nic;
|
---|
2074 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2075 | ASSERT(nic);
|
---|
2076 |
|
---|
2077 | CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw()));
|
---|
2078 | break;
|
---|
2079 | }
|
---|
2080 |
|
---|
2081 | case MODIFYVM_NATNETWORKNAME:
|
---|
2082 | {
|
---|
2083 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2084 | break;
|
---|
2085 |
|
---|
2086 | ComPtr<INetworkAdapter> nic;
|
---|
2087 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2088 | ASSERT(nic);
|
---|
2089 |
|
---|
2090 | CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz).raw()));
|
---|
2091 | break;
|
---|
2092 | }
|
---|
2093 |
|
---|
2094 | case MODIFYVM_NATNET:
|
---|
2095 | {
|
---|
2096 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2097 | break;
|
---|
2098 |
|
---|
2099 | ComPtr<INetworkAdapter> nic;
|
---|
2100 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2101 | ASSERT(nic);
|
---|
2102 |
|
---|
2103 | ComPtr<INATEngine> engine;
|
---|
2104 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2105 |
|
---|
2106 | const char *psz = ValueUnion.psz;
|
---|
2107 | if (!RTStrICmp("default", psz))
|
---|
2108 | psz = "";
|
---|
2109 |
|
---|
2110 | CHECK_ERROR(engine, COMSETTER(Network)(Bstr(psz).raw()));
|
---|
2111 | break;
|
---|
2112 | }
|
---|
2113 |
|
---|
2114 | case MODIFYVM_NATBINDIP:
|
---|
2115 | {
|
---|
2116 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2117 | break;
|
---|
2118 |
|
---|
2119 | ComPtr<INetworkAdapter> nic;
|
---|
2120 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2121 | ASSERT(nic);
|
---|
2122 |
|
---|
2123 | ComPtr<INATEngine> engine;
|
---|
2124 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2125 |
|
---|
2126 | CHECK_ERROR(engine, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw()));
|
---|
2127 | break;
|
---|
2128 | }
|
---|
2129 |
|
---|
2130 | #define ITERATE_TO_NEXT_TERM(ch) \
|
---|
2131 | do { \
|
---|
2132 | while (*ch != ',') \
|
---|
2133 | { \
|
---|
2134 | if (*ch == 0) \
|
---|
2135 | { \
|
---|
2136 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"), \
|
---|
2137 | GetOptState.pDef->pszLong); \
|
---|
2138 | } \
|
---|
2139 | ch++; \
|
---|
2140 | } \
|
---|
2141 | *ch = '\0'; \
|
---|
2142 | ch++; \
|
---|
2143 | } while(0)
|
---|
2144 |
|
---|
2145 | case MODIFYVM_NATSETTINGS:
|
---|
2146 | {
|
---|
2147 | ComPtr<INetworkAdapter> nic;
|
---|
2148 | ComPtr<INATEngine> engine;
|
---|
2149 | char *strMtu;
|
---|
2150 | char *strSockSnd;
|
---|
2151 | char *strSockRcv;
|
---|
2152 | char *strTcpSnd;
|
---|
2153 | char *strTcpRcv;
|
---|
2154 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
2155 | char *ch = strRaw;
|
---|
2156 | strMtu = RTStrStrip(ch);
|
---|
2157 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2158 | strSockSnd = RTStrStrip(ch);
|
---|
2159 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2160 | strSockRcv = RTStrStrip(ch);
|
---|
2161 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2162 | strTcpSnd = RTStrStrip(ch);
|
---|
2163 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2164 | strTcpRcv = RTStrStrip(ch);
|
---|
2165 |
|
---|
2166 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2167 | break;
|
---|
2168 |
|
---|
2169 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2170 | ASSERT(nic);
|
---|
2171 |
|
---|
2172 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2173 | CHECK_ERROR(engine, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
|
---|
2174 | RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
|
---|
2175 | break;
|
---|
2176 | }
|
---|
2177 |
|
---|
2178 |
|
---|
2179 | case MODIFYVM_NATPF:
|
---|
2180 | {
|
---|
2181 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2182 | break;
|
---|
2183 |
|
---|
2184 | ComPtr<INetworkAdapter> nic;
|
---|
2185 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2186 | ASSERT(nic);
|
---|
2187 |
|
---|
2188 | ComPtr<INATEngine> engine;
|
---|
2189 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2190 |
|
---|
2191 | /* format name:proto:hostip:hostport:guestip:guestport*/
|
---|
2192 | if (RTStrCmp(ValueUnion.psz, "delete") != 0)
|
---|
2193 | {
|
---|
2194 | char *strName;
|
---|
2195 | char *strProto;
|
---|
2196 | char *strHostIp;
|
---|
2197 | char *strHostPort;
|
---|
2198 | char *strGuestIp;
|
---|
2199 | char *strGuestPort;
|
---|
2200 | char *strRaw = RTStrDup(ValueUnion.psz);
|
---|
2201 | char *ch = strRaw;
|
---|
2202 | strName = RTStrStrip(ch);
|
---|
2203 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2204 | strProto = RTStrStrip(ch);
|
---|
2205 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2206 | strHostIp = RTStrStrip(ch);
|
---|
2207 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2208 | strHostPort = RTStrStrip(ch);
|
---|
2209 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2210 | strGuestIp = RTStrStrip(ch);
|
---|
2211 | ITERATE_TO_NEXT_TERM(ch);
|
---|
2212 | strGuestPort = RTStrStrip(ch);
|
---|
2213 | NATProtocol_T proto;
|
---|
2214 | if (RTStrICmp(strProto, "udp") == 0)
|
---|
2215 | proto = NATProtocol_UDP;
|
---|
2216 | else if (RTStrICmp(strProto, "tcp") == 0)
|
---|
2217 | proto = NATProtocol_TCP;
|
---|
2218 | else
|
---|
2219 | {
|
---|
2220 | errorArgument(ModifyVM::tr("Invalid proto '%s' specfied for NIC %u"), ValueUnion.psz, GetOptState.uIndex);
|
---|
2221 | hrc = E_FAIL;
|
---|
2222 | break;
|
---|
2223 | }
|
---|
2224 | CHECK_ERROR(engine, AddRedirect(Bstr(strName).raw(), proto,
|
---|
2225 | Bstr(strHostIp).raw(),
|
---|
2226 | RTStrToUInt16(strHostPort),
|
---|
2227 | Bstr(strGuestIp).raw(),
|
---|
2228 | RTStrToUInt16(strGuestPort)));
|
---|
2229 | }
|
---|
2230 | else
|
---|
2231 | {
|
---|
2232 | /* delete NAT Rule operation */
|
---|
2233 | int vrc;
|
---|
2234 | vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
2235 | if (RT_FAILURE(vrc))
|
---|
2236 | return errorSyntax(ModifyVM::tr("Not enough parameters"));
|
---|
2237 | CHECK_ERROR(engine, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
|
---|
2238 | }
|
---|
2239 | break;
|
---|
2240 | }
|
---|
2241 | #undef ITERATE_TO_NEXT_TERM
|
---|
2242 | case MODIFYVM_NATALIASMODE:
|
---|
2243 | {
|
---|
2244 | ComPtr<INetworkAdapter> nic;
|
---|
2245 | ComPtr<INATEngine> engine;
|
---|
2246 | uint32_t aliasMode = 0;
|
---|
2247 |
|
---|
2248 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2249 | ASSERT(nic);
|
---|
2250 |
|
---|
2251 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2252 | if (RTStrCmp(ValueUnion.psz, "default") == 0)
|
---|
2253 | aliasMode = 0;
|
---|
2254 | else
|
---|
2255 | {
|
---|
2256 | char *token = (char *)ValueUnion.psz;
|
---|
2257 | while (token)
|
---|
2258 | {
|
---|
2259 | if (RTStrNCmp(token, RT_STR_TUPLE("log")) == 0)
|
---|
2260 | aliasMode |= NATAliasMode_AliasLog;
|
---|
2261 | else if (RTStrNCmp(token, RT_STR_TUPLE("proxyonly")) == 0)
|
---|
2262 | aliasMode |= NATAliasMode_AliasProxyOnly;
|
---|
2263 | else if (RTStrNCmp(token, RT_STR_TUPLE("sameports")) == 0)
|
---|
2264 | aliasMode |= NATAliasMode_AliasUseSamePorts;
|
---|
2265 | token = RTStrStr(token, ",");
|
---|
2266 | if (token == NULL)
|
---|
2267 | break;
|
---|
2268 | token++;
|
---|
2269 | }
|
---|
2270 | }
|
---|
2271 | CHECK_ERROR(engine, COMSETTER(AliasMode)(aliasMode));
|
---|
2272 | break;
|
---|
2273 | }
|
---|
2274 |
|
---|
2275 | case MODIFYVM_NATTFTPPREFIX:
|
---|
2276 | {
|
---|
2277 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2278 | break;
|
---|
2279 |
|
---|
2280 | ComPtr<INetworkAdapter> nic;
|
---|
2281 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2282 | ASSERT(nic);
|
---|
2283 |
|
---|
2284 | ComPtr<INATEngine> engine;
|
---|
2285 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2286 |
|
---|
2287 | CHECK_ERROR(engine, COMSETTER(TFTPPrefix)(Bstr(ValueUnion.psz).raw()));
|
---|
2288 | break;
|
---|
2289 | }
|
---|
2290 |
|
---|
2291 | case MODIFYVM_NATTFTPFILE:
|
---|
2292 | {
|
---|
2293 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2294 | break;
|
---|
2295 |
|
---|
2296 | ComPtr<INetworkAdapter> nic;
|
---|
2297 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2298 | ASSERT(nic);
|
---|
2299 |
|
---|
2300 | ComPtr<INATEngine> engine;
|
---|
2301 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2302 |
|
---|
2303 | CHECK_ERROR(engine, COMSETTER(TFTPBootFile)(Bstr(ValueUnion.psz).raw()));
|
---|
2304 | break;
|
---|
2305 | }
|
---|
2306 |
|
---|
2307 | case MODIFYVM_NATTFTPSERVER:
|
---|
2308 | {
|
---|
2309 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2310 | break;
|
---|
2311 |
|
---|
2312 | ComPtr<INetworkAdapter> nic;
|
---|
2313 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2314 | ASSERT(nic);
|
---|
2315 |
|
---|
2316 | ComPtr<INATEngine> engine;
|
---|
2317 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2318 |
|
---|
2319 | CHECK_ERROR(engine, COMSETTER(TFTPNextServer)(Bstr(ValueUnion.psz).raw()));
|
---|
2320 | break;
|
---|
2321 | }
|
---|
2322 | case MODIFYVM_NATDNSPASSDOMAIN:
|
---|
2323 | {
|
---|
2324 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2325 | break;
|
---|
2326 |
|
---|
2327 | ComPtr<INetworkAdapter> nic;
|
---|
2328 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2329 | ASSERT(nic);
|
---|
2330 |
|
---|
2331 | ComPtr<INATEngine> engine;
|
---|
2332 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2333 |
|
---|
2334 | CHECK_ERROR(engine, COMSETTER(DNSPassDomain)(ValueUnion.f));
|
---|
2335 | break;
|
---|
2336 | }
|
---|
2337 |
|
---|
2338 | case MODIFYVM_NATDNSPROXY:
|
---|
2339 | {
|
---|
2340 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2341 | break;
|
---|
2342 |
|
---|
2343 | ComPtr<INetworkAdapter> nic;
|
---|
2344 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2345 | ASSERT(nic);
|
---|
2346 |
|
---|
2347 | ComPtr<INATEngine> engine;
|
---|
2348 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2349 |
|
---|
2350 | CHECK_ERROR(engine, COMSETTER(DNSProxy)(ValueUnion.f));
|
---|
2351 | break;
|
---|
2352 | }
|
---|
2353 |
|
---|
2354 | case MODIFYVM_NATDNSHOSTRESOLVER:
|
---|
2355 | {
|
---|
2356 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2357 | break;
|
---|
2358 |
|
---|
2359 | ComPtr<INetworkAdapter> nic;
|
---|
2360 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2361 | ASSERT(nic);
|
---|
2362 |
|
---|
2363 | ComPtr<INATEngine> engine;
|
---|
2364 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2365 |
|
---|
2366 | CHECK_ERROR(engine, COMSETTER(DNSUseHostResolver)(ValueUnion.f));
|
---|
2367 | break;
|
---|
2368 | }
|
---|
2369 |
|
---|
2370 | case MODIFYVM_NATLOCALHOSTREACHABLE:
|
---|
2371 | {
|
---|
2372 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2373 | break;
|
---|
2374 |
|
---|
2375 | ComPtr<INetworkAdapter> nic;
|
---|
2376 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2377 | ASSERT(nic);
|
---|
2378 |
|
---|
2379 | ComPtr<INATEngine> engine;
|
---|
2380 | CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
|
---|
2381 |
|
---|
2382 | CHECK_ERROR(engine, COMSETTER(LocalhostReachable)(ValueUnion.f));
|
---|
2383 | break;
|
---|
2384 | }
|
---|
2385 |
|
---|
2386 | case MODIFYVM_MACADDRESS:
|
---|
2387 | {
|
---|
2388 | if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
|
---|
2389 | break;
|
---|
2390 |
|
---|
2391 | ComPtr<INetworkAdapter> nic;
|
---|
2392 | CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
|
---|
2393 | ASSERT(nic);
|
---|
2394 |
|
---|
2395 | /* generate one? */
|
---|
2396 | if (!RTStrICmp(ValueUnion.psz, "auto"))
|
---|
2397 | {
|
---|
2398 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr().raw()));
|
---|
2399 | }
|
---|
2400 | else
|
---|
2401 | {
|
---|
2402 | CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
2403 | }
|
---|
2404 | break;
|
---|
2405 | }
|
---|
2406 |
|
---|
2407 | case MODIFYVM_HIDPTR:
|
---|
2408 | {
|
---|
2409 | bool fEnableUsb = false;
|
---|
2410 | if (!RTStrICmp(ValueUnion.psz, "ps2"))
|
---|
2411 | {
|
---|
2412 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_PS2Mouse));
|
---|
2413 | }
|
---|
2414 | else if (!RTStrICmp(ValueUnion.psz, "usb"))
|
---|
2415 | {
|
---|
2416 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBMouse));
|
---|
2417 | if (SUCCEEDED(hrc))
|
---|
2418 | fEnableUsb = true;
|
---|
2419 | }
|
---|
2420 | else if (!RTStrICmp(ValueUnion.psz, "usbtablet"))
|
---|
2421 | {
|
---|
2422 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBTablet));
|
---|
2423 | if (SUCCEEDED(hrc))
|
---|
2424 | fEnableUsb = true;
|
---|
2425 | }
|
---|
2426 | else if (!RTStrICmp(ValueUnion.psz, "usbmultitouch"))
|
---|
2427 | {
|
---|
2428 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBMultiTouch));
|
---|
2429 | if (SUCCEEDED(hrc))
|
---|
2430 | fEnableUsb = true;
|
---|
2431 | }
|
---|
2432 | else if (!RTStrICmp(ValueUnion.psz, "usbmtscreenpluspad"))
|
---|
2433 | {
|
---|
2434 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBMultiTouchScreenPlusPad));
|
---|
2435 | if (SUCCEEDED(hrc))
|
---|
2436 | fEnableUsb = true;
|
---|
2437 | }
|
---|
2438 | else if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
2439 | {
|
---|
2440 | CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_None));
|
---|
2441 | }
|
---|
2442 | else
|
---|
2443 | {
|
---|
2444 | errorArgument(ModifyVM::tr("Invalid type '%s' specfied for pointing device"), ValueUnion.psz);
|
---|
2445 | hrc = E_FAIL;
|
---|
2446 | }
|
---|
2447 | if (fEnableUsb)
|
---|
2448 | {
|
---|
2449 | /* Make sure either the OHCI or xHCI controller is enabled. */
|
---|
2450 | ULONG cOhciCtrls = 0;
|
---|
2451 | ULONG cXhciCtrls = 0;
|
---|
2452 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
|
---|
2453 | if (SUCCEEDED(hrc)) {
|
---|
2454 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_XHCI, &cXhciCtrls);
|
---|
2455 | if ( SUCCEEDED(hrc)
|
---|
2456 | && cOhciCtrls + cXhciCtrls == 0)
|
---|
2457 | {
|
---|
2458 | /* If there's nothing, enable OHCI (always available). */
|
---|
2459 | ComPtr<IUSBController> UsbCtl;
|
---|
2460 | CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
|
---|
2461 | UsbCtl.asOutParam()));
|
---|
2462 | }
|
---|
2463 | }
|
---|
2464 | }
|
---|
2465 | break;
|
---|
2466 | }
|
---|
2467 |
|
---|
2468 | case MODIFYVM_HIDKBD:
|
---|
2469 | {
|
---|
2470 | bool fEnableUsb = false;
|
---|
2471 | if (!RTStrICmp(ValueUnion.psz, "ps2"))
|
---|
2472 | {
|
---|
2473 | CHECK_ERROR(sessionMachine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_PS2Keyboard));
|
---|
2474 | }
|
---|
2475 | else if (!RTStrICmp(ValueUnion.psz, "usb"))
|
---|
2476 | {
|
---|
2477 | CHECK_ERROR(sessionMachine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_USBKeyboard));
|
---|
2478 | if (SUCCEEDED(hrc))
|
---|
2479 | fEnableUsb = true;
|
---|
2480 | }
|
---|
2481 | else if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
2482 | {
|
---|
2483 | CHECK_ERROR(sessionMachine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_None));
|
---|
2484 | if (SUCCEEDED(hrc))
|
---|
2485 | fEnableUsb = true;
|
---|
2486 | }
|
---|
2487 | else
|
---|
2488 | {
|
---|
2489 | errorArgument(ModifyVM::tr("Invalid type '%s' specfied for keyboard"), ValueUnion.psz);
|
---|
2490 | hrc = E_FAIL;
|
---|
2491 | }
|
---|
2492 | if (fEnableUsb)
|
---|
2493 | {
|
---|
2494 | /* Make sure either the OHCI or xHCI controller is enabled. */
|
---|
2495 | ULONG cOhciCtrls = 0;
|
---|
2496 | ULONG cXhciCtrls = 0;
|
---|
2497 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
|
---|
2498 | if (SUCCEEDED(hrc)) {
|
---|
2499 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_XHCI, &cXhciCtrls);
|
---|
2500 | if ( SUCCEEDED(hrc)
|
---|
2501 | && cOhciCtrls + cXhciCtrls == 0)
|
---|
2502 | {
|
---|
2503 | /* If there's nothing, enable OHCI (always available). */
|
---|
2504 | ComPtr<IUSBController> UsbCtl;
|
---|
2505 | CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
|
---|
2506 | UsbCtl.asOutParam()));
|
---|
2507 | }
|
---|
2508 | }
|
---|
2509 | }
|
---|
2510 | break;
|
---|
2511 | }
|
---|
2512 |
|
---|
2513 | case MODIFYVM_UARTMODE:
|
---|
2514 | {
|
---|
2515 | ComPtr<ISerialPort> uart;
|
---|
2516 |
|
---|
2517 | CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
2518 | ASSERT(uart);
|
---|
2519 |
|
---|
2520 | if (!RTStrICmp(ValueUnion.psz, "disconnected"))
|
---|
2521 | {
|
---|
2522 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
|
---|
2523 | }
|
---|
2524 | else if ( !RTStrICmp(ValueUnion.psz, "server")
|
---|
2525 | || !RTStrICmp(ValueUnion.psz, "client")
|
---|
2526 | || !RTStrICmp(ValueUnion.psz, "tcpserver")
|
---|
2527 | || !RTStrICmp(ValueUnion.psz, "tcpclient")
|
---|
2528 | || !RTStrICmp(ValueUnion.psz, "file"))
|
---|
2529 | {
|
---|
2530 | const char *pszMode = ValueUnion.psz;
|
---|
2531 |
|
---|
2532 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
2533 | if (RT_FAILURE(vrc))
|
---|
2534 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"),
|
---|
2535 | GetOptState.pDef->pszLong);
|
---|
2536 |
|
---|
2537 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
2538 |
|
---|
2539 | if (!RTStrICmp(pszMode, "server"))
|
---|
2540 | {
|
---|
2541 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
2542 | CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
|
---|
2543 | }
|
---|
2544 | else if (!RTStrICmp(pszMode, "client"))
|
---|
2545 | {
|
---|
2546 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
|
---|
2547 | CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
|
---|
2548 | }
|
---|
2549 | else if (!RTStrICmp(pszMode, "tcpserver"))
|
---|
2550 | {
|
---|
2551 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_TCP));
|
---|
2552 | CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
|
---|
2553 | }
|
---|
2554 | else if (!RTStrICmp(pszMode, "tcpclient"))
|
---|
2555 | {
|
---|
2556 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_TCP));
|
---|
2557 | CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
|
---|
2558 | }
|
---|
2559 | else if (!RTStrICmp(pszMode, "file"))
|
---|
2560 | {
|
---|
2561 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
|
---|
2562 | }
|
---|
2563 | }
|
---|
2564 | else
|
---|
2565 | {
|
---|
2566 | CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
2567 | CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
|
---|
2568 | }
|
---|
2569 | break;
|
---|
2570 | }
|
---|
2571 |
|
---|
2572 | case MODIFYVM_UARTTYPE:
|
---|
2573 | {
|
---|
2574 | ComPtr<ISerialPort> uart;
|
---|
2575 |
|
---|
2576 | CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
2577 | ASSERT(uart);
|
---|
2578 |
|
---|
2579 | if (!RTStrICmp(ValueUnion.psz, "16450"))
|
---|
2580 | {
|
---|
2581 | CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16450));
|
---|
2582 | }
|
---|
2583 | else if (!RTStrICmp(ValueUnion.psz, "16550A"))
|
---|
2584 | {
|
---|
2585 | CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16550A));
|
---|
2586 | }
|
---|
2587 | else if (!RTStrICmp(ValueUnion.psz, "16750"))
|
---|
2588 | {
|
---|
2589 | CHECK_ERROR(uart, COMSETTER(UartType)(UartType_U16750));
|
---|
2590 | }
|
---|
2591 | else
|
---|
2592 | return errorSyntax(ModifyVM::tr("Invalid argument to '%s'"),
|
---|
2593 | GetOptState.pDef->pszLong);
|
---|
2594 | break;
|
---|
2595 | }
|
---|
2596 |
|
---|
2597 | case MODIFYVM_UART:
|
---|
2598 | {
|
---|
2599 | ComPtr<ISerialPort> uart;
|
---|
2600 |
|
---|
2601 | CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
|
---|
2602 | ASSERT(uart);
|
---|
2603 |
|
---|
2604 | if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
|
---|
2605 | CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
|
---|
2606 | else
|
---|
2607 | {
|
---|
2608 | const char *pszIOBase = ValueUnion.psz;
|
---|
2609 | uint32_t uVal = 0;
|
---|
2610 |
|
---|
2611 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
|
---|
2612 | if (RT_FAILURE(vrc))
|
---|
2613 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"),
|
---|
2614 | GetOptState.pDef->pszLong);
|
---|
2615 |
|
---|
2616 | CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
2617 |
|
---|
2618 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
2619 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
2620 | return errorArgument(ModifyVM::tr("Error parsing UART I/O base '%s'"), pszIOBase);
|
---|
2621 | CHECK_ERROR(uart, COMSETTER(IOAddress)(uVal));
|
---|
2622 |
|
---|
2623 | CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
|
---|
2624 | }
|
---|
2625 | break;
|
---|
2626 | }
|
---|
2627 |
|
---|
2628 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
2629 | case MODIFYVM_LPTMODE:
|
---|
2630 | {
|
---|
2631 | ComPtr<IParallelPort> lpt;
|
---|
2632 |
|
---|
2633 | CHECK_ERROR_BREAK(sessionMachine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
|
---|
2634 | ASSERT(lpt);
|
---|
2635 |
|
---|
2636 | CHECK_ERROR(lpt, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
|
---|
2637 | break;
|
---|
2638 | }
|
---|
2639 |
|
---|
2640 | case MODIFYVM_LPT:
|
---|
2641 | {
|
---|
2642 | ComPtr<IParallelPort> lpt;
|
---|
2643 |
|
---|
2644 | CHECK_ERROR_BREAK(sessionMachine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
|
---|
2645 | ASSERT(lpt);
|
---|
2646 |
|
---|
2647 | if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
|
---|
2648 | CHECK_ERROR(lpt, COMSETTER(Enabled)(FALSE));
|
---|
2649 | else
|
---|
2650 | {
|
---|
2651 | const char *pszIOBase = ValueUnion.psz;
|
---|
2652 | uint32_t uVal = 0;
|
---|
2653 |
|
---|
2654 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_LPT;
|
---|
2655 | if (RT_FAILURE(vrc))
|
---|
2656 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"),
|
---|
2657 | GetOptState.pDef->pszLong);
|
---|
2658 |
|
---|
2659 | CHECK_ERROR(lpt, COMSETTER(IRQ)(ValueUnion.u32));
|
---|
2660 |
|
---|
2661 | vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
|
---|
2662 | if (vrc != VINF_SUCCESS || uVal == 0)
|
---|
2663 | return errorArgument(ModifyVM::tr("Error parsing LPT I/O base '%s'"), pszIOBase);
|
---|
2664 | CHECK_ERROR(lpt, COMSETTER(IOBase)(uVal));
|
---|
2665 |
|
---|
2666 | CHECK_ERROR(lpt, COMSETTER(Enabled)(TRUE));
|
---|
2667 | }
|
---|
2668 | break;
|
---|
2669 | }
|
---|
2670 | #endif
|
---|
2671 |
|
---|
2672 | case MODIFYVM_GUESTMEMORYBALLOON:
|
---|
2673 | {
|
---|
2674 | CHECK_ERROR(sessionMachine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
|
---|
2675 | break;
|
---|
2676 | }
|
---|
2677 |
|
---|
2678 | case MODIFYVM_AUDIOCONTROLLER:
|
---|
2679 | {
|
---|
2680 | ComPtr<IAudioSettings> audioSettings;
|
---|
2681 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2682 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2683 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2684 | ASSERT(audioAdapter);
|
---|
2685 |
|
---|
2686 | if (!RTStrICmp(ValueUnion.psz, "sb16"))
|
---|
2687 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
|
---|
2688 | else if (!RTStrICmp(ValueUnion.psz, "ac97"))
|
---|
2689 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
|
---|
2690 | else if (!RTStrICmp(ValueUnion.psz, "hda"))
|
---|
2691 | CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_HDA));
|
---|
2692 | else
|
---|
2693 | {
|
---|
2694 | errorArgument(ModifyVM::tr("Invalid --audiocontroller argument '%s'"), ValueUnion.psz);
|
---|
2695 | hrc = E_FAIL;
|
---|
2696 | }
|
---|
2697 | break;
|
---|
2698 | }
|
---|
2699 |
|
---|
2700 | case MODIFYVM_AUDIOCODEC:
|
---|
2701 | {
|
---|
2702 | ComPtr<IAudioSettings> audioSettings;
|
---|
2703 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2704 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2705 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2706 | ASSERT(audioAdapter);
|
---|
2707 |
|
---|
2708 | if (!RTStrICmp(ValueUnion.psz, "sb16"))
|
---|
2709 | CHECK_ERROR(audioAdapter, COMSETTER(AudioCodec)(AudioCodecType_SB16));
|
---|
2710 | else if (!RTStrICmp(ValueUnion.psz, "stac9700"))
|
---|
2711 | CHECK_ERROR(audioAdapter, COMSETTER(AudioCodec)(AudioCodecType_STAC9700));
|
---|
2712 | else if (!RTStrICmp(ValueUnion.psz, "ad1980"))
|
---|
2713 | CHECK_ERROR(audioAdapter, COMSETTER(AudioCodec)(AudioCodecType_AD1980));
|
---|
2714 | else if (!RTStrICmp(ValueUnion.psz, "stac9221"))
|
---|
2715 | CHECK_ERROR(audioAdapter, COMSETTER(AudioCodec)(AudioCodecType_STAC9221));
|
---|
2716 | else
|
---|
2717 | {
|
---|
2718 | errorArgument(ModifyVM::tr("Invalid --audiocodec argument '%s'"), ValueUnion.psz);
|
---|
2719 | hrc = E_FAIL;
|
---|
2720 | }
|
---|
2721 | break;
|
---|
2722 | }
|
---|
2723 |
|
---|
2724 | case MODIFYVM_AUDIODRIVER:
|
---|
2725 | RT_FALL_THROUGH();
|
---|
2726 | case MODIFYVM_AUDIO: /** @todo Deprecated; remove. */
|
---|
2727 | {
|
---|
2728 | if (c == MODIFYVM_AUDIO)
|
---|
2729 | RTStrmPrintf(g_pStdErr,
|
---|
2730 | ModifyVM::tr("Warning: --audio is deprecated and will be removed soon. Use --audio-driver instead!\n"));
|
---|
2731 |
|
---|
2732 | ComPtr<IAudioSettings> audioSettings;
|
---|
2733 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2734 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2735 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2736 | ASSERT(audioAdapter);
|
---|
2737 | /* disable? */
|
---|
2738 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
2739 | || !RTStrICmp(ValueUnion.psz, "null"))
|
---|
2740 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
|
---|
2741 | else if (!RTStrICmp(ValueUnion.psz, "default"))
|
---|
2742 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Default));
|
---|
2743 | #ifdef RT_OS_WINDOWS
|
---|
2744 | # ifdef VBOX_WITH_WINMM
|
---|
2745 | else if (!RTStrICmp(ValueUnion.psz, "winmm"))
|
---|
2746 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
|
---|
2747 | # endif
|
---|
2748 | else if (!RTStrICmp(ValueUnion.psz, "dsound"))
|
---|
2749 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
|
---|
2750 | else if (!RTStrICmp(ValueUnion.psz, "was"))
|
---|
2751 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WAS));
|
---|
2752 | #endif /* RT_OS_WINDOWS */
|
---|
2753 | #ifdef VBOX_WITH_AUDIO_OSS
|
---|
2754 | else if (!RTStrICmp(ValueUnion.psz, "oss"))
|
---|
2755 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
|
---|
2756 | #endif
|
---|
2757 | #ifdef VBOX_WITH_AUDIO_ALSA
|
---|
2758 | else if (!RTStrICmp(ValueUnion.psz, "alsa"))
|
---|
2759 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
|
---|
2760 | #endif
|
---|
2761 | #ifdef VBOX_WITH_AUDIO_PULSE
|
---|
2762 | else if (!RTStrICmp(ValueUnion.psz, "pulse"))
|
---|
2763 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
|
---|
2764 | #endif
|
---|
2765 | #ifdef RT_OS_DARWIN
|
---|
2766 | else if (!RTStrICmp(ValueUnion.psz, "coreaudio"))
|
---|
2767 | CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
|
---|
2768 | #endif /* !RT_OS_DARWIN */
|
---|
2769 | else
|
---|
2770 | {
|
---|
2771 | errorArgument(ModifyVM::tr("Invalid %s argument '%s'"),
|
---|
2772 | c == MODIFYVM_AUDIO ? "--audio" : "--audio-driver", ValueUnion.psz);
|
---|
2773 | hrc = E_FAIL;
|
---|
2774 | }
|
---|
2775 |
|
---|
2776 | if ( SUCCEEDED(hrc)
|
---|
2777 | && c == MODIFYVM_AUDIO) /* To keep the original behavior until we remove the command. */
|
---|
2778 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(RTStrICmp(ValueUnion.psz, "none") == false ? false : true));
|
---|
2779 |
|
---|
2780 | break;
|
---|
2781 | }
|
---|
2782 |
|
---|
2783 | case MODIFYVM_AUDIOENABLED:
|
---|
2784 | {
|
---|
2785 | ComPtr<IAudioSettings> audioSettings;
|
---|
2786 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2787 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2788 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2789 | ASSERT(audioAdapter);
|
---|
2790 |
|
---|
2791 | CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(ValueUnion.f));
|
---|
2792 | break;
|
---|
2793 | }
|
---|
2794 |
|
---|
2795 | case MODIFYVM_AUDIOIN:
|
---|
2796 | {
|
---|
2797 | ComPtr<IAudioSettings> audioSettings;
|
---|
2798 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2799 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2800 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2801 | ASSERT(audioAdapter);
|
---|
2802 |
|
---|
2803 | CHECK_ERROR(audioAdapter, COMSETTER(EnabledIn)(ValueUnion.f));
|
---|
2804 | break;
|
---|
2805 | }
|
---|
2806 |
|
---|
2807 | case MODIFYVM_AUDIOOUT:
|
---|
2808 | {
|
---|
2809 | ComPtr<IAudioSettings> audioSettings;
|
---|
2810 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
|
---|
2811 | ComPtr<IAudioAdapter> audioAdapter;
|
---|
2812 | CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
|
---|
2813 | ASSERT(audioAdapter);
|
---|
2814 |
|
---|
2815 | CHECK_ERROR(audioAdapter, COMSETTER(EnabledOut)(ValueUnion.f));
|
---|
2816 | break;
|
---|
2817 | }
|
---|
2818 |
|
---|
2819 | #ifdef VBOX_WITH_SHARED_CLIPBOARD
|
---|
2820 | case MODIFYVM_CLIPBOARD_MODE:
|
---|
2821 | {
|
---|
2822 | ClipboardMode_T mode = ClipboardMode_Disabled; /* Shut up MSC */
|
---|
2823 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
2824 | mode = ClipboardMode_Disabled;
|
---|
2825 | else if (!RTStrICmp(ValueUnion.psz, "hosttoguest"))
|
---|
2826 | mode = ClipboardMode_HostToGuest;
|
---|
2827 | else if (!RTStrICmp(ValueUnion.psz, "guesttohost"))
|
---|
2828 | mode = ClipboardMode_GuestToHost;
|
---|
2829 | else if (!RTStrICmp(ValueUnion.psz, "bidirectional"))
|
---|
2830 | mode = ClipboardMode_Bidirectional;
|
---|
2831 | else
|
---|
2832 | {
|
---|
2833 | errorArgument(ModifyVM::tr("Invalid --clipboard-mode argument '%s'"), ValueUnion.psz);
|
---|
2834 | hrc = E_FAIL;
|
---|
2835 | }
|
---|
2836 | if (SUCCEEDED(hrc))
|
---|
2837 | {
|
---|
2838 | CHECK_ERROR(sessionMachine, COMSETTER(ClipboardMode)(mode));
|
---|
2839 | }
|
---|
2840 | break;
|
---|
2841 | }
|
---|
2842 |
|
---|
2843 | # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
|
---|
2844 | case MODIFYVM_CLIPBOARD_FILE_TRANSFERS:
|
---|
2845 | {
|
---|
2846 | BOOL fEnabled = false; /* Shut up MSC */
|
---|
2847 | if (!RTStrICmp(ValueUnion.psz, "enabled"))
|
---|
2848 | fEnabled = true;
|
---|
2849 | else if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
2850 | fEnabled = false;
|
---|
2851 | else
|
---|
2852 | {
|
---|
2853 | errorArgument(ModifyVM::tr("Invalid --clipboard-file-transfers argument '%s'"), ValueUnion.psz);
|
---|
2854 | hrc = E_FAIL;
|
---|
2855 | }
|
---|
2856 | if (SUCCEEDED(hrc))
|
---|
2857 | {
|
---|
2858 | CHECK_ERROR(sessionMachine, COMSETTER(ClipboardFileTransfersEnabled)(fEnabled));
|
---|
2859 | }
|
---|
2860 | break;
|
---|
2861 | }
|
---|
2862 | # endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
|
---|
2863 | #endif /* VBOX_WITH_SHARED_CLIPBOARD */
|
---|
2864 |
|
---|
2865 | case MODIFYVM_DRAGANDDROP:
|
---|
2866 | {
|
---|
2867 | DnDMode_T mode = DnDMode_Disabled; /* Shut up MSC */
|
---|
2868 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
2869 | mode = DnDMode_Disabled;
|
---|
2870 | else if (!RTStrICmp(ValueUnion.psz, "hosttoguest"))
|
---|
2871 | mode = DnDMode_HostToGuest;
|
---|
2872 | else if (!RTStrICmp(ValueUnion.psz, "guesttohost"))
|
---|
2873 | mode = DnDMode_GuestToHost;
|
---|
2874 | else if (!RTStrICmp(ValueUnion.psz, "bidirectional"))
|
---|
2875 | mode = DnDMode_Bidirectional;
|
---|
2876 | else
|
---|
2877 | {
|
---|
2878 | errorArgument(ModifyVM::tr("Invalid --draganddrop argument '%s'"), ValueUnion.psz);
|
---|
2879 | hrc = E_FAIL;
|
---|
2880 | }
|
---|
2881 | if (SUCCEEDED(hrc))
|
---|
2882 | {
|
---|
2883 | CHECK_ERROR(sessionMachine, COMSETTER(DnDMode)(mode));
|
---|
2884 | }
|
---|
2885 | break;
|
---|
2886 | }
|
---|
2887 |
|
---|
2888 | case MODIFYVM_VRDE_EXTPACK:
|
---|
2889 | {
|
---|
2890 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2891 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2892 | ASSERT(vrdeServer);
|
---|
2893 |
|
---|
2894 | if (vrdeServer)
|
---|
2895 | {
|
---|
2896 | if (RTStrICmp(ValueUnion.psz, "default") != 0)
|
---|
2897 | {
|
---|
2898 | Bstr bstr(ValueUnion.psz);
|
---|
2899 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
|
---|
2900 | }
|
---|
2901 | else
|
---|
2902 | CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(Bstr().raw()));
|
---|
2903 | }
|
---|
2904 | break;
|
---|
2905 | }
|
---|
2906 |
|
---|
2907 | case MODIFYVM_VRDEPROPERTY:
|
---|
2908 | {
|
---|
2909 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2910 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2911 | ASSERT(vrdeServer);
|
---|
2912 |
|
---|
2913 | if (vrdeServer)
|
---|
2914 | {
|
---|
2915 | /* Parse 'name=value' */
|
---|
2916 | char *pszProperty = RTStrDup(ValueUnion.psz);
|
---|
2917 | if (pszProperty)
|
---|
2918 | {
|
---|
2919 | char *pDelimiter = strchr(pszProperty, '=');
|
---|
2920 | if (pDelimiter)
|
---|
2921 | {
|
---|
2922 | *pDelimiter = '\0';
|
---|
2923 |
|
---|
2924 | Bstr bstrName = pszProperty;
|
---|
2925 | Bstr bstrValue = &pDelimiter[1];
|
---|
2926 | CHECK_ERROR(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw()));
|
---|
2927 | }
|
---|
2928 | else
|
---|
2929 | {
|
---|
2930 | RTStrFree(pszProperty);
|
---|
2931 |
|
---|
2932 | errorArgument(ModifyVM::tr("Invalid --vrdeproperty argument '%s'"), ValueUnion.psz);
|
---|
2933 | hrc = E_FAIL;
|
---|
2934 | break;
|
---|
2935 | }
|
---|
2936 | RTStrFree(pszProperty);
|
---|
2937 | }
|
---|
2938 | else
|
---|
2939 | {
|
---|
2940 | RTStrmPrintf(g_pStdErr, ModifyVM::tr("Error: Failed to allocate memory for VRDE property '%s'\n"),
|
---|
2941 | ValueUnion.psz);
|
---|
2942 | hrc = E_FAIL;
|
---|
2943 | }
|
---|
2944 | }
|
---|
2945 | break;
|
---|
2946 | }
|
---|
2947 |
|
---|
2948 | case MODIFYVM_VRDPPORT:
|
---|
2949 | vrdeWarningDeprecatedOption("port");
|
---|
2950 | RT_FALL_THRU();
|
---|
2951 |
|
---|
2952 | case MODIFYVM_VRDEPORT:
|
---|
2953 | {
|
---|
2954 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2955 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2956 | ASSERT(vrdeServer);
|
---|
2957 |
|
---|
2958 | if (!RTStrICmp(ValueUnion.psz, "default"))
|
---|
2959 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr("0").raw()));
|
---|
2960 | else
|
---|
2961 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
2962 | break;
|
---|
2963 | }
|
---|
2964 |
|
---|
2965 | case MODIFYVM_VRDPADDRESS:
|
---|
2966 | vrdeWarningDeprecatedOption("address");
|
---|
2967 | RT_FALL_THRU();
|
---|
2968 |
|
---|
2969 | case MODIFYVM_VRDEADDRESS:
|
---|
2970 | {
|
---|
2971 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2972 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2973 | ASSERT(vrdeServer);
|
---|
2974 |
|
---|
2975 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
|
---|
2976 | break;
|
---|
2977 | }
|
---|
2978 |
|
---|
2979 | case MODIFYVM_VRDPAUTHTYPE:
|
---|
2980 | vrdeWarningDeprecatedOption("authtype");
|
---|
2981 | RT_FALL_THRU();
|
---|
2982 | case MODIFYVM_VRDEAUTHTYPE:
|
---|
2983 | {
|
---|
2984 | ComPtr<IVRDEServer> vrdeServer;
|
---|
2985 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
2986 | ASSERT(vrdeServer);
|
---|
2987 |
|
---|
2988 | if (!RTStrICmp(ValueUnion.psz, "null"))
|
---|
2989 | {
|
---|
2990 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
|
---|
2991 | }
|
---|
2992 | else if (!RTStrICmp(ValueUnion.psz, "external"))
|
---|
2993 | {
|
---|
2994 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
|
---|
2995 | }
|
---|
2996 | else if (!RTStrICmp(ValueUnion.psz, "guest"))
|
---|
2997 | {
|
---|
2998 | CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Guest));
|
---|
2999 | }
|
---|
3000 | else
|
---|
3001 | {
|
---|
3002 | errorArgument(ModifyVM::tr("Invalid --vrdeauthtype argument '%s'"), ValueUnion.psz);
|
---|
3003 | hrc = E_FAIL;
|
---|
3004 | }
|
---|
3005 | break;
|
---|
3006 | }
|
---|
3007 |
|
---|
3008 | case MODIFYVM_VRDEAUTHLIBRARY:
|
---|
3009 | {
|
---|
3010 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3011 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3012 | ASSERT(vrdeServer);
|
---|
3013 |
|
---|
3014 | if (vrdeServer)
|
---|
3015 | {
|
---|
3016 | if (RTStrICmp(ValueUnion.psz, "default") != 0)
|
---|
3017 | {
|
---|
3018 | Bstr bstr(ValueUnion.psz);
|
---|
3019 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
|
---|
3020 | }
|
---|
3021 | else
|
---|
3022 | CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(Bstr().raw()));
|
---|
3023 | }
|
---|
3024 | break;
|
---|
3025 | }
|
---|
3026 |
|
---|
3027 | case MODIFYVM_VRDPMULTICON:
|
---|
3028 | vrdeWarningDeprecatedOption("multicon");
|
---|
3029 | RT_FALL_THRU();
|
---|
3030 | case MODIFYVM_VRDEMULTICON:
|
---|
3031 | {
|
---|
3032 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3033 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3034 | ASSERT(vrdeServer);
|
---|
3035 |
|
---|
3036 | CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
|
---|
3037 | break;
|
---|
3038 | }
|
---|
3039 |
|
---|
3040 | case MODIFYVM_VRDPREUSECON:
|
---|
3041 | vrdeWarningDeprecatedOption("reusecon");
|
---|
3042 | RT_FALL_THRU();
|
---|
3043 | case MODIFYVM_VRDEREUSECON:
|
---|
3044 | {
|
---|
3045 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3046 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3047 | ASSERT(vrdeServer);
|
---|
3048 |
|
---|
3049 | CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
|
---|
3050 | break;
|
---|
3051 | }
|
---|
3052 |
|
---|
3053 | case MODIFYVM_VRDPVIDEOCHANNEL:
|
---|
3054 | vrdeWarningDeprecatedOption("videochannel");
|
---|
3055 | RT_FALL_THRU();
|
---|
3056 | case MODIFYVM_VRDEVIDEOCHANNEL:
|
---|
3057 | {
|
---|
3058 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3059 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3060 | ASSERT(vrdeServer);
|
---|
3061 |
|
---|
3062 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
|
---|
3063 | ValueUnion.f? Bstr("true").raw(): Bstr("false").raw()));
|
---|
3064 | break;
|
---|
3065 | }
|
---|
3066 |
|
---|
3067 | case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
|
---|
3068 | vrdeWarningDeprecatedOption("videochannelquality");
|
---|
3069 | RT_FALL_THRU();
|
---|
3070 | case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
|
---|
3071 | {
|
---|
3072 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3073 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3074 | ASSERT(vrdeServer);
|
---|
3075 |
|
---|
3076 | CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
|
---|
3077 | Bstr(ValueUnion.psz).raw()));
|
---|
3078 | break;
|
---|
3079 | }
|
---|
3080 |
|
---|
3081 | case MODIFYVM_VRDP:
|
---|
3082 | vrdeWarningDeprecatedOption("");
|
---|
3083 | RT_FALL_THRU();
|
---|
3084 | case MODIFYVM_VRDE:
|
---|
3085 | {
|
---|
3086 | ComPtr<IVRDEServer> vrdeServer;
|
---|
3087 | sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
|
---|
3088 | ASSERT(vrdeServer);
|
---|
3089 |
|
---|
3090 | CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
|
---|
3091 | break;
|
---|
3092 | }
|
---|
3093 |
|
---|
3094 | case MODIFYVM_USBRENAME:
|
---|
3095 | {
|
---|
3096 | const char *pszName = ValueUnion.psz;
|
---|
3097 | int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
|
---|
3098 | if (RT_FAILURE(vrc))
|
---|
3099 | return errorSyntax(ModifyVM::tr("Missing or invalid argument to '%s'"),
|
---|
3100 | GetOptState.pDef->pszLong);
|
---|
3101 | const char *pszNewName = ValueUnion.psz;
|
---|
3102 |
|
---|
3103 | SafeIfaceArray<IUSBController> ctrls;
|
---|
3104 | CHECK_ERROR(sessionMachine, COMGETTER(USBControllers)(ComSafeArrayAsOutParam(ctrls)));
|
---|
3105 | bool fRenamed = false;
|
---|
3106 | for (size_t i = 0; i < ctrls.size(); i++)
|
---|
3107 | {
|
---|
3108 | ComPtr<IUSBController> pCtrl = ctrls[i];
|
---|
3109 | Bstr bstrName;
|
---|
3110 | CHECK_ERROR(pCtrl, COMGETTER(Name)(bstrName.asOutParam()));
|
---|
3111 | if (bstrName == pszName)
|
---|
3112 | {
|
---|
3113 | bstrName = pszNewName;
|
---|
3114 | CHECK_ERROR(pCtrl, COMSETTER(Name)(bstrName.raw()));
|
---|
3115 | fRenamed = true;
|
---|
3116 | }
|
---|
3117 | }
|
---|
3118 | if (!fRenamed)
|
---|
3119 | {
|
---|
3120 | errorArgument(ModifyVM::tr("Invalid --usbrename parameters, nothing renamed"));
|
---|
3121 | hrc = E_FAIL;
|
---|
3122 | }
|
---|
3123 | break;
|
---|
3124 | }
|
---|
3125 |
|
---|
3126 | case MODIFYVM_USBXHCI:
|
---|
3127 | {
|
---|
3128 | ULONG cXhciCtrls = 0;
|
---|
3129 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_XHCI, &cXhciCtrls);
|
---|
3130 | if (SUCCEEDED(hrc))
|
---|
3131 | {
|
---|
3132 | if (!cXhciCtrls && ValueUnion.f)
|
---|
3133 | {
|
---|
3134 | ComPtr<IUSBController> UsbCtl;
|
---|
3135 | CHECK_ERROR(sessionMachine, AddUSBController(Bstr("xHCI").raw(), USBControllerType_XHCI,
|
---|
3136 | UsbCtl.asOutParam()));
|
---|
3137 | }
|
---|
3138 | else if (cXhciCtrls && !ValueUnion.f)
|
---|
3139 | {
|
---|
3140 | SafeIfaceArray<IUSBController> ctrls;
|
---|
3141 | CHECK_ERROR(sessionMachine, COMGETTER(USBControllers)(ComSafeArrayAsOutParam(ctrls)));
|
---|
3142 | for (size_t i = 0; i < ctrls.size(); i++)
|
---|
3143 | {
|
---|
3144 | ComPtr<IUSBController> pCtrl = ctrls[i];
|
---|
3145 | USBControllerType_T enmType;
|
---|
3146 | CHECK_ERROR(pCtrl, COMGETTER(Type)(&enmType));
|
---|
3147 | if (enmType == USBControllerType_XHCI)
|
---|
3148 | {
|
---|
3149 | Bstr ctrlName;
|
---|
3150 | CHECK_ERROR(pCtrl, COMGETTER(Name)(ctrlName.asOutParam()));
|
---|
3151 | CHECK_ERROR(sessionMachine, RemoveUSBController(ctrlName.raw()));
|
---|
3152 | }
|
---|
3153 | }
|
---|
3154 | }
|
---|
3155 | }
|
---|
3156 | break;
|
---|
3157 | }
|
---|
3158 |
|
---|
3159 | case MODIFYVM_USBEHCI:
|
---|
3160 | {
|
---|
3161 | ULONG cEhciCtrls = 0;
|
---|
3162 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_EHCI, &cEhciCtrls);
|
---|
3163 | if (SUCCEEDED(hrc))
|
---|
3164 | {
|
---|
3165 | if (!cEhciCtrls && ValueUnion.f)
|
---|
3166 | {
|
---|
3167 | ComPtr<IUSBController> UsbCtl;
|
---|
3168 | CHECK_ERROR(sessionMachine, AddUSBController(Bstr("EHCI").raw(), USBControllerType_EHCI,
|
---|
3169 | UsbCtl.asOutParam()));
|
---|
3170 | }
|
---|
3171 | else if (cEhciCtrls && !ValueUnion.f)
|
---|
3172 | {
|
---|
3173 | SafeIfaceArray<IUSBController> ctrls;
|
---|
3174 | CHECK_ERROR(sessionMachine, COMGETTER(USBControllers)(ComSafeArrayAsOutParam(ctrls)));
|
---|
3175 | for (size_t i = 0; i < ctrls.size(); i++)
|
---|
3176 | {
|
---|
3177 | ComPtr<IUSBController> pCtrl = ctrls[i];
|
---|
3178 | USBControllerType_T enmType;
|
---|
3179 | CHECK_ERROR(pCtrl, COMGETTER(Type)(&enmType));
|
---|
3180 | if (enmType == USBControllerType_EHCI)
|
---|
3181 | {
|
---|
3182 | Bstr ctrlName;
|
---|
3183 | CHECK_ERROR(pCtrl, COMGETTER(Name)(ctrlName.asOutParam()));
|
---|
3184 | CHECK_ERROR(sessionMachine, RemoveUSBController(ctrlName.raw()));
|
---|
3185 | }
|
---|
3186 | }
|
---|
3187 | }
|
---|
3188 | }
|
---|
3189 | break;
|
---|
3190 | }
|
---|
3191 |
|
---|
3192 | case MODIFYVM_USBOHCI:
|
---|
3193 | {
|
---|
3194 | ULONG cOhciCtrls = 0;
|
---|
3195 | hrc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
|
---|
3196 | if (SUCCEEDED(hrc))
|
---|
3197 | {
|
---|
3198 | if (!cOhciCtrls && ValueUnion.f)
|
---|
3199 | {
|
---|
3200 | ComPtr<IUSBController> UsbCtl;
|
---|
3201 | CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
|
---|
3202 | UsbCtl.asOutParam()));
|
---|
3203 | }
|
---|
3204 | else if (cOhciCtrls && !ValueUnion.f)
|
---|
3205 | {
|
---|
3206 | SafeIfaceArray<IUSBController> ctrls;
|
---|
3207 | CHECK_ERROR(sessionMachine, COMGETTER(USBControllers)(ComSafeArrayAsOutParam(ctrls)));
|
---|
3208 | for (size_t i = 0; i < ctrls.size(); i++)
|
---|
3209 | {
|
---|
3210 | ComPtr<IUSBController> pCtrl = ctrls[i];
|
---|
3211 | USBControllerType_T enmType;
|
---|
3212 | CHECK_ERROR(pCtrl, COMGETTER(Type)(&enmType));
|
---|
3213 | if (enmType == USBControllerType_OHCI)
|
---|
3214 | {
|
---|
3215 | Bstr ctrlName;
|
---|
3216 | CHECK_ERROR(pCtrl, COMGETTER(Name)(ctrlName.asOutParam()));
|
---|
3217 | CHECK_ERROR(sessionMachine, RemoveUSBController(ctrlName.raw()));
|
---|
3218 | }
|
---|
3219 | }
|
---|
3220 | }
|
---|
3221 | }
|
---|
3222 | break;
|
---|
3223 | }
|
---|
3224 |
|
---|
3225 | case MODIFYVM_SNAPSHOTFOLDER:
|
---|
3226 | {
|
---|
3227 | if (!RTStrICmp(ValueUnion.psz, "default"))
|
---|
3228 | CHECK_ERROR(sessionMachine, COMSETTER(SnapshotFolder)(Bstr().raw()));
|
---|
3229 | else
|
---|
3230 | CHECK_ERROR(sessionMachine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
|
---|
3231 | break;
|
---|
3232 | }
|
---|
3233 |
|
---|
3234 | case MODIFYVM_TELEPORTER_ENABLED:
|
---|
3235 | {
|
---|
3236 | CHECK_ERROR(sessionMachine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
|
---|
3237 | break;
|
---|
3238 | }
|
---|
3239 |
|
---|
3240 | case MODIFYVM_TELEPORTER_PORT:
|
---|
3241 | {
|
---|
3242 | CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPort)(ValueUnion.u32));
|
---|
3243 | break;
|
---|
3244 | }
|
---|
3245 |
|
---|
3246 | case MODIFYVM_TELEPORTER_ADDRESS:
|
---|
3247 | {
|
---|
3248 | CHECK_ERROR(sessionMachine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
|
---|
3249 | break;
|
---|
3250 | }
|
---|
3251 |
|
---|
3252 | case MODIFYVM_TELEPORTER_PASSWORD:
|
---|
3253 | {
|
---|
3254 | CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
|
---|
3255 | break;
|
---|
3256 | }
|
---|
3257 |
|
---|
3258 | case MODIFYVM_TELEPORTER_PASSWORD_FILE:
|
---|
3259 | {
|
---|
3260 | Utf8Str password;
|
---|
3261 | RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &password);
|
---|
3262 | if (rcExit != RTEXITCODE_SUCCESS)
|
---|
3263 | hrc = E_FAIL;
|
---|
3264 | else
|
---|
3265 | CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
|
---|
3266 | break;
|
---|
3267 | }
|
---|
3268 |
|
---|
3269 | case MODIFYVM_TRACING_ENABLED:
|
---|
3270 | {
|
---|
3271 | CHECK_ERROR(sessionMachine, COMSETTER(TracingEnabled)(ValueUnion.f));
|
---|
3272 | break;
|
---|
3273 | }
|
---|
3274 |
|
---|
3275 | case MODIFYVM_TRACING_CONFIG:
|
---|
3276 | {
|
---|
3277 | CHECK_ERROR(sessionMachine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
|
---|
3278 | break;
|
---|
3279 | }
|
---|
3280 |
|
---|
3281 | case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
|
---|
3282 | {
|
---|
3283 | CHECK_ERROR(sessionMachine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
|
---|
3284 | break;
|
---|
3285 | }
|
---|
3286 |
|
---|
3287 | case MODIFYVM_HARDWARE_UUID:
|
---|
3288 | {
|
---|
3289 | CHECK_ERROR(sessionMachine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
|
---|
3290 | break;
|
---|
3291 | }
|
---|
3292 |
|
---|
3293 | case MODIFYVM_IOCACHE:
|
---|
3294 | {
|
---|
3295 | CHECK_ERROR(sessionMachine, COMSETTER(IOCacheEnabled)(ValueUnion.f));
|
---|
3296 | break;
|
---|
3297 | }
|
---|
3298 |
|
---|
3299 | case MODIFYVM_IOCACHESIZE:
|
---|
3300 | {
|
---|
3301 | CHECK_ERROR(sessionMachine, COMSETTER(IOCacheSize)(ValueUnion.u32));
|
---|
3302 | break;
|
---|
3303 | }
|
---|
3304 |
|
---|
3305 | case MODIFYVM_CHIPSET:
|
---|
3306 | {
|
---|
3307 | if (!RTStrICmp(ValueUnion.psz, "piix3"))
|
---|
3308 | {
|
---|
3309 | CHECK_ERROR(platform, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
|
---|
3310 | }
|
---|
3311 | else if (!RTStrICmp(ValueUnion.psz, "ich9"))
|
---|
3312 | {
|
---|
3313 | CHECK_ERROR(platform, COMSETTER(ChipsetType)(ChipsetType_ICH9));
|
---|
3314 | BOOL fIoApic = FALSE;
|
---|
3315 | CHECK_ERROR(firmwareSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
|
---|
3316 | if (!fIoApic)
|
---|
3317 | {
|
---|
3318 | RTStrmPrintf(g_pStdErr, ModifyVM::tr("*** I/O APIC must be enabled for ICH9, enabling. ***\n"));
|
---|
3319 | CHECK_ERROR(firmwareSettings, COMSETTER(IOAPICEnabled)(TRUE));
|
---|
3320 | }
|
---|
3321 | }
|
---|
3322 | else if ( !RTStrICmp(ValueUnion.psz, "armv8")
|
---|
3323 | || !RTStrICmp(ValueUnion.psz, "armv8virtual"))
|
---|
3324 | {
|
---|
3325 | CHECK_ERROR(platform, COMSETTER(ChipsetType)(ChipsetType_ARMv8Virtual));
|
---|
3326 | }
|
---|
3327 | else
|
---|
3328 | {
|
---|
3329 | errorArgument(ModifyVM::tr("Invalid --chipset argument '%s' (valid: piix3,ich9,armv8virtual)"),
|
---|
3330 | ValueUnion.psz);
|
---|
3331 | hrc = E_FAIL;
|
---|
3332 | }
|
---|
3333 | break;
|
---|
3334 | }
|
---|
3335 | #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL)
|
---|
3336 | case MODIFYVM_IOMMU:
|
---|
3337 | {
|
---|
3338 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
3339 | || !RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
3340 | CHECK_ERROR(platform, COMSETTER(IommuType)(IommuType_None));
|
---|
3341 | else if (!RTStrICmp(ValueUnion.psz, "amd"))
|
---|
3342 | CHECK_ERROR(platform, COMSETTER(IommuType)(IommuType_AMD));
|
---|
3343 | else if (!RTStrICmp(ValueUnion.psz, "intel"))
|
---|
3344 | {
|
---|
3345 | #ifdef VBOX_WITH_IOMMU_INTEL
|
---|
3346 | CHECK_ERROR(platform, COMSETTER(IommuType)(IommuType_Intel));
|
---|
3347 | #else
|
---|
3348 | errorArgument(ModifyVM::tr("Invalid --iommu argument '%s' (valid: none,amd,automatic)"), ValueUnion.psz);
|
---|
3349 | hrc = E_FAIL;
|
---|
3350 | #endif
|
---|
3351 | }
|
---|
3352 | else if (!RTStrICmp(ValueUnion.psz, "automatic"))
|
---|
3353 | {
|
---|
3354 | CHECK_ERROR(platform, COMSETTER(IommuType)(IommuType_Automatic));
|
---|
3355 | #ifndef VBOX_WITH_IOMMU_INTEL
|
---|
3356 | RTStrmPrintf(g_pStdErr,
|
---|
3357 | ModifyVM::tr("Warning: On Intel hosts, 'automatic' will not enable an IOMMU since the Intel IOMMU device is not supported yet.\n"));
|
---|
3358 | #endif
|
---|
3359 | }
|
---|
3360 | else
|
---|
3361 | {
|
---|
3362 | errorArgument(ModifyVM::tr("Invalid --iommu argument '%s'"), ValueUnion.psz);
|
---|
3363 | hrc = E_FAIL;
|
---|
3364 | }
|
---|
3365 | break;
|
---|
3366 | }
|
---|
3367 | #endif
|
---|
3368 | #if defined(VBOX_WITH_TPM)
|
---|
3369 | case MODIFYVM_TPM_TYPE:
|
---|
3370 | {
|
---|
3371 | ComPtr<ITrustedPlatformModule> tpm;
|
---|
3372 | sessionMachine->COMGETTER(TrustedPlatformModule)(tpm.asOutParam());
|
---|
3373 |
|
---|
3374 | if ( !RTStrICmp(ValueUnion.psz, "none")
|
---|
3375 | || !RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
3376 | CHECK_ERROR(tpm, COMSETTER(Type)(TpmType_None));
|
---|
3377 | else if (!RTStrICmp(ValueUnion.psz, "1.2"))
|
---|
3378 | CHECK_ERROR(tpm, COMSETTER(Type)(TpmType_v1_2));
|
---|
3379 | else if (!RTStrICmp(ValueUnion.psz, "2.0"))
|
---|
3380 | CHECK_ERROR(tpm, COMSETTER(Type)(TpmType_v2_0));
|
---|
3381 | else if (!RTStrICmp(ValueUnion.psz, "host"))
|
---|
3382 | CHECK_ERROR(tpm, COMSETTER(Type)(TpmType_Host));
|
---|
3383 | else if (!RTStrICmp(ValueUnion.psz, "swtpm"))
|
---|
3384 | CHECK_ERROR(tpm, COMSETTER(Type)(TpmType_Swtpm));
|
---|
3385 | else
|
---|
3386 | {
|
---|
3387 | errorArgument(ModifyVM::tr("Invalid --tpm-type argument '%s'"), ValueUnion.psz);
|
---|
3388 | hrc = E_FAIL;
|
---|
3389 | }
|
---|
3390 | break;
|
---|
3391 | }
|
---|
3392 |
|
---|
3393 | case MODIFYVM_TPM_LOCATION:
|
---|
3394 | {
|
---|
3395 | ComPtr<ITrustedPlatformModule> tpm;
|
---|
3396 | sessionMachine->COMGETTER(TrustedPlatformModule)(tpm.asOutParam());
|
---|
3397 |
|
---|
3398 | CHECK_ERROR(tpm, COMSETTER(Location)(Bstr(ValueUnion.psz).raw()));
|
---|
3399 | break;
|
---|
3400 | }
|
---|
3401 | #endif
|
---|
3402 | #ifdef VBOX_WITH_RECORDING
|
---|
3403 | case MODIFYVM_RECORDING:
|
---|
3404 | RT_FALL_THROUGH();
|
---|
3405 | case MODIFYVM_RECORDING_SCREENS:
|
---|
3406 | RT_FALL_THROUGH();
|
---|
3407 | case MODIFYVM_RECORDING_FILENAME:
|
---|
3408 | RT_FALL_THROUGH();
|
---|
3409 | case MODIFYVM_RECORDING_VIDEO_WIDTH:
|
---|
3410 | RT_FALL_THROUGH();
|
---|
3411 | case MODIFYVM_RECORDING_VIDEO_HEIGHT:
|
---|
3412 | RT_FALL_THROUGH();
|
---|
3413 | case MODIFYVM_RECORDING_VIDEO_RES:
|
---|
3414 | RT_FALL_THROUGH();
|
---|
3415 | case MODIFYVM_RECORDING_VIDEO_RATE:
|
---|
3416 | RT_FALL_THROUGH();
|
---|
3417 | case MODIFYVM_RECORDING_VIDEO_FPS:
|
---|
3418 | RT_FALL_THROUGH();
|
---|
3419 | case MODIFYVM_RECORDING_MAXTIME:
|
---|
3420 | RT_FALL_THROUGH();
|
---|
3421 | case MODIFYVM_RECORDING_MAXSIZE:
|
---|
3422 | RT_FALL_THROUGH();
|
---|
3423 | case MODIFYVM_RECORDING_OPTIONS:
|
---|
3424 | {
|
---|
3425 | ComPtr<IRecordingSettings> recordingSettings;
|
---|
3426 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(RecordingSettings)(recordingSettings.asOutParam()));
|
---|
3427 | SafeIfaceArray <IRecordingScreenSettings> saRecordingScreenScreens;
|
---|
3428 | CHECK_ERROR_BREAK(recordingSettings, COMGETTER(Screens)(ComSafeArrayAsOutParam(saRecordingScreenScreens)));
|
---|
3429 |
|
---|
3430 | switch (c)
|
---|
3431 | {
|
---|
3432 | case MODIFYVM_RECORDING:
|
---|
3433 | {
|
---|
3434 | CHECK_ERROR(recordingSettings, COMSETTER(Enabled)(ValueUnion.f));
|
---|
3435 | break;
|
---|
3436 | }
|
---|
3437 | case MODIFYVM_RECORDING_SCREENS:
|
---|
3438 | {
|
---|
3439 | ULONG cMonitors = 64;
|
---|
3440 | CHECK_ERROR(pGraphicsAdapter, COMGETTER(MonitorCount)(&cMonitors));
|
---|
3441 | com::SafeArray<BOOL> screens(cMonitors);
|
---|
3442 | if (RT_FAILURE(parseScreens(ValueUnion.psz, &screens)))
|
---|
3443 | {
|
---|
3444 | errorArgument(ModifyVM::tr("Invalid list of screens specified\n"));
|
---|
3445 | hrc = E_FAIL;
|
---|
3446 | break;
|
---|
3447 | }
|
---|
3448 |
|
---|
3449 | if (cMonitors > saRecordingScreenScreens.size()) /* Paranoia. */
|
---|
3450 | cMonitors = (ULONG)saRecordingScreenScreens.size();
|
---|
3451 |
|
---|
3452 | for (size_t i = 0; i < cMonitors; ++i)
|
---|
3453 | CHECK_ERROR_BREAK(saRecordingScreenScreens[i], COMSETTER(Enabled)(screens[i]));
|
---|
3454 | break;
|
---|
3455 | }
|
---|
3456 | case MODIFYVM_RECORDING_FILENAME:
|
---|
3457 | {
|
---|
3458 | Bstr bstr;
|
---|
3459 | /* empty string will fall through, leaving bstr empty */
|
---|
3460 | if (*ValueUnion.psz)
|
---|
3461 | {
|
---|
3462 | char szVCFileAbs[RTPATH_MAX] = "";
|
---|
3463 | int vrc = RTPathAbs(ValueUnion.psz, szVCFileAbs, sizeof(szVCFileAbs));
|
---|
3464 | if (RT_FAILURE(vrc))
|
---|
3465 | {
|
---|
3466 | errorArgument(ModifyVM::tr("Cannot convert filename \"%s\" to absolute path\n"), ValueUnion.psz);
|
---|
3467 | hrc = E_FAIL;
|
---|
3468 | break;
|
---|
3469 | }
|
---|
3470 | bstr = szVCFileAbs;
|
---|
3471 | }
|
---|
3472 |
|
---|
3473 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3474 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(Filename)(bstr.raw()));
|
---|
3475 | break;
|
---|
3476 | }
|
---|
3477 | case MODIFYVM_RECORDING_VIDEO_WIDTH:
|
---|
3478 | {
|
---|
3479 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3480 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoWidth)(ValueUnion.u32));
|
---|
3481 | break;
|
---|
3482 | }
|
---|
3483 | case MODIFYVM_RECORDING_VIDEO_HEIGHT:
|
---|
3484 | {
|
---|
3485 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3486 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoHeight)(ValueUnion.u32));
|
---|
3487 | break;
|
---|
3488 | }
|
---|
3489 | case MODIFYVM_RECORDING_VIDEO_RES:
|
---|
3490 | {
|
---|
3491 | uint32_t uWidth = 0;
|
---|
3492 | char *pszNext;
|
---|
3493 | int vrc = RTStrToUInt32Ex(ValueUnion.psz, &pszNext, 0, &uWidth);
|
---|
3494 | if (RT_FAILURE(vrc) || vrc != VWRN_TRAILING_CHARS || !pszNext || *pszNext != 'x')
|
---|
3495 | {
|
---|
3496 | errorArgument(ModifyVM::tr("Error parsing video resolution '%s' (expected <width>x<height>)"),
|
---|
3497 | ValueUnion.psz);
|
---|
3498 | hrc = E_FAIL;
|
---|
3499 | break;
|
---|
3500 | }
|
---|
3501 | uint32_t uHeight = 0;
|
---|
3502 | vrc = RTStrToUInt32Ex(pszNext+1, NULL, 0, &uHeight);
|
---|
3503 | if (vrc != VINF_SUCCESS)
|
---|
3504 | {
|
---|
3505 | errorArgument(ModifyVM::tr("Error parsing video resolution '%s' (expected <width>x<height>)"),
|
---|
3506 | ValueUnion.psz);
|
---|
3507 | hrc = E_FAIL;
|
---|
3508 | break;
|
---|
3509 | }
|
---|
3510 |
|
---|
3511 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3512 | {
|
---|
3513 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoWidth)(uWidth));
|
---|
3514 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoHeight)(uHeight));
|
---|
3515 | }
|
---|
3516 | break;
|
---|
3517 | }
|
---|
3518 | case MODIFYVM_RECORDING_VIDEO_RATE:
|
---|
3519 | {
|
---|
3520 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3521 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoRate)(ValueUnion.u32));
|
---|
3522 | break;
|
---|
3523 | }
|
---|
3524 | case MODIFYVM_RECORDING_VIDEO_FPS:
|
---|
3525 | {
|
---|
3526 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3527 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(VideoFPS)(ValueUnion.u32));
|
---|
3528 | break;
|
---|
3529 | }
|
---|
3530 | case MODIFYVM_RECORDING_MAXTIME:
|
---|
3531 | {
|
---|
3532 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3533 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(MaxTime)(ValueUnion.u32));
|
---|
3534 | break;
|
---|
3535 | }
|
---|
3536 | case MODIFYVM_RECORDING_MAXSIZE:
|
---|
3537 | {
|
---|
3538 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3539 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(MaxFileSize)(ValueUnion.u32));
|
---|
3540 | break;
|
---|
3541 | }
|
---|
3542 | case MODIFYVM_RECORDING_OPTIONS:
|
---|
3543 | {
|
---|
3544 | Bstr bstr(ValueUnion.psz);
|
---|
3545 | for (size_t i = 0; i < saRecordingScreenScreens.size(); ++i)
|
---|
3546 | CHECK_ERROR(saRecordingScreenScreens[i], COMSETTER(Options)(bstr.raw()));
|
---|
3547 | break;
|
---|
3548 | }
|
---|
3549 | }
|
---|
3550 |
|
---|
3551 | break;
|
---|
3552 | }
|
---|
3553 | #endif
|
---|
3554 | case MODIFYVM_AUTOSTART_ENABLED:
|
---|
3555 | {
|
---|
3556 | CHECK_ERROR(sessionMachine, COMSETTER(AutostartEnabled)(ValueUnion.f));
|
---|
3557 | break;
|
---|
3558 | }
|
---|
3559 |
|
---|
3560 | case MODIFYVM_AUTOSTART_DELAY:
|
---|
3561 | {
|
---|
3562 | CHECK_ERROR(sessionMachine, COMSETTER(AutostartDelay)(ValueUnion.u32));
|
---|
3563 | break;
|
---|
3564 | }
|
---|
3565 |
|
---|
3566 | case MODIFYVM_AUTOSTOP_TYPE:
|
---|
3567 | {
|
---|
3568 | AutostopType_T enmAutostopType = AutostopType_Disabled;
|
---|
3569 |
|
---|
3570 | if (!RTStrICmp(ValueUnion.psz, "disabled"))
|
---|
3571 | enmAutostopType = AutostopType_Disabled;
|
---|
3572 | else if (!RTStrICmp(ValueUnion.psz, "savestate"))
|
---|
3573 | enmAutostopType = AutostopType_SaveState;
|
---|
3574 | else if (!RTStrICmp(ValueUnion.psz, "poweroff"))
|
---|
3575 | enmAutostopType = AutostopType_PowerOff;
|
---|
3576 | else if (!RTStrICmp(ValueUnion.psz, "acpishutdown"))
|
---|
3577 | enmAutostopType = AutostopType_AcpiShutdown;
|
---|
3578 | else
|
---|
3579 | {
|
---|
3580 | errorArgument(ModifyVM::tr("Invalid --autostop-type argument '%s' (valid: disabled, savestate, poweroff, acpishutdown)"),
|
---|
3581 | ValueUnion.psz);
|
---|
3582 | hrc = E_FAIL;
|
---|
3583 | }
|
---|
3584 |
|
---|
3585 | if (SUCCEEDED(hrc))
|
---|
3586 | CHECK_ERROR(sessionMachine, COMSETTER(AutostopType)(enmAutostopType));
|
---|
3587 | break;
|
---|
3588 | }
|
---|
3589 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
3590 | case MODIFYVM_ATTACH_PCI:
|
---|
3591 | {
|
---|
3592 | const char* pAt = strchr(ValueUnion.psz, '@');
|
---|
3593 | int32_t iHostAddr, iGuestAddr;
|
---|
3594 |
|
---|
3595 | iHostAddr = parsePci(ValueUnion.psz);
|
---|
3596 | iGuestAddr = pAt != NULL ? parsePci(pAt + 1) : iHostAddr;
|
---|
3597 |
|
---|
3598 | if (iHostAddr == -1 || iGuestAddr == -1)
|
---|
3599 | {
|
---|
3600 | errorArgument(ModifyVM::tr("Invalid --pciattach argument '%s' (valid: 'HB:HD.HF@GB:GD.GF' or just 'HB:HD.HF')"),
|
---|
3601 | ValueUnion.psz);
|
---|
3602 | hrc = E_FAIL;
|
---|
3603 | }
|
---|
3604 | else
|
---|
3605 | {
|
---|
3606 | CHECK_ERROR(sessionMachine, AttachHostPCIDevice(iHostAddr, iGuestAddr, TRUE));
|
---|
3607 | }
|
---|
3608 |
|
---|
3609 | break;
|
---|
3610 | }
|
---|
3611 | case MODIFYVM_DETACH_PCI:
|
---|
3612 | {
|
---|
3613 | int32_t iHostAddr;
|
---|
3614 |
|
---|
3615 | iHostAddr = parsePci(ValueUnion.psz);
|
---|
3616 | if (iHostAddr == -1)
|
---|
3617 | {
|
---|
3618 | errorArgument(ModifyVM::tr("Invalid --pcidetach argument '%s' (valid: 'HB:HD.HF')"), ValueUnion.psz);
|
---|
3619 | hrc = E_FAIL;
|
---|
3620 | }
|
---|
3621 | else
|
---|
3622 | {
|
---|
3623 | CHECK_ERROR(sessionMachine, DetachHostPCIDevice(iHostAddr));
|
---|
3624 | }
|
---|
3625 |
|
---|
3626 | break;
|
---|
3627 | }
|
---|
3628 | #endif
|
---|
3629 |
|
---|
3630 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
3631 | case MODIFYVM_USBCARDREADER:
|
---|
3632 | {
|
---|
3633 | CHECK_ERROR(sessionMachine, COMSETTER(EmulatedUSBCardReaderEnabled)(ValueUnion.f));
|
---|
3634 | break;
|
---|
3635 | }
|
---|
3636 | #endif /* VBOX_WITH_USB_CARDREADER */
|
---|
3637 |
|
---|
3638 | case MODIFYVM_DEFAULTFRONTEND:
|
---|
3639 | {
|
---|
3640 | Bstr bstr(ValueUnion.psz);
|
---|
3641 | if (bstr == "default")
|
---|
3642 | bstr = Bstr::Empty;
|
---|
3643 | CHECK_ERROR(sessionMachine, COMSETTER(DefaultFrontend)(bstr.raw()));
|
---|
3644 | break;
|
---|
3645 | }
|
---|
3646 |
|
---|
3647 | case MODIFYVM_VMPROC_PRIORITY:
|
---|
3648 | {
|
---|
3649 | VMProcPriority_T enmPriority = nameToVMProcPriority(ValueUnion.psz);
|
---|
3650 | if (enmPriority == VMProcPriority_Invalid)
|
---|
3651 | {
|
---|
3652 | errorArgument(ModifyVM::tr("Invalid --vm-process-priority '%s'"), ValueUnion.psz);
|
---|
3653 | hrc = E_FAIL;
|
---|
3654 | }
|
---|
3655 | else
|
---|
3656 | {
|
---|
3657 | CHECK_ERROR(sessionMachine, COMSETTER(VMProcessPriority)(enmPriority));
|
---|
3658 | }
|
---|
3659 | break;
|
---|
3660 | }
|
---|
3661 |
|
---|
3662 | case MODIFYVM_VMEXEC_ENGINE:
|
---|
3663 | {
|
---|
3664 | VMExecutionEngine_T enmExecEngine = nameToVMExecEngine(ValueUnion.psz);
|
---|
3665 | if (enmExecEngine == VMExecutionEngine_NotSet)
|
---|
3666 | {
|
---|
3667 | errorArgument(ModifyVM::tr("Invalid --vm-execution-engine '%s'"), ValueUnion.psz);
|
---|
3668 | hrc = E_FAIL;
|
---|
3669 | }
|
---|
3670 | else
|
---|
3671 | {
|
---|
3672 | CHECK_ERROR(sessionMachine, COMSETTER(VMExecutionEngine)(enmExecEngine));
|
---|
3673 | }
|
---|
3674 | break;
|
---|
3675 | }
|
---|
3676 |
|
---|
3677 | case MODIFYVM_TESTING_ENABLED:
|
---|
3678 | hrc = setExtraData(sessionMachine, "VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled", ValueUnion.f ? "1" : "");
|
---|
3679 | break;
|
---|
3680 |
|
---|
3681 | case MODIFYVM_TESTING_MMIO:
|
---|
3682 | hrc = setExtraData(sessionMachine, "VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO", ValueUnion.f ? "1" : "");
|
---|
3683 | break;
|
---|
3684 |
|
---|
3685 | case MODIFYVM_TESTING_CFG_DWORD:
|
---|
3686 | if (GetOptState.uIndex <= 9)
|
---|
3687 | {
|
---|
3688 | char szVar[128];
|
---|
3689 | RTStrPrintf(szVar, sizeof(szVar), "VBoxInternal/Devices/VMMDev/0/Config/TestingCfgDword%u",
|
---|
3690 | GetOptState.uIndex);
|
---|
3691 | char szValue[32];
|
---|
3692 | RTStrPrintf(szValue, sizeof(szValue), "%u", ValueUnion.u32);
|
---|
3693 | hrc = setExtraData(sessionMachine, szVar, szValue);
|
---|
3694 | }
|
---|
3695 | else
|
---|
3696 | hrc = errorArgumentHr(ModifyVM::tr("--testing-cfg-dword index %u is out of range: 0 thru 9"),
|
---|
3697 | GetOptState.uIndex);
|
---|
3698 | break;
|
---|
3699 |
|
---|
3700 | case MODIFYVM_GUEST_DEBUG_PROVIDER:
|
---|
3701 | {
|
---|
3702 | ComPtr<IGuestDebugControl> gstDbgCtrl;
|
---|
3703 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(GuestDebugControl)(gstDbgCtrl.asOutParam()));
|
---|
3704 |
|
---|
3705 | GuestDebugProvider_T enmDebugProvider = GuestDebugProvider_None;
|
---|
3706 |
|
---|
3707 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
3708 | enmDebugProvider = GuestDebugProvider_None;
|
---|
3709 | else if (!RTStrICmp(ValueUnion.psz, "native"))
|
---|
3710 | enmDebugProvider = GuestDebugProvider_Native;
|
---|
3711 | else if (!RTStrICmp(ValueUnion.psz, "gdb"))
|
---|
3712 | enmDebugProvider = GuestDebugProvider_GDB;
|
---|
3713 | else if (!RTStrICmp(ValueUnion.psz, "kd"))
|
---|
3714 | enmDebugProvider = GuestDebugProvider_KD;
|
---|
3715 | else
|
---|
3716 | {
|
---|
3717 | errorArgument(ModifyVM::tr("Invalid --guest-debug-provider '%s' (valid: none, native, gdb, kd)"),
|
---|
3718 | ValueUnion.psz);
|
---|
3719 | hrc = E_FAIL;
|
---|
3720 | }
|
---|
3721 |
|
---|
3722 | if (SUCCEEDED(hrc))
|
---|
3723 | CHECK_ERROR(gstDbgCtrl, COMSETTER(DebugProvider)(enmDebugProvider));
|
---|
3724 | break;
|
---|
3725 | }
|
---|
3726 |
|
---|
3727 | case MODIFYVM_GUEST_DEBUG_IO_PROVIDER:
|
---|
3728 | {
|
---|
3729 | ComPtr<IGuestDebugControl> gstDbgCtrl;
|
---|
3730 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(GuestDebugControl)(gstDbgCtrl.asOutParam()));
|
---|
3731 |
|
---|
3732 | GuestDebugIoProvider_T enmDebugIoProvider = GuestDebugIoProvider_None;
|
---|
3733 |
|
---|
3734 | if (!RTStrICmp(ValueUnion.psz, "none"))
|
---|
3735 | enmDebugIoProvider = GuestDebugIoProvider_None;
|
---|
3736 | else if (!RTStrICmp(ValueUnion.psz, "tcp"))
|
---|
3737 | enmDebugIoProvider = GuestDebugIoProvider_TCP;
|
---|
3738 | else if (!RTStrICmp(ValueUnion.psz, "udp"))
|
---|
3739 | enmDebugIoProvider = GuestDebugIoProvider_UDP;
|
---|
3740 | else if (!RTStrICmp(ValueUnion.psz, "ipc"))
|
---|
3741 | enmDebugIoProvider = GuestDebugIoProvider_IPC;
|
---|
3742 | else
|
---|
3743 | {
|
---|
3744 | errorArgument(ModifyVM::tr("Invalid --guest-debug-io-provider '%s' (valid: none, tcp, udp, ipc)"),
|
---|
3745 | ValueUnion.psz);
|
---|
3746 | hrc = E_FAIL;
|
---|
3747 | }
|
---|
3748 |
|
---|
3749 | if (SUCCEEDED(hrc))
|
---|
3750 | CHECK_ERROR(gstDbgCtrl, COMSETTER(DebugIoProvider)(enmDebugIoProvider));
|
---|
3751 | break;
|
---|
3752 | }
|
---|
3753 |
|
---|
3754 | case MODIFYVM_GUEST_DEBUG_ADDRESS:
|
---|
3755 | {
|
---|
3756 | ComPtr<IGuestDebugControl> gstDbgCtrl;
|
---|
3757 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(GuestDebugControl)(gstDbgCtrl.asOutParam()));
|
---|
3758 |
|
---|
3759 | Bstr bstr(ValueUnion.psz);
|
---|
3760 | CHECK_ERROR(gstDbgCtrl, COMSETTER(DebugAddress)(bstr.raw()));
|
---|
3761 | break;
|
---|
3762 | }
|
---|
3763 |
|
---|
3764 | case MODIFYVM_GUEST_DEBUG_PORT:
|
---|
3765 | {
|
---|
3766 | ComPtr<IGuestDebugControl> gstDbgCtrl;
|
---|
3767 | CHECK_ERROR_BREAK(sessionMachine, COMGETTER(GuestDebugControl)(gstDbgCtrl.asOutParam()));
|
---|
3768 | CHECK_ERROR(gstDbgCtrl, COMSETTER(DebugPort)(ValueUnion.u32));
|
---|
3769 | break;
|
---|
3770 | }
|
---|
3771 |
|
---|
3772 | default:
|
---|
3773 | {
|
---|
3774 | PlatformArchitecture_T enmArch;
|
---|
3775 | CHECK_ERROR_RET(platform, COMGETTER(Architecture)(&enmArch), RTEXITCODE_FAILURE);
|
---|
3776 |
|
---|
3777 | if (enmArch == PlatformArchitecture_x86)
|
---|
3778 | {
|
---|
3779 | /* For the x86-based options we need the x86-specific platform object. */
|
---|
3780 | ComPtr<IPlatformX86> platformX86;
|
---|
3781 | CHECK_ERROR_RET(platform, COMGETTER(X86)(platformX86.asOutParam()), RTEXITCODE_FAILURE);
|
---|
3782 |
|
---|
3783 | hrc = handleModifyVM_x86(&GetOptState, c, &ValueUnion, sessionMachine, platformX86);
|
---|
3784 | }
|
---|
3785 | else if (enmArch == PlatformArchitecture_ARM)
|
---|
3786 | {
|
---|
3787 | /* For the ARM-based options we need the x86-specific platform object. */
|
---|
3788 | ComPtr<IPlatformARM> platformARM;
|
---|
3789 | CHECK_ERROR_RET(platform, COMGETTER(ARM)(platformARM.asOutParam()), RTEXITCODE_FAILURE);
|
---|
3790 |
|
---|
3791 | hrc = handleModifyVM_ARM(&GetOptState, c, &ValueUnion, sessionMachine, platformARM);
|
---|
3792 | }
|
---|
3793 | else
|
---|
3794 | {
|
---|
3795 | errorArgument(ModifyVM::tr("Invalid platform architecture returned for VM"));
|
---|
3796 | hrc = E_FAIL;
|
---|
3797 | }
|
---|
3798 |
|
---|
3799 | if (FAILED(hrc))
|
---|
3800 | errorGetOpt(c, &ValueUnion);
|
---|
3801 | break;
|
---|
3802 | }
|
---|
3803 | }
|
---|
3804 | }
|
---|
3805 |
|
---|
3806 | /* commit changes */
|
---|
3807 | if (SUCCEEDED(hrc))
|
---|
3808 | CHECK_ERROR(sessionMachine, SaveSettings());
|
---|
3809 |
|
---|
3810 | /* it's important to always close sessions */
|
---|
3811 | a->session->UnlockMachine();
|
---|
3812 |
|
---|
3813 | return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
|
---|
3814 | }
|
---|