VirtualBox

Changeset 94184 in vbox for trunk


Ignore:
Timestamp:
Mar 11, 2022 6:24:17 PM (3 years ago)
Author:
vboxsync
Message:

Main: Guest Properties: notify lesteners that property was deleted (additional fixes in r150441, r150442, r150443, r150445), bugref:10185.

Location:
trunk/src/VBox
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp

    r93115 r94184  
    831831                                 pu64Timestamp,
    832832                                 NULL /* ppszFlags */,
    833                                  &cbBuf);
     833                                 &cbBuf,
     834                                 NULL /* pfWasDeleted */);
    834835
    835836        if (rc != VERR_BUFFER_OVERFLOW)
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r93300 r94184  
    15151515    uint64_t u64TimestampOut = 0;
    15161516    char *pszFlags = NULL;
     1517    bool fWasDeleted = false;
    15171518    /* The buffer for storing the data and its initial size.  We leave a bit
    15181519     * of space here in case the maximum values are raised. */
     
    15381539                                     u64TimestampIn, u32Timeout,
    15391540                                     &pszName, &pszValue, &u64TimestampOut,
    1540                                      &pszFlags, &cbBuf);
     1541                                     &pszFlags, &cbBuf, &fWasDeleted);
    15411542        }
    15421543        if (VERR_BUFFER_OVERFLOW == rc)
     
    15621563    else if (RT_SUCCESS(rc))
    15631564    {
    1564         RTPrintf("Name: %s\n", pszName);
    1565         RTPrintf("Value: %s\n", pszValue);
    1566         RTPrintf("Timestamp: %lld ns\n", u64TimestampOut);
    1567         RTPrintf("Flags: %s\n", pszFlags);
     1565        if (fWasDeleted)
     1566        {
     1567            RTPrintf("Property %s was deleted\n", pszName);
     1568        }
     1569        else
     1570        {
     1571            RTPrintf("Name: %s\n", pszName);
     1572            RTPrintf("Value: %s\n", pszValue);
     1573            RTPrintf("Timestamp: %lld ns\n", u64TimestampOut);
     1574            RTPrintf("Flags: %s\n", pszFlags);
     1575        }
    15681576    }
    15691577
  • trunk/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp

    r93115 r94184  
    177177                                        uint64_t *pu64Timestamp,
    178178                                        char **ppszFlags,
    179                                         uint32_t *pcbBufActual)
     179                                        uint32_t *pcbBufActual,
     180                                        bool *pfWasDeleted)
    180181{
    181182    RT_NOREF2(pvBuf, cbBuf);
     
    201202    if (pcbBufActual)
    202203        *pcbBufActual = 256;
     204    if (pfWasDeleted)
     205        *pfWasDeleted = false;
    203206    return VINF_SUCCESS;
    204207}
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestProp.cpp

    r93453 r94184  
    937937 * @param   pcbBufActual    If @a pcBuf is not large enough, the size needed.
    938938 *                          Optional.
     939 * @param   pfWasDeleted    A flag which indicates that property was deleted.
     940 *                          Optional.
    939941 */
    940942VBGLR3DECL(int) VbglR3GuestPropWait(HGCMCLIENTID idClient,
     
    944946                                    char ** ppszName, char **ppszValue,
    945947                                    uint64_t *pu64Timestamp, char **ppszFlags,
    946                                     uint32_t *pcbBufActual)
     948                                    uint32_t *pcbBufActual, bool *pfWasDeleted)
    947949{
    948950    /*
     
    973975
    974976    /*
    975      * Buffer layout: Name\0Value\0Flags\0.
     977     * Buffer layout: Name\0Value\0Flags\0fWasDeleted\0.
    976978     *
    977979     * If the caller cares about any of these strings, make sure things are
     
    979981     */
    980982    if (    RT_SUCCESS(rc)
    981         &&  (ppszName != NULL || ppszValue != NULL || ppszFlags != NULL))
     983        &&  (ppszName != NULL || ppszValue != NULL || ppszFlags != NULL || pfWasDeleted != NULL))
    982984    {
    983985        /* Validate / skip 'Name'. */
     
    994996
    995997        if (ppszFlags)
     998            *ppszFlags = pszFlags;
     999
     1000        /* Validate / skip 'Flags'. */
     1001        char *pszWasDeleted = RTStrEnd(pszFlags, cbBuf - (pszFlags - (char *)pvBuf)) + 1;
     1002        AssertPtrReturn(pszWasDeleted, VERR_TOO_MUCH_DATA);
     1003        if (pfWasDeleted)
    9961004        {
    997             /* Validate 'Flags'. */
    998             char *pszEos = RTStrEnd(pszFlags, cbBuf - (pszFlags - (char *)pvBuf));
    999             AssertPtrReturn(pszEos, VERR_TOO_MUCH_DATA);
    1000             *ppszFlags = pszFlags;
     1005            AssertReturn(pszWasDeleted[0] == '0' || pszWasDeleted[0] == '1', VERR_PARSE_ERROR);
     1006            *pfWasDeleted = pszWasDeleted[0] == '0' ? false : true;
    10011007        }
     1008
     1009        /* Validate end of buffer string. */
     1010        char *pszEos = RTStrEnd(pszWasDeleted, cbBuf - (pszWasDeleted - (char *)pvBuf));
     1011        AssertPtrReturn(pszEos, VERR_TOO_MUCH_DATA);
    10021012    }
    10031013
  • trunk/src/VBox/Additions/common/pam/pam_vbox.cpp

    r93115 r94184  
    529529                                     0 /* Last timestamp; just wait for next event */, uTimeoutMS,
    530530                                     &pszName, &pszValue, &u64TimestampOut,
    531                                      &pszFlags, &cbBuf);
     531                                     &pszFlags, &cbBuf, NULL /* pfWasDeleted */);
    532532        }
    533533        else
  • trunk/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp

    r93115 r94184  
    328328                                     0 /* Last timestamp; just wait for next event */, uTimeoutMS,
    329329                                     &pszName, &pszValue, &u64TimestampOut,
    330                                      &pszFlags, &cbBuf);
     330                                     &pszFlags, &cbBuf, NULL);
    331331        }
    332332        else
  • trunk/src/VBox/Additions/x11/VBoxClient/display-drm.cpp

    r94121 r94184  
    900900static DECLCALLBACK(int) vbDrmIpcClientWorker(RTTHREAD ThreadSelf, void *pvUser)
    901901{
    902     VBOX_DRMIPC_CLIENT        hClient  = VBOX_DRMIPC_CLIENT_INITIALIZER;
     902    VBOX_DRMIPC_CLIENT  hClient  = VBOX_DRMIPC_CLIENT_INITIALIZER;
    903903    RTLOCALIPCSESSION   hSession = (RTLOCALIPCSESSION)pvUser;
    904904    int                 rc;
     
    11331133
    11341134            rc = VbglR3GuestPropWait(idClient, VBGLR3DRMIPCPROPRESTRICT, achBuf, sizeof(achBuf), u64Timestamp,
    1135                                      VBOX_DRMIPC_RX_TIMEOUT_MS, NULL, NULL, &u64Timestamp, NULL, NULL);
     1135                                     VBOX_DRMIPC_RX_TIMEOUT_MS, NULL, NULL, &u64Timestamp, NULL, NULL, NULL);
    11361136            if (RT_SUCCESS(rc))
    11371137                vbDrmSetIpcServerAccessPermissions(hIpcServer);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp

    r93700 r94184  
    370370                    {
    371371                        Bstr aNextValue, aNextFlags;
     372                        BOOL aNextWasDeleted;
    372373                        gpcev->COMGETTER(Value)(aNextValue.asOutParam());
    373374                        gpcev->COMGETTER(Flags)(aNextFlags.asOutParam());
    374                         RTPrintf(GuestProp::tr("Name: %ls, value: %ls, flags: %ls\n"),
    375                                  aNextName.raw(), aNextValue.raw(), aNextFlags.raw());
     375                        gpcev->COMGETTER(FWasDeleted)(&aNextWasDeleted);
     376                        if (aNextWasDeleted)
     377                            RTPrintf(GuestProp::tr("Property %ls was deleted\n"), aNextName.raw());
     378                        else
     379                            RTPrintf(GuestProp::tr("Name: %ls, value: %ls, flags: %ls\n"),
     380                                     aNextName.raw(), aNextValue.raw(), aNextFlags.raw());
    376381                        fSignalled = true;
    377382                    }
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r93115 r94184  
    365365            gpcev = ctx['global'].queryInterface(event, 'IGuestPropertyChangedEvent')
    366366            if gpcev:
    367                 print("guest property change: name=%s value=%s" % (gpcev.name, gpcev.value))
     367                if (gpcev.fWasDeleted)
     368                    print("property %s was deleted" % (gpcev.name))
     369                else
     370                    print("guest property change: name=%s value=%s flags='%s'" %
     371                          (gpcev.name, gpcev.value, gpcev.flags))
    368372        elif  evtype == ctx['global'].constants.VBoxEventType_OnMousePointerShapeChanged:
    369373            psev = ctx['global'].queryInterface(event, 'IMousePointerShapeChangedEvent')
  • trunk/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.cpp

    r93891 r94184  
    425425    int getNotification(uint32_t u32ClientId, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    426426    int getOldNotificationInternal(const char *pszPattern, uint64_t nsTimestamp, Property *pProp);
    427     int getNotificationWriteOut(uint32_t cParms, VBOXHGCMSVCPARM paParms[], Property const &prop);
     427    int getNotificationWriteOut(uint32_t cParms, VBOXHGCMSVCPARM paParms[], Property const &prop, bool fWasDeleted);
    428428    int doNotifications(const char *pszProperty, uint64_t nsTimestamp);
    429429    int notifyHost(const char *pszName, const char *pszValue, uint64_t nsTimestamp, const char *pszFlags);
     
    10401040
    10411041/** Helper query used by getNotification */
    1042 int Service::getNotificationWriteOut(uint32_t cParms, VBOXHGCMSVCPARM paParms[], Property const &rProp)
     1042int Service::getNotificationWriteOut(uint32_t cParms, VBOXHGCMSVCPARM paParms[], Property const &rProp, bool fWasDeleted)
    10431043{
    10441044    AssertReturn(cParms == 4, VERR_INVALID_PARAMETER); /* Basic sanity checking. */
     
    10511051    {
    10521052        char szFlags[GUEST_PROP_MAX_FLAGS_LEN];
     1053        char szWasDeleted[2] = { fWasDeleted ? '1' : '0', '\0' };
     1054
    10531055        rc = GuestPropWriteFlags(rProp.mFlags, szFlags);
    10541056        if (RT_SUCCESS(rc))
     
    10591061            size_t const cbName   = rProp.mName.length() + 1;
    10601062            size_t const cbValue  = rProp.mValue.length() + 1;
    1061             size_t const cbNeeded = cbName + cbValue + cbFlags;
     1063            size_t const cbWasDeleted  = strlen(szWasDeleted) + 1;
     1064            size_t const cbNeeded = cbName + cbValue + cbFlags + cbWasDeleted;
    10621065            HGCMSvcSetU32(&paParms[3], (uint32_t)cbNeeded);
    10631066            if (cbNeeded <= cbBuf)
    10641067            {
     1068                /* Buffer layout: Name\0Value\0Flags\0fWasDeleted\0. */
    10651069                memcpy(pchBuf, rProp.mName.c_str(), cbName);
    10661070                pchBuf += cbName;
     
    10681072                pchBuf += cbValue;
    10691073                memcpy(pchBuf, szFlags, cbFlags);
     1074                pchBuf += cbFlags;
     1075                memcpy(pchBuf, szWasDeleted, cbWasDeleted);
    10701076            }
    10711077            else
     
    11851191            else
    11861192            {
    1187                 int rc2 = getNotificationWriteOut(cParms, paParms, prop);
     1193                int rc2 = getNotificationWriteOut(cParms, paParms, prop, !getPropertyInternal(prop.mName.c_str()));
    11881194                if (RT_FAILURE(rc2))
    11891195                    rc = rc2;
     
    12521258            if (prop.Matches(pszPatterns))
    12531259            {
    1254                 int rc2 = getNotificationWriteOut(it->mParmsCnt, it->mParms, prop);
     1260                int rc2 = getNotificationWriteOut(it->mParmsCnt, it->mParms, prop, !pProp);
    12551261                if (RT_SUCCESS(rc2))
    12561262                    rc2 = it->mRc;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r94075 r94184  
    2586925869  <interface
    2587025870    name="IGuestPropertyChangedEvent" extends="IMachineEvent"
    25871     uuid="3f63597a-26f1-4edb-8dd2-6bddd0912368"
     25871    uuid="2d0f4c6f-a77e-45c5-96d2-7ca7daae63a9"
    2587225872    wsmap="managed" autogen="VBoxEvent" id="OnGuestPropertyChanged"
    2587325873    >
     
    2589125891      <desc>
    2589225892        The new property flags.
     25893      </desc>
     25894    </attribute>
     25895
     25896    <attribute name="fWasDeleted" readonly="yes" type="boolean">
     25897      <desc>
     25898        A flag which indicates that property was deleted.
    2589325899      </desc>
    2589425900    </attribute>
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r93115 r94184  
    175175    void i_onSnapshotChanged(const Guid &aMachineId, const Guid &aSnapshotId);
    176176
    177     void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags);
     177    void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags,
     178                                  const BOOL &fWasDeleted);
    178179    void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, const Utf8Str &aName,
    179180                                NATProtocol_T aProto, const Utf8Str &aHostIp, uint16_t aHostPort,
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r93891 r94184  
    18451845    Bstr value(pCBData->pcszValue);
    18461846    Bstr flags(pCBData->pcszFlags);
     1847    BOOL fWasDeleted = !pCBData->pcszValue;
    18471848    ComObjPtr<Console> pConsole = reinterpret_cast<Console *>(pvExtension);
    18481849    HRESULT hrc = pConsole->mControl->PushGuestProperty(name.raw(),
     
    18501851                                                        pCBData->u64Timestamp,
    18511852                                                        flags.raw(),
    1852                                                         !pCBData->pcszValue);
     1853                                                        fWasDeleted);
    18531854    if (SUCCEEDED(hrc))
    18541855    {
    1855         ::FireGuestPropertyChangedEvent(pConsole->mEventSource, pConsole->i_getId().raw(), name.raw(), value.raw(), flags.raw());
     1856        ::FireGuestPropertyChangedEvent(pConsole->mEventSource, pConsole->i_getId().raw(), name.raw(), value.raw(), flags.raw(),
     1857                                        fWasDeleted);
    18561858        rc = VINF_SUCCESS;
    18571859    }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r94092 r94184  
    56225622            alock.release();
    56235623
    5624             mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags);
     5624            mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags, fDelete);
    56255625        }
    56265626    }
     
    1367713677        alock.release();
    1367813678
    13679         mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags);
     13679        mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags, fWasDeleted);
    1368013680    }
    1368113681    catch (...)
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r93115 r94184  
    36093609 */
    36103610void VirtualBox::i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue,
    3611                                           const Utf8Str &aFlags)
     3611                                          const Utf8Str &aFlags, const BOOL &fWasDeleted)
    36123612{
    36133613    ComPtr<IEvent> ptrEvent;
    36143614    HRESULT hrc = ::CreateGuestPropertyChangedEvent(ptrEvent.asOutParam(), m->pEventSource,
    3615                                                     aMachineId.toString(), aName, aValue, aFlags);
     3615                                                    aMachineId.toString(), aName, aValue, aFlags, fWasDeleted);
    36163616    AssertComRCReturnVoid(hrc);
    36173617    i_postEvent(new AsyncEvent(this, ptrEvent));
  • trunk/src/VBox/ValidationKit/testdriver/vbox.py

    r94126 r94184  
    806806            try:
    807807                oEvtIt = self.oVBoxMgr.queryInterface(oEvtBase, 'IGuestPropertyChangedEvent');
    808                 return self.onGuestPropertyChange(oEvtIt.machineId, oEvtIt.name, oEvtIt.value, oEvtIt.flags);
     808                return self.onGuestPropertyChange(oEvtIt.machineId, oEvtIt.name, oEvtIt.value, oEvtIt.flags, oEvtIt.fWasDeleted);
    809809            except:
    810810                reporter.logXcpt();
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