service.cpp revision c0d42b3cb1528dba30ecac910e9bda2b60dd0852
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Guest Property Service:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Host service entry points.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright (C) 2008 Sun Microsystems, Inc.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * available from http://www.virtualbox.org. This file is free software;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * you can redistribute it and/or modify it under the terms of the GNU
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * General Public License (GPL) as published by the Free Software
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * additional information or have any questions.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This HGCM service allows the guest to set and query values in a property
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * store on the host. The service proxies the guest requests to the service
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * owner on the host using a request callback provided by the owner, and is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notified of changes to properties made by the host. It forwards these
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notifications to clients in the guest which have expressed interest and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * are waiting for notification.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The service currently consists of two threads. One of these is the main
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * HGCM service thread which deals with requests from the guest and from the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * host. The second thread sends the host asynchronous notifications of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * changes made by the guest and deals with notification timeouts.
#include <string>
#include <list>
namespace guestProp {
struct Property
NULL)
bool isNull()
struct GuestCall
int mRc;
bool mfExitThread;
void *mpvHostData;
#ifdef VBOX_STRICT
return rc;
#ifndef VBOX_GUEST_PROP_TEST_NOTHREAD
throw rc;
delete pSelf;
return rc;
return VINF_SUCCESS;
void *pvClient,
LogFlowFunc (("pvService=%p, callHandle=%p, u32ClientID=%u, pvClient=%p, u32Function=%u, cParms=%u, paParms=%p\n", pvService, callHandle, u32ClientID, pvClient, u32Function, cParms, paParms));
LogFlowFunc (("pvService=%p, u32Function=%u, cParms=%u, paParms=%p\n", pvService, u32Function, cParms, paParms));
return rc;
void *pvExtension)
return VINF_SUCCESS;
int uninit ();
return VINF_SUCCESS;
return rc;
return rc;
--itEnd;
++itEnd;
bool found = false;
found = true;
++itEnd;
return rc;
const char *pcszName;
char *pchBuf;
return rc;
bool found = false;
found = true;
if (found)
return rc;
const char *pcszName;
bool found = false;
found = true;
return rc;
return rc;
bool warn = false;
++it) {}
warn = true;
++base) {}
if (warn)
return rc;
char *pchBuf;
return rc;
u64Timestamp));
return rc;
++u64Timestamp;
bool found = false;
found = true;
const char *pszPatterns;
++it;
#ifndef VBOX_GUEST_PROP_TEST_NOTHREAD
LogFlowFunc (("pfnCallback=%p, pvData=%p, pszName=%p, pszValue=%p, u32TimeHigh=%u, u32TimeLow=%u, pszFlags=%p\n", pfnCallback, pvData, pszName, pszValue, u32TimeHigh, u32TimeLow, pszFlags));
/* LogFlowFunc (("pfnCallback=%p, pvData=%p, pszName=%s, pszValue=%s, u32TimeHigh=%u, u32TimeLow=%u, pszFlags=%s\n", pfnCallback, pvData, pszName, pszValue, u32TimeHigh, u32TimeLow, pszFlags)); */
sizeof(HostCallbackData));
return VINF_SUCCESS;
switch (eFunction)
case GET_PROP:
case SET_PROP:
case SET_PROP_VALUE:
case DEL_PROP:
case ENUM_PROPS:
case GET_NOTIFICATION:
switch (eFunction)
case SET_PROPS_HOST:
case GET_PROP_HOST:
case SET_PROP_HOST:
case SET_PROP_VALUE_HOST:
case DEL_PROP_HOST:
case ENUM_PROPS_HOST:
return rc;
unsigned count = 0;
mfExitThread = true;
#ifndef VBOX_GUEST_PROP_TEST_NOTHREAD
++count;
return rc;
LogFlowFunc(("ptable->cbSize = %d, ptable->u32Version = 0x%08X\n", ptable->cbSize, ptable->u32Version));
} catch (int rcThrown) {
return rc;