Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c	(revision 6149)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c	(revision 6150)
@@ -524,4 +524,5 @@
     {
         pState->pSession = pSession;
+        *pDev = makedevice(getmajor(*pDev), iOpenInstance);
         Log((DEVICE_NAME "VBoxAddSolarisOpen: pSession=%p pState=%p\n", pSession, pState));
         return 0;
@@ -547,4 +548,17 @@
         RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
 
+        int instance;
+        for (instance = 0; instance < 4096; instance++)
+        {
+            VBoxAddDevState *pState = ddi_get_soft_state(g_pVBoxAddSolarisState, instance);
+            if (pState)
+                break;
+        }
+        if (instance >= 4096)
+        {
+            Log((DEVICE_NAME ":VBoxAddSolarisOpen: All instances exhausted\n"));
+            return ENXIO;
+        }
+        *pDev = makedevice(getmajor(*pDev), instance);
         Log((DEVICE_NAME "VBoxAddSolarisOpen: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf()));
         return 0;
@@ -601,5 +615,5 @@
     {
         Log((DEVICE_NAME ":VBoxGuestIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d", (int)Process));
-        return VERR_INVALID_PARAMETER;
+        return EFAULT;
     }
 #else
@@ -609,5 +623,5 @@
     {
         Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pState.\n"));
-        return DDI_FAILURE;
+        return EFAULT;
     }
 
@@ -618,5 +632,5 @@
     {
         Log((DEVICE_NAME ":VBoxAddSolarisClose: failed to get pSession.\n"));
-        return DDI_FAILURE;
+        return EFAULT;
     }
 #endif
@@ -633,5 +647,5 @@
 {
     LogFlow((DEVICE_NAME ":VBoxAddSolarisRead\n"));
-    return DDI_SUCCESS;
+    return 0;
 }
 
@@ -640,5 +654,5 @@
 {
     LogFlow((DEVICE_NAME ":VBoxAddSolarisWrite\n"));
-    return DDI_SUCCESS;
+    return 0;
 }
 
@@ -705,5 +719,5 @@
     {
         Log((DEVICE_NAME ":VBoxAddSolarisIOCtl: no session data for %d\n", getminor(Dev)));
-        return DDI_SUCCESS;
+        return EINVAL;
     }
 #endif
