Index: /trunk/include/VBox/VBoxGuestLib.h
===================================================================
--- /trunk/include/VBox/VBoxGuestLib.h	(revision 31429)
+++ /trunk/include/VBox/VBoxGuestLib.h	(revision 31430)
@@ -380,6 +380,4 @@
 DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory);
 DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
-
-DECLR0VBGL(int) VbglR0MiscReportGuestInfo(VBOXOSTYPE enmOSType);
 
 #endif /* IN_RING0 && !IN_RING0_AGNOSTIC */
Index: /trunk/src/VBox/Additions/WINNT/VBoxGuest/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/WINNT/VBoxGuest/Makefile.kmk	(revision 31429)
+++ /trunk/src/VBox/Additions/WINNT/VBoxGuest/Makefile.kmk	(revision 31430)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (C) 2006-2007 Oracle Corporation
+# Copyright (C) 2006-2010 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -43,5 +43,7 @@
 	HelperBugCheck.cpp \
 	VBoxGuest.rc
-VBoxGuest_LIBS        = \
+VBoxGuest_SOURCES      += \
+	../../common/VBoxGuest/VBoxHelper.cpp
+VBoxGuest_LIBS          = \
 	$(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
 	$(PATH_SDK_W2K3DDK_LIB)/hal.lib \
@@ -71,4 +73,7 @@
 	NTLegacy.cpp \
 	VBoxGuest.rc
+VBoxGuestNT_SOURCES  += \
+	../../common/VBoxGuest/VBoxHelper.cpp
+
 VBoxGuestNT_LIBS      = \
 	$(PATH_SDK_W2K3DDK_LIB)/exsup.lib \
Index: /trunk/src/VBox/Additions/WINNT/VBoxGuest/NTLegacy.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/VBoxGuest/NTLegacy.cpp	(revision 31429)
+++ /trunk/src/VBox/Additions/WINNT/VBoxGuest/NTLegacy.cpp	(revision 31430)
@@ -3,5 +3,5 @@
  * VBoxGuest -- VirtualBox Win32 guest support driver
  *
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -24,4 +24,5 @@
 
 #include <VBox/VBoxGuestLib.h>
+#include "../../common/VBoxGuest/VBoxHelper.h"
 
 /*******************************************************************************
@@ -276,21 +277,36 @@
     /** @todo Don't mix up IPRT rc and NTSTATUS rc above! */
 
-    vrc = VBoxInitMemBalloon(pDevExt);
-    if (RT_SUCCESS(vrc))
-    {
-        vrc = VbglR0MiscReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion));
+    if (NT_SUCCESS(rc))
+    {
+        vrc = VBoxReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion));
+        if (RT_SUCCESS(vrc))
+        {
+            vrc = VBoxInitMemBalloon(pDevExt);
+            if (RT_SUCCESS(vrc))
+            {
+                vrc = VBoxReportGuestDriverStatus(true /* Driver is active */);
+                if (RT_FAILURE(vrc))
+                    dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report guest driver status, vrc = %d\n", vrc));
+            }
+            else
+                dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not init mem balloon, vrc = %d\n", vrc));
+        }
+        else
+            dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report guest information to host, vrc = %d\n", vrc));
+
         if (RT_FAILURE(vrc))
-            dprintf(("VBoxGuest::ntCreateDevice: could not report information to host, rc = %d, exiting!\n", rc));
-    }
-
-    if (   NT_ERROR(rc)
-        || RT_FAILURE(vrc))
+            rc = STATUS_UNSUCCESSFUL;
+    }
+
+    if (NT_SUCCESS(rc))
+    {
+        // ready to rumble!
+        pDevExt->devState = WORKING;
+    }
+    else
     {
         freeDeviceResources(pDrvObj, pDevObj);
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    // ready to rumble!
-    pDevExt->devState = WORKING;
+    }
+
     dprintf(("returning from ntCreateDevice with rc = 0x%x\n, vrc = %Rrc", rc, vrc));
     return rc;
Index: /trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuestPnP.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuestPnP.cpp	(revision 31429)
+++ /trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuestPnP.cpp	(revision 31430)
@@ -25,4 +25,5 @@
 
 #include <VBox/VBoxGuestLib.h>
+#include "../../common/VBoxGuest/VBoxHelper.h"
 
 /*******************************************************************************
@@ -230,4 +231,29 @@
                 }
             }
+
+            /** @todo Don't mix up IPRT rc and NTSTATUS rc above! */
+
+            if (NT_SUCCESS(rc))
+            {
+                int vrc = VBoxReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion));
+                if (RT_SUCCESS(vrc))
+                {
+                    vrc = VBoxInitMemBalloon(pDevExt);
+                    if (RT_SUCCESS(vrc))
+                    {
+                        vrc = VBoxReportGuestDriverStatus(true /* Driver is active */);
+                        if (RT_FAILURE(vrc))
+                            dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report guest driver status, vrc = %d\n", vrc));
+                    }
+                    else
+                        dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not init mem balloon, vrc = %d\n", vrc));
+                }
+                else
+                    dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report guest information to host, vrc = %d\n", vrc));
+
+                if (RT_FAILURE(vrc))
+                    rc = STATUS_UNSUCCESSFUL;
+            }
+
             if (NT_SUCCESS(rc))
             {
@@ -241,16 +267,9 @@
                 pDevExt->HGCMWaitTimeout.QuadPart *= -10000;     /* relative in 100ns units */
 
-                int vrc = VBoxInitMemBalloon(pDevExt);
-                if (RT_SUCCESS(vrc))
-                {
-                    vrc = VbglR0MiscReportGuestInfo(hlpVBoxWinVersionToOSType(winVersion));
-                    if (RT_FAILURE(vrc))
-                        dprintf(("VBoxGuest::VBoxGuestPnp::IRP_MN_START_DEVICE: could not report information to host, rc = %d\n", rc));
-                }
-
                 // ready to rumble!
                 dprintf(("VBoxGuest::VBoxGuestPnp: device is ready!\n"));
                 pDevExt->devState = WORKING;
-            } else
+            }
+            else
             {
                 dprintf(("VBoxGuest::VBoxGuestPnp: error: rc = 0x%x\n", rc));
Index: /trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk	(revision 31429)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk	(revision 31430)
@@ -45,5 +45,7 @@
    VBoxGuest_SOURCES     = VBoxGuest-$(KBUILD_TARGET).c
   endif
-  VBoxGuest_SOURCES     += VBoxGuest.cpp
+  VBoxGuest_SOURCES     += \
+  	VBoxGuest.cpp \
+  	VBoxHelper.cpp
   VBoxGuest_LIBS         = \
   	$(VBOX_LIB_VBGL_R0BASE) \
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp	(revision 31429)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp	(revision 31430)
@@ -36,4 +36,5 @@
 # include <iprt/thread.h>
 #endif
+#include "VBoxHelper.h"
 #include "version-generated.h"
 #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
@@ -733,28 +734,34 @@
             Assert(pDevExt->PhysIrqAckEvents != 0);
 
-            rc = vboxGuestSetFilterMask(pDevExt, fFixedEvents);
+            rc = VBoxReportGuestInfo(enmOSType);
             if (RT_SUCCESS(rc))
             {
-                /*
-                 * Disable guest graphics capability by default. The guest specific
-                 * graphics driver will re-enable this when it is necessary.
-                 */
-                rc = VBoxGuestSetGuestCapabilities(0, VMMDEV_GUEST_SUPPORTS_GRAPHICS);
+                rc = vboxGuestSetFilterMask(pDevExt, fFixedEvents);
                 if (RT_SUCCESS(rc))
                 {
-                    vboxGuestInitFixateGuestMappings(pDevExt);
-
-                    rc = VbglR0MiscReportGuestInfo(enmOSType);
-                    if (RT_FAILURE(rc))
-                        LogRel(("VBoxGuestInitDevExt: VbglR0MiscReportGuestInfo failed, rc=%Rrc\n", rc));
-
-                    Log(("VBoxGuestInitDevExt: returns success\n"));
-                    return VINF_SUCCESS;
+                    /*
+                     * Disable guest graphics capability by default. The guest specific
+                     * graphics driver will re-enable this when it is necessary.
+                     */
+                    rc = VBoxGuestSetGuestCapabilities(0, VMMDEV_GUEST_SUPPORTS_GRAPHICS);
+                    if (RT_SUCCESS(rc))
+                    {
+                        vboxGuestInitFixateGuestMappings(pDevExt);
+
+                        rc = VBoxReportGuestDriverStatus(true /* Driver is active */);
+                        if (RT_FAILURE(rc))
+                            LogRel(("VBoxGuestInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
+
+                        Log(("VBoxGuestInitDevExt: returns success\n"));
+                        return VINF_SUCCESS;
+                    }
+
+                    LogRel(("VBoxGuestInitDevExt: VBoxGuestSetGuestCapabilities failed, rc=%Rrc\n", rc));
                 }
-
-                LogRel(("VBoxGuestInitDevExt: VBoxGuestSetGuestCapabilities failed, rc=%Rrc\n", rc));
+                else
+                    LogRel(("VBoxGuestInitDevExt: vboxGuestSetFilterMask failed, rc=%Rrc\n", rc));
             }
             else
-                LogRel(("VBoxGuestInitDevExt: vboxGuestSetFilterMask failed, rc=%Rrc\n", rc));
+                LogRel(("VBoxGuestInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc));
             VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents);
         }
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxHelper.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxHelper.cpp	(revision 31430)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxHelper.cpp	(revision 31430)
@@ -0,0 +1,108 @@
+/* $Id$ */
+/** @file
+ * VBoxHelper - Miscellaneous functions.
+ */
+
+/*
+ * Copyright (C) 2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#include <iprt/string.h>
+#include <VBox/err.h>
+#include <VBox/log.h>
+#include <VBox/VBoxGuestLib.h>
+#include <VBox/version.h>
+
+
+int VBoxReportGuestInfo(VBOXOSTYPE enmOSType)
+{
+    /*
+     * Important: VMMDev *awaits* a VMMDevReportGuestInfo or VMMDevReportGuestInfo2 message
+     *            first in order to accept all other VMMDev messages! Otherwise you'd get
+     *            a VERR_NOT_SUPPORTED error.
+     */
+    VMMDevReportGuestInfo2 *pReq = NULL;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
+    Log(("VBoxReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+    if (RT_SUCCESS(rc))
+    {
+        pReq->guestInfo.additionsMajor = VBOX_VERSION_MAJOR;
+        pReq->guestInfo.additionsMinor = VBOX_VERSION_MINOR;
+        pReq->guestInfo.additionsBuild = VBOX_VERSION_BUILD;
+        pReq->guestInfo.additionsRevision = VBOX_SVN_REV;
+        pReq->guestInfo.additionsFeatures = 0; /* Not (never?) used. */
+        RTStrCopy(pReq->guestInfo.szName, sizeof(pReq->guestInfo.szName), VBOX_VERSION_STRING);
+
+        rc = VbglGRPerform(&pReq->header);
+        Log(("VBoxReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+        if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
+            rc = VINF_SUCCESS;
+        VbglGRFree(&pReq->header);
+    }
+
+    /*
+     * VMMDevReportGuestInfo acts as a beacon and signals the host that all guest information is
+     * now complete.  So always send this report last!
+     */
+    if (RT_SUCCESS(rc))
+    {
+        VMMDevReportGuestInfo *pReq3 = NULL;
+        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq3, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
+        Log(("VBoxReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+        if (RT_SUCCESS(rc))
+        {
+            pReq3->guestInfo.interfaceVersion = VMMDEV_VERSION;
+            pReq3->guestInfo.osType = enmOSType;
+
+            rc = VbglGRPerform(&pReq3->header);
+            Log(("VBoxReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+            VbglGRFree(&pReq3->header);
+        }
+    }
+
+    return rc;
+}
+
+int VBoxReportGuestDriverStatus(bool fActive)
+{
+    /*
+     * Report guest status of the VBox driver to the host.
+     */
+    VMMDevReportGuestStatus *pReq2 = NULL;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestStatus);
+    Log(("VBoxReportGuestDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
+    if (RT_SUCCESS(rc))
+    {
+        pReq2->guestStatus.facility = VBoxGuestStatusFacility_VBoxGuestDriver;
+        pReq2->guestStatus.status = fActive ?
+                                    VBoxGuestStatusCurrent_Active
+                                  : VBoxGuestStatusCurrent_Inactive;
+        pReq2->guestStatus.flags = 0;
+        rc = VbglGRPerform(&pReq2->header);
+        Log(("VBoxReportGuestDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
+             rc, fActive ? 1 : 0));
+        if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
+            rc = VINF_SUCCESS;
+        VbglGRFree(&pReq2->header);
+    }
+
+    return rc;
+}
+
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk	(revision 31429)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk	(revision 31430)
@@ -61,10 +61,6 @@
 	VMMDev.cpp \
 	HGCM.cpp \
-	VBoxGuestR0LibMisc.c \
 	VBoxGuestR0LibSharedFolders.c \
 	VbglR0CanUsePhysPageList.cpp
-
-VBoxGuestR0LibMisc.c_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
-
 
 #
@@ -82,6 +78,5 @@
 	VMMDev.cpp \
 	HGCMInternal.cpp \
-	VbglR0CanUsePhysPageList.cpp \
-	VBoxGuestR0LibMisc.c
+	VbglR0CanUsePhysPageList.cpp
 
 #
Index: unk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibMisc.c
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibMisc.c	(revision 31429)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/* $Id$ */
-/** @file
- * VBoxGuestR0LibMisc - Miscellaneous functions.
- */
-
-/*
- * Copyright (C) 2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-#include <iprt/string.h>
-#include <VBox/err.h>
-#include <VBox/log.h>
-#include <VBox/VBoxGuestLib.h>
-#include <VBox/version.h>
-
-
-DECLR0VBGL(int) VbglR0MiscReportGuestInfo(VBOXOSTYPE enmOSType)
-{
-    VMMDevReportGuestInfo2 *pReq = NULL;
-    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
-    if (RT_SUCCESS(rc))
-    {
-        pReq->guestInfo.additionsMajor = VBOX_VERSION_MAJOR;
-        pReq->guestInfo.additionsMinor = VBOX_VERSION_MINOR;
-        pReq->guestInfo.additionsBuild = VBOX_VERSION_BUILD;
-        pReq->guestInfo.additionsRevision = VBOX_SVN_REV;
-        pReq->guestInfo.additionsFeatures = 0; /* Not (never?) used. */
-        RTStrCopy(pReq->guestInfo.szName, sizeof(pReq->guestInfo.szName), VBOX_VERSION_STRING);
-
-        rc = VbglGRPerform(&pReq->header);
-        if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
-            rc = VINF_SUCCESS;
-        VbglGRFree(&pReq->header);
-    }
-
-    /*
-     * Report guest status of the VBox driver to the host.
-     */
-    if (RT_SUCCESS(rc))
-    {
-        VMMDevReportGuestStatus *pReq2;
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestStatus);
-        if (RT_SUCCESS(rc))
-        {
-            pReq2->guestStatus.facility = VBoxGuestStatusFacility_VBoxGuestDriver;
-            pReq2->guestStatus.status = VBoxGuestStatusCurrent_Active; /** @todo Are we actually *really* active at this point? */
-            pReq2->guestStatus.flags = 0;
-            rc = VbglGRPerform(&pReq2->header);
-            if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
-                rc = VINF_SUCCESS;
-            VbglGRFree(&pReq2->header);
-        }
-    }
-
-    /*
-     * VMMDevReportGuestInfo acts as a beacon and signals the host that all guest information is
-     * now complete.  So always send this report last!
-     */
-    if (RT_SUCCESS(rc))
-    {
-        VMMDevReportGuestInfo *pReq3 = NULL;
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq3, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
-        if (RT_SUCCESS(rc))
-        {
-            pReq3->guestInfo.interfaceVersion = VMMDEV_VERSION;
-            pReq3->guestInfo.osType = enmOSType;
-
-            rc = VbglGRPerform(&pReq3->header);
-            VbglGRFree(&pReq3->header);
-        }
-    }
-
-    return rc;
-}
-
Index: /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 31429)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 31430)
@@ -425,6 +425,9 @@
     Log2(("VMMDev request issued: %d\n", requestHeader.requestType));
 
-    if (    requestHeader.requestType != VMMDevReq_ReportGuestInfo
-        && !pThis->fu32AdditionsOk)
+    /* Because VMMDevReq_ReportGuestInfo is sent last in the first information chain
+     * from the guest also check for VMMDevReq_ReportGuestInfo2. */
+    if (    requestHeader.requestType != VMMDevReq_ReportGuestInfo2
+        && (   requestHeader.requestType != VMMDevReq_ReportGuestInfo
+            && !pThis->fu32AdditionsOk))
     {
         Log(("VMMDev: guest has not yet reported to us. Refusing operation.\n"));
