- Timestamp:
- Sep 22, 2009 6:15:56 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MediumImpl.cpp
r23223 r23235 968 968 CBSTR aLocation, 969 969 HDDOpenMode enOpenMode, 970 DeviceType_T aDeviceType, 970 971 BOOL aSetImageId, 971 972 const Guid &aImageId, … … 998 999 m->hddOpenMode = enOpenMode; 999 1000 1000 rc = setLocation(aLocation); 1001 if (aDeviceType == DeviceType_HardDisk) 1002 rc = setLocation(aLocation); 1003 else 1004 rc = setLocation(aLocation, "RAW"); 1001 1005 CheckComRCReturnRC(rc); 1002 1006 … … 3334 3338 * be NotCreated and will return a faiulre otherwise. 3335 3339 * 3336 * @param aLocation Location of the storage unit. If the loca iton is a FS-path,3340 * @param aLocation Location of the storage unit. If the location is a FS-path, 3337 3341 * then it can be relative to the VirtualBox home directory. 3342 * @param aFormat Optional fallback format if it is an import and the format 3343 * cannot be determined. 3338 3344 * 3339 3345 * @note Must be called from under this object's write lock. 3340 3346 */ 3341 HRESULT Medium::setLocation(const Utf8Str &aLocation )3347 HRESULT Medium::setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat) 3342 3348 { 3343 3349 AssertReturn(!aLocation.isEmpty(), E_FAIL); … … 3436 3442 tr("Could not find file for the hard disk '%s' (%Rrc)"), 3437 3443 locationFull.raw(), vrc); 3438 else 3444 else if (aFormat.isEmpty()) 3439 3445 return setError(VBOX_E_IPRT_ERROR, 3440 3446 tr("Could not get the storage format of the hard disk '%s' (%Rrc)"), 3441 3447 locationFull.raw(), vrc); 3448 else 3449 { 3450 HRESULT rc = setFormat(Bstr(aFormat)); 3451 /* setFormat() must not fail since we've just used the backend so 3452 * the format object must be there */ 3453 AssertComRCReturnRC(rc); 3454 } 3442 3455 } 3443 3444 ComAssertRet(backendName != NULL && *backendName != '\0', E_FAIL); 3445 3446 HRESULT rc = setFormat(Bstr(backendName)); 3447 RTStrFree(backendName); 3448 3449 /* setFormat() must not fail since we've just used the backend so 3450 * the format object must be there */ 3451 AssertComRCReturnRC(rc); 3456 else 3457 { 3458 ComAssertRet(backendName != NULL && *backendName != '\0', E_FAIL); 3459 3460 HRESULT rc = setFormat(Bstr(backendName)); 3461 RTStrFree(backendName); 3462 3463 /* setFormat() must not fail since we've just used the backend so 3464 * the format object must be there */ 3465 AssertComRCReturnRC(rc); 3466 } 3452 3467 } 3453 3468 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r23223 r23235 1174 1174 aLocation, 1175 1175 (accessMode == AccessMode_ReadWrite) ? Medium::OpenReadWrite : Medium::OpenReadOnly, 1176 DeviceType_HardDisk, 1176 1177 aSetImageId, imageId, 1177 1178 aSetParentId, parentId); … … 1249 1250 ComObjPtr<Medium> image; 1250 1251 image.createObject(); 1251 rc = image->init (this, aLocation, Medium::OpenReadOnly, true, id, false, Guid());1252 rc = image->init (this, aLocation, Medium::OpenReadOnly, DeviceType_DVD, true, id, false, Guid()); 1252 1253 if (SUCCEEDED(rc)) 1253 1254 { … … 1316 1317 ComObjPtr<Medium> image; 1317 1318 image.createObject(); 1318 rc = image->init (this, aLocation, Medium::OpenReadWrite, true, id, false, Guid());1319 rc = image->init (this, aLocation, Medium::OpenReadWrite, DeviceType_Floppy, true, id, false, Guid()); 1319 1320 if (SUCCEEDED(rc)) 1320 1321 { -
trunk/src/VBox/Main/include/MediumImpl.h
r23223 r23235 81 81 CBSTR aLocation, 82 82 HDDOpenMode enOpenMode, 83 DeviceType_T aDeviceType, 83 84 BOOL aSetImageId, 84 85 const Guid &aImageId, … … 316 317 private: 317 318 318 HRESULT setLocation(const Utf8Str &aLocation );319 HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str()); 319 320 HRESULT setFormat(CBSTR aFormat); 320 321
Note:
See TracChangeset
for help on using the changeset viewer.