Changeset 35239 in vbox for trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
- Timestamp:
- Dec 20, 2010 12:45:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r35146 r35239 683 683 { 684 684 ComPtr<IMedium> hardDisk; 685 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 686 DeviceType_HardDisk, 687 hardDisk.asOutParam()); 685 rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk, 686 hardDisk, NULL); 688 687 if (FAILED(rc)) 689 { 690 /* open the new hard disk object */ 691 CHECK_ERROR(a->virtualBox, 692 OpenMedium(Bstr(ValueUnion.psz).raw(), 693 DeviceType_HardDisk, 694 AccessMode_ReadWrite, 695 hardDisk.asOutParam())); 696 } 688 break; 697 689 if (hardDisk) 698 690 { … … 785 777 else 786 778 { 787 /* first guess is that it's a UUID */788 779 ComPtr<IMedium> hardDisk; 789 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 790 DeviceType_HardDisk, 791 hardDisk.asOutParam()); 792 /* not successful? Then it must be a filename */ 780 rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk, 781 hardDisk, NULL); 793 782 if (FAILED(rc)) 794 { 795 /* open the new hard disk object */ 796 CHECK_ERROR(a->virtualBox, 797 OpenMedium(Bstr(ValueUnion.psz).raw(), 798 DeviceType_HardDisk, 799 AccessMode_ReadWrite, 800 hardDisk.asOutParam())); 801 } 783 break; 802 784 if (hardDisk) 803 785 { … … 923 905 else 924 906 { 925 /* first assume it's a UUID */ 926 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 927 DeviceType_DVD, 928 dvdMedium.asOutParam()); 929 if (FAILED(rc) || !dvdMedium) 930 { 931 /* not registered, do that on the fly */ 932 Bstr emptyUUID; 933 CHECK_ERROR(a->virtualBox, 934 OpenMedium(Bstr(ValueUnion.psz).raw(), 935 DeviceType_DVD, 936 AccessMode_ReadWrite, 937 dvdMedium.asOutParam())); 938 } 907 rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_DVD, 908 dvdMedium, NULL); 909 if (FAILED(rc)) 910 break; 939 911 if (!dvdMedium) 940 912 { … … 996 968 else 997 969 { 998 /* first assume it's a UUID */ 999 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 1000 DeviceType_Floppy, 1001 floppyMedium.asOutParam()); 1002 if (FAILED(rc) || !floppyMedium) 1003 { 1004 /* not registered, do that on the fly */ 1005 Bstr emptyUUID; 1006 CHECK_ERROR(a->virtualBox, 1007 OpenMedium(Bstr(ValueUnion.psz).raw(), 1008 DeviceType_Floppy, 1009 AccessMode_ReadWrite, 1010 floppyMedium.asOutParam())); 1011 } 970 rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_Floppy, 971 floppyMedium, NULL); 972 if (FAILED(rc)) 973 break; 1012 974 if (!floppyMedium) 1013 975 {
Note:
See TracChangeset
for help on using the changeset viewer.