Index: trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp	(revision 45415)
+++ trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp	(revision 47620)
@@ -50,5 +50,5 @@
  *
  * @returns VBox status code
- * @param   puClientId    Where to put the client id on success. The client id
+ * @param   puClientId    Where to put The client ID on success. The client ID
  *                        must be passed to all the other calls to the service.
  */
@@ -77,5 +77,5 @@
  *
  * @returns VBox status code.
- * @param   uClientId     The client id returned by VbglR3GuestCtrlConnect().
+ * @param   uClientId     The client ID returned by VbglR3GuestCtrlConnect().
  */
 VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t uClientId)
@@ -97,5 +97,5 @@
  *
  * @returns VBox status code.
- * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
+ * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
  * @param   puMsg           Where to store the message id.
  * @param   puNumParms      Where to store the number  of parameters which will be received
@@ -134,22 +134,48 @@
  * Asks the host guest control service to set a command filter to this
  * client so that it only will receive certain commands in the future.
+ * The filter(s) are a bitmask for the context IDs, served from the host.
  *
  * @return  IPRT status code.
- * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
- * @param   uFilterAdd      Filter mask to add.
- * @param   uFilterRemove   Filter mask to remove.
- */
-VBGLR3DECL(int) VbglR3GuestCtrlMsgSetFilter(uint32_t uClientId,
+ * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
+ * @param   uFilterAdd      Context ID filter mask to add.
+ * @param   uFilterRemove   Context ID filter mask to remove.
+ */
+VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId,
                                             uint32_t uFilterAdd, uint32_t uFilterRemove)
 {
-    HGCMMsgCmdSetFilter Msg;
+    HGCMMsgCmdFilterSet Msg;
 
     Msg.hdr.result      = VERR_WRONG_ORDER;
     Msg.hdr.u32ClientID = uClientId;
-    Msg.hdr.u32Function = GUEST_MSG_FILTER; /* Tell the host we want to set a filter. */
-    Msg.hdr.cParms      = 2;
+    Msg.hdr.u32Function = GUEST_MSG_FILTER_SET; /* Tell the host we want to set a filter. */
+    Msg.hdr.cParms      = 3;
 
     VbglHGCMParmUInt32Set(&Msg.add, uFilterAdd);
     VbglHGCMParmUInt32Set(&Msg.remove, uFilterRemove);
+    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
+
+    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+    if (RT_SUCCESS(rc))
+        rc = Msg.hdr.result;
+    return rc;
+}
+
+
+/**
+ * Disables a previously set message filter.
+ *
+ * @return  IPRT status code.
+ * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
+ */
+VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterUnset(uint32_t uClientId)
+{
+    HGCMMsgCmdFilterUnset Msg;
+
+    Msg.hdr.result      = VERR_WRONG_ORDER;
+    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32Function = GUEST_MSG_FILTER_UNSET; /* Tell the host we want to unset the filter. */
+    Msg.hdr.cParms      = 1;
+
+    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -165,5 +191,5 @@
  *
  * @return  IPRT status code.
- * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
+ * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
  */
 VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t uClientId)
@@ -175,5 +201,7 @@
     Msg.hdr.u32Function = GUEST_MSG_SKIP; /* Tell the host we want to skip
                                              the current assigned command. */
-    Msg.hdr.cParms      = 0;              /* No parameters needed. */
+    Msg.hdr.cParms      = 1;
+
+    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -189,5 +217,5 @@
  *
  * @returns VBox status code.
- * @param   uClientId     The client id returned by VbglR3GuestCtrlConnect().
+ * @param   uClientId     The client ID returned by VbglR3GuestCtrlConnect().
  */
 VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t uClientId)
