Index: /trunk/include/VBox/err.h
===================================================================
--- /trunk/include/VBox/err.h	(revision 29531)
+++ /trunk/include/VBox/err.h	(revision 29532)
@@ -1483,31 +1483,39 @@
 
 
-/** @name VBox Webservice Status Codes
- * @{
- */
-/** Object not found. */
-#define VERR_COM_OBJECT_NOT_FOUND                  (-4601)
-/** Invalid machine state. */
-#define VERR_COM_INVALID_VM_STATE                  (-4602)
-/** VM error. */
-#define VERR_COM_VM_ERROR                          (-4603)
-/** File error. */
-#define VERR_COM_FILE_ERROR                        (-4604)
+/** @name VBox COM error codes
+ * @remarks There
+ * @{  */
+/** Unexpected turn of events. */
+#define VERR_COM_UNEXPECTED                         (-4600)
+/** The base of the VirtualBox COM status codes (the lower value)
+ * corresponding 1:1 to VBOX_E_XXX.  This is the lowest value. */
+#define VERR_COM_VBOX_LOWEST                        (-4699)
+/** Object corresponding to the supplied arguments does not exist. */
+#define VERR_COM_OBJECT_NOT_FOUND                   (VERR_COM_VBOX_LOWEST + 1)
+/** Current virtual machine state prevents the operation. */
+#define VERR_COM_INVALID_VM_STATE                   (VERR_COM_VBOX_LOWEST + 2)
+/** Virtual machine error occurred attempting the operation. */
+#define VERR_COM_VM_ERROR                           (VERR_COM_VBOX_LOWEST + 3)
+/** File not accessible or erroneous file contents. */
+#define VERR_COM_FILE_ERROR                         (VERR_COM_VBOX_LOWEST + 4)
 /** IPRT error. */
-#define VERR_COM_IPRT_ERROR                        (-4605)
-/** PDM error. */
-#define VERR_COM_PDM_ERROR                         (-4606)
-/** Invalid object state. */
-#define VERR_COM_INVALID_OBJECT_STATE              (-4607)
-/** Host error. */
-#define VERR_COM_HOST_ERROR                        (-4608)
-/** Not supported. */
-#define VERR_COM_NOT_SUPPORTED                     (-4609)
-/** XML error. */
-#define VERR_COM_XML_ERROR                         (-4610)
-/** Invalid session state. */
-#define VERR_COM_INVALID_SESSION_STATE             (-4611)
-/** Invalid session state. */
-#define VERR_COM_OBJECT_IN_USE                     (-4612)
+#define VERR_COM_IPRT_ERROR                         (VERR_COM_VBOX_LOWEST + 5)
+/** Pluggable Device Manager error. */
+#define VERR_COM_PDM_ERROR                          (VERR_COM_VBOX_LOWEST + 6)
+/** Current object state prohibits operation. */
+#define VERR_COM_INVALID_OBJECT_STATE               (VERR_COM_VBOX_LOWEST + 7)
+/** Host operating system related error. */
+#define VERR_COM_HOST_ERROR                         (VERR_COM_VBOX_LOWEST + 8)
+/** Requested operation is not supported. */
+#define VERR_COM_NOT_SUPPORTED                      (VERR_COM_VBOX_LOWEST + 9)
+/** Invalid XML found. */
+#define VERR_COM_XML_ERROR                          (VERR_COM_VBOX_LOWEST + 10)
+/** Current session state prohibits operation. */
+#define VERR_COM_INVALID_SESSION_STATE              (VERR_COM_VBOX_LOWEST + 11)
+/** Object being in use prohibits operation. */
+#define VERR_COM_OBJECT_IN_USE                      (VERR_COM_VBOX_LOWEST + 12)
+/** Returned by callback methods which does not need to be called
+ * again because the client does not actually make use of them. */
+#define VERR_COM_DONT_CALL_AGAIN                    (VERR_COM_VBOX_LOWEST + 13)
 /** @} */
 
Index: /trunk/src/VBox/Main/Global.cpp
===================================================================
--- /trunk/src/VBox/Main/Global.cpp	(revision 29531)
+++ /trunk/src/VBox/Main/Global.cpp	(revision 29532)
@@ -406,8 +406,20 @@
     {
         case S_OK:                              return VINF_SUCCESS;
+
+        /* Standard COM status codes. See also RTErrConvertFromDarwinCOM */
+        case E_UNEXPECTED:                      return VERR_COM_UNEXPECTED;
+        case E_NOTIMPL:                         return VERR_NOT_IMPLEMENTED;
+        case E_OUTOFMEMORY:                     return VERR_NO_MEMORY;
+        case E_INVALIDARG:                      return VERR_INVALID_PARAMETER;
+        case E_NOINTERFACE:                     return VERR_NOT_SUPPORTED;
+        case E_POINTER:                         return VERR_INVALID_POINTER;
+#ifdef E_HANDLE
+        case E_HANDLE:                          return VERR_INVALID_HANDLE;
+#endif
+        case E_ABORT:                           return VERR_CANCELLED;
         case E_FAIL:                            return VERR_GENERAL_FAILURE;
-        case E_INVALIDARG:                      return VERR_INVALID_PARAMETER;
-        case E_POINTER:                         return VERR_INVALID_POINTER;
-
+        case E_ACCESSDENIED:                    return VERR_ACCESS_DENIED;
+
+        /* VirtualBox status codes */
         case VBOX_E_OBJECT_NOT_FOUND:           return VERR_COM_OBJECT_NOT_FOUND;
         case VBOX_E_INVALID_VM_STATE:           return VERR_COM_INVALID_VM_STATE;
@@ -422,8 +434,11 @@
         case VBOX_E_INVALID_SESSION_STATE:      return VERR_COM_INVALID_SESSION_STATE;
         case VBOX_E_OBJECT_IN_USE:              return VERR_COM_OBJECT_IN_USE;
+        case VBOX_E_DONT_CALL_AGAIN:            return VERR_COM_DONT_CALL_AGAIN;
 
         default:
             if (SUCCEEDED(aComStatus))
                 return VINF_SUCCESS;
+            /** @todo Check for the win32 facility and use the
+             *        RTErrConvertFromWin32 function on windows. */
             return VERR_UNRESOLVED_ERROR;
     }
@@ -437,9 +452,20 @@
     {
         case VINF_SUCCESS:                      return S_OK;
+
+        /* Standard COM status codes. */
+        case VERR_COM_UNEXPECTED:               return E_UNEXPECTED;
+        case VERR_NOT_IMPLEMENTED:              return E_NOTIMPL;
+        case VERR_NO_MEMORY:                    return E_OUTOFMEMORY;
+        case VERR_INVALID_PARAMETER:            return E_INVALIDARG;
+        case VERR_NOT_SUPPORTED:                return E_NOINTERFACE;
+        case VERR_INVALID_POINTER:              return E_POINTER;
+#ifdef E_HANDLE
+        case VERR_INVALID_HANDLE:               return E_HANDLE;
+#endif
+        case VERR_CANCELLED:                    return E_ABORT;
         case VERR_GENERAL_FAILURE:              return E_FAIL;
-        case VERR_UNRESOLVED_ERROR:             return E_FAIL;
-        case VERR_INVALID_PARAMETER:            return E_INVALIDARG;
-        case VERR_INVALID_POINTER:              return E_POINTER;
-
+        case VERR_ACCESS_DENIED:                return E_ACCESSDENIED;
+
+        /* VirtualBox COM status codes */
         case VERR_COM_OBJECT_NOT_FOUND:         return VBOX_E_OBJECT_NOT_FOUND;
         case VERR_COM_INVALID_VM_STATE:         return VBOX_E_INVALID_VM_STATE;
@@ -454,4 +480,8 @@
         case VERR_COM_INVALID_SESSION_STATE:    return VBOX_E_INVALID_SESSION_STATE;
         case VERR_COM_OBJECT_IN_USE:            return VBOX_E_OBJECT_IN_USE;
+        case VERR_COM_DONT_CALL_AGAIN:          return VBOX_E_DONT_CALL_AGAIN;
+
+        /* Other errors. */
+        case VERR_UNRESOLVED_ERROR:             return E_FAIL;
 
         default:
