VirtualBox

Changeset 75969 in vbox for trunk/src


Ignore:
Timestamp:
Dec 5, 2018 12:08:09 PM (6 years ago)
Author:
vboxsync
Message:

HGCM,GuestProps: Added HGCM service notifications for VM power-on, VM resume, VM suspend, VM reset and VM power-off. Made use of the first two in guest properties to wake up guest programs waiting on any of the host version properties. Also moved inserting sysprep and host version properties to the services as that's a better home than ConsoleImpl/VMMDevInterface in my opinion.

Location:
trunk/src/VBox
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/DragAndDrop/service.cpp

    r75953 r75969  
    164164    pTable->pfnLoadState         = NULL;  /* construction done before restoring suffices */
    165165    pTable->pfnRegisterExtension = svcRegisterExtension;
     166    pTable->pfnNotify            = NULL;
    166167
    167168    /* Drag'n drop mode is disabled by default. */
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r75894 r75969  
    24402440                pTable->pfnLoadState            = GstCtrlService::svcLoadState;
    24412441                pTable->pfnRegisterExtension    = GstCtrlService::svcRegisterExtension;
     2442                pTable->pfnNotify               = NULL;
    24422443
    24432444                /* Service specific initialization. */
  • trunk/src/VBox/HostServices/GuestProperties/service.cpp

    r75773 r75969  
    4545#include <iprt/asm.h>
    4646#include <iprt/assert.h>
     47#include <iprt/buildconfig.h>
    4748#include <iprt/cpp/autores.h>
    4849#include <iprt/cpp/utils.h>
     
    5455#include <iprt/time.h>
    5556#include <VBox/vmm/dbgf.h>
     57#include <VBox/version.h>
    5658
    5759#include <string>
     
    9799             uint32_t u32Flags)
    98100        : mName(name), mValue(value), mTimestamp(u64Timestamp),
    99           mFlags(u32Flags) {}
     101          mFlags(u32Flags)
     102    {}
    100103
    101104    /** Does the property name match one of a set of patterns? */
     
    195198     * values: {(mPrevTimestamp - mcTimestampAdjustments), ..., mPrevTimestamp} */
    196199    uint64_t mcTimestampAdjustments;
     200    /** For helping setting host version properties _after_ restoring VMs. */
     201    bool m_fSetHostVersionProps;
    197202
    198203    /**
     
    311316        , mPrevTimestamp(0)
    312317        , mcTimestampAdjustments(0)
     318        , m_fSetHostVersionProps(false)
    313319#ifdef ASYNC_HOST_NOTIFY
    314320        , mhThreadNotifyHost(NIL_RTTHREAD)
     
    409415    }
    410416
     417    void setHostVersionProps();
     418    static DECLCALLBACK(void) svcNotify(void *pvService, HGCMNOTIFYEVENT enmEvent);
     419
    411420    int initialize();
    412421
     
    419428    int getProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    420429    int setProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool isGuest);
     430    int setPropertyInternal(const char *pcszName, const char *pcszValue, uint32_t fFlags, uint64_t nsTimestamp, bool fIsGuest);
    421431    int delProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool isGuest);
    422432    int enumProps(uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     
    749759
    750760    /*
     761     * Hand it over to the internal setter method.
     762     */
     763    rc = setPropertyInternal(pcszName, pcszValue, fFlags, u64TimeNano, isGuest);
     764
     765    LogFlowThisFunc(("%s=%s, rc=%Rrc\n", pcszName, pcszValue, rc));
     766    return rc;
     767}
     768
     769/**
     770 * Internal property setter.
     771 *
     772 * @returns VBox status code.
     773 * @param   pcszName            The property name.
     774 * @param   pcszValue           The new value.
     775 * @param   fFlags              The flags.
     776 * @param   nsTimestamp         The timestamp.
     777 * @param   fIsGuest            Is it the guest calling.
     778 * @throws  std::bad_alloc  if an out of memory condition occurs
     779 * @thread  HGCM
     780 */
     781int Service::setPropertyInternal(const char *pcszName, const char *pcszValue, uint32_t fFlags, uint64_t nsTimestamp, bool fIsGuest)
     782{
     783    /*
    751784     * If the property already exists, check its flags to see if we are allowed
    752785     * to change it.
    753786     */
    754787    Property *pProp = getPropertyInternal(pcszName);
    755     rc = checkPermission(pProp ? pProp->mFlags : GUEST_PROP_F_NILFLAG, isGuest);
     788    int rc = checkPermission(pProp ? pProp->mFlags : GUEST_PROP_F_NILFLAG, fIsGuest);
    756789    /*
    757790     * Handle names which are read-only for the guest.
     
    759792    if (rc == VINF_SUCCESS && checkHostReserved(pcszName))
    760793    {
    761         if (isGuest)
     794        if (fIsGuest)
    762795            rc = VERR_PERMISSION_DENIED;
    763796        else
     
    772805        {
    773806            pProp->mValue = pcszValue;
    774             pProp->mTimestamp = u64TimeNano;
     807            pProp->mTimestamp = nsTimestamp;
    775808            pProp->mFlags = fFlags;
    776809        }
     
    780813            {
    781814                /* Create a new string space record. */
    782                 pProp = new Property(pcszName, pcszValue, u64TimeNano, fFlags);
     815                pProp = new Property(pcszName, pcszValue, nsTimestamp, fFlags);
    783816                AssertPtr(pProp);
    784817
     
    804837         * Send a notification to the guest and host and return.
    805838         */
    806         // if (isGuest) /* Notify the host even for properties that the host
     839        // if (fIsGuest) /* Notify the host even for properties that the host
    807840        //                * changed.  Less efficient, but ensures consistency. */
    808         int rc2 = doNotifications(pcszName, u64TimeNano);
     841        int rc2 = doNotifications(pcszName, nsTimestamp);
    809842        if (RT_SUCCESS(rc))
    810843            rc = rc2;
     
    15641597}
    15651598
     1599
     1600/**
     1601 * Sets the VBoxVer, VBoxVerExt and VBoxRev properties.
     1602 */
     1603void Service::setHostVersionProps()
     1604{
     1605    uint64_t nsTimestamp = getCurrentTimestamp();
     1606
     1607    /* Set the raw VBox version string as a guest property. Used for host/guest
     1608     * version comparison. */
     1609    setPropertyInternal("/VirtualBox/HostInfo/VBoxVer", VBOX_VERSION_STRING_RAW,
     1610                        GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_RDONLYGUEST, nsTimestamp, false /*fIsGuest*/);
     1611
     1612    /* Set the full VBox version string as a guest property. Can contain vendor-specific
     1613     * information/branding and/or pre-release tags. */
     1614    setPropertyInternal("/VirtualBox/HostInfo/VBoxVerExt", VBOX_VERSION_STRING,
     1615                        GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_RDONLYGUEST, nsTimestamp, false /*fIsGuest*/);
     1616
     1617    /* Set the VBox SVN revision as a guest property */
     1618    setPropertyInternal("/VirtualBox/HostInfo/VBoxRev", RTBldCfgRevisionStr(),
     1619                        GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_RDONLYGUEST, nsTimestamp, false /*fIsGuest*/);
     1620}
     1621
     1622
     1623/**
     1624 * @interface_method_impl{VBOXHGCMSVCFNTABLE,pfnNotify}
     1625 */
     1626/*static*/ DECLCALLBACK(void) Service::svcNotify(void *pvService, HGCMNOTIFYEVENT enmEvent)
     1627{
     1628    SELF *pThis = reinterpret_cast<SELF *>(pvService);
     1629    AssertPtrReturnVoid(pThis);
     1630
     1631    /* Make sure the host version properties have been touched and are
     1632       up-to-date after a restore: */
     1633    if (   !pThis->m_fSetHostVersionProps
     1634        && (enmEvent == HGCMNOTIFYEVENT_RESUME || enmEvent == HGCMNOTIFYEVENT_POWER_ON))
     1635    {
     1636        pThis->setHostVersionProps();
     1637        pThis->m_fSetHostVersionProps = true;
     1638    }
     1639
     1640    /** @todo add suspend/resume property? */
     1641    /** @todo add reset counter? */
     1642}
     1643
     1644
    15661645#ifdef ASYNC_HOST_NOTIFY
    15671646
     
    16021681int Service::initialize()
    16031682{
     1683    /*
     1684     * Insert standard host properties.
     1685     */
     1686    try
     1687    {
     1688        /* The host version will but updated again on power on or resume
     1689           (after restore), however we need the properties now for restored
     1690           guest notification/wait calls. */
     1691        setHostVersionProps();
     1692
     1693        /* Sysprep execution by VBoxService (host is allowed to change these). */
     1694        uint64_t nsTimestamp = getCurrentTimestamp();
     1695        setPropertyInternal("/VirtualBox/HostGuest/SysprepExec", "", GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_RDONLYGUEST,
     1696                            nsTimestamp, false /*fIsGuest*/);
     1697        setPropertyInternal("/VirtualBox/HostGuest/SysprepArgs", "", GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_RDONLYGUEST,
     1698                            nsTimestamp, false /*fIsGuest*/);
     1699    }
     1700    catch (std::bad_alloc &)
     1701    {
     1702        return VERR_NO_MEMORY;
     1703    }
     1704
    16041705#ifdef ASYNC_HOST_NOTIFY
    16051706    /* The host notification thread and queue. */
     
    17281829                ptable->pfnLoadState          = NULL;  /* construction done before restoring suffices */
    17291830                ptable->pfnRegisterExtension  = Service::svcRegisterExtension;
     1831                ptable->pfnNotify             = Service::svcNotify;
    17301832                ptable->pvService             = pService;
    17311833
  • trunk/src/VBox/HostServices/SharedClipboard/service.cpp

    r75853 r75969  
    10351035            ptable->pfnLoadState  = svcLoadState;
    10361036            ptable->pfnRegisterExtension  = svcRegisterExtension;
     1037            ptable->pfnNotify     = NULL;
    10371038            ptable->pvService     = NULL;
    10381039
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r75853 r75969  
    17471747            ptable->pfnSaveState  = svcSaveState;
    17481748            ptable->pfnLoadState  = svcLoadState;
     1749            ptable->pfnNotify     = NULL;
    17491750            ptable->pvService     = NULL;
    17501751        }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r75853 r75969  
    15471547            ptable->pfnSaveState  = svcSaveState;
    15481548            ptable->pfnLoadState  = svcLoadState;
     1549            ptable->pfnNotify     = NULL;
    15491550            ptable->pvService     = NULL;
    15501551
  • trunk/src/VBox/Main/include/HGCM.h

    r75853 r75969  
    4747
    4848int HGCMHostCall(const char *pszServiceName, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM aParms[]);
     49int HGCMBroadcastEvent(HGCMNOTIFYEVENT enmEvent);
    4950
    5051#ifdef VBOX_WITH_CRHGSMI
  • trunk/src/VBox/Main/include/VMMDev.h

    r75955 r75969  
    7878# endif
    7979#endif
    80 
    8180    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    8281    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
    8382    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
    8483    static DECLCALLBACK(void)   drvReset(PPDMDRVINS pDrvIns);
     84    static DECLCALLBACK(void)   drvPowerOn(PPDMDRVINS pDrvIns);
     85    static DECLCALLBACK(void)   drvPowerOff(PPDMDRVINS pDrvIns);
     86    static DECLCALLBACK(void)   drvSuspend(PPDMDRVINS pDrvIns);
     87    static DECLCALLBACK(void)   drvResume(PPDMDRVINS pDrvIns);
    8588
    8689    Console * const         mParent;
  • trunk/src/VBox/Main/src-client/HGCM.cpp

    r75853 r75969  
    176176
    177177        int HostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms);
     178        static void BroadcastNotify(HGCMNOTIFYEVENT enmEvent);
     179        void Notify(HGCMNOTIFYEVENT enmEvent);
    178180
    179181#ifdef VBOX_WITH_CRHGSMI
     
    401403 */
    402404
    403 #define SVC_MSG_LOAD       (0)  /* Load the service library and call VBOX_HGCM_SVCLOAD_NAME entry point. */
    404 #define SVC_MSG_UNLOAD     (1)  /* call pfnUnload and unload the service library. */
    405 #define SVC_MSG_CONNECT    (2)  /* pfnConnect */
    406 #define SVC_MSG_DISCONNECT (3)  /* pfnDisconnect */
    407 #define SVC_MSG_GUESTCALL  (4)  /* pfnGuestCall */
    408 #define SVC_MSG_HOSTCALL   (5)  /* pfnHostCall */
    409 #define SVC_MSG_LOADSTATE  (6)  /* pfnLoadState. */
    410 #define SVC_MSG_SAVESTATE  (7)  /* pfnSaveState. */
    411 #define SVC_MSG_QUIT       (8)  /* Terminate the thread. */
    412 #define SVC_MSG_REGEXT     (9)  /* pfnRegisterExtension */
    413 #define SVC_MSG_UNREGEXT   (10) /* pfnRegisterExtension */
     405#define SVC_MSG_LOAD       (0)  /**< Load the service library and call VBOX_HGCM_SVCLOAD_NAME entry point. */
     406#define SVC_MSG_UNLOAD     (1)  /**< call pfnUnload and unload the service library. */
     407#define SVC_MSG_CONNECT    (2)  /**< pfnConnect */
     408#define SVC_MSG_DISCONNECT (3)  /**< pfnDisconnect */
     409#define SVC_MSG_GUESTCALL  (4)  /**< pfnGuestCall */
     410#define SVC_MSG_HOSTCALL   (5)  /**< pfnHostCall */
     411#define SVC_MSG_LOADSTATE  (6)  /**< pfnLoadState. */
     412#define SVC_MSG_SAVESTATE  (7)  /**< pfnSaveState. */
     413#define SVC_MSG_QUIT       (8)  /**< Terminate the thread. */
     414#define SVC_MSG_REGEXT     (9)  /**< pfnRegisterExtension */
     415#define SVC_MSG_UNREGEXT   (10) /**< pfnRegisterExtension */
     416#define SVC_MSG_NOTIFY     (11) /**< pfnNotify */
    414417#ifdef VBOX_WITH_CRHGSMI
    415418# define SVC_MSG_HOSTFASTCALLASYNC (21) /* pfnHostCall */
     
    522525        /* Handle of the registered extension. */
    523526        HGCMSVCEXTHANDLE handle;
     527};
     528
     529class HGCMMsgNotify: public HGCMMsgCore
     530{
     531    public:
     532        /** The event. */
     533        HGCMNOTIFYEVENT enmEvent;
    524534};
    525535
     
    555565        case SVC_MSG_REGEXT:      return new HGCMMsgSvcRegisterExtension();
    556566        case SVC_MSG_UNREGEXT:    return new HGCMMsgSvcUnregisterExtension();
     567        case SVC_MSG_NOTIFY:      return new HGCMMsgNotify();
    557568        default:
    558569            AssertReleaseMsgFailed(("Msg id = %08X\n", u32MsgId));
     
    812823            } break;
    813824
     825            case SVC_MSG_NOTIFY:
     826            {
     827                HGCMMsgNotify *pMsg = (HGCMMsgNotify *)pMsgCore;
     828
     829                LogFlowFunc(("SVC_MSG_NOTIFY enmEvent = %d\n", pMsg->enmEvent));
     830
     831                pSvc->m_fntable.pfnNotify(pSvc->m_fntable.pvService, pMsg->enmEvent);
     832            } break;
     833
    814834            default:
    815835            {
     
    17941814}
    17951815
     1816/** Posts a broadcast notification event to all interested services.
     1817 *
     1818 * @param   enmEvent    The notification event.
     1819 */
     1820/*static*/ void HGCMService::BroadcastNotify(HGCMNOTIFYEVENT enmEvent)
     1821{
     1822    for (HGCMService *pService = sm_pSvcListHead; pService != NULL; pService = pService->m_pSvcNext)
     1823    {
     1824        pService->Notify(enmEvent);
     1825    }
     1826}
     1827
     1828/** Posts a broadcast notification event to the service.
     1829 *
     1830 * @param   enmEvent    The notification event.
     1831 */
     1832void HGCMService::Notify(HGCMNOTIFYEVENT enmEvent)
     1833{
     1834    LogFlowFunc(("%s enmEvent=%d pfnNotify=%p\n", m_pszSvcName, enmEvent, m_fntable.pfnNotify));
     1835    if (m_fntable.pfnNotify)
     1836    {
     1837        HGCMMsgCore *pCoreMsg;
     1838        int rc = hgcmMsgAlloc(m_pThread, &pCoreMsg, SVC_MSG_NOTIFY, hgcmMessageAllocSvc);
     1839        if (RT_SUCCESS(rc))
     1840        {
     1841            HGCMMsgNotify *pMsg = (HGCMMsgNotify *)pCoreMsg;
     1842            pMsg->enmEvent = enmEvent;
     1843
     1844            rc = hgcmMsgPost(pMsg, NULL);
     1845            AssertRC(rc);
     1846        }
     1847    }
     1848}
     1849
    17961850#ifdef VBOX_WITH_CRHGSMI
    17971851
     
    18561910
    18571911/* Messages processed by the main HGCM thread. */
    1858 #define HGCM_MSG_CONNECT    (10)  /* Connect a client to a service. */
    1859 #define HGCM_MSG_DISCONNECT (11)  /* Disconnect the specified client id. */
    1860 #define HGCM_MSG_LOAD       (12)  /* Load the service. */
    1861 #define HGCM_MSG_HOSTCALL   (13)  /* Call the service. */
    1862 #define HGCM_MSG_LOADSTATE  (14)  /* Load saved state for the specified service. */
    1863 #define HGCM_MSG_SAVESTATE  (15)  /* Save state for the specified service. */
    1864 #define HGCM_MSG_RESET      (16)  /* Disconnect all clients from the specified service. */
    1865 #define HGCM_MSG_QUIT       (17)  /* Unload all services and terminate the thread. */
    1866 #define HGCM_MSG_REGEXT     (18)  /* Register a service extension. */
    1867 #define HGCM_MSG_UNREGEXT   (19)  /* Unregister a service extension. */
     1912#define HGCM_MSG_CONNECT    (10)  /**< Connect a client to a service. */
     1913#define HGCM_MSG_DISCONNECT (11)  /**< Disconnect the specified client id. */
     1914#define HGCM_MSG_LOAD       (12)  /**< Load the service. */
     1915#define HGCM_MSG_HOSTCALL   (13)  /**< Call the service. */
     1916#define HGCM_MSG_LOADSTATE  (14)  /**< Load saved state for the specified service. */
     1917#define HGCM_MSG_SAVESTATE  (15)  /**< Save state for the specified service. */
     1918#define HGCM_MSG_RESET      (16)  /**< Disconnect all clients from the specified service. */
     1919#define HGCM_MSG_QUIT       (17)  /**< Unload all services and terminate the thread. */
     1920#define HGCM_MSG_REGEXT     (18)  /**< Register a service extension. */
     1921#define HGCM_MSG_UNREGEXT   (19)  /**< Unregister a service extension. */
     1922#define HGCM_MSG_BRD_NOTIFY (20)  /**< Broadcast notification event (VM state change). */
    18681923#ifdef VBOX_WITH_CRHGSMI
    1869 # define HGCM_MSG_SVCAQUIRE  (30)  /* Acquire a service handle (for fast host calls) */
    1870 # define HGCM_MSG_SVCRELEASE (31)  /* Release a service */
     1924# define HGCM_MSG_SVCAQUIRE  (30) /**< Acquire a service handle (for fast host calls) */
     1925# define HGCM_MSG_SVCRELEASE (31) /**< Release a service */
    18711926#endif
    18721927
     
    19532008};
    19542009
     2010class HGCMMsgMainBroadcastNotify: public HGCMMsgCore
     2011{
     2012    public:
     2013        /** The notification event. */
     2014        HGCMNOTIFYEVENT enmEvent;
     2015};
     2016
    19552017#ifdef VBOX_WITH_CRHGSMI
    19562018class HGCMMsgMainSvcAcquire: public HGCMMsgCore
     
    19862048        case HGCM_MSG_REGEXT:     return new HGCMMsgMainRegisterExtension();
    19872049        case HGCM_MSG_UNREGEXT:   return new HGCMMsgMainUnregisterExtension();
     2050        case HGCM_MSG_BRD_NOTIFY: return new HGCMMsgMainBroadcastNotify();
    19882051#ifdef VBOX_WITH_CRHGSMI
    19892052        case HGCM_MSG_SVCAQUIRE:  return new HGCMMsgMainSvcAcquire();
     
    21002163                    pService->ReleaseService();
    21012164                }
     2165            } break;
     2166
     2167            case HGCM_MSG_BRD_NOTIFY:
     2168            {
     2169                HGCMMsgMainBroadcastNotify *pMsg = (HGCMMsgMainBroadcastNotify *)pMsgCore;
     2170
     2171                LogFlowFunc(("HGCM_MSG_BRD_NOTIFY enmEvent=%d\n", pMsg->enmEvent));
     2172
     2173                HGCMService::BroadcastNotify(pMsg->enmEvent);
    21022174            } break;
    21032175
     
    21472219
    21482220                HGCMService::Reset();
     2221
     2222                HGCMService::BroadcastNotify(HGCMNOTIFYEVENT_RESET);
    21492223            } break;
    21502224
     
    25512625}
    25522626
    2553 /* The host calls the service.
     2627/** The host calls the service.
    25542628 *
    25552629 * @param pszServiceName The service name to be called.
     
    25572631 * @param cParms         Number of parameters.
    25582632 * @param paParms        Pointer to array of parameters.
     2633 * @param fWait          Whether to wait for the call to complete (default),
     2634 *                       or just post it and return immediately.
    25592635 * @return VBox rc.
    25602636 */
     
    25972673}
    25982674
     2675/** Posts a notification event to all services.
     2676 *
     2677 * @param   enmEvent    The notification event.
     2678 * @return  VBox rc.
     2679 */
     2680int HGCMBroadcastEvent(HGCMNOTIFYEVENT enmEvent)
     2681{
     2682    LogFlowFunc(("enmEvent=%d\n", enmEvent));
     2683
     2684    HGCMMsgCore *pCoreMsg;
     2685    int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, HGCM_MSG_BRD_NOTIFY, hgcmMainMessageAlloc);
     2686
     2687    if (RT_SUCCESS(rc))
     2688    {
     2689        HGCMMsgMainBroadcastNotify *pMsg = (HGCMMsgMainBroadcastNotify *)pCoreMsg;
     2690
     2691        pMsg->enmEvent = enmEvent;
     2692
     2693        rc = hgcmMsgPost(pMsg, NULL);
     2694    }
     2695
     2696    LogFlowFunc(("rc = %Rrc\n", rc));
     2697    return rc;
     2698}
     2699
     2700
    25992701#ifdef VBOX_WITH_CRHGSMI
    26002702int HGCMHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc)
  • trunk/src/VBox/Main/src-client/VMMDevInterface.cpp

    r75955 r75969  
    2929#include <VBox/shflsvc.h>
    3030#include <iprt/asm.h>
    31 #include <iprt/buildconfig.h>
    3231
    3332#ifdef VBOX_WITH_HGCM
     
    3635# if defined(RT_OS_DARWIN) && defined(VBOX_WITH_CROGL)
    3736#  include <VBox/HostServices/VBoxCrOpenGLSvc.h>
    38 # endif
    39 # ifdef VBOX_WITH_GUEST_PROPS
    40 #  include <VBox/version.h>
    4137# endif
    4238#endif
     
    770766
    771767/**
     768 * @interface_method_impl{PDMDRVREG,pfnSuspend}
     769 */
     770/*static*/ DECLCALLBACK(void) VMMDev::drvSuspend(PPDMDRVINS pDrvIns)
     771{
     772    RT_NOREF(pDrvIns);
     773#ifdef VBOX_WITH_HGCM
     774    HGCMBroadcastEvent(HGCMNOTIFYEVENT_SUSPEND);
     775#endif
     776}
     777
     778/**
     779 * @interface_method_impl{PDMDRVREG,pfnResume}
     780 */
     781/*static*/ DECLCALLBACK(void) VMMDev::drvResume(PPDMDRVINS pDrvIns)
     782{
     783    RT_NOREF(pDrvIns);
     784#ifdef VBOX_WITH_HGCM
     785    HGCMBroadcastEvent(HGCMNOTIFYEVENT_RESUME);
     786#endif
     787}
     788
     789/**
     790 * @interface_method_impl{PDMDRVREG,pfnPowerOff}
     791 */
     792/*static*/ DECLCALLBACK(void) VMMDev::drvPowerOff(PPDMDRVINS pDrvIns)
     793{
     794    RT_NOREF(pDrvIns);
     795#ifdef VBOX_WITH_HGCM
     796    HGCMBroadcastEvent(HGCMNOTIFYEVENT_POWER_ON);
     797#endif
     798}
     799
     800/**
     801 * @interface_method_impl{PDMDRVREG,pfnPowerOn}
     802 */
     803/*static*/ DECLCALLBACK(void) VMMDev::drvPowerOn(PPDMDRVINS pDrvIns)
     804{
     805    RT_NOREF(pDrvIns);
     806#ifdef VBOX_WITH_HGCM
     807    HGCMBroadcastEvent(HGCMNOTIFYEVENT_POWER_ON);
     808#endif
     809}
     810
     811/**
    772812 * @interface_method_impl{PDMDRVREG,pfnReset}
    773813 */
     
    778818#ifdef VBOX_WITH_HGCM
    779819    HGCMHostReset();
    780 #endif /* VBOX_WITH_HGCM */
     820#endif
    781821}
    782822
     
    883923    AssertReturn(ptrConsole.isNotNull(), VERR_INVALID_POINTER);
    884924
    885     /* Load the service */
     925    /*
     926     * Load the service
     927     */
    886928    int rc = hgcmLoadService("VBoxGuestPropSvc", "VBoxGuestPropSvc");
    887929    if (RT_FAILURE(rc))
     
    890932        return VINF_SUCCESS; /* That is not a fatal failure. */
    891933    }
    892     /*
    893      * Initialize built-in properties that can be changed and saved.
    894      *
    895      * These are typically transient properties that the guest cannot
    896      * change.
    897      */
    898 
    899     /* Sysprep execution by VBoxService. */
    900     i_guestPropSet("/VirtualBox/HostGuest/SysprepExec", "", "TRANSIENT, RDONLYGUEST");
    901     i_guestPropSet("/VirtualBox/HostGuest/SysprepArgs", "", "TRANSIENT, RDONLYGUEST");
    902934
    903935    /*
     
    964996
    965997    /*
    966      * These properties have to be set before pulling over the properties
    967      * from the machine XML, to ensure that properties saved in the XML
    968      * will override them.
    969      */
    970     /* Set the raw VBox version string as a guest property. Used for host/guest
    971      * version comparison. */
    972     i_guestPropSet("/VirtualBox/HostInfo/VBoxVer", VBOX_VERSION_STRING_RAW, "TRANSIENT, RDONLYGUEST");
    973     /* Set the full VBox version string as a guest property. Can contain vendor-specific
    974      * information/branding and/or pre-release tags. */
    975     i_guestPropSet("/VirtualBox/HostInfo/VBoxVerExt", VBOX_VERSION_STRING, "TRANSIENT, RDONLYGUEST");
    976     /* Set the VBox SVN revision as a guest property */
    977     i_guestPropSet("/VirtualBox/HostInfo/VBoxRev", RTBldCfgRevisionStr(), "TRANSIENT, RDONLYGUEST");
    978 
    979     /*
    980998     * Register the host notification callback
    981999     */
     
    11781196    NULL,
    11791197    /* pfnPowerOn */
    1180     NULL,
     1198    VMMDev::drvPowerOn,
    11811199    /* pfnReset */
    11821200    VMMDev::drvReset,
    11831201    /* pfnSuspend */
    1184     NULL,
     1202    VMMDev::drvSuspend,
    11851203    /* pfnResume */
    1186     NULL,
     1204    VMMDev::drvResume,
    11871205    /* pfnAttach */
    11881206    NULL,
     
    11901208    NULL,
    11911209    /* pfnPowerOff */
    1192     NULL,
     1210    VMMDev::drvPowerOff,
    11931211    /* pfnSoftReset */
    11941212    NULL,
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