Index: /trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMFInternal.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMFInternal.cpp	(revision 59881)
+++ /trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMFInternal.cpp	(revision 59882)
@@ -216,5 +216,6 @@
     KeAcquireSpinLock(&g_ctx.SyncLock, &Irql);
     InsertHeadList(&g_ctx.DevExtList, &pDevExt->ListEntry);
-    if (!g_ctx.pCurrentDevExt)
+    /* g_ctx.pCurrentDevExt must be associated with the i8042prt device. */
+    if (pDevExt->bHostMouse && !g_ctx.pCurrentDevExt)
     {
         ASMAtomicWritePtr(&g_ctx.pCurrentDevExt, pDevExt);
@@ -243,14 +244,7 @@
     if (g_ctx.pCurrentDevExt == pDevExt)
     {
+        /* The PS/2 mouse is being removed. Usually never happens. */
         ObDereferenceObject(pDevExt->pdoSelf);
         g_ctx.pCurrentDevExt = NULL;
-        for (PLIST_ENTRY pCur = g_ctx.DevExtList.Flink; pCur != &g_ctx.DevExtList; pCur = pCur->Flink)
-        {
-            PVBOXMOUSE_DEVEXT pNewCurDevExt = PVBOXMOUSE_DEVEXT_FROM_LE(pCur);
-            ASMAtomicWritePtr(&g_ctx.pCurrentDevExt, pNewCurDevExt);
-            /* ensure the object is not deleted while it is being used by a poller thread */
-            ObReferenceObject(pNewCurDevExt->pdoSelf);
-            break;
-        }
     }
 
@@ -347,6 +341,4 @@
         }
     }
-
-    vboxNewProtDeviceAdded(pDevExt);
 
     if (!vboxIsHostMouseFound())
@@ -424,4 +416,8 @@
         }
     }
+
+    /* Finally call the handler, which needs a correct pDevExt->bHostMouse value. */
+    vboxNewProtDeviceAdded(pDevExt);
+
     LOGF_LEAVE();
 }
