Index: trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 29225)
+++ trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 29226)
@@ -302,9 +302,8 @@
     int             rc;
     HRESULT         hrc;
-    BSTR            str = NULL;
-
-#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } } while (0)
-#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  STR_FREE(); return rc;                   } } while (0)
-#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)
+    Bstr            bstr;
+
+#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  return rc;                   } } while (0)
+#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); return VERR_GENERAL_FAILURE; } } while (0)
 
     /*
@@ -323,8 +322,7 @@
     hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());             H();
 
-    hrc = pMachine->COMGETTER(HardwareUUID)(&str);                                  H();
+    hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam());                                  H();
     RTUUID HardwareUuid;
-    rc = RTUuidFromUtf16(&HardwareUuid, str);                                       RC_CHECK();
-    STR_FREE();
+    rc = RTUuidFromUtf16(&HardwareUuid, bstr.raw());                                       RC_CHECK();
 
     ULONG cRamMBs;
@@ -363,6 +361,6 @@
      * Set the root (and VMM) level values.
      */
-    hrc = pMachine->COMGETTER(Name)(&str);                                          H();
-    rc = CFGMR3InsertStringW(pRoot, "Name",                 str);                   RC_CHECK();
+    hrc = pMachine->COMGETTER(Name)(bstr.asOutParam());                             H();
+    rc = CFGMR3InsertStringW(pRoot, "Name",                 bstr.raw());            RC_CHECK();
     rc = CFGMR3InsertBytes(pRoot,   "UUID", &HardwareUuid, sizeof(HardwareUuid));   RC_CHECK();
     rc = CFGMR3InsertInteger(pRoot, "RamSize",              cbRam);                 RC_CHECK();
@@ -377,5 +375,4 @@
     rc = CFGMR3InsertInteger(pRoot, "CSAMEnabled",          1);     /* boolean */   RC_CHECK();
 #endif
-    STR_FREE();
 
     /* cpuid leaf overrides. */
@@ -842,12 +839,10 @@
         char szExtraDataKey[sizeof("CustomVideoModeXX")];
         RTStrPrintf(szExtraDataKey, sizeof(szExtraDataKey), "CustomVideoMode%u", iMode);
-        hrc = pMachine->GetExtraData(Bstr(szExtraDataKey), &str);                   H();
-        if (!str || !*str)
+        hrc = pMachine->GetExtraData(Bstr(szExtraDataKey), bstr.asOutParam());     H();
+        if (bstr.isEmpty())
             break;
-        rc = CFGMR3InsertStringW(pCfg, szExtraDataKey, str);                        RC_CHECK();
-        STR_FREE();
+        rc = CFGMR3InsertStringW(pCfg, szExtraDataKey, bstr.raw());                RC_CHECK();
         ++cModes;
     }
-    STR_FREE();
     rc = CFGMR3InsertInteger(pCfg,  "CustomVideoModes", cModes);                    RC_CHECK();
 
@@ -970,28 +965,19 @@
         hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps"), deviceProps.asOutParam()); H();
         /* Get GOP mode settings */
-        STR_FREE();
         uint32_t u32GopMode = UINT32_MAX;
-        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode"), &str); H();
-        if (str && *str)
-        {
-            u32GopMode = Utf8Str(str).toUInt32();
-        }
+        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode"), bstr.asOutParam()); H();
+        if (!bstr.isEmpty())
+            u32GopMode = Utf8Str(bstr).toUInt32();
+
         /* UGA mode settings */
-        STR_FREE();
         uint32_t u32UgaHorisontal = 0;
-        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution"), &str); H();
-        if (str && *str)
-        {
-            u32UgaHorisontal = Utf8Str(str).toUInt32();
-        }
-
-        STR_FREE();
+        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution"), bstr.asOutParam()); H();
+        if (!bstr.isEmpty())
+            u32UgaHorisontal = Utf8Str(bstr).toUInt32();
+
         uint32_t u32UgaVertical = 0;
-        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution"), &str); H();
-        if (str && *str)
-        {
-            u32UgaVertical = Utf8Str(str).toUInt32();
-        }
-        STR_FREE();
+        hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution"), bstr.asOutParam()); H();
+        if (!bstr.isEmpty())
+            u32UgaVertical = Utf8Str(bstr).toUInt32();
 
         /*
@@ -1492,5 +1478,5 @@
         BOOL  fServer;
         hrc = serialPort->COMGETTER(Server)(&fServer);                              H();
-        hrc = serialPort->COMGETTER(Path)(&str);                                    H();
+        hrc = serialPort->COMGETTER(Path)(bstr.asOutParam());                       H();
         PortMode_T eHostMode;
         hrc = serialPort->COMGETTER(HostMode)(&eHostMode);                          H();
@@ -1504,5 +1490,5 @@
                 rc = CFGMR3InsertString(pLunL1,  "Driver", "NamedPipe");            RC_CHECK();
                 rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                RC_CHECK();
-                rc = CFGMR3InsertStringW(pLunL2, "Location", str);                  RC_CHECK();
+                rc = CFGMR3InsertStringW(pLunL2, "Location", bstr.raw());           RC_CHECK();
                 rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer);              RC_CHECK();
             }
@@ -1511,5 +1497,5 @@
                 rc = CFGMR3InsertString(pLunL0,  "Driver", "Host Serial");          RC_CHECK();
                 rc = CFGMR3InsertNode(pLunL0,    "Config", &pLunL1);                RC_CHECK();
-                rc = CFGMR3InsertStringW(pLunL1, "DevicePath", str);                RC_CHECK();
+                rc = CFGMR3InsertStringW(pLunL1, "DevicePath", bstr.raw());         RC_CHECK();
             }
             else if (eHostMode == PortMode_RawFile)
@@ -1519,8 +1505,7 @@
                 rc = CFGMR3InsertString(pLunL1,  "Driver", "RawFile");              RC_CHECK();
                 rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                RC_CHECK();
-                rc = CFGMR3InsertStringW(pLunL2, "Location", str);                  RC_CHECK();
-            }
-        }
-        STR_FREE();
+                rc = CFGMR3InsertStringW(pLunL2, "Location", bstr.raw());           RC_CHECK();
+            }
+        }
     }
 
@@ -1553,7 +1538,6 @@
         rc = CFGMR3InsertString(pLunL0,  "Driver", "HostParallel");                 RC_CHECK();
         rc = CFGMR3InsertNode(pLunL0,    "AttachedDriver", &pLunL1);                RC_CHECK();
-        hrc = parallelPort->COMGETTER(Path)(&str);                                  H();
-        rc = CFGMR3InsertStringW(pLunL1,  "DevicePath", str);                       RC_CHECK();
-        STR_FREE();
+        hrc = parallelPort->COMGETTER(Path)(bstr.asOutParam());                     H();
+        rc = CFGMR3InsertStringW(pLunL1,  "DevicePath", bstr.raw());                RC_CHECK();
     }
 
@@ -1726,7 +1710,6 @@
 #endif
         }
-        hrc = pMachine->COMGETTER(Name)(&str);                                      H();
-        rc = CFGMR3InsertStringW(pCfg, "StreamName", str);                          RC_CHECK();
-        STR_FREE();
+        hrc = pMachine->COMGETTER(Name)(bstr.asOutParam());                         H();
+        rc = CFGMR3InsertStringW(pCfg, "StreamName", bstr.raw());                   RC_CHECK();
     }
 
@@ -2218,5 +2201,4 @@
     }
 
-#undef STR_FREE
 #undef H
 #undef RC_CHECK
@@ -2270,9 +2252,8 @@
     int rc = VINF_SUCCESS;
     HRESULT hrc;
-    BSTR str = NULL;
-
-#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } } while (0)
-#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  STR_FREE(); return rc;                   } } while (0)
-#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)
+    Bstr    bstr;
+
+#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  return rc;                   } } while (0)
+#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); return VERR_GENERAL_FAILURE; } } while (0)
 
     LONG lDev;
@@ -2368,5 +2349,4 @@
         paLedDevType[uLUN] = lType;
 
-#undef STR_FREE
 #undef H
 #undef RC_CHECK
@@ -2388,9 +2368,8 @@
     int rc = VINF_SUCCESS;
     HRESULT hrc;
-    BSTR str = NULL;
-
-#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } } while (0)
-#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  STR_FREE(); return rc;                   } } while (0)
-#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); if (phrc) *phrc = hrc; return VERR_GENERAL_FAILURE; } } while (0)
+    Bstr bstr;
+
+#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  return rc;                   } } while (0)
+#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); if (phrc) *phrc = hrc; return VERR_GENERAL_FAILURE; } } while (0)
 
     PCFGMNODE pLunL1 = NULL;
@@ -2411,7 +2390,6 @@
             rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);                             RC_CHECK();
 
-            hrc = pMedium->COMGETTER(Location)(&str);                                   H();
-            rc = CFGMR3InsertStringW(pCfg, "Path", str);                                RC_CHECK();
-            STR_FREE();
+            hrc = pMedium->COMGETTER(Location)(bstr.asOutParam());                      H();
+            rc = CFGMR3InsertStringW(pCfg, "Path", bstr.raw());                         RC_CHECK();
 
             rc = CFGMR3InsertInteger(pCfg, "Passthrough", fPassthrough);                RC_CHECK();
@@ -2422,7 +2400,6 @@
             rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);                             RC_CHECK();
 
-            hrc = pMedium->COMGETTER(Location)(&str);                                   H();
-            rc = CFGMR3InsertStringW(pCfg, "Path", str);                                RC_CHECK();
-            STR_FREE();
+            hrc = pMedium->COMGETTER(Location)(bstr.asOutParam());                      H();
+            rc = CFGMR3InsertStringW(pCfg, "Path", bstr.raw());                         RC_CHECK();
         }
     }
@@ -2492,11 +2469,9 @@
             rc = CFGMR3InsertNode(pLunL1, "Config", &pCfg);                             RC_CHECK();
 
-            hrc = pMedium->COMGETTER(Location)(&str);                                   H();
-            rc = CFGMR3InsertStringW(pCfg, "Path", str);                                RC_CHECK();
-            STR_FREE();
-
-            hrc = pMedium->COMGETTER(Format)(&str);                                     H();
-            rc = CFGMR3InsertStringW(pCfg, "Format", str);                              RC_CHECK();
-            STR_FREE();
+            hrc = pMedium->COMGETTER(Location)(bstr.asOutParam());                      H();
+            rc = CFGMR3InsertStringW(pCfg, "Path", bstr.raw());                         RC_CHECK();
+
+            hrc = pMedium->COMGETTER(Format)(bstr.asOutParam());                        H();
+            rc = CFGMR3InsertStringW(pCfg, "Format", bstr.raw());                       RC_CHECK();
 
             /* DVDs are always readonly */
@@ -2575,11 +2550,9 @@
                 PCFGMNODE pCur;
                 rc = CFGMR3InsertNode(pParent, "Parent", &pCur);                        RC_CHECK();
-                hrc = pMedium->COMGETTER(Location)(&str);                               H();
-                rc = CFGMR3InsertStringW(pCur, "Path", str);                            RC_CHECK();
-                STR_FREE();
-
-                hrc = pMedium->COMGETTER(Format)(&str);                                 H();
-                rc = CFGMR3InsertStringW(pCur, "Format", str);                          RC_CHECK();
-                STR_FREE();
+                hrc = pMedium->COMGETTER(Location)(bstr.asOutParam());                  H();
+                rc = CFGMR3InsertStringW(pCur, "Path", bstr.raw());                     RC_CHECK();
+
+                hrc = pMedium->COMGETTER(Format)(bstr.asOutParam());                    H();
+                rc = CFGMR3InsertStringW(pCur, "Format", bstr.raw());                   RC_CHECK();
 
                 if (fSetupMerge)
@@ -2634,5 +2607,4 @@
     }
 
-#undef STR_FREE
 #undef H
 #undef RC_CHECK
@@ -2669,9 +2641,8 @@
     int rc = VINF_SUCCESS;
     HRESULT hrc;
-    BSTR str = NULL;
-
-#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } } while (0)
-#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  STR_FREE(); return rc;                   } } while (0)
-#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); STR_FREE(); return VERR_GENERAL_FAILURE; } } while (0)
+    Bstr bstr;
+
+#define RC_CHECK()  do { if (RT_FAILURE(rc)) { AssertMsgFailed(("rc=%Rrc\n", rc));  return rc;                   } } while (0)
+#define H()         do { if (FAILED(hrc))    { AssertMsgFailed(("hrc=%Rhrc\n", hrc)); return VERR_GENERAL_FAILURE; } } while (0)
 
     /*
@@ -2725,10 +2696,9 @@
             rc = CFGMR3InsertString(pLunL0, "Driver", "NetSniffer");        RC_CHECK();
             rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);                 RC_CHECK();
-            hrc = aNetworkAdapter->COMGETTER(TraceFile)(&str);              H();
-            if (str) /* check convention for indicating default file. */
-            {
-                rc = CFGMR3InsertStringW(pCfg, "File", str);                RC_CHECK();
-            }
-            STR_FREE();
+            hrc = aNetworkAdapter->COMGETTER(TraceFile)(bstr.asOutParam()); H();
+            if (!bstr.isEmpty()) /* check convention for indicating default file. */
+            {
+                rc = CFGMR3InsertStringW(pCfg, "File", bstr.raw());         RC_CHECK();
+            }
         }
     }
@@ -2749,10 +2719,9 @@
         rc = CFGMR3InsertString(pLunL0, "Driver", "NetSniffer");        RC_CHECK();
         rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);                 RC_CHECK();
-        hrc = aNetworkAdapter->COMGETTER(TraceFile)(&str);              H();
-        if (str) /* check convention for indicating default file. */
-        {
-            rc = CFGMR3InsertStringW(pCfg, "File", str);                RC_CHECK();
-        }
-        STR_FREE();
+        hrc = aNetworkAdapter->COMGETTER(TraceFile)(bstr.asOutParam()); H();
+        if (!bstr.isEmpty()) /* check convention for indicating default file. */
+        {
+            rc = CFGMR3InsertStringW(pCfg, "File", bstr.raw());         RC_CHECK();
+        }
     }
 
@@ -2781,18 +2750,16 @@
 
             /* Configure TFTP prefix and boot filename. */
-            hrc = virtualBox->COMGETTER(HomeFolder)(&str);              H();
-            if (str && *str)
-            {
-                rc = CFGMR3InsertStringF(pCfg, "TFTPPrefix", "%ls%c%s", str, RTPATH_DELIMITER, "TFTP"); RC_CHECK();
-            }
-            STR_FREE();
-            hrc = pMachine->COMGETTER(Name)(&str);                      H();
-            rc = CFGMR3InsertStringF(pCfg, "BootFile", "%ls.pxe", str); RC_CHECK();
-            STR_FREE();
-
-            hrc = natDriver->COMGETTER(Network)(&str);                  H();
-            if (str)
-            {
-                rc = CFGMR3InsertStringW(pCfg, "Network", str);         RC_CHECK();
+            hrc = virtualBox->COMGETTER(HomeFolder)(bstr.asOutParam()); H();
+            if (!bstr.isEmpty())
+            {
+                rc = CFGMR3InsertStringF(pCfg, "TFTPPrefix", "%ls%c%s", bstr.raw(), RTPATH_DELIMITER, "TFTP"); RC_CHECK();
+            }
+            hrc = pMachine->COMGETTER(Name)(bstr.asOutParam());         H();
+            rc = CFGMR3InsertStringF(pCfg, "BootFile", "%ls.pxe", bstr.raw()); RC_CHECK();
+
+            hrc = natDriver->COMGETTER(Network)(bstr.asOutParam());     H();
+            if (!bstr.isEmpty())
+            {
+                rc = CFGMR3InsertStringW(pCfg, "Network", bstr.raw());  RC_CHECK();
             }
             else
@@ -2802,11 +2769,9 @@
                 rc = CFGMR3InsertStringF(pCfg, "Network", "10.0.%d.0/24", uSlot+2); RC_CHECK();
             }
-            STR_FREE();
-            hrc = natDriver->COMGETTER(HostIP)(&str);                   H();
-            if (str)
-            {
-                rc = CFGMR3InsertStringW(pCfg, "BindIP", str);          RC_CHECK();
-            }
-            STR_FREE();
+            hrc = natDriver->COMGETTER(HostIP)(bstr.asOutParam());      H();
+            if (!bstr.isEmpty())
+            {
+                rc = CFGMR3InsertStringW(pCfg, "BindIP", bstr.raw());   RC_CHECK();
+            }
             ULONG mtu = 0;
             ULONG sockSnd = 0;
@@ -2835,23 +2800,20 @@
                 rc = CFGMR3InsertInteger(pCfg, "TcpSnd", tcpSnd);        RC_CHECK();
             }
-            STR_FREE();
-            hrc = natDriver->COMGETTER(TftpPrefix)(&str);                H();
-            if (str)
+            hrc = natDriver->COMGETTER(TftpPrefix)(bstr.asOutParam());   H();
+            if (!bstr.isEmpty())
             {
                 rc = CFGMR3RemoveValue(pCfg, "TFTPPrefix");              RC_CHECK();
-                rc = CFGMR3InsertStringW(pCfg, "TFTPPrefix", str);       RC_CHECK();
-            }
-            STR_FREE();
-            hrc = natDriver->COMGETTER(TftpBootFile)(&str);              H();
-            if (str)
+                rc = CFGMR3InsertStringW(pCfg, "TFTPPrefix", bstr);       RC_CHECK();
+            }
+            hrc = natDriver->COMGETTER(TftpBootFile)(bstr.asOutParam());              H();
+            if (!bstr.isEmpty())
             {
                 rc = CFGMR3RemoveValue(pCfg, "BootFile");                RC_CHECK();
-                rc = CFGMR3InsertStringW(pCfg, "BootFile", str);         RC_CHECK();
-            }
-            STR_FREE();
-            hrc = natDriver->COMGETTER(TftpNextServer)(&str);            H();
-            if (str)
-            {
-                rc = CFGMR3InsertStringW(pCfg, "NextServer", str);       RC_CHECK();
+                rc = CFGMR3InsertStringW(pCfg, "BootFile", bstr);         RC_CHECK();
+            }
+            hrc = natDriver->COMGETTER(TftpNextServer)(bstr.asOutParam()); H();
+            if (!bstr.isEmpty())
+            {
+                rc = CFGMR3InsertStringW(pCfg, "NextServer", bstr);       RC_CHECK();
             }
             BOOL fDnsFlag;
@@ -3079,5 +3041,5 @@
             }
 
-            hrc = hostInterface->COMGETTER(Id)(&str);
+            hrc = hostInterface->COMGETTER(Id)(bstr.asOutParam());
             if (FAILED(hrc))
             {
@@ -3085,6 +3047,5 @@
                 H();
             }
-            Guid hostIFGuid(str);
-            STR_FREE();
+            Guid hostIFGuid(bstr);
 
             INetCfg              *pNc;
@@ -3390,6 +3351,6 @@
         case NetworkAttachmentType_Internal:
         {
-            hrc = aNetworkAdapter->COMGETTER(InternalNetwork)(&str);    H();
-            if (str && *str)
+            hrc = aNetworkAdapter->COMGETTER(InternalNetwork)(bstr.asOutParam());    H();
+            if (!bstr.isEmpty())
             {
                 if (fSniffer)
@@ -3405,10 +3366,9 @@
                 rc = CFGMR3InsertString(pLunL0, "Driver", "IntNet");    RC_CHECK();
                 rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);         RC_CHECK();
-                rc = CFGMR3InsertStringW(pCfg, "Network", str);         RC_CHECK();
+                rc = CFGMR3InsertStringW(pCfg, "Network", bstr);         RC_CHECK();
                 rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_WhateverNone); RC_CHECK();
-                networkName = str;
+                networkName = bstr;
                 trunkType = Bstr(TRUNKTYPE_WHATEVER);
             }
-            STR_FREE();
             break;
         }
@@ -3474,5 +3434,5 @@
                                   HifName.raw());
 
-            hrc = hostInterface->COMGETTER(Id)(&str);
+            hrc = hostInterface->COMGETTER(Id)(bstr.asOutParam());
             if (FAILED(hrc))
             {
@@ -3480,6 +3440,5 @@
                 H();
             }
-            Guid hostIFGuid(str);
-            STR_FREE();
+            Guid hostIFGuid(bstr);
 
             INetCfg *pNc;
@@ -3617,14 +3576,13 @@
         case NetworkAttachmentType_VDE:
         {
-            hrc = aNetworkAdapter->COMGETTER(VDENetwork)(&str);    H();
+            hrc = aNetworkAdapter->COMGETTER(VDENetwork)(bstr.asOutParam());    H();
             rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0);        RC_CHECK();
             rc = CFGMR3InsertString(pLunL0, "Driver", "VDE");      RC_CHECK();
             rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);        RC_CHECK();
-            if (str && *str)
-            {
-                rc = CFGMR3InsertStringW(pCfg, "Network", str);    RC_CHECK();
-                networkName = str;
-            }
-            STR_FREE();
+            if (!bstr.isEmpty())
+            {
+                rc = CFGMR3InsertStringW(pCfg, "Network", bstr);    RC_CHECK();
+                networkName = bstr;
+            }
             break;
         }
@@ -3706,5 +3664,4 @@
     meAttachmentType[uInstance] = eAttachmentType;
 
-#undef STR_FREE
 #undef H
 #undef RC_CHECK
