Index: /trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp	(revision 53343)
+++ /trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp	(revision 53344)
@@ -376,17 +376,18 @@
     if (FAILED(adep.rc())) return adep.rc();
 
-    Bstr key = aKey;
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Special processing for some "standard" properties. */
-    if (key == Bstr("TCP/Ports"))
-    {
-        /* Verify the string. */
-        int vrc = i_vrdpServerVerifyPortsString(aValue);
+    if (aKey == "TCP/Ports")
+    {
+        /* Verify the string. "0" means the default port. */
+        Utf8Str strPorts = aValue == "0"?
+                               VRDP_DEFAULT_PORT_STR:
+                               aValue;
+        int vrc = i_vrdpServerVerifyPortsString(strPorts);
         if (RT_FAILURE(vrc))
             return E_INVALIDARG;
 
-        if (aValue != mData->mProperties["TCP/Ports"])
+        if (strPorts != mData->mProperties["TCP/Ports"])
         {
             /* Port value is not verified here because it is up to VRDP transport to
@@ -395,8 +396,5 @@
              */
             mData.backup();
-            if (aValue == Utf8Str("0"))
-                mData->mProperties["TCP/Ports"] = VRDP_DEFAULT_PORT_STR;
-            else
-                mData->mProperties["TCP/Ports"] = aValue;
+            mData->mProperties["TCP/Ports"] = strPorts;
 
             /* leave the lock before informing callbacks */
