Changeset 23825 in vbox
- Timestamp:
- Oct 16, 2009 2:42:34 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53581
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r23801 r23825 871 871 char *fdaFile = NULL; 872 872 #ifdef VBOX_WITH_VRDP 873 c har *portVRDP = NULL;873 const char *portVRDP = NULL; 874 874 #endif 875 875 bool fDiscardState = false; … … 1519 1519 * Strategy: iterate through all registered hard disk 1520 1520 * and see if one of them points to the same file. If 1521 * so, assign it. If not, register a new image and assi ng1521 * so, assign it. If not, register a new image and assign 1522 1522 * it to the VM. 1523 1523 */ … … 1538 1538 */ 1539 1539 Bstr uuid; 1540 Bstr storageCtlName; 1540 1541 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 1541 gMachine->DetachDevice(Bstr("IDE Controller"), 0, 0); 1542 gMachine->AttachDevice(Bstr("IDE Controller"), 0, 0, DeviceType_HardDisk, uuid); 1542 1543 /* get the first IDE controller to attach the harddisk to 1544 * and if there is none, add one temporarily 1545 */ 1546 { 1547 ComPtr<IStorageController> storageCtl; 1548 com::SafeIfaceArray<IStorageController> aStorageControllers; 1549 CHECK_ERROR (gMachine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(aStorageControllers))); 1550 for (size_t i = 0; i < aStorageControllers.size(); ++ i) 1551 { 1552 StorageBus_T storageBus = StorageBus_Null; 1553 1554 CHECK_ERROR (aStorageControllers[i], COMGETTER(Bus)(&storageBus)); 1555 if (storageBus == StorageBus_IDE) 1556 { 1557 storageCtl = aStorageControllers[i]; 1558 break; 1559 } 1560 } 1561 1562 if (storageCtl) 1563 { 1564 CHECK_ERROR (storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1565 gMachine->DetachDevice(storageCtlName, 0, 0); 1566 } 1567 else 1568 { 1569 storageCtlName = "IDE Controller"; 1570 CHECK_ERROR (gMachine, AddStorageController(storageCtlName, 1571 StorageBus_IDE, 1572 storageCtl.asOutParam())); 1573 } 1574 } 1575 1576 gMachine->AttachDevice(storageCtlName, 0, 0, DeviceType_HardDisk, uuid); 1543 1577 /// @todo why is this attachment saved? 1544 1578 } … … 1584 1618 } 1585 1619 } 1620 1586 1621 Bstr id; 1622 Bstr storageCtlName; 1587 1623 floppyMedium->COMGETTER(Id)(id.asOutParam()); 1588 CHECK_ERROR(gMachine, MountMedium(Bstr("Floppy Controller"), 0, 0, id)); 1624 1625 /* get the first floppy controller to attach the floppy to 1626 * and if there is none, add one temporarily 1627 */ 1628 { 1629 ComPtr<IStorageController> storageCtl; 1630 com::SafeIfaceArray<IStorageController> aStorageControllers; 1631 CHECK_ERROR (gMachine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(aStorageControllers))); 1632 for (size_t i = 0; i < aStorageControllers.size(); ++ i) 1633 { 1634 StorageBus_T storageBus = StorageBus_Null; 1635 1636 CHECK_ERROR (aStorageControllers[i], COMGETTER(Bus)(&storageBus)); 1637 if (storageBus == StorageBus_Floppy) 1638 { 1639 storageCtl = aStorageControllers[i]; 1640 break; 1641 } 1642 } 1643 1644 if (storageCtl) 1645 { 1646 ComPtr<IMediumAttachment> floppyAttachment; 1647 1648 CHECK_ERROR (storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1649 rc = gMachine->GetMediumAttachment(storageCtlName, 0, 0, floppyAttachment.asOutParam()); 1650 if (FAILED(rc)) 1651 CHECK_ERROR (gMachine, AttachDevice(storageCtlName, 0, 0, 1652 DeviceType_Floppy, NULL)); 1653 } 1654 else 1655 { 1656 storageCtlName = "Floppy Controller"; 1657 CHECK_ERROR (gMachine, AddStorageController(storageCtlName, 1658 StorageBus_Floppy, 1659 storageCtl.asOutParam())); 1660 CHECK_ERROR (gMachine, AttachDevice(storageCtlName, 0, 0, 1661 DeviceType_Floppy, NULL)); 1662 } 1663 } 1664 1665 CHECK_ERROR (gMachine, MountMedium(storageCtlName, 0, 0, id)); 1589 1666 } 1590 1667 while (0); … … 1626 1703 } 1627 1704 } 1705 1628 1706 Bstr id; 1707 Bstr storageCtlName; 1629 1708 dvdMedium->COMGETTER(Id)(id.asOutParam()); 1630 CHECK_ERROR(gMachine, MountMedium(Bstr("IDE Controller"), 1, 0, id)); 1709 1710 /* get the first IDE controller to attach the DVD Drive to 1711 * and if there is none, add one temporarily 1712 */ 1713 { 1714 ComPtr<IStorageController> storageCtl; 1715 com::SafeIfaceArray<IStorageController> aStorageControllers; 1716 CHECK_ERROR (gMachine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(aStorageControllers))); 1717 for (size_t i = 0; i < aStorageControllers.size(); ++ i) 1718 { 1719 StorageBus_T storageBus = StorageBus_Null; 1720 1721 CHECK_ERROR (aStorageControllers[i], COMGETTER(Bus)(&storageBus)); 1722 if (storageBus == StorageBus_IDE) 1723 { 1724 storageCtl = aStorageControllers[i]; 1725 break; 1726 } 1727 } 1728 1729 if (storageCtl) 1730 { 1731 ComPtr<IMediumAttachment> dvdAttachment; 1732 1733 CHECK_ERROR (storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1734 gMachine->DetachDevice(storageCtlName, 1, 0); 1735 CHECK_ERROR (gMachine, AttachDevice(storageCtlName, 1, 0, 1736 DeviceType_DVD, NULL)); 1737 } 1738 else 1739 { 1740 storageCtlName = "IDE Controller"; 1741 CHECK_ERROR (gMachine, AddStorageController(storageCtlName, 1742 StorageBus_IDE, 1743 storageCtl.asOutParam())); 1744 CHECK_ERROR (gMachine, AttachDevice(storageCtlName, 1, 0, 1745 DeviceType_DVD, NULL)); 1746 } 1747 } 1748 1749 CHECK_ERROR(gMachine, MountMedium(storageCtlName, 1, 0, id)); 1631 1750 } 1632 1751 while (0);
Note:
See TracChangeset
for help on using the changeset viewer.