VirtualBox

Changeset 94327 in vbox


Ignore:
Timestamp:
Mar 22, 2022 3:56:55 PM (3 years ago)
Author:
vboxsync
Message:

Main/DrvAudioVRDE: Drop passing pointers through CFGM in favor of using VMM2USERMETHODS::pfnQueryGenericObject, bugref:10053

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r93444 r94327  
    114114int AudioVRDE::configureDriver(PCFGMNODE pLunCfg, PCVMMR3VTABLE pVMM)
    115115{
    116     int rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "Object", (uintptr_t)this);
    117     AssertRCReturn(rc, rc);
    118 
    119     rc = pVMM->pfnCFGMR3InsertInteger(pLunCfg, "ObjectVRDPServer", (uintptr_t)mpConsole->i_consoleVRDPServer());
    120     AssertRCReturn(rc, rc);
    121 
    122116    return AudioDriver::configureDriver(pLunCfg, pVMM);
    123117}
     
    713707     */
    714708    pThis->pDrvIns                   = pDrvIns;
     709    pThis->cClients                  = 0;
    715710    /* IBase */
    716711    pDrvIns->IBase.pfnQueryInterface = drvAudioVrdeQueryInterface;
     
    744739    AssertPtrReturn(pThis->pIHostAudioPort, VERR_PDM_MISSING_INTERFACE_ABOVE);
    745740
    746     /*
    747      * Get the ConsoleVRDPServer object pointer.
    748      */
    749     void *pvUser;
    750     int rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "ObjectVRDPServer", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */
    751     AssertMsgRCReturn(rc, ("Confguration error: No/bad \"ObjectVRDPServer\" value, rc=%Rrc\n", rc), rc);
    752 
    753     /* CFGM tree saves the pointer to ConsoleVRDPServer in the Object node of AudioVRDE. */
    754     pThis->pConsoleVRDPServer = (ConsoleVRDPServer *)pvUser;
     741    /* Get the Console object pointer. */
     742    com::Guid ConsoleUuid(COM_IIDOF(IConsole));
     743    IConsole *pIConsole = (IConsole *)PDMDrvHlpQueryGenericUserObject(pDrvIns, ConsoleUuid.raw());
     744    AssertLogRelReturn(pIConsole, VERR_INTERNAL_ERROR_3);
     745    Console *pConsole = static_cast<Console *>(pIConsole);
     746    AssertLogRelReturn(pConsole, VERR_INTERNAL_ERROR_3);
     747
     748    /* Get the console VRDP object pointer. */
     749    pThis->pConsoleVRDPServer = pConsole->i_consoleVRDPServer();
    755750    AssertLogRelMsgReturn(RT_VALID_PTR(pThis->pConsoleVRDPServer) || !pThis->pConsoleVRDPServer,
    756751                          ("pConsoleVRDPServer=%p\n", pThis->pConsoleVRDPServer), VERR_INVALID_POINTER);
    757     pThis->cClients = 0;
    758 
    759     /*
    760      * Get the AudioVRDE object pointer.
    761      */
    762     pvUser = NULL;
    763     rc = pDrvIns->pHlpR3->pfnCFGMQueryPtr(pCfg, "Object", &pvUser); /** @todo r=andy Get rid of this hack and use IHostAudio::SetCallback. */
    764     AssertMsgRCReturn(rc, ("Confguration error: No/bad \"Object\" value, rc=%Rrc\n", rc), rc);
    765 
    766     pThis->pAudioVRDE = (AudioVRDE *)pvUser;
     752
     753    /* Get the AudioVRDE object pointer. */
     754    pThis->pAudioVRDE = pConsole->i_getAudioVRDE();
    767755    AssertLogRelMsgReturn(RT_VALID_PTR(pThis->pAudioVRDE), ("pAudioVRDE=%p\n", pThis->pAudioVRDE), VERR_INVALID_POINTER);
    768756    RTCritSectEnter(&pThis->pAudioVRDE->mCritSect);
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