VirtualBox

Changeset 75894 in vbox


Ignore:
Timestamp:
Dec 3, 2018 12:07:43 PM (6 years ago)
Author:
vboxsync
Message:

GuestControl: Made GUEST_MSG_SKIP_OLD work better for 5.2.x GAs. Worked around a couple of assertions in legacy mode. bugref:9313

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r75889 r75894  
    134134    /** Array of HGCM parameters. */
    135135    PVBOXHGCMSVCPARM mpParms;
     136    /** Set if we detected the message skipping hack from r121400. */
     137    bool m_f60BetaHackInPlay;
    136138
    137139    HostCommand()
     
    140142        , mParmCount(0)
    141143        , mpParms(NULL)
     144        , m_f60BetaHackInPlay(false)
    142145    {
    143146        RTListInit(&m_ListEntry);
     
    472475    /** Set if master. */
    473476    bool                    m_fIsMaster;
     477    /** Set if restored (needed for shutting legacy mode assert on non-masters). */
     478    bool                    m_fRestored;
    474479
    475480    /** Set if we've got a pending wait cancel. */
     
    489494        , m_idSession(UINT32_MAX)
    490495        , m_fIsMaster(false)
     496        , m_fRestored(false)
    491497        , m_fPendingCancel(false)
    492498        , m_enmIsPending((guestControl::eGuestFn)0)
     
    503509        , m_idSession(UINT32_MAX)
    504510        , m_fIsMaster(false)
     511        , m_fRestored(false)
    505512        , m_fPendingCancel(false)
    506513        , m_enmIsPending((guestControl::eGuestFn)0)
     
    652659        Assert(pFirstCmd);
    653660        RTListNodeRemove(&pFirstCmd->m_ListEntry);
     661        pFirstCmd->Delete();
    654662
    655663        /* Reset state else. */
     
    896904                                         uint32_t fRequestor, bool fRestoring);
    897905    static DECLCALLBACK(int)  svcDisconnect(void *pvService, uint32_t idClient, void *pvClient);
    898     static DECLCALLBACK(void) svcCall(void *pvService, VBOXHGCMCALLHANDLE callHandle, uint32_t idClient, void *pvClient,
     906    static DECLCALLBACK(void) svcCall(void *pvService, VBOXHGCMCALLHANDLE hCall, uint32_t idClient, void *pvClient,
    899907                                      uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival);
    900908    static DECLCALLBACK(int)  svcHostCall(void *pvService, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     
    915923    int clientToMain(ClientState *pClient, uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    916924
    917     int clientMsgOldGet(ClientState *pClient, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     925    int clientMsgOldGet(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    918926    int clientMsgOldFilterSet(ClientState *pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    919     int clientMsgOldSkip(ClientState *pClient, uint32_t cParms);
     927    int clientMsgOldSkip(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms);
    920928
    921929    int hostCallback(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     
    10881096int GstCtrlService::clientMsgOldGet(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    10891097{
    1090     ASSERT_GUEST(pClient->m_idSession != UINT32_MAX || pClient->m_fIsMaster);
     1098    ASSERT_GUEST(pClient->m_idSession != UINT32_MAX || pClient->m_fIsMaster || pClient->m_fRestored);
    10911099
    10921100    /* Use the current (inbound) connection. */
     
    17811789    uint32_t const fFlags = paParms[1].u.uint32;
    17821790
    1783     ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED);
     1791    ASSERT_GUEST_RETURN(pClient->m_fIsMaster || (m_fLegacyMode && pClient->m_idSession == UINT32_MAX), VERR_ACCESS_DENIED);
    17841792
    17851793    /*
     
    18771885 * @return  VBox status code.
    18781886 * @param   pClient     The client state.
     1887 * @param   hCall       The call handle for completing it.
    18791888 * @param   cParms      Number of parameters.
    18801889 */
    1881 int GstCtrlService::clientMsgOldSkip(ClientState *pClient, uint32_t cParms)
     1890int GstCtrlService::clientMsgOldSkip(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms)
    18821891{
    18831892    /*
     
    18881897    /*
    18891898     * Execute the request.
    1890      */
    1891     if (!RTListIsEmpty(&pClient->m_HostCmdList))
    1892         pClient->OldDitchFirstHostCmd();
    1893 
    1894     LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->m_idClient));
     1899     *
     1900     * Note! As it turns out the old and new skip should be mostly the same.  The
     1901     *       pre-6.0 GAs (up to BETA3) has a hack which tries to issue a
     1902     *       VERR_NOT_SUPPORTED reply to unknown host requests, however the 5.2.x
     1903     *       and earlier GAs doesn't.  We need old skip behavior only for the 6.0
     1904     *       beta GAs, nothing else.
     1905     *       So, we have to track whether they issued a MSG_REPLY or not.  Wonderful.
     1906     */
     1907    HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
     1908    if (pFirstCmd)
     1909    {
     1910        uint32_t const idMsg             = pFirstCmd->mMsgType;
     1911        bool const     f60BetaHackInPlay = pFirstCmd->m_f60BetaHackInPlay;
     1912        int            rc;
     1913        if (!f60BetaHackInPlay)
     1914            rc = clientMsgSkip(pClient, hCall, 0, NULL);
     1915        else
     1916        {
     1917            RTListNodeRemove(&pFirstCmd->m_ListEntry);
     1918            pFirstCmd->Delete();
     1919            rc = VINF_SUCCESS;
     1920        }
     1921
     1922        /* Reset legacy message wait/get state: */
     1923        if (RT_SUCCESS(rc))
     1924        {
     1925            pClient->mHostCmdRc    = VINF_SUCCESS;
     1926            pClient->mHostCmdTries = 0;
     1927            pClient->mPeekCount    = 0;
     1928        }
     1929
     1930        LogFlowFunc(("[Client %RU32] Legacy message skipping: Skipped %u (%s)%s!\n",
     1931                     pClient->m_idClient, idMsg, GstCtrlHostFnName((eHostFn)idMsg), f60BetaHackInPlay ? " hack style" : ""));
     1932        NOREF(idMsg);
     1933        return rc;
     1934    }
     1935    LogFlowFunc(("[Client %RU32] Legacy message skipping: No messages pending!\n", pClient->m_idClient));
    18951936    return VINF_SUCCESS;
    18961937}
     
    20122053         */
    20132054        case GUEST_MSG_REPLY:
     2055            if (cParms >= 3 && paParms[2].u.uint32 == (uint32_t)VERR_NOT_SUPPORTED)
     2056            {
     2057                HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
     2058                if (pFirstCmd && pFirstCmd->m_idContext == paParms[0].u.uint32)
     2059                    pFirstCmd->m_f60BetaHackInPlay = true;
     2060            }
     2061            RT_FALL_THROUGH();
    20142062        case GUEST_MSG_PROGRESS_UPDATE:
    20152063        case GUEST_SESSION_NOTIFY:
     
    20362084        case GUEST_MSG_SKIP_OLD:
    20372085            LogFlowFunc(("[Client %RU32] GUEST_MSG_SKIP_OLD\n", idClient));
    2038             rc = pThis->clientMsgOldSkip(pClient, cParms);
     2086            rc = pThis->clientMsgOldSkip(pClient, hCall, cParms);
    20392087            break;
    20402088
     
    23152363         */
    23162364    }
     2365    pClient->m_fRestored = true;
    23172366    return VINF_SUCCESS;
    23182367}
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