VirtualBox

Changeset 47695 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 13, 2013 2:40:20 PM (11 years ago)
Author:
vboxsync
Message:

Additions/GuestCtrl: Use a separate filter mask + value for message filtering.

Location:
trunk/src/VBox/Additions/common
Files:
3 edited

Legend:

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

    r47620 r47695  
    138138 * @return  IPRT status code.
    139139 * @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  */
    143 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId,
    144                                             uint32_t uFilterAdd, uint32_t uFilterRemove)
     140 * @param   uValue          The value to filter messages for.
     141 * @param   uMaskAdd        Filter mask to add.
     142 * @param   uMaskRemove     Filter mask to remove.
     143 */
     144VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue,
     145                                            uint32_t uMaskAdd, uint32_t uMaskRemove)
    145146{
    146147    HGCMMsgCmdFilterSet Msg;
     
    149150    Msg.hdr.u32ClientID = uClientId;
    150151    Msg.hdr.u32Function = GUEST_MSG_FILTER_SET; /* Tell the host we want to set a filter. */
    151     Msg.hdr.cParms      = 3;
    152 
    153     VbglHGCMParmUInt32Set(&Msg.add, uFilterAdd);
    154     VbglHGCMParmUInt32Set(&Msg.remove, uFilterRemove);
     152    Msg.hdr.cParms      = 4;
     153
     154    VbglHGCMParmUInt32Set(&Msg.value, uValue);
     155    VbglHGCMParmUInt32Set(&Msg.mask_add, uMaskAdd);
     156    VbglHGCMParmUInt32Set(&Msg.mask_remove, uMaskRemove);
    155157    VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */);
    156158
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp

    r47622 r47695  
    14421442    /* The process thread is not interested in receiving any commands;
    14431443     * tell the host service. */
    1444     rc = VbglR3GuestCtrlMsgFilterSet(pProcess->uClientID, 0 /* Skip all */, 0);
     1444    rc = VbglR3GuestCtrlMsgFilterSet(pProcess->uClientID, 0 /* Skip all */,
     1445                                     0 /* Filter mask to add */, 0 /* Filter mask to remove */);
    14451446    if (RT_FAILURE(rc))
    14461447    {
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp

    r47622 r47695  
    911911
    912912/**
    913  * Thread main routine for a forked guest session. This
    914  * thread runs in the main executable to control the forked
     913 * Thread main routine for a forked guest session process.
     914 * This thread runs in the main executable to control the forked
    915915 * session process.
    916916 *
     
    936936        /* The session thread is not interested in receiving any commands;
    937937         * tell the host service. */
    938         rc = VbglR3GuestCtrlMsgFilterSet(uClientID, 0 /* Skip all */, 0);
     938        rc = VbglR3GuestCtrlMsgFilterSet(uClientID, 0 /* Skip all */,
     939                                         0 /* Filter mask to add */, 0 /* Filter mask to remove */);
    939940        if (RT_FAILURE(rc))
    940941        {
    941942            VBoxServiceError("Unable to set message filter, rc=%Rrc\n", rc);
    942943            /* Non-critical. */
     944            rc = VINF_SUCCESS;
    943945        }
    944946    }
    945947    else
    946     {
    947948        VBoxServiceError("Error connecting to guest control service, rc=%Rrc\n", rc);
    948         return rc;
    949     }
    950 
    951     /* Let caller know that we're done initializing. */
    952     rc = RTThreadUserSignal(RTThreadSelf());
     949
     950    if (RT_FAILURE(rc))
     951        pThread->fShutdown = true;
     952
     953    /* Let caller know that we're done initializing, regardless of the result. */
     954    int rc2 = RTThreadUserSignal(RTThreadSelf());
     955    AssertRC(rc2);
     956
    953957    if (RT_FAILURE(rc))
    954958        return rc;
     
    10691073    Assert(uSessionStatus != GUEST_SESSION_NOTIFYTYPE_UNDEFINED);
    10701074    VBGLR3GUESTCTRLCMDCTX ctx = { uClientID, VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(uSessionID) };
    1071     int rc2 = VbglR3GuestCtrlSessionNotify(&ctx,
    1072                                            uSessionStatus, uSessionRc);
     1075    rc2 = VbglR3GuestCtrlSessionNotify(&ctx,
     1076                                       uSessionStatus, uSessionRc);
    10731077    if (RT_FAILURE(rc2))
    10741078        VBoxServiceError("Reporting session ID=%RU32 final status failed with rc=%Rrc\n",
     
    11001104         * session we don't want to handle. */
    11011105        uint32_t uFilterAdd =
    1102             VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID);
    1103         uFilterAdd |= 0x7FFFFFF; /* We only want to filter for session IDs. */
    1104 
    1105         rc = VbglR3GuestCtrlMsgFilterSet(uClientID, uFilterAdd, 0 /* Filter remove */);
     1106            VBOX_GUESTCTRL_FILTER_BY_SESSION(pSession->StartupInfo.uSessionID);
     1107        rc = VbglR3GuestCtrlMsgFilterSet(uClientID,
     1108                                         VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID),
     1109                                        uFilterAdd, 0 /* Filter remove */);
    11061110        VBoxServiceVerbose(3, "Setting message filterAdd=0x%x returned %Rrc\n",
    11071111                           uFilterAdd, rc);
     
    19301934    int rc = GstCntlSessionThreadWait(pThread,
    19311935                                      5 * 60 * 1000 /* 5 minutes timeout */, uFlags);
    1932     /** @todo Kill session process if still around? */
    19331936
    19341937    /* Remove session from list and destroy object. */
    19351938    RTListNodeRemove(&pThread->Node);
     1939
    19361940    RTMemFree(pThread);
     1941    pThread = NULL;
    19371942
    19381943    return rc;
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