VirtualBox

Ignore:
Timestamp:
Aug 8, 2013 8:09:42 PM (11 years ago)
Author:
vboxsync
Message:

GuestCtrl: Fixed per-session command filtering, added command to disable the filter again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp

    r45415 r47620  
    5050 *
    5151 * @returns VBox status code
    52  * @param   puClientId    Where to put the client id on success. The client id
     52 * @param   puClientId    Where to put The client ID on success. The client ID
    5353 *                        must be passed to all the other calls to the service.
    5454 */
     
    7777 *
    7878 * @returns VBox status code.
    79  * @param   uClientId     The client id returned by VbglR3GuestCtrlConnect().
     79 * @param   uClientId     The client ID returned by VbglR3GuestCtrlConnect().
    8080 */
    8181VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t uClientId)
     
    9797 *
    9898 * @returns VBox status code.
    99  * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
     99 * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
    100100 * @param   puMsg           Where to store the message id.
    101101 * @param   puNumParms      Where to store the number  of parameters which will be received
     
    134134 * Asks the host guest control service to set a command filter to this
    135135 * client so that it only will receive certain commands in the future.
     136 * The filter(s) are a bitmask for the context IDs, served from the host.
    136137 *
    137138 * @return  IPRT status code.
    138  * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
    139  * @param   uFilterAdd      Filter mask to add.
    140  * @param   uFilterRemove   Filter mask to remove.
    141  */
    142 VBGLR3DECL(int) VbglR3GuestCtrlMsgSetFilter(uint32_t uClientId,
     139 * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
     140 * @param   uFilterAdd      Context ID filter mask to add.
     141 * @param   uFilterRemove   Context ID filter mask to remove.
     142 */
     143VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId,
    143144                                            uint32_t uFilterAdd, uint32_t uFilterRemove)
    144145{
    145     HGCMMsgCmdSetFilter Msg;
     146    HGCMMsgCmdFilterSet Msg;
    146147
    147148    Msg.hdr.result      = VERR_WRONG_ORDER;
    148149    Msg.hdr.u32ClientID = uClientId;
    149     Msg.hdr.u32Function = GUEST_MSG_FILTER; /* Tell the host we want to set a filter. */
    150     Msg.hdr.cParms      = 2;
     150    Msg.hdr.u32Function = GUEST_MSG_FILTER_SET; /* Tell the host we want to set a filter. */
     151    Msg.hdr.cParms      = 3;
    151152
    152153    VbglHGCMParmUInt32Set(&Msg.add, uFilterAdd);
    153154    VbglHGCMParmUInt32Set(&Msg.remove, uFilterRemove);
     155    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
     156
     157    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     158    if (RT_SUCCESS(rc))
     159        rc = Msg.hdr.result;
     160    return rc;
     161}
     162
     163
     164/**
     165 * Disables a previously set message filter.
     166 *
     167 * @return  IPRT status code.
     168 * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
     169 */
     170VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterUnset(uint32_t uClientId)
     171{
     172    HGCMMsgCmdFilterUnset Msg;
     173
     174    Msg.hdr.result      = VERR_WRONG_ORDER;
     175    Msg.hdr.u32ClientID = uClientId;
     176    Msg.hdr.u32Function = GUEST_MSG_FILTER_UNSET; /* Tell the host we want to unset the filter. */
     177    Msg.hdr.cParms      = 1;
     178
     179    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
    154180
    155181    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     
    165191 *
    166192 * @return  IPRT status code.
    167  * @param   uClientId       The client id returned by VbglR3GuestCtrlConnect().
     193 * @param   uClientId       The client ID returned by VbglR3GuestCtrlConnect().
    168194 */
    169195VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t uClientId)
     
    175201    Msg.hdr.u32Function = GUEST_MSG_SKIP; /* Tell the host we want to skip
    176202                                             the current assigned command. */
    177     Msg.hdr.cParms      = 0;              /* No parameters needed. */
     203    Msg.hdr.cParms      = 1;
     204
     205    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
    178206
    179207    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     
    189217 *
    190218 * @returns VBox status code.
    191  * @param   uClientId     The client id returned by VbglR3GuestCtrlConnect().
     219 * @param   uClientId     The client ID returned by VbglR3GuestCtrlConnect().
    192220 */
    193221VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t uClientId)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette