VirtualBox

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


Ignore:
Timestamp:
Jul 24, 2008 5:15:02 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33677
Message:

Added VbglR3GuestPropWriteValueF and VbglR3GuestPropWriteValueV.

File:
1 edited

Legend:

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

    r10860 r10861  
    131131 *
    132132 * @returns VBox status code.
     133 *
    133134 * @param   u32ClientId     The client id returned by VbglR3InvsSvcConnect().
    134  * @param   pszName         The property to save to.  Utf8
    135  * @param   pszValue        The value to store.  Utf8.  If this is NULL then
    136  *                          the property will be removed.
     135 * @param   pszName         The property to save to.  Must be valid UTF-8.
     136 * @param   pszValue        The value to store.  Must be valid UTF-8.
     137 *                          If this is NULL then the property will be removed.
     138 *
    137139 * @note  if the property already exists and pszValue is not NULL then the
    138140 *        property's flags field will be left unchanged
     
    169171            rc = Msg.hdr.result;
    170172    }
     173    return rc;
     174}
     175
     176
     177/**
     178 * Write a property value where the value is in RTStrPrintfV fashion.
     179 *
     180 * @returns The same as VbglR3GuestPropWriteValue with the addition of VERR_NO_STR_MEMORY.
     181 *
     182 * @param   u32ClientId     The client ID returned by VbglR3InvsSvcConnect().
     183 * @param   pszName         The property to save to.  Must be valid UTF-8.
     184 * @param   pszValueFormat  The value format. This must be valid UTF-8 when fully formatted.
     185 * @param   va              The format arguments.
     186 */
     187VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va)
     188{
     189    /*
     190     * Format the value and pass it on to the setter.
     191     */
     192    int rc = VERR_NO_STR_MEMORY;
     193    char *pszValue;
     194    if (RTStrAPrintfV(&pszValue, pszValueFormat, va) < 0)
     195    {
     196        rc = VbglR3GuestPropWriteValue(u32ClientId, pszName, pszValue);
     197        RTStrFree(pszValue);
     198    }
     199    return rc;
     200}
     201
     202
     203/**
     204 * Write a property value where the value is in RTStrPrintf fashion.
     205 *
     206 * @returns The same as VbglR3GuestPropWriteValue with the addition of VERR_NO_STR_MEMORY.
     207 *
     208 * @param   u32ClientId     The client ID returned by VbglR3InvsSvcConnect().
     209 * @param   pszName         The property to save to.  Must be valid UTF-8.
     210 * @param   pszValueFormat  The value format. This must be valid UTF-8 when fully formatted.
     211 * @param   ...             The format arguments.
     212 */
     213VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...)
     214{
     215    va_list va;
     216    va_start(va, pszValueFormat);
     217    int rc = VbglR3GuestPropWriteValueV(u32ClientId, pszName, pszValueFormat, va);
     218    va_end(va);
    171219    return rc;
    172220}
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