Index: /trunk/include/VBox/cfgm.h
===================================================================
--- /trunk/include/VBox/cfgm.h	(revision 30954)
+++ /trunk/include/VBox/cfgm.h	(revision 30955)
@@ -98,5 +98,8 @@
 VMMR3DECL(int)          CFGMR3InsertInteger(PCFGMNODE pNode, const char *pszName, uint64_t u64Integer);
 VMMR3DECL(int)          CFGMR3InsertString(PCFGMNODE pNode, const char *pszName, const char *pszString);
-VMMR3DECL(int)          CFGMR3InsertStringLengthKnown(PCFGMNODE pNode, const char *pszName, const char *pszString, size_t cbString);
+VMMR3DECL(int)          CFGMR3InsertStringN(PCFGMNODE pNode, const char *pszName, const char *pszString, size_t cchString);
+VMMR3DECL(int)          CFGMR3InsertStringF(PCFGMNODE pNode, const char *pszName, const char *pszFormat, ...);
+VMMR3DECL(int)          CFGMR3InsertStringFV(PCFGMNODE pNode, const char *pszName, const char *pszFormat, va_list va);
+VMMR3DECL(int)          CFGMR3InsertStringW(PCFGMNODE pNode, const char *pszName, PCRTUTF16 pwszValue);
 VMMR3DECL(int)          CFGMR3InsertBytes(PCFGMNODE pNode, const char *pszName, const void *pvBytes, size_t cbBytes);
 VMMR3DECL(int)          CFGMR3RemoveValue(PCFGMNODE pNode, const char *pszName);
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30954)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30955)
@@ -330,11 +330,11 @@
  * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
  * fails (C-string variant).
- * @param pParent
- * @param pcszNodeName
- * @param strValue
+ * @param   pParent         See CFGMR3InsertStringN.
+ * @param   pcszNodeName    See CFGMR3InsertStringN.
+ * @param   pcszValue       The string value.
  */
-void InsertConfigString(PCFGMNODE pNode,
-                        const char *pcszName,
-                        const char *pcszValue)
+static void InsertConfigString(PCFGMNODE pNode,
+                               const char *pcszName,
+                               const char *pcszValue)
 {
     int vrc = CFGMR3InsertString(pNode,
@@ -348,16 +348,16 @@
  * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
  * fails (Utf8Str variant).
- * @param pParent
- * @param pcszNodeName
- * @param strValue
+ * @param   pParent         See CFGMR3InsertStringN.
+ * @param   pcszNodeName    See CFGMR3InsertStringN.
+ * @param   rStrValue       The string value.
  */
-void InsertConfigString(PCFGMNODE pNode,
-                        const char *pcszName,
-                        const Utf8Str &strValue)
+static void InsertConfigString(PCFGMNODE pNode,
+                               const char *pcszName,
+                               const Utf8Str &rStrValue)
 {
-    int vrc = CFGMR3InsertStringLengthKnown(pNode,
-                                            pcszName,
-                                            strValue.c_str(),
-                                            strValue.length() + 1);
+    int vrc = CFGMR3InsertStringN(pNode,
+                                  pcszName,
+                                  rStrValue.c_str(),
+                                  rStrValue.length());
     if (RT_FAILURE(vrc))
         throw ConfigError("CFGMR3InsertStringLengthKnown", vrc, pcszName);
@@ -367,26 +367,28 @@
  * Helper that calls CFGMR3InsertString and throws an iprt::Error if that
  * fails (Bstr variant).
- * @param pParent
- * @param pcszNodeName
- * @param strValue
+ *
+ * @param   pParent         See CFGMR3InsertStringN.
+ * @param   pcszNodeName    See CFGMR3InsertStringN.
+ * @param   rBstrValue       The string value.
  */
-void InsertConfigString(PCFGMNODE pNode,
-                        const char *pcszName,
-                        const Bstr &bstrValue)
+static void InsertConfigString(PCFGMNODE pNode,
+                               const char *pcszName,
+                               const Bstr &rBstrValue)
 {
-    InsertConfigString(pNode, pcszName, Utf8Str(bstrValue));
+    InsertConfigString(pNode, pcszName, Utf8Str(rBstrValue));
 }
 
 /**
+ * Helper that calls CFGMR3InsertBytes and throws an iprt::Error if that fails.
  *
- * @param pNode
- * @param pcszName
- * @param pvBytes
- * @param cbBytes
+ * @param   pNode           See CFGMR3InsertBytes.
+ * @param   pcszName        See CFGMR3InsertBytes.
+ * @param   pvBytes         See CFGMR3InsertBytes.
+ * @param   cbBytes         See CFGMR3InsertBytes.
  */
-void InsertConfigBytes(PCFGMNODE pNode,
-                       const char *pcszName,
-                       const void *pvBytes,
-                       size_t cbBytes)
+static void InsertConfigBytes(PCFGMNODE pNode,
+                              const char *pcszName,
+                              const void *pvBytes,
+                              size_t cbBytes)
 {
     int vrc = CFGMR3InsertBytes(pNode,
@@ -399,12 +401,14 @@
 
 /**
+ * Helper that calls CFGMR3InsertInteger and thows an iprt::Error if that
+ * fails.
  *
- * @param pNode
- * @param pcszName
- * @param u64Integer
+ * @param   pNode           See CFGMR3InsertInteger.
+ * @param   pcszName        See CFGMR3InsertInteger.
+ * @param   u64Integer      See CFGMR3InsertInteger.
  */
-void InsertConfigInteger(PCFGMNODE pNode,
-                         const char *pcszName,
-                         uint64_t u64Integer)
+static void InsertConfigInteger(PCFGMNODE pNode,
+                                const char *pcszName,
+                                uint64_t u64Integer)
 {
     int vrc = CFGMR3InsertInteger(pNode,
@@ -416,12 +420,13 @@
 
 /**
+ * Helper that calls CFGMR3InsertNode and throws an iprt::Error if that fails.
  *
- * @param pNode
- * @param pcszName
- * @param ppChild
+ * @param   pNode           See CFGMR3InsertNode.
+ * @param   pcszName        See CFGMR3InsertNode.
+ * @param   ppChild         See CFGMR3InsertNode.
  */
-void InsertConfigNode(PCFGMNODE pNode,
-                      const char *pcszName,
-                      PCFGMNODE *ppChild)
+static void InsertConfigNode(PCFGMNODE pNode,
+                             const char *pcszName,
+                             PCFGMNODE *ppChild)
 {
     int vrc = CFGMR3InsertNode(pNode, pcszName, ppChild);
@@ -431,10 +436,11 @@
 
 /**
+ * Helper that calls CFGMR3RemoveValue and throws an iprt::Error if that fails.
  *
- * @param pNode
- * @param pcszName
+ * @param   pNode           See CFGMR3RemoveValue.
+ * @param   pcszName        See CFGMR3RemoveValue.
  */
-void RemoveConfigValue(PCFGMNODE pNode,
-                       const char *pcszName)
+static void RemoveConfigValue(PCFGMNODE pNode,
+                              const char *pcszName)
 {
     int vrc = CFGMR3RemoveValue(pNode, pcszName);
@@ -442,4 +448,5 @@
         throw ConfigError("CFGMR3RemoveValue", vrc, pcszName);
 }
+
 
 /**
@@ -886,5 +893,5 @@
 
             InsertConfigString(pCfg,   "DeviceKey", bstrKey);
-            InsertConfigInteger(pCfg, "GetKeyFromRealSMC", fGetKeyFromRealSMC);
+            InsertConfigInteger(pCfg,  "GetKeyFromRealSMC", fGetKeyFromRealSMC);
         }
 
@@ -917,5 +924,5 @@
         InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
         InsertConfigNode(pLunL0,   "Config", &pCfg);
-        InsertConfigInteger(pCfg, "QueueSize",            64);
+        InsertConfigInteger(pCfg,  "QueueSize",            64);
 
         InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
@@ -923,5 +930,5 @@
         InsertConfigNode(pLunL1,   "Config", &pCfg);
         Keyboard *pKeyboard = pConsole->mKeyboard;
-        InsertConfigInteger(pCfg, "Object",     (uintptr_t)pKeyboard);
+        InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
 
         InsertConfigNode(pInst,    "LUN#1", &pLunL0);
@@ -934,5 +941,5 @@
         InsertConfigNode(pLunL1,   "Config", &pCfg);
         Mouse *pMouse = pConsole->mMouse;
-        InsertConfigInteger(pCfg, "Object",     (uintptr_t)pMouse);
+        InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
 
         /*
@@ -963,6 +970,6 @@
         InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
         InsertConfigNode(pInst,    "Config", &pCfg);
-        InsertConfigInteger(pCfg, "IOAPIC", fIOAPIC);
-        InsertConfigInteger(pCfg, "NumCPUs", cCpus);
+        InsertConfigInteger(pCfg,  "IOAPIC", fIOAPIC);
+        InsertConfigInteger(pCfg,  "NumCPUs", cCpus);
 
         if (fIOAPIC)
@@ -985,5 +992,5 @@
         BOOL fRTCUseUTC;
         hrc = pMachine->COMGETTER(RTCUseUTC)(&fRTCUseUTC);                                  H();
-        InsertConfigInteger(pCfg, "UseUTC", fRTCUseUTC ? 1 : 0);
+        InsertConfigInteger(pCfg,  "UseUTC", fRTCUseUTC ? 1 : 0);
 
         /*
@@ -1000,10 +1007,10 @@
         ULONG cVRamMBs;
         hrc = pMachine->COMGETTER(VRAMSize)(&cVRamMBs);                                     H();
-        InsertConfigInteger(pCfg, "VRamSize",             cVRamMBs * _1M);
+        InsertConfigInteger(pCfg,  "VRamSize",             cVRamMBs * _1M);
         ULONG cMonitorCount;
         hrc = pMachine->COMGETTER(MonitorCount)(&cMonitorCount);                            H();
-        InsertConfigInteger(pCfg, "MonitorCount",         cMonitorCount);
+        InsertConfigInteger(pCfg,  "MonitorCount",         cMonitorCount);
 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
-        InsertConfigInteger(pCfg, "R0Enabled",            fHWVirtExEnabled);
+        InsertConfigInteger(pCfg,  "R0Enabled",            fHWVirtExEnabled);
 #endif
 
@@ -1013,11 +1020,11 @@
         BOOL fFadeIn;
         hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                                H();
-        InsertConfigInteger(pCfg, "FadeIn",  fFadeIn ? 1 : 0);
+        InsertConfigInteger(pCfg,  "FadeIn",  fFadeIn ? 1 : 0);
         BOOL fFadeOut;
         hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                              H();
-        InsertConfigInteger(pCfg, "FadeOut", fFadeOut ? 1: 0);
+        InsertConfigInteger(pCfg,  "FadeOut", fFadeOut ? 1: 0);
         ULONG logoDisplayTime;
         hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);                   H();
-        InsertConfigInteger(pCfg, "LogoTime", logoDisplayTime);
+        InsertConfigInteger(pCfg,  "LogoTime", logoDisplayTime);
         Bstr logoImagePath;
         hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());           H();
@@ -1064,5 +1071,5 @@
             ulHeightReduction = 0;
         }
-        InsertConfigInteger(pCfg, "HeightReduction", ulHeightReduction);
+        InsertConfigInteger(pCfg,  "HeightReduction", ulHeightReduction);
 
         /* Attach the display. */
@@ -1071,5 +1078,5 @@
         InsertConfigNode(pLunL0,   "Config", &pCfg);
         Display *pDisplay = pConsole->mDisplay;
-        InsertConfigInteger(pCfg, "Object", (uintptr_t)pDisplay);
+        InsertConfigInteger(pCfg,  "Object", (uintptr_t)pDisplay);
 
 
@@ -1094,13 +1101,13 @@
             InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
             InsertConfigNode(pInst,    "Config", &pBiosCfg);
-            InsertConfigInteger(pBiosCfg, "RamSize",              cbRam);
-            InsertConfigInteger(pBiosCfg, "RamHoleSize",          cbRamHole);
-            InsertConfigInteger(pBiosCfg, "NumCPUs",              cCpus);
+            InsertConfigInteger(pBiosCfg,  "RamSize",              cbRam);
+            InsertConfigInteger(pBiosCfg,  "RamHoleSize",          cbRamHole);
+            InsertConfigInteger(pBiosCfg,  "NumCPUs",              cCpus);
             InsertConfigString(pBiosCfg,   "HardDiskDevice",       "piix3ide");
             InsertConfigString(pBiosCfg,   "FloppyDevice",         "i82078");
-            InsertConfigInteger(pBiosCfg, "IOAPIC",               fIOAPIC);
-            InsertConfigInteger(pBiosCfg, "PXEDebug",             fPXEDebug);
+            InsertConfigInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);
+            InsertConfigInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);
             InsertConfigBytes(pBiosCfg,    "UUID", &HardwareUuid,sizeof(HardwareUuid));
-            InsertConfigNode(pBiosCfg,   "NetBoot", &pNetBootCfg);
+            InsertConfigNode(pBiosCfg,     "NetBoot", &pNetBootCfg);
 
             DeviceType_T bootDevice;
@@ -1194,16 +1201,16 @@
             InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
             InsertConfigNode(pInst,    "Config", &pCfg);
-            InsertConfigInteger(pCfg, "RamSize",          cbRam);
-            InsertConfigInteger(pCfg, "RamHoleSize",      cbRamHole);
-            InsertConfigInteger(pCfg, "NumCPUs",          cCpus);
+            InsertConfigInteger(pCfg,  "RamSize",          cbRam);
+            InsertConfigInteger(pCfg,  "RamHoleSize",      cbRamHole);
+            InsertConfigInteger(pCfg,  "NumCPUs",          cCpus);
             InsertConfigString(pCfg,   "EfiRom",           efiRomFile);
             InsertConfigString(pCfg,   "BootArgs",         bootArgs);
             InsertConfigString(pCfg,   "DeviceProps",      deviceProps);
-            InsertConfigInteger(pCfg, "IOAPIC",           fIOAPIC);
+            InsertConfigInteger(pCfg,  "IOAPIC",           fIOAPIC);
             InsertConfigBytes(pCfg,    "UUID", &HardwareUuid,sizeof(HardwareUuid));
-            InsertConfigInteger(pCfg, "64BitEntry", f64BitEntry); /* boolean */
-            InsertConfigInteger(pCfg, "GopMode", u32GopMode);
-            InsertConfigInteger(pCfg, "UgaHorizontalResolution", u32UgaHorisontal);
-            InsertConfigInteger(pCfg, "UgaVerticalResolution", u32UgaVertical);
+            InsertConfigInteger(pCfg,  "64BitEntry", f64BitEntry); /* boolean */
+            InsertConfigInteger(pCfg,  "GopMode", u32GopMode);
+            InsertConfigInteger(pCfg,  "UgaHorizontalResolution", u32UgaHorisontal);
+            InsertConfigInteger(pCfg,  "UgaVerticalResolution", u32UgaVertical);
 
             /* For OS X guests we'll force passing host's DMI info to the guest */
@@ -1272,8 +1279,8 @@
                     InsertConfigString(pLunL0, "Driver",               "MainStatus");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
-                    InsertConfigInteger(pCfg, "First",    0);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
+                    InsertConfigInteger(pCfg,  "First",    0);
                     Assert(cLedScsi >= 16);
-                    InsertConfigInteger(pCfg, "Last",     15);
+                    InsertConfigInteger(pCfg,  "Last",     15);
                     paLedDevType = &pConsole->maStorageDevType[iLedScsi];
                     break;
@@ -1291,8 +1298,8 @@
                     InsertConfigString(pLunL0, "Driver",               "MainStatus");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
-                    InsertConfigInteger(pCfg, "First",    0);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedScsi]);
+                    InsertConfigInteger(pCfg,  "First",    0);
                     Assert(cLedScsi >= 16);
-                    InsertConfigInteger(pCfg, "Last",     15);
+                    InsertConfigInteger(pCfg,  "Last",     15);
                     paLedDevType = &pConsole->maStorageDevType[iLedScsi];
                     break;
@@ -1335,7 +1342,7 @@
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
                     AssertRelease(cPorts <= cLedSata);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSata]);
-                    InsertConfigInteger(pCfg, "First",    0);
-                    InsertConfigInteger(pCfg, "Last",     cPorts - 1);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSata]);
+                    InsertConfigInteger(pCfg,  "First",    0);
+                    InsertConfigInteger(pCfg,  "Last",     cPorts - 1);
                     paLedDevType = &pConsole->maStorageDevType[iLedSata];
                     break;
@@ -1353,5 +1360,5 @@
                     afPciDeviceNo[1] = true;
                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        1);
-                    InsertConfigString(pCfg,  "Type", controllerString(enmCtrlType));
+                    InsertConfigString(pCfg,   "Type", controllerString(enmCtrlType));
 
                     /* Attach the status driver */
@@ -1359,8 +1366,8 @@
                     InsertConfigString(pLunL0, "Driver",               "MainStatus");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedIde]);
-                    InsertConfigInteger(pCfg, "First",    0);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedIde]);
+                    InsertConfigInteger(pCfg,  "First",    0);
                     Assert(cLedIde >= 4);
-                    InsertConfigInteger(pCfg, "Last",     3);
+                    InsertConfigInteger(pCfg,  "Last",     3);
                     paLedDevType = &pConsole->maStorageDevType[iLedIde];
 
@@ -1387,8 +1394,8 @@
                     InsertConfigString(pLunL0, "Driver",               "MainStatus");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedFloppy]);
-                    InsertConfigInteger(pCfg, "First",    0);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedFloppy]);
+                    InsertConfigInteger(pCfg,  "First",    0);
                     Assert(cLedFloppy >= 1);
-                    InsertConfigInteger(pCfg, "Last",     0);
+                    InsertConfigInteger(pCfg,  "Last",     0);
                     paLedDevType = &pConsole->maStorageDevType[iLedFloppy];
                     break;
@@ -1408,8 +1415,8 @@
                     InsertConfigString(pLunL0, "Driver",               "MainStatus");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSas]);
-                    InsertConfigInteger(pCfg, "First",    0);
+                    InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapStorageLeds[iLedSas]);
+                    InsertConfigInteger(pCfg,  "First",    0);
                     Assert(cLedSas >= 8);
-                    InsertConfigInteger(pCfg, "Last",     7);
+                    InsertConfigInteger(pCfg,  "Last",     7);
                     paLedDevType = &pConsole->maStorageDevType[iLedSas];
                     break;
@@ -1624,5 +1631,5 @@
             InsertConfigString(pLunL0, "Driver",               "MainStatus");
             InsertConfigNode(pLunL0,   "Config", &pCfg);
-            InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapNetworkLeds[ulInstance]);
+            InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapNetworkLeds[ulInstance]);
 
             /*
@@ -1703,5 +1710,5 @@
                     InsertConfigString(pLunL1,  "Driver", "NamedPipe");
                     InsertConfigNode(pLunL1,    "Config", &pLunL2);
-                    InsertConfigString(pLunL2, "Location", bstr);
+                    InsertConfigString(pLunL2,  "Location", bstr);
                     InsertConfigInteger(pLunL2, "IsServer", fServer);
                 }
@@ -1710,5 +1717,5 @@
                     InsertConfigString(pLunL0,  "Driver", "Host Serial");
                     InsertConfigNode(pLunL0,    "Config", &pLunL1);
-                    InsertConfigString(pLunL1, "DevicePath", bstr);
+                    InsertConfigString(pLunL1,  "DevicePath", bstr);
                 }
                 else if (eHostMode == PortMode_RawFile)
@@ -1718,5 +1725,5 @@
                     InsertConfigString(pLunL1,  "Driver", "RawFile");
                     InsertConfigNode(pLunL1,    "Config", &pLunL2);
-                    InsertConfigString(pLunL2, "Location", bstr);
+                    InsertConfigString(pLunL2,  "Location", bstr);
                 }
             }
@@ -1747,5 +1754,5 @@
             ULONG ulIOBase;
             hrc = parallelPort->COMGETTER(IOBase)(&ulIOBase);                               H();
-            InsertConfigInteger(pCfg, "IOBase", ulIOBase);
+            InsertConfigInteger(pCfg,   "IOBase", ulIOBase);
             InsertConfigNode(pInst,     "LUN#0", &pLunL0);
             InsertConfigString(pLunL0,  "Driver", "HostParallel");
@@ -1777,5 +1784,5 @@
         InsertConfigNode(pLunL0,   "Config", &pCfg);
         VMMDev *pVMMDev = pConsole->mVMMDev;
-        InsertConfigInteger(pCfg, "Object", (uintptr_t)pVMMDev);
+        InsertConfigInteger(pCfg,  "Object", (uintptr_t)pVMMDev);
 
         /*
@@ -1785,7 +1792,7 @@
         InsertConfigString(pLunL0, "Driver",               "MainStatus");
         InsertConfigNode(pLunL0,   "Config", &pCfg);
-        InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&pConsole->mapSharedFolderLed);
-        InsertConfigInteger(pCfg, "First",    0);
-        InsertConfigInteger(pCfg, "Last",     0);
+        InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapSharedFolderLed);
+        InsertConfigInteger(pCfg,  "First",    0);
+        InsertConfigInteger(pCfg,  "Last",     0);
 
         /*
@@ -1801,5 +1808,5 @@
         InsertConfigNode(pLunL0,   "Config", &pCfg);
         AudioSniffer *pAudioSniffer = pConsole->mAudioSniffer;
-        InsertConfigInteger(pCfg, "Object", (uintptr_t)pAudioSniffer);
+        InsertConfigInteger(pCfg,  "Object", (uintptr_t)pAudioSniffer);
 
         /*
@@ -1838,9 +1845,9 @@
                     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);
+                    InsertConfigInteger(pCfg,  "IRQ", 5);
+                    InsertConfigInteger(pCfg,  "DMA", 1);
+                    InsertConfigInteger(pCfg,  "DMA16", 5);
+                    InsertConfigInteger(pCfg,  "Port", 0x220);
+                    InsertConfigInteger(pCfg,  "Version", 0x0405);
                     break;
                 }
@@ -1957,6 +1964,6 @@
                 InsertConfigNode(pLunL0,   "Config", &pCfg);
                 InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapUSBLed[0]);
-                InsertConfigInteger(pCfg, "First",    0);
-                InsertConfigInteger(pCfg, "Last",     0);
+                InsertConfigInteger(pCfg,  "First",    0);
+                InsertConfigInteger(pCfg,  "Last",     0);
 
 #ifdef VBOX_WITH_EHCI
@@ -1985,6 +1992,6 @@
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
                     InsertConfigInteger(pCfg,  "papLeds", (uintptr_t)&pConsole->mapUSBLed[1]);
-                    InsertConfigInteger(pCfg, "First",    0);
-                    InsertConfigInteger(pCfg, "Last",     0);
+                    InsertConfigInteger(pCfg,  "First",    0);
+                    InsertConfigInteger(pCfg,  "Last",     0);
                 }
 #endif
@@ -2027,5 +2034,5 @@
                 InsertConfigNode(pLunL1,   "Config", &pCfg);
                 InsertConfigString(pCfg,   "Type", "HardDisk");
-                InsertConfigInteger(pCfg, "Mountable", 0);
+                InsertConfigInteger(pCfg,  "Mountable", 0);
 
                 InsertConfigNode(pLunL1,   "AttachedDriver", &pLunL2);
@@ -2056,5 +2063,5 @@
                     InsertConfigString(pLunL0, "Driver",        "MouseQueue");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "QueueSize",            128);
+                    InsertConfigInteger(pCfg,  "QueueSize",            128);
 
                     InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
@@ -2062,5 +2069,5 @@
                     InsertConfigNode(pLunL1,   "Config", &pCfg);
                     pMouse = pConsole->mMouse;
-                    InsertConfigInteger(pCfg, "Object",     (uintptr_t)pMouse);
+                    InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
                 }
 
@@ -2077,5 +2084,5 @@
                     InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
                     InsertConfigNode(pLunL0,   "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "QueueSize",            64);
+                    InsertConfigInteger(pCfg,  "QueueSize",            64);
 
                     InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
@@ -2083,5 +2090,5 @@
                     InsertConfigNode(pLunL1,   "Config", &pCfg);
                     pKeyboard = pConsole->mKeyboard;
-                    InsertConfigInteger(pCfg, "Object",     (uintptr_t)pKeyboard);
+                    InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
                 }
             }
@@ -2233,13 +2240,13 @@
             InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
             InsertConfigNode(pInst,    "Config", &pCfg);
-            InsertConfigInteger(pCfg, "RamSize",          cbRam);
-            InsertConfigInteger(pCfg, "RamHoleSize",      cbRamHole);
-            InsertConfigInteger(pCfg, "NumCPUs",          cCpus);
-
-            InsertConfigInteger(pCfg, "IOAPIC", fIOAPIC);
-            InsertConfigInteger(pCfg, "FdcEnabled", fFdcEnabled);
-            InsertConfigInteger(pCfg, "HpetEnabled", fHpetEnabled);
-            InsertConfigInteger(pCfg, "SmcEnabled", fSmcEnabled);
-            InsertConfigInteger(pCfg, "ShowRtc",    fOsXGuest);
+            InsertConfigInteger(pCfg,  "RamSize",          cbRam);
+            InsertConfigInteger(pCfg,  "RamHoleSize",      cbRamHole);
+            InsertConfigInteger(pCfg,  "NumCPUs",          cCpus);
+
+            InsertConfigInteger(pCfg,  "IOAPIC", fIOAPIC);
+            InsertConfigInteger(pCfg,  "FdcEnabled", fFdcEnabled);
+            InsertConfigInteger(pCfg,  "HpetEnabled", fHpetEnabled);
+            InsertConfigInteger(pCfg,  "SmcEnabled", fSmcEnabled);
+            InsertConfigInteger(pCfg,  "ShowRtc",    fOsXGuest);
             if (fOsXGuest && !llBootNics.empty())
             {
@@ -2248,6 +2255,6 @@
                 InsertConfigInteger(pCfg, "NicPciAddress",    u32NicPciAddr);
             }
-            InsertConfigInteger(pCfg, "ShowCpu", fShowCpu);
-            InsertConfigInteger(pCfg, "CpuHotPlug", fCpuHotPlug);
+            InsertConfigInteger(pCfg,  "ShowCpu", fShowCpu);
+            InsertConfigInteger(pCfg,  "CpuHotPlug", fCpuHotPlug);
             InsertConfigInteger(pInst, "PCIDeviceNo",          7);
             Assert(!afPciDeviceNo[7]);
Index: /trunk/src/VBox/VMM/CFGM.cpp
===================================================================
--- /trunk/src/VBox/VMM/CFGM.cpp	(revision 30954)
+++ /trunk/src/VBox/VMM/CFGM.cpp	(revision 30955)
@@ -1698,8 +1698,11 @@
  * @param   pszName         Value name.
  * @param   pszString       The value. Must not be NULL.
- * @param   cbString        The length of the string including the null terminator (i.e. strlen(pszString) + 1).
- */
-VMMR3DECL(int) CFGMR3InsertStringLengthKnown(PCFGMNODE pNode, const char *pszName, const char *pszString, size_t cbString)
-{
+ * @param   cchString       The length of the string excluding the
+ *                          terminator.
+ */
+VMMR3DECL(int) CFGMR3InsertStringN(PCFGMNODE pNode, const char *pszName, const char *pszString, size_t cchString)
+{
+    Assert(RTStrNLen(pszString, cchString) == cchString);
+
     int rc;
     if (pNode)
@@ -1708,8 +1711,9 @@
          * Allocate string object first.
          */
-        char *pszStringCopy = (char *)MMR3HeapAlloc(pNode->pVM, MM_TAG_CFGM_STRING, cbString);
+        char *pszStringCopy = (char *)MMR3HeapAlloc(pNode->pVM, MM_TAG_CFGM_STRING, cchString + 1);
         if (pszStringCopy)
         {
-            memcpy(pszStringCopy, pszString, cbString);
+            memcpy(pszStringCopy, pszString, cchString);
+            pszStringCopy[cchString] = '\0';
 
             /*
@@ -1722,5 +1726,5 @@
                 pLeaf->enmType = CFGMVALUETYPE_STRING;
                 pLeaf->Value.String.psz = pszStringCopy;
-                pLeaf->Value.String.cb  = cbString;
+                pLeaf->Value.String.cb  = cchString + 1;
             }
             else
@@ -1748,6 +1752,93 @@
 VMMR3DECL(int) CFGMR3InsertString(PCFGMNODE pNode, const char *pszName, const char *pszString)
 {
-    return CFGMR3InsertStringLengthKnown(pNode, pszName, pszString, strlen(pszString) + 1);
-}
+    return CFGMR3InsertStringN(pNode, pszName, pszString, strlen(pszString));
+}
+
+
+/**
+ * Same as CFGMR3InsertString except the string value given in RTStrPrintfV
+ * fashion.
+ *
+ * @returns VBox status code.
+ * @param   pNode           Parent node.
+ * @param   pszName         Value name.
+ * @param   pszFormat       The value given as a format string.
+ * @param   va              Argument to pszFormat.
+ */
+VMMR3DECL(int) CFGMR3InsertStringFV(PCFGMNODE pNode, const char *pszName, const char *pszFormat, va_list va)
+{
+    int rc;
+    if (pNode)
+    {
+        /*
+         * Allocate string object first.
+         */
+        char *pszString = MMR3HeapAPrintfVU(pNode->pVM->pUVM, MM_TAG_CFGM_STRING, pszFormat, va);
+        if (pszString)
+        {
+            /*
+             * Create value leaf and set it to string type.
+             */
+            PCFGMLEAF pLeaf;
+            rc = cfgmR3InsertLeaf(pNode, pszName, &pLeaf);
+            if (RT_SUCCESS(rc))
+            {
+                pLeaf->enmType = CFGMVALUETYPE_STRING;
+                pLeaf->Value.String.psz = pszString;
+                pLeaf->Value.String.cb  = strlen(pszString) + 1;
+            }
+            else
+                MMR3HeapFree(pszString);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else
+        rc = VERR_CFGM_NO_PARENT;
+
+    return rc;
+}
+
+
+/**
+ * Same as CFGMR3InsertString except the string value given in RTStrPrintf
+ * fashion.
+ *
+ * @returns VBox status code.
+ * @param   pNode           Parent node.
+ * @param   pszName         Value name.
+ * @param   pszFormat       The value given as a format string.
+ * @param   ...             Argument to pszFormat.
+ */
+VMMR3DECL(int) CFGMR3InsertStringF(PCFGMNODE pNode, const char *pszName, const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    int rc = CFGMR3InsertStringFV(pNode, pszName, pszFormat, va);
+    va_end(va);
+    return rc;
+}
+
+
+/**
+ * Same as CFGMR3InsertString except the string value given as a UTF-16 string.
+ *
+ * @returns VBox status code.
+ * @param   pNode           Parent node.
+ * @param   pszName         Value name.
+ * @param   pwszValue       The string value (UTF-16).
+ */
+VMMR3DECL(int) CFGMR3InsertStringW(PCFGMNODE pNode, const char *pszName, PCRTUTF16 pwszValue)
+{
+    char *pszValue;
+    int rc = RTUtf16ToUtf8(pwszValue, &pszValue);
+    if (RT_SUCCESS(rc))
+    {
+        rc = CFGMR3InsertString(pNode, pszName, pszValue);
+        RTStrFree(pszValue);
+    }
+    return rc;
+}
+
 
 /**
