- Timestamp:
- Nov 14, 2008 4:17:20 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDisk2Impl.cpp
r14164 r14224 472 472 const BSTR aLocation) 473 473 { 474 AssertReturn (aVirtualBox, E_INVALIDARG); 475 AssertReturn (aLocation, E_INVALIDARG); 474 AssertReturn (aVirtualBox != NULL, E_INVALIDARG); 475 AssertReturn (aLocation != NULL, E_INVALIDARG); 476 AssertReturn (aFormat != NULL && *aFormat != '\0', E_INVALIDARG); 476 477 477 478 /* Enclose the state transition NotReady->InInit->Ready */ -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r13837 r14224 75 75 setDefaultMachineFolder (NULL); 76 76 setDefaultHardDiskFolder (NULL); 77 setDefaultHardDiskFormat (NULL); 78 77 79 setRemoteDisplayAuthLibrary (NULL); 78 80 … … 362 364 } 363 365 366 STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFormat) (BSTR *aDefaultHardDiskFormat) 367 { 368 if (!aDefaultHardDiskFormat) 369 return E_POINTER; 370 371 AutoCaller autoCaller (this); 372 CheckComRCReturnRC (autoCaller.rc()); 373 374 AutoReadLock alock (this); 375 376 mDefaultHardDiskFormat.cloneTo (aDefaultHardDiskFormat); 377 378 return S_OK; 379 } 380 381 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat) (INPTR BSTR aDefaultHardDiskFormat) 382 { 383 AutoCaller autoCaller (this); 384 CheckComRCReturnRC (autoCaller.rc()); 385 386 /* VirtualBox::saveSettings() needs a write lock */ 387 AutoMultiWriteLock2 alock (mParent, this); 388 389 HRESULT rc = setDefaultHardDiskFormat (aDefaultHardDiskFormat); 390 if (SUCCEEDED (rc)) 391 rc = mParent->saveSettings(); 392 393 return rc; 394 } 395 364 396 STDMETHODIMP SystemProperties::COMGETTER(RemoteDisplayAuthLibrary) (BSTR *aRemoteDisplayAuthLibrary) 365 397 { … … 508 540 bstr = properties.stringValue ("defaultHardDiskFolder"); 509 541 rc = setDefaultHardDiskFolder (bstr); 542 CheckComRCReturnRC (rc); 543 544 bstr = properties.stringValue ("defaultHardDiskFormat"); 545 rc = setDefaultHardDiskFormat (bstr); 510 546 CheckComRCReturnRC (rc); 511 547 … … 549 585 if (mDefaultHardDiskFolder) 550 586 properties.setValue <Bstr> ("defaultHardDiskFolder", mDefaultHardDiskFolder); 587 588 if (mDefaultHardDiskFormat) 589 properties.setValue <Bstr> ("defaultHardDiskFormat", mDefaultHardDiskFormat); 551 590 552 591 if (mRemoteDisplayAuthLibrary) … … 610 649 } 611 650 651 HRESULT SystemProperties::setDefaultHardDiskFormat (const BSTR aFormat) 652 { 653 if (aFormat && *aFormat) 654 mDefaultHardDiskFormat = aFormat; 655 else 656 mDefaultHardDiskFormat = "VDI"; 657 658 return S_OK; 659 } 660 612 661 HRESULT SystemProperties::setRemoteDisplayAuthLibrary (const BSTR aPath) 613 662 { 614 Utf8Str path;615 663 if (aPath && *aPath) 616 path= aPath;664 mRemoteDisplayAuthLibrary = aPath; 617 665 else 618 path = "VRDPAuth"; 619 620 mRemoteDisplayAuthLibrary = path; 666 mRemoteDisplayAuthLibrary = "VRDPAuth"; 621 667 622 668 return S_OK; … … 625 671 HRESULT SystemProperties::setWebServiceAuthLibrary (const BSTR aPath) 626 672 { 627 Utf8Str path;628 673 if (aPath && *aPath) 629 path= aPath;674 mWebServiceAuthLibrary = aPath; 630 675 else 631 path = "VRDPAuth"; 632 633 mWebServiceAuthLibrary = path; 634 635 return S_OK; 636 } 676 mWebServiceAuthLibrary = "VRDPAuth"; 677 678 return S_OK; 679 } -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r13842 r14224 1060 1060 /* we don't access non-const data members so no need to lock */ 1061 1061 1062 Bstr format = aFormat; 1063 if (format.isEmpty()) 1064 { 1065 AutoReadLock propsLock (systemProperties()); 1066 format = systemProperties()->defaultHardDiskFormat(); 1067 } 1068 1062 1069 HRESULT rc = E_FAIL; 1063 1070 1064 1071 ComObjPtr <HardDisk2> hardDisk; 1065 1072 hardDisk.createObject(); 1066 rc = hardDisk->init (this, aFormat, aLocation);1073 rc = hardDisk->init (this, format, aLocation); 1067 1074 1068 1075 if (SUCCEEDED (rc)) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r14107 r14224 1386 1386 the <link to="#hardDisks2"/> array. See IHardDisk2 for more details. 1387 1387 1388 The list of all <link to="IHardDisk2::format">storage formats</link> 1389 supported by this VirtualBox installation can be obtained using 1390 <link to="ISystemProperties::hardDiskFormats"/>. 1388 The list of all storage formats supported by this VirtualBox 1389 installation can be obtained using 1390 <link to="ISystemProperties::hardDiskFormats"/>. If the @a format 1391 attribute is empty or <tt>null</tt> then the default storage format 1392 specified by <link to="ISystemProperties::defaultHardDiskFormat"/> will 1393 be used for creating a storage unit of the hard disk. 1391 1394 1392 1395 Note that the format of the location string is storage format specific. … … 1396 1399 <param name="format" type="wstring" dir="in"> 1397 1400 <desc> 1398 Storage format to use for the new hard disk.1401 Idetifier of the torage format to use for the new hard disk. 1399 1402 </desc> 1400 1403 </param> … … 5269 5272 name="ISystemProperties" 5270 5273 extends="$unknown" 5271 uuid=" c7c060a9-91af-4e74-9188-a6b15a725e49"5274 uuid="604afeba-5963-4d12-a577-902ffb96352a" 5272 5275 wsmap="managed" 5273 5276 > … … 5415 5418 <see> 5416 5419 <link to="IHardDiskFormat"/>, 5420 </see> 5421 </desc> 5422 </attribute> 5423 5424 <attribute name="defaultHardDiskFormat" type="wstring"> 5425 <desc> 5426 Identifier of the default hard disk format used by VirtualBox. 5427 5428 The hard disk format set by this attribute is used by VirtualBox 5429 when the hard disk format was not specified explicitly. One example is 5430 <link to="IVirtualBox::createHardDisk2()"/> with the <tt>null</tt> 5431 format argument. A more complex example is implicit creation of 5432 differencing hard disks when taking a snapshot of a virtual machine: 5433 this operation will try to use a format of the parent hard disk first 5434 and if this format does not support differencing hard disks the default 5435 format specified by this argument will be used. 5436 5437 The list of supported hard disk formats may be obtained by the 5438 <link to="#defaultHardDiskFormats"/> call. Note that the default 5439 hard disk format must have a capability to create differencing hard 5440 disks; otherwise opeartions that create hard disks implicitly may fail 5441 unexpectedly. 5442 5443 The initial value of this property is <tt>VDI</tt> in the current 5444 version of the VirtualBox product, but may change in the future. 5445 5446 <note> 5447 Setting this property to <tt>null</tt> will restore the 5448 initial value. 5449 </note> 5450 5451 <see> 5452 <link to="#hardDiskFormats"/>, 5453 <link to="IHardDiskFormat:id"/>, 5454 <link to="IVirtualBox::createHardDisk2()"/> 5417 5455 </see> 5418 5456 </desc> -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r13606 r14224 80 80 STDMETHOD(COMSETTER(DefaultHardDiskFolder)) (INPTR BSTR aDefaultHardDiskFolder); 81 81 STDMETHOD(COMGETTER(HardDiskFormats)) (ComSafeArrayOut (IHardDiskFormat *, aHardDiskFormats)); 82 STDMETHOD(COMGETTER(DefaultHardDiskFormat)) (BSTR *aDefaultHardDiskFolder); 83 STDMETHOD(COMSETTER(DefaultHardDiskFormat)) (INPTR BSTR aDefaultHardDiskFolder); 82 84 STDMETHOD(COMGETTER(RemoteDisplayAuthLibrary)) (BSTR *aRemoteDisplayAuthLibrary); 83 85 STDMETHOD(COMSETTER(RemoteDisplayAuthLibrary)) (INPTR BSTR aRemoteDisplayAuthLibrary); … … 103 105 const Bstr &defaultHardDiskFolderFull() const { return mDefaultHardDiskFolderFull; } 104 106 107 /** Default hard disk format. Not thread safe (use object lock). */ 108 const Bstr &defaultHardDiskFormat() const { return mDefaultHardDiskFormat; } 109 105 110 // for VirtualBoxSupportErrorInfoImpl 106 111 static const wchar_t *getComponentName() { return L"SystemProperties"; } … … 112 117 HRESULT setDefaultMachineFolder (const BSTR aPath); 113 118 HRESULT setDefaultHardDiskFolder (const BSTR aPath); 119 HRESULT setDefaultHardDiskFormat (const BSTR aFormat); 120 114 121 HRESULT setRemoteDisplayAuthLibrary (const BSTR aPath); 115 122 HRESULT setWebServiceAuthLibrary (const BSTR aPath); … … 121 128 Bstr mDefaultHardDiskFolder; 122 129 Bstr mDefaultHardDiskFolderFull; 130 Bstr mDefaultHardDiskFormat; 123 131 124 132 HardDiskFormatList mHardDiskFormats; -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r13966 r14224 305 305 <xsd:attribute name="defaultMachineFolder" type="TLocalFile"/> 306 306 <xsd:attribute name="defaultHardDiskFolder" type="TLocalFile"/> 307 <xsd:attribute name="defaultHardDiskFormat" type="TNonEmptyString"/> 307 308 <xsd:attribute name="remoteDisplayAuthLibrary" type="TLocalFile"/> 308 309 <xsd:attribute name="webServiceAuthLibrary" type="TLocalFile"/>
Note:
See TracChangeset
for help on using the changeset viewer.