Index: /trunk/include/VBox/pdmifs.h
===================================================================
--- /trunk/include/VBox/pdmifs.h	(revision 25983)
+++ /trunk/include/VBox/pdmifs.h	(revision 25984)
@@ -38,4 +38,21 @@
 /** @defgroup grp_pdm_interfaces    The PDM Interface Definitions
  * @ingroup grp_pdm
+ *
+ * For historical reasons (the PDMINTERFACE enum) a lot of interface was stuffed
+ * together in this group instead, dragging stuff into global space that didn't
+ * need to be there and making this file huge (>2500 lines).  Since we're using
+ * UUIDs as interface identifiers (IIDs) now, no only generic PDM interface will
+ * be added to this file.  Component specific interface should be defined in the
+ * header file of that component.
+ *
+ * Interfaces consists of a method table (typedef'ed struct) and an interface
+ * ID.  The typename of the method table should have an 'I' in it, be all
+ * capitals and according to the rules, no underscores.  The interface ID is a
+ * \#define constructed by appending '_IID' to the typename. The IID value is a
+ * UUID string on the form "a2299c0d-b709-4551-aa5a-73f59ffbed74".  If you stick
+ * to these rules, you can make use of the PDMIBASE_QUERY_INTERFACE and
+ * PDMIBASE_RETURN_INTERFACE when querying interface and implementing
+ * PDMIBASE::pfnQueryInterface respectively.
+ *
  * @{
  */
@@ -46,51 +63,8 @@
  * @{
  */
-/** PDMIAUDIOCONNECTOR      - The audio driver interface.           (Up)    No coupling. */
-#define PDMINTERFACE_AUDIO_CONNECTOR            "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
-
-/** PDMIAUDIOSNIFFERPORT    - The Audio Sniffer Device port interface. */
-#define PDMINTERFACE_AUDIO_SNIFFER_PORT         "83b95e02-68cb-470d-9dfc-25a0f8efe197"
-/** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
-#define PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR    "433b64ab-e603-4933-bc97-8fe79b2bd0e0"
-
-/** PDMIVMMDEVPORT          - The VMM Device port interface. */
-#define PDMINTERFACE_VMMDEV_PORT                "d7e52035-3b6c-422e-9215-2a75646a945d"
-/** PDMIVMMDEVCONNECTOR     - The VMM Device connector interface. */
-#define PDMINTERFACE_VMMDEV_CONNECTOR           "38b96194-ee83-489e-b92e-73ee28a29439"
-
-/** PDMILEDPORTS            - The generic LED port interface.       (Down)  Coupled with PDMINTERFACE_LED_CONNECTORS. */
-#define PDMINTERFACE_LED_PORTS                  "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
-/** PDMILEDCONNECTORS       - The generic LED connector interface.  (Up)    Coupled with PDMINTERFACE_LED_PORTS.  */
-#define PDMINTERFACE_LED_CONNECTORS             "8ed63568-82a7-4193-b57b-db8085ac4495"
-
-/** PDMIACPIPORT            - ACPI port interface.                  (Down)   Coupled with PDMINTERFACE_ACPI_CONNECTOR. */
-#define PDMINTERFACE_ACPI_PORT                  "30d3dc4c-6a73-40c8-80e9-34309deacbb3"
-/** PDMIACPICONNECTOR       - ACPI connector interface.             (Up)     Coupled with PDMINTERFACE_ACPI_PORT. */
-#define PDMINTERFACE_ACPI_CONNECTOR             "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
-
-/** PDMIHGCMPORT            - The Host-Guest communication manager port interface. Normally implemented by VMMDev. */
-#define PDMINTERFACE_HGCM_PORT                  "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
-/** PDMIHGCMCONNECTOR       - The Host-Guest communication manager connector interface. Normally implemented by Main::VMMDevInterface. */
-#define PDMINTERFACE_HGCM_CONNECTOR             "a1104758-c888-4437-8f2a-7bac17865b5c"
-
-/** VUSBIROOTHUBPORT        - VUSB RootHub port interface.          (Down)   Coupled with PDMINTERFACE_USB_RH_CONNECTOR. */
-#define PDMINTERFACE_VUSB_RH_PORT               "e38e2978-7aa2-4860-94b6-9ef4a066d8a0"
-/** VUSBIROOTHUBCONNECTOR   - VUSB RootHub connector interface.     (Up)     Coupled with PDMINTERFACE_USB_RH_PORT. */
-#define PDMINTERFACE_VUSB_RH_CONNECTOR          "d9a90c59-e3ff-4dff-9754-844557c3f7a0"
-/** VUSBIRHCONFIG           - VUSB RootHub configuration interface. (Main)   Used by the managment api. */
-#define PDMINTERFACE_VUSB_RH_CONFIG             "c354cd97-e85f-465e-bc12-b58798465f52"
-
-/** VUSBIDEVICE             - VUSB Device interface.                (Up)     No coupling. */
-#define PDMINTERFACE_VUSB_DEVICE                "88732dd3-0ccd-4625-b040-48804ac7a217"
-
-/** PDMIHOSTPARALLELPORT    - The Host Parallel port interface.     (Down)   Coupled with PDMINTERFACE_HOST_PARALLEL_CONNECTOR. */
-#define PDMINTERFACE_HOST_PARALLEL_PORT         "ac13e437-cd30-47ac-a271-6120571f3a22"
-/** PDMIHOSTPARALLELCONNECTOR - The Host Parallel connector interface (Up)   Coupled with PDMINTERFACE_HOST_PARALLEL_PORT. */
-#define PDMINTERFACE_HOST_PARALLEL_CONNECTOR    "a03567ca-b29e-4a1b-b2f3-a12435fa2982"
-
-/** PDMISCSIPORT            - The SCSI command execution port interface (Down) Coupled with PDMINTERFACE_SCSI_CONNECTOR. */
-#define PDMINTERFACE_SCSI_PORT                  "0f894add-714d-4a77-818e-a32fe3586ba4"
-/** PDMISCSICONNECTOR       - The SCSI command execution connector interface (Up) Coupled with PDMINTERFACE_SCSI_PORT. */
-#define PDMINTERFACE_SCSI_CONNECTOR             "94465fbd-a2f2-447e-88c9-7366421bfbfe"
+
+/* gsrc -r PDMINTERFACE */
+
+
 /** @} */
 
@@ -1419,5 +1393,5 @@
 typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
 /**
- * Host parallel port interface.
+ * Host parallel port interface (down).
  * Pair with PDMIHOSTPARALLELCONNECTOR.
  */
@@ -1444,4 +1418,6 @@
     DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
 } PDMIHOSTPARALLELPORT;
+/** PDMIHOSTPARALLELPORT interface ID. */
+#define PDMIHOSTPARALLELPORT_IID                "ac13e437-cd30-47ac-a271-6120571f3a22"
 
 
@@ -1450,5 +1426,5 @@
 typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
 /**
- * Host parallel connector interface
+ * Host parallel connector interface (up).
  * Pair with PDMIHOSTPARALLELPORT.
  */
@@ -1517,4 +1493,6 @@
     DECLR3CALLBACKMEMBER(int, pfnSetMode,(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode));
 } PDMIHOSTPARALLELCONNECTOR;
+/** PDMIHOSTPARALLELCONNECTOR interface ID. */
+#define PDMIHOSTPARALLELCONNECTOR_IID           "a03567ca-b29e-4a1b-b2f3-a12435fa2982"
 
 
@@ -1553,5 +1531,6 @@
 typedef struct PDMIACPIPORT *PPDMIACPIPORT;
 /**
- * ACPI port interface.
+ * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
+ * Pair with PDMIACPICONNECTOR.
  */
 typedef struct PDMIACPIPORT
@@ -1601,9 +1580,13 @@
     DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
 } PDMIACPIPORT;
+/** PDMIACPIPORT interface ID. */
+#define PDMIACPIPORT_IID                        "30d3dc4c-6a73-40c8-80e9-34309deacbb3"
+
 
 /** Pointer to an ACPI connector interface. */
 typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
 /**
- * ACPI connector interface.
+ * ACPI connector interface (up).
+ * Pair with PDMIACPIPORT.
  */
 typedef struct PDMIACPICONNECTOR
@@ -1631,4 +1614,6 @@
                                                      PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
 } PDMIACPICONNECTOR;
+/** PDMIACPICONNECTOR interface ID. */
+#define PDMIACPICONNECTOR_IID                   "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
 
 
@@ -1636,5 +1621,6 @@
 typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
 /**
- * VMMDevice port interface.
+ * VMMDevice port interface (down).
+ * Pair with PDMIVMMDEVCONNECTOR.
  */
 typedef struct PDMIVMMDEVPORT
@@ -1773,4 +1759,6 @@
 
 } PDMIVMMDEVPORT;
+/** PDMIVMMDEVPORT interface ID. */
+#define PDMIVMMDEVPORT_IID                      "d7e52035-3b6c-422e-9215-2a75646a945d"
 
 /** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
@@ -1797,5 +1785,5 @@
 typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
 /**
- * VMMDev connector interface.
+ * VMMDev connector interface (up).
  * Pair with PDMIVMMDEVPORT.
  */
@@ -1965,4 +1953,6 @@
 
 } PDMIVMMDEVCONNECTOR;
+/** PDMIVMMDEVCONNECTOR interface ID. */
+#define PDMIVMMDEVCONNECTOR_IID                 "38b96194-ee83-489e-b92e-73ee28a29439"
 
 
@@ -2111,5 +2101,6 @@
 typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
 /**
- * Audio connector interface.
+ * Audio connector interface (up).
+ * No interface pair yet.
  */
 typedef struct PDMIAUDIOCONNECTOR
@@ -2120,4 +2111,6 @@
 
 } PDMIAUDIOCONNECTOR;
+/** PDMIAUDIOCONNECTOR interface ID. */
+#define PDMIAUDIOCONNECTOR_IID                  "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
 
 
@@ -2127,13 +2120,15 @@
 /** Pointer to a Audio Sniffer Device port interface. */
 typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
-
-/**
- * Audio Sniffer port interface.
+/**
+ * Audio Sniffer port interface (down).
+ * Pair with PDMIAUDIOSNIFFERCONNECTOR.
  */
 typedef struct PDMIAUDIOSNIFFERPORT
 {
     /**
-     * Enables or disables sniffing. If sniffing is being enabled also sets a flag
-     * whether the audio must be also left on the host.
+     * Enables or disables sniffing.
+     *
+     * If sniffing is being enabled also sets a flag whether the audio must be also
+     * left on the host.
      *
      * @returns VBox status code
@@ -2147,4 +2142,7 @@
 
 } PDMIAUDIOSNIFFERPORT;
+/** PDMIAUDIOSNIFFERPORT interface ID. */
+#define PDMIAUDIOSNIFFERPORT_IID                "83b95e02-68cb-470d-9dfc-25a0f8efe197"
+
 
 /** Pointer to a Audio Sniffer connector interface. */
@@ -2152,5 +2150,5 @@
 
 /**
- * Audio Sniffer connector interface.
+ * Audio Sniffer connector interface (up).
  * Pair with PDMIAUDIOSNIFFERPORT.
  */
@@ -2184,4 +2182,6 @@
 
 } PDMIAUDIOSNIFFERCONNECTOR;
+/** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
+#define PDMIAUDIOSNIFFERCONNECTOR_IID           "433b64ab-e603-4933-bc97-8fe79b2bd0e0"
 
 
@@ -2244,10 +2244,12 @@
 typedef const PDMLED *PCPDMLED;
 
-#define PDMLED_MAGIC ( 0x11335577 )
+/** Magic value for PDMLED::u32Magic. */
+#define PDMLED_MAGIC    UINT32_C(0x11335577)
 
 /** Pointer to an LED ports interface. */
 typedef struct PDMILEDPORTS      *PPDMILEDPORTS;
 /**
- * Interface for exporting LEDs.
+ * Interface for exporting LEDs (down).
+ * Pair with PDMILEDCONNECTORS.
  */
 typedef struct PDMILEDPORTS
@@ -2264,4 +2266,6 @@
 
 } PDMILEDPORTS;
+/** PDMILEDPORTS interface ID. */
+#define PDMILEDPORTS_IID                        "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
 
 
@@ -2269,5 +2273,6 @@
 typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
 /**
- * Interface for reading LEDs.
+ * Interface for reading LEDs (up).
+ * Pair with PDMILEDPORTS.
  */
 typedef struct PDMILEDCONNECTORS
@@ -2284,4 +2289,6 @@
     DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
 } PDMILEDCONNECTORS;
+/** PDMILEDCONNECTORS interface ID. */
+#define PDMILEDCONNECTORS_IID                   "8ed63568-82a7-4193-b57b-db8085ac4495"
 
 
@@ -2303,7 +2310,8 @@
 /** Pointer to a HGCM port interface. */
 typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
-
-/**
- * HGCM port interface. Normally implemented by VMMDev.
+/**
+ * Host-Guest communication manager port interface (down). Normally implemented
+ * by VMMDev.
+ * Pair with PDMIHGCMCONNECTOR.
  */
 typedef struct PDMIHGCMPORT
@@ -2321,14 +2329,16 @@
 
 } PDMIHGCMPORT;
-
+/** PDMIHGCMPORT interface ID. */
+# define PDMIHGCMPORT_IID                       "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
+
+
+/** Pointer to a HGCM service location structure. */
+typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
 
 /** Pointer to a HGCM connector interface. */
 typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
-
-/** Pointer to a HGCM service location structure. */
-typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
-
-/**
- * HGCM connector interface.
+/**
+ * The Host-Guest communication manager connector interface (up). Normally
+ * implemented by Main::VMMDevInterface.
  * Pair with PDMIHGCMPORT.
  */
@@ -2374,6 +2384,8 @@
 
 } PDMIHGCMCONNECTOR;
-
-#endif
+/** PDMIHGCMCONNECTOR interface ID. */
+# define PDMIHGCMCONNECTOR_IID                  "a1104758-c888-4437-8f2a-7bac17865b5c"
+
+#endif /* VBOX_WITH_HGCM */
 
 /**
@@ -2422,7 +2434,6 @@
 /** Pointer to a SCSI port interface. */
 typedef struct PDMISCSIPORT *PPDMISCSIPORT;
-
-/**
- * SCSI port interface.
+/**
+ * SCSI command execution port interface (down).
  * Pair with PDMISCSICONNECTOR.
  */
@@ -2441,4 +2452,6 @@
 
 } PDMISCSIPORT;
+/** PDMISCSIPORT interface ID. */
+#define PDMISCSIPORT_IID                        "0f894add-714d-4a77-818e-a32fe3586ba4"
 
 
@@ -2446,5 +2459,5 @@
 typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
 /**
- * SCSI connector interface.
+ * SCSI command execution connector interface (up).
  * Pair with PDMISCSIPORT.
  */
@@ -2462,4 +2475,6 @@
 
 } PDMISCSICONNECTOR;
+/** PDMISCSICONNECTOR interface ID. */
+#define PDMISCSICONNECTOR_IID                   "94465fbd-a2f2-447e-88c9-7366421bfbfe"
 
 
Index: /trunk/include/VBox/vusb.h
===================================================================
--- /trunk/include/VBox/vusb.h	(revision 25983)
+++ /trunk/include/VBox/vusb.h	(revision 25984)
@@ -352,5 +352,6 @@
 
 /**
- * The VUSB RootHub port interface provided by the HCI.
+ * The VUSB RootHub port interface provided by the HCI (down).
+ * Pair with VUSBIROOTCONNECTOR
  */
 typedef struct VUSBIROOTHUBPORT
@@ -427,11 +428,14 @@
 
 } VUSBIROOTHUBPORT;
+/** VUSBIROOTHUBPORT interface ID. */
+#define VUSBIROOTHUBPORT_IID                    "e38e2978-7aa2-4860-94b6-9ef4a066d8a0"
 
 
 /** Pointer to a VUSB RootHub connector interface. */
 typedef struct VUSBIROOTHUBCONNECTOR *PVUSBIROOTHUBCONNECTOR;
-
-/**
- * The VUSB RootHub connector interface provided by the VBox USB RootHub driver.
+/**
+ * The VUSB RootHub connector interface provided by the VBox USB RootHub driver
+ * (up).
+ * Pair with VUSBIROOTHUBPORT.
  */
 typedef struct VUSBIROOTHUBCONNECTOR
@@ -510,4 +514,6 @@
 
 } VUSBIROOTHUBCONNECTOR;
+/** VUSBIROOTHUBCONNECTOR interface ID. */
+#define VUSBIROOTHUBCONNECTOR_IID               "d9a90c59-e3ff-4dff-9754-844557c3f7a0"
 
 
@@ -554,7 +560,7 @@
 /** Pointer to a Root Hub Configuration Interface. */
 typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
-
 /**
  * Root Hub Configuration Interface (intended for MAIN).
+ * No interface pair.
  */
 typedef struct VUSBIRHCONFIG
@@ -583,4 +589,7 @@
 
 } VUSBIRHCONFIG;
+/** VUSBIRHCONFIG interface ID. */
+#define VUSBIRHCONFIG_IID                       "c354cd97-e85f-465e-bc12-b58798465f52"
+
 
 #ifdef IN_RING3
@@ -641,5 +650,6 @@
 
 /**
- * USB Device Interface.
+ * USB Device Interface (up).
+ * No interface pair.
  */
 typedef struct VUSBIDEVICE
@@ -698,4 +708,6 @@
 
 } VUSBIDEVICE;
+/** VUSBIDEVICE interface ID. */
+#define VUSBIDEVICE_IID                         "88732dd3-0ccd-4625-b040-48804ac7a217"
 
 
Index: /trunk/include/iprt/assert.h
===================================================================
--- /trunk/include/iprt/assert.h	(revision 25983)
+++ /trunk/include/iprt/assert.h	(revision 25984)
@@ -672,4 +672,35 @@
 #endif
 
+/** @def AssertMsgStmt
+ * Assert that an expression is true.  If it's not print message and hit
+ * breakpoint and execute the statement.
+ *
+ * @param   expr    Expression which should be true.
+ * @param   a       printf argument list (in parenthesis).
+ * @param   stmt    Statement to execute in case of a failed assertion.
+ *
+ * @remarks The expression and statement will be evaluated in all build types.
+ */
+#ifdef RT_STRICT
+# define AssertMsgStmt(expr, a, stmt)  \
+    do { \
+        if (RT_UNLIKELY(!(expr))) \
+        { \
+            RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+            RTAssertMsg2Weak a; \
+            RTAssertPanic(); \
+            stmt; \
+        } \
+    } while (0)
+#else
+# define AssertMsgStmt(expr, a, stmt)  \
+    do { \
+        if (RT_UNLIKELY(!(expr))) \
+        { \
+            stmt; \
+        } \
+    } while (0)
+#endif
+
 /** @def AssertMsgReturn
  * Assert that an expression is true and returns if it isn't.
Index: /trunk/src/VBox/Devices/Audio/audio.c
===================================================================
--- /trunk/src/VBox/Devices/Audio/audio.c	(revision 25983)
+++ /trunk/src/VBox/Devices/Audio/audio.c	(revision 25984)
@@ -54,4 +54,7 @@
 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown"
 
+/**
+ * @implements PDMIAUDIOCONNECTOR
+ */
 typedef struct DRVAUDIO
 {
@@ -1934,6 +1937,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_AUDIO_CONNECTOR) == 0)
-        return &pThis->IAudioConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIAUDIOCONNECTOR, &pThis->IAudioConnector);
     return NULL;
 }
Index: /trunk/src/VBox/Devices/Audio/audiosniffer.c
===================================================================
--- /trunk/src/VBox/Devices/Audio/audiosniffer.c	(revision 25983)
+++ /trunk/src/VBox/Devices/Audio/audiosniffer.c	(revision 25984)
@@ -127,6 +127,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->Base;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_AUDIO_SNIFFER_PORT) == 0)
-        return &pThis->Port;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIAUDIOSNIFFERPORT, &pThis->Port);
     return NULL;
 }
@@ -184,11 +183,7 @@
     if (RT_SUCCESS(rc))
     {
-        pThis->pDrv = (PPDMIAUDIOSNIFFERCONNECTOR)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR);
-
-        if (!pThis->pDrv)
-        {
-            AssertMsgFailed(("LUN #0 doesn't have a Audio Sniffer connector interface rc=%Rrc\n", rc));
-            rc = VERR_PDM_MISSING_INTERFACE;
-        }
+        pThis->pDrv = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIAUDIOSNIFFERCONNECTOR);
+        AssertMsgStmt(pThis->pDrv, ("LUN #0 doesn't have a Audio Sniffer connector interface rc=%Rrc\n", rc),
+                      rc = VERR_PDM_MISSING_INTERFACE);
     }
     else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
Index: /trunk/src/VBox/Devices/Network/DevE1000.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 25984)
@@ -4471,6 +4471,5 @@
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKPORT, &pThis->INetworkPort);
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKCONFIG, &pThis->INetworkConfig);
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -5061,5 +5060,5 @@
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the status LUN"));
-    pState->pLedsConnector = (PPDMILEDCONNECTORS)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+    pState->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
 
     rc = PDMDevHlpDriverAttach(pDevIns, 0, &pState->IBase, &pState->pDrvBase, "Network Port");
Index: /trunk/src/VBox/Devices/Network/DevPCNet.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DevPCNet.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Network/DevPCNet.cpp	(revision 25984)
@@ -4491,6 +4491,5 @@
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKPORT, &pThis->INetworkPort);
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKCONFIG, &pThis->INetworkConfig);
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -5191,6 +5190,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->pLedsConnector = (PPDMILEDCONNECTORS)
-            pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/PC/DevACPI.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 25984)
@@ -1943,6 +1943,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_PORT) == 0)
-        return &pThis->IACPIPort;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIACPIPORT, &pThis->IACPIPort);
     return NULL;
 }
@@ -2504,5 +2503,5 @@
    if (RT_SUCCESS(rc))
    {
-       s->pDrv = (PPDMIACPICONNECTOR)s->pDrvBase->pfnQueryInterface(s->pDrvBase, PDMINTERFACE_ACPI_CONNECTOR);
+       s->pDrv = PDMIBASE_QUERY_INTERFACE(s->pDrvBase, PDMIACPICONNECTOR);
        if (!s->pDrv)
            return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_MISSING_INTERFACE,
Index: /trunk/src/VBox/Devices/PC/DrvACPI.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DrvACPI.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/PC/DrvACPI.cpp	(revision 25984)
@@ -91,6 +91,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_CONNECTOR) == 0)
-        return &pThis->IACPIConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIACPICONNECTOR, &pThis->IACPIConnector);
     return NULL;
 }
@@ -751,6 +750,5 @@
      * Query the ACPI port interface.
      */
-    pThis->pPort = (PPDMIACPIPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase,
-                                                                      PDMINTERFACE_ACPI_PORT);
+    pThis->pPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIACPIPORT);
     if (!pThis->pPort)
     {
Index: /trunk/src/VBox/Devices/Parallel/DevParallel.cpp
===================================================================
--- /trunk/src/VBox/Devices/Parallel/DevParallel.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Parallel/DevParallel.cpp	(revision 25984)
@@ -658,6 +658,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_PORT) == 0)
-        return &pThis->IHostParallelPort;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTPARALLELPORT, &pThis->IHostParallelPort);
     return NULL;
 }
@@ -832,11 +831,8 @@
     if (RT_SUCCESS(rc))
     {
-        pThis->pDrvHostParallelConnector = (PDMIHOSTPARALLELCONNECTOR *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase,
-                                                                                                           PDMINTERFACE_HOST_PARALLEL_CONNECTOR);
-        if (!pThis->pDrvHostParallelConnector)
-        {
-            AssertMsgFailed(("Configuration error: instance %d has no host parallel interface!\n", iInstance));
-            return VERR_PDM_MISSING_INTERFACE;
-        }
+        pThis->pDrvHostParallelConnector = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIHOSTPARALLELCONNECTOR);
+        AssertMsgReturn(pThis->pDrvHostParallelConnector,
+                        ("Configuration error: instance %d has no host parallel interface!\n", iInstance),
+                        VERR_PDM_MISSING_INTERFACE);
         /** @todo provide read notification interface!!!! */
     }
Index: /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
===================================================================
--- /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp	(revision 25984)
@@ -93,6 +93,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_CONNECTOR) == 0)
-        return &pThis->IHostParallelConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTPARALLELCONNECTOR, &pThis->IHostParallelConnector);
     return NULL;
 }
@@ -323,5 +322,5 @@
      * Get the IHostParallelPort interface of the above driver/device.
      */
-    pThis->pDrvHostParallelPort = (PPDMIHOSTPARALLELPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HOST_PARALLEL_PORT);
+    pThis->pDrvHostParallelPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIHOSTPARALLELPORT);
     if (!pThis->pDrvHostParallelPort)
         return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"),
Index: /trunk/src/VBox/Devices/Storage/DevAHCI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 25984)
@@ -2393,6 +2393,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -6859,5 +6858,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/Storage/DevATA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 25984)
@@ -5236,6 +5236,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -6775,5 +6774,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 25984)
@@ -2357,8 +2357,6 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDevice->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_PORT) == 0)
-        return &pDevice->ISCSIPort;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pDevice->ILed;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSIPORT, &pDevice->ISCSIPort);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pDevice->ILed);
     return NULL;
 }
@@ -2392,6 +2390,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -2458,5 +2455,5 @@
     {
         /* Get SCSI connector interface. */
-        pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR);
+        pDevice->pDrvSCSIConnector = PDMIBASE_QUERY_INTERFACE(pDevice->pDrvBase, PDMISCSICONNECTOR);
         AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE);
         pDevice->fPresent = true;
@@ -2642,5 +2639,5 @@
         {
             /* Get SCSI connector interface. */
-            pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR);
+            pDevice->pDrvSCSIConnector = PDMIBASE_QUERY_INTERFACE(pDevice->pDrvBase, PDMISCSICONNECTOR);
             AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE);
 
@@ -2667,5 +2664,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 25984)
@@ -4203,8 +4203,6 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDevice->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_PORT) == 0)
-        return &pDevice->ISCSIPort;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pDevice->ILed;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSIPORT, &pDevice->ISCSIPort);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pDevice->ILed);
     return NULL;
 }
@@ -4238,6 +4236,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -4309,5 +4306,5 @@
     {
         /* Get SCSI connector interface. */
-        pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR);
+        pDevice->pDrvSCSIConnector = PDMIBASE_QUERY_INTERFACE(pDevice->pDrvBase, PDMISCSICONNECTOR);
         AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE);
     }
@@ -4595,5 +4592,5 @@
         {
             /* Get SCSI connector interface. */
-            pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR);
+            pDevice->pDrvSCSIConnector = PDMIBASE_QUERY_INTERFACE(pDevice->pDrvBase, PDMISCSICONNECTOR);
             AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE);
         }
@@ -4617,5 +4614,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvSCSI.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DrvSCSI.cpp	(revision 25984)
@@ -807,6 +807,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_CONNECTOR) == 0)
-        return &pThis->ISCSIConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSICONNECTOR, &pThis->ISCSIConnector);
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBLOCKPORT, &pThis->IPort);
     return NULL;
@@ -972,5 +971,5 @@
 
     /* Query the SCSI port interface above. */
-    pThis->pDevScsiPort = (PPDMISCSIPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_SCSI_PORT);
+    pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
     AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE);
 
@@ -978,5 +977,5 @@
 
     /* Query the optional LED interface above. */
-    pThis->pLedPort = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS);
+    pThis->pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
     if (pThis->pLedPort != NULL)
     {
Index: /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp	(revision 25984)
@@ -406,6 +406,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_CONNECTOR) == 0)
-        return &pThis->ISCSIConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSICONNECTOR, &pThis->ISCSIConnector);
     return NULL;
 }
@@ -465,5 +464,5 @@
 
     /* Query the SCSI port interface above. */
-    pThis->pDevScsiPort = (PPDMISCSIPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_SCSI_PORT);
+    pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
     AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE);
 
Index: /trunk/src/VBox/Devices/Storage/fdc.c
===================================================================
--- /trunk/src/VBox/Devices/Storage/fdc.c	(revision 25983)
+++ /trunk/src/VBox/Devices/Storage/fdc.c	(revision 25984)
@@ -2542,6 +2542,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBaseStatus;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -2888,6 +2887,5 @@
     rc = PDMDevHlpDriverAttach (pDevIns, PDM_STATUS_LUN, &fdctrl->IBaseStatus, &pBase, "Status Port");
     if (RT_SUCCESS (rc)) {
-        fdctrl->pLedsConnector =
-            pBase->pfnQueryInterface (pBase, PDMINTERFACE_LED_CONNECTORS);
+        fdctrl->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     } else if (rc != VERR_PDM_NO_ATTACHED_DRIVER) {
         AssertMsgFailed (("Failed to attach to status driver. rc=%Rrc\n",
Index: /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 25984)
@@ -1836,13 +1836,10 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->Base;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_VMMDEV_PORT) == 0)
-        return &pThis->Port;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIVMMDEVPORT, &pThis->Port);
 #ifdef VBOX_WITH_HGCM
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_PORT) == 0)
-        return &pThis->HGCMPort;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHGCMPORT, &pThis->HGCMPort);
 #endif
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        /* Currently only for shared folders */
-        return &pThis->SharedFolders.ILeds;
+    /* Currently only for shared folders. */
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->SharedFolders.ILeds);
     return NULL;
 }
@@ -2590,9 +2587,8 @@
     if (RT_SUCCESS(rc))
     {
-        pThis->pDrv = (PPDMIVMMDEVCONNECTOR)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_VMMDEV_CONNECTOR);
-        if (!pThis->pDrv)
-            AssertMsgFailedReturn(("LUN #0 doesn't have a VMMDev connector interface!\n"), VERR_PDM_MISSING_INTERFACE);
+        pThis->pDrv = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIVMMDEVCONNECTOR);
+        AssertMsgReturn(pThis->pDrv, ("LUN #0 doesn't have a VMMDev connector interface!\n"), VERR_PDM_MISSING_INTERFACE);
 #ifdef VBOX_WITH_HGCM
-        pThis->pHGCMDrv = (PPDMIHGCMCONNECTOR)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_HGCM_CONNECTOR);
+        pThis->pHGCMDrv = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIHGCMCONNECTOR);
         if (!pThis->pHGCMDrv)
         {
@@ -2616,6 +2612,5 @@
     rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->Base, &pBase, "Status Port");
     if (RT_SUCCESS(rc))
-        pThis->SharedFolders.pLedsConnector = (PPDMILEDCONNECTORS)
-            pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+        pThis->SharedFolders.pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     {
Index: /trunk/src/VBox/Devices/VirtIO/Virtio.cpp
===================================================================
--- /trunk/src/VBox/Devices/VirtIO/Virtio.cpp	(revision 25983)
+++ /trunk/src/VBox/Devices/VirtIO/Virtio.cpp	(revision 25984)
@@ -533,6 +533,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pThis->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
-        return &pThis->ILeds;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
@@ -837,5 +836,5 @@
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the status LUN"));
-    pState->pLedsConnector = (PPDMILEDCONNECTORS)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
+    pState->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
 
     pState->nQueues = nQueues;
Index: /trunk/src/VBox/Frontends/VBoxBFE/HostUSBImpl.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/HostUSBImpl.cpp	(revision 25983)
+++ /trunk/src/VBox/Frontends/VBoxBFE/HostUSBImpl.cpp	(revision 25984)
@@ -224,6 +224,6 @@
         return setError (E_FAIL,
                          tr ("Device is not in a capturable state"));
-    PVUSBIRHCONFIG pRhConfig = (PVUSBIRHCONFIG)pBase->pfnQueryInterface (pBase, PDMINTERFACE_VUSB_RH_CONFIG);
-    AssertReturn (pRhConfig, E_FAIL);
+    PVUSBIRHCONFIG pRhConfig = PDMIBASE_QUERY_INTERFACE(pBase, VUSBIRHCONFIG);
+    AssertReturn(pRhConfig, E_FAIL);
 
     /*
@@ -293,6 +293,6 @@
         if (RT_SUCCESS (vrc))
         {
-            PVUSBIRHCONFIG pRhConfig = (PVUSBIRHCONFIG)pBase->pfnQueryInterface (pBase, PDMINTERFACE_VUSB_RH_CONFIG);
-            Assert (pRhConfig);
+            PVUSBIRHCONFIG pRhConfig = PDMIBASE_QUERY_INTERFACE(pBase, VUSBIRHCONFIG);
+            Assert(pRhConfig);
 
             RTUUID Uuid = aDevice->id();
Index: /trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.cpp	(revision 25983)
+++ /trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.cpp	(revision 25984)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -93,6 +93,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_CONNECTORS) == 0)
-        return &pDrv->ILedConnectors;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDCONNECTORS, &pDrv->ILedConnectors);
     return NULL;
 }
@@ -180,10 +179,7 @@
      * query the LEDs we want.
      */
-    pData->pLedPorts = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS);
-    if (!pData->pLedPorts)
-    {
-        AssertMsgFailed(("Configuration error: No led ports interface above!\n"));
-        return VERR_PDM_MISSING_INTERFACE_ABOVE;
-    }
+    pData->pLedPorts = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
+    AssertMsgReturn(pData->pLedPorts, ("Configuration error: No led ports interface above!\n"),
+                    VERR_PDM_MISSING_INTERFACE_ABOVE);
 
     for (unsigned i = pData->iFirstLUN; i <= pData->iLastLUN; i++)
Index: /trunk/src/VBox/Frontends/VBoxBFE/VMControl.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/VMControl.cpp	(revision 25983)
+++ /trunk/src/VBox/Frontends/VBoxBFE/VMControl.cpp	(revision 25984)
@@ -103,6 +103,5 @@
     {
         Assert (pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnPowerButtonPress(pPort) : VERR_INVALID_POINTER;
     }
@@ -121,6 +120,5 @@
     {
         Assert (pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnSleepButtonPress(pPort) : VERR_INVALID_POINTER;
     }
Index: /trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp	(revision 25983)
+++ /trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp	(revision 25984)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -353,13 +353,7 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_VMMDEV_CONNECTOR) == 0)
-        return &pDrv->Connector;
-#ifdef VBOX_WITH_HGCM
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_CONNECTOR) == 0)
-    {
-        if (fActivateHGCM())
-            return &pDrv->HGCMConnector;
-        return NULL;
-    }
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIVMMDEVCONNECTOR, &pDrv->Connector);
+#ifdef VBOX_WITH_HGCM
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHGCMCONNECTOR, fActivateHGCM() ? &pDrv->HGCMConnector : NULL);
 #endif
     return NULL;
@@ -426,20 +420,12 @@
      * Get the IVMMDevPort interface of the above driver/device.
      */
-    pData->pUpPort = (PPDMIVMMDEVPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_VMMDEV_PORT);
-    if (!pData->pUpPort)
-    {
-        AssertMsgFailed(("Configuration error: No VMMDev port interface above!\n"));
-        return VERR_PDM_MISSING_INTERFACE_ABOVE;
-    }
+    pData->pUpPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIVMMDEVPORT);
+    AssertMsgReturn(pData->pUpPort, ("Configuration error: No VMMDev port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
 
 #ifdef VBOX_WITH_HGCM
     if (fActivateHGCM())
     {
-        pData->pHGCMPort = (PPDMIHGCMPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HGCM_PORT);
-        if (!pData->pHGCMPort)
-        {
-            AssertMsgFailed(("Configuration error: No HGCM port interface above!\n"));
-            return VERR_PDM_MISSING_INTERFACE_ABOVE;
-        }
+        pData->pHGCMPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIHGCMPORT);
+        AssertMsgReturn(pData->pHGCMPort, ("Configuration error: No HGCM port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
     }
 #endif
Index: /trunk/src/VBox/Main/AudioSnifferInterface.cpp
===================================================================
--- /trunk/src/VBox/Main/AudioSnifferInterface.cpp	(revision 25983)
+++ /trunk/src/VBox/Main/AudioSnifferInterface.cpp	(revision 25984)
@@ -126,6 +126,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR) == 0)
-        return &pDrv->Connector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIAUDIOSNIFFERCONNECTOR, &pDrv->Connector);
     return NULL;
 }
@@ -181,5 +180,5 @@
      * Get the Audio Sniffer Port interface of the above driver/device.
      */
-    pThis->pUpPort = (PPDMIAUDIOSNIFFERPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_AUDIO_SNIFFER_PORT);
+    pThis->pUpPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOSNIFFERPORT);
     if (!pThis->pUpPort)
     {
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 25983)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 25984)
@@ -1787,6 +1787,5 @@
         Assert(pBase);
 
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
 
         vrc = getVMMDev()->getVMMDevPort()->pfnCpuHotUnplug(getVMMDev()->getVMMDevPort(), idCpuCore, idCpuPackage);
@@ -2083,6 +2082,5 @@
     {
         Assert(pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnPowerButtonPress(pPort) : VERR_INVALID_POINTER;
     }
@@ -2128,6 +2126,5 @@
     {
         Assert(pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnGetPowerButtonHandled(pPort, &handled) : VERR_INVALID_POINTER;
     }
@@ -2175,6 +2172,5 @@
     {
         Assert(pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnGetGuestEnteredACPIMode(pPort, &entered) : VERR_INVALID_POINTER;
     }
@@ -2209,6 +2205,5 @@
     {
         Assert(pBase);
-        PPDMIACPIPORT pPort =
-            (PPDMIACPIPORT) pBase->pfnQueryInterface(pBase, PDMINTERFACE_ACPI_PORT);
+        PPDMIACPIPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIACPIPORT);
         vrc = pPort ? pPort->pfnSleepButtonPress(pPort) : VERR_INVALID_POINTER;
     }
@@ -8137,6 +8132,5 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_CONNECTORS) == 0)
-        return &pThis->ILedConnectors;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDCONNECTORS, &pThis->ILedConnectors);
     return NULL;
 }
@@ -8224,10 +8218,7 @@
      * query the LEDs we want.
      */
-    pData->pLedPorts = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS);
-    if (!pData->pLedPorts)
-    {
-        AssertMsgFailed(("Configuration error: No led ports interface above!\n"));
-        return VERR_PDM_MISSING_INTERFACE_ABOVE;
-    }
+    pData->pLedPorts = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
+    AssertMsgReturn(pData->pLedPorts, ("Configuration error: No led ports interface above!\n"),
+                    VERR_PDM_MISSING_INTERFACE_ABOVE);
 
     for (unsigned i = pData->iFirstLUN; i <= pData->iLastLUN; ++i)
Index: /trunk/src/VBox/Main/VMMDevInterface.cpp
===================================================================
--- /trunk/src/VBox/Main/VMMDevInterface.cpp	(revision 25983)
+++ /trunk/src/VBox/Main/VMMDevInterface.cpp	(revision 25984)
@@ -661,9 +661,7 @@
     if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
         return &pDrvIns->IBase;
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_VMMDEV_CONNECTOR) == 0)
-        return &pDrv->Connector;
-#ifdef VBOX_WITH_HGCM
-    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_CONNECTOR) == 0)
-        return &pDrv->HGCMConnector;
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIVMMDEVCONNECTOR, &pDrv->Connector);
+#ifdef VBOX_WITH_HGCM
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHGCMCONNECTOR, &pDrv->HGCMConnector);
 #endif
     return NULL;
@@ -751,18 +749,10 @@
      * Get the IVMMDevPort interface of the above driver/device.
      */
-    pData->pUpPort = (PPDMIVMMDEVPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_VMMDEV_PORT);
-    if (!pData->pUpPort)
-    {
-        AssertMsgFailed(("Configuration error: No VMMDev port interface above!\n"));
-        return VERR_PDM_MISSING_INTERFACE_ABOVE;
-    }
-
-#ifdef VBOX_WITH_HGCM
-    pData->pHGCMPort = (PPDMIHGCMPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HGCM_PORT);
-    if (!pData->pHGCMPort)
-    {
-        AssertMsgFailed(("Configuration error: No HGCM port interface above!\n"));
-        return VERR_PDM_MISSING_INTERFACE_ABOVE;
-    }
+    pData->pUpPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIVMMDEVPORT);
+    AssertMsgReturn(pData->pUpPort, ("Configuration error: No VMMDev port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
+
+#ifdef VBOX_WITH_HGCM
+    pData->pHGCMPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIHGCMPORT);
+    AssertMsgReturn(pData->pHGCMPort, ("Configuration error: No HGCM port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
 #endif
 
@@ -791,10 +781,6 @@
 
         LogRel(("Shared Folders service loaded.\n"));
-        pLedPort = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS);
-        if (!pLedPort)
-        {
-            AssertMsgFailed(("Configuration error: No LED port interface above!\n"));
-            return VERR_PDM_MISSING_INTERFACE_ABOVE;
-        }
+        pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
+        AssertMsgReturn(pLedPort, ("Configuration error: No LED port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
         rc = pLedPort->pfnQueryStatusLed(pLedPort, 0, &pLed);
         if (RT_SUCCESS(rc) && pLed)
