Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 17192)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 17193)
@@ -671,9 +671,8 @@
                 ComPtr<IHost> host;
                 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
-                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
-                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
-
+                ComPtr<IHostDVDDriveCollection> hostDVDs;
+                CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
                 ComPtr<IHostDVDDrive> hostDVDDrive;
-                rc = host->FindHostDVDDrive(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());
+                rc = hostDVDs->FindByName(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 17192)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp	(revision 17193)
@@ -224,6 +224,6 @@
             {
                 /*
-                 * Iterate through the collection.
-                 */
+                * Iterate through the collection.
+                */
                 for (size_t i = 0; i < coll.size(); ++ i)
                 {
@@ -245,11 +245,15 @@
             ComPtr<IHost> host;
             CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.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];
+            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()));
                     Bstr name;
                     dvdDrive->COMGETTER(Name)(name.asOutParam());
@@ -775,3 +779,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 17192)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 17193)
@@ -25,5 +25,4 @@
 #ifndef VBOX_ONLY_DOCS
 #include <VBox/com/com.h>
-#include <VBox/com/array.h>
 #include <VBox/com/ErrorInfo.h>
 #include <VBox/com/errorprint2.h>
@@ -1092,9 +1091,8 @@
                 ComPtr<IHost> host;
                 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
-                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
-                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
-
+                ComPtr<IHostDVDDriveCollection> hostDVDs;
+                CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
                 ComPtr<IHostDVDDrive> hostDVDDrive;
-                rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
+                rc = hostDVDs->FindByName(Bstr(dvd + 5), hostDVDDrive.asOutParam());
                 if (!hostDVDDrive)
                 {
@@ -1107,5 +1105,5 @@
                         break;
                     }
-                    rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
+                    rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam());
                     if (!hostDVDDrive)
                     {
Index: /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 17192)
+++ /trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 17193)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2007 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()));
-            SafeIfaceArray <IHostDVDDrive> coll;
-            CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
+            ComPtr <IHostDVDDriveCollection> coll;
+            CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(coll.asOutParam()));
             ComPtr <IHostDVDDrive> hostDrive;
-            rc = host->FindHostDVDDrive (medium, hostDrive.asOutParam());
+            rc = coll->FindByName (medium, hostDrive.asOutParam());
             if (SUCCEEDED (rc))
             {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 17192)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 17193)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -3133,9 +3133,9 @@
 
     hostDVDMap.clear();
-    CHostDVDDriveVector drvvec =
-        vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-    for (int i = 0; i < drvvec.size(); ++i)
-    {
-        CHostDVDDrive hostDVD = drvvec[i];
+    CHostDVDDriveEnumerator en =
+        vboxGlobal().virtualBox().GetHost().GetDVDDrives().Enumerate();
+    while (en.HasMore())
+    {
+        CHostDVDDrive hostDVD = en.GetNext();
         /** @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 17192)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp	(revision 17193)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -176,11 +176,12 @@
     {
         /* Search for the host dvd-drives */
-        CHostDVDDriveVector coll =
+        CHostDVDDriveCollection coll =
             vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-        mHostDVDs.resize (coll.size());
-
-        for (int id = 0; id < coll.size(); ++id)
-        {
-            CHostDVDDrive hostDVD = coll[id];
+        mHostDVDs.resize (coll.GetCount());
+        int id = 0;
+        CHostDVDDriveEnumerator en = coll.Enumerate();
+        while (en.HasMore())
+        {
+            CHostDVDDrive hostDVD = en.GetNext();
             QString name = hostDVD.GetName();
             QString description = hostDVD.GetDescription();
@@ -189,4 +190,5 @@
             mCbHost->insertItem (id, fullName);
             mHostDVDs [id] = hostDVD;
+            ++ id;
         }
 
@@ -220,5 +222,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 17192)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp	(revision 17193)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -59,12 +59,13 @@
 
     /* Read out the host DVD drive list and prepare the combobox */
-    CHostDVDDriveVector coll =
+    CHostDVDDriveCollection coll =
         vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-    mHostCDs.resize (coll.size());
+    mHostCDs.resize (coll.GetCount());
     mCbHostCD->clear();
-
-    for (int id = 0; id < coll.size(); ++id)
-    {
-        CHostDVDDrive hostDVD = coll[id];
+    int id = 0;
+    CHostDVDDriveEnumerator en = coll.Enumerate();
+    while (en.HasMore())
+    {
+        CHostDVDDrive hostDVD = en.GetNext();
         /// @todo (r=dmik) set icon?
         QString name = hostDVD.GetName();
@@ -74,4 +75,5 @@
         mCbHostCD->insertItem (id, fullName);
         mHostCDs [id] = hostDVD;
+        ++ id;
     }
 
@@ -87,5 +89,5 @@
                 name :
                 QString ("%1 (%2)").arg (description, name);
-            if (vboxGlobal().virtualBox().GetHost().FindHostDVDDrive (name).isNull())
+            if (coll.FindByName (name).isNull())
             {
                 /* If the DVD drive is not currently available,
Index: /trunk/src/VBox/Main/DVDDriveImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 17192)
+++ /trunk/src/VBox/Main/DVDDriveImpl.cpp	(revision 17193)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -452,14 +452,13 @@
         Bstr src = typeNode.stringValue ("src");
 
-        /* find the corresponding object */
+        /* find the correspoding object */
         ComObjPtr <Host> host = mParent->virtualBox()->host();
 
-        com::SafeIfaceArray <IHostDVDDrive> coll;
-        rc = host->COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(coll));
+        ComPtr <IHostDVDDriveCollection> coll;
+        rc = host->COMGETTER(DVDDrives) (coll.asOutParam());
         AssertComRC (rc);
 
         ComPtr <IHostDVDDrive> drive;
-        rc = host->FindHostDVDDrive (src, drive.asOutParam());
-
+        rc = coll->FindByName (src, drive.asOutParam());
         if (SUCCEEDED (rc))
         {
Index: /trunk/src/VBox/Main/HostImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostImpl.cpp	(revision 17192)
+++ /trunk/src/VBox/Main/HostImpl.cpp	(revision 17193)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2007 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) (ComSafeArrayOut (IHostDVDDrive *, aDrives))
-{
-    CheckComArgOutSafeArrayPointerValid(aDrives);
+STDMETHODIMP Host::COMGETTER(DVDDrives) (IHostDVDDriveCollection **aDrives)
+{
+    CheckComArgOutPointerValid(aDrives);
     AutoWriteLock alock (this);
     CHECK_READY();
@@ -399,6 +399,8 @@
 #endif
 
-    SafeIfaceArray <IHostDVDDrive> array (list);
-    array.detachTo(ComSafeArrayOutArg(aDrives));
+    ComObjPtr<HostDVDDriveCollection> collection;
+    collection.createObject();
+    collection->init (list);
+    collection.queryInterfaceTo(aDrives);
     return rc;
 }
@@ -3321,31 +3323,4 @@
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
-STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IHostDVDDrive **aDrive)
-{
-    CheckComArgNotNull(aName);
-    CheckComArgOutPointerValid(aDrive);
-    AutoReadLock alock (this);
-
-    *aDrive = NULL;
-
-    for (DriveInfoList::const_iterator it = mHostDrives.DVDBegin();
-            it != mHostDrives.DVDEnd(); ++it)
-    {
-        Bstr device (it->mDevice.c_str());
-        if (device == aName)
-        {
-            ComObjPtr<HostDVDDrive> found;
-            HRESULT rc = found.createObject();
-            CheckComRCReturnRC (rc);
-            rc = found->init (device, Bstr (it->mUdi.c_str()), Bstr (it->mDescription.c_str()));
-            CheckComRCReturnRC (rc);
-            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 17192)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 17193)
@@ -6341,4 +6341,32 @@
   </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"
@@ -6515,5 +6543,5 @@
   <interface
      name="IHost" extends="$unknown"
-     uuid="ba0cb246-478a-4a2b-930e-51ce740ada9c"
+     uuid="7c172c42-b209-4bdc-9ddf-a84f222bd59a"
      wsmap="managed"
      >
@@ -6530,5 +6558,5 @@
 
     </desc>
-    <attribute name="DVDDrives" type="IHostDVDDrive" readonly="yes" safearray="yes">
+    <attribute name="DVDDrives" type="IHostDVDDriveCollection" readonly="yes">
       <desc>List of DVD drives available on the host.</desc>
     </attribute>
@@ -6805,27 +6833,10 @@
     </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 @c name.
-        <note>
-          The method returns an error if the given @c name does not
+        the given name.
+        <note>
+          The method returns an error if the given 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 17192)
+++ /trunk/src/VBox/Main/include/HostDVDDriveImpl.h	(revision 17193)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -24,4 +24,5 @@
 
 #include "VirtualBoxBase.h"
+#include "Collection.h"
 
 class ATL_NO_VTABLE HostDVDDrive :
@@ -82,4 +83,34 @@
 };
 
+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 17192)
+++ /trunk/src/VBox/Main/include/HostImpl.h	(revision 17193)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -81,5 +81,5 @@
 
     // IHost properties
-    STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives));
+    STDMETHOD(COMGETTER(DVDDrives))(IHostDVDDriveCollection **drives);
     STDMETHOD(COMGETTER(FloppyDrives))(IHostFloppyDriveCollection **drives);
     STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
@@ -111,5 +111,4 @@
     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 17192)
+++ /trunk/src/VBox/Main/webservice/webtest.cpp	(revision 17193)
@@ -4,5 +4,5 @@
  *      functionality of VBoxManage for testing purposes.
  *
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -233,10 +233,10 @@
         {
             unsigned int i,
-                         c = resp.returnval.size();
+                         c = resp.returnval->array.size();
             for(i = 0;
                 i < c;
                 ++i)
             {
-                std::cout << "DVD drive " << i << ": objref " << resp.returnval[i] << "\n";
+                std::cout << "DVD drive " << i << ": objref " << resp.returnval->array[i] << "\n";
             }
         }
Index: /trunk/src/VBox/Main/xpcom/server.cpp
===================================================================
--- /trunk/src/VBox/Main/xpcom/server.cpp	(revision 17192)
+++ /trunk/src/VBox/Main/xpcom/server.cpp	(revision 17193)
@@ -243,4 +243,5 @@
 
 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
