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