VirtualBox

Ignore:
Timestamp:
Oct 17, 2023 8:26:12 AM (16 months ago)
Author:
vboxsync
Message:

Main/ConsoleImpl: Move the VMM device configuration out of the x86 config constructor into a separate method in order to be able to use it from the Armv8 variant later on, bugref:10528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp

    r101458 r101459  
    4848#include "NvramStoreImpl.h"
    4949#include "BusAssignmentManager.h"
     50#ifdef VBOX_WITH_SHARED_CLIPBOARD
     51# include "GuestShClPrivate.h"
     52#endif
    5053#ifdef VBOX_WITH_DRAG_AND_DROP
    5154# include "GuestImpl.h"
     
    38173820}
    38183821
     3822
     3823int Console::i_configVmmDev(ComPtr<IMachine> pMachine, BusAssignmentManager *pBusMgr, PCFGMNODE pDevices)
     3824{
     3825    VMMDev *pVMMDev = m_pVMMDev; Assert(pVMMDev);
     3826
     3827    int vrc = VINF_SUCCESS;
     3828    PCFGMNODE pDev = NULL;          /* /Devices/Dev/ */
     3829    PCFGMNODE pInst = NULL;         /* /Devices/Dev/0/ */
     3830    PCFGMNODE pCfg = NULL;          /* /Devices/Dev/.../Config/ */
     3831    PCFGMNODE pLunL0 = NULL;        /* /Devices/Dev/0/LUN#0/ */
     3832
     3833    /*
     3834     * VMM Device
     3835     */
     3836    InsertConfigNode(pDevices, "VMMDev", &pDev);
     3837    InsertConfigNode(pDev,     "0", &pInst);
     3838    InsertConfigNode(pInst,    "Config", &pCfg);
     3839    InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
     3840    HRESULT hrc = pBusMgr->assignPCIDevice("VMMDev", pInst);                            H();
     3841
     3842    Bstr hwVersion;
     3843    hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam());                 H();
     3844    if (hwVersion.compare(Bstr("1").raw()) == 0) /* <= 2.0.x */
     3845        InsertConfigInteger(pCfg, "HeapEnabled", 0);
     3846    Bstr snapshotFolder;
     3847    hrc = pMachine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam());             H();
     3848    InsertConfigString(pCfg, "GuestCoreDumpDir", snapshotFolder);
     3849
     3850    /* the VMM device's Main driver */
     3851    InsertConfigNode(pInst,    "LUN#0", &pLunL0);
     3852    InsertConfigString(pLunL0, "Driver",               "HGCM");
     3853    InsertConfigNode(pLunL0,   "Config", &pCfg);
     3854
     3855    /*
     3856     * Attach the status driver.
     3857     */
     3858    i_attachStatusDriver(pInst, DeviceType_SharedFolder);
     3859
     3860#ifdef VBOX_WITH_SHARED_CLIPBOARD
     3861    /*
     3862     * Shared Clipboard.
     3863     */
     3864    {
     3865        ClipboardMode_T enmClipboardMode = ClipboardMode_Disabled;
     3866        hrc = pMachine->COMGETTER(ClipboardMode)(&enmClipboardMode); H();
     3867# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     3868        BOOL fFileTransfersEnabled;
     3869        hrc = pMachine->COMGETTER(ClipboardFileTransfersEnabled)(&fFileTransfersEnabled); H();
     3870#endif
     3871
     3872        /* Load the service */
     3873        vrc = pVMMDev->hgcmLoadService("VBoxSharedClipboard", "VBoxSharedClipboard");
     3874        if (RT_SUCCESS(vrc))
     3875        {
     3876            LogRel(("Shared Clipboard: Service loaded\n"));
     3877
     3878            /* Set initial clipboard mode. */
     3879            vrc = i_changeClipboardMode(enmClipboardMode);
     3880            AssertLogRelMsg(RT_SUCCESS(vrc), ("Shared Clipboard: Failed to set initial clipboard mode (%d): vrc=%Rrc\n",
     3881                                             enmClipboardMode, vrc));
     3882
     3883            /* Setup the service. */
     3884            VBOXHGCMSVCPARM parm;
     3885            HGCMSvcSetU32(&parm, !i_useHostClipboard());
     3886            vrc = pVMMDev->hgcmHostCall("VBoxSharedClipboard", VBOX_SHCL_HOST_FN_SET_HEADLESS, 1, &parm);
     3887            AssertLogRelMsg(RT_SUCCESS(vrc), ("Shared Clipboard: Failed to set initial headless mode (%RTbool): vrc=%Rrc\n",
     3888                                             !i_useHostClipboard(), vrc));
     3889
     3890# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     3891            vrc = i_changeClipboardFileTransferMode(RT_BOOL(fFileTransfersEnabled));
     3892            AssertLogRelMsg(RT_SUCCESS(vrc), ("Shared Clipboard: Failed to set initial file transfer mode (%u): vrc=%Rrc\n",
     3893                                             fFileTransfersEnabled, vrc));
     3894# endif
     3895            GuestShCl::createInstance(this /* pConsole */);
     3896            vrc = HGCMHostRegisterServiceExtension(&m_hHgcmSvcExtShCl, "VBoxSharedClipboard",
     3897                                                   &GuestShCl::hgcmDispatcher,
     3898                                                   GuestShClInst());
     3899            if (RT_FAILURE(vrc))
     3900                Log(("Cannot register VBoxSharedClipboard extension, vrc=%Rrc\n", vrc));
     3901        }
     3902        else
     3903            LogRel(("Shared Clipboard: Not available, vrc=%Rrc\n", vrc));
     3904        vrc = VINF_SUCCESS;  /* None of the potential failures above are fatal. */
     3905    }
     3906#endif /* VBOX_WITH_SHARED_CLIPBOARD */
     3907
     3908    /*
     3909     * HGCM HostChannel.
     3910     */
     3911    {
     3912        Bstr value;
     3913        hrc = pMachine->GetExtraData(Bstr("HGCM/HostChannel").raw(),
     3914                                     value.asOutParam());
     3915
     3916        if (   hrc   == S_OK
     3917            && value == "1")
     3918        {
     3919            vrc = pVMMDev->hgcmLoadService("VBoxHostChannel", "VBoxHostChannel");
     3920            if (RT_FAILURE(vrc))
     3921            {
     3922                LogRel(("VBoxHostChannel is not available, vrc=%Rrc\n", vrc));
     3923                /* That is not a fatal failure. */
     3924                vrc = VINF_SUCCESS;
     3925            }
     3926        }
     3927    }
     3928
     3929#ifdef VBOX_WITH_DRAG_AND_DROP
     3930    /*
     3931     * Drag and Drop.
     3932     */
     3933    {
     3934        DnDMode_T enmMode = DnDMode_Disabled;
     3935        hrc = pMachine->COMGETTER(DnDMode)(&enmMode);                                   H();
     3936
     3937        /* Load the service */
     3938        vrc = pVMMDev->hgcmLoadService("VBoxDragAndDropSvc", "VBoxDragAndDropSvc");
     3939        if (RT_FAILURE(vrc))
     3940        {
     3941            LogRel(("Drag and drop service is not available, vrc=%Rrc\n", vrc));
     3942            /* That is not a fatal failure. */
     3943            vrc = VINF_SUCCESS;
     3944        }
     3945        else
     3946        {
     3947            vrc = HGCMHostRegisterServiceExtension(&m_hHgcmSvcExtDragAndDrop, "VBoxDragAndDropSvc",
     3948                                                   &GuestDnD::notifyDnDDispatcher,
     3949                                                   GuestDnDInst());
     3950            if (RT_FAILURE(vrc))
     3951                Log(("Cannot register VBoxDragAndDropSvc extension, vrc=%Rrc\n", vrc));
     3952            else
     3953            {
     3954                LogRel(("Drag and drop service loaded\n"));
     3955                vrc = i_changeDnDMode(enmMode);
     3956            }
     3957        }
     3958    }
     3959#endif /* VBOX_WITH_DRAG_AND_DROP */
     3960
     3961    return vrc;
     3962}
     3963
    38193964#undef H
    38203965#undef VRC
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