VirtualBox

Changeset 10005 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jun 27, 2008 9:33:35 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32462
Message:

Additions/common: handle the guest property delete request

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibInfoSvc.cpp

    r9918 r10005  
    8686 * @param   u32ClientId     The client id returned by VbglR3InvsSvcConnect().
    8787 * @param   pszKey          The registry key to save to.
    88  * @param   pszValue        The value to save.
     88 * @param   pszValue        The value to store.  If this is NULL then the key
     89 *                          will be removed.
    8990 */
    9091VBGLR3DECL(int) VbglR3InfoSvcWriteKey(uint32_t u32ClientId, char *pszKey, char *pszValue)
    9192{
    92     SetConfigKey Msg;
     93    int rc;
    9394
    94     Msg.hdr.result = (uint32_t)VERR_WRONG_ORDER;  /** @todo drop the cast when the result type has been fixed! */
    95     Msg.hdr.u32ClientID = u32ClientId;
    96     Msg.hdr.u32Function = SET_CONFIG_KEY;
    97     Msg.hdr.cParms = 2;
    98     VbglHGCMParmPtrSet(&Msg.key, pszKey, strlen(pszKey) + 1);
    99     VbglHGCMParmPtrSet(&Msg.value, pszValue, strlen(pszValue) + 1);
     95    if (pszValue != NULL)
     96    {
     97        SetConfigKey Msg;
    10098
    101     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     99        Msg.hdr.result = (uint32_t)VERR_WRONG_ORDER;  /** @todo drop the cast when the result type has been fixed! */
     100        Msg.hdr.u32ClientID = u32ClientId;
     101        Msg.hdr.u32Function = SET_CONFIG_KEY;
     102        Msg.hdr.cParms = 2;
     103        VbglHGCMParmPtrSet(&Msg.key, pszKey, strlen(pszKey) + 1);
     104        VbglHGCMParmPtrSet(&Msg.value, pszValue, strlen(pszValue) + 1);
     105        rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     106        if (RT_SUCCESS(rc))
     107            rc = Msg.hdr.result;
     108    }
     109    else
     110    {
     111        DelConfigKey Msg;
     112
     113        Msg.hdr.result = (uint32_t)VERR_WRONG_ORDER;  /** @todo drop the cast when the result type has been fixed! */
     114        Msg.hdr.u32ClientID = u32ClientId;
     115        Msg.hdr.u32Function = DEL_CONFIG_KEY;
     116        Msg.hdr.cParms = 1;
     117        VbglHGCMParmPtrSet(&Msg.key, pszKey, strlen(pszKey) + 1);
     118        rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     119        if (RT_SUCCESS(rc))
     120            rc = Msg.hdr.result;
     121    }
    102122    return rc;
    103123}
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