Index: /trunk/src/VBox/Devices/Audio/DevHda.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevHda.cpp	(revision 88560)
+++ /trunk/src/VBox/Devices/Audio/DevHda.cpp	(revision 88561)
@@ -4472,4 +4472,5 @@
 }
 
+
 /**
  * @interface_method_impl{PDMDEVREG,pfnAttach}
@@ -4496,4 +4497,5 @@
     return VINF_SUCCESS;
 }
+
 
 /**
@@ -4527,4 +4529,5 @@
 }
 
+
 /**
  * Powers off the device.
@@ -4558,4 +4561,6 @@
 }
 
+
+# ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT
 /**
  * Replaces a driver with a the NullAudio drivers.
@@ -4575,4 +4580,5 @@
     return rc;
 }
+# endif
 
 
@@ -4905,12 +4911,5 @@
             break;
         }
-        if (rc == VERR_AUDIO_BACKEND_INIT_FAILED)
-        {
-            hdaR3ReconfigLunWithNullAudio(pDevIns, pThis, pThisCC, iLun); /* Pretend attaching to the NULL audio backend will never fail. */
-            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
-                                       N_("Host audio backend initialization has failed. Selecting the NULL audio backend with the consequence that no sound is audible"));
-        }
-        else
-            AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
+        AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
     }
 
Index: /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 88560)
+++ /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 88561)
@@ -4113,4 +4113,6 @@
 }
 
+
+# ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT
 /**
  * Replaces a driver with a the NullAudio drivers.
@@ -4129,4 +4131,6 @@
     return rc;
 }
+# endif
+
 
 /**
@@ -4311,13 +4315,5 @@
             break;
         }
-        if (rc == VERR_AUDIO_BACKEND_INIT_FAILED)
-        {
-            ichac97R3ReconfigLunWithNullAudio(pDevIns, pThisCC, iLun); /* Pretend attaching to the NULL audio backend will never fail. */
-            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
-                                       N_("Host audio backend initialization has failed. "
-                                          "Selecting the NULL audio backend with the consequence that no sound is audible"));
-        }
-        else
-            AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
+        AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
     }
 
Index: /trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 88560)
+++ /trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 88561)
@@ -2253,4 +2253,6 @@
 }
 
+
+#ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT
 /**
  * Replaces a driver with a the NullAudio drivers.
@@ -2268,4 +2270,6 @@
     return rc;
 }
+#endif
+
 
 /**
@@ -2494,13 +2498,5 @@
             break;
         }
-        if (rc == VERR_AUDIO_BACKEND_INIT_FAILED)
-        {
-            sb16ReconfigLunWithNullAudio(pThis, iLun); /* Pretend attaching to the NULL audio backend will never fail. */
-            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
-                                       N_("Host audio backend initialization has failed. "
-                                          "Selecting the NULL audio backend with the consequence that no sound is audible"));
-        }
-        else
-            AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
+        AssertLogRelMsgReturn(RT_SUCCESS(rc),  ("LUN#%u: rc=%Rrc\n", iLun, rc), rc);
     }
 
Index: /trunk/src/VBox/Devices/Audio/DrvAudio.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 88560)
+++ /trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 88561)
@@ -2251,10 +2251,4 @@
 /**
  * Initializes the host backend and queries its initial configuration.
- * If the host backend fails, VERR_AUDIO_BACKEND_INIT_FAILED will be returned.
- *
- * Note: As this routine is called when attaching to the device LUN in the
- *       device emulation, we either check for success or VERR_AUDIO_BACKEND_INIT_FAILED.
- *       Everything else is considered as fatal and must be handled separately in
- *       the device emulation!
  *
  * @returns VBox status code.
@@ -3030,9 +3024,6 @@
             /* Retrieve host driver name for easier identification. */
             AssertPtr(pThis->pHostDrvAudio);
-            PPDMDRVINS pDrvAudioInst = PDMIBASE_2_PDMDRV(pThis->pDrvIns->pDownBase);
             RTStrPrintf(pStreamEx->Core.szName, RT_ELEMENTS(pStreamEx->Core.szName), "[%s] %s",
-                        pDrvAudioInst && pDrvAudioInst->pReg && pDrvAudioInst->pReg->szName[0]
-                        ? pDrvAudioInst->pReg->szName : "none",
-                        pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<Untitled>");
+                        pThis->BackendCfg.szName, pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<Untitled>");
 
             pStreamEx->Core.enmDir    = pCfgHost->enmDir;
@@ -3756,8 +3747,9 @@
  *
  * @returns VBox status code.
+ * @param   pDrvIns     The driver instance.
  * @param   pThis       Pointer to driver instance.
  * @param   fFlags      Attach flags; see PDMDrvHlpAttach().
  */
-static int drvAudioDoAttachInternal(PDRVAUDIO pThis, uint32_t fFlags)
+static int drvAudioDoAttachInternal(PPDMDRVINS pDrvIns, PDRVAUDIO pThis, uint32_t fFlags)
 {
     Assert(pThis->pHostDrvAudio == NULL); /* No nested attaching. */
@@ -3767,5 +3759,5 @@
      */
     PPDMIBASE pDownBase;
-    int rc = PDMDrvHlpAttach(pThis->pDrvIns, fFlags, &pDownBase);
+    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase);
     if (RT_SUCCESS(rc))
     {
@@ -3787,18 +3779,29 @@
         }
     }
-
-    /*
-     * Do some status code simplification for beningn host driver init failures.
-     * The device above us will then replace it will the Null driver.
-     */
-    /** @todo Do the Null driver replacment here, then we don't have to duplicate
-     *        it in 3+ devices! */
-    if (   rc == VERR_MODULE_NOT_FOUND
-        || rc == VERR_SYMBOL_NOT_FOUND
-        || rc == VERR_FILE_NOT_FOUND
-        || rc == VERR_PATH_NOT_FOUND)
-    {
-        LogRel(("Audio: %Rrc -> VERR_AUDIO_BACKEND_INIT_FAILED\n", rc));
-        rc = VERR_AUDIO_BACKEND_INIT_FAILED;
+    /*
+     * If the host driver below us failed to construct for some beningn reason,
+     * we'll report it as a runtime error and replace it with the Null driver.
+     *
+     * Note! We do NOT change anything in PDM (or CFGM), so pDrvIns->pDownBase
+     *       will remain NULL in this case.
+     */
+    else if (   rc == VERR_AUDIO_BACKEND_INIT_FAILED
+             || rc == VERR_MODULE_NOT_FOUND
+             || rc == VERR_SYMBOL_NOT_FOUND
+             || rc == VERR_FILE_NOT_FOUND
+             || rc == VERR_PATH_NOT_FOUND)
+    {
+        /* Complain: */
+        LogRel(("DrvAudio: Host audio driver '%s' init failed with %Rrc. Switching to the NULL driver for now.\n",
+                pThis->szName, rc));
+        PDMDrvHlpVMSetRuntimeError(pDrvIns, 0 /*fFlags*/, "HostAudioNotResponding",
+                                   N_("Host audio backend (%s) initialization has failed. Selecting the NULL audio backend with the consequence that no sound is audible"),
+                                   pThis->szName);
+
+        /* Replace with null audio: */
+        pThis->pHostDrvAudio = (PPDMIHOSTAUDIO)&g_DrvHostAudioNull;
+        RTStrCopy(pThis->szName, sizeof(pThis->szName), "NULL");
+        rc = drvAudioHostInit(pThis);
+        AssertRC(rc);
     }
 
@@ -3823,5 +3826,5 @@
     AssertRCReturn(rc, rc);
 
-    rc = drvAudioDoAttachInternal(pThis, fFlags);
+    rc = drvAudioDoAttachInternal(pDrvIns, pThis, fFlags);
 
     RTCritSectLeave(&pThis->CritSect);
@@ -4178,5 +4181,5 @@
      * Attach the host driver, if present.
      */
-    rc = drvAudioDoAttachInternal(pThis, fFlags);
+    rc = drvAudioDoAttachInternal(pDrvIns, pThis, fFlags);
     if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
         rc = VINF_SUCCESS;
Index: /trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp	(revision 88560)
+++ /trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp	(revision 88561)
@@ -22,5 +22,4 @@
 *   Header Files                                                                                                                 *
 *********************************************************************************************************************************/
-#include <iprt/mem.h>
 #include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
 
@@ -44,18 +43,4 @@
 /** Pointer to a null audio stream.   */
 typedef NULLAUDIOSTREAM *PNULLAUDIOSTREAM;
-
-/**
- * NULL audio driver instance data.
- * @implements PDMIAUDIOCONNECTOR
- */
-typedef struct DRVHOSTNULLAUDIO
-{
-    /** Pointer to the driver instance structure. */
-    PPDMDRVINS          pDrvIns;
-    /** Pointer to host audio interface. */
-    PDMIHOSTAUDIO       IHostAudio;
-} DRVHOSTNULLAUDIO;
-/** Pointer to the instance data for a null audio host driver. */
-typedef DRVHOSTNULLAUDIO *PDRVHOSTNULLAUDIO;
 
 
@@ -237,4 +222,25 @@
 
 /**
+ * This is used directly by DrvAudio when a backend fails to initialize in a
+ * non-fatal manner.
+ */
+DECL_HIDDEN_CONST(PDMIHOSTAUDIO) const g_DrvHostAudioNull =
+{
+    /* .pfnGetConfig          =*/ drvHostNullAudioHA_GetConfig,
+    /* .pfnGetDevices         =*/ NULL,
+    /* .pfnGetStatus          =*/ drvHostNullAudioHA_GetStatus,
+    /* .pfnStreamCreate       =*/ drvHostNullAudioHA_StreamCreate,
+    /* .pfnStreamDestroy      =*/ drvHostNullAudioHA_StreamDestroy,
+    /* .pfnStreamControl      =*/ drvHostNullAudioHA_StreamControl,
+    /* .pfnStreamGetReadable  =*/ drvHostNullAudioHA_StreamGetReadable,
+    /* .pfnStreamGetWritable  =*/ drvHostNullAudioHA_StreamGetWritable,
+    /* .pfnStreamGetPending   =*/ drvHostNullAudioHA_StreamGetPending,
+    /* .pfnStreamGetStatus    =*/ drvHostNullAudioHA_StreamGetStatus,
+    /* .pfnStreamPlay         =*/ drvHostNullAudioHA_StreamPlay,
+    /* .pfnStreamCapture      =*/ drvHostNullAudioHA_StreamCapture,
+};
+
+
+/**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
@@ -242,8 +248,8 @@
 {
     PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
-    PDRVHOSTNULLAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);
+    PPDMIHOSTAUDIO    pThis   = PDMINS_2_DATA(pDrvIns, PPDMIHOSTAUDIO);
 
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, pThis);
     return NULL;
 }
@@ -258,5 +264,5 @@
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
-    PDRVHOSTNULLAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);
+    PPDMIHOSTAUDIO pThis = PDMINS_2_DATA(pDrvIns, PPDMIHOSTAUDIO);
     RT_NOREF(pCfg, fFlags);
     LogRel(("Audio: Initializing NULL driver\n"));
@@ -265,20 +271,8 @@
      * Init the static parts.
      */
-    pThis->pDrvIns                   = pDrvIns;
     /* IBase */
     pDrvIns->IBase.pfnQueryInterface = drvHostNullAudioQueryInterface;
     /* IHostAudio */
-    pThis->IHostAudio.pfnGetConfig          = drvHostNullAudioHA_GetConfig;
-    pThis->IHostAudio.pfnGetDevices         = NULL;
-    pThis->IHostAudio.pfnGetStatus          = drvHostNullAudioHA_GetStatus;
-    pThis->IHostAudio.pfnStreamCreate       = drvHostNullAudioHA_StreamCreate;
-    pThis->IHostAudio.pfnStreamDestroy      = drvHostNullAudioHA_StreamDestroy;
-    pThis->IHostAudio.pfnStreamControl      = drvHostNullAudioHA_StreamControl;
-    pThis->IHostAudio.pfnStreamGetReadable  = drvHostNullAudioHA_StreamGetReadable;
-    pThis->IHostAudio.pfnStreamGetWritable  = drvHostNullAudioHA_StreamGetWritable;
-    pThis->IHostAudio.pfnStreamGetPending   = drvHostNullAudioHA_StreamGetPending;
-    pThis->IHostAudio.pfnStreamGetStatus    = drvHostNullAudioHA_StreamGetStatus;
-    pThis->IHostAudio.pfnStreamPlay         = drvHostNullAudioHA_StreamPlay;
-    pThis->IHostAudio.pfnStreamCapture      = drvHostNullAudioHA_StreamCapture;
+    *pThis = g_DrvHostAudioNull;
 
     return VINF_SUCCESS;
@@ -308,5 +302,5 @@
     ~0U,
     /* cbInstance */
-    sizeof(DRVHOSTNULLAUDIO),
+    sizeof(PDMIHOSTAUDIO),
     /* pfnConstruct */
     drvHostNullAudioConstruct,
Index: /trunk/src/VBox/Devices/build/VBoxDD.h
===================================================================
--- /trunk/src/VBox/Devices/build/VBoxDD.h	(revision 88560)
+++ /trunk/src/VBox/Devices/build/VBoxDD.h	(revision 88561)
@@ -138,4 +138,5 @@
 #endif
 extern const PDMDRVREG g_DrvHostNullAudio;
+extern DECL_HIDDEN_DATA(struct PDMIHOSTAUDIO) const g_DrvHostAudioNull;
 #if defined(RT_OS_WINDOWS)
 extern const PDMDRVREG g_DrvHostDSound;
