VirtualBox

Changeset 89951 in vbox for trunk/src


Ignore:
Timestamp:
Jun 29, 2021 1:22:29 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145409
Message:

Main/{MouseImpl,KeyboardImpl,ConsoleImpl): Drop passing pointers through CFGM in favor of using VMM2USERMETHODS::pfnQueryGenericObject, bugref:10053

Location:
trunk/src/VBox/Main/src-client
Files:
4 edited

Legend:

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

    r87391 r89951  
    1073010730    }
    1073110731
     10732    if (UuidCopy == COM_IIDOF(IKeyboard))
     10733    {
     10734        IKeyboard *pIKeyboard = pConsole->mKeyboard;
     10735        return pIKeyboard;
     10736    }
     10737
     10738    if (UuidCopy == COM_IIDOF(IMouse))
     10739    {
     10740        IMouse *pIMouse = pConsole->mMouse;
     10741        return pIMouse;
     10742    }
     10743
    1073210744    if (UuidCopy == COM_IIDOF(ISnapshot))
    1073310745        return ((MYVMM2USERMETHODS *)pThis)->pISnapshot;
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r89921 r89951  
    17021702            InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    17031703            InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
    1704             InsertConfigNode(pLunL1,   "Config", &pCfg);
    1705             Keyboard *pKeyboard = mKeyboard;
    1706             InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
    17071704        }
    17081705
     
    17181715            InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    17191716            InsertConfigString(pLunL1, "Driver",               "MainMouse");
    1720             InsertConfigNode(pLunL1,   "Config", &pCfg);
    1721             Mouse *pMouse = mMouse;
    1722             InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
    17231717        }
    17241718
     
    22352229                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    22362230                InsertConfigString(pLunL1, "Driver",        "MainMouse");
    2237                 InsertConfigNode(pLunL1,   "Config", &pCfg);
    2238                 Mouse *pMouse = mMouse;
    2239                 InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
    22402231            }
    22412232            if (aPointingHID == PointingHIDType_USBMultiTouch)
     
    22522243                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    22532244                InsertConfigString(pLunL1, "Driver",        "MainMouse");
    2254                 InsertConfigNode(pLunL1,   "Config", &pCfg);
    2255                 Mouse *pMouse = mMouse;
    2256                 InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
    22572245            }
    22582246
     
    22712259                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
    22722260                InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
    2273                 InsertConfigNode(pLunL1,   "Config", &pCfg);
    2274                 Keyboard *pKeyboard = mKeyboard;
    2275                 InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
    22762261            }
    22772262        }
  • trunk/src/VBox/Main/src-client/KeyboardImpl.cpp

    r89935 r89951  
    437437     * Validate configuration.
    438438     */
    439     if (!CFGMR3AreValuesValid(pCfg, "Object\0"))
     439    if (!CFGMR3AreValuesValid(pCfg, ""))
    440440        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    441441    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     
    464464     * Get the Keyboard object pointer and update the mpDrv member.
    465465     */
    466     void *pv;
    467     int rc = CFGMR3QueryPtr(pCfg, "Object", &pv);
    468     if (RT_FAILURE(rc))
    469     {
    470         AssertMsgFailed(("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc));
    471         return rc;
    472     }
    473     pThis->pKeyboard = (Keyboard *)pv;        /** @todo Check this cast! */
     466    com::Guid uuid(COM_IIDOF(IKeyboard));
     467    IKeyboard *pIKeyboard = (IKeyboard *)PDMDrvHlpQueryGenericUserObject(pDrvIns, uuid.raw());
     468    if (!pIKeyboard)
     469    {
     470        AssertMsgFailed(("Configuration error: No/bad Keyboard object!\n"));
     471        return VERR_NOT_FOUND;
     472    }
     473    pThis->pKeyboard = static_cast<Keyboard *>(pIKeyboard);
     474
    474475    unsigned cDev;
    475476    for (cDev = 0; cDev < KEYBOARD_MAX_DEVICES; ++cDev)
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r85301 r89951  
    12421242     * Validate configuration.
    12431243     */
    1244     if (!CFGMR3AreValuesValid(pCfg, "Object\0"))
     1244    if (!CFGMR3AreValuesValid(pCfg, ""))
    12451245        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    12461246    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
     
    12681268     * Get the Mouse object pointer and update the mpDrv member.
    12691269     */
    1270     void *pv;
    1271     int rc = CFGMR3QueryPtr(pCfg, "Object", &pv);
    1272     if (RT_FAILURE(rc))
    1273     {
    1274         AssertMsgFailed(("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc));
    1275         return rc;
    1276     }
    1277     pThis->pMouse = (Mouse *)pv;        /** @todo Check this cast! */
     1270    com::Guid uuid(COM_IIDOF(IMouse));
     1271    IMouse *pIMouse = (IMouse *)PDMDrvHlpQueryGenericUserObject(pDrvIns, uuid.raw());
     1272    if (!pIMouse)
     1273    {
     1274        AssertMsgFailed(("Configuration error: No/bad Mouse object!\n"));
     1275        return VERR_NOT_FOUND;
     1276    }
     1277    pThis->pMouse = static_cast<Mouse *>(pIMouse);
     1278
    12781279    unsigned cDev;
    12791280    {
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