1 | /* $Id: SystemPropertiesImpl.cpp 98292 2023-01-25 01:14:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
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 | #define LOG_GROUP LOG_GROUP_MAIN_SYSTEMPROPERTIES
|
---|
29 | #include "SystemPropertiesImpl.h"
|
---|
30 | #include "VirtualBoxImpl.h"
|
---|
31 | #include "MachineImpl.h"
|
---|
32 | #ifdef VBOX_WITH_EXTPACK
|
---|
33 | # include "ExtPackManagerImpl.h"
|
---|
34 | #endif
|
---|
35 | #include "CPUProfileImpl.h"
|
---|
36 | #include "AutoCaller.h"
|
---|
37 | #include "Global.h"
|
---|
38 | #include "LoggingNew.h"
|
---|
39 | #include "AutostartDb.h"
|
---|
40 | #include "VirtualBoxTranslator.h"
|
---|
41 |
|
---|
42 | // generated header
|
---|
43 | #include "SchemaDefs.h"
|
---|
44 |
|
---|
45 | #include <iprt/dir.h>
|
---|
46 | #include <iprt/ldr.h>
|
---|
47 | #include <iprt/locale.h>
|
---|
48 | #include <iprt/path.h>
|
---|
49 | #include <iprt/string.h>
|
---|
50 | #include <iprt/uri.h>
|
---|
51 | #include <iprt/cpp/utils.h>
|
---|
52 |
|
---|
53 | #include <iprt/errcore.h>
|
---|
54 | #include <VBox/param.h>
|
---|
55 | #include <VBox/settings.h>
|
---|
56 | #include <VBox/vd.h>
|
---|
57 | #include <VBox/vmm/cpum.h>
|
---|
58 |
|
---|
59 | // defines
|
---|
60 | /////////////////////////////////////////////////////////////////////////////
|
---|
61 |
|
---|
62 | // constructor / destructor
|
---|
63 | /////////////////////////////////////////////////////////////////////////////
|
---|
64 |
|
---|
65 | SystemProperties::SystemProperties()
|
---|
66 | : mParent(NULL)
|
---|
67 | , m(new settings::SystemProperties)
|
---|
68 | , m_fLoadedX86CPUProfiles(false)
|
---|
69 | {
|
---|
70 | }
|
---|
71 |
|
---|
72 | SystemProperties::~SystemProperties()
|
---|
73 | {
|
---|
74 | delete m;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | HRESULT SystemProperties::FinalConstruct()
|
---|
79 | {
|
---|
80 | return BaseFinalConstruct();
|
---|
81 | }
|
---|
82 |
|
---|
83 | void SystemProperties::FinalRelease()
|
---|
84 | {
|
---|
85 | uninit();
|
---|
86 | BaseFinalRelease();
|
---|
87 | }
|
---|
88 |
|
---|
89 | // public methods only for internal purposes
|
---|
90 | /////////////////////////////////////////////////////////////////////////////
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Initializes the system information object.
|
---|
94 | *
|
---|
95 | * @returns COM result indicator
|
---|
96 | */
|
---|
97 | HRESULT SystemProperties::init(VirtualBox *aParent)
|
---|
98 | {
|
---|
99 | LogFlowThisFunc(("aParent=%p\n", aParent));
|
---|
100 |
|
---|
101 | ComAssertRet(aParent, E_FAIL);
|
---|
102 |
|
---|
103 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
104 | AutoInitSpan autoInitSpan(this);
|
---|
105 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
106 |
|
---|
107 | unconst(mParent) = aParent;
|
---|
108 |
|
---|
109 | i_setDefaultMachineFolder(Utf8Str::Empty);
|
---|
110 | i_setLoggingLevel(Utf8Str::Empty);
|
---|
111 | i_setDefaultHardDiskFormat(Utf8Str::Empty);
|
---|
112 |
|
---|
113 | i_setVRDEAuthLibrary(Utf8Str::Empty);
|
---|
114 | i_setDefaultVRDEExtPack(Utf8Str::Empty);
|
---|
115 | i_setDefaultCryptoExtPack(Utf8Str::Empty);
|
---|
116 |
|
---|
117 | m->uLogHistoryCount = 3;
|
---|
118 |
|
---|
119 |
|
---|
120 | /* On Windows, OS X and Solaris, HW virtualization use isn't exclusive
|
---|
121 | * by default so that VT-x or AMD-V can be shared with other
|
---|
122 | * hypervisors without requiring user intervention.
|
---|
123 | * NB: See also SystemProperties constructor in settings.h
|
---|
124 | */
|
---|
125 | #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
|
---|
126 | m->fExclusiveHwVirt = false;
|
---|
127 | #else
|
---|
128 | m->fExclusiveHwVirt = true;
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | HRESULT hrc = S_OK;
|
---|
132 |
|
---|
133 | /* Fetch info of all available hd backends. */
|
---|
134 |
|
---|
135 | /// @todo NEWMEDIA VDBackendInfo needs to be improved to let us enumerate
|
---|
136 | /// any number of backends
|
---|
137 |
|
---|
138 | VDBACKENDINFO aVDInfo[100];
|
---|
139 | unsigned cEntries;
|
---|
140 | int vrc = VDBackendInfo(RT_ELEMENTS(aVDInfo), aVDInfo, &cEntries);
|
---|
141 | AssertRC(vrc);
|
---|
142 | if (RT_SUCCESS(vrc))
|
---|
143 | {
|
---|
144 | for (unsigned i = 0; i < cEntries; ++ i)
|
---|
145 | {
|
---|
146 | ComObjPtr<MediumFormat> hdf;
|
---|
147 | hrc = hdf.createObject();
|
---|
148 | if (FAILED(hrc)) break;
|
---|
149 |
|
---|
150 | hrc = hdf->init(&aVDInfo[i]);
|
---|
151 | if (FAILED(hrc)) break;
|
---|
152 |
|
---|
153 | m_llMediumFormats.push_back(hdf);
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 | /* Confirm a successful initialization */
|
---|
158 | if (SUCCEEDED(hrc))
|
---|
159 | autoInitSpan.setSucceeded();
|
---|
160 |
|
---|
161 | return hrc;
|
---|
162 | }
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Uninitializes the instance and sets the ready flag to FALSE.
|
---|
166 | * Called either from FinalRelease() or by the parent when it gets destroyed.
|
---|
167 | */
|
---|
168 | void SystemProperties::uninit()
|
---|
169 | {
|
---|
170 | LogFlowThisFunc(("\n"));
|
---|
171 |
|
---|
172 | /* Enclose the state transition Ready->InUninit->NotReady */
|
---|
173 | AutoUninitSpan autoUninitSpan(this);
|
---|
174 | if (autoUninitSpan.uninitDone())
|
---|
175 | return;
|
---|
176 |
|
---|
177 | unconst(mParent) = NULL;
|
---|
178 | }
|
---|
179 |
|
---|
180 | // wrapped ISystemProperties properties
|
---|
181 | /////////////////////////////////////////////////////////////////////////////
|
---|
182 |
|
---|
183 | HRESULT SystemProperties::getMinGuestRAM(ULONG *minRAM)
|
---|
184 |
|
---|
185 | {
|
---|
186 | /* no need to lock, this is const */
|
---|
187 | AssertCompile(MM_RAM_MIN_IN_MB >= SchemaDefs::MinGuestRAM);
|
---|
188 | *minRAM = MM_RAM_MIN_IN_MB;
|
---|
189 |
|
---|
190 | return S_OK;
|
---|
191 | }
|
---|
192 |
|
---|
193 | HRESULT SystemProperties::getMaxGuestRAM(ULONG *maxRAM)
|
---|
194 | {
|
---|
195 | /* no need to lock, this is const */
|
---|
196 | AssertCompile(MM_RAM_MAX_IN_MB <= SchemaDefs::MaxGuestRAM);
|
---|
197 | ULONG maxRAMSys = MM_RAM_MAX_IN_MB;
|
---|
198 | ULONG maxRAMArch = maxRAMSys;
|
---|
199 | *maxRAM = RT_MIN(maxRAMSys, maxRAMArch);
|
---|
200 |
|
---|
201 | return S_OK;
|
---|
202 | }
|
---|
203 |
|
---|
204 | HRESULT SystemProperties::getMinGuestVRAM(ULONG *minVRAM)
|
---|
205 | {
|
---|
206 | /* no need to lock, this is const */
|
---|
207 | *minVRAM = SchemaDefs::MinGuestVRAM;
|
---|
208 |
|
---|
209 | return S_OK;
|
---|
210 | }
|
---|
211 |
|
---|
212 | HRESULT SystemProperties::getMaxGuestVRAM(ULONG *maxVRAM)
|
---|
213 | {
|
---|
214 | /* no need to lock, this is const */
|
---|
215 | *maxVRAM = SchemaDefs::MaxGuestVRAM;
|
---|
216 |
|
---|
217 | return S_OK;
|
---|
218 | }
|
---|
219 |
|
---|
220 | HRESULT SystemProperties::getMinGuestCPUCount(ULONG *minCPUCount)
|
---|
221 | {
|
---|
222 | /* no need to lock, this is const */
|
---|
223 | *minCPUCount = SchemaDefs::MinCPUCount; // VMM_MIN_CPU_COUNT
|
---|
224 |
|
---|
225 | return S_OK;
|
---|
226 | }
|
---|
227 |
|
---|
228 | HRESULT SystemProperties::getMaxGuestCPUCount(ULONG *maxCPUCount)
|
---|
229 | {
|
---|
230 | /* no need to lock, this is const */
|
---|
231 | *maxCPUCount = SchemaDefs::MaxCPUCount; // VMM_MAX_CPU_COUNT
|
---|
232 |
|
---|
233 | return S_OK;
|
---|
234 | }
|
---|
235 |
|
---|
236 | HRESULT SystemProperties::getMaxGuestMonitors(ULONG *maxMonitors)
|
---|
237 | {
|
---|
238 |
|
---|
239 | /* no need to lock, this is const */
|
---|
240 | *maxMonitors = SchemaDefs::MaxGuestMonitors;
|
---|
241 |
|
---|
242 | return S_OK;
|
---|
243 | }
|
---|
244 |
|
---|
245 |
|
---|
246 | HRESULT SystemProperties::getInfoVDSize(LONG64 *infoVDSize)
|
---|
247 | {
|
---|
248 | /*
|
---|
249 | * The BIOS supports currently 32 bit LBA numbers (implementing the full
|
---|
250 | * 48 bit range is in theory trivial, but the crappy compiler makes things
|
---|
251 | * more difficult). This translates to almost 2 TiBytes (to be on the safe
|
---|
252 | * side, the reported limit is 1 MiByte less than that, as the total number
|
---|
253 | * of sectors should fit in 32 bits, too), which should be enough for the
|
---|
254 | * moment. Since the MBR partition tables support only 32bit sector numbers
|
---|
255 | * and thus the BIOS can only boot from disks smaller than 2T this is a
|
---|
256 | * rather hard limit.
|
---|
257 | *
|
---|
258 | * The virtual ATA/SATA disks support complete LBA48, and SCSI supports
|
---|
259 | * LBA64 (almost, more like LBA55 in practice), so the theoretical maximum
|
---|
260 | * disk size is 128 PiByte/16 EiByte. The GUI works nicely with 6 orders
|
---|
261 | * of magnitude, but not with 11..13 orders of magnitude.
|
---|
262 | */
|
---|
263 | /* no need to lock, this is const */
|
---|
264 | *infoVDSize = 2 * _1T - _1M;
|
---|
265 |
|
---|
266 | return S_OK;
|
---|
267 | }
|
---|
268 |
|
---|
269 |
|
---|
270 | HRESULT SystemProperties::getSerialPortCount(ULONG *count)
|
---|
271 | {
|
---|
272 | /* no need to lock, this is const */
|
---|
273 | *count = SchemaDefs::SerialPortCount;
|
---|
274 |
|
---|
275 | return S_OK;
|
---|
276 | }
|
---|
277 |
|
---|
278 |
|
---|
279 | HRESULT SystemProperties::getParallelPortCount(ULONG *count)
|
---|
280 | {
|
---|
281 | /* no need to lock, this is const */
|
---|
282 | *count = SchemaDefs::ParallelPortCount;
|
---|
283 |
|
---|
284 | return S_OK;
|
---|
285 | }
|
---|
286 |
|
---|
287 |
|
---|
288 | HRESULT SystemProperties::getMaxBootPosition(ULONG *aMaxBootPosition)
|
---|
289 | {
|
---|
290 | /* no need to lock, this is const */
|
---|
291 | *aMaxBootPosition = SchemaDefs::MaxBootPosition;
|
---|
292 |
|
---|
293 | return S_OK;
|
---|
294 | }
|
---|
295 |
|
---|
296 |
|
---|
297 | HRESULT SystemProperties::getRawModeSupported(BOOL *aRawModeSupported)
|
---|
298 | {
|
---|
299 | *aRawModeSupported = FALSE;
|
---|
300 | return S_OK;
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 | HRESULT SystemProperties::getExclusiveHwVirt(BOOL *aExclusiveHwVirt)
|
---|
305 | {
|
---|
306 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
307 |
|
---|
308 | *aExclusiveHwVirt = m->fExclusiveHwVirt;
|
---|
309 |
|
---|
310 | return S_OK;
|
---|
311 | }
|
---|
312 |
|
---|
313 | HRESULT SystemProperties::setExclusiveHwVirt(BOOL aExclusiveHwVirt)
|
---|
314 | {
|
---|
315 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
316 | m->fExclusiveHwVirt = !!aExclusiveHwVirt;
|
---|
317 | alock.release();
|
---|
318 |
|
---|
319 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
320 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
321 | return mParent->i_saveSettings();
|
---|
322 | }
|
---|
323 |
|
---|
324 | HRESULT SystemProperties::getMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *aMaxNetworkAdapters)
|
---|
325 | {
|
---|
326 | /* no need for locking, no state */
|
---|
327 | uint32_t uResult = Global::getMaxNetworkAdapters(aChipset);
|
---|
328 | if (uResult == 0)
|
---|
329 | AssertMsgFailed(("Invalid chipset type %d\n", aChipset));
|
---|
330 | *aMaxNetworkAdapters = uResult;
|
---|
331 | return S_OK;
|
---|
332 | }
|
---|
333 |
|
---|
334 | HRESULT SystemProperties::getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count)
|
---|
335 | {
|
---|
336 | /* no need for locking, no state */
|
---|
337 | uint32_t uResult = Global::getMaxNetworkAdapters(aChipset);
|
---|
338 | if (uResult == 0)
|
---|
339 | AssertMsgFailed(("Invalid chipset type %d\n", aChipset));
|
---|
340 |
|
---|
341 | switch (aType)
|
---|
342 | {
|
---|
343 | case NetworkAttachmentType_NAT:
|
---|
344 | case NetworkAttachmentType_Internal:
|
---|
345 | case NetworkAttachmentType_NATNetwork:
|
---|
346 | /* chipset default is OK */
|
---|
347 | break;
|
---|
348 | case NetworkAttachmentType_Bridged:
|
---|
349 | /* Maybe use current host interface count here? */
|
---|
350 | break;
|
---|
351 | case NetworkAttachmentType_HostOnly:
|
---|
352 | uResult = RT_MIN(uResult, 8);
|
---|
353 | break;
|
---|
354 | default:
|
---|
355 | AssertMsgFailed(("Unhandled attachment type %d\n", aType));
|
---|
356 | }
|
---|
357 |
|
---|
358 | *count = uResult;
|
---|
359 |
|
---|
360 | return S_OK;
|
---|
361 | }
|
---|
362 |
|
---|
363 |
|
---|
364 | HRESULT SystemProperties::getMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
|
---|
365 | ULONG *aMaxDevicesPerPort)
|
---|
366 | {
|
---|
367 | /* no need to lock, this is const */
|
---|
368 | switch (aBus)
|
---|
369 | {
|
---|
370 | case StorageBus_SATA:
|
---|
371 | case StorageBus_SCSI:
|
---|
372 | case StorageBus_SAS:
|
---|
373 | case StorageBus_USB:
|
---|
374 | case StorageBus_PCIe:
|
---|
375 | case StorageBus_VirtioSCSI:
|
---|
376 | {
|
---|
377 | /* SATA and both SCSI controllers only support one device per port. */
|
---|
378 | *aMaxDevicesPerPort = 1;
|
---|
379 | break;
|
---|
380 | }
|
---|
381 | case StorageBus_IDE:
|
---|
382 | case StorageBus_Floppy:
|
---|
383 | {
|
---|
384 | /* The IDE and Floppy controllers support 2 devices. One as master
|
---|
385 | * and one as slave (or floppy drive 0 and 1). */
|
---|
386 | *aMaxDevicesPerPort = 2;
|
---|
387 | break;
|
---|
388 | }
|
---|
389 | default:
|
---|
390 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
391 | }
|
---|
392 |
|
---|
393 | return S_OK;
|
---|
394 | }
|
---|
395 |
|
---|
396 | HRESULT SystemProperties::getMinPortCountForStorageBus(StorageBus_T aBus,
|
---|
397 | ULONG *aMinPortCount)
|
---|
398 | {
|
---|
399 | /* no need to lock, this is const */
|
---|
400 | switch (aBus)
|
---|
401 | {
|
---|
402 | case StorageBus_SATA:
|
---|
403 | case StorageBus_SAS:
|
---|
404 | case StorageBus_PCIe:
|
---|
405 | case StorageBus_VirtioSCSI:
|
---|
406 | {
|
---|
407 | *aMinPortCount = 1;
|
---|
408 | break;
|
---|
409 | }
|
---|
410 | case StorageBus_SCSI:
|
---|
411 | {
|
---|
412 | *aMinPortCount = 16;
|
---|
413 | break;
|
---|
414 | }
|
---|
415 | case StorageBus_IDE:
|
---|
416 | {
|
---|
417 | *aMinPortCount = 2;
|
---|
418 | break;
|
---|
419 | }
|
---|
420 | case StorageBus_Floppy:
|
---|
421 | {
|
---|
422 | *aMinPortCount = 1;
|
---|
423 | break;
|
---|
424 | }
|
---|
425 | case StorageBus_USB:
|
---|
426 | {
|
---|
427 | *aMinPortCount = 8;
|
---|
428 | break;
|
---|
429 | }
|
---|
430 | default:
|
---|
431 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
432 | }
|
---|
433 |
|
---|
434 | return S_OK;
|
---|
435 | }
|
---|
436 |
|
---|
437 | HRESULT SystemProperties::getMaxPortCountForStorageBus(StorageBus_T aBus,
|
---|
438 | ULONG *aMaxPortCount)
|
---|
439 | {
|
---|
440 | /* no need to lock, this is const */
|
---|
441 | switch (aBus)
|
---|
442 | {
|
---|
443 | case StorageBus_SATA:
|
---|
444 | {
|
---|
445 | *aMaxPortCount = 30;
|
---|
446 | break;
|
---|
447 | }
|
---|
448 | case StorageBus_SCSI:
|
---|
449 | {
|
---|
450 | *aMaxPortCount = 16;
|
---|
451 | break;
|
---|
452 | }
|
---|
453 | case StorageBus_IDE:
|
---|
454 | {
|
---|
455 | *aMaxPortCount = 2;
|
---|
456 | break;
|
---|
457 | }
|
---|
458 | case StorageBus_Floppy:
|
---|
459 | {
|
---|
460 | *aMaxPortCount = 1;
|
---|
461 | break;
|
---|
462 | }
|
---|
463 | case StorageBus_SAS:
|
---|
464 | case StorageBus_PCIe:
|
---|
465 | {
|
---|
466 | *aMaxPortCount = 255;
|
---|
467 | break;
|
---|
468 | }
|
---|
469 | case StorageBus_USB:
|
---|
470 | {
|
---|
471 | *aMaxPortCount = 8;
|
---|
472 | break;
|
---|
473 | }
|
---|
474 | case StorageBus_VirtioSCSI:
|
---|
475 | {
|
---|
476 | *aMaxPortCount = 256;
|
---|
477 | break;
|
---|
478 | }
|
---|
479 | default:
|
---|
480 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
481 | }
|
---|
482 |
|
---|
483 | return S_OK;
|
---|
484 | }
|
---|
485 |
|
---|
486 | HRESULT SystemProperties::getMaxInstancesOfStorageBus(ChipsetType_T aChipset,
|
---|
487 | StorageBus_T aBus,
|
---|
488 | ULONG *aMaxInstances)
|
---|
489 | {
|
---|
490 | ULONG cCtrs = 0;
|
---|
491 |
|
---|
492 | /* no need to lock, this is const */
|
---|
493 | switch (aBus)
|
---|
494 | {
|
---|
495 | case StorageBus_SATA:
|
---|
496 | case StorageBus_SCSI:
|
---|
497 | case StorageBus_SAS:
|
---|
498 | case StorageBus_PCIe:
|
---|
499 | case StorageBus_VirtioSCSI:
|
---|
500 | cCtrs = aChipset == ChipsetType_ICH9 ? 8 : 1;
|
---|
501 | break;
|
---|
502 | case StorageBus_USB:
|
---|
503 | case StorageBus_IDE:
|
---|
504 | case StorageBus_Floppy:
|
---|
505 | {
|
---|
506 | cCtrs = 1;
|
---|
507 | break;
|
---|
508 | }
|
---|
509 | default:
|
---|
510 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
511 | }
|
---|
512 |
|
---|
513 | *aMaxInstances = cCtrs;
|
---|
514 |
|
---|
515 | return S_OK;
|
---|
516 | }
|
---|
517 |
|
---|
518 | HRESULT SystemProperties::getDeviceTypesForStorageBus(StorageBus_T aBus,
|
---|
519 | std::vector<DeviceType_T> &aDeviceTypes)
|
---|
520 | {
|
---|
521 | aDeviceTypes.resize(0);
|
---|
522 |
|
---|
523 | /* no need to lock, this is const */
|
---|
524 | switch (aBus)
|
---|
525 | {
|
---|
526 | case StorageBus_IDE:
|
---|
527 | case StorageBus_SATA:
|
---|
528 | case StorageBus_SCSI:
|
---|
529 | case StorageBus_SAS:
|
---|
530 | case StorageBus_USB:
|
---|
531 | case StorageBus_VirtioSCSI:
|
---|
532 | {
|
---|
533 | aDeviceTypes.resize(2);
|
---|
534 | aDeviceTypes[0] = DeviceType_DVD;
|
---|
535 | aDeviceTypes[1] = DeviceType_HardDisk;
|
---|
536 | break;
|
---|
537 | }
|
---|
538 | case StorageBus_Floppy:
|
---|
539 | {
|
---|
540 | aDeviceTypes.resize(1);
|
---|
541 | aDeviceTypes[0] = DeviceType_Floppy;
|
---|
542 | break;
|
---|
543 | }
|
---|
544 | case StorageBus_PCIe:
|
---|
545 | {
|
---|
546 | aDeviceTypes.resize(1);
|
---|
547 | aDeviceTypes[0] = DeviceType_HardDisk;
|
---|
548 | break;
|
---|
549 | }
|
---|
550 | default:
|
---|
551 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
552 | }
|
---|
553 |
|
---|
554 | return S_OK;
|
---|
555 | }
|
---|
556 |
|
---|
557 | HRESULT SystemProperties::getStorageBusForStorageControllerType(StorageControllerType_T aStorageControllerType,
|
---|
558 | StorageBus_T *aStorageBus)
|
---|
559 | {
|
---|
560 | /* no need to lock, this is const */
|
---|
561 | switch (aStorageControllerType)
|
---|
562 | {
|
---|
563 | case StorageControllerType_LsiLogic:
|
---|
564 | case StorageControllerType_BusLogic:
|
---|
565 | *aStorageBus = StorageBus_SCSI;
|
---|
566 | break;
|
---|
567 | case StorageControllerType_IntelAhci:
|
---|
568 | *aStorageBus = StorageBus_SATA;
|
---|
569 | break;
|
---|
570 | case StorageControllerType_PIIX3:
|
---|
571 | case StorageControllerType_PIIX4:
|
---|
572 | case StorageControllerType_ICH6:
|
---|
573 | *aStorageBus = StorageBus_IDE;
|
---|
574 | break;
|
---|
575 | case StorageControllerType_I82078:
|
---|
576 | *aStorageBus = StorageBus_Floppy;
|
---|
577 | break;
|
---|
578 | case StorageControllerType_LsiLogicSas:
|
---|
579 | *aStorageBus = StorageBus_SAS;
|
---|
580 | break;
|
---|
581 | case StorageControllerType_USB:
|
---|
582 | *aStorageBus = StorageBus_USB;
|
---|
583 | break;
|
---|
584 | case StorageControllerType_NVMe:
|
---|
585 | *aStorageBus = StorageBus_PCIe;
|
---|
586 | break;
|
---|
587 | case StorageControllerType_VirtioSCSI:
|
---|
588 | *aStorageBus = StorageBus_VirtioSCSI;
|
---|
589 | break;
|
---|
590 | default:
|
---|
591 | return setError(E_FAIL, tr("Invalid storage controller type %d\n"), aStorageBus);
|
---|
592 | }
|
---|
593 |
|
---|
594 | return S_OK;
|
---|
595 | }
|
---|
596 |
|
---|
597 | HRESULT SystemProperties::getStorageControllerTypesForStorageBus(StorageBus_T aStorageBus,
|
---|
598 | std::vector<StorageControllerType_T> &aStorageControllerTypes)
|
---|
599 | {
|
---|
600 | aStorageControllerTypes.resize(0);
|
---|
601 |
|
---|
602 | /* no need to lock, this is const */
|
---|
603 | switch (aStorageBus)
|
---|
604 | {
|
---|
605 | case StorageBus_IDE:
|
---|
606 | aStorageControllerTypes.resize(3);
|
---|
607 | aStorageControllerTypes[0] = StorageControllerType_PIIX4;
|
---|
608 | aStorageControllerTypes[1] = StorageControllerType_PIIX3;
|
---|
609 | aStorageControllerTypes[2] = StorageControllerType_ICH6;
|
---|
610 | break;
|
---|
611 | case StorageBus_SATA:
|
---|
612 | aStorageControllerTypes.resize(1);
|
---|
613 | aStorageControllerTypes[0] = StorageControllerType_IntelAhci;
|
---|
614 | break;
|
---|
615 | case StorageBus_SCSI:
|
---|
616 | aStorageControllerTypes.resize(2);
|
---|
617 | aStorageControllerTypes[0] = StorageControllerType_LsiLogic;
|
---|
618 | aStorageControllerTypes[1] = StorageControllerType_BusLogic;
|
---|
619 | break;
|
---|
620 | case StorageBus_Floppy:
|
---|
621 | aStorageControllerTypes.resize(1);
|
---|
622 | aStorageControllerTypes[0] = StorageControllerType_I82078;
|
---|
623 | break;
|
---|
624 | case StorageBus_SAS:
|
---|
625 | aStorageControllerTypes.resize(1);
|
---|
626 | aStorageControllerTypes[0] = StorageControllerType_LsiLogicSas;
|
---|
627 | break;
|
---|
628 | case StorageBus_USB:
|
---|
629 | aStorageControllerTypes.resize(1);
|
---|
630 | aStorageControllerTypes[0] = StorageControllerType_USB;
|
---|
631 | break;
|
---|
632 | case StorageBus_PCIe:
|
---|
633 | aStorageControllerTypes.resize(1);
|
---|
634 | aStorageControllerTypes[0] = StorageControllerType_NVMe;
|
---|
635 | break;
|
---|
636 | case StorageBus_VirtioSCSI:
|
---|
637 | aStorageControllerTypes.resize(1);
|
---|
638 | aStorageControllerTypes[0] = StorageControllerType_VirtioSCSI;
|
---|
639 | break;
|
---|
640 | default:
|
---|
641 | return setError(E_FAIL, tr("Invalid storage bus %d\n"), aStorageBus);
|
---|
642 | }
|
---|
643 |
|
---|
644 | return S_OK;
|
---|
645 | }
|
---|
646 |
|
---|
647 | HRESULT SystemProperties::getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType,
|
---|
648 | BOOL *aEnabled)
|
---|
649 | {
|
---|
650 | /* no need to lock, this is const */
|
---|
651 | switch (aControllerType)
|
---|
652 | {
|
---|
653 | case StorageControllerType_LsiLogic:
|
---|
654 | case StorageControllerType_BusLogic:
|
---|
655 | case StorageControllerType_IntelAhci:
|
---|
656 | case StorageControllerType_LsiLogicSas:
|
---|
657 | case StorageControllerType_USB:
|
---|
658 | case StorageControllerType_NVMe:
|
---|
659 | case StorageControllerType_VirtioSCSI:
|
---|
660 | *aEnabled = false;
|
---|
661 | break;
|
---|
662 | case StorageControllerType_PIIX3:
|
---|
663 | case StorageControllerType_PIIX4:
|
---|
664 | case StorageControllerType_ICH6:
|
---|
665 | case StorageControllerType_I82078:
|
---|
666 | *aEnabled = true;
|
---|
667 | break;
|
---|
668 | default:
|
---|
669 | AssertMsgFailed(("Invalid controller type %d\n", aControllerType));
|
---|
670 | }
|
---|
671 | return S_OK;
|
---|
672 | }
|
---|
673 |
|
---|
674 | HRESULT SystemProperties::getStorageControllerHotplugCapable(StorageControllerType_T aControllerType,
|
---|
675 | BOOL *aHotplugCapable)
|
---|
676 | {
|
---|
677 | switch (aControllerType)
|
---|
678 | {
|
---|
679 | case StorageControllerType_IntelAhci:
|
---|
680 | case StorageControllerType_USB:
|
---|
681 | *aHotplugCapable = true;
|
---|
682 | break;
|
---|
683 | case StorageControllerType_LsiLogic:
|
---|
684 | case StorageControllerType_LsiLogicSas:
|
---|
685 | case StorageControllerType_BusLogic:
|
---|
686 | case StorageControllerType_NVMe:
|
---|
687 | case StorageControllerType_VirtioSCSI:
|
---|
688 | case StorageControllerType_PIIX3:
|
---|
689 | case StorageControllerType_PIIX4:
|
---|
690 | case StorageControllerType_ICH6:
|
---|
691 | case StorageControllerType_I82078:
|
---|
692 | *aHotplugCapable = false;
|
---|
693 | break;
|
---|
694 | default:
|
---|
695 | AssertMsgFailedReturn(("Invalid controller type %d\n", aControllerType), E_FAIL);
|
---|
696 | }
|
---|
697 |
|
---|
698 | return S_OK;
|
---|
699 | }
|
---|
700 |
|
---|
701 | HRESULT SystemProperties::getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,
|
---|
702 | USBControllerType_T aType,
|
---|
703 | ULONG *aMaxInstances)
|
---|
704 | {
|
---|
705 | NOREF(aChipset);
|
---|
706 | ULONG cCtrs = 0;
|
---|
707 |
|
---|
708 | /* no need to lock, this is const */
|
---|
709 | switch (aType)
|
---|
710 | {
|
---|
711 | case USBControllerType_OHCI:
|
---|
712 | case USBControllerType_EHCI:
|
---|
713 | case USBControllerType_XHCI:
|
---|
714 | {
|
---|
715 | cCtrs = 1;
|
---|
716 | break;
|
---|
717 | }
|
---|
718 | default:
|
---|
719 | AssertMsgFailed(("Invalid bus type %d\n", aType));
|
---|
720 | }
|
---|
721 |
|
---|
722 | *aMaxInstances = cCtrs;
|
---|
723 |
|
---|
724 | return S_OK;
|
---|
725 | }
|
---|
726 |
|
---|
727 | HRESULT SystemProperties::getCPUProfiles(CPUArchitecture_T aArchitecture, const com::Utf8Str &aNamePattern,
|
---|
728 | std::vector<ComPtr<ICPUProfile> > &aProfiles)
|
---|
729 | {
|
---|
730 | /*
|
---|
731 | * Validate and adjust the architecture.
|
---|
732 | */
|
---|
733 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
734 | CPUArchitecture_T enmSecondaryArch = aArchitecture;
|
---|
735 | bool fLoaded;
|
---|
736 | switch (aArchitecture)
|
---|
737 | {
|
---|
738 | case CPUArchitecture_Any:
|
---|
739 | aArchitecture = CPUArchitecture_AMD64;
|
---|
740 | RT_FALL_THROUGH();
|
---|
741 | case CPUArchitecture_AMD64:
|
---|
742 | enmSecondaryArch = CPUArchitecture_x86;
|
---|
743 | RT_FALL_THROUGH();
|
---|
744 | case CPUArchitecture_x86:
|
---|
745 | fLoaded = m_fLoadedX86CPUProfiles;
|
---|
746 | break;
|
---|
747 | default:
|
---|
748 | return setError(E_INVALIDARG, tr("Invalid or unsupported architecture value: %d"), aArchitecture);
|
---|
749 | }
|
---|
750 |
|
---|
751 | /*
|
---|
752 | * Do we need to load the profiles?
|
---|
753 | */
|
---|
754 | HRESULT hrc;
|
---|
755 | if (fLoaded)
|
---|
756 | hrc = S_OK;
|
---|
757 | else
|
---|
758 | {
|
---|
759 | alock.release();
|
---|
760 | AutoWriteLock alockWrite(this COMMA_LOCKVAL_SRC_POS);
|
---|
761 |
|
---|
762 | /*
|
---|
763 | * Translate the architecture to a VMM module handle.
|
---|
764 | */
|
---|
765 | const char *pszVMM;
|
---|
766 | switch (aArchitecture)
|
---|
767 | {
|
---|
768 | case CPUArchitecture_AMD64:
|
---|
769 | case CPUArchitecture_x86:
|
---|
770 | pszVMM = "VBoxVMM";
|
---|
771 | fLoaded = m_fLoadedX86CPUProfiles;
|
---|
772 | break;
|
---|
773 | default:
|
---|
774 | AssertFailedReturn(E_INVALIDARG);
|
---|
775 | }
|
---|
776 | if (fLoaded)
|
---|
777 | hrc = S_OK;
|
---|
778 | else
|
---|
779 | {
|
---|
780 | char szPath[RTPATH_MAX];
|
---|
781 | int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
|
---|
782 | if (RT_SUCCESS(vrc))
|
---|
783 | vrc = RTPathAppend(szPath, sizeof(szPath), pszVMM);
|
---|
784 | if (RT_SUCCESS(vrc))
|
---|
785 | vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
|
---|
786 | if (RT_SUCCESS(vrc))
|
---|
787 | {
|
---|
788 | RTLDRMOD hMod = NIL_RTLDRMOD;
|
---|
789 | vrc = RTLdrLoad(szPath, &hMod);
|
---|
790 | if (RT_SUCCESS(vrc))
|
---|
791 | {
|
---|
792 | /*
|
---|
793 | * Resolve the CPUMDb APIs we need.
|
---|
794 | */
|
---|
795 | PFNCPUMDBGETENTRIES pfnGetEntries
|
---|
796 | = (PFNCPUMDBGETENTRIES)RTLdrGetFunction(hMod, "CPUMR3DbGetEntries");
|
---|
797 | PFNCPUMDBGETENTRYBYINDEX pfnGetEntryByIndex
|
---|
798 | = (PFNCPUMDBGETENTRYBYINDEX)RTLdrGetFunction(hMod, "CPUMR3DbGetEntryByIndex");
|
---|
799 | if (pfnGetEntries && pfnGetEntryByIndex)
|
---|
800 | {
|
---|
801 | size_t const cExistingProfiles = m_llCPUProfiles.size();
|
---|
802 |
|
---|
803 | /*
|
---|
804 | * Instantate the profiles.
|
---|
805 | */
|
---|
806 | hrc = S_OK;
|
---|
807 | uint32_t const cEntries = pfnGetEntries();
|
---|
808 | for (uint32_t i = 0; i < cEntries; i++)
|
---|
809 | {
|
---|
810 | PCCPUMDBENTRY pDbEntry = pfnGetEntryByIndex(i);
|
---|
811 | AssertBreakStmt(pDbEntry, hrc = setError(E_UNEXPECTED, "CPUMR3DbGetEntryByIndex failed for %i", i));
|
---|
812 |
|
---|
813 | ComObjPtr<CPUProfile> ptrProfile;
|
---|
814 | hrc = ptrProfile.createObject();
|
---|
815 | if (SUCCEEDED(hrc))
|
---|
816 | {
|
---|
817 | hrc = ptrProfile->initFromDbEntry(pDbEntry);
|
---|
818 | if (SUCCEEDED(hrc))
|
---|
819 | {
|
---|
820 | try
|
---|
821 | {
|
---|
822 | m_llCPUProfiles.push_back(ptrProfile);
|
---|
823 | continue;
|
---|
824 | }
|
---|
825 | catch (std::bad_alloc &)
|
---|
826 | {
|
---|
827 | hrc = E_OUTOFMEMORY;
|
---|
828 | }
|
---|
829 | }
|
---|
830 | }
|
---|
831 | break;
|
---|
832 | }
|
---|
833 |
|
---|
834 | /*
|
---|
835 | * On success update the flag and retake the read lock.
|
---|
836 | * If we fail, drop the profiles we added to the list.
|
---|
837 | */
|
---|
838 | if (SUCCEEDED(hrc))
|
---|
839 | {
|
---|
840 | switch (aArchitecture)
|
---|
841 | {
|
---|
842 | case CPUArchitecture_AMD64:
|
---|
843 | case CPUArchitecture_x86:
|
---|
844 | m_fLoadedX86CPUProfiles = true;
|
---|
845 | break;
|
---|
846 | default:
|
---|
847 | AssertFailedStmt(hrc = E_INVALIDARG);
|
---|
848 | }
|
---|
849 |
|
---|
850 | alockWrite.release();
|
---|
851 | alock.acquire();
|
---|
852 | }
|
---|
853 | else
|
---|
854 | m_llCPUProfiles.resize(cExistingProfiles);
|
---|
855 | }
|
---|
856 | else
|
---|
857 | hrc = setErrorVrc(VERR_SYMBOL_NOT_FOUND,
|
---|
858 | tr("'%s' is missing symbols: CPUMR3DbGetEntries, CPUMR3DbGetEntryByIndex"), szPath);
|
---|
859 | RTLdrClose(hMod);
|
---|
860 | }
|
---|
861 | else
|
---|
862 | hrc = setErrorVrc(vrc, tr("Failed to construct load '%s': %Rrc"), szPath, vrc);
|
---|
863 | }
|
---|
864 | else
|
---|
865 | hrc = setErrorVrc(vrc, tr("Failed to construct path to the VMM DLL/Dylib/SharedObject: %Rrc"), vrc);
|
---|
866 | }
|
---|
867 | }
|
---|
868 | if (SUCCEEDED(hrc))
|
---|
869 | {
|
---|
870 | /*
|
---|
871 | * Return the matching profiles.
|
---|
872 | */
|
---|
873 | /* Count matches: */
|
---|
874 | size_t cMatches = 0;
|
---|
875 | for (CPUProfileList_T::const_iterator it = m_llCPUProfiles.begin(); it != m_llCPUProfiles.end(); ++it)
|
---|
876 | if ((*it)->i_match(aArchitecture, enmSecondaryArch, aNamePattern))
|
---|
877 | cMatches++;
|
---|
878 |
|
---|
879 | /* Resize the output array. */
|
---|
880 | try
|
---|
881 | {
|
---|
882 | aProfiles.resize(cMatches);
|
---|
883 | }
|
---|
884 | catch (std::bad_alloc &)
|
---|
885 | {
|
---|
886 | aProfiles.resize(0);
|
---|
887 | hrc = E_OUTOFMEMORY;
|
---|
888 | }
|
---|
889 |
|
---|
890 | /* Get the return objects: */
|
---|
891 | if (SUCCEEDED(hrc) && cMatches > 0)
|
---|
892 | {
|
---|
893 | size_t iMatch = 0;
|
---|
894 | for (CPUProfileList_T::const_iterator it = m_llCPUProfiles.begin(); it != m_llCPUProfiles.end(); ++it)
|
---|
895 | if ((*it)->i_match(aArchitecture, enmSecondaryArch, aNamePattern))
|
---|
896 | {
|
---|
897 | AssertBreakStmt(iMatch < cMatches, hrc = E_UNEXPECTED);
|
---|
898 | hrc = (*it).queryInterfaceTo(aProfiles[iMatch].asOutParam());
|
---|
899 | if (SUCCEEDED(hrc))
|
---|
900 | iMatch++;
|
---|
901 | else
|
---|
902 | break;
|
---|
903 | }
|
---|
904 | AssertStmt(iMatch == cMatches || FAILED(hrc), hrc = E_UNEXPECTED);
|
---|
905 | }
|
---|
906 | }
|
---|
907 | return hrc;
|
---|
908 | }
|
---|
909 |
|
---|
910 |
|
---|
911 | HRESULT SystemProperties::getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder)
|
---|
912 | {
|
---|
913 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
914 | aDefaultMachineFolder = m->strDefaultMachineFolder;
|
---|
915 | return S_OK;
|
---|
916 | }
|
---|
917 |
|
---|
918 | HRESULT SystemProperties::setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder)
|
---|
919 | {
|
---|
920 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
921 | HRESULT hrc = i_setDefaultMachineFolder(aDefaultMachineFolder);
|
---|
922 | alock.release();
|
---|
923 | if (SUCCEEDED(hrc))
|
---|
924 | {
|
---|
925 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
926 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
927 | hrc = mParent->i_saveSettings();
|
---|
928 | }
|
---|
929 |
|
---|
930 | return hrc;
|
---|
931 | }
|
---|
932 |
|
---|
933 | HRESULT SystemProperties::getLoggingLevel(com::Utf8Str &aLoggingLevel)
|
---|
934 | {
|
---|
935 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
936 |
|
---|
937 | aLoggingLevel = m->strLoggingLevel;
|
---|
938 |
|
---|
939 | if (aLoggingLevel.isEmpty())
|
---|
940 | aLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
941 |
|
---|
942 | return S_OK;
|
---|
943 | }
|
---|
944 |
|
---|
945 |
|
---|
946 | HRESULT SystemProperties::setLoggingLevel(const com::Utf8Str &aLoggingLevel)
|
---|
947 | {
|
---|
948 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
949 | HRESULT hrc = i_setLoggingLevel(aLoggingLevel);
|
---|
950 | alock.release();
|
---|
951 |
|
---|
952 | if (SUCCEEDED(hrc))
|
---|
953 | {
|
---|
954 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
955 | hrc = mParent->i_saveSettings();
|
---|
956 | }
|
---|
957 | else
|
---|
958 | LogRel(("Cannot set passed logging level=%s, or the default one - Error=%Rhrc \n", aLoggingLevel.c_str(), hrc));
|
---|
959 |
|
---|
960 | return hrc;
|
---|
961 | }
|
---|
962 |
|
---|
963 | HRESULT SystemProperties::getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats)
|
---|
964 | {
|
---|
965 | MediumFormatList mediumFormats(m_llMediumFormats);
|
---|
966 | aMediumFormats.resize(mediumFormats.size());
|
---|
967 | size_t i = 0;
|
---|
968 | for (MediumFormatList::const_iterator it = mediumFormats.begin(); it != mediumFormats.end(); ++it, ++i)
|
---|
969 | (*it).queryInterfaceTo(aMediumFormats[i].asOutParam());
|
---|
970 | return S_OK;
|
---|
971 | }
|
---|
972 |
|
---|
973 | HRESULT SystemProperties::getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat)
|
---|
974 | {
|
---|
975 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
976 | aDefaultHardDiskFormat = m->strDefaultHardDiskFormat;
|
---|
977 | return S_OK;
|
---|
978 | }
|
---|
979 |
|
---|
980 |
|
---|
981 | HRESULT SystemProperties::setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat)
|
---|
982 | {
|
---|
983 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
984 | HRESULT hrc = i_setDefaultHardDiskFormat(aDefaultHardDiskFormat);
|
---|
985 | alock.release();
|
---|
986 | if (SUCCEEDED(hrc))
|
---|
987 | {
|
---|
988 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
989 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
990 | hrc = mParent->i_saveSettings();
|
---|
991 | }
|
---|
992 |
|
---|
993 | return hrc;
|
---|
994 | }
|
---|
995 |
|
---|
996 | HRESULT SystemProperties::getFreeDiskSpaceWarning(LONG64 *aFreeSpace)
|
---|
997 | {
|
---|
998 | NOREF(aFreeSpace);
|
---|
999 | ReturnComNotImplemented();
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | HRESULT SystemProperties::setFreeDiskSpaceWarning(LONG64 /* aFreeSpace */)
|
---|
1003 | {
|
---|
1004 | ReturnComNotImplemented();
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | HRESULT SystemProperties::getFreeDiskSpacePercentWarning(ULONG *aFreeSpacePercent)
|
---|
1008 | {
|
---|
1009 | NOREF(aFreeSpacePercent);
|
---|
1010 | ReturnComNotImplemented();
|
---|
1011 | }
|
---|
1012 |
|
---|
1013 | HRESULT SystemProperties::setFreeDiskSpacePercentWarning(ULONG /* aFreeSpacePercent */)
|
---|
1014 | {
|
---|
1015 | ReturnComNotImplemented();
|
---|
1016 | }
|
---|
1017 |
|
---|
1018 | HRESULT SystemProperties::getFreeDiskSpaceError(LONG64 *aFreeSpace)
|
---|
1019 | {
|
---|
1020 | NOREF(aFreeSpace);
|
---|
1021 | ReturnComNotImplemented();
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | HRESULT SystemProperties::setFreeDiskSpaceError(LONG64 /* aFreeSpace */)
|
---|
1025 | {
|
---|
1026 | ReturnComNotImplemented();
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | HRESULT SystemProperties::getFreeDiskSpacePercentError(ULONG *aFreeSpacePercent)
|
---|
1030 | {
|
---|
1031 | NOREF(aFreeSpacePercent);
|
---|
1032 | ReturnComNotImplemented();
|
---|
1033 | }
|
---|
1034 |
|
---|
1035 | HRESULT SystemProperties::setFreeDiskSpacePercentError(ULONG /* aFreeSpacePercent */)
|
---|
1036 | {
|
---|
1037 | ReturnComNotImplemented();
|
---|
1038 | }
|
---|
1039 |
|
---|
1040 | HRESULT SystemProperties::getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary)
|
---|
1041 | {
|
---|
1042 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1043 |
|
---|
1044 | aVRDEAuthLibrary = m->strVRDEAuthLibrary;
|
---|
1045 |
|
---|
1046 | return S_OK;
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | HRESULT SystemProperties::setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary)
|
---|
1050 | {
|
---|
1051 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1052 | HRESULT hrc = i_setVRDEAuthLibrary(aVRDEAuthLibrary);
|
---|
1053 | alock.release();
|
---|
1054 | if (SUCCEEDED(hrc))
|
---|
1055 | {
|
---|
1056 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1057 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1058 | hrc = mParent->i_saveSettings();
|
---|
1059 | }
|
---|
1060 |
|
---|
1061 | return hrc;
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | HRESULT SystemProperties::getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary)
|
---|
1065 | {
|
---|
1066 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1067 |
|
---|
1068 | aWebServiceAuthLibrary = m->strWebServiceAuthLibrary;
|
---|
1069 |
|
---|
1070 | return S_OK;
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | HRESULT SystemProperties::setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary)
|
---|
1074 | {
|
---|
1075 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1076 | HRESULT hrc = i_setWebServiceAuthLibrary(aWebServiceAuthLibrary);
|
---|
1077 | alock.release();
|
---|
1078 |
|
---|
1079 | if (SUCCEEDED(hrc))
|
---|
1080 | {
|
---|
1081 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1082 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1083 | hrc = mParent->i_saveSettings();
|
---|
1084 | }
|
---|
1085 |
|
---|
1086 | return hrc;
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | HRESULT SystemProperties::getDefaultVRDEExtPack(com::Utf8Str &aExtPack)
|
---|
1090 | {
|
---|
1091 | HRESULT hrc = S_OK;
|
---|
1092 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1093 | Utf8Str strExtPack(m->strDefaultVRDEExtPack);
|
---|
1094 | if (strExtPack.isNotEmpty())
|
---|
1095 | {
|
---|
1096 | if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
|
---|
1097 | hrc = S_OK;
|
---|
1098 | else
|
---|
1099 | #ifdef VBOX_WITH_EXTPACK
|
---|
1100 | hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&strExtPack);
|
---|
1101 | #else
|
---|
1102 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
|
---|
1103 | #endif
|
---|
1104 | }
|
---|
1105 | else
|
---|
1106 | {
|
---|
1107 | #ifdef VBOX_WITH_EXTPACK
|
---|
1108 | hrc = mParent->i_getExtPackManager()->i_getDefaultVrdeExtPack(&strExtPack);
|
---|
1109 | #endif
|
---|
1110 | if (strExtPack.isEmpty())
|
---|
1111 | {
|
---|
1112 | /*
|
---|
1113 | * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed.
|
---|
1114 | * This is hardcoded uglyness, sorry.
|
---|
1115 | */
|
---|
1116 | char szPath[RTPATH_MAX];
|
---|
1117 | int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
|
---|
1118 | if (RT_SUCCESS(vrc))
|
---|
1119 | vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP");
|
---|
1120 | if (RT_SUCCESS(vrc))
|
---|
1121 | vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
|
---|
1122 | if (RT_SUCCESS(vrc) && RTFileExists(szPath))
|
---|
1123 | {
|
---|
1124 | /* Illegal extpack name, so no conflict. */
|
---|
1125 | strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME;
|
---|
1126 | }
|
---|
1127 | }
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | if (SUCCEEDED(hrc))
|
---|
1131 | aExtPack = strExtPack;
|
---|
1132 |
|
---|
1133 | return S_OK;
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | HRESULT SystemProperties::setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
|
---|
1138 | {
|
---|
1139 | HRESULT hrc = S_OK;
|
---|
1140 | if (aExtPack.isNotEmpty())
|
---|
1141 | {
|
---|
1142 | if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
|
---|
1143 | hrc = S_OK;
|
---|
1144 | else
|
---|
1145 | #ifdef VBOX_WITH_EXTPACK
|
---|
1146 | hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&aExtPack);
|
---|
1147 | #else
|
---|
1148 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str());
|
---|
1149 | #endif
|
---|
1150 | }
|
---|
1151 | if (SUCCEEDED(hrc))
|
---|
1152 | {
|
---|
1153 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1154 | hrc = i_setDefaultVRDEExtPack(aExtPack);
|
---|
1155 | if (SUCCEEDED(hrc))
|
---|
1156 | {
|
---|
1157 | /* VirtualBox::i_saveSettings() needs the VirtualBox write lock. */
|
---|
1158 | alock.release();
|
---|
1159 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1160 | hrc = mParent->i_saveSettings();
|
---|
1161 | }
|
---|
1162 | }
|
---|
1163 |
|
---|
1164 | return hrc;
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 |
|
---|
1168 | HRESULT SystemProperties::getDefaultCryptoExtPack(com::Utf8Str &aExtPack)
|
---|
1169 | {
|
---|
1170 | HRESULT hrc = S_OK;
|
---|
1171 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1172 | Utf8Str strExtPack(m->strDefaultCryptoExtPack);
|
---|
1173 | if (strExtPack.isNotEmpty())
|
---|
1174 | {
|
---|
1175 | if (strExtPack.equals(VBOXPUELCRYPTO_KLUDGE_EXTPACK_NAME))
|
---|
1176 | hrc = S_OK;
|
---|
1177 | else
|
---|
1178 | #ifdef VBOX_WITH_EXTPACK
|
---|
1179 | hrc = mParent->i_getExtPackManager()->i_checkCryptoExtPack(&strExtPack);
|
---|
1180 | #else
|
---|
1181 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
|
---|
1182 | #endif
|
---|
1183 | }
|
---|
1184 | else
|
---|
1185 | {
|
---|
1186 | #ifdef VBOX_WITH_EXTPACK
|
---|
1187 | hrc = mParent->i_getExtPackManager()->i_getDefaultCryptoExtPack(&strExtPack);
|
---|
1188 | #endif
|
---|
1189 | if (strExtPack.isEmpty())
|
---|
1190 | {
|
---|
1191 | /*
|
---|
1192 | * Klugde - check if VBoxPuelCrypto.dll/.so/.dylib is installed.
|
---|
1193 | * This is hardcoded uglyness, sorry.
|
---|
1194 | */
|
---|
1195 | char szPath[RTPATH_MAX];
|
---|
1196 | int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
|
---|
1197 | if (RT_SUCCESS(vrc))
|
---|
1198 | vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxPuelCrypto");
|
---|
1199 | if (RT_SUCCESS(vrc))
|
---|
1200 | vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
|
---|
1201 | if (RT_SUCCESS(vrc) && RTFileExists(szPath))
|
---|
1202 | {
|
---|
1203 | /* Illegal extpack name, so no conflict. */
|
---|
1204 | strExtPack = VBOXPUELCRYPTO_KLUDGE_EXTPACK_NAME;
|
---|
1205 | }
|
---|
1206 | }
|
---|
1207 | }
|
---|
1208 |
|
---|
1209 | if (SUCCEEDED(hrc))
|
---|
1210 | aExtPack = strExtPack;
|
---|
1211 |
|
---|
1212 | return S_OK;
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 |
|
---|
1216 | HRESULT SystemProperties::setDefaultCryptoExtPack(const com::Utf8Str &aExtPack)
|
---|
1217 | {
|
---|
1218 | HRESULT hrc = S_OK;
|
---|
1219 | if (aExtPack.isNotEmpty())
|
---|
1220 | {
|
---|
1221 | if (aExtPack.equals(VBOXPUELCRYPTO_KLUDGE_EXTPACK_NAME))
|
---|
1222 | hrc = S_OK;
|
---|
1223 | else
|
---|
1224 | #ifdef VBOX_WITH_EXTPACK
|
---|
1225 | hrc = mParent->i_getExtPackManager()->i_checkCryptoExtPack(&aExtPack);
|
---|
1226 | #else
|
---|
1227 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str());
|
---|
1228 | #endif
|
---|
1229 | }
|
---|
1230 | if (SUCCEEDED(hrc))
|
---|
1231 | {
|
---|
1232 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1233 | hrc = i_setDefaultCryptoExtPack(aExtPack);
|
---|
1234 | if (SUCCEEDED(hrc))
|
---|
1235 | {
|
---|
1236 | /* VirtualBox::i_saveSettings() needs the VirtualBox write lock. */
|
---|
1237 | alock.release();
|
---|
1238 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1239 | hrc = mParent->i_saveSettings();
|
---|
1240 | }
|
---|
1241 | }
|
---|
1242 |
|
---|
1243 | return hrc;
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 |
|
---|
1247 | HRESULT SystemProperties::getLogHistoryCount(ULONG *count)
|
---|
1248 | {
|
---|
1249 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1250 |
|
---|
1251 | *count = m->uLogHistoryCount;
|
---|
1252 |
|
---|
1253 | return S_OK;
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 |
|
---|
1257 | HRESULT SystemProperties::setLogHistoryCount(ULONG count)
|
---|
1258 | {
|
---|
1259 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1260 | m->uLogHistoryCount = count;
|
---|
1261 | alock.release();
|
---|
1262 |
|
---|
1263 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1264 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1265 | return mParent->i_saveSettings();
|
---|
1266 | }
|
---|
1267 |
|
---|
1268 | HRESULT SystemProperties::getDefaultAudioDriver(AudioDriverType_T *aAudioDriver)
|
---|
1269 | {
|
---|
1270 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1271 |
|
---|
1272 | *aAudioDriver = settings::MachineConfigFile::getHostDefaultAudioDriver();
|
---|
1273 |
|
---|
1274 | return S_OK;
|
---|
1275 | }
|
---|
1276 |
|
---|
1277 | HRESULT SystemProperties::getAutostartDatabasePath(com::Utf8Str &aAutostartDbPath)
|
---|
1278 | {
|
---|
1279 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1280 |
|
---|
1281 | aAutostartDbPath = m->strAutostartDatabasePath;
|
---|
1282 |
|
---|
1283 | return S_OK;
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | HRESULT SystemProperties::setAutostartDatabasePath(const com::Utf8Str &aAutostartDbPath)
|
---|
1287 | {
|
---|
1288 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1289 | HRESULT hrc = i_setAutostartDatabasePath(aAutostartDbPath);
|
---|
1290 | alock.release();
|
---|
1291 |
|
---|
1292 | if (SUCCEEDED(hrc))
|
---|
1293 | {
|
---|
1294 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1295 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1296 | hrc = mParent->i_saveSettings();
|
---|
1297 | }
|
---|
1298 |
|
---|
1299 | return hrc;
|
---|
1300 | }
|
---|
1301 |
|
---|
1302 | HRESULT SystemProperties::getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
|
---|
1303 | {
|
---|
1304 | return i_getDefaultAdditionsISO(aDefaultAdditionsISO);
|
---|
1305 | }
|
---|
1306 |
|
---|
1307 | HRESULT SystemProperties::setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO)
|
---|
1308 | {
|
---|
1309 | RT_NOREF(aDefaultAdditionsISO);
|
---|
1310 | /** @todo not yet implemented, settings handling is missing */
|
---|
1311 | ReturnComNotImplemented();
|
---|
1312 | #if 0 /* not implemented */
|
---|
1313 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1314 | HRESULT hrc = i_setDefaultAdditionsISO(aDefaultAdditionsISO);
|
---|
1315 | alock.release();
|
---|
1316 |
|
---|
1317 | if (SUCCEEDED(hrc))
|
---|
1318 | {
|
---|
1319 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1320 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1321 | hrc = mParent->i_saveSettings();
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 | return hrc;
|
---|
1325 | #endif
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | HRESULT SystemProperties::getDefaultFrontend(com::Utf8Str &aDefaultFrontend)
|
---|
1329 | {
|
---|
1330 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1331 | aDefaultFrontend = m->strDefaultFrontend;
|
---|
1332 | return S_OK;
|
---|
1333 | }
|
---|
1334 |
|
---|
1335 | HRESULT SystemProperties::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
|
---|
1336 | {
|
---|
1337 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1338 | if (m->strDefaultFrontend == aDefaultFrontend)
|
---|
1339 | return S_OK;
|
---|
1340 | HRESULT hrc = i_setDefaultFrontend(aDefaultFrontend);
|
---|
1341 | alock.release();
|
---|
1342 |
|
---|
1343 | if (SUCCEEDED(hrc))
|
---|
1344 | {
|
---|
1345 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
1346 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
1347 | hrc = mParent->i_saveSettings();
|
---|
1348 | }
|
---|
1349 |
|
---|
1350 | return hrc;
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 | HRESULT SystemProperties::getScreenShotFormats(std::vector<BitmapFormat_T> &aBitmapFormats)
|
---|
1354 | {
|
---|
1355 | aBitmapFormats.push_back(BitmapFormat_BGR0);
|
---|
1356 | aBitmapFormats.push_back(BitmapFormat_BGRA);
|
---|
1357 | aBitmapFormats.push_back(BitmapFormat_RGBA);
|
---|
1358 | aBitmapFormats.push_back(BitmapFormat_PNG);
|
---|
1359 | return S_OK;
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | HRESULT SystemProperties::getProxyMode(ProxyMode_T *pProxyMode)
|
---|
1363 | {
|
---|
1364 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1365 | ProxyMode_T enmMode = *pProxyMode = (ProxyMode_T)m->uProxyMode;
|
---|
1366 | AssertMsgReturn(enmMode == ProxyMode_System || enmMode == ProxyMode_NoProxy || enmMode == ProxyMode_Manual,
|
---|
1367 | ("enmMode=%d\n", enmMode), E_UNEXPECTED);
|
---|
1368 | return S_OK;
|
---|
1369 | }
|
---|
1370 |
|
---|
1371 | HRESULT SystemProperties::setProxyMode(ProxyMode_T aProxyMode)
|
---|
1372 | {
|
---|
1373 | /* Validate input. */
|
---|
1374 | switch (aProxyMode)
|
---|
1375 | {
|
---|
1376 | case ProxyMode_System:
|
---|
1377 | case ProxyMode_NoProxy:
|
---|
1378 | case ProxyMode_Manual:
|
---|
1379 | break;
|
---|
1380 | default:
|
---|
1381 | return setError(E_INVALIDARG, tr("Invalid ProxyMode value: %d"), (int)aProxyMode);
|
---|
1382 | }
|
---|
1383 |
|
---|
1384 | /* Set and write out settings. */
|
---|
1385 | {
|
---|
1386 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1387 | m->uProxyMode = aProxyMode;
|
---|
1388 | }
|
---|
1389 | AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */
|
---|
1390 | return mParent->i_saveSettings();
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | HRESULT SystemProperties::getProxyURL(com::Utf8Str &aProxyURL)
|
---|
1394 | {
|
---|
1395 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1396 | aProxyURL = m->strProxyUrl;
|
---|
1397 | return S_OK;
|
---|
1398 | }
|
---|
1399 |
|
---|
1400 | HRESULT SystemProperties::setProxyURL(const com::Utf8Str &aProxyURL)
|
---|
1401 | {
|
---|
1402 | /*
|
---|
1403 | * Validate input.
|
---|
1404 | */
|
---|
1405 | Utf8Str const *pStrProxyUrl = &aProxyURL;
|
---|
1406 | Utf8Str strTmp;
|
---|
1407 | if (pStrProxyUrl->isNotEmpty())
|
---|
1408 | {
|
---|
1409 | /* RTUriParse requires a scheme, so append 'http://' if none seems present: */
|
---|
1410 | if (pStrProxyUrl->find("://") == RTCString::npos)
|
---|
1411 | {
|
---|
1412 | strTmp.printf("http://%s", aProxyURL.c_str());
|
---|
1413 | pStrProxyUrl = &strTmp;
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | /* Use RTUriParse to check the format. There must be a hostname, but nothing
|
---|
1417 | can follow it and the port. */
|
---|
1418 | RTURIPARSED Parsed;
|
---|
1419 | int vrc = RTUriParse(pStrProxyUrl->c_str(), &Parsed);
|
---|
1420 | if (RT_FAILURE(vrc))
|
---|
1421 | return setErrorBoth(E_INVALIDARG, vrc, tr("Failed to parse proxy URL: %Rrc"), vrc);
|
---|
1422 | if ( Parsed.cchAuthorityHost == 0
|
---|
1423 | && !RTUriIsSchemeMatch(pStrProxyUrl->c_str(), "direct"))
|
---|
1424 | return setError(E_INVALIDARG, tr("Proxy URL must include a hostname"));
|
---|
1425 | if (Parsed.cchPath > 0)
|
---|
1426 | return setError(E_INVALIDARG, tr("Proxy URL must not include a path component (%.*s)"),
|
---|
1427 | Parsed.cchPath, pStrProxyUrl->c_str() + Parsed.offPath);
|
---|
1428 | if (Parsed.cchQuery > 0)
|
---|
1429 | return setError(E_INVALIDARG, tr("Proxy URL must not include a query component (?%.*s)"),
|
---|
1430 | Parsed.cchQuery, pStrProxyUrl->c_str() + Parsed.offQuery);
|
---|
1431 | if (Parsed.cchFragment > 0)
|
---|
1432 | return setError(E_INVALIDARG, tr("Proxy URL must not include a fragment component (#%.*s)"),
|
---|
1433 | Parsed.cchFragment, pStrProxyUrl->c_str() + Parsed.offFragment);
|
---|
1434 | }
|
---|
1435 |
|
---|
1436 | /*
|
---|
1437 | * Set and write out settings.
|
---|
1438 | */
|
---|
1439 | {
|
---|
1440 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1441 | m->strProxyUrl = *pStrProxyUrl;
|
---|
1442 | }
|
---|
1443 | AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */
|
---|
1444 | return mParent->i_saveSettings();
|
---|
1445 | }
|
---|
1446 |
|
---|
1447 | HRESULT SystemProperties::getSupportedParavirtProviders(std::vector<ParavirtProvider_T> &aSupportedParavirtProviders)
|
---|
1448 | {
|
---|
1449 | static const ParavirtProvider_T aParavirtProviders[] =
|
---|
1450 | {
|
---|
1451 | ParavirtProvider_None,
|
---|
1452 | ParavirtProvider_Default,
|
---|
1453 | ParavirtProvider_Legacy,
|
---|
1454 | ParavirtProvider_Minimal,
|
---|
1455 | ParavirtProvider_HyperV,
|
---|
1456 | ParavirtProvider_KVM,
|
---|
1457 | };
|
---|
1458 | aSupportedParavirtProviders.assign(aParavirtProviders,
|
---|
1459 | aParavirtProviders + RT_ELEMENTS(aParavirtProviders));
|
---|
1460 | return S_OK;
|
---|
1461 | }
|
---|
1462 |
|
---|
1463 | HRESULT SystemProperties::getSupportedClipboardModes(std::vector<ClipboardMode_T> &aSupportedClipboardModes)
|
---|
1464 | {
|
---|
1465 | static const ClipboardMode_T aClipboardModes[] =
|
---|
1466 | {
|
---|
1467 | ClipboardMode_Disabled,
|
---|
1468 | ClipboardMode_HostToGuest,
|
---|
1469 | ClipboardMode_GuestToHost,
|
---|
1470 | ClipboardMode_Bidirectional,
|
---|
1471 | };
|
---|
1472 | aSupportedClipboardModes.assign(aClipboardModes,
|
---|
1473 | aClipboardModes + RT_ELEMENTS(aClipboardModes));
|
---|
1474 | return S_OK;
|
---|
1475 | }
|
---|
1476 |
|
---|
1477 | HRESULT SystemProperties::getSupportedDnDModes(std::vector<DnDMode_T> &aSupportedDnDModes)
|
---|
1478 | {
|
---|
1479 | static const DnDMode_T aDnDModes[] =
|
---|
1480 | {
|
---|
1481 | DnDMode_Disabled,
|
---|
1482 | DnDMode_HostToGuest,
|
---|
1483 | DnDMode_GuestToHost,
|
---|
1484 | DnDMode_Bidirectional,
|
---|
1485 | };
|
---|
1486 | aSupportedDnDModes.assign(aDnDModes,
|
---|
1487 | aDnDModes + RT_ELEMENTS(aDnDModes));
|
---|
1488 | return S_OK;
|
---|
1489 | }
|
---|
1490 |
|
---|
1491 | HRESULT SystemProperties::getSupportedFirmwareTypes(std::vector<FirmwareType_T> &aSupportedFirmwareTypes)
|
---|
1492 | {
|
---|
1493 | static const FirmwareType_T aFirmwareTypes[] =
|
---|
1494 | {
|
---|
1495 | FirmwareType_BIOS,
|
---|
1496 | FirmwareType_EFI,
|
---|
1497 | FirmwareType_EFI32,
|
---|
1498 | FirmwareType_EFI64,
|
---|
1499 | FirmwareType_EFIDUAL,
|
---|
1500 | };
|
---|
1501 | aSupportedFirmwareTypes.assign(aFirmwareTypes,
|
---|
1502 | aFirmwareTypes + RT_ELEMENTS(aFirmwareTypes));
|
---|
1503 | return S_OK;
|
---|
1504 | }
|
---|
1505 |
|
---|
1506 | HRESULT SystemProperties::getSupportedPointingHIDTypes(std::vector<PointingHIDType_T> &aSupportedPointingHIDTypes)
|
---|
1507 | {
|
---|
1508 | static const PointingHIDType_T aPointingHIDTypes[] =
|
---|
1509 | {
|
---|
1510 | PointingHIDType_PS2Mouse,
|
---|
1511 | #ifdef DEBUG
|
---|
1512 | PointingHIDType_USBMouse,
|
---|
1513 | #endif
|
---|
1514 | PointingHIDType_USBTablet,
|
---|
1515 | #ifdef DEBUG
|
---|
1516 | PointingHIDType_ComboMouse,
|
---|
1517 | #endif
|
---|
1518 | PointingHIDType_USBMultiTouch,
|
---|
1519 | PointingHIDType_USBMultiTouchScreenPlusPad,
|
---|
1520 | };
|
---|
1521 | aSupportedPointingHIDTypes.assign(aPointingHIDTypes,
|
---|
1522 | aPointingHIDTypes + RT_ELEMENTS(aPointingHIDTypes));
|
---|
1523 | return S_OK;
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | HRESULT SystemProperties::getSupportedKeyboardHIDTypes(std::vector<KeyboardHIDType_T> &aSupportedKeyboardHIDTypes)
|
---|
1527 | {
|
---|
1528 | static const KeyboardHIDType_T aKeyboardHIDTypes[] =
|
---|
1529 | {
|
---|
1530 | KeyboardHIDType_PS2Keyboard,
|
---|
1531 | KeyboardHIDType_USBKeyboard,
|
---|
1532 | #ifdef DEBUG
|
---|
1533 | KeyboardHIDType_ComboKeyboard,
|
---|
1534 | #endif
|
---|
1535 | };
|
---|
1536 | aSupportedKeyboardHIDTypes.assign(aKeyboardHIDTypes,
|
---|
1537 | aKeyboardHIDTypes + RT_ELEMENTS(aKeyboardHIDTypes));
|
---|
1538 | return S_OK;
|
---|
1539 | }
|
---|
1540 |
|
---|
1541 | HRESULT SystemProperties::getSupportedVFSTypes(std::vector<VFSType_T> &aSupportedVFSTypes)
|
---|
1542 | {
|
---|
1543 | static const VFSType_T aVFSTypes[] =
|
---|
1544 | {
|
---|
1545 | VFSType_File,
|
---|
1546 | VFSType_Cloud,
|
---|
1547 | VFSType_S3,
|
---|
1548 | #ifdef DEBUG
|
---|
1549 | VFSType_WebDav,
|
---|
1550 | #endif
|
---|
1551 | };
|
---|
1552 | aSupportedVFSTypes.assign(aVFSTypes,
|
---|
1553 | aVFSTypes + RT_ELEMENTS(aVFSTypes));
|
---|
1554 | return S_OK;
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | HRESULT SystemProperties::getSupportedImportOptions(std::vector<ImportOptions_T> &aSupportedImportOptions)
|
---|
1558 | {
|
---|
1559 | static const ImportOptions_T aImportOptions[] =
|
---|
1560 | {
|
---|
1561 | ImportOptions_KeepAllMACs,
|
---|
1562 | ImportOptions_KeepNATMACs,
|
---|
1563 | ImportOptions_ImportToVDI,
|
---|
1564 | };
|
---|
1565 | aSupportedImportOptions.assign(aImportOptions,
|
---|
1566 | aImportOptions + RT_ELEMENTS(aImportOptions));
|
---|
1567 | return S_OK;
|
---|
1568 | }
|
---|
1569 |
|
---|
1570 | HRESULT SystemProperties::getSupportedExportOptions(std::vector<ExportOptions_T> &aSupportedExportOptions)
|
---|
1571 | {
|
---|
1572 | static const ExportOptions_T aExportOptions[] =
|
---|
1573 | {
|
---|
1574 | ExportOptions_CreateManifest,
|
---|
1575 | ExportOptions_ExportDVDImages,
|
---|
1576 | ExportOptions_StripAllMACs,
|
---|
1577 | ExportOptions_StripAllNonNATMACs,
|
---|
1578 | };
|
---|
1579 | aSupportedExportOptions.assign(aExportOptions,
|
---|
1580 | aExportOptions + RT_ELEMENTS(aExportOptions));
|
---|
1581 | return S_OK;
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 | HRESULT SystemProperties::getSupportedRecordingFeatures(std::vector<RecordingFeature_T> &aSupportedRecordingFeatures)
|
---|
1585 | {
|
---|
1586 | #ifdef VBOX_WITH_RECORDING
|
---|
1587 | static const RecordingFeature_T aRecordingFeatures[] =
|
---|
1588 | {
|
---|
1589 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
1590 | RecordingFeature_Audio,
|
---|
1591 | # endif
|
---|
1592 | RecordingFeature_Video,
|
---|
1593 | };
|
---|
1594 | aSupportedRecordingFeatures.assign(aRecordingFeatures,
|
---|
1595 | aRecordingFeatures + RT_ELEMENTS(aRecordingFeatures));
|
---|
1596 | #else /* !VBOX_WITH_RECORDING */
|
---|
1597 | aSupportedRecordingFeatures.clear();
|
---|
1598 | #endif /* VBOX_WITH_RECORDING */
|
---|
1599 | return S_OK;
|
---|
1600 | }
|
---|
1601 |
|
---|
1602 | HRESULT SystemProperties::getSupportedRecordingAudioCodecs(std::vector<RecordingAudioCodec_T> &aSupportedRecordingAudioCodecs)
|
---|
1603 | {
|
---|
1604 | static const RecordingAudioCodec_T aRecordingAudioCodecs[] =
|
---|
1605 | {
|
---|
1606 | RecordingAudioCodec_None,
|
---|
1607 | #ifdef DEBUG
|
---|
1608 | RecordingAudioCodec_WavPCM,
|
---|
1609 | #endif
|
---|
1610 | #ifdef VBOX_WITH_LIBVORBIS
|
---|
1611 | RecordingAudioCodec_OggVorbis,
|
---|
1612 | #endif
|
---|
1613 | };
|
---|
1614 | aSupportedRecordingAudioCodecs.assign(aRecordingAudioCodecs,
|
---|
1615 | aRecordingAudioCodecs + RT_ELEMENTS(aRecordingAudioCodecs));
|
---|
1616 | return S_OK;
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | HRESULT SystemProperties::getSupportedRecordingVideoCodecs(std::vector<RecordingVideoCodec_T> &aSupportedRecordingVideoCodecs)
|
---|
1620 | {
|
---|
1621 | static const RecordingVideoCodec_T aRecordingVideoCodecs[] =
|
---|
1622 | {
|
---|
1623 | RecordingVideoCodec_None,
|
---|
1624 | #ifdef VBOX_WITH_LIBVPX
|
---|
1625 | RecordingVideoCodec_VP8,
|
---|
1626 | #endif
|
---|
1627 | #ifdef DEBUG
|
---|
1628 | RecordingVideoCodec_VP9,
|
---|
1629 | RecordingVideoCodec_AV1,
|
---|
1630 | #endif
|
---|
1631 | };
|
---|
1632 | aSupportedRecordingVideoCodecs.assign(aRecordingVideoCodecs,
|
---|
1633 | aRecordingVideoCodecs + RT_ELEMENTS(aRecordingVideoCodecs));
|
---|
1634 | return S_OK;
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | HRESULT SystemProperties::getSupportedRecordingVSModes(std::vector<RecordingVideoScalingMode_T> &aSupportedRecordingVideoScalingModes)
|
---|
1638 | {
|
---|
1639 | static const RecordingVideoScalingMode_T aRecordingVideoScalingModes[] =
|
---|
1640 | {
|
---|
1641 | RecordingVideoScalingMode_None,
|
---|
1642 | #ifdef DEBUG
|
---|
1643 | RecordingVideoScalingMode_NearestNeighbor,
|
---|
1644 | RecordingVideoScalingMode_Bilinear,
|
---|
1645 | RecordingVideoScalingMode_Bicubic,
|
---|
1646 | #endif
|
---|
1647 | };
|
---|
1648 | aSupportedRecordingVideoScalingModes.assign(aRecordingVideoScalingModes,
|
---|
1649 | aRecordingVideoScalingModes + RT_ELEMENTS(aRecordingVideoScalingModes));
|
---|
1650 | return S_OK;
|
---|
1651 | }
|
---|
1652 |
|
---|
1653 | HRESULT SystemProperties::getSupportedRecordingARCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingAudioRateControlModes)
|
---|
1654 | {
|
---|
1655 | static const RecordingRateControlMode_T aRecordingAudioRateControlModes[] =
|
---|
1656 | {
|
---|
1657 | #ifdef DEBUG
|
---|
1658 | RecordingRateControlMode_ABR,
|
---|
1659 | RecordingRateControlMode_CBR,
|
---|
1660 | #endif
|
---|
1661 | RecordingRateControlMode_VBR
|
---|
1662 | };
|
---|
1663 | aSupportedRecordingAudioRateControlModes.assign(aRecordingAudioRateControlModes,
|
---|
1664 | aRecordingAudioRateControlModes + RT_ELEMENTS(aRecordingAudioRateControlModes));
|
---|
1665 | return S_OK;
|
---|
1666 | }
|
---|
1667 |
|
---|
1668 | HRESULT SystemProperties::getSupportedRecordingVRCModes(std::vector<RecordingRateControlMode_T> &aSupportedRecordingVideoRateControlModes)
|
---|
1669 | {
|
---|
1670 | static const RecordingRateControlMode_T aRecordingVideoRateControlModes[] =
|
---|
1671 | {
|
---|
1672 | #ifdef DEBUG
|
---|
1673 | RecordingRateControlMode_ABR,
|
---|
1674 | RecordingRateControlMode_CBR,
|
---|
1675 | #endif
|
---|
1676 | RecordingRateControlMode_VBR
|
---|
1677 | };
|
---|
1678 | aSupportedRecordingVideoRateControlModes.assign(aRecordingVideoRateControlModes,
|
---|
1679 | aRecordingVideoRateControlModes + RT_ELEMENTS(aRecordingVideoRateControlModes));
|
---|
1680 | return S_OK;
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | HRESULT SystemProperties::getSupportedGraphicsControllerTypes(std::vector<GraphicsControllerType_T> &aSupportedGraphicsControllerTypes)
|
---|
1684 | {
|
---|
1685 | static const GraphicsControllerType_T aGraphicsControllerTypes[] =
|
---|
1686 | {
|
---|
1687 | GraphicsControllerType_VBoxVGA,
|
---|
1688 | GraphicsControllerType_VMSVGA,
|
---|
1689 | GraphicsControllerType_VBoxSVGA,
|
---|
1690 | GraphicsControllerType_Null,
|
---|
1691 | };
|
---|
1692 | aSupportedGraphicsControllerTypes.assign(aGraphicsControllerTypes,
|
---|
1693 | aGraphicsControllerTypes + RT_ELEMENTS(aGraphicsControllerTypes));
|
---|
1694 | return S_OK;
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | HRESULT SystemProperties::getSupportedCloneOptions(std::vector<CloneOptions_T> &aSupportedCloneOptions)
|
---|
1698 | {
|
---|
1699 | static const CloneOptions_T aCloneOptions[] =
|
---|
1700 | {
|
---|
1701 | CloneOptions_Link,
|
---|
1702 | CloneOptions_KeepAllMACs,
|
---|
1703 | CloneOptions_KeepNATMACs,
|
---|
1704 | CloneOptions_KeepDiskNames,
|
---|
1705 | CloneOptions_KeepHwUUIDs,
|
---|
1706 | };
|
---|
1707 | aSupportedCloneOptions.assign(aCloneOptions,
|
---|
1708 | aCloneOptions + RT_ELEMENTS(aCloneOptions));
|
---|
1709 | return S_OK;
|
---|
1710 | }
|
---|
1711 |
|
---|
1712 | HRESULT SystemProperties::getSupportedAutostopTypes(std::vector<AutostopType_T> &aSupportedAutostopTypes)
|
---|
1713 | {
|
---|
1714 | static const AutostopType_T aAutostopTypes[] =
|
---|
1715 | {
|
---|
1716 | AutostopType_Disabled,
|
---|
1717 | AutostopType_SaveState,
|
---|
1718 | AutostopType_PowerOff,
|
---|
1719 | AutostopType_AcpiShutdown,
|
---|
1720 | };
|
---|
1721 | aSupportedAutostopTypes.assign(aAutostopTypes,
|
---|
1722 | aAutostopTypes + RT_ELEMENTS(aAutostopTypes));
|
---|
1723 | return S_OK;
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 | HRESULT SystemProperties::getSupportedVMProcPriorities(std::vector<VMProcPriority_T> &aSupportedVMProcPriorities)
|
---|
1727 | {
|
---|
1728 | static const VMProcPriority_T aVMProcPriorities[] =
|
---|
1729 | {
|
---|
1730 | VMProcPriority_Default,
|
---|
1731 | VMProcPriority_Flat,
|
---|
1732 | VMProcPriority_Low,
|
---|
1733 | VMProcPriority_Normal,
|
---|
1734 | VMProcPriority_High,
|
---|
1735 | };
|
---|
1736 | aSupportedVMProcPriorities.assign(aVMProcPriorities,
|
---|
1737 | aVMProcPriorities + RT_ELEMENTS(aVMProcPriorities));
|
---|
1738 | return S_OK;
|
---|
1739 | }
|
---|
1740 |
|
---|
1741 | HRESULT SystemProperties::getSupportedNetworkAttachmentTypes(std::vector<NetworkAttachmentType_T> &aSupportedNetworkAttachmentTypes)
|
---|
1742 | {
|
---|
1743 | static const NetworkAttachmentType_T aNetworkAttachmentTypes[] =
|
---|
1744 | {
|
---|
1745 | NetworkAttachmentType_NAT,
|
---|
1746 | NetworkAttachmentType_Bridged,
|
---|
1747 | NetworkAttachmentType_Internal,
|
---|
1748 | NetworkAttachmentType_HostOnly,
|
---|
1749 | #ifdef VBOX_WITH_VMNET
|
---|
1750 | NetworkAttachmentType_HostOnlyNetwork,
|
---|
1751 | #endif /* VBOX_WITH_VMNET */
|
---|
1752 | NetworkAttachmentType_Generic,
|
---|
1753 | NetworkAttachmentType_NATNetwork,
|
---|
1754 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
1755 | NetworkAttachmentType_Cloud,
|
---|
1756 | #endif
|
---|
1757 | NetworkAttachmentType_Null,
|
---|
1758 | };
|
---|
1759 | aSupportedNetworkAttachmentTypes.assign(aNetworkAttachmentTypes,
|
---|
1760 | aNetworkAttachmentTypes + RT_ELEMENTS(aNetworkAttachmentTypes));
|
---|
1761 | return S_OK;
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | HRESULT SystemProperties::getSupportedNetworkAdapterTypes(std::vector<NetworkAdapterType_T> &aSupportedNetworkAdapterTypes)
|
---|
1765 | {
|
---|
1766 | static const NetworkAdapterType_T aNetworkAdapterTypes[] =
|
---|
1767 | {
|
---|
1768 | NetworkAdapterType_Am79C970A,
|
---|
1769 | NetworkAdapterType_Am79C973,
|
---|
1770 | NetworkAdapterType_I82540EM,
|
---|
1771 | NetworkAdapterType_I82543GC,
|
---|
1772 | NetworkAdapterType_I82545EM,
|
---|
1773 | NetworkAdapterType_Virtio,
|
---|
1774 | };
|
---|
1775 | aSupportedNetworkAdapterTypes.assign(aNetworkAdapterTypes,
|
---|
1776 | aNetworkAdapterTypes + RT_ELEMENTS(aNetworkAdapterTypes));
|
---|
1777 | return S_OK;
|
---|
1778 | }
|
---|
1779 |
|
---|
1780 | HRESULT SystemProperties::getSupportedPortModes(std::vector<PortMode_T> &aSupportedPortModes)
|
---|
1781 | {
|
---|
1782 | static const PortMode_T aPortModes[] =
|
---|
1783 | {
|
---|
1784 | PortMode_Disconnected,
|
---|
1785 | PortMode_HostPipe,
|
---|
1786 | PortMode_HostDevice,
|
---|
1787 | PortMode_RawFile,
|
---|
1788 | PortMode_TCP,
|
---|
1789 | };
|
---|
1790 | aSupportedPortModes.assign(aPortModes,
|
---|
1791 | aPortModes + RT_ELEMENTS(aPortModes));
|
---|
1792 | return S_OK;
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 | HRESULT SystemProperties::getSupportedUartTypes(std::vector<UartType_T> &aSupportedUartTypes)
|
---|
1796 | {
|
---|
1797 | static const UartType_T aUartTypes[] =
|
---|
1798 | {
|
---|
1799 | UartType_U16450,
|
---|
1800 | UartType_U16550A,
|
---|
1801 | UartType_U16750,
|
---|
1802 | };
|
---|
1803 | aSupportedUartTypes.assign(aUartTypes,
|
---|
1804 | aUartTypes + RT_ELEMENTS(aUartTypes));
|
---|
1805 | return S_OK;
|
---|
1806 | }
|
---|
1807 |
|
---|
1808 | HRESULT SystemProperties::getSupportedUSBControllerTypes(std::vector<USBControllerType_T> &aSupportedUSBControllerTypes)
|
---|
1809 | {
|
---|
1810 | static const USBControllerType_T aUSBControllerTypes[] =
|
---|
1811 | {
|
---|
1812 | USBControllerType_OHCI,
|
---|
1813 | USBControllerType_EHCI,
|
---|
1814 | USBControllerType_XHCI,
|
---|
1815 | };
|
---|
1816 | aSupportedUSBControllerTypes.assign(aUSBControllerTypes,
|
---|
1817 | aUSBControllerTypes + RT_ELEMENTS(aUSBControllerTypes));
|
---|
1818 | return S_OK;
|
---|
1819 | }
|
---|
1820 |
|
---|
1821 | HRESULT SystemProperties::getSupportedAudioDriverTypes(std::vector<AudioDriverType_T> &aSupportedAudioDriverTypes)
|
---|
1822 | {
|
---|
1823 | static const AudioDriverType_T aAudioDriverTypes[] =
|
---|
1824 | {
|
---|
1825 | AudioDriverType_Default,
|
---|
1826 | #ifdef RT_OS_WINDOWS
|
---|
1827 | # if 0 /* deprecated for many years now */
|
---|
1828 | AudioDriverType_WinMM,
|
---|
1829 | # endif
|
---|
1830 | AudioDriverType_WAS,
|
---|
1831 | AudioDriverType_DirectSound,
|
---|
1832 | #endif
|
---|
1833 | #ifdef RT_OS_DARWIN
|
---|
1834 | AudioDriverType_CoreAudio,
|
---|
1835 | #endif
|
---|
1836 | #ifdef RT_OS_OS2
|
---|
1837 | AudioDriverType_MMPM,
|
---|
1838 | #endif
|
---|
1839 | #ifdef RT_OS_SOLARIS
|
---|
1840 | # if 0 /* deprecated for many years now */
|
---|
1841 | AudioDriverType_SolAudio,
|
---|
1842 | # endif
|
---|
1843 | #endif
|
---|
1844 | #ifdef VBOX_WITH_AUDIO_ALSA
|
---|
1845 | AudioDriverType_ALSA,
|
---|
1846 | #endif
|
---|
1847 | #ifdef VBOX_WITH_AUDIO_OSS
|
---|
1848 | AudioDriverType_OSS,
|
---|
1849 | #endif
|
---|
1850 | #ifdef VBOX_WITH_AUDIO_PULSE
|
---|
1851 | AudioDriverType_Pulse,
|
---|
1852 | #endif
|
---|
1853 | AudioDriverType_Null,
|
---|
1854 | };
|
---|
1855 | aSupportedAudioDriverTypes.assign(aAudioDriverTypes,
|
---|
1856 | aAudioDriverTypes + RT_ELEMENTS(aAudioDriverTypes));
|
---|
1857 | return S_OK;
|
---|
1858 | }
|
---|
1859 |
|
---|
1860 | HRESULT SystemProperties::getSupportedAudioControllerTypes(std::vector<AudioControllerType_T> &aSupportedAudioControllerTypes)
|
---|
1861 | {
|
---|
1862 | static const AudioControllerType_T aAudioControllerTypes[] =
|
---|
1863 | {
|
---|
1864 | AudioControllerType_AC97,
|
---|
1865 | AudioControllerType_SB16,
|
---|
1866 | AudioControllerType_HDA,
|
---|
1867 | };
|
---|
1868 | aSupportedAudioControllerTypes.assign(aAudioControllerTypes,
|
---|
1869 | aAudioControllerTypes + RT_ELEMENTS(aAudioControllerTypes));
|
---|
1870 | return S_OK;
|
---|
1871 | }
|
---|
1872 |
|
---|
1873 | HRESULT SystemProperties::getSupportedStorageBuses(std::vector<StorageBus_T> &aSupportedStorageBuses)
|
---|
1874 | {
|
---|
1875 | static const StorageBus_T aStorageBuses[] =
|
---|
1876 | {
|
---|
1877 | StorageBus_SATA,
|
---|
1878 | StorageBus_IDE,
|
---|
1879 | StorageBus_SCSI,
|
---|
1880 | StorageBus_Floppy,
|
---|
1881 | StorageBus_SAS,
|
---|
1882 | StorageBus_USB,
|
---|
1883 | StorageBus_PCIe,
|
---|
1884 | StorageBus_VirtioSCSI,
|
---|
1885 | };
|
---|
1886 | aSupportedStorageBuses.assign(aStorageBuses,
|
---|
1887 | aStorageBuses + RT_ELEMENTS(aStorageBuses));
|
---|
1888 | return S_OK;
|
---|
1889 | }
|
---|
1890 |
|
---|
1891 | HRESULT SystemProperties::getSupportedStorageControllerTypes(std::vector<StorageControllerType_T> &aSupportedStorageControllerTypes)
|
---|
1892 | {
|
---|
1893 | static const StorageControllerType_T aStorageControllerTypes[] =
|
---|
1894 | {
|
---|
1895 | StorageControllerType_IntelAhci,
|
---|
1896 | StorageControllerType_PIIX4,
|
---|
1897 | StorageControllerType_PIIX3,
|
---|
1898 | StorageControllerType_ICH6,
|
---|
1899 | StorageControllerType_LsiLogic,
|
---|
1900 | StorageControllerType_BusLogic,
|
---|
1901 | StorageControllerType_I82078,
|
---|
1902 | StorageControllerType_LsiLogicSas,
|
---|
1903 | StorageControllerType_USB,
|
---|
1904 | StorageControllerType_NVMe,
|
---|
1905 | StorageControllerType_VirtioSCSI,
|
---|
1906 | };
|
---|
1907 | aSupportedStorageControllerTypes.assign(aStorageControllerTypes,
|
---|
1908 | aStorageControllerTypes + RT_ELEMENTS(aStorageControllerTypes));
|
---|
1909 | return S_OK;
|
---|
1910 | }
|
---|
1911 |
|
---|
1912 | HRESULT SystemProperties::getSupportedChipsetTypes(std::vector<ChipsetType_T> &aSupportedChipsetTypes)
|
---|
1913 | {
|
---|
1914 | static const ChipsetType_T aChipsetTypes[] =
|
---|
1915 | {
|
---|
1916 | ChipsetType_PIIX3,
|
---|
1917 | ChipsetType_ICH9,
|
---|
1918 | };
|
---|
1919 | aSupportedChipsetTypes.assign(aChipsetTypes,
|
---|
1920 | aChipsetTypes + RT_ELEMENTS(aChipsetTypes));
|
---|
1921 | return S_OK;
|
---|
1922 | }
|
---|
1923 |
|
---|
1924 | HRESULT SystemProperties::getSupportedIommuTypes(std::vector<IommuType_T> &aSupportedIommuTypes)
|
---|
1925 | {
|
---|
1926 | static const IommuType_T aIommuTypes[] =
|
---|
1927 | {
|
---|
1928 | IommuType_None,
|
---|
1929 | IommuType_Automatic,
|
---|
1930 | IommuType_AMD,
|
---|
1931 | /** @todo Add Intel when it's supported. */
|
---|
1932 | };
|
---|
1933 | aSupportedIommuTypes.assign(aIommuTypes,
|
---|
1934 | aIommuTypes + RT_ELEMENTS(aIommuTypes));
|
---|
1935 | return S_OK;
|
---|
1936 | }
|
---|
1937 |
|
---|
1938 | HRESULT SystemProperties::getSupportedTpmTypes(std::vector<TpmType_T> &aSupportedTpmTypes)
|
---|
1939 | {
|
---|
1940 | static const TpmType_T aTpmTypes[] =
|
---|
1941 | {
|
---|
1942 | TpmType_None,
|
---|
1943 | TpmType_v1_2,
|
---|
1944 | TpmType_v2_0
|
---|
1945 | };
|
---|
1946 | aSupportedTpmTypes.assign(aTpmTypes,
|
---|
1947 | aTpmTypes + RT_ELEMENTS(aTpmTypes));
|
---|
1948 | return S_OK;
|
---|
1949 | }
|
---|
1950 |
|
---|
1951 |
|
---|
1952 | // public methods only for internal purposes
|
---|
1953 | /////////////////////////////////////////////////////////////////////////////
|
---|
1954 |
|
---|
1955 | HRESULT SystemProperties::i_loadSettings(const settings::SystemProperties &data)
|
---|
1956 | {
|
---|
1957 | AutoCaller autoCaller(this);
|
---|
1958 | if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
|
---|
1959 |
|
---|
1960 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1961 | HRESULT hrc = i_setDefaultMachineFolder(data.strDefaultMachineFolder);
|
---|
1962 | if (FAILED(hrc)) return hrc;
|
---|
1963 |
|
---|
1964 | hrc = i_setLoggingLevel(data.strLoggingLevel);
|
---|
1965 | if (FAILED(hrc)) return hrc;
|
---|
1966 |
|
---|
1967 | hrc = i_setDefaultHardDiskFormat(data.strDefaultHardDiskFormat);
|
---|
1968 | if (FAILED(hrc)) return hrc;
|
---|
1969 |
|
---|
1970 | hrc = i_setVRDEAuthLibrary(data.strVRDEAuthLibrary);
|
---|
1971 | if (FAILED(hrc)) return hrc;
|
---|
1972 |
|
---|
1973 | hrc = i_setWebServiceAuthLibrary(data.strWebServiceAuthLibrary);
|
---|
1974 | if (FAILED(hrc)) return hrc;
|
---|
1975 |
|
---|
1976 | hrc = i_setDefaultVRDEExtPack(data.strDefaultVRDEExtPack);
|
---|
1977 | if (FAILED(hrc)) return hrc;
|
---|
1978 |
|
---|
1979 | hrc = i_setDefaultCryptoExtPack(data.strDefaultCryptoExtPack);
|
---|
1980 | if (FAILED(hrc)) return hrc;
|
---|
1981 |
|
---|
1982 | m->uLogHistoryCount = data.uLogHistoryCount;
|
---|
1983 | m->fExclusiveHwVirt = data.fExclusiveHwVirt;
|
---|
1984 | m->uProxyMode = data.uProxyMode;
|
---|
1985 | m->strProxyUrl = data.strProxyUrl;
|
---|
1986 |
|
---|
1987 | m->strLanguageId = data.strLanguageId;
|
---|
1988 |
|
---|
1989 | hrc = i_setAutostartDatabasePath(data.strAutostartDatabasePath);
|
---|
1990 | if (FAILED(hrc)) return hrc;
|
---|
1991 |
|
---|
1992 | {
|
---|
1993 | /* must ignore errors signalled here, because the guest additions
|
---|
1994 | * file may not exist, and in this case keep the empty string */
|
---|
1995 | ErrorInfoKeeper eik;
|
---|
1996 | (void)i_setDefaultAdditionsISO(data.strDefaultAdditionsISO);
|
---|
1997 | }
|
---|
1998 |
|
---|
1999 | hrc = i_setDefaultFrontend(data.strDefaultFrontend);
|
---|
2000 | if (FAILED(hrc)) return hrc;
|
---|
2001 |
|
---|
2002 | return S_OK;
|
---|
2003 | }
|
---|
2004 |
|
---|
2005 | HRESULT SystemProperties::i_saveSettings(settings::SystemProperties &data)
|
---|
2006 | {
|
---|
2007 | AutoCaller autoCaller(this);
|
---|
2008 | if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
|
---|
2009 |
|
---|
2010 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2011 |
|
---|
2012 | data = *m;
|
---|
2013 |
|
---|
2014 | return S_OK;
|
---|
2015 | }
|
---|
2016 |
|
---|
2017 | /**
|
---|
2018 | * Returns a medium format object corresponding to the given format
|
---|
2019 | * identifier or null if no such format.
|
---|
2020 | *
|
---|
2021 | * @param aFormat Format identifier.
|
---|
2022 | *
|
---|
2023 | * @return ComObjPtr<MediumFormat>
|
---|
2024 | */
|
---|
2025 | ComObjPtr<MediumFormat> SystemProperties::i_mediumFormat(const Utf8Str &aFormat)
|
---|
2026 | {
|
---|
2027 | ComObjPtr<MediumFormat> format;
|
---|
2028 |
|
---|
2029 | AutoCaller autoCaller(this);
|
---|
2030 | AssertComRCReturn (autoCaller.hrc(), format);
|
---|
2031 |
|
---|
2032 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2033 |
|
---|
2034 | for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
|
---|
2035 | it != m_llMediumFormats.end();
|
---|
2036 | ++ it)
|
---|
2037 | {
|
---|
2038 | /* MediumFormat is all const, no need to lock */
|
---|
2039 |
|
---|
2040 | if ((*it)->i_getId().compare(aFormat, Utf8Str::CaseInsensitive) == 0)
|
---|
2041 | {
|
---|
2042 | format = *it;
|
---|
2043 | break;
|
---|
2044 | }
|
---|
2045 | }
|
---|
2046 |
|
---|
2047 | return format;
|
---|
2048 | }
|
---|
2049 |
|
---|
2050 | /**
|
---|
2051 | * Returns a medium format object corresponding to the given file extension or
|
---|
2052 | * null if no such format.
|
---|
2053 | *
|
---|
2054 | * @param aExt File extension.
|
---|
2055 | *
|
---|
2056 | * @return ComObjPtr<MediumFormat>
|
---|
2057 | */
|
---|
2058 | ComObjPtr<MediumFormat> SystemProperties::i_mediumFormatFromExtension(const Utf8Str &aExt)
|
---|
2059 | {
|
---|
2060 | ComObjPtr<MediumFormat> format;
|
---|
2061 |
|
---|
2062 | AutoCaller autoCaller(this);
|
---|
2063 | AssertComRCReturn (autoCaller.hrc(), format);
|
---|
2064 |
|
---|
2065 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2066 |
|
---|
2067 | bool fFound = false;
|
---|
2068 | for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
|
---|
2069 | it != m_llMediumFormats.end() && !fFound;
|
---|
2070 | ++it)
|
---|
2071 | {
|
---|
2072 | /* MediumFormat is all const, no need to lock */
|
---|
2073 | MediumFormat::StrArray aFileList = (*it)->i_getFileExtensions();
|
---|
2074 | for (MediumFormat::StrArray::const_iterator it1 = aFileList.begin();
|
---|
2075 | it1 != aFileList.end();
|
---|
2076 | ++it1)
|
---|
2077 | {
|
---|
2078 | if ((*it1).compare(aExt, Utf8Str::CaseInsensitive) == 0)
|
---|
2079 | {
|
---|
2080 | format = *it;
|
---|
2081 | fFound = true;
|
---|
2082 | break;
|
---|
2083 | }
|
---|
2084 | }
|
---|
2085 | }
|
---|
2086 |
|
---|
2087 | return format;
|
---|
2088 | }
|
---|
2089 |
|
---|
2090 |
|
---|
2091 | /**
|
---|
2092 | * VD plugin load
|
---|
2093 | */
|
---|
2094 | int SystemProperties::i_loadVDPlugin(const char *pszPluginLibrary)
|
---|
2095 | {
|
---|
2096 | int vrc = VDPluginLoadFromFilename(pszPluginLibrary);
|
---|
2097 | LogFlowFunc(("pszPluginLibrary='%s' -> %Rrc\n", pszPluginLibrary, vrc));
|
---|
2098 | return vrc;
|
---|
2099 | }
|
---|
2100 |
|
---|
2101 | /**
|
---|
2102 | * VD plugin unload
|
---|
2103 | */
|
---|
2104 | int SystemProperties::i_unloadVDPlugin(const char *pszPluginLibrary)
|
---|
2105 | {
|
---|
2106 | int vrc = VDPluginUnloadFromFilename(pszPluginLibrary);
|
---|
2107 | LogFlowFunc(("pszPluginLibrary='%s' -> %Rrc\n", pszPluginLibrary, vrc));
|
---|
2108 | return vrc;
|
---|
2109 | }
|
---|
2110 |
|
---|
2111 | /**
|
---|
2112 | * Internally usable version of getDefaultAdditionsISO.
|
---|
2113 | */
|
---|
2114 | HRESULT SystemProperties::i_getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
|
---|
2115 | {
|
---|
2116 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2117 | if (m->strDefaultAdditionsISO.isNotEmpty())
|
---|
2118 | aDefaultAdditionsISO = m->strDefaultAdditionsISO;
|
---|
2119 | else
|
---|
2120 | {
|
---|
2121 | /* no guest additions, check if it showed up in the mean time */
|
---|
2122 | alock.release();
|
---|
2123 | AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2124 | if (m->strDefaultAdditionsISO.isEmpty())
|
---|
2125 | {
|
---|
2126 | ErrorInfoKeeper eik;
|
---|
2127 | (void)i_setDefaultAdditionsISO("");
|
---|
2128 | }
|
---|
2129 | aDefaultAdditionsISO = m->strDefaultAdditionsISO;
|
---|
2130 | }
|
---|
2131 | return S_OK;
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 | // private methods
|
---|
2135 | /////////////////////////////////////////////////////////////////////////////
|
---|
2136 |
|
---|
2137 | /**
|
---|
2138 | * Returns the user's home directory. Wrapper around RTPathUserHome().
|
---|
2139 | * @param strPath
|
---|
2140 | * @return
|
---|
2141 | */
|
---|
2142 | HRESULT SystemProperties::i_getUserHomeDirectory(Utf8Str &strPath)
|
---|
2143 | {
|
---|
2144 | char szHome[RTPATH_MAX];
|
---|
2145 | int vrc = RTPathUserHome(szHome, sizeof(szHome));
|
---|
2146 | if (RT_FAILURE(vrc))
|
---|
2147 | return setErrorBoth(E_FAIL, vrc,
|
---|
2148 | tr("Cannot determine user home directory (%Rrc)"),
|
---|
2149 | vrc);
|
---|
2150 | strPath = szHome;
|
---|
2151 | return S_OK;
|
---|
2152 | }
|
---|
2153 |
|
---|
2154 | /**
|
---|
2155 | * Internal implementation to set the default machine folder. Gets called
|
---|
2156 | * from the public attribute setter as well as loadSettings(). With 4.0,
|
---|
2157 | * the "default default" machine folder has changed, and we now require
|
---|
2158 | * a full path always.
|
---|
2159 | * @param strPath
|
---|
2160 | * @return
|
---|
2161 | */
|
---|
2162 | HRESULT SystemProperties::i_setDefaultMachineFolder(const Utf8Str &strPath)
|
---|
2163 | {
|
---|
2164 | Utf8Str path(strPath); // make modifiable
|
---|
2165 | if ( path.isEmpty() // used by API calls to reset the default
|
---|
2166 | || path == "Machines" // this value (exactly like this, without path) is stored
|
---|
2167 | // in VirtualBox.xml if user upgrades from before 4.0 and
|
---|
2168 | // has not changed the default machine folder
|
---|
2169 | )
|
---|
2170 | {
|
---|
2171 | // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs"
|
---|
2172 | HRESULT hrc = i_getUserHomeDirectory(path);
|
---|
2173 | if (FAILED(hrc)) return hrc;
|
---|
2174 | path += RTPATH_SLASH_STR "VirtualBox VMs";
|
---|
2175 | }
|
---|
2176 |
|
---|
2177 | if (!RTPathStartsWithRoot(path.c_str()))
|
---|
2178 | return setError(E_INVALIDARG,
|
---|
2179 | tr("Given default machine folder '%s' is not fully qualified"),
|
---|
2180 | path.c_str());
|
---|
2181 |
|
---|
2182 | m->strDefaultMachineFolder = path;
|
---|
2183 |
|
---|
2184 | return S_OK;
|
---|
2185 | }
|
---|
2186 |
|
---|
2187 | HRESULT SystemProperties::i_setLoggingLevel(const com::Utf8Str &aLoggingLevel)
|
---|
2188 | {
|
---|
2189 | Utf8Str useLoggingLevel(aLoggingLevel);
|
---|
2190 | if (useLoggingLevel.isEmpty())
|
---|
2191 | useLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
2192 | int vrc = RTLogGroupSettings(RTLogRelGetDefaultInstance(), useLoggingLevel.c_str());
|
---|
2193 | // If failed and not the default logging level - try to use the default logging level.
|
---|
2194 | if (RT_FAILURE(vrc))
|
---|
2195 | {
|
---|
2196 | // If failed write message to the release log.
|
---|
2197 | LogRel(("Cannot set passed logging level=%s Error=%Rrc \n", useLoggingLevel.c_str(), vrc));
|
---|
2198 | // If attempted logging level not the default one then try the default one.
|
---|
2199 | if (!useLoggingLevel.equals(VBOXSVC_LOG_DEFAULT))
|
---|
2200 | {
|
---|
2201 | vrc = RTLogGroupSettings(RTLogRelGetDefaultInstance(), VBOXSVC_LOG_DEFAULT);
|
---|
2202 | // If failed report this to the release log.
|
---|
2203 | if (RT_FAILURE(vrc))
|
---|
2204 | LogRel(("Cannot set default logging level Error=%Rrc \n", vrc));
|
---|
2205 | }
|
---|
2206 | // On any failure - set default level as the one to be stored.
|
---|
2207 | useLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
2208 | }
|
---|
2209 | // Set to passed value or if default used/attempted (even if error condition) use empty string.
|
---|
2210 | m->strLoggingLevel = (useLoggingLevel.equals(VBOXSVC_LOG_DEFAULT) ? "" : useLoggingLevel);
|
---|
2211 | return RT_SUCCESS(vrc) ? S_OK : E_FAIL;
|
---|
2212 | }
|
---|
2213 |
|
---|
2214 | HRESULT SystemProperties::i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat)
|
---|
2215 | {
|
---|
2216 | if (!aFormat.isEmpty())
|
---|
2217 | m->strDefaultHardDiskFormat = aFormat;
|
---|
2218 | else
|
---|
2219 | m->strDefaultHardDiskFormat = "VDI";
|
---|
2220 |
|
---|
2221 | return S_OK;
|
---|
2222 | }
|
---|
2223 |
|
---|
2224 | HRESULT SystemProperties::i_setVRDEAuthLibrary(const com::Utf8Str &aPath)
|
---|
2225 | {
|
---|
2226 | if (!aPath.isEmpty())
|
---|
2227 | m->strVRDEAuthLibrary = aPath;
|
---|
2228 | else
|
---|
2229 | m->strVRDEAuthLibrary = "VBoxAuth";
|
---|
2230 |
|
---|
2231 | return S_OK;
|
---|
2232 | }
|
---|
2233 |
|
---|
2234 | HRESULT SystemProperties::i_setWebServiceAuthLibrary(const com::Utf8Str &aPath)
|
---|
2235 | {
|
---|
2236 | if (!aPath.isEmpty())
|
---|
2237 | m->strWebServiceAuthLibrary = aPath;
|
---|
2238 | else
|
---|
2239 | m->strWebServiceAuthLibrary = "VBoxAuth";
|
---|
2240 |
|
---|
2241 | return S_OK;
|
---|
2242 | }
|
---|
2243 |
|
---|
2244 | HRESULT SystemProperties::i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
|
---|
2245 | {
|
---|
2246 | m->strDefaultVRDEExtPack = aExtPack;
|
---|
2247 |
|
---|
2248 | return S_OK;
|
---|
2249 | }
|
---|
2250 |
|
---|
2251 | HRESULT SystemProperties::i_setDefaultCryptoExtPack(const com::Utf8Str &aExtPack)
|
---|
2252 | {
|
---|
2253 | m->strDefaultCryptoExtPack = aExtPack;
|
---|
2254 |
|
---|
2255 | return S_OK;
|
---|
2256 | }
|
---|
2257 |
|
---|
2258 | HRESULT SystemProperties::i_setAutostartDatabasePath(const com::Utf8Str &aPath)
|
---|
2259 | {
|
---|
2260 | HRESULT hrc = S_OK;
|
---|
2261 | AutostartDb *autostartDb = this->mParent->i_getAutostartDb();
|
---|
2262 |
|
---|
2263 | if (!aPath.isEmpty())
|
---|
2264 | {
|
---|
2265 | /* Update path in the autostart database. */
|
---|
2266 | int vrc = autostartDb->setAutostartDbPath(aPath.c_str());
|
---|
2267 | if (RT_SUCCESS(vrc))
|
---|
2268 | m->strAutostartDatabasePath = aPath;
|
---|
2269 | else
|
---|
2270 | hrc = setErrorBoth(E_FAIL, vrc, tr("Cannot set the autostart database path (%Rrc)"), vrc);
|
---|
2271 | }
|
---|
2272 | else
|
---|
2273 | {
|
---|
2274 | int vrc = autostartDb->setAutostartDbPath(NULL);
|
---|
2275 | if (RT_SUCCESS(vrc) || vrc == VERR_NOT_SUPPORTED)
|
---|
2276 | m->strAutostartDatabasePath = "";
|
---|
2277 | else
|
---|
2278 | hrc = setErrorBoth(E_FAIL, vrc, tr("Deleting the autostart database path failed (%Rrc)"), vrc);
|
---|
2279 | }
|
---|
2280 |
|
---|
2281 | return hrc;
|
---|
2282 | }
|
---|
2283 |
|
---|
2284 | HRESULT SystemProperties::i_setDefaultAdditionsISO(const com::Utf8Str &aPath)
|
---|
2285 | {
|
---|
2286 | com::Utf8Str path(aPath);
|
---|
2287 | if (path.isEmpty())
|
---|
2288 | {
|
---|
2289 | char strTemp[RTPATH_MAX];
|
---|
2290 | int vrc = RTPathAppPrivateNoArch(strTemp, sizeof(strTemp));
|
---|
2291 | AssertRC(vrc);
|
---|
2292 | Utf8Str strSrc1 = Utf8Str(strTemp).append("/VBoxGuestAdditions.iso");
|
---|
2293 |
|
---|
2294 | vrc = RTPathExecDir(strTemp, sizeof(strTemp));
|
---|
2295 | AssertRC(vrc);
|
---|
2296 | Utf8Str strSrc2 = Utf8Str(strTemp).append("/additions/VBoxGuestAdditions.iso");
|
---|
2297 |
|
---|
2298 | vrc = RTPathUserHome(strTemp, sizeof(strTemp));
|
---|
2299 | AssertRC(vrc);
|
---|
2300 | Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%s.iso", strTemp, VirtualBox::i_getVersionNormalized().c_str());
|
---|
2301 |
|
---|
2302 | /* Check the standard image locations */
|
---|
2303 | if (RTFileExists(strSrc1.c_str()))
|
---|
2304 | path = strSrc1;
|
---|
2305 | else if (RTFileExists(strSrc2.c_str()))
|
---|
2306 | path = strSrc2;
|
---|
2307 | else if (RTFileExists(strSrc3.c_str()))
|
---|
2308 | path = strSrc3;
|
---|
2309 | else
|
---|
2310 | return setError(E_FAIL,
|
---|
2311 | tr("Cannot determine default Guest Additions ISO location. Most likely they are not available"));
|
---|
2312 | }
|
---|
2313 |
|
---|
2314 | if (!RTPathStartsWithRoot(path.c_str()))
|
---|
2315 | return setError(E_INVALIDARG,
|
---|
2316 | tr("Given default machine Guest Additions ISO file '%s' is not fully qualified"),
|
---|
2317 | path.c_str());
|
---|
2318 |
|
---|
2319 | if (!RTFileExists(path.c_str()))
|
---|
2320 | return setError(E_INVALIDARG,
|
---|
2321 | tr("Given default machine Guest Additions ISO file '%s' does not exist"),
|
---|
2322 | path.c_str());
|
---|
2323 |
|
---|
2324 | m->strDefaultAdditionsISO = path;
|
---|
2325 |
|
---|
2326 | return S_OK;
|
---|
2327 | }
|
---|
2328 |
|
---|
2329 | HRESULT SystemProperties::i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
|
---|
2330 | {
|
---|
2331 | m->strDefaultFrontend = aDefaultFrontend;
|
---|
2332 |
|
---|
2333 | return S_OK;
|
---|
2334 | }
|
---|
2335 |
|
---|
2336 | HRESULT SystemProperties::getLanguageId(com::Utf8Str &aLanguageId)
|
---|
2337 | {
|
---|
2338 | #ifdef VBOX_WITH_MAIN_NLS
|
---|
2339 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2340 | aLanguageId = m->strLanguageId;
|
---|
2341 | alock.release();
|
---|
2342 |
|
---|
2343 | HRESULT hrc = S_OK;
|
---|
2344 | if (aLanguageId.isEmpty())
|
---|
2345 | {
|
---|
2346 | char szLocale[256];
|
---|
2347 | memset(szLocale, 0, sizeof(szLocale));
|
---|
2348 | int vrc = RTLocaleQueryNormalizedBaseLocaleName(szLocale, sizeof(szLocale));
|
---|
2349 | if (RT_SUCCESS(vrc))
|
---|
2350 | aLanguageId = szLocale;
|
---|
2351 | else
|
---|
2352 | hrc = Global::vboxStatusCodeToCOM(vrc);
|
---|
2353 | }
|
---|
2354 | return hrc;
|
---|
2355 | #else
|
---|
2356 | aLanguageId = "C";
|
---|
2357 | return S_OK;
|
---|
2358 | #endif
|
---|
2359 | }
|
---|
2360 |
|
---|
2361 | HRESULT SystemProperties::setLanguageId(const com::Utf8Str &aLanguageId)
|
---|
2362 | {
|
---|
2363 | #ifdef VBOX_WITH_MAIN_NLS
|
---|
2364 | VirtualBoxTranslator *pTranslator = VirtualBoxTranslator::instance();
|
---|
2365 | if (!pTranslator)
|
---|
2366 | return E_FAIL;
|
---|
2367 |
|
---|
2368 | HRESULT hrc = S_OK;
|
---|
2369 | int vrc = pTranslator->i_loadLanguage(aLanguageId.c_str());
|
---|
2370 | if (RT_SUCCESS(vrc))
|
---|
2371 | {
|
---|
2372 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
2373 | m->strLanguageId = aLanguageId;
|
---|
2374 | alock.release();
|
---|
2375 |
|
---|
2376 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
2377 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
2378 | hrc = mParent->i_saveSettings();
|
---|
2379 | }
|
---|
2380 | else
|
---|
2381 | hrc = Global::vboxStatusCodeToCOM(vrc);
|
---|
2382 |
|
---|
2383 | pTranslator->release();
|
---|
2384 |
|
---|
2385 | if (SUCCEEDED(hrc))
|
---|
2386 | mParent->i_onLanguageChanged(aLanguageId);
|
---|
2387 |
|
---|
2388 | return hrc;
|
---|
2389 | #else
|
---|
2390 | NOREF(aLanguageId);
|
---|
2391 | return E_NOTIMPL;
|
---|
2392 | #endif
|
---|
2393 | }
|
---|