Changeset 23559 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 5, 2009 12:27:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r23391 r23559 446 446 * Floppy. 447 447 */ 448 ComPtr<IStorageController> FloppyCtl; 449 bool fFloppyEnabled = false; 450 451 rc = machine->GetStorageControllerByName(Bstr("Floppy Controller"), FloppyCtl.asOutParam()); 452 if (SUCCEEDED(rc)) 453 fFloppyEnabled = true; 454 455 if (details == VMINFO_MACHINEREADABLE) 456 RTPrintf("floppy=\"%s\"\n", fFloppyEnabled ? "on" : "off"); 457 else 458 RTPrintf("Floppy: %s\n", fFloppyEnabled ? "enabled" : "disabled"); 459 460 /* 461 * Floppy drives and media 462 */ 463 if (fFloppyEnabled) 464 { 465 ComPtr<IMedium> floppyMedium; 466 Bstr filePath; 467 ULONG cFloppyPorts; 468 469 FloppyCtl->COMGETTER(PortCount)(&cFloppyPorts); 470 for (ULONG i = 0; i < cFloppyPorts; ++ i) 471 { 472 rc = machine->GetMedium(Bstr("Floppy Controller"), 0, i, floppyMedium.asOutParam()); 473 if (SUCCEEDED(rc) && floppyMedium) 474 { 475 floppyMedium->COMGETTER(Location)(filePath.asOutParam()); 476 floppyMedium->COMGETTER(Id)(uuid.asOutParam()); 477 if (details == VMINFO_MACHINEREADABLE) 478 { 479 RTPrintf("floppy%d=\"%lS\"\n", i, filePath.raw()); 480 RTPrintf("FloppyImageUUID%d=\"%s\"\n", i, Utf8Str(uuid).raw()); 481 } 482 else 483 RTPrintf("Floppy %d: %lS (UUID: %s)\n", i, filePath.raw(), Utf8Str(uuid).raw()); 484 } 485 else 486 { 487 if (details == VMINFO_MACHINEREADABLE) 488 RTPrintf("floppy%d=\"none\"\n",i); 489 } 490 } 491 } 492 493 /* 494 * SATA. 495 * 496 * Contributed by: James Lucas 497 */ 498 #ifdef VBOX_WITH_AHCI 499 ComPtr<IStorageController> SataCtl; 500 bool fSataEnabled = false; 501 502 rc = machine->GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()); 503 if (SUCCEEDED(rc)) 504 fSataEnabled = true; 505 506 if (details == VMINFO_MACHINEREADABLE) 507 RTPrintf("sata=\"%s\"\n", fSataEnabled ? "on" : "off"); 508 else 509 RTPrintf("SATA: %s\n", fSataEnabled ? "enabled" : "disabled"); 510 511 /* 512 * SATA Hard disks 513 */ 514 if (fSataEnabled) 515 { 516 ComPtr<IMedium> hardDisk; 517 Bstr filePath; 518 ULONG cSataPorts; 519 520 SataCtl->COMGETTER(PortCount)(&cSataPorts); 521 for (ULONG i = 0; i < cSataPorts; ++ i) 522 { 523 rc = machine->GetMedium(Bstr("SATA"), i, 0, hardDisk.asOutParam()); 524 if (SUCCEEDED(rc) && hardDisk) 525 { 526 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 527 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 528 if (details == VMINFO_MACHINEREADABLE) 529 { 530 RTPrintf("sataport%d=\"%lS\"\n", i, filePath.raw()); 531 RTPrintf("SataPortImageUUID%d=\"%s\"\n", i, Utf8Str(uuid).raw()); 532 } 533 else 534 RTPrintf("SATA %d: %lS (UUID: %s)\n", i, filePath.raw(), Utf8Str(uuid).raw()); 535 } 536 else 537 { 538 if (details == VMINFO_MACHINEREADABLE) 539 RTPrintf("sata%d=\"none\"\n",i); 540 } 541 } 542 } 543 #endif 544 545 /* 546 * IDE Hard disks 547 */ 548 ComPtr<IStorageController> ideController; 549 550 rc = machine->GetStorageControllerByName(Bstr("IDE Controller"), ideController.asOutParam()); 551 if (SUCCEEDED(rc) && ideController) 552 { 553 StorageControllerType_T enmIdeController; 554 const char *pszIdeController = NULL; 555 556 rc = ideController->COMGETTER(ControllerType)(&enmIdeController); 557 558 switch (enmIdeController) 559 { 448 com::SafeIfaceArray<IStorageController> storageCtls; 449 CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam (storageCtls))); 450 for (size_t i = 0; i < storageCtls.size(); ++ i) 451 { 452 ComPtr<IStorageController> storageCtl = storageCtls[i]; 453 StorageControllerType_T enmCtlType = StorageControllerType_Null; 454 const char *pszCtl = NULL; 455 Bstr storageCtlName; 456 457 storageCtl->COMGETTER(Name)(storageCtlName.asOutParam()); 458 459 if (details == VMINFO_MACHINEREADABLE) 460 RTPrintf("storagecontroller%u:\"%lS\"\n", i, storageCtlName.raw()); 461 else 462 RTPrintf("Storage Controller (%u): %lS\n", i, storageCtlName.raw()); 463 464 storageCtl->COMGETTER(ControllerType)(&enmCtlType); 465 466 switch (enmCtlType) 467 { 468 case StorageControllerType_LsiLogic: 469 pszCtl = "LsiLogic"; 470 break; 471 case StorageControllerType_BusLogic: 472 pszCtl = "BusLogic"; 473 break; 474 case StorageControllerType_IntelAhci: 475 pszCtl = "IntelAhci"; 476 break; 560 477 case StorageControllerType_PIIX3: 561 psz IdeController= "PIIX3";478 pszCtl = "PIIX3"; 562 479 break; 563 480 case StorageControllerType_PIIX4: 564 psz IdeController= "PIIX4";481 pszCtl = "PIIX4"; 565 482 break; 566 483 case StorageControllerType_ICH6: 567 psz IdeController= "ICH6";484 pszCtl = "ICH6"; 568 485 break; 486 case StorageControllerType_I82078: 487 pszCtl = "I82078"; 488 break; 489 569 490 default: 570 psz IdeController= "unknown";491 pszCtl = "unknown"; 571 492 } 572 493 if (details == VMINFO_MACHINEREADABLE) 573 RTPrintf(" idecontroller=\"%s\"\n", pszIdeController);494 RTPrintf("storagecontrollertype%u:=\"%s\"\n", i, pszCtl); 574 495 else 575 RTPrintf("IDE Controller: %s\n", pszIdeController); 576 } 577 578 ComPtr<IMedium> hardDisk; 579 Bstr filePath; 580 rc = machine->GetMedium(Bstr("IDE Controller"), 0, 0, hardDisk.asOutParam()); 581 if (SUCCEEDED(rc) && hardDisk) 582 { 583 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 584 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 585 if (details == VMINFO_MACHINEREADABLE) 586 { 587 RTPrintf("hda=\"%lS\"\n", filePath.raw()); 588 RTPrintf("HdaImageUUID=\"%s\"\n", Utf8Str(uuid).raw()); 589 } 590 else 591 RTPrintf("Primary master: %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw()); 592 } 593 else 594 { 595 if (details == VMINFO_MACHINEREADABLE) 596 RTPrintf("hda=\"none\"\n"); 597 } 598 rc = machine->GetMedium(Bstr("IDE Controller"), 0, 1, hardDisk.asOutParam()); 599 if (SUCCEEDED(rc) && hardDisk) 600 { 601 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 602 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 603 if (details == VMINFO_MACHINEREADABLE) 604 { 605 RTPrintf("hdb=\"%lS\"\n", filePath.raw()); 606 RTPrintf("HdbImageUUID=\"%s\"\n", Utf8Str(uuid).raw()); 607 } 608 else 609 RTPrintf("Primary slave: %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw()); 610 } 611 else 612 { 613 if (details == VMINFO_MACHINEREADABLE) 614 RTPrintf("hdb=\"none\"\n"); 615 } 616 rc = machine->GetMedium(Bstr("IDE Controller"), 1, 1, hardDisk.asOutParam()); 617 if (SUCCEEDED(rc) && hardDisk) 618 { 619 hardDisk->COMGETTER(Location)(filePath.asOutParam()); 620 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 621 if (details == VMINFO_MACHINEREADABLE) 622 { 623 RTPrintf("hdd=\"%lS\"\n", filePath.raw()); 624 RTPrintf("HddImageUUID=\"%s\"\n", Utf8Str(uuid).raw()); 625 } 626 else 627 RTPrintf("Secondary slave: %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw()); 628 } 629 else 630 { 631 if (details == VMINFO_MACHINEREADABLE) 632 RTPrintf("hdd=\"none\"\n"); 633 } 634 ComPtr<IMedium> dvdMedium; 635 rc = machine->GetMedium(Bstr("IDE Controller"), 1, 0, dvdMedium.asOutParam()); 636 if (SUCCEEDED(rc) && dvdMedium) 637 { 638 dvdMedium->COMGETTER(Location)(filePath.asOutParam()); 639 dvdMedium->COMGETTER(Id)(uuid.asOutParam()); 640 if (details == VMINFO_MACHINEREADABLE) 641 { 642 RTPrintf("dvd=\"%lS\"\n", filePath.raw()); 643 RTPrintf("DvdImageUUID=\"%s\"\n", Utf8Str(uuid).raw()); 644 } 645 else 646 RTPrintf("DVD: %lS (UUID: %s)\n", filePath.raw(), Utf8Str(uuid).raw()); 647 648 BOOL fPassthrough; 649 ComPtr<IMediumAttachment> dvdAttachment; 650 machine->GetMediumAttachment(Bstr("IDE Controller"), 1, 0, dvdAttachment.asOutParam()); 651 dvdAttachment->COMGETTER(Passthrough)(&fPassthrough); 652 if (details == VMINFO_MACHINEREADABLE) 653 { 654 RTPrintf("dvdpassthrough=\"%s\"\n", fPassthrough ? "on" : "off"); 655 } 656 else 657 { 658 if (fPassthrough) 659 RTPrintf(" (passthrough enabled)"); 660 RTPrintf("\n"); 661 } 662 } 663 else 664 { 665 if (details == VMINFO_MACHINEREADABLE) 666 RTPrintf("dvd=\"none\"\n"); 667 else 668 RTPrintf("DVD: empty\n"); 496 RTPrintf("Storage Controller Type (%u): %s\n", i, pszCtl); 497 } 498 499 for (size_t j = 0; j < storageCtls.size(); ++ j) 500 { 501 ComPtr<IStorageController> storageCtl = storageCtls[j]; 502 ComPtr<IMedium> medium; 503 Bstr storageCtlName; 504 Bstr filePath; 505 ULONG cDevices; 506 ULONG cPorts; 507 508 storageCtl->COMGETTER(Name)(storageCtlName.asOutParam()); 509 storageCtl->COMGETTER(MaxDevicesPerPortCount)(&cDevices); 510 storageCtl->COMGETTER(PortCount)(&cPorts); 511 512 for (ULONG i = 0; i < cPorts; ++ i) 513 { 514 for (ULONG k = 0; k < cDevices; ++ k) 515 { 516 rc = machine->GetMedium(storageCtlName, i, k, medium.asOutParam()); 517 if (SUCCEEDED(rc) && medium) 518 { 519 BOOL fPassthrough; 520 ComPtr<IMediumAttachment> mediumAttach; 521 522 rc = machine->GetMediumAttachment(storageCtlName, i, k, mediumAttach.asOutParam()); 523 if (SUCCEEDED(rc) && mediumAttach) 524 mediumAttach->COMGETTER(Passthrough)(&fPassthrough); 525 526 medium->COMGETTER(Location)(filePath.asOutParam()); 527 medium->COMGETTER(Id)(uuid.asOutParam()); 528 529 if (details == VMINFO_MACHINEREADABLE) 530 { 531 RTPrintf("\"%lS\"-%d-%d=\"%lS\"\n", storageCtlName.raw(), 532 i, k, filePath.raw()); 533 RTPrintf("\"%lS\"-ImageUUID-%d-%d=\"%s\"\n", 534 storageCtlName.raw(), i, k, Utf8Str(uuid).raw()); 535 if (fPassthrough) 536 RTPrintf("\"%lS\"-dvdpassthrough=\"%s\"\n", storageCtlName.raw(), 537 fPassthrough ? "on" : "off"); 538 } 539 else 540 { 541 RTPrintf("%lS (%d, %d): %lS (UUID: %s)", 542 storageCtlName.raw(), i, k, filePath.raw(), 543 Utf8Str(uuid).raw()); 544 if (fPassthrough) 545 RTPrintf(" (passthrough enabled)"); 546 RTPrintf("\n"); 547 } 548 } 549 else 550 { 551 if (details == VMINFO_MACHINEREADABLE) 552 RTPrintf("\"%lS\"-%d-%d=\"none\"\n", storageCtlName.raw(), i, k); 553 } 554 } 555 } 669 556 } 670 557
Note:
See TracChangeset
for help on using the changeset viewer.