Index: /trunk/src/VBox/Devices/Audio/DevHDA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 82318)
+++ /trunk/src/VBox/Devices/Audio/DevHDA.cpp	(revision 82319)
@@ -3341,5 +3341,5 @@
 
 /**
- * @callback_method_impl{FNIOMMMIOWNEWWRITE,
+ * @callback_method_impl{FNIOMMMIONEWWRITE,
  *      Looks up and calls the appropriate handler.}
  */
@@ -4724,5 +4724,6 @@
 {
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
-    PHDASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
+    PHDASTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
+    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
     Assert(iInstance == 0); RT_NOREF(iInstance);
 
@@ -4736,24 +4737,9 @@
 
     /*
-     * Validations.
+     * Validate and read configuration.
      */
-    if (!CFGMR3AreValuesValid(pCfg, "RZEnabled\0"
-                                    "TimerHz\0"
-                                    "PosAdjustEnabled\0"
-                                    "PosAdjustFrames\0"
-                                    "DebugEnabled\0"
-                                    "DebugPathOut\0"))
-    {
-        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
-                                N_ ("Invalid configuration for the Intel HDA device"));
-    }
-
-    int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("HDA configuration error: failed to read RCEnabled as boolean"));
-
-
-    rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
+    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "TimerHz|PosAdjustEnabled|PosAdjustFrames|DebugEnabled|DebugPathOut", "");
+
+    int rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
@@ -4763,5 +4749,5 @@
         LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz));
 
-    rc = CFGMR3QueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
+    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
@@ -4771,5 +4757,5 @@
         LogRel(("HDA: Position adjustment is disabled\n"));
 
-    rc = CFGMR3QueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
+    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
@@ -4779,17 +4765,14 @@
         LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames));
 
-    rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
+    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("HDA configuration error: failed to read debugging enabled flag as boolean"));
 
-    rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
-                              VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
+    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
+                                     VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("HDA configuration error: failed to read debugging output path flag as string"));
-
-    if (!strlen(pThis->Dbg.szOutPath))
-        RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
 
     if (pThis->Dbg.fEnabled)
Index: /trunk/src/VBox/Devices/Audio/DevHDA.h
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevHDA.h	(revision 82318)
+++ /trunk/src/VBox/Devices/Audio/DevHDA.h	(revision 82319)
@@ -134,8 +134,6 @@
     /** DMA position buffer enable bit. */
     bool                    fDMAPosition;
-    /** Flag whether the R0 and RC parts are enabled. */
-    bool                    fRZEnabled;
     /** Reserved. */
-    bool                    fPadding1b;
+    bool                    afPadding1b[2];
     /** Number of active (running) SDn streams. */
     uint8_t                 cStreamsActive;
Index: /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 82318)
+++ /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 82319)
@@ -492,7 +492,5 @@
     /** RC pointer to the device instance. */
     PPDMDEVINSRC            pDevInsRC;
-    /** Set if R0/RC is enabled. */
-    bool                    fRZEnabled;
-    bool                    afPadding0[3];
+    bool                    afPadding0[4];
     /** Global Control (Bus Master Control Register). */
     uint32_t                glob_cnt;
@@ -4042,5 +4040,6 @@
 {
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
-    PAC97STATE pThis = PDMDEVINS_2_DATA(pDevIns, PAC97STATE);
+    PAC97STATE      pThis   = PDMDEVINS_2_DATA(pDevIns, PAC97STATE);
+    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
     Assert(iInstance == 0); RT_NOREF(iInstance);
 
@@ -4055,29 +4054,15 @@
 
     /*
-     * Validations.
+     * Validate and read configuration.
      */
-    if (!CFGMR3AreValuesValid(pCfg, "RZEnabled\0"
-                                    "Codec\0"
-                                    "TimerHz\0"
-                                    "DebugEnabled\0"
-                                    "DebugPathOut\0"))
-        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
-                                N_("Invalid configuration for the AC'97 device"));
-
-    /*
-     * Read config data.
-     */
-    int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("AC'97 configuration error: failed to read RCEnabled as boolean"));
+    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "Codec|TimerHz|DebugEnabled|DebugPathOut", "");
 
     char szCodec[20];
-    rc = CFGMR3QueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700");
+    int rc = pHlp->pfnCFGMQueryStringDef(pCfg, "Codec", &szCodec[0], sizeof(szCodec), "STAC9700");
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
                                 N_("AC'97 configuration error: Querying \"Codec\" as string failed"));
 
-    rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, AC97_TIMER_HZ_DEFAULT /* Default value, if not set. */);
+    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, AC97_TIMER_HZ_DEFAULT /* Default value, if not set. */);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
@@ -4087,17 +4072,14 @@
         LogRel(("AC97: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz));
 
-    rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
+    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("AC97 configuration error: failed to read debugging enabled flag as boolean"));
 
-    rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
-                              VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
+    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
+                                     VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("AC97 configuration error: failed to read debugging output path flag as string"));
-
-    if (!strlen(pThis->Dbg.szOutPath))
-        RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
 
     if (pThis->Dbg.fEnabled)
Index: /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 82318)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 82319)
@@ -2843,13 +2843,11 @@
         if (fAudioEnabled)
         {
-            Utf8Str strAudioDevice;
-
-            AudioControllerType_T audioController;
-            hrc = audioAdapter->COMGETTER(AudioController)(&audioController);               H();
-            AudioCodecType_T audioCodec;
-            hrc = audioAdapter->COMGETTER(AudioCodec)(&audioCodec);                         H();
+            AudioControllerType_T enmAudioController;
+            hrc = audioAdapter->COMGETTER(AudioController)(&enmAudioController);            H();
+            AudioCodecType_T enmAudioCodec;
+            hrc = audioAdapter->COMGETTER(AudioCodec)(&enmAudioCodec);                      H();
 
             GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/Audio/Debug/Enabled", &strTmp);
-            const uint64_t fDebugEnabled = (strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1")) ? 1 : 0;
+            const bool fDebugEnabled = strTmp.equalsIgnoreCase("true") || strTmp.equalsIgnoreCase("1");
 
             Utf8Str strDebugPathOut;
@@ -2859,28 +2857,30 @@
              *        without duplicating (more) code. */
 
-            switch (audioController)
+            const char *pszAudioDevice;
+            switch (enmAudioController)
             {
                 case AudioControllerType_AC97:
                 {
                     /* ICH AC'97. */
-                    strAudioDevice = "ichac97";
-
-                    InsertConfigNode   (pDevices, strAudioDevice.c_str(),  &pDev);
-                    InsertConfigNode   (pDev,     "0",                     &pInst);
-                    InsertConfigInteger(pInst,    "Trusted",               1); /* boolean */
-                    hrc = pBusMgr->assignPCIDevice(strAudioDevice.c_str(), pInst);          H();
-                    InsertConfigNode   (pInst,    "Config",                &pCfg);
-                    switch (audioCodec)
+                    pszAudioDevice = "ichac97";
+
+                    InsertConfigNode(pDevices,      pszAudioDevice,         &pDev);
+                    InsertConfigNode(pDev,          "0",                    &pInst);
+                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
+                    hrc = pBusMgr->assignPCIDevice(pszAudioDevice, pInst);              H();
+                    InsertConfigNode(pInst,         "Config",               &pCfg);
+                    switch (enmAudioCodec)
                     {
                         case AudioCodecType_STAC9700:
-                            InsertConfigString(pCfg,   "Codec", "STAC9700");
+                            InsertConfigString(pCfg, "Codec",               "STAC9700");
                             break;
                         case AudioCodecType_AD1980:
-                            InsertConfigString(pCfg,   "Codec", "AD1980");
+                            InsertConfigString(pCfg, "Codec",               "AD1980");
                             break;
                         default: AssertFailedBreak();
                     }
-                    InsertConfigInteger(pCfg, "DebugEnabled", fDebugEnabled);
-                    InsertConfigString (pCfg, "DebugPathOut", strDebugPathOut);
+                    InsertConfigInteger(pCfg,       "DebugEnabled",         fDebugEnabled);
+                    if (strDebugPathOut.isNotEmpty())
+                        InsertConfigString(pCfg,    "DebugPathOut",         strDebugPathOut);
                     break;
                 }
@@ -2888,15 +2888,15 @@
                 {
                     /* Legacy SoundBlaster16. */
-                    strAudioDevice = "sb16";
-
-                    InsertConfigNode   (pDevices, strAudioDevice.c_str(), &pDev);
-                    InsertConfigNode   (pDev,     "0", &pInst);
-                    InsertConfigInteger(pInst,    "Trusted",              1); /* boolean */
-                    InsertConfigNode   (pInst,    "Config",               &pCfg);
-                    InsertConfigInteger(pCfg,     "IRQ",                  5);
-                    InsertConfigInteger(pCfg,     "DMA",                  1);
-                    InsertConfigInteger(pCfg,     "DMA16",                5);
-                    InsertConfigInteger(pCfg,     "Port",                 0x220);
-                    InsertConfigInteger(pCfg,     "Version",              0x0405);
+                    pszAudioDevice = "sb16";
+
+                    InsertConfigNode(pDevices,      pszAudioDevice,         &pDev);
+                    InsertConfigNode(pDev,          "0", &pInst);
+                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
+                    InsertConfigNode(pInst,         "Config",               &pCfg);
+                    InsertConfigInteger(pCfg,       "IRQ",                  5);
+                    InsertConfigInteger(pCfg,       "DMA",                  1);
+                    InsertConfigInteger(pCfg,       "DMA16",                5);
+                    InsertConfigInteger(pCfg,       "Port",                 0x220);
+                    InsertConfigInteger(pCfg,       "Version",              0x0405);
                     break;
                 }
@@ -2904,13 +2904,14 @@
                 {
                     /* Intel HD Audio. */
-                    strAudioDevice = "hda";
-
-                    InsertConfigNode   (pDevices, strAudioDevice.c_str(),  &pDev);
-                    InsertConfigNode   (pDev,     "0",                     &pInst);
-                    InsertConfigInteger(pInst,    "Trusted",               1); /* boolean */
-                    hrc = pBusMgr->assignPCIDevice(strAudioDevice.c_str(), pInst);          H();
-                    InsertConfigNode   (pInst,    "Config",                &pCfg);
-                    InsertConfigInteger(pCfg,     "DebugEnabled",          fDebugEnabled);
-                    InsertConfigString (pCfg,     "DebugPathOut",          strDebugPathOut);
+                    pszAudioDevice = "hda";
+
+                    InsertConfigNode(pDevices,      pszAudioDevice,         &pDev);
+                    InsertConfigNode(pDev,          "0",                    &pInst);
+                    InsertConfigInteger(pInst,      "Trusted",              1); /* boolean */
+                    hrc = pBusMgr->assignPCIDevice(pszAudioDevice, pInst);              H();
+                    InsertConfigNode(pInst,         "Config",               &pCfg);
+                    InsertConfigInteger(pCfg,       "DebugEnabled",         fDebugEnabled);
+                    if (strDebugPathOut.isNotEmpty())
+                        InsertConfigString(pCfg,    "DebugPathOut",         strDebugPathOut);
                     break;
                 }
@@ -3016,5 +3017,5 @@
             InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
             InsertConfigString(pLunL0, "Driver", "AUDIO");
-            AudioDriverCfg DrvCfgVRDE(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVRDE");
+            AudioDriverCfg DrvCfgVRDE(pszAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVRDE");
             rc = mAudioVRDE->InitializeConfig(&DrvCfgVRDE);
             if (RT_SUCCESS(rc))
@@ -3026,5 +3027,5 @@
             InsertConfigNodeF(pInst, &pLunL0, "LUN#%u", uAudioLUN);
             InsertConfigString(pLunL0, "Driver", "AUDIO");
-            AudioDriverCfg DrvCfgVideoRec(strAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVideoRec");
+            AudioDriverCfg DrvCfgVideoRec(pszAudioDevice, 0 /* Instance */, uAudioLUN, "AudioVideoRec");
             rc = Recording.mAudioRec->InitializeConfig(&DrvCfgVideoRec);
             if (RT_SUCCESS(rc))
@@ -3044,10 +3045,10 @@
                  * Tweak the logging groups.
                  */
-                Utf8Str strLogGroups = "drv_host_audio.e.l.l2.l3.f+" \
-                                       "drv_audio.e.l.l2.l3.f+" \
-                                       "audio_mixer.e.l.l2.l3.f+" \
-                                       "dev_hda_codec.e.l.l2.l3.f+" \
-                                       "dev_hda.e.l.l2.l3.f+" \
-                                       "dev_ac97.e.l.l2.l3.f+" \
+                Utf8Str strLogGroups = "drv_host_audio.e.l.l2.l3.f+"
+                                       "drv_audio.e.l.l2.l3.f+"
+                                       "audio_mixer.e.l.l2.l3.f+"
+                                       "dev_hda_codec.e.l.l2.l3.f+"
+                                       "dev_hda.e.l.l2.l3.f+"
+                                       "dev_ac97.e.l.l2.l3.f+"
                                        "dev_sb16.e.l.l2.l3.f";
 
