Index: trunk/src/VBox/Main/include/KeyboardImpl.h
===================================================================
--- trunk/src/VBox/Main/include/KeyboardImpl.h	(revision 45012)
+++ trunk/src/VBox/Main/include/KeyboardImpl.h	(revision 45029)
@@ -86,6 +86,7 @@
 private:
 
+    static DECLCALLBACK(void)   keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds);
+    static DECLCALLBACK(void)   keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
     static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(void)   keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
     static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
     static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
Index: trunk/src/VBox/Main/src-client/AudioSnifferInterface.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/AudioSnifferInterface.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/AudioSnifferInterface.cpp	(revision 45029)
@@ -161,7 +161,7 @@
 DECLCALLBACK(void) AudioSniffer::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVAUDIOSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOSNIFFER);
     LogFlow(("AudioSniffer::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
     if (pThis->pAudioSniffer)
@@ -179,8 +179,8 @@
 DECLCALLBACK(int) AudioSniffer::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVAUDIOSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOSNIFFER);
 
     LogFlow(("AudioSniffer::drvConstruct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
 
     /*
Index: trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 45029)
@@ -9902,7 +9902,7 @@
 DECLCALLBACK(void) Console::drvStatus_Destruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINSTATUS pData = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
     LogFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
     if (pData->papLeds)
@@ -9922,7 +9922,7 @@
 DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINSTATUS pData = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
     LogFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
 
     /*
Index: trunk/src/VBox/Main/src-client/DisplayImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 45029)
@@ -4265,7 +4265,7 @@
 DECLCALLBACK(void) Display::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINDISPLAY pData = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
-    LogRelFlowFunc (("iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+    LogRelFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
 
     if (pData->pDisplay)
@@ -4293,7 +4293,7 @@
 DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINDISPLAY pData = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
-    LogRelFlowFunc (("iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
+    LogRelFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
 
     /*
Index: trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/KeyboardImpl.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/KeyboardImpl.cpp	(revision 45029)
@@ -272,4 +272,25 @@
 //
 
+DECLCALLBACK(void) Keyboard::keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds)
+{
+    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
+    pDrv->pKeyboard->getParent()->onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK),
+                                                       RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK),
+                                                       RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
+}
+
+/**
+ * @interface_method_impl{PDMIKEYBOARDCONNECTOR,pfnSetActive}
+ */
+DECLCALLBACK(void) Keyboard::keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive)
+{
+    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
+    if (fActive)
+        pDrv->u32DevCaps |= KEYBOARD_DEVCAP_ENABLED;
+    else
+        pDrv->u32DevCaps &= ~KEYBOARD_DEVCAP_ENABLED;
+}
+
+
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
@@ -294,7 +315,7 @@
 DECLCALLBACK(void) Keyboard::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
     LogFlow(("Keyboard::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
     if (pData->pKeyboard)
@@ -311,25 +332,4 @@
 }
 
-DECLCALLBACK(void) keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface,
-                                           PDMKEYBLEDS enmLeds)
-{
-    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
-    pDrv->pKeyboard->getParent()->onKeyboardLedsChange(!!(enmLeds & PDMKEYBLEDS_NUMLOCK),
-                                                       !!(enmLeds & PDMKEYBLEDS_CAPSLOCK),
-                                                       !!(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
-}
-
-/**
- * @interface_method_impl{PDMIKEYBOARDCONNECTOR,pfnSetActive}
- */
-DECLCALLBACK(void) Keyboard::keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive)
-{
-    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
-    if (fActive)
-        pDrv->u32DevCaps |= KEYBOARD_DEVCAP_ENABLED;
-    else
-        pDrv->u32DevCaps &= ~KEYBOARD_DEVCAP_ENABLED;
-}
-
 /**
  * Construct a keyboard driver instance.
@@ -337,10 +337,9 @@
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg,
-                                         uint32_t fFlags)
-{
+DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
     LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
 
     /*
@@ -359,5 +358,5 @@
 
     pData->IConnector.pfnLedStatusChange    = keyboardLedStatusChange;
-    pData->IConnector.pfnSetActive          = keyboardSetActive;
+    pData->IConnector.pfnSetActive          = Keyboard::keyboardSetActive;
 
     /*
Index: trunk/src/VBox/Main/src-client/MouseImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/MouseImpl.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/MouseImpl.cpp	(revision 45029)
@@ -713,7 +713,7 @@
 DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     LogFlow(("Mouse::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
     if (pData->pMouse)
@@ -737,7 +737,7 @@
 DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINMOUSE pData = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
     LogFlow(("drvMainMouse_Construct: iInstance=%d\n", pDrvIns->iInstance));
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
 
     /*
Index: trunk/src/VBox/Main/src-client/Nvram.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/Nvram.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/Nvram.cpp	(revision 45029)
@@ -330,4 +330,5 @@
 DECLCALLBACK(void) Nvram::drvNvram_Destruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     LogFlow(("%s: iInstance/#d\n", __FUNCTION__, pDrvIns->iInstance));
     PNVRAM pThis = PDMINS_2_DATA(pDrvIns, PNVRAM);
@@ -342,4 +343,5 @@
 DECLCALLBACK(int) Nvram::drvNvram_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     LogFlowFunc(("iInstance/#d, pCfg:%p, fFlags:%x\n", pDrvIns->iInstance, pCfg, fFlags));
     PNVRAM pThis = PDMINS_2_DATA(pDrvIns, PNVRAM);
Index: trunk/src/VBox/Main/src-client/PCIRawDevImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/PCIRawDevImpl.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/PCIRawDevImpl.cpp	(revision 45029)
@@ -15,4 +15,5 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
+
 #include "Logging.h"
 #include "PCIRawDevImpl.h"
@@ -105,13 +106,18 @@
 
 /**
- * Destruct a PCI raw driver instance.
- *
- * @returns VBox status.
- * @param   pDrvIns     The driver instance data.
+ * @interface_method_impl{PDMDRVREG,pfnReset}
+ */
+DECLCALLBACK(void) PCIRawDev::drvReset(PPDMDRVINS pDrvIns)
+{
+}
+
+
+/**
+ * @interface_method_impl{PDMDRVREG,pfnReset}
  */
 DECLCALLBACK(void) PCIRawDev::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINPCIRAWDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINPCIRAWDEV);
-    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
     if (pData->pPCIRawDev)
@@ -121,23 +127,10 @@
 
 /**
- * Reset notification.
- *
- * @returns VBox status.
- * @param   pDrvIns     The driver instance data.
- */
-DECLCALLBACK(void) PCIRawDev::drvReset(PPDMDRVINS pDrvIns)
-{
-}
-
-
-/**
- * Construct a raw PCI driver instance.
- *
- * @copydoc FNPDMDRVCONSTRUCT
+ * @interface_method_impl{PDMDRVREG,pfnConstruct}
  */
 DECLCALLBACK(int) PCIRawDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINPCIRAWDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINPCIRAWDEV);
-    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
 
     /*
@@ -228,2 +221,3 @@
     PDM_DRVREG_VERSION
 };
+
Index: trunk/src/VBox/Main/src-client/UsbCardReader.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/UsbCardReader.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/UsbCardReader.cpp	(revision 45029)
@@ -1,4 +1,3 @@
 /* $Id$ */
-
 /** @file
  * UsbCardReader - Driver Interface to USB Smart Card Reader emulation.
@@ -1824,5 +1823,5 @@
 
 /*
- * PDM
+ * PDMDRVINS
  */
 
@@ -1838,8 +1837,35 @@
 }
 
+/* static */ DECLCALLBACK(void) UsbCardReader::drvDestruct(PPDMDRVINS pDrvIns)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+    LogFlowFunc(("iInstance/%d\n",pDrvIns->iInstance));
+    PUSBCARDREADER pThis = PDMINS_2_DATA(pDrvIns, PUSBCARDREADER);
+
+    /** @todo The driver is destroyed before the device.
+     * So device calls ReleaseContext when there is no more driver.
+     * Notify the device here so it can do cleanup or
+     * do a cleanup now in the driver.
+     */
+    if (pThis->hReqQCardReaderCmd != NIL_RTREQQUEUE)
+    {
+        int rc = RTReqQueueDestroy(pThis->hReqQCardReaderCmd);
+        AssertRC(rc);
+        pThis->hReqQCardReaderCmd = NIL_RTREQQUEUE;
+    }
+
+    /** @todo r=bird: why doesn't this set pThis->pUsbCardReader->mpDrv to NULL like
+     *        everyone else? */
+    pThis->pUsbCardReader = NULL;
+    LogFlowFuncLeave();
+}
+
 /* static */ DECLCALLBACK(int) UsbCardReader::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     LogFlowFunc(("iInstance/%d, pCfg:%p, fFlags:%x\n", pDrvIns->iInstance, pCfg, fFlags));
     PUSBCARDREADER pThis = PDMINS_2_DATA(pDrvIns, PUSBCARDREADER);
+
+    pThis->hReqQCardReaderCmd = NIL_RTREQQUEUE;
 
     if (!CFGMR3AreValuesValid(pCfg, "Object\0"))
@@ -1893,25 +1919,4 @@
     LogFlowFunc(("LEAVE: %Rrc\n", rc));
     return rc;
-}
-
-/* static */ DECLCALLBACK(void) UsbCardReader::drvDestruct(PPDMDRVINS pDrvIns)
-{
-    LogFlowFunc(("iInstance/%d\n",pDrvIns->iInstance));
-    PUSBCARDREADER pThis = PDMINS_2_DATA(pDrvIns, PUSBCARDREADER);
-
-    /* @todo The driver is destroyed before the device.
-     * So device calls ReleaseContext when there is no more driver.
-     * Notify the device here so it can do cleanup or
-     * do a cleanup now in the driver.
-     */
-    if (pThis->hReqQCardReaderCmd != NIL_RTREQQUEUE)
-    {
-        int rc = RTReqQueueDestroy(pThis->hReqQCardReaderCmd);
-        AssertRC(rc);
-        pThis->hReqQCardReaderCmd = NIL_RTREQQUEUE;
-    }
-
-    pThis->pUsbCardReader = NULL;
-    LogFlowFuncLeave();
 }
 
Index: trunk/src/VBox/Main/src-client/UsbWebcamInterface.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/UsbWebcamInterface.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/UsbWebcamInterface.cpp	(revision 45029)
@@ -330,6 +330,22 @@
 }
 
+/* static */ DECLCALLBACK(void) EmWebcam::drvDestruct(PPDMDRVINS pDrvIns)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+    PEMWEBCAMDRV pThis = PDMINS_2_DATA(pDrvIns, PEMWEBCAMDRV);
+
+    LogFlowFunc(("iInstance %d, pEmWebcam %p, pIWebcamUp %p\n",
+                 pDrvIns->iInstance, pThis->pEmWebcam, pThis->pIWebcamUp));
+
+    if (pThis->pEmWebcam)
+    {
+        pThis->pEmWebcam->EmWebcamDestruct(pThis);
+        pThis->pEmWebcam = NULL;
+    }
+}
+
 /* static */ DECLCALLBACK(int) EmWebcam::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     LogFlowFunc(("iInstance:%d, pCfg:%p, fFlags:%x\n", pDrvIns->iInstance, pCfg, fFlags));
 
@@ -367,18 +383,4 @@
 
     return VINF_SUCCESS;
-}
-
-/* static */ DECLCALLBACK(void) EmWebcam::drvDestruct(PPDMDRVINS pDrvIns)
-{
-    PEMWEBCAMDRV pThis = PDMINS_2_DATA(pDrvIns, PEMWEBCAMDRV);
-
-    LogFlowFunc(("iInstance %d, pEmWebcam %p, pIWebcamUp %p\n",
-                 pDrvIns->iInstance, pThis->pEmWebcam, pThis->pIWebcamUp));
-
-    if (pThis->pEmWebcam)
-    {
-        pThis->pEmWebcam->EmWebcamDestruct(pThis);
-        pThis->pEmWebcam = NULL;
-    }
 }
 
Index: trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/VMMDevInterface.cpp	(revision 45012)
+++ trunk/src/VBox/Main/src-client/VMMDevInterface.cpp	(revision 45029)
@@ -746,13 +746,23 @@
 
 /**
- * Destruct a VMMDev driver instance.
- *
- * @returns VBox status.
- * @param   pDrvIns     The driver instance data.
+ * @interface_method_impl{PDMDRVREG,pfnReset}
+ */
+DECLCALLBACK(void) VMMDev::drvReset(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("VMMDev::drvReset: iInstance=%d\n", pDrvIns->iInstance));
+#ifdef VBOX_WITH_HGCM
+    HGCMHostReset ();
+#endif /* VBOX_WITH_HGCM */
+}
+
+/**
+ * @interface_method_impl{PDMDRVREG,pfnDestruct}
  */
 DECLCALLBACK(void) VMMDev::drvDestruct(PPDMDRVINS pDrvIns)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINVMMDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
     LogFlow(("VMMDev::drvDestruct: iInstance=%d\n", pDrvIns->iInstance));
+
 #ifdef VBOX_WITH_HGCM
     /* HGCM is shut down on the VMMDev destructor. */
@@ -763,24 +773,9 @@
 
 /**
- * Reset notification.
- *
- * @returns VBox status.
- * @param   pDrvIns     The driver instance data.
- */
-DECLCALLBACK(void) VMMDev::drvReset(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("VMMDev::drvReset: iInstance=%d\n", pDrvIns->iInstance));
-#ifdef VBOX_WITH_HGCM
-    HGCMHostReset ();
-#endif /* VBOX_WITH_HGCM */
-}
-
-/**
- * Construct a VMMDev driver instance.
- *
- * @copydoc FNPDMDRVCONSTRUCT
+ * @interface_method_impl{PDMDRVREG,pfnConstruct}
  */
 DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
 {
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINVMMDEV pData = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
     LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance));
