1 | /* $Id: SystemPropertiesImpl.cpp 78509 2019-05-14 15:16:21Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 "AutoCaller.h"
|
---|
26 | #include "Global.h"
|
---|
27 | #include "LoggingNew.h"
|
---|
28 | #include "AutostartDb.h"
|
---|
29 |
|
---|
30 | // generated header
|
---|
31 | #include "SchemaDefs.h"
|
---|
32 |
|
---|
33 | #include <iprt/dir.h>
|
---|
34 | #include <iprt/ldr.h>
|
---|
35 | #include <iprt/path.h>
|
---|
36 | #include <iprt/string.h>
|
---|
37 | #include <iprt/uri.h>
|
---|
38 | #include <iprt/cpp/utils.h>
|
---|
39 |
|
---|
40 | #include <iprt/errcore.h>
|
---|
41 | #include <VBox/param.h>
|
---|
42 | #include <VBox/settings.h>
|
---|
43 | #include <VBox/vd.h>
|
---|
44 |
|
---|
45 | // defines
|
---|
46 | /////////////////////////////////////////////////////////////////////////////
|
---|
47 |
|
---|
48 | // constructor / destructor
|
---|
49 | /////////////////////////////////////////////////////////////////////////////
|
---|
50 |
|
---|
51 | SystemProperties::SystemProperties()
|
---|
52 | : mParent(NULL),
|
---|
53 | m(new settings::SystemProperties)
|
---|
54 | {
|
---|
55 | }
|
---|
56 |
|
---|
57 | SystemProperties::~SystemProperties()
|
---|
58 | {
|
---|
59 | delete m;
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | HRESULT SystemProperties::FinalConstruct()
|
---|
64 | {
|
---|
65 | return BaseFinalConstruct();
|
---|
66 | }
|
---|
67 |
|
---|
68 | void SystemProperties::FinalRelease()
|
---|
69 | {
|
---|
70 | uninit();
|
---|
71 | BaseFinalRelease();
|
---|
72 | }
|
---|
73 |
|
---|
74 | // public methods only for internal purposes
|
---|
75 | /////////////////////////////////////////////////////////////////////////////
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Initializes the system information object.
|
---|
79 | *
|
---|
80 | * @returns COM result indicator
|
---|
81 | */
|
---|
82 | HRESULT SystemProperties::init(VirtualBox *aParent)
|
---|
83 | {
|
---|
84 | LogFlowThisFunc(("aParent=%p\n", aParent));
|
---|
85 |
|
---|
86 | ComAssertRet(aParent, E_FAIL);
|
---|
87 |
|
---|
88 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
89 | AutoInitSpan autoInitSpan(this);
|
---|
90 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
91 |
|
---|
92 | unconst(mParent) = aParent;
|
---|
93 |
|
---|
94 | i_setDefaultMachineFolder(Utf8Str::Empty);
|
---|
95 | i_setLoggingLevel(Utf8Str::Empty);
|
---|
96 | i_setDefaultHardDiskFormat(Utf8Str::Empty);
|
---|
97 |
|
---|
98 | i_setVRDEAuthLibrary(Utf8Str::Empty);
|
---|
99 | i_setDefaultVRDEExtPack(Utf8Str::Empty);
|
---|
100 |
|
---|
101 | m->uLogHistoryCount = 3;
|
---|
102 |
|
---|
103 |
|
---|
104 | /* On Windows, OS X and Solaris, HW virtualization use isn't exclusive
|
---|
105 | * by default so that VT-x or AMD-V can be shared with other
|
---|
106 | * hypervisors without requiring user intervention.
|
---|
107 | * NB: See also SystemProperties constructor in settings.h
|
---|
108 | */
|
---|
109 | #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
|
---|
110 | m->fExclusiveHwVirt = false;
|
---|
111 | #else
|
---|
112 | m->fExclusiveHwVirt = true;
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | HRESULT rc = S_OK;
|
---|
116 |
|
---|
117 | /* Fetch info of all available hd backends. */
|
---|
118 |
|
---|
119 | /// @todo NEWMEDIA VDBackendInfo needs to be improved to let us enumerate
|
---|
120 | /// any number of backends
|
---|
121 |
|
---|
122 | VDBACKENDINFO aVDInfo[100];
|
---|
123 | unsigned cEntries;
|
---|
124 | int vrc = VDBackendInfo(RT_ELEMENTS(aVDInfo), aVDInfo, &cEntries);
|
---|
125 | AssertRC(vrc);
|
---|
126 | if (RT_SUCCESS(vrc))
|
---|
127 | {
|
---|
128 | for (unsigned i = 0; i < cEntries; ++ i)
|
---|
129 | {
|
---|
130 | ComObjPtr<MediumFormat> hdf;
|
---|
131 | rc = hdf.createObject();
|
---|
132 | if (FAILED(rc)) break;
|
---|
133 |
|
---|
134 | rc = hdf->init(&aVDInfo[i]);
|
---|
135 | if (FAILED(rc)) break;
|
---|
136 |
|
---|
137 | m_llMediumFormats.push_back(hdf);
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | /* Confirm a successful initialization */
|
---|
142 | if (SUCCEEDED(rc))
|
---|
143 | autoInitSpan.setSucceeded();
|
---|
144 |
|
---|
145 | return rc;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Uninitializes the instance and sets the ready flag to FALSE.
|
---|
150 | * Called either from FinalRelease() or by the parent when it gets destroyed.
|
---|
151 | */
|
---|
152 | void SystemProperties::uninit()
|
---|
153 | {
|
---|
154 | LogFlowThisFunc(("\n"));
|
---|
155 |
|
---|
156 | /* Enclose the state transition Ready->InUninit->NotReady */
|
---|
157 | AutoUninitSpan autoUninitSpan(this);
|
---|
158 | if (autoUninitSpan.uninitDone())
|
---|
159 | return;
|
---|
160 |
|
---|
161 | unconst(mParent) = NULL;
|
---|
162 | }
|
---|
163 |
|
---|
164 | // wrapped ISystemProperties properties
|
---|
165 | /////////////////////////////////////////////////////////////////////////////
|
---|
166 |
|
---|
167 | HRESULT SystemProperties::getMinGuestRAM(ULONG *minRAM)
|
---|
168 |
|
---|
169 | {
|
---|
170 | /* no need to lock, this is const */
|
---|
171 | AssertCompile(MM_RAM_MIN_IN_MB >= SchemaDefs::MinGuestRAM);
|
---|
172 | *minRAM = MM_RAM_MIN_IN_MB;
|
---|
173 |
|
---|
174 | return S_OK;
|
---|
175 | }
|
---|
176 |
|
---|
177 | HRESULT SystemProperties::getMaxGuestRAM(ULONG *maxRAM)
|
---|
178 | {
|
---|
179 | /* no need to lock, this is const */
|
---|
180 | AssertCompile(MM_RAM_MAX_IN_MB <= SchemaDefs::MaxGuestRAM);
|
---|
181 | ULONG maxRAMSys = MM_RAM_MAX_IN_MB;
|
---|
182 | ULONG maxRAMArch = maxRAMSys;
|
---|
183 | *maxRAM = RT_MIN(maxRAMSys, maxRAMArch);
|
---|
184 |
|
---|
185 | return S_OK;
|
---|
186 | }
|
---|
187 |
|
---|
188 | HRESULT SystemProperties::getMinGuestVRAM(ULONG *minVRAM)
|
---|
189 | {
|
---|
190 | /* no need to lock, this is const */
|
---|
191 | *minVRAM = SchemaDefs::MinGuestVRAM;
|
---|
192 |
|
---|
193 | return S_OK;
|
---|
194 | }
|
---|
195 |
|
---|
196 | HRESULT SystemProperties::getMaxGuestVRAM(ULONG *maxVRAM)
|
---|
197 | {
|
---|
198 | /* no need to lock, this is const */
|
---|
199 | *maxVRAM = SchemaDefs::MaxGuestVRAM;
|
---|
200 |
|
---|
201 | return S_OK;
|
---|
202 | }
|
---|
203 |
|
---|
204 | HRESULT SystemProperties::getMinGuestCPUCount(ULONG *minCPUCount)
|
---|
205 | {
|
---|
206 | /* no need to lock, this is const */
|
---|
207 | *minCPUCount = SchemaDefs::MinCPUCount; // VMM_MIN_CPU_COUNT
|
---|
208 |
|
---|
209 | return S_OK;
|
---|
210 | }
|
---|
211 |
|
---|
212 | HRESULT SystemProperties::getMaxGuestCPUCount(ULONG *maxCPUCount)
|
---|
213 | {
|
---|
214 | /* no need to lock, this is const */
|
---|
215 | *maxCPUCount = SchemaDefs::MaxCPUCount; // VMM_MAX_CPU_COUNT
|
---|
216 |
|
---|
217 | return S_OK;
|
---|
218 | }
|
---|
219 |
|
---|
220 | HRESULT SystemProperties::getMaxGuestMonitors(ULONG *maxMonitors)
|
---|
221 | {
|
---|
222 |
|
---|
223 | /* no need to lock, this is const */
|
---|
224 | *maxMonitors = SchemaDefs::MaxGuestMonitors;
|
---|
225 |
|
---|
226 | return S_OK;
|
---|
227 | }
|
---|
228 |
|
---|
229 |
|
---|
230 | HRESULT SystemProperties::getInfoVDSize(LONG64 *infoVDSize)
|
---|
231 | {
|
---|
232 | /*
|
---|
233 | * The BIOS supports currently 32 bit LBA numbers (implementing the full
|
---|
234 | * 48 bit range is in theory trivial, but the crappy compiler makes things
|
---|
235 | * more difficult). This translates to almost 2 TiBytes (to be on the safe
|
---|
236 | * side, the reported limit is 1 MiByte less than that, as the total number
|
---|
237 | * of sectors should fit in 32 bits, too), which should be enough for the
|
---|
238 | * moment. Since the MBR partition tables support only 32bit sector numbers
|
---|
239 | * and thus the BIOS can only boot from disks smaller than 2T this is a
|
---|
240 | * rather hard limit.
|
---|
241 | *
|
---|
242 | * The virtual ATA/SATA disks support complete LBA48, and SCSI supports
|
---|
243 | * LBA64 (almost, more like LBA55 in practice), so the theoretical maximum
|
---|
244 | * disk size is 128 PiByte/16 EiByte. The GUI works nicely with 6 orders
|
---|
245 | * of magnitude, but not with 11..13 orders of magnitude.
|
---|
246 | */
|
---|
247 | /* no need to lock, this is const */
|
---|
248 | *infoVDSize = 2 * _1T - _1M;
|
---|
249 |
|
---|
250 | return S_OK;
|
---|
251 | }
|
---|
252 |
|
---|
253 |
|
---|
254 | HRESULT SystemProperties::getSerialPortCount(ULONG *count)
|
---|
255 | {
|
---|
256 | /* no need to lock, this is const */
|
---|
257 | *count = SchemaDefs::SerialPortCount;
|
---|
258 |
|
---|
259 | return S_OK;
|
---|
260 | }
|
---|
261 |
|
---|
262 |
|
---|
263 | HRESULT SystemProperties::getParallelPortCount(ULONG *count)
|
---|
264 | {
|
---|
265 | /* no need to lock, this is const */
|
---|
266 | *count = SchemaDefs::ParallelPortCount;
|
---|
267 |
|
---|
268 | return S_OK;
|
---|
269 | }
|
---|
270 |
|
---|
271 |
|
---|
272 | HRESULT SystemProperties::getMaxBootPosition(ULONG *aMaxBootPosition)
|
---|
273 | {
|
---|
274 | /* no need to lock, this is const */
|
---|
275 | *aMaxBootPosition = SchemaDefs::MaxBootPosition;
|
---|
276 |
|
---|
277 | return S_OK;
|
---|
278 | }
|
---|
279 |
|
---|
280 |
|
---|
281 | HRESULT SystemProperties::getRawModeSupported(BOOL *aRawModeSupported)
|
---|
282 | {
|
---|
283 | #ifdef VBOX_WITH_RAW_MODE
|
---|
284 | *aRawModeSupported = TRUE;
|
---|
285 | #else
|
---|
286 | *aRawModeSupported = FALSE;
|
---|
287 | #endif
|
---|
288 | return S_OK;
|
---|
289 | }
|
---|
290 |
|
---|
291 |
|
---|
292 | HRESULT SystemProperties::getExclusiveHwVirt(BOOL *aExclusiveHwVirt)
|
---|
293 | {
|
---|
294 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
295 |
|
---|
296 | *aExclusiveHwVirt = m->fExclusiveHwVirt;
|
---|
297 |
|
---|
298 | return S_OK;
|
---|
299 | }
|
---|
300 |
|
---|
301 | HRESULT SystemProperties::setExclusiveHwVirt(BOOL aExclusiveHwVirt)
|
---|
302 | {
|
---|
303 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
304 | m->fExclusiveHwVirt = !!aExclusiveHwVirt;
|
---|
305 | alock.release();
|
---|
306 |
|
---|
307 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
308 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
309 | HRESULT rc = mParent->i_saveSettings();
|
---|
310 |
|
---|
311 | return rc;
|
---|
312 | }
|
---|
313 |
|
---|
314 | HRESULT SystemProperties::getMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *aMaxNetworkAdapters)
|
---|
315 | {
|
---|
316 | /* no need for locking, no state */
|
---|
317 | uint32_t uResult = Global::getMaxNetworkAdapters(aChipset);
|
---|
318 | if (uResult == 0)
|
---|
319 | AssertMsgFailed(("Invalid chipset type %d\n", aChipset));
|
---|
320 | *aMaxNetworkAdapters = uResult;
|
---|
321 | return S_OK;
|
---|
322 | }
|
---|
323 |
|
---|
324 | HRESULT SystemProperties::getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count)
|
---|
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 |
|
---|
331 | switch (aType)
|
---|
332 | {
|
---|
333 | case NetworkAttachmentType_NAT:
|
---|
334 | case NetworkAttachmentType_Internal:
|
---|
335 | case NetworkAttachmentType_NATNetwork:
|
---|
336 | /* chipset default is OK */
|
---|
337 | break;
|
---|
338 | case NetworkAttachmentType_Bridged:
|
---|
339 | /* Maybe use current host interface count here? */
|
---|
340 | break;
|
---|
341 | case NetworkAttachmentType_HostOnly:
|
---|
342 | uResult = RT_MIN(uResult, 8);
|
---|
343 | break;
|
---|
344 | default:
|
---|
345 | AssertMsgFailed(("Unhandled attachment type %d\n", aType));
|
---|
346 | }
|
---|
347 |
|
---|
348 | *count = uResult;
|
---|
349 |
|
---|
350 | return S_OK;
|
---|
351 | }
|
---|
352 |
|
---|
353 |
|
---|
354 | HRESULT SystemProperties::getMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
|
---|
355 | ULONG *aMaxDevicesPerPort)
|
---|
356 | {
|
---|
357 | /* no need to lock, this is const */
|
---|
358 | switch (aBus)
|
---|
359 | {
|
---|
360 | case StorageBus_SATA:
|
---|
361 | case StorageBus_SCSI:
|
---|
362 | case StorageBus_SAS:
|
---|
363 | case StorageBus_USB:
|
---|
364 | case StorageBus_PCIe:
|
---|
365 | case StorageBus_VirtioSCSI:
|
---|
366 | {
|
---|
367 | /* SATA and both SCSI controllers only support one device per port. */
|
---|
368 | *aMaxDevicesPerPort = 1;
|
---|
369 | break;
|
---|
370 | }
|
---|
371 | case StorageBus_IDE:
|
---|
372 | case StorageBus_Floppy:
|
---|
373 | {
|
---|
374 | /* The IDE and Floppy controllers support 2 devices. One as master
|
---|
375 | * and one as slave (or floppy drive 0 and 1). */
|
---|
376 | *aMaxDevicesPerPort = 2;
|
---|
377 | break;
|
---|
378 | }
|
---|
379 | default:
|
---|
380 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
381 | }
|
---|
382 |
|
---|
383 | return S_OK;
|
---|
384 | }
|
---|
385 |
|
---|
386 | HRESULT SystemProperties::getMinPortCountForStorageBus(StorageBus_T aBus,
|
---|
387 | ULONG *aMinPortCount)
|
---|
388 | {
|
---|
389 | /* no need to lock, this is const */
|
---|
390 | switch (aBus)
|
---|
391 | {
|
---|
392 | case StorageBus_SATA:
|
---|
393 | case StorageBus_SAS:
|
---|
394 | case StorageBus_PCIe:
|
---|
395 | case StorageBus_VirtioSCSI:
|
---|
396 | {
|
---|
397 | *aMinPortCount = 1;
|
---|
398 | break;
|
---|
399 | }
|
---|
400 | case StorageBus_SCSI:
|
---|
401 | {
|
---|
402 | *aMinPortCount = 16;
|
---|
403 | break;
|
---|
404 | }
|
---|
405 | case StorageBus_IDE:
|
---|
406 | {
|
---|
407 | *aMinPortCount = 2;
|
---|
408 | break;
|
---|
409 | }
|
---|
410 | case StorageBus_Floppy:
|
---|
411 | {
|
---|
412 | *aMinPortCount = 1;
|
---|
413 | break;
|
---|
414 | }
|
---|
415 | case StorageBus_USB:
|
---|
416 | {
|
---|
417 | *aMinPortCount = 8;
|
---|
418 | break;
|
---|
419 | }
|
---|
420 | default:
|
---|
421 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
422 | }
|
---|
423 |
|
---|
424 | return S_OK;
|
---|
425 | }
|
---|
426 |
|
---|
427 | HRESULT SystemProperties::getMaxPortCountForStorageBus(StorageBus_T aBus,
|
---|
428 | ULONG *aMaxPortCount)
|
---|
429 | {
|
---|
430 | /* no need to lock, this is const */
|
---|
431 | switch (aBus)
|
---|
432 | {
|
---|
433 | case StorageBus_SATA:
|
---|
434 | {
|
---|
435 | *aMaxPortCount = 30;
|
---|
436 | break;
|
---|
437 | }
|
---|
438 | case StorageBus_SCSI:
|
---|
439 | {
|
---|
440 | *aMaxPortCount = 16;
|
---|
441 | break;
|
---|
442 | }
|
---|
443 | case StorageBus_IDE:
|
---|
444 | {
|
---|
445 | *aMaxPortCount = 2;
|
---|
446 | break;
|
---|
447 | }
|
---|
448 | case StorageBus_Floppy:
|
---|
449 | {
|
---|
450 | *aMaxPortCount = 1;
|
---|
451 | break;
|
---|
452 | }
|
---|
453 | case StorageBus_SAS:
|
---|
454 | case StorageBus_PCIe:
|
---|
455 | {
|
---|
456 | *aMaxPortCount = 255;
|
---|
457 | break;
|
---|
458 | }
|
---|
459 | case StorageBus_USB:
|
---|
460 | {
|
---|
461 | *aMaxPortCount = 8;
|
---|
462 | break;
|
---|
463 | }
|
---|
464 | case StorageBus_VirtioSCSI:
|
---|
465 | {
|
---|
466 | *aMaxPortCount = 256;
|
---|
467 | break;
|
---|
468 | }
|
---|
469 | default:
|
---|
470 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
471 | }
|
---|
472 |
|
---|
473 | return S_OK;
|
---|
474 | }
|
---|
475 |
|
---|
476 | HRESULT SystemProperties::getMaxInstancesOfStorageBus(ChipsetType_T aChipset,
|
---|
477 | StorageBus_T aBus,
|
---|
478 | ULONG *aMaxInstances)
|
---|
479 | {
|
---|
480 | ULONG cCtrs = 0;
|
---|
481 |
|
---|
482 | /* no need to lock, this is const */
|
---|
483 | switch (aBus)
|
---|
484 | {
|
---|
485 | case StorageBus_SATA:
|
---|
486 | case StorageBus_SCSI:
|
---|
487 | case StorageBus_SAS:
|
---|
488 | case StorageBus_PCIe:
|
---|
489 | case StorageBus_VirtioSCSI:
|
---|
490 | cCtrs = aChipset == ChipsetType_ICH9 ? 8 : 1;
|
---|
491 | break;
|
---|
492 | case StorageBus_USB:
|
---|
493 | case StorageBus_IDE:
|
---|
494 | case StorageBus_Floppy:
|
---|
495 | {
|
---|
496 | cCtrs = 1;
|
---|
497 | break;
|
---|
498 | }
|
---|
499 | default:
|
---|
500 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
501 | }
|
---|
502 |
|
---|
503 | *aMaxInstances = cCtrs;
|
---|
504 |
|
---|
505 | return S_OK;
|
---|
506 | }
|
---|
507 |
|
---|
508 | HRESULT SystemProperties::getDeviceTypesForStorageBus(StorageBus_T aBus,
|
---|
509 | std::vector<DeviceType_T> &aDeviceTypes)
|
---|
510 | {
|
---|
511 | aDeviceTypes.resize(0);
|
---|
512 |
|
---|
513 | /* no need to lock, this is const */
|
---|
514 | switch (aBus)
|
---|
515 | {
|
---|
516 | case StorageBus_IDE:
|
---|
517 | case StorageBus_SATA:
|
---|
518 | case StorageBus_SCSI:
|
---|
519 | case StorageBus_SAS:
|
---|
520 | case StorageBus_USB:
|
---|
521 | case StorageBus_VirtioSCSI:
|
---|
522 | {
|
---|
523 | aDeviceTypes.resize(2);
|
---|
524 | aDeviceTypes[0] = DeviceType_DVD;
|
---|
525 | aDeviceTypes[1] = DeviceType_HardDisk;
|
---|
526 | break;
|
---|
527 | }
|
---|
528 | case StorageBus_Floppy:
|
---|
529 | {
|
---|
530 | aDeviceTypes.resize(1);
|
---|
531 | aDeviceTypes[0] = DeviceType_Floppy;
|
---|
532 | break;
|
---|
533 | }
|
---|
534 | case StorageBus_PCIe:
|
---|
535 | {
|
---|
536 | aDeviceTypes.resize(1);
|
---|
537 | aDeviceTypes[0] = DeviceType_HardDisk;
|
---|
538 | break;
|
---|
539 | }
|
---|
540 | default:
|
---|
541 | AssertMsgFailed(("Invalid bus type %d\n", aBus));
|
---|
542 | }
|
---|
543 |
|
---|
544 | return S_OK;
|
---|
545 | }
|
---|
546 |
|
---|
547 | HRESULT SystemProperties::getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType,
|
---|
548 | BOOL *aEnabled)
|
---|
549 | {
|
---|
550 | /* no need to lock, this is const */
|
---|
551 | switch (aControllerType)
|
---|
552 | {
|
---|
553 | case StorageControllerType_LsiLogic:
|
---|
554 | case StorageControllerType_BusLogic:
|
---|
555 | case StorageControllerType_IntelAhci:
|
---|
556 | case StorageControllerType_LsiLogicSas:
|
---|
557 | case StorageControllerType_USB:
|
---|
558 | case StorageControllerType_NVMe:
|
---|
559 | case StorageControllerType_VirtioSCSI:
|
---|
560 | *aEnabled = false;
|
---|
561 | break;
|
---|
562 | case StorageControllerType_PIIX3:
|
---|
563 | case StorageControllerType_PIIX4:
|
---|
564 | case StorageControllerType_ICH6:
|
---|
565 | case StorageControllerType_I82078:
|
---|
566 | *aEnabled = true;
|
---|
567 | break;
|
---|
568 | default:
|
---|
569 | AssertMsgFailed(("Invalid controller type %d\n", aControllerType));
|
---|
570 | }
|
---|
571 | return S_OK;
|
---|
572 | }
|
---|
573 |
|
---|
574 | HRESULT SystemProperties::getStorageControllerHotplugCapable(StorageControllerType_T aControllerType,
|
---|
575 | BOOL *aHotplugCapable)
|
---|
576 | {
|
---|
577 | switch (aControllerType)
|
---|
578 | {
|
---|
579 | case StorageControllerType_IntelAhci:
|
---|
580 | case StorageControllerType_USB:
|
---|
581 | *aHotplugCapable = true;
|
---|
582 | break;
|
---|
583 | case StorageControllerType_LsiLogic:
|
---|
584 | case StorageControllerType_LsiLogicSas:
|
---|
585 | case StorageControllerType_BusLogic:
|
---|
586 | case StorageControllerType_NVMe:
|
---|
587 | case StorageControllerType_VirtioSCSI:
|
---|
588 | case StorageControllerType_PIIX3:
|
---|
589 | case StorageControllerType_PIIX4:
|
---|
590 | case StorageControllerType_ICH6:
|
---|
591 | case StorageControllerType_I82078:
|
---|
592 | *aHotplugCapable = false;
|
---|
593 | break;
|
---|
594 | default:
|
---|
595 | AssertMsgFailedReturn(("Invalid controller type %d\n", aControllerType), E_FAIL);
|
---|
596 | }
|
---|
597 |
|
---|
598 | return S_OK;
|
---|
599 | }
|
---|
600 |
|
---|
601 | HRESULT SystemProperties::getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,
|
---|
602 | USBControllerType_T aType,
|
---|
603 | ULONG *aMaxInstances)
|
---|
604 | {
|
---|
605 | NOREF(aChipset);
|
---|
606 | ULONG cCtrs = 0;
|
---|
607 |
|
---|
608 | /* no need to lock, this is const */
|
---|
609 | switch (aType)
|
---|
610 | {
|
---|
611 | case USBControllerType_OHCI:
|
---|
612 | case USBControllerType_EHCI:
|
---|
613 | case USBControllerType_XHCI:
|
---|
614 | {
|
---|
615 | cCtrs = 1;
|
---|
616 | break;
|
---|
617 | }
|
---|
618 | default:
|
---|
619 | AssertMsgFailed(("Invalid bus type %d\n", aType));
|
---|
620 | }
|
---|
621 |
|
---|
622 | *aMaxInstances = cCtrs;
|
---|
623 |
|
---|
624 | return S_OK;
|
---|
625 | }
|
---|
626 |
|
---|
627 | HRESULT SystemProperties::getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder)
|
---|
628 | {
|
---|
629 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
630 | aDefaultMachineFolder = m->strDefaultMachineFolder;
|
---|
631 | return S_OK;
|
---|
632 | }
|
---|
633 |
|
---|
634 | HRESULT SystemProperties::setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder)
|
---|
635 | {
|
---|
636 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
637 | HRESULT rc = i_setDefaultMachineFolder(aDefaultMachineFolder);
|
---|
638 | alock.release();
|
---|
639 | if (SUCCEEDED(rc))
|
---|
640 | {
|
---|
641 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
642 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
643 | rc = mParent->i_saveSettings();
|
---|
644 | }
|
---|
645 |
|
---|
646 | return rc;
|
---|
647 | }
|
---|
648 |
|
---|
649 | HRESULT SystemProperties::getLoggingLevel(com::Utf8Str &aLoggingLevel)
|
---|
650 | {
|
---|
651 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
652 |
|
---|
653 | aLoggingLevel = m->strLoggingLevel;
|
---|
654 |
|
---|
655 | if (aLoggingLevel.isEmpty())
|
---|
656 | aLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
657 |
|
---|
658 | return S_OK;
|
---|
659 | }
|
---|
660 |
|
---|
661 |
|
---|
662 | HRESULT SystemProperties::setLoggingLevel(const com::Utf8Str &aLoggingLevel)
|
---|
663 | {
|
---|
664 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
665 | HRESULT rc = i_setLoggingLevel(aLoggingLevel);
|
---|
666 | alock.release();
|
---|
667 |
|
---|
668 | if (SUCCEEDED(rc))
|
---|
669 | {
|
---|
670 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
671 | rc = mParent->i_saveSettings();
|
---|
672 | }
|
---|
673 | else
|
---|
674 | LogRel(("Cannot set passed logging level=%s, or the default one - Error=%Rhrc \n", aLoggingLevel.c_str(), rc));
|
---|
675 |
|
---|
676 | return rc;
|
---|
677 | }
|
---|
678 |
|
---|
679 | HRESULT SystemProperties::getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats)
|
---|
680 | {
|
---|
681 | MediumFormatList mediumFormats(m_llMediumFormats);
|
---|
682 | aMediumFormats.resize(mediumFormats.size());
|
---|
683 | size_t i = 0;
|
---|
684 | for (MediumFormatList::const_iterator it = mediumFormats.begin(); it != mediumFormats.end(); ++it, ++i)
|
---|
685 | (*it).queryInterfaceTo(aMediumFormats[i].asOutParam());
|
---|
686 | return S_OK;
|
---|
687 | }
|
---|
688 |
|
---|
689 | HRESULT SystemProperties::getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat)
|
---|
690 | {
|
---|
691 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
692 | aDefaultHardDiskFormat = m->strDefaultHardDiskFormat;
|
---|
693 | return S_OK;
|
---|
694 | }
|
---|
695 |
|
---|
696 |
|
---|
697 | HRESULT SystemProperties::setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat)
|
---|
698 | {
|
---|
699 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
700 | HRESULT rc = i_setDefaultHardDiskFormat(aDefaultHardDiskFormat);
|
---|
701 | alock.release();
|
---|
702 | if (SUCCEEDED(rc))
|
---|
703 | {
|
---|
704 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
705 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
706 | rc = mParent->i_saveSettings();
|
---|
707 | }
|
---|
708 |
|
---|
709 | return rc;
|
---|
710 | }
|
---|
711 |
|
---|
712 | HRESULT SystemProperties::getFreeDiskSpaceWarning(LONG64 *aFreeSpace)
|
---|
713 | {
|
---|
714 | NOREF(aFreeSpace);
|
---|
715 | ReturnComNotImplemented();
|
---|
716 | }
|
---|
717 |
|
---|
718 | HRESULT SystemProperties::setFreeDiskSpaceWarning(LONG64 /* aFreeSpace */)
|
---|
719 | {
|
---|
720 | ReturnComNotImplemented();
|
---|
721 | }
|
---|
722 |
|
---|
723 | HRESULT SystemProperties::getFreeDiskSpacePercentWarning(ULONG *aFreeSpacePercent)
|
---|
724 | {
|
---|
725 | NOREF(aFreeSpacePercent);
|
---|
726 | ReturnComNotImplemented();
|
---|
727 | }
|
---|
728 |
|
---|
729 | HRESULT SystemProperties::setFreeDiskSpacePercentWarning(ULONG /* aFreeSpacePercent */)
|
---|
730 | {
|
---|
731 | ReturnComNotImplemented();
|
---|
732 | }
|
---|
733 |
|
---|
734 | HRESULT SystemProperties::getFreeDiskSpaceError(LONG64 *aFreeSpace)
|
---|
735 | {
|
---|
736 | NOREF(aFreeSpace);
|
---|
737 | ReturnComNotImplemented();
|
---|
738 | }
|
---|
739 |
|
---|
740 | HRESULT SystemProperties::setFreeDiskSpaceError(LONG64 /* aFreeSpace */)
|
---|
741 | {
|
---|
742 | ReturnComNotImplemented();
|
---|
743 | }
|
---|
744 |
|
---|
745 | HRESULT SystemProperties::getFreeDiskSpacePercentError(ULONG *aFreeSpacePercent)
|
---|
746 | {
|
---|
747 | NOREF(aFreeSpacePercent);
|
---|
748 | ReturnComNotImplemented();
|
---|
749 | }
|
---|
750 |
|
---|
751 | HRESULT SystemProperties::setFreeDiskSpacePercentError(ULONG /* aFreeSpacePercent */)
|
---|
752 | {
|
---|
753 | ReturnComNotImplemented();
|
---|
754 | }
|
---|
755 |
|
---|
756 | HRESULT SystemProperties::getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary)
|
---|
757 | {
|
---|
758 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
759 |
|
---|
760 | aVRDEAuthLibrary = m->strVRDEAuthLibrary;
|
---|
761 |
|
---|
762 | return S_OK;
|
---|
763 | }
|
---|
764 |
|
---|
765 | HRESULT SystemProperties::setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary)
|
---|
766 | {
|
---|
767 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
768 | HRESULT rc = i_setVRDEAuthLibrary(aVRDEAuthLibrary);
|
---|
769 | alock.release();
|
---|
770 | if (SUCCEEDED(rc))
|
---|
771 | {
|
---|
772 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
773 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
774 | rc = mParent->i_saveSettings();
|
---|
775 | }
|
---|
776 |
|
---|
777 | return rc;
|
---|
778 | }
|
---|
779 |
|
---|
780 | HRESULT SystemProperties::getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary)
|
---|
781 | {
|
---|
782 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
783 |
|
---|
784 | aWebServiceAuthLibrary = m->strWebServiceAuthLibrary;
|
---|
785 |
|
---|
786 | return S_OK;
|
---|
787 | }
|
---|
788 |
|
---|
789 | HRESULT SystemProperties::setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary)
|
---|
790 | {
|
---|
791 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
792 | HRESULT rc = i_setWebServiceAuthLibrary(aWebServiceAuthLibrary);
|
---|
793 | alock.release();
|
---|
794 |
|
---|
795 | if (SUCCEEDED(rc))
|
---|
796 | {
|
---|
797 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
798 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
799 | rc = mParent->i_saveSettings();
|
---|
800 | }
|
---|
801 |
|
---|
802 | return rc;
|
---|
803 | }
|
---|
804 |
|
---|
805 | HRESULT SystemProperties::getDefaultVRDEExtPack(com::Utf8Str &aExtPack)
|
---|
806 | {
|
---|
807 | HRESULT hrc = S_OK;
|
---|
808 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
809 | Utf8Str strExtPack(m->strDefaultVRDEExtPack);
|
---|
810 | if (strExtPack.isNotEmpty())
|
---|
811 | {
|
---|
812 | if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
|
---|
813 | hrc = S_OK;
|
---|
814 | else
|
---|
815 | #ifdef VBOX_WITH_EXTPACK
|
---|
816 | hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&strExtPack);
|
---|
817 | #else
|
---|
818 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
|
---|
819 | #endif
|
---|
820 | }
|
---|
821 | else
|
---|
822 | {
|
---|
823 | #ifdef VBOX_WITH_EXTPACK
|
---|
824 | hrc = mParent->i_getExtPackManager()->i_getDefaultVrdeExtPack(&strExtPack);
|
---|
825 | #endif
|
---|
826 | if (strExtPack.isEmpty())
|
---|
827 | {
|
---|
828 | /*
|
---|
829 | * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed.
|
---|
830 | * This is hardcoded uglyness, sorry.
|
---|
831 | */
|
---|
832 | char szPath[RTPATH_MAX];
|
---|
833 | int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
|
---|
834 | if (RT_SUCCESS(vrc))
|
---|
835 | vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP");
|
---|
836 | if (RT_SUCCESS(vrc))
|
---|
837 | vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
|
---|
838 | if (RT_SUCCESS(vrc) && RTFileExists(szPath))
|
---|
839 | {
|
---|
840 | /* Illegal extpack name, so no conflict. */
|
---|
841 | strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME;
|
---|
842 | }
|
---|
843 | }
|
---|
844 | }
|
---|
845 |
|
---|
846 | if (SUCCEEDED(hrc))
|
---|
847 | aExtPack = strExtPack;
|
---|
848 |
|
---|
849 | return S_OK;
|
---|
850 | }
|
---|
851 |
|
---|
852 |
|
---|
853 | HRESULT SystemProperties::setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
|
---|
854 | {
|
---|
855 | HRESULT hrc = S_OK;
|
---|
856 | if (aExtPack.isNotEmpty())
|
---|
857 | {
|
---|
858 | if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
|
---|
859 | hrc = S_OK;
|
---|
860 | else
|
---|
861 | #ifdef VBOX_WITH_EXTPACK
|
---|
862 | hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&aExtPack);
|
---|
863 | #else
|
---|
864 | hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str());
|
---|
865 | #endif
|
---|
866 | }
|
---|
867 | if (SUCCEEDED(hrc))
|
---|
868 | {
|
---|
869 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
870 | hrc = i_setDefaultVRDEExtPack(aExtPack);
|
---|
871 | if (SUCCEEDED(hrc))
|
---|
872 | {
|
---|
873 | /* VirtualBox::i_saveSettings() needs the VirtualBox write lock. */
|
---|
874 | alock.release();
|
---|
875 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
876 | hrc = mParent->i_saveSettings();
|
---|
877 | }
|
---|
878 | }
|
---|
879 |
|
---|
880 | return hrc;
|
---|
881 | }
|
---|
882 |
|
---|
883 |
|
---|
884 | HRESULT SystemProperties::getLogHistoryCount(ULONG *count)
|
---|
885 | {
|
---|
886 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
887 |
|
---|
888 | *count = m->uLogHistoryCount;
|
---|
889 |
|
---|
890 | return S_OK;
|
---|
891 | }
|
---|
892 |
|
---|
893 |
|
---|
894 | HRESULT SystemProperties::setLogHistoryCount(ULONG count)
|
---|
895 | {
|
---|
896 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
897 | m->uLogHistoryCount = count;
|
---|
898 | alock.release();
|
---|
899 |
|
---|
900 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
901 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
902 | HRESULT rc = mParent->i_saveSettings();
|
---|
903 |
|
---|
904 | return rc;
|
---|
905 | }
|
---|
906 |
|
---|
907 | HRESULT SystemProperties::getDefaultAudioDriver(AudioDriverType_T *aAudioDriver)
|
---|
908 | {
|
---|
909 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
910 |
|
---|
911 | *aAudioDriver = settings::MachineConfigFile::getHostDefaultAudioDriver();
|
---|
912 |
|
---|
913 | return S_OK;
|
---|
914 | }
|
---|
915 |
|
---|
916 | HRESULT SystemProperties::getAutostartDatabasePath(com::Utf8Str &aAutostartDbPath)
|
---|
917 | {
|
---|
918 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
919 |
|
---|
920 | aAutostartDbPath = m->strAutostartDatabasePath;
|
---|
921 |
|
---|
922 | return S_OK;
|
---|
923 | }
|
---|
924 |
|
---|
925 | HRESULT SystemProperties::setAutostartDatabasePath(const com::Utf8Str &aAutostartDbPath)
|
---|
926 | {
|
---|
927 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
928 | HRESULT rc = i_setAutostartDatabasePath(aAutostartDbPath);
|
---|
929 | alock.release();
|
---|
930 |
|
---|
931 | if (SUCCEEDED(rc))
|
---|
932 | {
|
---|
933 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
934 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
935 | rc = mParent->i_saveSettings();
|
---|
936 | }
|
---|
937 |
|
---|
938 | return rc;
|
---|
939 | }
|
---|
940 |
|
---|
941 | HRESULT SystemProperties::getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
|
---|
942 | {
|
---|
943 | return i_getDefaultAdditionsISO(aDefaultAdditionsISO);
|
---|
944 | }
|
---|
945 |
|
---|
946 | HRESULT SystemProperties::setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO)
|
---|
947 | {
|
---|
948 | RT_NOREF(aDefaultAdditionsISO);
|
---|
949 | /** @todo not yet implemented, settings handling is missing */
|
---|
950 | ReturnComNotImplemented();
|
---|
951 | #if 0 /* not implemented */
|
---|
952 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
953 | HRESULT rc = i_setDefaultAdditionsISO(aDefaultAdditionsISO);
|
---|
954 | alock.release();
|
---|
955 |
|
---|
956 | if (SUCCEEDED(rc))
|
---|
957 | {
|
---|
958 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
959 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
960 | rc = mParent->i_saveSettings();
|
---|
961 | }
|
---|
962 |
|
---|
963 | return rc;
|
---|
964 | #endif
|
---|
965 | }
|
---|
966 |
|
---|
967 | HRESULT SystemProperties::getDefaultFrontend(com::Utf8Str &aDefaultFrontend)
|
---|
968 | {
|
---|
969 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
970 | aDefaultFrontend = m->strDefaultFrontend;
|
---|
971 | return S_OK;
|
---|
972 | }
|
---|
973 |
|
---|
974 | HRESULT SystemProperties::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
|
---|
975 | {
|
---|
976 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
977 | if (m->strDefaultFrontend == Utf8Str(aDefaultFrontend))
|
---|
978 | return S_OK;
|
---|
979 | HRESULT rc = i_setDefaultFrontend(aDefaultFrontend);
|
---|
980 | alock.release();
|
---|
981 |
|
---|
982 | if (SUCCEEDED(rc))
|
---|
983 | {
|
---|
984 | // VirtualBox::i_saveSettings() needs vbox write lock
|
---|
985 | AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
|
---|
986 | rc = mParent->i_saveSettings();
|
---|
987 | }
|
---|
988 |
|
---|
989 | return rc;
|
---|
990 | }
|
---|
991 |
|
---|
992 | HRESULT SystemProperties::getScreenShotFormats(std::vector<BitmapFormat_T> &aBitmapFormats)
|
---|
993 | {
|
---|
994 | aBitmapFormats.push_back(BitmapFormat_BGR0);
|
---|
995 | aBitmapFormats.push_back(BitmapFormat_BGRA);
|
---|
996 | aBitmapFormats.push_back(BitmapFormat_RGBA);
|
---|
997 | aBitmapFormats.push_back(BitmapFormat_PNG);
|
---|
998 | return S_OK;
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | HRESULT SystemProperties::getProxyMode(ProxyMode_T *pProxyMode)
|
---|
1002 | {
|
---|
1003 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1004 | ProxyMode_T enmMode = *pProxyMode = (ProxyMode_T)m->uProxyMode;
|
---|
1005 | AssertMsgReturn(enmMode == ProxyMode_System || enmMode == ProxyMode_NoProxy || enmMode == ProxyMode_Manual,
|
---|
1006 | ("enmMode=%d\n", enmMode), E_UNEXPECTED);
|
---|
1007 | return S_OK;
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | HRESULT SystemProperties::setProxyMode(ProxyMode_T aProxyMode)
|
---|
1011 | {
|
---|
1012 | /* Validate input. */
|
---|
1013 | switch (aProxyMode)
|
---|
1014 | {
|
---|
1015 | case ProxyMode_System:
|
---|
1016 | case ProxyMode_NoProxy:
|
---|
1017 | case ProxyMode_Manual:
|
---|
1018 | break;
|
---|
1019 | default:
|
---|
1020 | return setError(E_INVALIDARG, tr("Invalid ProxyMode value: %d"), (int)aProxyMode);
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | /* Set and write out settings. */
|
---|
1024 | {
|
---|
1025 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1026 | m->uProxyMode = aProxyMode;
|
---|
1027 | }
|
---|
1028 | AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */
|
---|
1029 | return mParent->i_saveSettings();
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 | HRESULT SystemProperties::getProxyURL(com::Utf8Str &aProxyURL)
|
---|
1033 | {
|
---|
1034 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1035 | aProxyURL = m->strProxyUrl;
|
---|
1036 | return S_OK;
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | HRESULT SystemProperties::setProxyURL(const com::Utf8Str &aProxyURL)
|
---|
1040 | {
|
---|
1041 | /*
|
---|
1042 | * Validate input.
|
---|
1043 | */
|
---|
1044 | Utf8Str const *pStrProxyUrl = &aProxyURL;
|
---|
1045 | Utf8Str strTmp;
|
---|
1046 | if (pStrProxyUrl->isNotEmpty())
|
---|
1047 | {
|
---|
1048 | /* RTUriParse requires a scheme, so append 'http://' if none seems present: */
|
---|
1049 | if (pStrProxyUrl->find("://") == RTCString::npos)
|
---|
1050 | {
|
---|
1051 | strTmp.printf("http://%s", aProxyURL.c_str());
|
---|
1052 | pStrProxyUrl = &strTmp;
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | /* Use RTUriParse to check the format. There must be a hostname, but nothing
|
---|
1056 | can follow it and the port. */
|
---|
1057 | RTURIPARSED Parsed;
|
---|
1058 | int vrc = RTUriParse(pStrProxyUrl->c_str(), &Parsed);
|
---|
1059 | if (RT_FAILURE(vrc))
|
---|
1060 | return setErrorBoth(E_INVALIDARG, vrc, tr("Failed to parse proxy URL: %Rrc"), vrc);
|
---|
1061 | if ( Parsed.cchAuthorityHost == 0
|
---|
1062 | && !RTUriIsSchemeMatch(pStrProxyUrl->c_str(), "direct"))
|
---|
1063 | return setError(E_INVALIDARG, tr("Proxy URL must include a hostname"));
|
---|
1064 | if (Parsed.cchPath > 0)
|
---|
1065 | return setError(E_INVALIDARG, tr("Proxy URL must not include a path component (%.*s)"),
|
---|
1066 | Parsed.cchPath, pStrProxyUrl->c_str() + Parsed.offPath);
|
---|
1067 | if (Parsed.cchQuery > 0)
|
---|
1068 | return setError(E_INVALIDARG, tr("Proxy URL must not include a query component (?%.*s)"),
|
---|
1069 | Parsed.cchQuery, pStrProxyUrl->c_str() + Parsed.offQuery);
|
---|
1070 | if (Parsed.cchFragment > 0)
|
---|
1071 | return setError(E_INVALIDARG, tr("Proxy URL must not include a fragment component (#%.*s)"),
|
---|
1072 | Parsed.cchFragment, pStrProxyUrl->c_str() + Parsed.offFragment);
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | /*
|
---|
1076 | * Set and write out settings.
|
---|
1077 | */
|
---|
1078 | {
|
---|
1079 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1080 | m->strProxyUrl = *pStrProxyUrl;
|
---|
1081 | }
|
---|
1082 | AutoWriteLock alock(mParent COMMA_LOCKVAL_SRC_POS); /* required for saving. */
|
---|
1083 | return mParent->i_saveSettings();
|
---|
1084 | }
|
---|
1085 |
|
---|
1086 | // public methods only for internal purposes
|
---|
1087 | /////////////////////////////////////////////////////////////////////////////
|
---|
1088 |
|
---|
1089 | HRESULT SystemProperties::i_loadSettings(const settings::SystemProperties &data)
|
---|
1090 | {
|
---|
1091 | AutoCaller autoCaller(this);
|
---|
1092 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
1093 |
|
---|
1094 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1095 | HRESULT rc = S_OK;
|
---|
1096 | rc = i_setDefaultMachineFolder(data.strDefaultMachineFolder);
|
---|
1097 | if (FAILED(rc)) return rc;
|
---|
1098 |
|
---|
1099 | rc = i_setLoggingLevel(data.strLoggingLevel);
|
---|
1100 | if (FAILED(rc)) return rc;
|
---|
1101 |
|
---|
1102 | rc = i_setDefaultHardDiskFormat(data.strDefaultHardDiskFormat);
|
---|
1103 | if (FAILED(rc)) return rc;
|
---|
1104 |
|
---|
1105 | rc = i_setVRDEAuthLibrary(data.strVRDEAuthLibrary);
|
---|
1106 | if (FAILED(rc)) return rc;
|
---|
1107 |
|
---|
1108 | rc = i_setWebServiceAuthLibrary(data.strWebServiceAuthLibrary);
|
---|
1109 | if (FAILED(rc)) return rc;
|
---|
1110 |
|
---|
1111 | rc = i_setDefaultVRDEExtPack(data.strDefaultVRDEExtPack);
|
---|
1112 | if (FAILED(rc)) return rc;
|
---|
1113 |
|
---|
1114 | m->uLogHistoryCount = data.uLogHistoryCount;
|
---|
1115 | m->fExclusiveHwVirt = data.fExclusiveHwVirt;
|
---|
1116 | m->uProxyMode = data.uProxyMode;
|
---|
1117 | m->strProxyUrl = data.strProxyUrl;
|
---|
1118 |
|
---|
1119 | rc = i_setAutostartDatabasePath(data.strAutostartDatabasePath);
|
---|
1120 | if (FAILED(rc)) return rc;
|
---|
1121 |
|
---|
1122 | {
|
---|
1123 | /* must ignore errors signalled here, because the guest additions
|
---|
1124 | * file may not exist, and in this case keep the empty string */
|
---|
1125 | ErrorInfoKeeper eik;
|
---|
1126 | (void)i_setDefaultAdditionsISO(data.strDefaultAdditionsISO);
|
---|
1127 | }
|
---|
1128 |
|
---|
1129 | rc = i_setDefaultFrontend(data.strDefaultFrontend);
|
---|
1130 | if (FAILED(rc)) return rc;
|
---|
1131 |
|
---|
1132 | return S_OK;
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 | HRESULT SystemProperties::i_saveSettings(settings::SystemProperties &data)
|
---|
1136 | {
|
---|
1137 | AutoCaller autoCaller(this);
|
---|
1138 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
1139 |
|
---|
1140 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1141 |
|
---|
1142 | data = *m;
|
---|
1143 |
|
---|
1144 | return S_OK;
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | /**
|
---|
1148 | * Returns a medium format object corresponding to the given format
|
---|
1149 | * identifier or null if no such format.
|
---|
1150 | *
|
---|
1151 | * @param aFormat Format identifier.
|
---|
1152 | *
|
---|
1153 | * @return ComObjPtr<MediumFormat>
|
---|
1154 | */
|
---|
1155 | ComObjPtr<MediumFormat> SystemProperties::i_mediumFormat(const Utf8Str &aFormat)
|
---|
1156 | {
|
---|
1157 | ComObjPtr<MediumFormat> format;
|
---|
1158 |
|
---|
1159 | AutoCaller autoCaller(this);
|
---|
1160 | AssertComRCReturn (autoCaller.rc(), format);
|
---|
1161 |
|
---|
1162 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1163 |
|
---|
1164 | for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
|
---|
1165 | it != m_llMediumFormats.end();
|
---|
1166 | ++ it)
|
---|
1167 | {
|
---|
1168 | /* MediumFormat is all const, no need to lock */
|
---|
1169 |
|
---|
1170 | if ((*it)->i_getId().compare(aFormat, Utf8Str::CaseInsensitive) == 0)
|
---|
1171 | {
|
---|
1172 | format = *it;
|
---|
1173 | break;
|
---|
1174 | }
|
---|
1175 | }
|
---|
1176 |
|
---|
1177 | return format;
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | /**
|
---|
1181 | * Returns a medium format object corresponding to the given file extension or
|
---|
1182 | * null if no such format.
|
---|
1183 | *
|
---|
1184 | * @param aExt File extension.
|
---|
1185 | *
|
---|
1186 | * @return ComObjPtr<MediumFormat>
|
---|
1187 | */
|
---|
1188 | ComObjPtr<MediumFormat> SystemProperties::i_mediumFormatFromExtension(const Utf8Str &aExt)
|
---|
1189 | {
|
---|
1190 | ComObjPtr<MediumFormat> format;
|
---|
1191 |
|
---|
1192 | AutoCaller autoCaller(this);
|
---|
1193 | AssertComRCReturn (autoCaller.rc(), format);
|
---|
1194 |
|
---|
1195 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1196 |
|
---|
1197 | bool fFound = false;
|
---|
1198 | for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
|
---|
1199 | it != m_llMediumFormats.end() && !fFound;
|
---|
1200 | ++it)
|
---|
1201 | {
|
---|
1202 | /* MediumFormat is all const, no need to lock */
|
---|
1203 | MediumFormat::StrArray aFileList = (*it)->i_getFileExtensions();
|
---|
1204 | for (MediumFormat::StrArray::const_iterator it1 = aFileList.begin();
|
---|
1205 | it1 != aFileList.end();
|
---|
1206 | ++it1)
|
---|
1207 | {
|
---|
1208 | if ((*it1).compare(aExt, Utf8Str::CaseInsensitive) == 0)
|
---|
1209 | {
|
---|
1210 | format = *it;
|
---|
1211 | fFound = true;
|
---|
1212 | break;
|
---|
1213 | }
|
---|
1214 | }
|
---|
1215 | }
|
---|
1216 |
|
---|
1217 | return format;
|
---|
1218 | }
|
---|
1219 |
|
---|
1220 |
|
---|
1221 | /**
|
---|
1222 | * VD plugin load
|
---|
1223 | */
|
---|
1224 | int SystemProperties::i_loadVDPlugin(const char *pszPluginLibrary)
|
---|
1225 | {
|
---|
1226 | return VDPluginLoadFromFilename(pszPluginLibrary);
|
---|
1227 | }
|
---|
1228 |
|
---|
1229 | /**
|
---|
1230 | * VD plugin unload
|
---|
1231 | */
|
---|
1232 | int SystemProperties::i_unloadVDPlugin(const char *pszPluginLibrary)
|
---|
1233 | {
|
---|
1234 | return VDPluginUnloadFromFilename(pszPluginLibrary);
|
---|
1235 | }
|
---|
1236 |
|
---|
1237 | /**
|
---|
1238 | * Internally usable version of getDefaultAdditionsISO.
|
---|
1239 | */
|
---|
1240 | HRESULT SystemProperties::i_getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
|
---|
1241 | {
|
---|
1242 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1243 | if (m->strDefaultAdditionsISO.isNotEmpty())
|
---|
1244 | aDefaultAdditionsISO = m->strDefaultAdditionsISO;
|
---|
1245 | else
|
---|
1246 | {
|
---|
1247 | /* no guest additions, check if it showed up in the mean time */
|
---|
1248 | alock.release();
|
---|
1249 | AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS);
|
---|
1250 | if (m->strDefaultAdditionsISO.isEmpty())
|
---|
1251 | {
|
---|
1252 | ErrorInfoKeeper eik;
|
---|
1253 | (void)setDefaultAdditionsISO("");
|
---|
1254 | }
|
---|
1255 | aDefaultAdditionsISO = m->strDefaultAdditionsISO;
|
---|
1256 | }
|
---|
1257 | return S_OK;
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | // private methods
|
---|
1261 | /////////////////////////////////////////////////////////////////////////////
|
---|
1262 |
|
---|
1263 | /**
|
---|
1264 | * Returns the user's home directory. Wrapper around RTPathUserHome().
|
---|
1265 | * @param strPath
|
---|
1266 | * @return
|
---|
1267 | */
|
---|
1268 | HRESULT SystemProperties::i_getUserHomeDirectory(Utf8Str &strPath)
|
---|
1269 | {
|
---|
1270 | char szHome[RTPATH_MAX];
|
---|
1271 | int vrc = RTPathUserHome(szHome, sizeof(szHome));
|
---|
1272 | if (RT_FAILURE(vrc))
|
---|
1273 | return setErrorBoth(E_FAIL, vrc,
|
---|
1274 | tr("Cannot determine user home directory (%Rrc)"),
|
---|
1275 | vrc);
|
---|
1276 | strPath = szHome;
|
---|
1277 | return S_OK;
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | /**
|
---|
1281 | * Internal implementation to set the default machine folder. Gets called
|
---|
1282 | * from the public attribute setter as well as loadSettings(). With 4.0,
|
---|
1283 | * the "default default" machine folder has changed, and we now require
|
---|
1284 | * a full path always.
|
---|
1285 | * @param strPath
|
---|
1286 | * @return
|
---|
1287 | */
|
---|
1288 | HRESULT SystemProperties::i_setDefaultMachineFolder(const Utf8Str &strPath)
|
---|
1289 | {
|
---|
1290 | Utf8Str path(strPath); // make modifiable
|
---|
1291 | if ( path.isEmpty() // used by API calls to reset the default
|
---|
1292 | || path == "Machines" // this value (exactly like this, without path) is stored
|
---|
1293 | // in VirtualBox.xml if user upgrades from before 4.0 and
|
---|
1294 | // has not changed the default machine folder
|
---|
1295 | )
|
---|
1296 | {
|
---|
1297 | // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs"
|
---|
1298 | HRESULT rc = i_getUserHomeDirectory(path);
|
---|
1299 | if (FAILED(rc)) return rc;
|
---|
1300 | path += RTPATH_SLASH_STR "VirtualBox VMs";
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | if (!RTPathStartsWithRoot(path.c_str()))
|
---|
1304 | return setError(E_INVALIDARG,
|
---|
1305 | tr("Given default machine folder '%s' is not fully qualified"),
|
---|
1306 | path.c_str());
|
---|
1307 |
|
---|
1308 | m->strDefaultMachineFolder = path;
|
---|
1309 |
|
---|
1310 | return S_OK;
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | HRESULT SystemProperties::i_setLoggingLevel(const com::Utf8Str &aLoggingLevel)
|
---|
1314 | {
|
---|
1315 | Utf8Str useLoggingLevel(aLoggingLevel);
|
---|
1316 | if (useLoggingLevel.isEmpty())
|
---|
1317 | useLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
1318 | int rc = RTLogGroupSettings(RTLogRelGetDefaultInstance(), useLoggingLevel.c_str());
|
---|
1319 | // If failed and not the default logging level - try to use the default logging level.
|
---|
1320 | if (RT_FAILURE(rc))
|
---|
1321 | {
|
---|
1322 | // If failed write message to the release log.
|
---|
1323 | LogRel(("Cannot set passed logging level=%s Error=%Rrc \n", useLoggingLevel.c_str(), rc));
|
---|
1324 | // If attempted logging level not the default one then try the default one.
|
---|
1325 | if (!useLoggingLevel.equals(VBOXSVC_LOG_DEFAULT))
|
---|
1326 | {
|
---|
1327 | rc = RTLogGroupSettings(RTLogRelGetDefaultInstance(), VBOXSVC_LOG_DEFAULT);
|
---|
1328 | // If failed report this to the release log.
|
---|
1329 | if (RT_FAILURE(rc))
|
---|
1330 | LogRel(("Cannot set default logging level Error=%Rrc \n", rc));
|
---|
1331 | }
|
---|
1332 | // On any failure - set default level as the one to be stored.
|
---|
1333 | useLoggingLevel = VBOXSVC_LOG_DEFAULT;
|
---|
1334 | }
|
---|
1335 | // Set to passed value or if default used/attempted (even if error condition) use empty string.
|
---|
1336 | m->strLoggingLevel = (useLoggingLevel.equals(VBOXSVC_LOG_DEFAULT) ? "" : useLoggingLevel);
|
---|
1337 | return RT_SUCCESS(rc) ? S_OK : E_FAIL;
|
---|
1338 | }
|
---|
1339 |
|
---|
1340 | HRESULT SystemProperties::i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat)
|
---|
1341 | {
|
---|
1342 | if (!aFormat.isEmpty())
|
---|
1343 | m->strDefaultHardDiskFormat = aFormat;
|
---|
1344 | else
|
---|
1345 | m->strDefaultHardDiskFormat = "VDI";
|
---|
1346 |
|
---|
1347 | return S_OK;
|
---|
1348 | }
|
---|
1349 |
|
---|
1350 | HRESULT SystemProperties::i_setVRDEAuthLibrary(const com::Utf8Str &aPath)
|
---|
1351 | {
|
---|
1352 | if (!aPath.isEmpty())
|
---|
1353 | m->strVRDEAuthLibrary = aPath;
|
---|
1354 | else
|
---|
1355 | m->strVRDEAuthLibrary = "VBoxAuth";
|
---|
1356 |
|
---|
1357 | return S_OK;
|
---|
1358 | }
|
---|
1359 |
|
---|
1360 | HRESULT SystemProperties::i_setWebServiceAuthLibrary(const com::Utf8Str &aPath)
|
---|
1361 | {
|
---|
1362 | if (!aPath.isEmpty())
|
---|
1363 | m->strWebServiceAuthLibrary = aPath;
|
---|
1364 | else
|
---|
1365 | m->strWebServiceAuthLibrary = "VBoxAuth";
|
---|
1366 |
|
---|
1367 | return S_OK;
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | HRESULT SystemProperties::i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
|
---|
1371 | {
|
---|
1372 | m->strDefaultVRDEExtPack = aExtPack;
|
---|
1373 |
|
---|
1374 | return S_OK;
|
---|
1375 | }
|
---|
1376 |
|
---|
1377 | HRESULT SystemProperties::i_setAutostartDatabasePath(const com::Utf8Str &aPath)
|
---|
1378 | {
|
---|
1379 | HRESULT rc = S_OK;
|
---|
1380 | AutostartDb *autostartDb = this->mParent->i_getAutostartDb();
|
---|
1381 |
|
---|
1382 | if (!aPath.isEmpty())
|
---|
1383 | {
|
---|
1384 | /* Update path in the autostart database. */
|
---|
1385 | int vrc = autostartDb->setAutostartDbPath(aPath.c_str());
|
---|
1386 | if (RT_SUCCESS(vrc))
|
---|
1387 | m->strAutostartDatabasePath = aPath;
|
---|
1388 | else
|
---|
1389 | rc = setErrorBoth(E_FAIL, vrc,
|
---|
1390 | tr("Cannot set the autostart database path (%Rrc)"),
|
---|
1391 | vrc);
|
---|
1392 | }
|
---|
1393 | else
|
---|
1394 | {
|
---|
1395 | int vrc = autostartDb->setAutostartDbPath(NULL);
|
---|
1396 | if (RT_SUCCESS(vrc) || vrc == VERR_NOT_SUPPORTED)
|
---|
1397 | m->strAutostartDatabasePath = "";
|
---|
1398 | else
|
---|
1399 | rc = setErrorBoth(E_FAIL, vrc,
|
---|
1400 | tr("Deleting the autostart database path failed (%Rrc)"),
|
---|
1401 | vrc);
|
---|
1402 | }
|
---|
1403 |
|
---|
1404 | return rc;
|
---|
1405 | }
|
---|
1406 |
|
---|
1407 | HRESULT SystemProperties::i_setDefaultAdditionsISO(const com::Utf8Str &aPath)
|
---|
1408 | {
|
---|
1409 | com::Utf8Str path(aPath);
|
---|
1410 | if (path.isEmpty())
|
---|
1411 | {
|
---|
1412 | char strTemp[RTPATH_MAX];
|
---|
1413 | int vrc = RTPathAppPrivateNoArch(strTemp, sizeof(strTemp));
|
---|
1414 | AssertRC(vrc);
|
---|
1415 | Utf8Str strSrc1 = Utf8Str(strTemp).append("/VBoxGuestAdditions.iso");
|
---|
1416 |
|
---|
1417 | vrc = RTPathExecDir(strTemp, sizeof(strTemp));
|
---|
1418 | AssertRC(vrc);
|
---|
1419 | Utf8Str strSrc2 = Utf8Str(strTemp).append("/additions/VBoxGuestAdditions.iso");
|
---|
1420 |
|
---|
1421 | vrc = RTPathUserHome(strTemp, sizeof(strTemp));
|
---|
1422 | AssertRC(vrc);
|
---|
1423 | Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%s.iso", strTemp, VirtualBox::i_getVersionNormalized().c_str());
|
---|
1424 |
|
---|
1425 | /* Check the standard image locations */
|
---|
1426 | if (RTFileExists(strSrc1.c_str()))
|
---|
1427 | path = strSrc1;
|
---|
1428 | else if (RTFileExists(strSrc2.c_str()))
|
---|
1429 | path = strSrc2;
|
---|
1430 | else if (RTFileExists(strSrc3.c_str()))
|
---|
1431 | path = strSrc3;
|
---|
1432 | else
|
---|
1433 | return setError(E_FAIL,
|
---|
1434 | tr("Cannot determine default Guest Additions ISO location. Most likely they are not available"));
|
---|
1435 | }
|
---|
1436 |
|
---|
1437 | if (!RTPathStartsWithRoot(path.c_str()))
|
---|
1438 | return setError(E_INVALIDARG,
|
---|
1439 | tr("Given default machine Guest Additions ISO file '%s' is not fully qualified"),
|
---|
1440 | path.c_str());
|
---|
1441 |
|
---|
1442 | if (!RTFileExists(path.c_str()))
|
---|
1443 | return setError(E_INVALIDARG,
|
---|
1444 | tr("Given default machine Guest Additions ISO file '%s' does not exist"),
|
---|
1445 | path.c_str());
|
---|
1446 |
|
---|
1447 | m->strDefaultAdditionsISO = path;
|
---|
1448 |
|
---|
1449 | return S_OK;
|
---|
1450 | }
|
---|
1451 |
|
---|
1452 | HRESULT SystemProperties::i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
|
---|
1453 | {
|
---|
1454 | m->strDefaultFrontend = aDefaultFrontend;
|
---|
1455 |
|
---|
1456 | return S_OK;
|
---|
1457 | }
|
---|
1458 |
|
---|