Changeset 29356 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 11, 2010 2:03:35 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 61462
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r28888 r29356 63 63 #endif 64 64 65 static void list HardDisks(const ComPtr<IVirtualBox> aVirtualBox,66 67 65 static void listMedia(const ComPtr<IVirtualBox> aVirtualBox, 66 const com::SafeIfaceArray<IMedium> &aMedia, 67 const char *pszParentUUIDStr) 68 68 { 69 69 HRESULT rc; 70 70 for (size_t i = 0; i < aMedia.size(); ++i) 71 71 { 72 ComPtr<IMedium> hdd= aMedia[i];72 ComPtr<IMedium> pMedium = aMedia[i]; 73 73 Bstr uuid; 74 hdd->COMGETTER(Id)(uuid.asOutParam());74 pMedium->COMGETTER(Id)(uuid.asOutParam()); 75 75 RTPrintf("UUID: %s\n", Utf8Str(uuid).raw()); 76 RTPrintf("Parent UUID: %s\n", pszParentUUIDStr); 76 if (pszParentUUIDStr) 77 RTPrintf("Parent UUID: %s\n", pszParentUUIDStr); 77 78 Bstr format; 78 hdd->COMGETTER(Format)(format.asOutParam());79 pMedium->COMGETTER(Format)(format.asOutParam()); 79 80 RTPrintf("Format: %lS\n", format.raw()); 80 81 Bstr filepath; 81 hdd->COMGETTER(Location)(filepath.asOutParam());82 pMedium->COMGETTER(Location)(filepath.asOutParam()); 82 83 RTPrintf("Location: %lS\n", filepath.raw()); 83 84 84 85 MediumState_T enmState; 85 hdd->RefreshState(&enmState);86 pMedium->RefreshState(&enmState); 86 87 const char *stateStr = "unknown"; 87 88 switch (enmState) … … 112 113 113 114 MediumType_T type; 114 hdd->COMGETTER(Type)(&type);115 pMedium->COMGETTER(Type)(&type); 115 116 const char *typeStr = "unknown"; 116 117 switch (type) … … 132 133 133 134 com::SafeArray<BSTR> machineIds; 134 hdd->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));135 pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds)); 135 136 for (size_t j = 0; j < machineIds.size(); ++j) 136 137 { … … 144 145 name.raw(), machineIds[j]); 145 146 com::SafeArray<BSTR> snapshotIds; 146 hdd->GetSnapshotIds(machineIds[j],147 ComSafeArrayAsOutParam(snapshotIds));147 pMedium->GetSnapshotIds(machineIds[j], 148 ComSafeArrayAsOutParam(snapshotIds)); 148 149 for (size_t k = 0; k < snapshotIds.size(); ++k) 149 150 { … … 162 163 163 164 com::SafeIfaceArray<IMedium> children; 164 CHECK_ERROR( hdd, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));165 CHECK_ERROR(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(children))); 165 166 if (children.size() > 0) 166 167 { 167 168 // depth first listing of child media 168 list HardDisks(aVirtualBox, children, Utf8Str(uuid).raw());169 listMedia(aVirtualBox, children, Utf8Str(uuid).raw()); 169 170 } 170 171 } … … 651 652 com::SafeIfaceArray<IMedium> hdds; 652 653 CHECK_ERROR(a->virtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds))); 653 list HardDisks(a->virtualBox, hdds, "base");654 listMedia(a->virtualBox, hdds, "base"); 654 655 } 655 656 break; … … 659 660 com::SafeIfaceArray<IMedium> dvds; 660 661 CHECK_ERROR(a->virtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds))); 661 for (size_t i = 0; i < dvds.size(); ++i) 662 { 663 ComPtr<IMedium> dvdImage = dvds[i]; 664 Bstr uuid; 665 dvdImage->COMGETTER(Id)(uuid.asOutParam()); 666 RTPrintf("UUID: %s\n", Utf8Str(uuid).raw()); 667 Bstr filePath; 668 dvdImage->COMGETTER(Location)(filePath.asOutParam()); 669 RTPrintf("Path: %lS\n", filePath.raw()); 670 MediumState_T enmState; 671 dvdImage->RefreshState(&enmState); 672 RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no"); 673 674 com::SafeArray<BSTR> machineIds; 675 dvdImage->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds)); 676 for (size_t j = 0; j < machineIds.size(); ++j) 677 { 678 ComPtr<IMachine> machine; 679 CHECK_ERROR(a->virtualBox, GetMachine(machineIds[j], machine.asOutParam())); 680 ASSERT(machine); 681 Bstr name; 682 machine->COMGETTER(Name)(name.asOutParam()); 683 machine->COMGETTER(Id)(uuid.asOutParam()); 684 RTPrintf("%s%lS (UUID: %lS)\n", 685 j == 0 ? "Usage: " : " ", 686 name.raw(), machineIds[j]); 687 } 688 RTPrintf("\n"); 689 } 662 listMedia(a->virtualBox, dvds, NULL); 690 663 } 691 664 break; … … 695 668 com::SafeIfaceArray<IMedium> floppies; 696 669 CHECK_ERROR(a->virtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies))); 697 for (size_t i = 0; i < floppies.size(); ++i) 698 { 699 ComPtr<IMedium> floppyImage = floppies[i]; 700 Bstr uuid; 701 floppyImage->COMGETTER(Id)(uuid.asOutParam()); 702 RTPrintf("UUID: %s\n", Utf8Str(uuid).raw()); 703 Bstr filePath; 704 floppyImage->COMGETTER(Location)(filePath.asOutParam()); 705 RTPrintf("Path: %lS\n", filePath.raw()); 706 MediumState_T enmState; 707 floppyImage->RefreshState(&enmState); 708 RTPrintf("Accessible: %s\n", enmState != MediumState_Inaccessible ? "yes" : "no"); 709 710 com::SafeArray<BSTR> machineIds; 711 floppyImage->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds)); 712 for (size_t j = 0; j < machineIds.size(); ++j) 713 { 714 ComPtr<IMachine> machine; 715 CHECK_ERROR(a->virtualBox, GetMachine(machineIds[j], machine.asOutParam())); 716 ASSERT(machine); 717 Bstr name; 718 machine->COMGETTER(Name)(name.asOutParam()); 719 machine->COMGETTER(Id)(uuid.asOutParam()); 720 RTPrintf("%s%lS (UUID: %lS)\n", 721 j == 0 ? "Usage: " : " ", 722 name.raw(), machineIds[j]); 723 } 724 RTPrintf("\n"); 725 } 670 listMedia(a->virtualBox, floppies, NULL); 726 671 } 727 672 break;
Note:
See TracChangeset
for help on using the changeset viewer.