VirtualBox

Changeset 94184 in vbox for trunk/src/VBox/HostServices


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
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