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