Index: /trunk/src/VBox/Main/HostImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostImpl.cpp	(revision 31336)
+++ /trunk/src/VBox/Main/HostImpl.cpp	(revision 31337)
@@ -65,7 +65,6 @@
 # include <limits.h>
 # include <stdio.h>
-# ifdef VBOX_SOLARIS_NSL_RESOLVED
-#  include <libdevinfo.h>
-# endif
+# include <libdevinfo.h>
+# include <sys/scsi/generic/inquiry.h>
 # include <net/if.h>
 # include <sys/socket.h>
@@ -85,4 +84,17 @@
 # endif
 # include "solaris/DynLoadLibSolaris.h"
+
+/**
+ * Solaris DVD drive list as returned by getDVDInfoFromDevTree().
+ */
+typedef struct SOLARISDVD
+{
+    struct SOLARISDVD *pNext;
+    char szDescription[512];
+    char szRawDiskPath[PATH_MAX];
+} SOLARISDVD;
+/** Pointer to a Solaris DVD descriptor. */
+typedef SOLARISDVD *PSOLARISDVD;
+
 #endif /* RT_OS_SOLARIS */
 
@@ -1724,41 +1736,6 @@
         if (!getDVDInfoFromHal(list))
 # endif
-        // Not all Solaris versions ship with libhal.
-        // So use a fallback approach similar to Linux.
-        {
-            if (RTEnvExistEx(RTENV_DEFAULT, "VBOX_CDROM"))
-            {
-                char *cdromEnv = RTEnvDupEx(RTENV_DEFAULT, "VBOX_CDROM");
-                char *saveStr = NULL;
-                char *cdromDrive = NULL;
-                if (cdromEnv)
-                    cdromDrive = strtok_r(cdromEnv, ":", &saveStr);
-                while (cdromDrive)
-                {
-                    if (validateDevice(cdromDrive, true))
-                    {
-                        ComObjPtr<Medium> hostDVDDriveObj;
-                        hostDVDDriveObj.createObject();
-                        hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr(cdromDrive));
-                        list.push_back(hostDVDDriveObj);
-                    }
-                    cdromDrive = strtok_r(NULL, ":", &saveStr);
-                }
-                RTStrFree(cdromEnv);
-            }
-            else
-            {
-                // this might work on Solaris version older than Nevada.
-                if (validateDevice("/cdrom/cdrom0", true))
-                {
-                    ComObjPtr<Medium> hostDVDDriveObj;
-                    hostDVDDriveObj.createObject();
-                    hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr("cdrom/cdrom0"));
-                    list.push_back(hostDVDDriveObj);
-                }
-
-                // check the mounted drives
-                parseMountTable(MNTTAB, list);
-            }
+        {
+            getDVDInfoFromDevTree(list);
         }
 
@@ -1978,4 +1955,138 @@
 
 #if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
+
+/**
+ * Helper function to get the slice number from a device path
+ *
+ * @param   pszDevLinkPath      Pointer to a device path (/dev/(r)dsk/c7d1t0d0s3 etc.)
+ * @returns Pointer to the slice portion of the given path.
+ */
+static char *solarisGetSliceFromPath(const char *pszDevLinkPath)
+{
+    char *pszFound = NULL;
+    char *pszSlice = strrchr(pszDevLinkPath, 's');
+    char *pszDisk  = strrchr(pszDevLinkPath, 'd');
+    if (pszSlice && pszSlice > pszDisk)
+        pszFound = pszSlice;
+    else
+        pszFound = pszDisk;
+
+    if (pszFound && RT_C_IS_DIGIT(pszFound[1]))
+        return pszFound;
+
+    return NULL;
+}
+
+/**
+ * Walk device links and returns an allocated path for the first one in the snapshot.
+ *
+ * @param   DevLink     Handle to the device link being walked.
+ * @param   pvArg       Opaque data containing the pointer to the path.
+ * @returns Pointer to an allocated device path string.
+ */
+static int solarisWalkDevLink(di_devlink_t DevLink, void *pvArg)
+{
+    char **ppszPath = (char **)pvArg;
+    *ppszPath = strdup(di_devlink_path(DevLink));
+    return DI_WALK_TERMINATE;
+}
+
+/**
+ * Walk all devices in the system and enumerate CD/DVD drives.
+ * @param   Node        Handle to the current node.
+ * @param   pvArg       Opaque data (holds list pointer).
+ * @returns Solaris specific code whether to continue walking or not.
+ */
+static int solarisWalkDeviceNodeForDVD(di_node_t Node, void *pvArg)
+{
+    PSOLARISDVD *ppDrives = (PSOLARISDVD *)pvArg;
+
+    char *pszClass = NULL;
+    if (   di_prop_lookup_strings(DDI_DEV_T_ANY, Node, "class", &pszClass) > 0
+        && !strcmp(pszClass, "scsi"))                                                   /* SCSI */
+    {
+        int *pInt = NULL;
+        if (di_prop_lookup_ints(DDI_DEV_T_ANY, Node, "inquiry-device-type", &pInt) > 0
+            && (   *pInt == DTYPE_RODIRECT                                              /* CDROM */
+                || *pInt == DTYPE_OPTICAL))                                             /* Optical Drive */
+        {
+            char *pszProduct = NULL;
+            if (di_prop_lookup_strings(DDI_DEV_T_ANY, Node, "inquiry-product-id", &pszProduct) > 0)
+            {
+                char *pszVendor = NULL;
+                if (di_prop_lookup_strings(DDI_DEV_T_ANY, Node, "inquiry-vendor-id", &pszVendor) > 0)
+                {
+                    /*
+                     * Found a DVD drive, we need to scan the minor nodes to find the correct
+                     * slice that represents the whole drive. "s2" is always the whole drive for CD/DVDs.
+                     */
+                    di_minor_t Minor = DI_MINOR_NIL;
+                    di_devlink_handle_t DevLink = di_devlink_init(NULL /* name */, 0 /* flags */);
+                    if (DevLink)
+                    {
+                        while ((Minor = di_minor_next(Node, Minor)) != DI_MINOR_NIL)
+                        {
+                            char *pszMinorPath = di_devfs_minor_path(Minor);
+                            if (!pszMinorPath)
+                                continue;
+
+                            char *pszDevLinkPath = NULL;
+                            di_devlink_walk(DevLink, NULL, pszMinorPath, DI_PRIMARY_LINK, &pszDevLinkPath, solarisWalkDevLink);
+                            di_devfs_path_free(pszMinorPath);
+
+                            char *pszSlice = solarisGetSliceFromPath(pszDevLinkPath);
+                            if (   pszSlice && !strcmp(pszSlice, "s2")
+                                && !strncmp(pszDevLinkPath, "/dev/rdsk", sizeof("/dev/rdsk") - 1))   /* We want only raw disks */
+                            {
+                                /*
+                                 * We've got a fully qualified DVD drive. Add it to the list.
+                                 */
+                                PSOLARISDVD pDrive = (PSOLARISDVD)RTMemAllocZ(sizeof(SOLARISDVD));
+                                if (RT_LIKELY(pDrive))
+                                {
+                                    RTStrPrintf(pDrive->szDescription, sizeof(pDrive->szDescription), "%s %s", pszVendor, pszProduct);
+                                    RTStrCopy(pDrive->szRawDiskPath, sizeof(pDrive->szRawDiskPath), pszDevLinkPath);
+                                    if (!*ppDrives)
+                                        *ppDrives = pDrive;
+                                    else
+                                        (*ppDrives)->pNext = pDrive;
+                                }
+                            }
+                            free(pszDevLinkPath);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return DI_WALK_CONTINUE;
+}
+
+/**
+ * Solaris specific function to enumerate CD/DVD drives via the device tree.
+ * Works on Solaris 10 as well as OpenSolaris without depending on libhal.
+ */
+void Host::getDVDInfoFromDevTree(std::list<ComObjPtr<Medium> > &list)
+{
+    PSOLARISDVD pDrives = NULL;
+    di_node_t RootNode = di_init("/", DINFOCPYALL);
+    if (RootNode != DI_NODE_NIL)
+        di_walk_node(RootNode, DI_WALK_CLDFIRST, &pDrives, solarisWalkDeviceNodeForDVD);
+
+    di_fini(RootNode);
+
+    while (pDrives)
+    {
+        ComObjPtr<Medium> hostDVDDriveObj;
+        hostDVDDriveObj.createObject();
+        hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr(pDrives->szRawDiskPath), Bstr(pDrives->szDescription));
+        list.push_back(hostDVDDriveObj);
+
+        void *pvDrive = pDrives;
+        pDrives = pDrives->pNext;
+        RTMemFree(pvDrive);
+    }
+}
+
 /* Solaris hosts, loading libhal at runtime */
 
Index: /trunk/src/VBox/Main/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/Makefile.kmk	(revision 31336)
+++ /trunk/src/VBox/Main/Makefile.kmk	(revision 31337)
@@ -239,7 +239,4 @@
 VBoxSVC_DEFS.solaris += VBOX_USE_LIBHAL
 VBoxSVC_DEFS.freebsd += VBOX_USE_LIBHAL
-ifdef VBOX_SOLARIS_NSL_RESOLVED
- VBoxSVC_DEFS.solaris += VBOX_SOLARIS_NSL_RESOLVED
-endif
 
 VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS))
@@ -267,16 +264,6 @@
 	adm \
 	nsl \
+	devinfo \
 	socket
-
-ifdef VBOX_WITH_NETFLT
- ifdef VBOX_SOLARIS_NSL_RESOLVED
-  VBoxSVC_LIBS.solaris += devinfo
- endif
- VBoxSVC_LIBS.solaris += socket
-endif
-ifdef VBOX_WITH_USB
- VBoxSVC_LIBS.solaris += \
-	devinfo
-endif
 
 VBoxSVC_INTERMEDIATES = \
Index: /trunk/src/VBox/Main/include/HostImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/HostImpl.h	(revision 31336)
+++ /trunk/src/VBox/Main/include/HostImpl.h	(revision 31337)
@@ -137,4 +137,5 @@
 
 #if defined(RT_OS_SOLARIS)
+    void getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
     void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
     bool validateDevice(const char *deviceNode, bool isCDROM);
Index: /trunk/src/VBox/Main/solaris/NetIf-solaris.cpp
===================================================================
--- /trunk/src/VBox/Main/solaris/NetIf-solaris.cpp	(revision 31336)
+++ /trunk/src/VBox/Main/solaris/NetIf-solaris.cpp	(revision 31337)
@@ -41,7 +41,5 @@
 #include <limits.h>
 #include <stdio.h>
-#ifdef VBOX_SOLARIS_NSL_RESOLVED
-# include <libdevinfo.h>
-#endif
+#include <libdevinfo.h>
 #include <net/if.h>
 #include <sys/socket.h>
@@ -272,5 +270,4 @@
 }
 
-# ifdef VBOX_SOLARIS_NSL_RESOLVED
 static int vboxSolarisAddPhysHostIface(di_node_t Node, di_minor_t Minor, void *pvHostNetworkInterfaceList)
 {
@@ -292,10 +289,7 @@
     return DI_WALK_CONTINUE;
 }
-# endif /* VBOX_SOLARIS_NSL_RESOLVED */
 
 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
 {
-
-#  ifdef VBOX_SOLARIS_NSL_RESOLVED
 
     /*
@@ -315,6 +309,4 @@
     if (VBoxSolarisLibDlpiFound())
         g_pfnLibDlpiWalk(vboxSolarisAddLinkHostIface, &list, 0);
-
-#  endif    /* VBOX_SOLARIS_NSL_RESOLVED */
 
     /*
