Changeset 24346 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Nov 4, 2009 5:04:00 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 54368
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r24026 r24346 73 73 ComPtr<IMachine> machine; 74 74 ComPtr<IStorageController> storageCtl; 75 ComPtr<ISystemProperties> systemProperties; 75 76 76 77 if (a->argc < 9) … … 153 154 } 154 155 156 /* get the virtualbox system properties */ 157 CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), 1); 158 155 159 /* try to find the given machine */ 156 160 if (!Guid(machineuuid).isEmpty()) … … 238 242 StorageBus_T storageBus = StorageBus_Null; 239 243 DeviceType_T deviceType = DeviceType_Null; 240 244 com::SafeArray <DeviceType_T> saDeviceTypes; 245 ULONG driveCheck = 0; 246 247 /* check if the device type is supported by the controller */ 241 248 CHECK_ERROR(storageCtl, COMGETTER(Bus)(&storageBus)); 249 CHECK_ERROR(systemProperties, GetDeviceTypesForStorageBus(storageBus, ComSafeArrayAsOutParam(saDeviceTypes))); 250 for (size_t i = 0; i < saDeviceTypes.size(); ++ i) 251 { 252 if ( (saDeviceTypes[i] == DeviceType_DVD) 253 || (saDeviceTypes[i] == DeviceType_Floppy)) 254 driveCheck++; 255 } 256 257 if (!driveCheck) 258 { 259 errorArgument("The Attachment is not supported by the Storage Controller: '%s'", pszCtl); 260 goto leave; 261 } 242 262 243 263 if (storageBus == StorageBus_Floppy) … … 337 357 } 338 358 359 /* check if the device type is supported by the controller */ 360 { 361 ULONG storageBus = StorageBus_Null; 362 com::SafeArray <DeviceType_T> saDeviceTypes; 363 364 CHECK_ERROR(storageCtl, COMGETTER(Bus)(&storageBus)); 365 CHECK_ERROR(systemProperties, GetDeviceTypesForStorageBus(storageBus, ComSafeArrayAsOutParam(saDeviceTypes))); 366 if (SUCCEEDED(rc)) 367 { 368 ULONG driveCheck = 0; 369 for (size_t i = 0; i < saDeviceTypes.size(); ++ i) 370 { 371 if ( !RTStrICmp(pszType, "dvddrive") 372 && (saDeviceTypes[i] == DeviceType_DVD)) 373 driveCheck++; 374 375 if ( !RTStrICmp(pszType, "hdd") 376 && (saDeviceTypes[i] == DeviceType_HardDisk)) 377 driveCheck++; 378 379 if ( !RTStrICmp(pszType, "fdd") 380 && (saDeviceTypes[i] == DeviceType_Floppy)) 381 driveCheck++; 382 } 383 if (!driveCheck) 384 { 385 errorArgument("The Attachment is not supported by the Storage Controller: '%s'", pszCtl); 386 goto leave; 387 } 388 } 389 else 390 goto leave; 391 } 392 339 393 if (!RTStrICmp(pszType, "dvddrive")) 340 394 {
Note:
See TracChangeset
for help on using the changeset viewer.