Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 17238)
@@ -671,8 +671,9 @@
                 ComPtr<IHost> host;
                 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
-                ComPtr<IHostDVDDriveCollection> hostDVDs;
-                CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
+                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
+                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
+
                 ComPtr<IHostDVDDrive> hostDVDDrive;
-                rc = hostDVDs->FindByName(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());
+                rc = host->FindHostDVDDrive(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());
                 if (!hostDVDDrive)
                 {
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp	(revision 17238)
@@ -224,6 +224,6 @@
             {
                 /*
-                * Iterate through the collection.
-                */
+                 * Iterate through the collection.
+                 */
                 for (size_t i = 0; i < coll.size(); ++ i)
                 {
@@ -245,15 +245,11 @@
             ComPtr<IHost> host;
             CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
-            ComPtr<IHostDVDDriveCollection> coll;
-            ComPtr<IHostDVDDriveEnumerator> enumerator;
-            CHECK_ERROR(host, COMGETTER(DVDDrives)(coll.asOutParam()));
-            if (SUCCEEDED(rc) && coll)
-            {
-                CHECK_ERROR(coll, Enumerate(enumerator.asOutParam()));
-                BOOL hasMore;
-                while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore)
-                {
-                    ComPtr<IHostDVDDrive> dvdDrive;
-                    CHECK_ERROR_BREAK(enumerator, GetNext(dvdDrive.asOutParam()));
+            com::SafeIfaceArray <IHostDVDDrive> coll;
+            CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
+            if (SUCCEEDED(rc))
+            {
+                for (size_t i = 0; i < coll.size(); ++ i)
+                {
+                    ComPtr<IHostDVDDrive> dvdDrive = coll[i];
                     Bstr name;
                     dvdDrive->COMGETTER(Name)(name.asOutParam());
@@ -779,3 +775,3 @@
 
 #endif /* !VBOX_ONLY_DOCS */
-
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 17238)
@@ -25,4 +25,5 @@
 #ifndef VBOX_ONLY_DOCS
 #include <VBox/com/com.h>
+#include <VBox/com/array.h>
 #include <VBox/com/ErrorInfo.h>
 #include <VBox/com/errorprint2.h>
@@ -1091,8 +1092,9 @@
                 ComPtr<IHost> host;
                 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
-                ComPtr<IHostDVDDriveCollection> hostDVDs;
-                CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
+                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
+                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
+
                 ComPtr<IHostDVDDrive> hostDVDDrive;
-                rc = hostDVDs->FindByName(Bstr(dvd + 5), hostDVDDrive.asOutParam());
+                rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
                 if (!hostDVDDrive)
                 {
@@ -1105,5 +1107,5 @@
                         break;
                     }
-                    rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam());
+                    rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
                     if (!hostDVDDrive)
                     {
Index: /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 17238)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -1772,8 +1772,8 @@
             ComPtr <IHost> host;
             CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));
-            ComPtr <IHostDVDDriveCollection> coll;
-            CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(coll.asOutParam()));
+            SafeIfaceArray <IHostDVDDrive> coll;
+            CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
             ComPtr <IHostDVDDrive> hostDrive;
-            rc = coll->FindByName (medium, hostDrive.asOutParam());
+            rc = host->FindHostDVDDrive (medium, hostDrive.asOutParam());
             if (SUCCEEDED (rc))
             {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 17238)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -3064,9 +3064,9 @@
 
     hostDVDMap.clear();
-    CHostDVDDriveEnumerator en =
-        vboxGlobal().virtualBox().GetHost().GetDVDDrives().Enumerate();
-    while (en.HasMore())
-    {
-        CHostDVDDrive hostDVD = en.GetNext();
+    CHostDVDDriveVector drvvec =
+        vboxGlobal().virtualBox().GetHost().GetDVDDrives();
+    for (int i = 0; i < drvvec.size(); ++i)
+    {
+        CHostDVDDrive hostDVD = drvvec[i];
         /** @todo set icon */
         QString drvName = hostDVD.GetName();
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp	(revision 17238)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -176,12 +176,11 @@
     {
         /* Search for the host dvd-drives */
-        CHostDVDDriveCollection coll =
+        CHostDVDDriveVector coll =
             vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-        mHostDVDs.resize (coll.GetCount());
-        int id = 0;
-        CHostDVDDriveEnumerator en = coll.Enumerate();
-        while (en.HasMore())
-        {
-            CHostDVDDrive hostDVD = en.GetNext();
+        mHostDVDs.resize (coll.size());
+
+        for (int id = 0; id < coll.size(); ++id)
+        {
+            CHostDVDDrive hostDVD = coll[id];
             QString name = hostDVD.GetName();
             QString description = hostDVD.GetDescription();
@@ -190,5 +189,4 @@
             mCbHost->insertItem (id, fullName);
             mHostDVDs [id] = hostDVD;
-            ++ id;
         }
 
@@ -222,5 +220,5 @@
 
     /* Repopulate the media list */
-        mCbImage->repopulate();
+    mCbImage->repopulate();
 
     /* Revalidate updated page */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp	(revision 17237)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp	(revision 17238)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -59,13 +59,12 @@
 
     /* Read out the host DVD drive list and prepare the combobox */
-    CHostDVDDriveCollection coll =
+    CHostDVDDriveVector coll =
         vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-    mHostCDs.resize (coll.GetCount());
+    mHostCDs.resize (coll.size());
     mCbHostCD->clear();
-    int id = 0;
-    CHostDVDDriveEnumerator en = coll.Enumerate();
-    while (en.HasMore())
-    {
-        CHostDVDDrive hostDVD = en.GetNext();
+
+    for (int id = 0; id < coll.size(); ++id)
+    {
+        CHostDVDDrive hostDVD = coll[id];
         /// @todo (r=dmik) set icon?
         QString name = hostDVD.GetName();
@@ -75,5 +74,4 @@
         mCbHostCD->insertItem (id, fullName);
         mHostCDs [id] = hostDVD;
-        ++ id;
     }
 
@@ -89,5 +87,5 @@
                 name :
                 QString ("%1 (%2)").arg (description, name);
-            if (coll.FindByName (name).isNull())
+            if (vboxGlobal().virtualBox().GetHost().FindHostDVDDrive (name).isNull())
             {
                 /* If the DVD drive is not currently available,
Index: /trunk/src/VBox/Main/DVDDriveImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 17237)
+++ /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 17238)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -452,13 +452,14 @@
         Bstr src = typeNode.stringValue ("src");
 
-        /* find the correspoding object */
+        /* find the corresponding object */
         ComObjPtr <Host> host = mParent->virtualBox()->host();
 
-        ComPtr <IHostDVDDriveCollection> coll;
-        rc = host->COMGETTER(DVDDrives) (coll.asOutParam());
+        com::SafeIfaceArray <IHostDVDDrive> coll;
+        rc = host->COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(coll));
         AssertComRC (rc);
 
         ComPtr <IHostDVDDrive> drive;
-        rc = coll->FindByName (src, drive.asOutParam());
+        rc = host->FindHostDVDDrive (src, drive.asOutParam());
+
         if (SUCCEEDED (rc))
         {
Index: /trunk/src/VBox/Main/HostImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostImpl.cpp	(revision 17237)
+++ /trunk/src/VBox/Main/HostImpl.cpp	(revision 17238)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -291,7 +291,7 @@
  * @param drives address of result pointer
  */
-STDMETHODIMP Host::COMGETTER(DVDDrives) (IHostDVDDriveCollection **aDrives)
-{
-    CheckComArgOutPointerValid(aDrives);
+STDMETHODIMP Host::COMGETTER(DVDDrives) (ComSafeArrayOut (IHostDVDDrive *, aDrives))
+{
+    CheckComArgOutSafeArrayPointerValid(aDrives);
     AutoWriteLock alock (this);
     CHECK_READY();
@@ -399,8 +399,6 @@
 #endif
 
-    ComObjPtr<HostDVDDriveCollection> collection;
-    collection.createObject();
-    collection->init (list);
-    collection.queryInterfaceTo(aDrives);
+    SafeIfaceArray <IHostDVDDrive> array (list);
+    array.detachTo(ComSafeArrayOutArg(aDrives));
     return rc;
 }
@@ -3323,4 +3321,38 @@
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
+STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IHostDVDDrive **aDrive)
+{
+    CheckComArgNotNull(aName);
+    CheckComArgOutPointerValid(aDrive);
+
+    *aDrive = NULL;
+
+    SafeIfaceArray <IHostDVDDrive> drivevec;
+    HRESULT rc = COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(drivevec));
+    CheckComRCReturnRC (rc);
+
+    for (size_t i = 0; i < drivevec.size(); ++i)
+    {
+        Bstr name;
+        rc = drivevec[i]->COMGETTER(Name) (name.asOutParam());
+        CheckComRCReturnRC (rc);
+        if (name == aName)
+        {
+            ComObjPtr<HostDVDDrive> found;
+            found.createObject();
+            Bstr udi, description;
+            rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam());
+            CheckComRCReturnRC (rc);
+            rc = drivevec[i]->COMGETTER(Description) (description.asOutParam());
+            CheckComRCReturnRC (rc);
+            found->init(name, udi, description);
+            return found.queryInterfaceTo(aDrive);
+        }
+    }
+
+    return setError (VBOX_E_OBJECT_NOT_FOUND, HostDVDDrive::tr (
+        "The host DVD drive named '%ls' could not be found"), aName);
+}
+
 STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface)
 {
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 17237)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 17238)
@@ -6341,32 +6341,4 @@
   </interface>
 
-  <enumerator
-     name="IHostDVDDriveEnumerator" type="IHostDVDDrive"
-     uuid="1ed7cfaf-c363-40df-aa4e-89c1afb7d96b"
-     />
-
-  <collection
-     name="IHostDVDDriveCollection" type="IHostDVDDrive"
-     enumerator="IHostDVDDriveEnumerator"
-     uuid="1909c533-1a1e-445f-a4e1-a267cffc30ed"
-     readonly="yes"
-     >
-    <method name="findByName">
-      <desc>
-        Searches this collection for a host drive with the given name.
-        <note>
-          The method returns an error if the given name does not
-          correspond to any host drive in the collection.
-        </note>
-      </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Name of the host drive to search for</desc>
-      </param>
-      <param name="drive" type="IHostDVDDrive" dir="return">
-        <desc>Found host drive object</desc>
-      </param>
-    </method>
-  </collection>
-
   <interface
      name="IHostFloppyDrive" extends="$unknown"
@@ -6543,5 +6515,5 @@
   <interface
      name="IHost" extends="$unknown"
-     uuid="7c172c42-b209-4bdc-9ddf-a84f222bd59a"
+     uuid="ba0cb246-478a-4a2b-930e-51ce740ada9c"
      wsmap="managed"
      >
@@ -6558,5 +6530,5 @@
 
     </desc>
-    <attribute name="DVDDrives" type="IHostDVDDriveCollection" readonly="yes">
+    <attribute name="DVDDrives" type="IHostDVDDrive" readonly="yes" safearray="yes">
       <desc>List of DVD drives available on the host.</desc>
     </attribute>
@@ -6833,10 +6805,27 @@
     </method>
 
+    <method name="findHostDVDDrive">
+      <desc>
+        Searches for a host DVD drive with the given @c name.
+
+        <result name="VBOX_E_OBJECT_NOT_FOUND">
+          Given @c name does not correspond to any host drive.
+        </result>
+
+      </desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Name of the host drive to search for</desc>
+      </param>
+      <param name="drive" type="IHostDVDDrive" dir="return">
+        <desc>Found host drive object</desc>
+      </param>
+    </method>
+
     <method name="findHostNetworkInterfaceByName">
       <desc>
         Searches through all host network interfaces for an interface with
-        the given name.
-        <note>
-          The method returns an error if the given name does not
+        the given @c name.
+        <note>
+          The method returns an error if the given @c name does not
           correspond to any host network interface.
         </note>
Index: /trunk/src/VBox/Main/include/HostDVDDriveImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/HostDVDDriveImpl.h	(revision 17237)
+++ /trunk/src/VBox/Main/include/HostDVDDriveImpl.h	(revision 17238)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -24,5 +24,4 @@
 
 #include "VirtualBoxBase.h"
-#include "Collection.h"
 
 class ATL_NO_VTABLE HostDVDDrive :
@@ -83,34 +82,4 @@
 };
 
-COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostDVDDrive)
-
-    STDMETHOD(FindByName) (IN_BSTR aName, IHostDVDDrive **aDrive)
-    {
-        if (!aName)
-            return E_INVALIDARG;
-        if (!aDrive)
-            return E_POINTER;
-
-        *aDrive = NULL;
-        Vector::value_type found;
-        Vector::iterator it = vec.begin();
-        while (it != vec.end() && !found)
-        {
-            Bstr n;
-            (*it)->COMGETTER(Name) (n.asOutParam());
-            if (n == aName)
-                found = *it;
-            ++ it;
-        }
-
-        if (!found)
-            return setError (E_INVALIDARG, HostDVDDriveCollection::tr (
-                "The host DVD drive named '%ls' could not be found"), aName);
-
-        return found.queryInterfaceTo (aDrive);
-    }
-
-COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostDVDDrive)
-
 #endif // ____H_HOSTDVDDRIVEIMPL
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Index: /trunk/src/VBox/Main/include/HostImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/HostImpl.h	(revision 17237)
+++ /trunk/src/VBox/Main/include/HostImpl.h	(revision 17238)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -81,5 +81,5 @@
 
     // IHost properties
-    STDMETHOD(COMGETTER(DVDDrives))(IHostDVDDriveCollection **drives);
+    STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives));
     STDMETHOD(COMGETTER(FloppyDrives))(IHostFloppyDriveCollection **drives);
     STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
@@ -111,4 +111,5 @@
     STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter **aFilter);
 
+    STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive);
     STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
     STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface);
Index: /trunk/src/VBox/Main/webservice/webtest.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/webtest.cpp	(revision 17237)
+++ /trunk/src/VBox/Main/webservice/webtest.cpp	(revision 17238)
@@ -4,5 +4,5 @@
  *      functionality of VBoxManage for testing purposes.
  *
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -233,10 +233,10 @@
         {
             unsigned int i,
-                         c = resp.returnval->array.size();
+                         c = resp.returnval.size();
             for(i = 0;
                 i < c;
                 ++i)
             {
-                std::cout << "DVD drive " << i << ": objref " << resp.returnval->array[i] << "\n";
+                std::cout << "DVD drive " << i << ": objref " << resp.returnval[i] << "\n";
             }
         }
Index: /trunk/src/VBox/Main/xpcom/server.cpp
===================================================================
--- /trunk/src/VBox/Main/xpcom/server.cpp	(revision 17237)
+++ /trunk/src/VBox/Main/xpcom/server.cpp	(revision 17238)
@@ -243,5 +243,4 @@
 
 COM_IMPL_READONLY_ENUM_AND_COLLECTION(Snapshot)
-COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostDVDDrive)
 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostFloppyDrive)
 #ifdef VBOX_WITH_USB
