Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp	(revision 50836)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp	(revision 50837)
@@ -138,36 +138,23 @@
         return VERR_INVALID_PARAMETER;
 
-    pHandleData = vbglHGCMHandleAlloc ();
-
-    rc = VINF_SUCCESS;
-
+    pHandleData = vbglHGCMHandleAlloc();
     if (!pHandleData)
-    {
         rc = VERR_NO_MEMORY;
-    }
     else
     {
         rc = vbglDriverOpen (&pHandleData->driver);
-
         if (RT_SUCCESS(rc))
         {
             rc = vbglDriverIOCtl (&pHandleData->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, pData, sizeof (*pData));
-
-            if (RT_SUCCESS(rc))
+            if (   RT_SUCCESS(rc)
+                && RT_SUCCESS(pData->result))
             {
                 *pHandle = pHandleData;
-            }
-            else
-            {
-                vbglDriverClose (&pHandleData->driver);
+                return rc;
             }
         }
-
-        if (RT_FAILURE(rc))
-        {
-            vbglHGCMHandleFree (pHandleData);
-        }
     }
-
+    vbglDriverClose (&pHandleData->driver);
+    vbglHGCMHandleFree (pHandleData);
     return rc;
 }
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp	(revision 50836)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp	(revision 50837)
@@ -46,7 +46,5 @@
     VBoxGuestMouseSetNotifyCallback NotifyCallback;
     VBGLDRIVER *pDriver;
-    int rc;
-
-    rc = vbglGetDriver(&pDriver);
+    int rc = vbglGetDriver(&pDriver);
     if (RT_FAILURE(rc))
         return rc;
@@ -85,4 +83,6 @@
     if (RT_FAILURE(rc))
         return rc;
+    if (RT_FAILURE(Req.header.rc))
+        return Req.header.rc;
     if (pfFeatures)
         *pfFeatures = Req.mouseFeatures;
