Index: /trunk/include/VBox/com/Guid.h
===================================================================
--- /trunk/include/VBox/com/Guid.h	(revision 26552)
+++ /trunk/include/VBox/com/Guid.h	(revision 26553)
@@ -97,5 +97,5 @@
     {
         ::RTUuidClear (&uuid);
-        if (!that.isEmpty())
+        if (!that.isNull())
            ::RTUuidFromUtf16(&uuid, that.raw());
         refresh();
@@ -145,5 +145,5 @@
     }
 
-    Bstr toUtf16() const
+    Bstr toUtf16 () const
     {
         if (isEmpty())
Index: /trunk/include/VBox/com/string.h
===================================================================
--- /trunk/include/VBox/com/string.h	(revision 26552)
+++ /trunk/include/VBox/com/string.h	(revision 26553)
@@ -3,5 +3,5 @@
 /** @file
  * MS COM / XPCOM Abstraction Layer:
- * UTF-8 and UTF-16 string classes
+ * Smart string classes declaration
  */
 
@@ -59,32 +59,15 @@
 
 /**
- *  String class used universally in Main for COM-style Utf-16 strings.
- *  Unfortunately COM on Windows uses UTF-16 everywhere, requiring conversions
- *  back and forth since most of VirtualBox and our libraries use UTF-8.
- *  The Bstr class makes such conversions easier.
- *
- *  Whereas the BSTR identifier is a typedef for a pointer to a wide character
- *  array (const char *uint_16 effectively, depending on the platform),
- *  the Bstr class is a fully featured string class with memory management
- *  for such strings.
- *
- *  Bstr uses COM/XPCOM-provided memory management routines (SysAlloc* etc.)
- *  to allocate and free string buffers. This makes it possible to use it as
- *  a type of member variables of COM/XPCOM components and pass their values
- *  to callers through component methods' output parameters using the #cloneTo()
- *  operation. Also, the class can adopt (take ownership of) string buffers
- *  returned in output parameters of COM methods using the #asOutParam()
- *  operation and correctly free them afterwards.
- *
- *  As opposed to the Ut8Str class, which is very efficient, Bstr does not
- *  cache the length of its member string. As a result, copying Bstr's is
- *  more expensive, and Bstr really should only be used to capture arguments
- *  from and return data to public COM methods.
- *
- *  Starting with VirtualBox 3.2, like Utf8Str, Bstr no longer differentiates
- *  between NULL strings and empty strings. In other words, Bstr("") and
- *  Bstr(NULL) behave the same. In both cases, Bstr allocates no memory,
- *  reports a zero length and zero allocated bytes for both, and returns an
- *  empty C wide string from raw().
+ *  Helper class that represents the |BSTR| type and hides platform-specific
+ *  implementation details.
+ *
+ *  This class uses COM/XPCOM-provided memory management routines to allocate
+ *  and free string buffers. This makes it possible to:
+ *  - use it as a type of member variables of COM/XPCOM components and pass
+ *    their values to callers through component methods' output parameters
+ *    using the #cloneTo() operation;
+ *  - adopt (take ownership of) string buffers returned in output parameters
+ *    of COM methods using the #asOutParam() operation and correctly free them
+ *    afterwards.
  */
 class Bstr
@@ -92,163 +75,127 @@
 public:
 
-    /**
-     * Creates an empty string that has no memory allocated.
-     */
-    Bstr()
-        : m_bstr(NULL)
-    {
-    }
-
-    /**
-     * Creates a copy of another Bstr.
-     *
-     * This allocates s.length() + 1 wide characters for the new instance, unless s is empty.
-     *
-     * @param   s               The source string.
-     *
-     * @throws  std::bad_alloc
-     */
-    Bstr(const Bstr &s)
-    {
-        copyFrom(s);
-    }
-
-    /**
-     * Creates a copy of a wide char string buffer.
-     *
-     * This allocates SysStringLen(pw) + 1 wide characters for the new instance, unless s is empty.
-     *
-     * @param   pcsz            The source string.
-     *
-     * @throws  std::bad_alloc
-     */
-    Bstr(CBSTR pw)
-    {
-        copyFrom(pw);
-    }
+    typedef BSTR String;
+    typedef CBSTR ConstString;
+
+    Bstr() : bstr(NULL) {}
+
+    Bstr(const Bstr &that) : bstr(NULL) { raw_copy(bstr, that.bstr); }
+    Bstr(CBSTR that) : bstr(NULL) { raw_copy(bstr, that); }
 
 #if defined (VBOX_WITH_XPCOM)
-    Bstr(const wchar_t *pw)
+    Bstr(const wchar_t *that) : bstr(NULL)
     {
         AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));
-        copyFrom((CBSTR)pw);
+        raw_copy(bstr, (CBSTR)that);
     }
 #endif
 
-
-    /**
-     * Creates a copy of an IPRT MiniString (which includes Utf8Str).
-     *
-     * This allocates s.length() + 1 wide characters for the new instance, unless s is empty.
-     *
-     * @param   pcsz            The source string.
-     *
-     * @throws  std::bad_alloc
-     */
-    Bstr(const iprt::MiniString &s)
-    {
-        copyFrom(s.c_str());        // @todo the source string length is know, we can probably speed this up
-    }
-
-    /**
-     * Creates a copy of a C string.
-     *
-     * This allocates strlen(pcsz) + 1 bytes for the new instance, unless s is empty.
-     *
-     * @param   pcsz            The source string.
-     *
-     * @throws  std::bad_alloc
-     */
-    Bstr(const char *pcsz)
-    {
-        copyFrom(pcsz);
-    }
-
-    /**
-     * String length in wide characters.
-     *
-     * Returns the length of the member string, which is equal to SysStringLen(raw()).
-     * In other words, this returns neither bytes nor the number of unicode codepoints.
-     *
-     * As opposed to Utf8Str::length(), this is _not_ cached and expensive.
-     */
-    size_t length() const
-    {
-        return ::SysStringLen(m_bstr);
-    }
-
-    /**
-     * Deallocates all memory.
-     */
-    inline void setNull()
-    {
-        cleanup();
-    }
-
-    /**
-     * Returns a const pointer to the member string. If the member string is empty,
-     * returns a pointer to a static null character.
-     * @return
-     */
-    CBSTR raw() const
-    {
-        return (m_bstr) ? m_bstr : (CBSTR)L"";
-    }
-
-    /**
-     * Empty string or not?
-     *
-     * Returns true if the member string has no length.
-     *
-     * @returns true if empty, false if not.
-     */
-    bool isEmpty() const
-    {
-        return (m_bstr == NULL);
-    }
-
-    /** Case sensitivity selector. */
-    enum CaseSensitivity
-    {
-        CaseSensitive,
-        CaseInsensitive
-    };
-
-    int compare(CBSTR str, CaseSensitivity cs = CaseSensitive) const
-    {
-        if (m_bstr == str)
-            return 0;
-        if (m_bstr == NULL)
-            return -1;
-        if (str == NULL)
-            return 1;
-
-        if (cs == CaseSensitive)
-            return ::RTUtf16Cmp((PRTUTF16)m_bstr, (PRTUTF16)str);
-        else
-            return ::RTUtf16ICmp((PRTUTF16)m_bstr, (PRTUTF16)str);
-    }
-
-    int compare(const Bstr &bstr, CaseSensitivity cs = CaseSensitive) const
-    {
-        return compare(bstr.raw(), cs);
-    }
-
-    /** @name Comparison operators.
-     * @{  */
-    bool operator==(const Bstr &that) const { return !compare(that.raw()); }
-    bool operator!=(const Bstr &that) const { return !!compare(that.raw()); }
-    bool operator<( const Bstr &that) const { return compare(that.raw()) < 0; }
-    bool operator>( const Bstr &that) const { return compare(that.raw()) > 0; }
-
+    Bstr(const iprt::MiniString &that);
+    Bstr(const char *that);
+
+    /** Shortcut that calls #alloc(aSize) right after object creation. */
+    Bstr(size_t aSize) : bstr(NULL) { alloc(aSize); }
+
+    ~Bstr() { setNull(); }
+
+    Bstr &operator=(const Bstr &that) { safe_assign(that.bstr); return *this; }
+    Bstr &operator=(CBSTR that) { safe_assign(that); return *this; }
+
+    Bstr &operator=(const Utf8Str &that);
+    Bstr &operator=(const char *that);
+
+    Bstr &setNull()
+    {
+        if (bstr)
+        {
+            ::SysFreeString(bstr);
+            bstr = NULL;
+        }
+        return *this;
+    }
+
+    Bstr &setNullIfEmpty()
+    {
+        if (bstr && *bstr == 0)
+        {
+            ::SysFreeString(bstr);
+            bstr = NULL;
+        }
+        return *this;
+    }
+
+    /**
+     *  Allocates memory for a string capable to store \a aSize - 1 characters;
+     *  in other words, aSize includes the terminating zero character. If \a aSize
+     *  is zero, or if a memory allocation error occurs, this object will become null.
+     */
+    Bstr &alloc(size_t aSize)
+    {
+        setNull();
+        if (aSize)
+        {
+            unsigned int size = (unsigned int) aSize; Assert(size == aSize);
+            bstr = ::SysAllocStringLen(NULL, size - 1);
+            if (bstr)
+                bstr[0] = 0;
+        }
+        return *this;
+    }
+
+    int compare(CBSTR str) const
+    {
+        return ::RTUtf16Cmp((PRTUTF16) bstr, (PRTUTF16) str);
+    }
+
+    int compare(BSTR str) const
+    {
+        return ::RTUtf16Cmp((PRTUTF16) bstr, (PRTUTF16) str);
+    }
+
+    bool operator==(const Bstr &that) const { return !compare(that.bstr); }
+    bool operator!=(const Bstr &that) const { return !!compare(that.bstr); }
     bool operator==(CBSTR that) const { return !compare(that); }
+    bool operator==(BSTR that) const { return !compare(that); }
+
+#if defined (VBOX_WITH_XPCOM)
+    bool operator!=(const wchar_t *that) const
+    {
+        AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));
+        return !!compare((CBSTR) that);
+    }
+    bool operator==(const wchar_t *that) const
+    {
+        AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));
+        return !compare((CBSTR) that);
+    }
+#endif
+
     bool operator!=(CBSTR that) const { return !!compare(that); }
-    bool operator<( CBSTR that) const { return compare(that) < 0; }
-    bool operator>( CBSTR that) const { return compare(that) > 0; }
-
-    /** @} */
+    bool operator!=(BSTR that) const { return !!compare(that); }
+    bool operator<(const Bstr &that) const { return compare(that.bstr) < 0; }
+    bool operator<(CBSTR that) const { return compare(that) < 0; }
+    bool operator<(BSTR that) const { return compare(that) < 0; }
+#if defined (VBOX_WITH_XPCOM)
+    bool operator<(const wchar_t *that) const
+    {
+        AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));
+        return compare((CBSTR) that) < 0;
+    }
+#endif
+
+    int compareIgnoreCase(CBSTR str) const
+    {
+        return ::RTUtf16LocaleICmp(bstr, str);
+    }
+
+    bool isNull() const { return bstr == NULL; }
+    operator bool() const { return !isNull(); }
+
+    bool isEmpty() const { return isNull() || *bstr == 0; }
+
+    size_t length() const { return isNull() ? 0 : ::RTUtf16Len((PRTUTF16) bstr); }
 
     /** Intended to to pass instances as |CBSTR| input parameters to methods. */
-    operator CBSTR() const { return raw(); }
+    operator CBSTR() const { return bstr; }
 
     /**
@@ -257,5 +204,20 @@
      * input BSTR parameters of interface methods are not const.
      */
-    operator BSTR() { return (BSTR)raw(); }
+    operator BSTR() { return bstr; }
+
+    /**
+     *  The same as operator CBSTR(), but for situations where the compiler
+     *  cannot typecast implicitly (for example, in printf() argument list).
+     */
+    CBSTR raw() const { return bstr; }
+
+    /**
+     *  Returns a non-const raw pointer that allows to modify the string directly.
+     *  @warning
+     *      Be sure not to modify data beyond the allocated memory! The
+     *      guaranteed size of the allocated memory is at least #length()
+     *      bytes after creation and after every assignment operation.
+     */
+    BSTR mutableRaw() { return bstr; }
 
     /**
@@ -263,12 +225,12 @@
      *  within the interface method. Transfers the ownership of the duplicated
      *  string to the caller.
-     *
-     *  This allocates a single 0 byte in the target if the member string is empty.
-     */
-    const Bstr& cloneTo(BSTR *pstr) const
+     */
+    const Bstr &cloneTo(BSTR *pstr) const
     {
         if (pstr)
-            *pstr = ::SysAllocString((const OLECHAR*)raw());
-                    // raw() never returns NULL, so we always allocate something here
+        {
+            *pstr = NULL;
+            raw_copy(*pstr, bstr);
+        }
         return *this;
     }
@@ -281,13 +243,18 @@
      *  As opposed to cloneTo(), this method doesn't create a copy of the
      *  string.
-     *
-     *  This allocates a single 0 byte in the target if the member string is empty.
-     */
-    Bstr& detachTo(BSTR *pstr)
-    {
-        *pstr = (m_bstr) ? m_bstr : ::SysAllocString((const OLECHAR*)"");
-        m_bstr = NULL;
-        return *this;
-    }
+     */
+    Bstr &detachTo(BSTR *pstr)
+    {
+        *pstr = bstr;
+        bstr = NULL;
+        return *this;
+    }
+
+    /**
+     *  Intended to assign copies of instances to |char *| out parameters from
+     *  within the interface method. Transfers the ownership of the duplicated
+     *  string to the caller.
+     */
+    const Bstr &cloneTo(char **pstr) const;
 
     /**
@@ -295,9 +262,5 @@
      *  Takes the ownership of the returned data.
      */
-    BSTR* asOutParam()
-    {
-        cleanup();
-        return &m_bstr;
-    }
+    BSTR *asOutParam() { setNull(); return &bstr; }
 
     /**
@@ -308,115 +271,33 @@
 protected:
 
-    /**
-     * Destructor implementation, also used to clean up in operator=() before
-     * assigning a new string.
-     */
-    void cleanup()
-    {
-        if (m_bstr)
-        {
-            ::SysFreeString(m_bstr);
-            m_bstr = NULL;
-        }
-    }
-
-    /**
-     *  Protected internal helper which allocates memory for a string capable of
-     *  storing \a aSize - 1 characters (not bytes, not codepoints); in other words,
-     *  aSize includes the terminating null character.
-     *
-     *  Does NOT call cleanup() before allocating!
-     *
-     * @throws  std::bad_alloc  On allocation failure. The object is left describing
-     *             a NULL string.
-     */
-    void alloc(size_t cw)
-    {
-        if (cw)
-        {
-            m_bstr = ::SysAllocStringLen(NULL, (unsigned int)cw - 1);
-#ifdef RT_EXCEPTIONS_ENABLED
-            if (!m_bstr)
-                throw std::bad_alloc();
-#endif
-        }
-    }
-
-    /**
-     * Protected internal helper to copy a string, ignoring the previous object state.
-     *
-     * copyFrom() unconditionally sets the members to a copy of the given other
-     * strings and makes no assumptions about previous contents. Can therefore be
-     * used both in copy constructors, when member variables have no defined value,
-     * and in assignments after having called cleanup().
-     *
-     * This variant copies from another Bstr. Since Bstr does _not_ cache string lengths,
-     * this is not fast.
-     *
-     * @param   s               The source string.
-     *
-     * @throws  std::bad_alloc  On allocation failure. The object is left describing
-     *             a NULL string.
-     */
-    void copyFrom(const Bstr &s)
-    {
-        copyFrom(s.raw());
-    }
-
-    /**
-     * Protected internal helper to copy a string, ignoring the previous object state.
-     *
-     * See copyFrom() above.
-     *
-     * This variant copies from a wide char C string.
-     *
-     * @param   pcsz            The source string.
-     *
-     * @throws  std::bad_alloc  On allocation failure. The object is left describing
-     *             a NULL string.
-     */
-    void copyFrom(CBSTR pw)
-    {
-        size_t cwLength;
-        if (    (pw)
-             && ((cwLength = ::SysStringLen((BSTR)pw)))
-           )
-        {
-            size_t cwAllocated = cwLength + 1;
-            alloc(cwAllocated);
-            memcpy(m_bstr, pw, cwAllocated * sizeof(OLECHAR));     // include 0 terminator
-        }
-        else
-            m_bstr = NULL;
-    }
-
-    /**
-     * Protected internal helper to copy a string, ignoring the previous object state.
-     *
-     * See copyFrom() above.
-     *
-     * This variant converts from a Utf-8 C string.
-     *
-     * @param   pcsz            The source string.
-     *
-     * @throws  std::bad_alloc  On allocation failure. The object is left describing
-     *             a NULL string.
-     */
-    void copyFrom(const char *pcsz)
-    {
-        if (pcsz && *pcsz)
-        {
-            // @todo r=dj apparently this was copied twice in the original because our buffers
-            // use memory from SysAllocMem and IPRT doesn't, but check if this can be made faster
+    void safe_assign(CBSTR str)
+    {
+        if (bstr != str)
+        {
+            setNull();
+            raw_copy(bstr, str);
+        }
+    }
+
+    inline static void raw_copy(BSTR &ls, CBSTR rs)
+    {
+        if (rs)
+            ls = ::SysAllocString((const OLECHAR *) rs);
+    }
+
+    inline static void raw_copy(BSTR &ls, const char *rs)
+    {
+        if (rs)
+        {
             PRTUTF16 s = NULL;
-            ::RTStrToUtf16(pcsz, &s);
-            copyFrom((BSTR)s);              // @todo r=dj this is not exception safe
+            ::RTStrToUtf16(rs, &s);
+            raw_copy(ls, (BSTR)s);
             ::RTUtf16Free(s);
         }
-        else
-            m_bstr = NULL;
-    }
-
-    BSTR    m_bstr;                     /**< The string buffer. */
+    }
+
+    BSTR bstr;
+
+    friend class Utf8Str; /* to access our raw_copy() */
 };
 
@@ -430,15 +311,16 @@
 
 /**
- *  String class used universally in Main for Utf-8 strings.
- *
- *  This is based on iprt::MiniString, to which some functionality has been
- *  moved. Here we keep things that are specific to Main, such as conversions
- *  with UTF-16 strings (Bstr).
- *
- *  Like iprt::MiniString, Utf8Str does not differentiate between NULL strings
- *  and empty strings. In other words, Utf8Str("") and Utf8Str(NULL)
- *  behave the same. In both cases, MiniString allocates no memory, reports
- *  a zero length and zero allocated bytes for both, and returns an empty
- *  C string from c_str().
+ *  Helper class that represents UTF8 (|char *|) strings. Useful in
+ *  conjunction with Bstr to simplify conversions between UTF16 (|BSTR|)
+ *  and UTF8.
+ *
+ *  This class uses COM/XPCOM-provided memory management routines to allocate
+ *  and free string buffers. This makes it possible to:
+ *  - use it as a type of member variables of COM/XPCOM components and pass
+ *    their values to callers through component methods' output parameters
+ *    using the #cloneTo() operation;
+ *  - adopt (take ownership of) string buffers returned in output parameters
+ *    of COM methods using the #asOutParam() operation and correctly free them
+ *    afterwards.
  */
 class Utf8Str : public iprt::MiniString
@@ -458,5 +340,5 @@
     Utf8Str(const Bstr &that)
     {
-        copyFrom(that.raw());
+        copyFrom(that);
     }
 
@@ -481,5 +363,5 @@
     {
         cleanup();
-        copyFrom(that.raw());
+        copyFrom(that);
         return *this;
     }
@@ -497,18 +379,27 @@
      * caller.
      *
-     * This allocates a single 0 byte in the target if the member string is empty.
-     *
      * @remarks The returned string must be freed by RTStrFree, not RTMemFree.
      */
     const Utf8Str& cloneTo(char **pstr) const
     {
-        if (pstr)
-        {
-            *pstr = RTStrDup(raw());
-#ifdef RT_EXCEPTIONS_ENABLED
-            if (!*pstr)
-                throw std::bad_alloc();
-#endif
-        }
+        if (pstr) /** @todo r=bird: This needs to if m_psz is NULL. Shouldn't it also throw std::bad_alloc? */
+            *pstr = RTStrDup(m_psz);
+        return *this;
+    }
+
+    /**
+     *  Intended to assign instances to |char *| out parameters from within the
+     *  interface method. Transfers the ownership of the original string to the
+     *  caller and resets the instance to null.
+     *
+     *  As opposed to cloneTo(), this method doesn't create a copy of the
+     *  string.
+     */
+    Utf8Str& detachTo(char **pstr)
+    {
+        *pstr = m_psz;
+        m_psz = NULL;
+        m_cbAllocated = 0;
+        m_cbLength = 0;
         return *this;
     }
@@ -518,6 +409,4 @@
      *  interface method. Transfers the ownership of the duplicated string to the
      *  caller.
-     *
-     *  This allocates a single 0 byte in the target if the member string is empty.
      */
     const Utf8Str& cloneTo(BSTR *pstr) const
@@ -525,7 +414,6 @@
         if (pstr)
         {
-            Bstr bstr(c_str());
             *pstr = NULL;
-            bstr.detachTo(pstr);
+            Bstr::raw_copy(*pstr, m_psz);
         }
         return *this;
@@ -619,9 +507,6 @@
         if (s)
         {
-            RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */
-#ifdef RT_EXCEPTIONS_ENABLED
-            if (!m_psz)
-                throw std::bad_alloc();
-#endif
+            RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This isn't throwing std::bad_alloc / handling return codes.
+                                                 * Also, this technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */
             m_cbLength = strlen(m_psz);         /** @todo optimize by using a different RTUtf* function */
             m_cbAllocated = m_cbLength + 1;
@@ -640,4 +525,43 @@
 // work around error C2593 of the stupid MSVC 7.x ambiguity resolver
 WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Bstr)
+
+////////////////////////////////////////////////////////////////////////////////
+
+// inlined Bstr members that depend on Utf8Str
+
+inline Bstr::Bstr(const iprt::MiniString &that)
+    : bstr(NULL)
+{
+    raw_copy(bstr, that.c_str());
+}
+
+inline Bstr::Bstr(const char *that)
+    : bstr(NULL)
+{
+    raw_copy(bstr, that);
+}
+
+inline Bstr &Bstr::operator=(const Utf8Str &that)
+{
+    setNull();
+    raw_copy(bstr, that.c_str());
+    return *this;
+}
+inline Bstr &Bstr::operator=(const char *that)
+{
+    setNull();
+    raw_copy(bstr, that);
+    return *this;
+}
+
+inline const Bstr& Bstr::cloneTo(char **pstr) const
+{
+    if (pstr)
+    {
+        Utf8Str ustr(*this);
+        ustr.detachTo(pstr);
+    }
+    return *this;
+}
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -730,5 +654,5 @@
         va_list args;
         va_start(args, aFormat);
-        copyFrom(Utf8StrFmtVA(aFormat, args).c_str());
+        raw_copy(bstr, Utf8StrFmtVA(aFormat, args).c_str());
         va_end(args);
     }
@@ -751,5 +675,5 @@
     BstrFmtVA(const char *aFormat, va_list aArgs)
     {
-        copyFrom(Utf8StrFmtVA(aFormat, aArgs).c_str());
+        raw_copy(bstr, Utf8StrFmtVA(aFormat, aArgs).c_str());
     }
 };
Index: /trunk/include/iprt/cpp/ministring.h
===================================================================
--- /trunk/include/iprt/cpp/ministring.h	(revision 26552)
+++ /trunk/include/iprt/cpp/ministring.h	(revision 26553)
@@ -45,10 +45,4 @@
  * else except IPRT memory management functions.  Semantics are like in
  * std::string, except it can do a lot less.
- *
- * Note that MiniString does not differentiate between NULL strings and
- * empty strings. In other words, MiniString("") and MiniString(NULL)
- * behave the same. In both cases, MiniString allocates no memory, reports
- * a zero length and zero allocated bytes for both, and returns an empty
- * C string from c_str().
  */
 #ifdef VBOX
@@ -77,5 +71,5 @@
      * Creates a copy of another MiniString.
      *
-     * This allocates s.length() + 1 bytes for the new instance, unless s is empty.
+     * This allocates s.length() + 1 bytes for the new instance.
      *
      * @param   s               The source string.
@@ -89,7 +83,7 @@
 
     /**
-     * Creates a copy of a C string.
-     *
-     * This allocates strlen(pcsz) + 1 bytes for the new instance, unless s is empty.
+     * Creates a copy of another MiniString.
+     *
+     * This allocates strlen(pcsz) + 1 bytes for the new instance.
      *
      * @param   pcsz            The source string.
@@ -129,5 +123,5 @@
      *
      * Returns the number of bytes allocated in the internal string buffer, which is
-     * at least length() + 1 if length() > 0. Returns 0 for an empty string.
+     * at least length() + 1 if length() > 0.
      *
      * @returns m_cbAllocated.
@@ -281,5 +275,5 @@
      * Returns the byte at the given index, or a null byte if the index is not
      * smaller than length().  This does _not_ count codepoints but simply points
-     * into the member C string; the result may not be a valid UTF-8 character.
+     * into the member C string.
      *
      * @param   i       The index into the string buffer.
@@ -295,6 +289,4 @@
     /**
      * Returns the contained string as a C-style const char* pointer.
-     * This never returns NULL; if the string is empty, returns a
-     * pointer to static null byte.
      *
      * @returns const pointer to C-style string.
@@ -302,11 +294,9 @@
     inline const char *c_str() const
     {
-        return (m_psz) ? m_psz : "";
+        return m_psz;
     }
 
     /**
      * Like c_str(), for compatibility with lots of VirtualBox Main code.
-     * This never returns NULL; if the string is empty, returns a
-     * pointer to static null byte.
      *
      * @returns const pointer to C-style string.
@@ -314,9 +304,9 @@
     inline const char *raw() const
     {
-        return (m_psz) ? m_psz : "";
-    }
-
-    /**
-     * Empty string or not?
+        return m_psz;
+    }
+
+    /**
+     * Emptry string or not?
      *
      * Returns true if the member string has no length.  This states nothing about
@@ -482,4 +472,9 @@
 
     /**
+     * Hide operator bool() to force people to use isEmpty() explicitly.
+     */
+    operator bool() const { return false; }
+
+    /**
      * Destructor implementation, also used to clean up in operator=() before
      * assigning a new string.
@@ -497,5 +492,6 @@
 
     /**
-     * Protected internal helper to copy a string, ignoring the previous object state.
+     * Protected internal helper for copy a string that completely ignors the
+     * current object state.
      *
      * copyFrom() unconditionally sets the members to a copy of the given other
@@ -505,5 +501,5 @@
      *
      * This variant copies from another MiniString and is fast since
-     * the length of the source string is known.
+     * the length of source string is known.
      *
      * @param   s               The source string.
@@ -537,5 +533,6 @@
 
     /**
-     * Protected internal helper to copy a string, ignoring the previous object state.
+     * Protected internal helper for copy a string that completely ignors the
+     * current object state.
      *
      * See copyFrom() above.
@@ -575,13 +572,4 @@
     }
 
-private:
-
-    /**
-     * Hide operator bool() to force people to use isEmpty() explicitly.
-     */
-    operator bool() const;
-
-protected:
-
     char    *m_psz;                     /**< The string buffer. */
     size_t  m_cbLength;                 /**< strlen(m_psz) - i.e. no terminator included. */
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp	(revision 26552)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp	(revision 26553)
@@ -230,5 +230,5 @@
 
         ComPtr<IHostNetworkInterface> hif;
-        CHECK_ERROR(host, FindHostNetworkInterfaceByName(Bstr(pIfName), hif.asOutParam()));
+        CHECK_ERROR(host, FindHostNetworkInterfaceByName(Bstr(pIfName).mutableRaw(), hif.asOutParam()));
         if(FAILED(rc))
             return errorArgument("could not find interface '%s'", pIfName);
@@ -244,5 +244,5 @@
 
     ComPtr<IDHCPServer> svr;
-    rc = a->virtualBox->FindDHCPServerByNetworkName(NetName, svr.asOutParam());
+    rc = a->virtualBox->FindDHCPServerByNetworkName(NetName.mutableRaw(), svr.asOutParam());
     if(enmCode == OP_ADD)
     {
@@ -250,5 +250,5 @@
             return errorArgument("dhcp server already exists");
 
-        CHECK_ERROR(a->virtualBox, CreateDHCPServer(NetName.raw(), svr.asOutParam()));
+        CHECK_ERROR(a->virtualBox, CreateDHCPServer(NetName.mutableRaw(), svr.asOutParam()));
         if(FAILED(rc))
             return errorArgument("failed to create server");
@@ -263,5 +263,5 @@
         if (pIp || pNetmask || pLowerIp || pUpperIp)
         {
-            CHECK_ERROR(svr, SetConfiguration(Bstr(pIp).raw(), Bstr(pNetmask), Bstr(pLowerIp), Bstr(pUpperIp)));
+            CHECK_ERROR(svr, SetConfiguration (Bstr(pIp).mutableRaw(), Bstr(pNetmask).mutableRaw(), Bstr(pLowerIp).mutableRaw(), Bstr(pUpperIp).mutableRaw()));
             if(FAILED(rc))
                 return errorArgument("failed to set configuration");
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp	(revision 26552)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp	(revision 26553)
@@ -281,5 +281,5 @@
         bool doClose = false;
 
-        if (!comment.isEmpty())
+        if (!comment.isNull())
         {
             CHECK_ERROR(hardDisk,COMSETTER(Description)(comment));
@@ -1038,5 +1038,5 @@
         if (FAILED(rc)) break;
 
-        if (!port.isEmpty())
+        if (!port.isNull())
             server = BstrFmt ("%ls:%ls", server.raw(), port.raw());
 
@@ -1047,17 +1047,17 @@
         server.detachTo (values.appendedRaw());
         Bstr ("TargetName").detachTo (names.appendedRaw());
-        target.detachTo(values.appendedRaw());
-
-        if (!lun.isEmpty())
+        target.detachTo (values.appendedRaw());
+
+        if (!lun.isNull())
         {
             Bstr ("LUN").detachTo (names.appendedRaw());
             lun.detachTo (values.appendedRaw());
         }
-        if (!username.isEmpty())
+        if (!username.isNull())
         {
             Bstr ("InitiatorUsername").detachTo (names.appendedRaw());
             username.detachTo (values.appendedRaw());
         }
-        if (!password.isEmpty())
+        if (!password.isNull())
         {
             Bstr ("InitiatorSecret").detachTo (names.appendedRaw());
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp	(revision 26552)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp	(revision 26553)
@@ -441,14 +441,14 @@
                 if (!f.mActive.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive));
-                if (!f.mVendorId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId)(f.mVendorId));
-                if (!f.mProductId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));
-                if (!f.mRevision.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));
-                if (!f.mManufacturer.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));
-                if (!f.mSerialNumber.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));
+                if (!f.mVendorId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId.setNullIfEmpty()));
+                if (!f.mProductId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId.setNullIfEmpty()));
+                if (!f.mRevision.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision.setNullIfEmpty()));
+                if (!f.mManufacturer.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer.setNullIfEmpty()));
+                if (!f.mSerialNumber.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
                 if (!f.mMaskedInterfaces.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
@@ -466,16 +466,16 @@
                 if (!f.mActive.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive));
-                if (!f.mVendorId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));
-                if (!f.mProductId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));
-                if (!f.mRevision.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));
-                if (!f.mManufacturer.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));
-                if (!f.mRemote.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote));
-                if (!f.mSerialNumber.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));
+                if (!f.mVendorId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId.setNullIfEmpty()));
+                if (!f.mProductId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId.setNullIfEmpty()));
+                if (!f.mRevision.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision.setNullIfEmpty()));
+                if (!f.mManufacturer.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer.setNullIfEmpty()));
+                if (!f.mRemote.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote.setNullIfEmpty()));
+                if (!f.mSerialNumber.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
                 if (!f.mMaskedInterfaces.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
@@ -494,18 +494,18 @@
                 ComPtr <IHostUSBDeviceFilter> flt = coll[cmd.mIndex];
 
-                if (!f.mName.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName));
+                if (!f.mName.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName.setNullIfEmpty()));
                 if (!f.mActive.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive));
-                if (!f.mVendorId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));
-                if (!f.mProductId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));
-                if (!f.mRevision.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));
-                if (!f.mManufacturer.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));
-                if (!f.mSerialNumber.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));
+                if (!f.mVendorId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId.setNullIfEmpty()));
+                if (!f.mProductId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId.setNullIfEmpty()));
+                if (!f.mRevision.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision.setNullIfEmpty()));
+                if (!f.mManufacturer.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer.setNullIfEmpty()));
+                if (!f.mSerialNumber.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
                 if (!f.mMaskedInterfaces.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
@@ -521,20 +521,20 @@
                 ComPtr <IUSBDeviceFilter> flt = coll[cmd.mIndex];
 
-                if (!f.mName.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName));
+                if (!f.mName.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName.setNullIfEmpty()));
                 if (!f.mActive.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive));
-                if (!f.mVendorId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));
-                if (!f.mProductId.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));
-                if (!f.mRevision.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));
-                if (!f.mManufacturer.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));
-                if (!f.mRemote.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote));
-                if (!f.mSerialNumber.isEmpty())
-                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));
+                if (!f.mVendorId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId.setNullIfEmpty()));
+                if (!f.mProductId.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId.setNullIfEmpty()));
+                if (!f.mRevision.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision.setNullIfEmpty()));
+                if (!f.mManufacturer.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer.setNullIfEmpty()));
+                if (!f.mRemote.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote.setNullIfEmpty()));
+                if (!f.mSerialNumber.isNull())
+                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
                 if (!f.mMaskedInterfaces.isNull())
                     CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 26552)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 26553)
@@ -228,5 +228,5 @@
             return E_INVALIDARG;
 
-        if (com::asGuidStr(id).isEmpty())
+        if (com::asGuidStr(id).isNull())
         {
             /* it's a global extra data key someone wants to change */
@@ -310,5 +310,5 @@
                                   IN_BSTR key, IN_BSTR value)
     {
-        if (com::asGuidStr(id).isEmpty())
+        if (com::asGuidStr(id).isNull())
         {
             QString sKey = QString::fromUtf16 (key);
Index: /trunk/src/VBox/HostServices/GuestProperties/service.cpp
===================================================================
--- /trunk/src/VBox/HostServices/GuestProperties/service.cpp	(revision 26552)
+++ /trunk/src/VBox/HostServices/GuestProperties/service.cpp	(revision 26553)
@@ -1158,11 +1158,7 @@
  */
 /* static */
-DECLCALLBACK(int) Service::reqNotify(PFNHGCMSVCEXT pfnCallback,
-                                     void *pvData,
-                                     char *pszName,
-                                     char *pszValue,
-                                     uint32_t u32TimeHigh,
-                                     uint32_t u32TimeLow,
-                                     char *pszFlags)
+DECLCALLBACK(int) Service::reqNotify(PFNHGCMSVCEXT pfnCallback, void *pvData,
+                                     char *pszName, char *pszValue, uint32_t u32TimeHigh,
+                                     uint32_t u32TimeLow, char *pszFlags)
 {
     LogFlowFunc (("pfnCallback=%p, pvData=%p, pszName=%p, pszValue=%p, u32TimeHigh=%u, u32TimeLow=%u, pszFlags=%p\n", pfnCallback, pvData, pszName, pszValue, u32TimeHigh, u32TimeLow, pszFlags));
Index: /trunk/src/VBox/Main/ApplianceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ApplianceImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/ApplianceImpl.cpp	(revision 26553)
@@ -370,5 +370,5 @@
     int i = 1;
     /* @todo: Maybe too cost-intensive; try to find a lighter way */
-    while (mVirtualBox->FindMachine(Bstr(tmpName).raw(), &machine) != VBOX_E_OBJECT_NOT_FOUND)
+    while (mVirtualBox->FindMachine(Bstr(tmpName), &machine) != VBOX_E_OBJECT_NOT_FOUND)
     {
         RTStrFree(tmpName);
@@ -391,5 +391,5 @@
     /* @todo: Maybe too cost-intensive; try to find a lighter way */
     while (RTPathExists(tmpName) ||
-           mVirtualBox->FindHardDisk(Bstr(tmpName).raw(), &harddisk) != VBOX_E_OBJECT_NOT_FOUND)
+           mVirtualBox->FindHardDisk(Bstr(tmpName), &harddisk) != VBOX_E_OBJECT_NOT_FOUND)
     {
         RTStrFree(tmpName);
@@ -501,5 +501,5 @@
 }
 
-HRESULT Appliance::setUpProgressFS(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription)
+HRESULT Appliance::setUpProgressFS(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)
 {
     HRESULT rc;
@@ -532,14 +532,14 @@
 
     rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this),
-                         strDescription,
+                         bstrDescription,
                          TRUE /* aCancelable */,
                          cOperations, // ULONG cOperations,
                          ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight,
-                         strDescription, // CBSTR bstrFirstOperationDescription,
+                         bstrDescription, // CBSTR bstrFirstOperationDescription,
                          m->ulWeightPerOperation); // ULONG ulFirstOperationWeight,
     return rc;
 }
 
-HRESULT Appliance::setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription)
+HRESULT Appliance::setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)
 {
     HRESULT rc;
@@ -572,14 +572,14 @@
 
     rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this),
-                         strDescription,
+                         bstrDescription,
                          TRUE /* aCancelable */,
                          cOperations, // ULONG cOperations,
                          ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight,
-                         tr("Init"), // CBSTR bstrFirstOperationDescription,
+                         Bstr(tr("Init")), // CBSTR bstrFirstOperationDescription,
                          ulInitWeight); // ULONG ulFirstOperationWeight,
     return rc;
 }
 
-HRESULT Appliance::setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription)
+HRESULT Appliance::setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)
 {
     HRESULT rc;
@@ -614,9 +614,9 @@
 
     rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this),
-                         strDescription,
+                         bstrDescription,
                          TRUE /* aCancelable */,
                          cOperations, // ULONG cOperations,
                          ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight,
-                         strDescription, // CBSTR bstrFirstOperationDescription,
+                         bstrDescription, // CBSTR bstrFirstOperationDescription,
                          ulOVFCreationWeight); // ULONG ulFirstOperationWeight,
     return rc;
@@ -837,6 +837,6 @@
     task->locInfo = aLocInfo;
 
-    Utf8Str progressDesc = Utf8StrFmt(tr("Import appliance '%s'"),
-                                      aLocInfo.strPath.c_str());
+    Bstr progressDesc = BstrFmt(tr("Import appliance '%s'"),
+                                aLocInfo.strPath.c_str());
 
     HRESULT rc = S_OK;
@@ -1569,5 +1569,5 @@
                                                     mhda.lDevice,
                                                     DeviceType_Floppy,
-                                                    NULL);
+                                                    Bstr(""));
                         if (FAILED(rc)) throw rc;
 
@@ -1618,5 +1618,5 @@
                                                     mhda.lDevice,
                                                     DeviceType_DVD,
-                                                    NULL);
+                                                    Bstr(""));
                         if (FAILED(rc)) throw rc;
 
@@ -1744,5 +1744,5 @@
                             rc = mVirtualBox->OpenHardDisk(Bstr(strSrcFilePath),
                                                            AccessMode_ReadOnly,
-                                                           false, NULL, false, NULL,
+                                                           false, Bstr(""), false, Bstr(""),
                                                            srcHdVBox.asOutParam());
                             if (FAILED(rc)) throw rc;
@@ -4281,4 +4281,7 @@
                                                       IN_BSTR aExtraConfigValue)
 {
+    CheckComArgNotNull(aVboxValue);
+    CheckComArgNotNull(aExtraConfigValue);
+
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 26553)
@@ -584,5 +584,5 @@
     if (RT_SUCCESS(rc))
     {
-        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST"));
+        mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
         RTStrFree(pszPropertyName);
     }
@@ -591,5 +591,5 @@
     if (RT_SUCCESS(rc))
     {
-        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST"));
+        mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
         RTStrFree(pszPropertyName);
     }
@@ -598,5 +598,5 @@
     if (RT_SUCCESS(rc))
     {
-        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST"));
+        mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
         RTStrFree(pszPropertyName);
     }
@@ -1190,7 +1190,7 @@
 
 // static
-DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
-                                                   uint32_t u32Function,
-                                                   void *pvParms, uint32_t cbParms)
+DECLCALLBACK(int)
+Console::doGuestPropNotification(void *pvExtension, uint32_t u32Function,
+                                 void *pvParms, uint32_t cbParms)
 {
     using namespace guestProp;
@@ -1212,17 +1212,25 @@
     Bstr value(pCBData->pcszValue);
     Bstr flags(pCBData->pcszFlags);
-    ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension);
-    HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name,
-                                                          value,
-                                                          pCBData->u64Timestamp,
-                                                          flags);
-    if (SUCCEEDED(hrc))
-        rc = VINF_SUCCESS;
+    if (   !name.isNull()
+        && (!value.isNull() || pCBData->pcszValue == NULL)
+        && (!flags.isNull() || pCBData->pcszFlags == NULL)
+       )
+    {
+        ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension);
+        HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name,
+                                                              value,
+                                                              pCBData->u64Timestamp,
+                                                              flags);
+        if (SUCCEEDED(hrc))
+            rc = VINF_SUCCESS;
+        else
+        {
+            LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
+                     pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
+            rc = Global::vboxStatusCodeFromCOM(hrc);
+        }
+    }
     else
-    {
-        LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
-                    pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
-        rc = Global::vboxStatusCodeFromCOM(hrc);
-    }
+        rc = VERR_NO_MEMORY;
     return rc;
 }
@@ -2586,5 +2594,5 @@
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgStrNotEmptyOrNull(aAddress);
+    CheckComArgNotNull(aAddress);
     CheckComArgOutPointerValid(aDevice);
 
@@ -2653,8 +2661,9 @@
 }
 
-STDMETHODIMP Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
-{
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgStrNotEmptyOrNull(aHostPath);
+STDMETHODIMP
+Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
+{
+    CheckComArgNotNull(aName);
+    CheckComArgNotNull(aHostPath);
 
     AutoCaller autoCaller(this);
@@ -2723,5 +2732,5 @@
 STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
 
     AutoCaller autoCaller(this);
@@ -2789,5 +2798,5 @@
     LogFlowThisFunc(("aName='%ls' mMachineState=%08X\n", aName, mMachineState));
 
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aProgress);
 
@@ -7716,6 +7725,6 @@
          * (i.e. creating a snapshot online)
          */
-        ComAssertThrow(    (!pTask->bstrSavedStateFile.isEmpty() && pTask->fTakingSnapshotOnline)
-                        || (pTask->bstrSavedStateFile.isEmpty() && !pTask->fTakingSnapshotOnline),
+        ComAssertThrow(    (!pTask->bstrSavedStateFile.isNull() && pTask->fTakingSnapshotOnline)
+                        || (pTask->bstrSavedStateFile.isNull() && !pTask->fTakingSnapshotOnline),
                        rc = E_FAIL);
 
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 26553)
@@ -3155,5 +3155,5 @@
                 }
 
-                if (!networkName.isEmpty())
+                if (!networkName.isNull())
                 {
                     /*
@@ -3162,5 +3162,5 @@
                      */
                     ComPtr<IDHCPServer> dhcpServer;
-                    hrc = virtualBox->FindDHCPServerByNetworkName(networkName.raw(), dhcpServer.asOutParam());
+                    hrc = virtualBox->FindDHCPServerByNetworkName(networkName.mutableRaw(), dhcpServer.asOutParam());
                     if (SUCCEEDED(hrc))
                     {
Index: /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp	(revision 26553)
@@ -894,9 +894,6 @@
  * @param   aProgress       Where to return the progress object.
  */
-STDMETHODIMP Console::Teleport(IN_BSTR aHostname,
-                               ULONG aPort,
-                               IN_BSTR aPassword,
-                               ULONG aMaxDowntime,
-                               IProgress **aProgress)
+STDMETHODIMP
+Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress)
 {
     /*
@@ -906,4 +903,5 @@
     CheckComArgOutPointerValid(aProgress);
     CheckComArgStrNotEmptyOrNull(aHostname);
+    CheckComArgNotNull(aHostname);
     CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort));
     CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime));
Index: /trunk/src/VBox/Main/GuestImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/GuestImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/GuestImpl.cpp	(revision 26553)
@@ -127,6 +127,6 @@
 
     // redirect the call to IMachine if no additions are installed
-    if (mData.mAdditionsVersion.isEmpty())
-        return mParent->machine()->COMGETTER(OSTypeId)(aOSTypeId);
+    if (mData.mAdditionsVersion.isNull())
+        return mParent->machine()->COMGETTER(OSTypeId) (aOSTypeId);
 
     mData.mOSTypeId.cloneTo(aOSTypeId);
@@ -135,5 +135,5 @@
 }
 
-STDMETHODIMP Guest::COMGETTER(AdditionsActive)(BOOL *aAdditionsActive)
+STDMETHODIMP Guest::COMGETTER(AdditionsActive) (BOOL *aAdditionsActive)
 {
     CheckComArgOutPointerValid(aAdditionsActive);
@@ -262,4 +262,8 @@
                                    IN_BSTR aDomain, BOOL aAllowInteractiveLogon)
 {
+    CheckComArgNotNull(aUserName);
+    CheckComArgNotNull(aPassword);
+    CheckComArgNotNull(aDomain);
+
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -274,8 +278,6 @@
 
         vmmDev->getVMMDevPort()->pfnSetCredentials(vmmDev->getVMMDevPort(),
-                                                   Utf8Str(aUserName).raw(),
-                                                   Utf8Str(aPassword).raw(),
-                                                   Utf8Str(aDomain).raw(),
-                                                   u32Flags);
+            Utf8Str(aUserName).raw(), Utf8Str(aPassword).raw(),
+            Utf8Str(aDomain).raw(), u32Flags);
         return S_OK;
     }
@@ -315,5 +317,5 @@
 void Guest::setAdditionsVersion (Bstr aVersion, VBOXOSTYPE aOsType)
 {
-    Assert(aVersion.isEmpty() || !aVersion.isEmpty());
+    Assert(aVersion.isNull() || !aVersion.isEmpty());
 
     AutoCaller autoCaller(this);
@@ -323,7 +325,7 @@
 
     mData.mAdditionsVersion = aVersion;
-    mData.mAdditionsActive = !aVersion.isEmpty();
-
-    mData.mOSTypeId = Global::OSTypeId(aOsType);
+    mData.mAdditionsActive = !aVersion.isNull();
+
+    mData.mOSTypeId = Global::OSTypeId (aOsType);
 }
 
Index: /trunk/src/VBox/Main/HostImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/HostImpl.cpp	(revision 26553)
@@ -1290,5 +1290,5 @@
 STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aDrive);
 
@@ -1317,5 +1317,5 @@
 STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aDrive);
 
@@ -1451,5 +1451,5 @@
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgStrNotEmptyOrNull(aAddress);
+    CheckComArgNotNull(aAddress);
     CheckComArgOutPointerValid(aDevice);
 
Index: /trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp	(revision 26553)
@@ -56,8 +56,8 @@
  * @param   aGuid GUID of the host network interface
  */
-HRESULT HostNetworkInterface::init(Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType)
+HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType)
 {
     LogFlowThisFunc(("aInterfaceName={%ls}, aGuid={%s}\n",
-                     aInterfaceName.raw(), aGuid.toString().raw()));
+                      aInterfaceName.raw(), aGuid.toString().raw()));
 
     ComAssertRet(aInterfaceName, E_INVALIDARG);
@@ -423,7 +423,7 @@
             {
                 m.realIPAddress = 0;
-                if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw())), NULL)))
+                if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw())), Bstr(""))))
                     return E_FAIL;
-                if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw())), NULL)))
+                if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw())), Bstr(""))))
                     return E_FAIL;
                 return S_OK;
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 26553)
@@ -697,5 +697,7 @@
 STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
 {
-    if (!aName || !*aName)
+    CheckComArgNotNull(aName);
+
+    if (!*aName)
         return setError(E_INVALIDARG,
                         tr("Machine name cannot be empty"));
@@ -777,5 +779,5 @@
 STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
 {
-    CheckComArgStrNotEmptyOrNull(aOSTypeId);
+    CheckComArgNotNull(aOSTypeId);
 
     AutoCaller autoCaller(this);
@@ -1928,5 +1930,8 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mSession.mType.cloneTo(aSessionType);
+    if (mData->mSession.mType.isNull())
+        Bstr("").cloneTo(aSessionType);
+    else
+        mData->mSession.mType.cloneTo(aSessionType);
 
     return S_OK;
@@ -1985,5 +1990,8 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mSSData->mStateFilePath.cloneTo(aStateFilePath);
+    if (mSSData->mStateFilePath.isEmpty())
+        Bstr("").cloneTo(aStateFilePath);
+    else
+        mSSData->mStateFilePath.cloneTo(aStateFilePath);
 
     return S_OK;
@@ -2126,6 +2134,8 @@
 }
 
-STDMETHODIMP Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns)
-{
+STDMETHODIMP
+Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns)
+{
+    CheckComArgNotNull(aPatterns);
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -2390,8 +2400,9 @@
                                    IN_BSTR aId)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aId=\"%ls\"\n",
                      aControllerName, aControllerPort, aDevice, aType, aId));
+
+    CheckComArgNotNull(aControllerName);
+    CheckComArgNotNull(aId);
 
     AutoCaller autoCaller(this);
@@ -2815,5 +2826,5 @@
                                    LONG aDevice)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
+    CheckComArgNotNull(aControllerName);
 
     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n",
@@ -2900,5 +2911,5 @@
                                         LONG aDevice, BOOL aPassthrough)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
+    CheckComArgNotNull(aControllerName);
 
     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aPassthrough=%d\n",
@@ -2954,5 +2965,6 @@
                      aControllerName, aControllerPort, aDevice, aForce));
 
-    CheckComArgStrNotEmptyOrNull(aControllerName);
+    CheckComArgNotNull(aControllerName);
+    CheckComArgNotNull(aId);
 
     AutoCaller autoCaller(this);
@@ -3094,5 +3106,5 @@
                      aControllerName, aControllerPort, aDevice));
 
-    CheckComArgStrNotEmptyOrNull(aControllerName);
+    CheckComArgNotNull(aControllerName);
     CheckComArgOutPointerValid(aMedium);
 
@@ -3193,5 +3205,5 @@
                                    BSTR *aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
+    CheckComArgNotNull(aKey);
     CheckComArgOutPointerValid(aValue);
 
@@ -3200,5 +3212,5 @@
 
     /* start with nothing found */
-    Bstr bstrResult;
+    Bstr bstrResult("");
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -3220,5 +3232,5 @@
 STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
+    CheckComArgNotNull(aKey);
 
     AutoCaller autoCaller(this);
@@ -3251,10 +3263,14 @@
         // lock to copy the list of callbacks to invoke
         Bstr error;
-        Bstr bstrValue(aValue);
+        Bstr bstrValue;
+        if (aValue)
+            bstrValue = aValue;
+        else
+            bstrValue = (const char *)"";
 
         if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue, error))
         {
             const char *sep = error.isEmpty() ? "" : ": ";
-            CBSTR err = error.raw();
+            CBSTR err = error.isNull() ? (CBSTR) L"" : error.raw();
             LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
                             sep, err));
@@ -3440,5 +3456,5 @@
 STDMETHODIMP Machine::FindSnapshot(IN_BSTR aName, ISnapshot **aSnapshot)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aSnapshot);
 
@@ -3466,6 +3482,6 @@
 STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgStrNotEmptyOrNull(aHostPath);
+    CheckComArgNotNull(aName);
+    CheckComArgNotNull(aHostPath);
 
     AutoCaller autoCaller(this);
@@ -3501,5 +3517,5 @@
 STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
 
     AutoCaller autoCaller(this);
@@ -3591,5 +3607,5 @@
     ReturnComNotImplemented();
 #else // VBOX_WITH_GUEST_PROPS
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutPointerValid(aValue);
     CheckComArgOutPointerValid(aTimestamp);
@@ -3670,5 +3686,6 @@
     using namespace guestProp;
 
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
+    CheckComArgNotNull(aValue);
     if ((aFlags != NULL) && !VALID_PTR(aFlags))
         return E_INVALIDARG;
@@ -3679,5 +3696,4 @@
     {
         Utf8Str utf8Name(aName);
-        Utf8Str utf8Value(aValue);
         Utf8Str utf8Flags(aFlags);
 
@@ -3735,8 +3751,8 @@
             if (found && SUCCEEDED(rc))
             {
-                if (utf8Value.length())
+                if (*aValue)
                 {
                     RTTIMESPEC time;
-                    property.strValue = utf8Value;
+                    property.strValue = aValue;
                     property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
                     if (aFlags != NULL)
@@ -3745,5 +3761,5 @@
                 }
             }
-            else if (SUCCEEDED(rc) && utf8Value.length())
+            else if (SUCCEEDED(rc) && *aValue)
             {
                 RTTIMESPEC time;
@@ -3751,5 +3767,5 @@
                 mHWData.backup();
                 property.strName = aName;
-                property.strValue = utf8Value;
+                property.strValue = aValue;
                 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
                 property.mFlags = fFlags;
@@ -3769,5 +3785,6 @@
         else
         {
-            ComPtr<IInternalSessionControl> directControl = mData->mSession.mDirectControl;
+            ComPtr<IInternalSessionControl> directControl =
+                mData->mSession.mDirectControl;
 
             /* just be on the safe side when calling another process */
@@ -3780,5 +3797,5 @@
             else
                 rc = directControl->AccessGuestProperty(aName,
-                                                        aValue,
+                                                        *aValue ? aValue : NULL,  /** @todo Fix when adding DeleteGuestProperty(), see defect. */
                                                         aFlags,
                                                         true /* isSetter */,
@@ -3914,5 +3931,5 @@
                      aControllerName, aControllerPort, aDevice));
 
-    CheckComArgStrNotEmptyOrNull(aControllerName);
+    CheckComArgNotNull(aControllerName);
     CheckComArgOutPointerValid(aAttachment);
 
@@ -8930,5 +8947,5 @@
 #endif /* VBOX_WITH_USB */
 
-    if (!mData->mSession.mType.isEmpty())
+    if (!mData->mSession.mType.isNull())
     {
         /* mType is not null when this machine's process has been started by
@@ -9638,6 +9655,6 @@
     using namespace guestProp;
 
-    CheckComArgStrNotEmptyOrNull(aName);
-    if (aValue && *aValue && (!VALID_PTR(aValue) || !VALID_PTR(aFlags)))
+    CheckComArgNotNull(aName);
+    if (aValue != NULL && (!VALID_PTR(aValue) || !VALID_PTR(aFlags)))
         return E_POINTER;  /* aValue can be NULL to indicate deletion */
 
Index: /trunk/src/VBox/Main/Matching.cpp
===================================================================
--- /trunk/src/VBox/Main/Matching.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/Matching.cpp	(revision 26553)
@@ -198,6 +198,6 @@
     return
         mSimple.isEmpty() ||
-        (mIgnoreCase && mSimple.compare(aValue, Bstr::CaseInsensitive) == 0) ||
-        (!mIgnoreCase && mSimple.compare(aValue) == 0);
+        (mIgnoreCase && mSimple.compareIgnoreCase (aValue) == 0) ||
+        (!mIgnoreCase && mSimple.compare (aValue) == 0);
 }
 
Index: /trunk/src/VBox/Main/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MediumImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/MediumImpl.cpp	(revision 26553)
@@ -1361,5 +1361,8 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strDescription.cloneTo(aDescription);
+    if (m->strDescription.isEmpty())
+        Bstr("").cloneTo(aDescription);
+    else
+        m->strDescription.cloneTo(aDescription);
 
     return S_OK;
@@ -1368,4 +1371,6 @@
 STDMETHODIMP Medium::COMSETTER(Description)(IN_BSTR aDescription)
 {
+    CheckComArgNotNull(aDescription);
+
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -1410,5 +1415,5 @@
 STDMETHODIMP Medium::COMSETTER(Location)(IN_BSTR aLocation)
 {
-    CheckComArgStrNotEmptyOrNull(aLocation);
+    CheckComArgNotNull(aLocation);
 
     AutoCaller autoCaller(this);
@@ -1720,5 +1725,8 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strLastAccessError.cloneTo(aLastAccessError);
+    if (m->strLastAccessError.isEmpty())
+        Bstr("").cloneTo(aLastAccessError);
+    else
+        m->strLastAccessError.cloneTo(aLastAccessError);
 
     return S_OK;
@@ -2094,5 +2102,8 @@
                         tr("Property '%ls' does not exist"), aName);
 
-    it->second.cloneTo(aValue);
+    if (it->second.isEmpty())
+        Bstr("").cloneTo(aValue);
+    else
+        it->second.cloneTo(aValue);
 
     return S_OK;
@@ -2158,5 +2169,8 @@
     {
         it->first.cloneTo(&names[i]);
-        it->second.cloneTo(&values[i]);
+        if (it->second.isEmpty())
+            Bstr("").cloneTo(&values[i]);
+        else
+            it->second.cloneTo(&values[i]);
         ++ i;
     }
@@ -2348,7 +2362,7 @@
 
 STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
-                             MediumVariant_T aVariant,
-                             IMedium *aParent,
-                             IProgress **aProgress)
+                              MediumVariant_T aVariant,
+                              IMedium *aParent,
+                              IProgress **aProgress)
 {
     CheckComArgNotNull(aTarget);
@@ -3076,5 +3090,5 @@
     {
         /* only save properties that have non-default values */
-        if (!it->second.isEmpty())
+        if (!it->second.isNull())
         {
             Utf8Str name = it->first;
@@ -4844,5 +4858,5 @@
 
     /* we interpret null values as "no value" in Medium */
-    if (it->second.isEmpty())
+    if (it->second.isNull())
         return VERR_CFGM_VALUE_NOT_FOUND;
 
@@ -4871,5 +4885,5 @@
 
     /* we interpret null values as "no value" in Medium */
-    if (it->second.isEmpty())
+    if (it->second.isNull())
         return VERR_CFGM_VALUE_NOT_FOUND;
 
Index: /trunk/src/VBox/Main/NetworkAdapterImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/NetworkAdapterImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/NetworkAdapterImpl.cpp	(revision 26553)
@@ -1026,4 +1026,6 @@
         case NetworkAttachmentType_NAT:
             mData->mNATNetwork = data.strName;
+            if (mData->mNATNetwork.isNull())
+                mData->mNATNetwork = "";
             rc = AttachToNAT();
             if (FAILED(rc)) return rc;
@@ -1039,5 +1041,5 @@
         case NetworkAttachmentType_Internal:
             mData->mInternalNetwork = data.strName;
-            Assert(!mData->mInternalNetwork.isEmpty());
+            Assert(!mData->mInternalNetwork.isNull());
 
             rc = AttachToInternalNetwork();
Index: /trunk/src/VBox/Main/ProgressImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ProgressImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/ProgressImpl.cpp	(revision 26553)
@@ -97,11 +97,10 @@
  * @return              COM result indicator.
  */
-HRESULT ProgressBase::protectedInit(AutoInitSpan &aAutoInitSpan,
+HRESULT ProgressBase::protectedInit (AutoInitSpan &aAutoInitSpan,
 #if !defined (VBOX_COM_INPROC)
-                                    VirtualBox *aParent,
+                            VirtualBox *aParent,
 #endif
-                                    IUnknown *aInitiator,
-                                    const Utf8Str &strDescription,
-                                    OUT_GUID aId /* = NULL */)
+                            IUnknown *aInitiator,
+                            CBSTR aDescription, OUT_GUID aId /* = NULL */)
 {
     /* Guarantees subclasses call this method at the proper time */
@@ -117,5 +116,5 @@
 #endif
 
-    AssertReturn(!strDescription.isEmpty(), E_INVALIDARG);
+    AssertReturn(aDescription, E_INVALIDARG);
 
 #if !defined (VBOX_COM_INPROC)
@@ -144,5 +143,5 @@
 #endif
 
-    unconst(m_strDescription) = strDescription;
+    unconst(mDescription) = aDescription;
 
     return S_OK;
@@ -221,5 +220,5 @@
 
     /* mDescription is constant during life time, no need to lock */
-    m_strDescription.cloneTo(aDescription);
+    mDescription.cloneTo(aDescription);
 
     return S_OK;
@@ -466,5 +465,5 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m_strOperationDescription.cloneTo(aOperationDescription);
+    m_bstrOperationDescription.cloneTo(aOperationDescription);
 
     return S_OK;
@@ -664,20 +663,20 @@
 #endif
                         IUnknown *aInitiator,
-                        const Utf8Str &strDescription,
+                        CBSTR aDescription,
                         BOOL aCancelable,
                         ULONG cOperations,
                         ULONG ulTotalOperationsWeight,
-                        const Utf8Str &strFirstOperationDescription,
+                        CBSTR bstrFirstOperationDescription,
                         ULONG ulFirstOperationWeight,
                         OUT_GUID aId /* = NULL */)
 {
-    LogFlowThisFunc(("aDescription=\"%s\", cOperations=%d, ulTotalOperationsWeight=%d, strFirstOperationDescription=\"%s\", ulFirstOperationWeight=%d\n",
-                     strDescription.c_str(),
+    LogFlowThisFunc(("aDescription=\"%ls\", cOperations=%d, ulTotalOperationsWeight=%d, bstrFirstOperationDescription=\"%ls\", ulFirstOperationWeight=%d\n",
+                     aDescription,
                      cOperations,
                      ulTotalOperationsWeight,
-                     strFirstOperationDescription.c_str(),
+                     bstrFirstOperationDescription,
                      ulFirstOperationWeight));
 
-    AssertReturn(!strFirstOperationDescription.isEmpty(), E_INVALIDARG);
+    AssertReturn(bstrFirstOperationDescription, E_INVALIDARG);
     AssertReturn(ulTotalOperationsWeight >= 1, E_INVALIDARG);
 
@@ -688,11 +687,9 @@
     HRESULT rc = S_OK;
 
-    rc = ProgressBase::protectedInit(autoInitSpan,
+    rc = ProgressBase::protectedInit (autoInitSpan,
 #if !defined (VBOX_COM_INPROC)
-                                     aParent,
+                                      aParent,
 #endif
-                                     aInitiator,
-                                     strDescription,
-                                     aId);
+                                      aInitiator, aDescription, aId);
     if (FAILED(rc)) return rc;
 
@@ -703,5 +700,5 @@
     m_ulOperationsCompletedWeight = 0;
     m_ulCurrentOperation = 0;
-    m_strOperationDescription = strFirstOperationDescription;
+    m_bstrOperationDescription = bstrFirstOperationDescription;
     m_ulCurrentOperationWeight = ulFirstOperationWeight;
     m_ulOperationPercent = 0;
@@ -736,7 +733,7 @@
 HRESULT Progress::init(BOOL aCancelable,
                        ULONG aOperationCount,
-                       const Utf8Str &strOperationDescription)
-{
-    LogFlowThisFunc(("aOperationDescription=\"%s\"\n", strOperationDescription.c_str()));
+                       CBSTR aOperationDescription)
+{
+    LogFlowThisFunc(("aOperationDescription=\"%ls\"\n", aOperationDescription));
 
     /* Enclose the state transition NotReady->InInit->Ready */
@@ -746,5 +743,5 @@
     HRESULT rc = S_OK;
 
-    rc = ProgressBase::protectedInit(autoInitSpan);
+    rc = ProgressBase::protectedInit (autoInitSpan);
     if (FAILED(rc)) return rc;
 
@@ -757,12 +754,12 @@
     m_ulOperationsCompletedWeight = 0;
     m_ulCurrentOperation = 0;
-    m_strOperationDescription = strOperationDescription;
+    m_bstrOperationDescription = aOperationDescription;
     m_ulCurrentOperationWeight = 1;
     m_ulOperationPercent = 0;
 
-    int vrc = RTSemEventMultiCreate(&mCompletedSem);
-    ComAssertRCRet(vrc, E_FAIL);
-
-    RTSemEventMultiReset(mCompletedSem);
+    int vrc = RTSemEventMultiCreate (&mCompletedSem);
+    ComAssertRCRet (vrc, E_FAIL);
+
+    RTSemEventMultiReset (mCompletedSem);
 
     /* Confirm a successful initialization when it's the case */
@@ -790,12 +787,12 @@
     if (mWaitersCount > 0)
     {
-        LogFlow (("WARNING: There are still %d threads waiting for '%s' completion!\n",
-                  mWaitersCount, m_strDescription.c_str()));
-        RTSemEventMultiSignal(mCompletedSem);
+        LogFlow (("WARNING: There are still %d threads waiting for '%ls' completion!\n",
+                  mWaitersCount, mDescription.raw()));
+        RTSemEventMultiSignal (mCompletedSem);
     }
 
-    RTSemEventMultiDestroy(mCompletedSem);
-
-    ProgressBase::protectedUninit(autoUninitSpan);
+    RTSemEventMultiDestroy (mCompletedSem);
+
+    ProgressBase::protectedUninit (autoUninitSpan);
 }
 
@@ -1007,10 +1004,10 @@
     m_ulOperationsCompletedWeight += m_ulCurrentOperationWeight;
 
-    m_strOperationDescription = bstrNextOperationDescription;
+    m_bstrOperationDescription = bstrNextOperationDescription;
     m_ulCurrentOperationWeight = ulNextOperationsWeight;
     m_ulOperationPercent = 0;
 
-    Log(("Progress::setNextOperation(%s): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
-         m_strOperationDescription.c_str(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
+    Log(("Progress::setNextOperation(%ls): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
+         m_bstrOperationDescription.raw(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
 
     /* wake up all waiting threads */
@@ -1289,7 +1286,5 @@
 
     m_ulCurrentOperation = 0;
-    Bstr bstrOperationDescription;
-    rc = mProgresses[0]->COMGETTER(OperationDescription)(bstrOperationDescription.asOutParam());
-    m_strOperationDescription = bstrOperationDescription;
+    rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam());
     if (FAILED(rc)) return rc;
 
@@ -1791,7 +1786,6 @@
         {
             m_ulCurrentOperation = mCompletedOperations + operation;
-            Bstr bstrOperationDescription;
-            rc = progress->COMGETTER(OperationDescription)(bstrOperationDescription.asOutParam());
-            m_strOperationDescription = bstrOperationDescription;
+            rc = progress->COMGETTER(OperationDescription) (
+                m_bstrOperationDescription.asOutParam());
         }
     }
Index: /trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp	(revision 26553)
@@ -134,5 +134,5 @@
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP RemoteUSBDevice::COMGETTER(Id)(BSTR *aId)
+STDMETHODIMP RemoteUSBDevice::COMGETTER(Id) (BSTR *aId)
 {
     CheckComArgOutPointerValid(aId);
@@ -142,5 +142,5 @@
 
     /* this is const, no need to lock */
-    Bstr(mData.id.toUtf16()).cloneTo(aId);
+    Bstr(mData.id).cloneTo(aId);
 
     return S_OK;
Index: /trunk/src/VBox/Main/SessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SessionImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/SessionImpl.cpp	(revision 26553)
@@ -682,11 +682,6 @@
 }
 
-STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName,
-                                          IN_BSTR aValue,
-                                          IN_BSTR aFlags,
-                                          BOOL aIsSetter,
-                                          BSTR *aRetValue,
-                                          ULONG64 *aRetTimestamp,
-                                          BSTR *aRetFlags)
+STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
+                                          BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags)
 {
 #ifdef VBOX_WITH_GUEST_PROPS
@@ -699,5 +694,5 @@
                         Global::stringifySessionState(mState));
     AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     if (!aIsSetter && !VALID_PTR(aRetValue))
         return E_POINTER;
Index: /trunk/src/VBox/Main/SharedFolderImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SharedFolderImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/SharedFolderImpl.cpp	(revision 26553)
@@ -333,5 +333,8 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m.lastAccessError.cloneTo(aLastAccessError);
+    if (m.lastAccessError.isEmpty())
+        Bstr("").cloneTo(aLastAccessError);
+    else
+        m.lastAccessError.cloneTo(aLastAccessError);
 
     return S_OK;
Index: /trunk/src/VBox/Main/SnapshotImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SnapshotImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/SnapshotImpl.cpp	(revision 26553)
@@ -342,5 +342,5 @@
 STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
 
     AutoCaller autoCaller(this);
@@ -378,4 +378,6 @@
 STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription)
 {
+    CheckComArgNotNull(aDescription);
+
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
Index: /trunk/src/VBox/Main/SystemPropertiesImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SystemPropertiesImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/SystemPropertiesImpl.cpp	(revision 26553)
@@ -814,5 +814,5 @@
  * @return ComObjPtr<MediumFormat>
  */
-ComObjPtr<MediumFormat> SystemProperties::mediumFormat(CBSTR aFormat)
+ComObjPtr<MediumFormat> SystemProperties::mediumFormat (CBSTR aFormat)
 {
     ComObjPtr<MediumFormat> format;
@@ -824,10 +824,9 @@
 
     for (MediumFormatList::const_iterator it = mMediumFormats.begin();
-         it != mMediumFormats.end();
-         ++it)
+         it != mMediumFormats.end(); ++ it)
     {
         /* MediumFormat is all const, no need to lock */
 
-        if ((*it)->id().compare(aFormat, Bstr::CaseInsensitive) == 0)
+        if ((*it)->id().compareIgnoreCase (aFormat) == 0)
         {
             format = *it;
Index: /trunk/src/VBox/Main/USBControllerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/USBControllerImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/USBControllerImpl.cpp	(revision 26553)
@@ -1110,5 +1110,5 @@
     rc = aUSBDevice->COMGETTER(Manufacturer) (manufacturer.asOutParam());
     ComAssertComRCRet(rc, false);
-    if (!manufacturer.isEmpty())
+    if (!manufacturer.isNull())
         USBFilterSetStringExact (&dev, USBFILTERIDX_MANUFACTURER_STR, Utf8Str(manufacturer).c_str(), true);
 
@@ -1116,5 +1116,5 @@
     rc = aUSBDevice->COMGETTER(Product) (product.asOutParam());
     ComAssertComRCRet(rc, false);
-    if (!product.isEmpty())
+    if (!product.isNull())
         USBFilterSetStringExact (&dev, USBFILTERIDX_PRODUCT_STR, Utf8Str(product).c_str(), true);
 
@@ -1122,5 +1122,5 @@
     rc = aUSBDevice->COMGETTER(SerialNumber) (serialNumber.asOutParam());
     ComAssertComRCRet(rc, false);
-    if (!serialNumber.isEmpty())
+    if (!serialNumber.isNull())
         USBFilterSetStringExact (&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber).c_str(), true);
 
Index: /trunk/src/VBox/Main/USBDeviceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/USBDeviceImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/USBDeviceImpl.cpp	(revision 26553)
@@ -155,5 +155,5 @@
 
     /* this is const, no need to lock */
-    Guid(mData.id).toUtf16().cloneTo(aId);
+    Guid(mData.id).toString().cloneTo(aId);
 
     return S_OK;
Index: /trunk/src/VBox/Main/VirtualBoxBase.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxBase.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/VirtualBoxBase.cpp	(revision 26553)
@@ -810,10 +810,8 @@
  */
 /* static */
-HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal(HRESULT aResultCode,
-                                                             const GUID &aIID,
-                                                             const Bstr &aComponent,
-                                                             const Bstr &aText,
-                                                             bool aWarning,
-                                                             bool aLogIt)
+HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal (
+    HRESULT aResultCode, const GUID &aIID,
+    const Bstr &aComponent, const Bstr &aText,
+    bool aWarning, bool aLogIt)
 {
     /* whether multi-error mode is turned on */
@@ -827,6 +825,6 @@
 
     /* these are mandatory, others -- not */
-    AssertReturn(    (!aWarning && FAILED(aResultCode))
-                  || (aWarning && aResultCode != S_OK),
+    AssertReturn((!aWarning && FAILED(aResultCode)) ||
+                  (aWarning && aResultCode != S_OK),
                   E_FAIL);
     AssertReturn(!aText.isEmpty(), E_FAIL);
@@ -916,5 +914,5 @@
 
             /* set the current error info and preserve the previous one if any */
-            rc = info->init(aResultCode, aIID, aComponent.raw(), aText.raw(), curInfo);
+            rc = info->init (aResultCode, aIID, aComponent, aText, curInfo);
             if (FAILED(rc)) break;
 
Index: /trunk/src/VBox/Main/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 26553)
@@ -302,8 +302,8 @@
     LogFlowThisFuncEnter();
 
-    if (sVersion.isEmpty())
+    if (sVersion.isNull())
         sVersion = VBOX_VERSION_STRING;
     sRevision = RTBldCfgRevision();
-    if (sPackageType.isEmpty())
+    if (sPackageType.isNull())
         sPackageType = VBOX_PACKAGE_STRING;
     LogFlowThisFunc(("Version: %ls, Package: %ls\n", sVersion.raw(), sPackageType.raw()));
@@ -323,7 +323,7 @@
     /* compose the VirtualBox.xml file name */
     unconst(m->strSettingsFilePath) = Utf8StrFmt("%s%c%s",
-                                                 m->strHomeDir.raw(),
-                                                 RTPATH_DELIMITER,
-                                                 VBOX_GLOBAL_SETTINGS_FILE);
+                                                m->strHomeDir.raw(),
+                                                RTPATH_DELIMITER,
+                                                VBOX_GLOBAL_SETTINGS_FILE);
     HRESULT rc = S_OK;
     bool fCreate = false;
@@ -979,9 +979,9 @@
                                firmwareDesc[i].fileName);
         rc = calculateFullPath(shortName, fullName); AssertRCReturn(rc, rc);
-        if (RTFileExists(fullName.c_str()))
+        if (RTFileExists(fullName.raw()))
         {
             *aResult = TRUE;
              if (aFile)
-                fullName.cloneTo(aFile);
+                Utf8Str(fullName).cloneTo(aFile);
             break;
         }
@@ -993,9 +993,9 @@
                               RTPATH_DELIMITER,
                               firmwareDesc[i].fileName);
-        if (RTFileExists(fullName.c_str()))
+        if (RTFileExists(fullName.raw()))
         {
             *aResult = TRUE;
             if (aFile)
-                fullName.cloneTo(aFile);
+                Utf8Str(fullName).cloneTo(aFile);
             break;
         }
@@ -1225,5 +1225,5 @@
     LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aName, aMachine));
 
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgOutSafeArrayPointerValid(aMachine);
 
@@ -1346,5 +1346,7 @@
                                       IMedium **aHardDisk)
 {
-    CheckComArgStrNotEmptyOrNull(aLocation);
+    CheckComArgNotNull(aLocation);
+    CheckComArgNotNull(aImageId);
+    CheckComArgNotNull(aParentId);
     CheckComArgOutSafeArrayPointerValid(aHardDisk);
 
@@ -1421,5 +1423,5 @@
                                       IMedium **aHardDisk)
 {
-    CheckComArgStrNotEmptyOrNull(aLocation);
+    CheckComArgNotNull(aLocation);
     CheckComArgOutSafeArrayPointerValid(aHardDisk);
 
@@ -1428,6 +1430,5 @@
 
     ComObjPtr<Medium> hardDisk;
-    Utf8Str strLocation(aLocation);
-    HRESULT rc = findHardDisk(NULL, &strLocation, true /* setError */, &hardDisk);
+    HRESULT rc = findHardDisk(NULL, aLocation, true /* setError */, &hardDisk);
 
     /* the below will set *aHardDisk to NULL if hardDisk is null */
@@ -1478,5 +1479,5 @@
 
 /** @note Locks objects! */
-STDMETHODIMP VirtualBox::GetDVDImage(IN_BSTR aId, IMedium **aDVDImage)
+STDMETHODIMP VirtualBox::GetDVDImage (IN_BSTR aId, IMedium **aDVDImage)
 {
     CheckComArgOutSafeArrayPointerValid(aDVDImage);
@@ -1496,7 +1497,7 @@
 
 /** @note Locks objects! */
-STDMETHODIMP VirtualBox::FindDVDImage(IN_BSTR aLocation, IMedium **aDVDImage)
-{
-    CheckComArgStrNotEmptyOrNull(aLocation);
+STDMETHODIMP VirtualBox::FindDVDImage (IN_BSTR aLocation, IMedium **aDVDImage)
+{
+    CheckComArgNotNull(aLocation);
     CheckComArgOutSafeArrayPointerValid(aDVDImage);
 
@@ -1505,6 +1506,5 @@
 
     ComObjPtr<Medium> image;
-    Utf8Str strLocation(aLocation);
-    HRESULT rc = findDVDImage(NULL, &strLocation, true /* setError */, &image);
+    HRESULT rc = findDVDImage (NULL, aLocation, true /* setError */, &image);
 
     /* the below will set *aDVDImage to NULL if dvd is null */
@@ -1515,6 +1515,6 @@
 
 /** @note Doesn't lock anything. */
-STDMETHODIMP VirtualBox::OpenFloppyImage(IN_BSTR aLocation, IN_BSTR aId,
-                                         IMedium **aFloppyImage)
+STDMETHODIMP VirtualBox::OpenFloppyImage (IN_BSTR aLocation, IN_BSTR aId,
+                                          IMedium **aFloppyImage)
 {
     CheckComArgStrNotEmptyOrNull(aLocation);
@@ -1555,6 +1555,6 @@
 
 /** @note Locks objects! */
-STDMETHODIMP VirtualBox::GetFloppyImage(IN_BSTR aId,
-                                        IMedium **aFloppyImage)
+STDMETHODIMP VirtualBox::GetFloppyImage (IN_BSTR aId,
+                                         IMedium **aFloppyImage)
 
 {
@@ -1575,8 +1575,8 @@
 
 /** @note Locks objects! */
-STDMETHODIMP VirtualBox::FindFloppyImage(IN_BSTR aLocation,
-                                         IMedium **aFloppyImage)
-{
-    CheckComArgStrNotEmptyOrNull(aLocation);
+STDMETHODIMP VirtualBox::FindFloppyImage (IN_BSTR aLocation,
+                                          IMedium **aFloppyImage)
+{
+    CheckComArgNotNull(aLocation);
     CheckComArgOutSafeArrayPointerValid(aFloppyImage);
 
@@ -1585,6 +1585,5 @@
 
     ComObjPtr<Medium> image;
-    Utf8Str strLocation(aLocation);
-    HRESULT rc = findFloppyImage(NULL, &strLocation, true /* setError */, &image);
+    HRESULT rc = findFloppyImage(NULL, aLocation, true /* setError */, &image);
 
     /* the below will set *aFloppyImage to NULL if img is null */
@@ -1595,5 +1594,5 @@
 
 /** @note Locks this object for reading. */
-STDMETHODIMP VirtualBox::GetGuestOSType(IN_BSTR aId, IGuestOSType **aType)
+STDMETHODIMP VirtualBox::GetGuestOSType (IN_BSTR aId, IGuestOSType **aType)
 {
     /* Old ID to new ID conversion table. See r39691 for a source */
@@ -1616,5 +1615,5 @@
     };
 
-    CheckComArgNotNull(aType);
+    CheckComArgNotNull (aType);
 
     AutoCaller autoCaller(this);
@@ -1640,5 +1639,6 @@
     {
         const Bstr &typeId = (*it)->id();
-        if (typeId.compare(id, Bstr::CaseInsensitive) == 0)
+        AssertMsg (!!typeId, ("ID must not be NULL"));
+        if (typeId.compareIgnoreCase (id) == 0)
         {
             (*it).queryInterfaceTo(aType);
@@ -1709,5 +1709,5 @@
                                       BSTR *aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
+    CheckComArgNotNull(aKey);
     CheckComArgNotNull(aValue);
 
@@ -1716,5 +1716,5 @@
 
     /* start with nothing found */
-    Bstr bstrResult;
+    Bstr bstrResult("");
 
     settings::ExtraDataItemsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(Utf8Str(aKey));
@@ -1735,5 +1735,5 @@
                                       IN_BSTR aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
+    CheckComArgNotNull(aKey);
 
     AutoCaller autoCaller(this);
@@ -1766,10 +1766,14 @@
         // lock to copy the list of callbacks to invoke
         Bstr error;
-        Bstr bstrValue(aValue);
+        Bstr bstrValue;
+        if (aValue)
+            bstrValue = aValue;
+        else
+            bstrValue = (const char *)"";
 
         if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue, error))
         {
             const char *sep = error.isEmpty() ? "" : ": ";
-            CBSTR err = error.raw();
+            CBSTR err = error.isNull() ? (CBSTR) L"" : error.raw();
             LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
                             sep, err));
@@ -1862,6 +1866,7 @@
     LogRel(("remotesession=%s\n", Utf8Str(aMachineId).c_str()));
 
-    CheckComArgStrNotEmptyOrNull(aMachineId);
+    CheckComArgNotNull(aMachineId);
     CheckComArgNotNull(aSession);
+    CheckComArgNotNull(aType);
     CheckComArgOutSafeArrayPointerValid(aProgress);
 
@@ -1892,8 +1897,7 @@
     ComObjPtr<Progress> progress;
     progress.createObject();
-    progress->init(this,
-                   static_cast<IMachine*>(machine),
-                   tr("Spawning session"),
-                   FALSE /* aCancelable */);
+    progress->init (this, static_cast <IMachine *> (machine),
+                    Bstr (tr ("Spawning session")),
+                    FALSE /* aCancelable */);
 
     rc = machine->openRemoteSession (control, aType, aEnvironment, progress);
@@ -2430,5 +2434,5 @@
             case DataChanged:
                 LogFlow (("OnMachineDataChange: id={%RTuuid}\n", id.ptr()));
-                aCallback->OnMachineDataChange(id.toUtf16());
+                aCallback->OnMachineDataChange (id.toUtf16());
                 break;
 
@@ -2436,5 +2440,5 @@
                 LogFlow (("OnMachineStateChange: id={%RTuuid}, state=%d\n",
                           id.ptr(), state));
-                aCallback->OnMachineStateChange(id.toUtf16(), state);
+                aCallback->OnMachineStateChange (id.toUtf16(), state);
                 break;
 
@@ -2442,5 +2446,5 @@
                 LogFlow (("OnMachineRegistered: id={%RTuuid}, registered=%d\n",
                           id.ptr(), registered));
-                aCallback->OnMachineRegistered(id.toUtf16(), registered);
+                aCallback->OnMachineRegistered (id.toUtf16(), registered);
                 break;
         }
@@ -2493,9 +2497,6 @@
     while ((it != list.end()) && allowChange)
     {
-        HRESULT rc = (*it++)->OnExtraDataCanChange(id,
-                                                   aKey,
-                                                   aValue,
-                                                   aError.asOutParam(),
-                                                   &allowChange);
+        HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue,
+                                                    aError.asOutParam(), &allowChange);
         if (FAILED(rc))
         {
@@ -2526,5 +2527,5 @@
         LogFlow (("OnExtraDataChange: machineId={%RTuuid}, key='%ls', val='%ls'\n",
                   machineId.ptr(), key.raw(), val.raw()));
-        aCallback->OnExtraDataChange(machineId.toUtf16(), key, val);
+        aCallback->OnExtraDataChange (machineId.toUtf16(), key, val);
     }
 
@@ -2553,5 +2554,5 @@
 {
     SessionEvent (VirtualBox *aVB, const Guid &aMachineId, SessionState_T aState)
-        : CallbackEvent (aVB), machineId(aMachineId), sessionState (aState)
+        : CallbackEvent (aVB), machineId (aMachineId), sessionState (aState)
         {}
 
@@ -2560,5 +2561,5 @@
         LogFlow (("OnSessionStateChange: machineId={%RTuuid}, sessionState=%d\n",
                   machineId.ptr(), sessionState));
-        aCallback->OnSessionStateChange(machineId.toUtf16(), sessionState);
+        aCallback->OnSessionStateChange (machineId.toUtf16(), sessionState);
     }
 
@@ -2597,5 +2598,5 @@
                 LogFlow (("OnSnapshotTaken: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
                           machineId.ptr(), snapshotId.ptr()));
-                aCallback->OnSnapshotTaken(mid, sid);
+                aCallback->OnSnapshotTaken (mid, sid);
                 break;
 
@@ -2603,5 +2604,5 @@
                 LogFlow (("OnSnapshotDiscarded: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
                           machineId.ptr(), snapshotId.ptr()));
-                aCallback->OnSnapshotDiscarded(mid, sid);
+                aCallback->OnSnapshotDiscarded (mid, sid);
                 break;
 
@@ -2609,5 +2610,5 @@
                 LogFlow (("OnSnapshotChange: machineId={%RTuuid}, snapshotId={%RTuuid}\n",
                           machineId.ptr(), snapshotId.ptr()));
-                aCallback->OnSnapshotChange(mid, sid);
+                aCallback->OnSnapshotChange (mid, sid);
                 break;
         }
@@ -2660,5 +2661,5 @@
         LogFlow(("OnGuestPropertyChange: machineId={%RTuuid}, name='%ls', value='%ls', flags='%ls'\n",
                  machineId.ptr(), name.raw(), value.raw(), flags.raw()));
-        aCallback->OnGuestPropertyChange(machineId.toUtf16(), name, value, flags);
+        aCallback->OnGuestPropertyChange (machineId.toUtf16(), name, value, flags);
     }
 
@@ -2796,5 +2797,5 @@
  *
  * @param aId           ID of the hard disk (unused when NULL).
- * @param pstrLocation  Full location specification (unused NULL).
+ * @param aLocation     Full location specification (unused NULL).
  * @param aSetError     If @c true , the appropriate error info is set in case
  *                      when the hard disk is not found.
@@ -2806,9 +2807,9 @@
  */
 HRESULT VirtualBox::findHardDisk(const Guid *aId,
-                                 const Utf8Str *pstrLocation,
+                                 CBSTR aLocation,
                                  bool aSetError,
                                  ComObjPtr<Medium> *aHardDisk /*= NULL*/)
 {
-    AssertReturn(aId || pstrLocation, E_INVALIDARG);
+    AssertReturn(aId || aLocation, E_INVALIDARG);
 
     // we use the hard disks map, but it is protected by the
@@ -2830,6 +2831,8 @@
     /* then iterate and search by location */
     int result = -1;
-    if (pstrLocation)
-    {
+    if (aLocation)
+    {
+        Utf8Str location = aLocation;
+
         for (HardDiskMap::const_iterator it = m->mapHardDisks.begin();
              it != m->mapHardDisks.end();
@@ -2838,5 +2841,5 @@
             const ComObjPtr<Medium> &hd = (*it).second;
 
-            HRESULT rc = hd->compareLocationTo(pstrLocation->c_str(), result);
+            HRESULT rc = hd->compareLocationTo(location.c_str(), result);
             if (FAILED(rc)) return rc;
 
@@ -2861,6 +2864,6 @@
         else
             setError(rc,
-                     tr("Could not find a hard disk with location '%s' in the media registry ('%s')"),
-                     pstrLocation->c_str(),
+                     tr("Could not find a hard disk with location '%ls' in the media registry ('%s')"),
+                     aLocation,
                      m->strSettingsFilePath.raw());
     }
@@ -2885,19 +2888,19 @@
  */
 HRESULT VirtualBox::findDVDImage(const Guid *aId,
-                                 const Utf8Str *pstrLocation,
+                                 CBSTR aLocation,
                                  bool aSetError,
                                  ComObjPtr<Medium> *aImage /* = NULL */)
 {
-    AssertReturn(aId || pstrLocation, E_INVALIDARG);
+    AssertReturn(aId || aLocation, E_INVALIDARG);
 
     Utf8Str location;
 
-    if (pstrLocation != NULL)
-    {
-        int vrc = calculateFullPath(*pstrLocation, location);
+    if (aLocation != NULL)
+    {
+        int vrc = calculateFullPath(Utf8Str(aLocation), location);
         if (RT_FAILURE(vrc))
             return setError(VBOX_E_FILE_ERROR,
-                            tr("Invalid image file location '%s' (%Rrc)"),
-                            pstrLocation->c_str(),
+                            tr("Invalid image file location '%ls' (%Rrc)"),
+                            aLocation,
                             vrc);
     }
@@ -2914,9 +2917,9 @@
         AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS);
 
-        found =    (aId && (*it)->getId() == *aId)
-                || (    pstrLocation != NULL
-                     && RTPathCompare(location.c_str(),
-                                      (*it)->getLocationFull().c_str()
-                                     ) == 0);
+        found = (aId && (*it)->getId() == *aId) ||
+                (aLocation != NULL &&
+                 RTPathCompare(location.c_str(),
+                               (*it)->getLocationFull().c_str()
+                              ) == 0);
         if (found)
         {
@@ -2938,6 +2941,6 @@
         else
             setError(rc,
-                     tr("Could not find a CD/DVD image with location '%s' in the media registry ('%s')"),
-                     pstrLocation->c_str(),
+                     tr("Could not find a CD/DVD image with location '%ls' in the media registry ('%s')"),
+                     aLocation,
                      m->strSettingsFilePath.raw());
     }
@@ -2963,20 +2966,19 @@
  */
 HRESULT VirtualBox::findFloppyImage(const Guid *aId,
-                                    const Utf8Str *pstrLocation,
+                                    CBSTR aLocation,
                                     bool aSetError,
                                     ComObjPtr<Medium> *aImage /* = NULL */)
 {
-    AssertReturn(aId || pstrLocation, E_INVALIDARG);
+    AssertReturn(aId || aLocation, E_INVALIDARG);
 
     Utf8Str location;
 
-    if (pstrLocation != NULL)
-    {
-        int vrc = calculateFullPath(*pstrLocation, location);
+    if (aLocation != NULL)
+    {
+        int vrc = calculateFullPath(Utf8Str(aLocation), location);
         if (RT_FAILURE(vrc))
             return setError(VBOX_E_FILE_ERROR,
-                            tr("Invalid image file location '%s' (%Rrc)"),
-                            pstrLocation->c_str(),
-                            vrc);
+                            tr("Invalid image file location '%ls' (%Rrc)"),
+                            aLocation, vrc);
     }
 
@@ -2992,9 +2994,9 @@
         AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS);
 
-        found =    (aId && (*it)->getId() == *aId)
-                || (    pstrLocation != NULL
-                     && RTPathCompare(location.c_str(),
-                                      (*it)->getLocationFull().c_str()
-                                     ) == 0);
+        found = (aId && (*it)->getId() == *aId) ||
+                (aLocation != NULL &&
+                 RTPathCompare(location.c_str(),
+                               (*it)->getLocationFull().c_str()
+                              ) == 0);
         if (found)
         {
@@ -3016,6 +3018,6 @@
         else
             setError(rc,
-                     tr("Could not find a floppy image with location '%s' in the media registry ('%s')"),
-                     pstrLocation->c_str(),
+                     tr("Could not find a floppy image with location '%ls' in the media registry ('%s')"),
+                     aLocation,
                      m->strSettingsFilePath.raw());
     }
@@ -3195,7 +3197,9 @@
     HRESULT rc = S_OK;
 
+    Bstr bstrLocation(aLocation);
+
     {
         ComObjPtr<Medium> hardDisk;
-        rc = findHardDisk(&aId, &aLocation, false /* aSetError */, &hardDisk);
+        rc = findHardDisk(&aId, bstrLocation, false /* aSetError */, &hardDisk);
         if (SUCCEEDED(rc))
         {
@@ -3211,5 +3215,5 @@
     {
         ComObjPtr<Medium> image;
-        rc = findDVDImage(&aId, &aLocation, false /* aSetError */, &image);
+        rc = findDVDImage(&aId, bstrLocation, false /* aSetError */, &image);
         if (SUCCEEDED(rc))
         {
@@ -3225,5 +3229,5 @@
     {
         ComObjPtr<Medium> image;
-        rc = findFloppyImage(&aId, &aLocation, false /* aSetError */, &image);
+        rc = findFloppyImage(&aId, bstrLocation, false /* aSetError */, &image);
         if (SUCCEEDED(rc))
         {
@@ -4355,5 +4359,5 @@
 STDMETHODIMP VirtualBox::CreateDHCPServer (IN_BSTR aName, IDHCPServer ** aServer)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgNotNull(aServer);
 
@@ -4376,5 +4380,5 @@
 STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer ** aServer)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
+    CheckComArgNotNull(aName);
     CheckComArgNotNull(aServer);
 
@@ -4452,5 +4456,5 @@
 
     ComPtr<IDHCPServer> existing;
-    rc = FindDHCPServerByNetworkName(name, existing.asOutParam());
+    rc = FindDHCPServerByNetworkName(name.mutableRaw(), existing.asOutParam());
     if (SUCCEEDED(rc))
     {
Index: /trunk/src/VBox/Main/generic/NetIf-generic.cpp
===================================================================
--- /trunk/src/VBox/Main/generic/NetIf-generic.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/generic/NetIf-generic.cpp	(revision 26553)
@@ -231,13 +231,12 @@
         Bstr ifname;
         ComPtr<IHostNetworkInterface> iface;
-        if (FAILED(host->FindHostNetworkInterfaceById(Guid(aId).toUtf16(), iface.asOutParam())))
+        if (FAILED(host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam())))
             return VERR_INVALID_PARAMETER;
-        iface->COMGETTER(Name)(ifname.asOutParam());
-        if (ifname.isEmpty())
+        iface->COMGETTER(Name) (ifname.asOutParam());
+        if (ifname.isNull())
             return VERR_INTERNAL_ERROR;
 
-        rc = progress->init(pVBox,
-                            host,
-                            Bstr("Removing host network interface"),
+        rc = progress->init (pVBox, host,
+                            Bstr ("Removing host network interface"),
                             FALSE /* aCancelable */);
         if(SUCCEEDED(rc))
Index: /trunk/src/VBox/Main/glue/ErrorInfo.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/ErrorInfo.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/glue/ErrorInfo.cpp	(revision 26553)
@@ -170,5 +170,5 @@
     {
         mCalleeIID = aIID;
-        GetInterfaceNameByIID(aIID, mCalleeName.asOutParam());
+        GetInterfaceNameByIID (aIID, mCalleeName.asOutParam());
     }
 }
Index: /trunk/src/VBox/Main/include/ApplianceImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ApplianceImpl.h	(revision 26552)
+++ /trunk/src/VBox/Main/include/ApplianceImpl.h	(revision 26553)
@@ -96,7 +96,7 @@
 
     void disksWeight(uint32_t &ulTotalMB, uint32_t &cDisks) const;
-    HRESULT setUpProgressFS(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription);
-    HRESULT setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription);
-    HRESULT setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription);
+    HRESULT setUpProgressFS(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);
+    HRESULT setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);
+    HRESULT setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);
 
     struct LocationInfo;
Index: /trunk/src/VBox/Main/include/ProgressImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ProgressImpl.h	(revision 26552)
+++ /trunk/src/VBox/Main/include/ProgressImpl.h	(revision 26553)
@@ -52,9 +52,8 @@
     HRESULT protectedInit(AutoInitSpan &aAutoInitSpan,
 #if !defined (VBOX_COM_INPROC)
-                          VirtualBox *aParent,
-#endif
-                          IUnknown *aInitiator,
-                          const Utf8Str &strDescription,
-                          OUT_GUID aId = NULL);
+                  VirtualBox *aParent,
+#endif
+                  IUnknown *aInitiator,
+                  CBSTR aDescription, OUT_GUID aId = NULL);
     HRESULT protectedInit(AutoInitSpan &aAutoInitSpan);
     void protectedUninit(AutoUninitSpan &aAutoUninitSpan);
@@ -106,5 +105,5 @@
 
     const Guid mId;
-    const Utf8Str m_strDescription;
+    const Bstr mDescription;
 
     uint64_t m_ullTimestamp;                        // progress object creation timestamp, for ETA computation
@@ -127,5 +126,5 @@
 
     ULONG m_ulCurrentOperation;                     // operations counter, incremented with each setNextOperation()
-    Utf8Str m_strOperationDescription;              // name of current operation; initially from constructor, changed with setNextOperation()
+    Bstr m_bstrOperationDescription;                // name of current operation; initially from constructor, changed with setNextOperation()
     ULONG m_ulCurrentOperationWeight;               // weight of current operation, given to setNextOperation()
     ULONG m_ulOperationPercent;                     // percentage of current operation, set with setCurrentOperationProgress()
@@ -177,5 +176,5 @@
 #endif
                   IUnknown *aInitiator,
-                  const Utf8Str &strDescription,
+                  CBSTR aDescription,
                   BOOL aCancelable,
                   OUT_GUID aId = NULL)
@@ -186,9 +185,9 @@
 #endif
             aInitiator,
-            strDescription,
+            aDescription,
             aCancelable,
             1,      // cOperations
             1,      // ulTotalOperationsWeight
-            strDescription, // bstrFirstOperationDescription
+            aDescription, // bstrFirstOperationDescription
             1,      // ulFirstOperationWeight
             aId);
@@ -212,8 +211,7 @@
 #endif
                   IUnknown *aInitiator,
-                  const Utf8Str &strDescription,
-                  BOOL aCancelable,
+                  CBSTR aDescription, BOOL aCancelable,
                   ULONG cOperations,
-                  const Utf8Str &strFirstOperationDescription,
+                  CBSTR bstrFirstOperationDescription,
                   OUT_GUID aId = NULL)
     {
@@ -223,9 +221,9 @@
 #endif
             aInitiator,
-            strDescription,
+            aDescription,
             aCancelable,
             cOperations,      // cOperations
             cOperations,      // ulTotalOperationsWeight = cOperations
-            strFirstOperationDescription, // bstrFirstOperationDescription
+            bstrFirstOperationDescription, // bstrFirstOperationDescription
             1,      // ulFirstOperationWeight: weigh them all the same
             aId);
@@ -237,9 +235,9 @@
 #endif
                   IUnknown *aInitiator,
-                  const Utf8Str &strDescription,
+                  CBSTR aDescription,
                   BOOL aCancelable,
                   ULONG cOperations,
                   ULONG ulTotalOperationsWeight,
-                  const Utf8Str &strFirstOperationDescription,
+                  CBSTR bstrFirstOperationDescription,
                   ULONG ulFirstOperationWeight,
                   OUT_GUID aId = NULL);
@@ -247,5 +245,5 @@
     HRESULT init(BOOL aCancelable,
                  ULONG aOperationCount,
-                 const Utf8Str &strOperationDescription);
+                 CBSTR aOperationDescription);
 
     void uninit();
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 26552)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 26553)
@@ -246,9 +246,9 @@
                          ComObjPtr<Machine> *machine = NULL);
 
-    HRESULT findHardDisk(const Guid *aId, const Utf8Str *pstrLocation,
+    HRESULT findHardDisk(const Guid *aId, CBSTR aLocation,
                           bool aSetError, ComObjPtr<Medium> *aHardDisk = NULL);
-    HRESULT findDVDImage(const Guid *aId, const Utf8Str *pstrLocation,
+    HRESULT findDVDImage(const Guid *aId, CBSTR aLocation,
                          bool aSetError, ComObjPtr<Medium> *aImage = NULL);
-    HRESULT findFloppyImage(const Guid *aId, const Utf8Str *pstrLocation,
+    HRESULT findFloppyImage(const Guid *aId, CBSTR aLocation,
                             bool aSetError, ComObjPtr<Medium> *aImage = NULL);
 
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 26552)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 26553)
@@ -195,7 +195,8 @@
             strLine = Utf8StrFmt(" (line %RU32)", pNode->getLineNumber());
 
+        const char *pcsz = strLine.c_str();
         Utf8StrFmt str(N_("Error in %s%s -- %s"),
                        file->m->strFilename.c_str(),
-                       strLine.c_str(),
+                       (pcsz) ? pcsz : "",
                        strWhat.c_str());
 
