VBoxGuestR3LibGuestProp.cpp revision c162c0cd25224d3979dc677d2eabc6cb5e8723b9
ea53cbf2a35b654a03cf6bc52b0b1fa849d5fc86Ryan Grove * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, guest properties.
e58e329a62c99b6967a791762117392e5af609deRyan Grove * Copyright (C) 2007 Sun Microsystems, Inc.
e58e329a62c99b6967a791762117392e5af609deRyan Grove * This file is part of VirtualBox Open Source Edition (OSE), as
67dad868b77ee156c32e10f4723686bcece665f2Ryan Grove * available from http://www.virtualbox.org. This file is free software;
67dad868b77ee156c32e10f4723686bcece665f2Ryan Grove * you can redistribute it and/or modify it under the terms of the GNU
67dad868b77ee156c32e10f4723686bcece665f2Ryan Grove * General Public License (GPL) as published by the Free Software
67dad868b77ee156c32e10f4723686bcece665f2Ryan Grove * Foundation, in version 2 as it comes in the "COPYING" file of the
67dad868b77ee156c32e10f4723686bcece665f2Ryan Grove * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4e21d9ace0f1e852eddbcea14f5becdce1d8dba9Ryan Grove * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4e21d9ace0f1e852eddbcea14f5becdce1d8dba9Ryan Grove * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
4e21d9ace0f1e852eddbcea14f5becdce1d8dba9Ryan Grove * Clara, CA 95054 USA or visit http://www.sun.com if you need
4e21d9ace0f1e852eddbcea14f5becdce1d8dba9Ryan Grove * additional information or have any questions.
200e1189ccbb1d6a1ddbef2e9320535f4a1af440Ryan Grove/*******************************************************************************
fc948858031e489d09d1d8c950ec74a88119cea6Ryan Grove* Header Files *
fc948858031e489d09d1d8c950ec74a88119cea6Ryan Grove*******************************************************************************/
3b176d01148442acf4e41c28739a6d8acbf6d32bRyan Grove/*******************************************************************************
3b176d01148442acf4e41c28739a6d8acbf6d32bRyan Grove* Structures and Typedefs *
be283020e5e7805257d00e466bb849b969bd109eRyan Grove*******************************************************************************/
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * Structure containing information needed to enumerate through guest
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * properties.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @remarks typedef in VBoxGuestLib.h.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove /** @todo add a magic and validate the handle. */
7f9dfffb92e442a6d99b2becef29e6f4d8db4edeRyan Grove /** The buffer containing the raw enumeration data */
ea53cbf2a35b654a03cf6bc52b0b1fa849d5fc86Ryan Grove /** The end of the buffer */
ea53cbf2a35b654a03cf6bc52b0b1fa849d5fc86Ryan Grove /** Pointer to the next entry to enumerate inside the buffer */
be283020e5e7805257d00e466bb849b969bd109eRyan Groveusing namespace guestProp;
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * Connects to the guest property service.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @returns VBox status code
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @param pu32ClientId Where to put the client id on success. The client id
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * must be passed to all the other calls to the service.
be283020e5e7805257d00e466bb849b969bd109eRyan GroveVBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pu32ClientId)
be283020e5e7805257d00e466bb849b969bd109eRyan Grove Info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
be283020e5e7805257d00e466bb849b969bd109eRyan Grove strcpy(Info.Loc.u.host.achName, "VBoxGuestPropSvc");
be283020e5e7805257d00e466bb849b969bd109eRyan Grove Info.u32ClientID = UINT32_MAX; /* try make valgrid shut up. */
be283020e5e7805257d00e466bb849b969bd109eRyan Grove int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CONNECT, &Info, sizeof(Info));
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * Disconnect from the guest property service.
ea53cbf2a35b654a03cf6bc52b0b1fa849d5fc86Ryan Grove * @returns VBox status code.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @param u32ClientId The client id returned by VbglR3InfoSvcConnect().
be283020e5e7805257d00e466bb849b969bd109eRyan GroveVBGLR3DECL(int) VbglR3GuestPropDisconnect(uint32_t u32ClientId)
ea53cbf2a35b654a03cf6bc52b0b1fa849d5fc86Ryan Grove int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_DISCONNECT, &Info, sizeof(Info));
4397b5a5bcaf8a291905306dbcc7f2b0fd2e60eeRyan Grove * Write a property value.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @returns VBox status code.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @param u32ClientId The client id returned by VbglR3InvsSvcConnect().
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @param pszName The property to save to. Utf8
a78f013cfc225b57730e82e15135c71d55857355Ryan Grove * @param pszValue The value to store. Utf8. If this is NULL then
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * the property will be removed.
be283020e5e7805257d00e466bb849b969bd109eRyan Grove * @param pszFlags The flags for the property
be283020e5e7805257d00e466bb849b969bd109eRyan GroveVBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags)
return rc;
VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue)
int rc;
return rc;
VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va)
char *pszValue;
return rc;
VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...)
return rc;
char **ppszFlags,
return rc;
if (ppszValue)
if (ppszFlags)
return VINF_SUCCESS;
const char *pszName,
char **ppszValue)
if (pvTmpBuf)
return rc;
return rc;
const char *pszzPatterns,
char *pcBuf,
++cchPatterns;
if ( pcbBufActual
return rc;
char const * const *papszPatterns,
char const **ppszName,
char const **ppszValue,
char const **ppszFlags)
if (!Handle)
return VERR_NO_MEMORY;
const char *pszNameTmp;
if (!ppszName)
return rc;
char const **ppszName,
char const **ppszValue,
char const **ppszFlags)
u64Timestamp = 0;
if (ppszName)
if (ppszValue)
if (pu64Timestamp)
if (ppszFlags)
return VINF_SUCCESS;
const char * const *papszPatterns,
&pHandle,
&pszName,
&pszValue,
&pszFlags);
&pszName,
&pszValue,
&pszFlags);
return rc;
const char *pszPatterns,
return rc;
if (ppszName)
if (ppszValue)
if (ppszFlags)
return VINF_SUCCESS;