ConsoleImpl.h revision 2deb7f514062c84c5bd603a4d17a6ceb1338628f
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync/* $Id$ */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync/** @file
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * VBox Console COM Class definition
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync/*
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Copyright (C) 2006-2008 Sun Microsystems, Inc.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * available from http://www.virtualbox.org. This file is free software;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * General Public License (GPL) as published by the Free Software
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * additional information or have any questions.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#ifndef ____H_CONSOLEIMPL
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#define ____H_CONSOLEIMPL
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include "VirtualBoxBase.h"
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include "ProgressImpl.h"
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include "SchemaDefs.h"
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass Guest;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass Keyboard;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass Mouse;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass Display;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass MachineDebugger;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass OUSBDevice;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass RemoteUSBDevice;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass SharedFolder;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass RemoteDisplayInfo;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass AudioSniffer;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass ConsoleVRDPServer;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass VMMDev;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include <VBox/vrdpapi.h>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include <VBox/pdmdrv.h>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#ifdef VBOX_WITH_GUEST_PROPS
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#endif
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncstruct VUSBIRHCONFIG;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsynctypedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#include <list>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync// defines
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync///////////////////////////////////////////////////////////////////////////////
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync/**
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * Checks the availability of the underlying VM device driver corresponding
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * The translatable error message is defined in null context.
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync *
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * Intended to used only within Console children (i.e. Keyboard, Mouse,
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * Display, etc.).
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync *
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * @param drv driver pointer to check (compare it with NULL)
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync#define CHECK_CONSOLE_DRV(drv) \
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync do { \
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync if (!(drv)) \
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync } while (0)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync// Console
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync///////////////////////////////////////////////////////////////////////////////
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync/** IConsole implementation class */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncclass ATL_NO_VTABLE Console :
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public VirtualBoxBaseWithChildrenNEXT,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public VirtualBoxSupportErrorInfoImpl <Console, IConsole>,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public VirtualBoxSupportTranslation <Console>,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync VBOX_SCRIPTABLE_IMPL(IConsole)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync{
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Q_OBJECT
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncpublic:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_NOT_AGGREGATABLE(Console)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync BEGIN_COM_MAP(Console)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
09e11be404479b989812ad9da85a16f3654ab320vboxsync COM_INTERFACE_ENTRY(IConsole)
09e11be404479b989812ad9da85a16f3654ab320vboxsync COM_INTERFACE_ENTRY(IDispatch)
09e11be404479b989812ad9da85a16f3654ab320vboxsync END_COM_MAP()
09e11be404479b989812ad9da85a16f3654ab320vboxsync
09e11be404479b989812ad9da85a16f3654ab320vboxsync NS_DECL_ISUPPORTS
09e11be404479b989812ad9da85a16f3654ab320vboxsync
09e11be404479b989812ad9da85a16f3654ab320vboxsync Console();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync ~Console();
09e11be404479b989812ad9da85a16f3654ab320vboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT FinalConstruct();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void FinalRelease();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync // public initializers/uninitializers for internal purposes only
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void uninit();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync // IConsole properties
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Guest)) (IGuest **aGuest);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Mouse)) (IMouse **aMouse);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut (IUSBDevice *, aUSBDevices));
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(RemoteUSBDevices)) (ComSafeArrayOut (IHostUSBDevice *, aRemoteUSBDevices));
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut (ISharedFolder *, aSharedFolders));
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync // IConsole methods
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(PowerUp) (IProgress **aProgress);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(PowerUpPaused) (IProgress **aProgress);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(PowerDown)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(PowerDownAsync) (IProgress **aProgress);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(Reset)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(Pause)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(Resume)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(PowerButton)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(SleepButton)();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(SaveState) (IProgress **aProgress);
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(AdoptSavedState) (IN_BSTR aSavedStateFile);
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(DiscardSavedState)();
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
09e11be404479b989812ad9da85a16f3654ab320vboxsync DeviceActivity_T *aDeviceActivity);
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(AttachUSBDevice) (IN_BSTR aId);
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(DetachUSBDevice) (IN_BSTR aId, IUSBDevice **aDevice);
09e11be404479b989812ad9da85a16f3654ab320vboxsync STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IUSBDevice **aDevice);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IUSBDevice **aDevice);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(RemoveSharedFolder) (IN_BSTR aName);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(TakeSnapshot) (IN_BSTR aName, IN_BSTR aDescription,
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync IProgress **aProgress);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(DiscardSnapshot) (IN_BSTR aId, IProgress **aProgress);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync // public methods for internal purposes only
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /*
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Note: the following methods do not increase refcount. intended to be
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * called only by the VM execution thread.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync Guest *getGuest() const { return mGuest; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Keyboard *getKeyboard() const { return mKeyboard; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Mouse *getMouse() const { return mMouse; }
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync Display *getDisplay() const { return mDisplay; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync MachineDebugger *getMachineDebugger() const { return mDebugger; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const ComPtr <IMachine> &machine() const { return mMachine; }
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Method is called only from ConsoleVRDPServer */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync IVRDPServer *getVRDPServer() const { return mVRDPServer; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT updateMachineState (MachineState_T aMachineState);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync // events from IInternalSessionControl
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onDVDDriveChange();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onFloppyDriveChange();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onSerialPortChange (ISerialPort *aSerialPort);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onParallelPortChange (IParallelPort *aParallelPort);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onStorageControllerChange ();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onVRDPServerChange();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onUSBControllerChange();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onSharedFolderChange (BOOL aGlobal);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onUSBDeviceDetach (IN_BSTR aId, IVirtualBoxErrorInfo *aError);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT getGuestProperty (IN_BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT setGuestProperty (IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT enumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync VMMDev *getVMMDev() { return mVMMDev; }
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync
0aa150e34ed49f14aaa37368c2e6999ec89e5f43vboxsync int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
09e11be404479b989812ad9da85a16f3654ab320vboxsync void VRDPClientConnect (uint32_t u32ClientId);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
09e11be404479b989812ad9da85a16f3654ab320vboxsync void VRDPInterceptAudio (uint32_t u32ClientId);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void VRDPInterceptClipboard (uint32_t u32ClientId);
09e11be404479b989812ad9da85a16f3654ab320vboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync // callback callers (partly; for some events console callbacks are notified
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync // directly from IInternalSessionControl event handlers declared above)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void onMousePointerShapeChange(bool fVisible, bool fAlpha,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync uint32_t xHot, uint32_t yHot,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync uint32_t width, uint32_t height,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void *pShape);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync void onStateChange (MachineState_T aMachineState);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync void onAdditionsStateChange();
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync void onAdditionsOutdated();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync IVirtualBoxErrorInfo *aError);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static const PDMDRVREG DrvStatusReg;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void reportAuthLibraryError (const char *filename, int rc)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync // for VirtualBoxSupportErrorInfoImpl
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync static const wchar_t *getComponentName() { return L"Console"; }
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsyncprivate:
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Base template for AutoVMCaller and SaveVMPtr. Template arguments
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * have the same meaning as arguments of Console::addVMCaller().
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync template <bool taQuiet = false, bool taAllowNullVM = false>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync class AutoVMCallerBase
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Assert (aThat);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync ~AutoVMCallerBase()
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync if (SUCCEEDED (mRC))
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync mThat->releaseVMCaller();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Decreases the number of callers before the instance is destroyed. */
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync void release()
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync AssertReturnVoid (SUCCEEDED (mRC));
c307f0d7384bfc4d19d2290a28be89868f02f42avboxsync mThat->releaseVMCaller();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync mRC = E_FAIL;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Restores the number of callers after by #release(). #rc() must be
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * rechecked to ensure the operation succeeded. */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void add()
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync AssertReturnVoid (!SUCCEEDED (mRC));
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Returns the result of Console::addVMCaller() */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT rc() const { return mRC; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Shortcut to SUCCEEDED (rc()) */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync bool isOk() const { return SUCCEEDED (mRC); }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync protected:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Console *mThat;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT mRC;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync private:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoVMCallerBase)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_CLS_NEW_DELETE_NOOP (AutoVMCallerBase)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync };
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Helper class that protects sections of code using the mpVM pointer by
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * automatically calling addVMCaller() on construction and
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * releaseVMCaller() on destruction. Intended for Console methods dealing
09e11be404479b989812ad9da85a16f3654ab320vboxsync * with mpVM. The usage pattern is:
09e11be404479b989812ad9da85a16f3654ab320vboxsync * <code>
09e11be404479b989812ad9da85a16f3654ab320vboxsync * AutoVMCaller autoVMCaller (this);
09e11be404479b989812ad9da85a16f3654ab320vboxsync * CheckComRCReturnRC (autoVMCaller.rc());
09e11be404479b989812ad9da85a16f3654ab320vboxsync * ...
09e11be404479b989812ad9da85a16f3654ab320vboxsync * VMR3ReqCall (mpVM, ...
09e11be404479b989812ad9da85a16f3654ab320vboxsync * </code>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * @note Temporarily locks the argument for writing.
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * @sa SafeVMPtr, SafeVMPtrQuiet
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef AutoVMCallerBase <false, false> AutoVMCaller;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Same as AutoVMCaller but doesn't set extended error info on failure.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync * @note Temporarily locks the argument for writing.
09e11be404479b989812ad9da85a16f3654ab320vboxsync */
09e11be404479b989812ad9da85a16f3654ab320vboxsync typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
09e11be404479b989812ad9da85a16f3654ab320vboxsync
09e11be404479b989812ad9da85a16f3654ab320vboxsync /**
09e11be404479b989812ad9da85a16f3654ab320vboxsync * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
09e11be404479b989812ad9da85a16f3654ab320vboxsync * instead of assertion).
09e11be404479b989812ad9da85a16f3654ab320vboxsync *
09e11be404479b989812ad9da85a16f3654ab320vboxsync * @note Temporarily locks the argument for writing.
09e11be404479b989812ad9da85a16f3654ab320vboxsync */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Same as AutoVMCaller but doesn't set extended error info on failure
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * and allows a null VM pointer (to trigger an error instead of
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * assertion).
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * @note Temporarily locks the argument for writing.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Base template for SaveVMPtr and SaveVMPtrQuiet.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync template <bool taQuiet = false>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef AutoVMCallerBase <taQuiet, true> Base;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync if (SUCCEEDED (Base::mRC))
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync mpVM = aThat->mpVM;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Smart SaveVMPtr to PVM cast operator */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync operator PVM() const { return mpVM; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** Direct PVM access for printf()-like functions */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync PVM raw() const { return mpVM; }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync private:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync PVM mpVM;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (SafeVMPtrBase)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync DECLARE_CLS_NEW_DELETE_NOOP (SafeVMPtrBase)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync };
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncpublic:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /**
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Helper class that safely manages the Console::mpVM pointer
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * by calling addVMCaller() on construction and releaseVMCaller() on
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * destruction. Intended for Console children. The usage pattern is:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * <code>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * Console::SaveVMPtr pVM (mParent);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * CheckComRCReturnRC (pVM.rc());
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * ...
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * VMR3ReqCall (pVM, ...
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * ...
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * printf ("%p\n", pVM.raw());
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * </code>
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * @note Temporarily locks the argument for writing.
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync *
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync * @sa SafeVMPtrQuiet, AutoVMCaller
d273db24f1a69abac22a9c2f9c8251e16b66c47fvboxsync */
5a7561300d631625bc381bcc85dd2087f34d0bf9vboxsync typedef SafeVMPtrBase <false> SafeVMPtr;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /**
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * A deviation of SaveVMPtr that doesn't set the error info on failure.
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * Intended for pieces of code that don't need to return the VM access
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * failure to the caller. The usage pattern is:
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * <code>
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * Console::SaveVMPtrQuiet pVM (mParent);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * if (pVM.rc())
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * VMR3ReqCall (pVM, ...
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * return S_OK;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * </code>
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync *
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * @note Temporarily locks the argument for writing.
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync *
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync * @sa SafeVMPtr, AutoVMCaller
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync class SharedFolderData
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync public:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync SharedFolderData() {}
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync SharedFolderData(Bstr aHostPath, BOOL aWritable)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync : mHostPath (aHostPath)
09e11be404479b989812ad9da85a16f3654ab320vboxsync , mWritable (aWritable) {}
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync SharedFolderData(const SharedFolderData& aThat)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync : mHostPath (aThat.mHostPath)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync , mWritable (aThat.mWritable) {}
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Bstr mHostPath;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync BOOL mWritable;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync };
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsyncprivate:
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void releaseVMCaller();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT consoleInitReleaseLog (const ComPtr <IMachine> aMachine);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT powerUp (IProgress **aProgress, bool aPaused);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT powerDown (Progress *aProgress = NULL);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync Bstr &tapSetupApplication);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT powerDownHostInterfaces();
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT setMachineStateLocally (MachineState_T aMachineState)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync {
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync return setMachineState (aMachineState, false /* aUpdateServer */);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync }
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT findSharedFolder (CBSTR aName,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync ComObjPtr <SharedFolder> &aSharedFolder,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync bool aSetError = false);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT fetchSharedFolders (BOOL aGlobal);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync bool findOtherSharedFolder (IN_BSTR aName,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync SharedFolderDataMap::const_iterator &aIt);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT createSharedFolder (CBSTR aName, SharedFolderData aData);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT removeSharedFolder (CBSTR aName);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int) configNetwork(Console *pThis, const char *pszDevice,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync unsigned uInstance, unsigned uLun,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync INetworkAdapter *aNetworkAdapter,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync PCFGMNODE pCfg, PCFGMNODE pLunL0,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync PCFGMNODE pInst, bool attachDetach);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync VMSTATE aOldState, void *aUser);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
09e11be404479b989812ad9da85a16f3654ab320vboxsync unsigned uLun, DriveState_T eState,
09e11be404479b989812ad9da85a16f3654ab320vboxsync DriveState_T *peState, const char *pszPath,
09e11be404479b989812ad9da85a16f3654ab320vboxsync bool fPassthrough);
09e11be404479b989812ad9da85a16f3654ab320vboxsync static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
09e11be404479b989812ad9da85a16f3654ab320vboxsync unsigned uInstance, unsigned uLun,
09e11be404479b989812ad9da85a16f3654ab320vboxsync DriveState_T eState, DriveState_T *peState,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const char *pszPath, bool fPassthrough);
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync#ifdef VBOX_DYNAMIC_NET_ATTACH
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT doNetworkAdapterChange (const char *pszDevice, unsigned uInstance,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync unsigned uLun, INetworkAdapter *aNetworkAdapter);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int) changeNetworkAttachment (Console *pThis, const char *pszDevice,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync unsigned uInstance, unsigned uLun,
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync INetworkAdapter *aNetworkAdapter);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#endif /* VBOX_DYNAMIC_NET_ATTACH */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#ifdef VBOX_WITH_USB
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync bool aRemote, const char *aAddress, ULONG aMaskedIfs);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync#endif
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK (int)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync stateProgressCallback (PVM pVM, unsigned uPercent, void *pvUser);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
64babf0f32eaf36212d54af4a3ce5fe193b24825vboxsync static DECLCALLBACK(void)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync setVMErrorCallback (PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const char *pszFormat, va_list args);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(void)
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync setVMRuntimeErrorCallback (PVM pVM, void *pvUser, uint32_t fFatal,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const char *pszErrorId,
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const char *pszFormat, va_list va);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync HRESULT captureUSBDevices (PVM pVM);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync void detachAllUSBDevices (bool aDone);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK (int) powerUpThread (RTTHREAD Thread, void *pvUser);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK (int) saveStateThread (RTTHREAD Thread, void *pvUser);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK (int) powerDownThread (RTTHREAD Thread, void *pvUser);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync int mcAudioRefs;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync volatile uint32_t mcVRDPClients;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static const char *sSSMConsoleUnit;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync static uint32_t sSSMConsoleVer;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync HRESULT loadDataFromSavedState();
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync#ifdef VBOX_WITH_GUEST_PROPS
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync static DECLCALLBACK(int) doGuestPropNotification (void *pvExtension, uint32_t,
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync void *pvParms, uint32_t cbParms);
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync HRESULT doEnumerateGuestProperties (CBSTR aPatterns,
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync ComSafeArrayOut(BSTR, aNames),
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync ComSafeArrayOut(BSTR, aValues),
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync ComSafeArrayOut(ULONG64, aTimestamps),
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync ComSafeArrayOut(BSTR, aFlags));
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync#endif
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync bool mSavedStateDataLoaded : 1;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComPtr <IMachine> mMachine;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComPtr <IInternalMachineControl> mControl;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComPtr <IVRDPServer> mVRDPServer;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComPtr <IDVDDrive> mDVDDrive;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComPtr <IFloppyDrive> mFloppyDrive;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync ConsoleVRDPServer * const mConsoleVRDPServer;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComObjPtr <Guest> mGuest;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComObjPtr <Keyboard> mKeyboard;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync const ComObjPtr <Mouse> mMouse;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComObjPtr <Display> mDisplay;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComObjPtr <MachineDebugger> mDebugger;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync const ComObjPtr <RemoteDisplayInfo> mRemoteDisplayInfo;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync USBDeviceList mUSBDevices;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync RemoteUSBDeviceList mRemoteUSBDevices;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync SharedFolderMap mSharedFolders;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync SharedFolderDataMap mMachineSharedFolders;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync SharedFolderDataMap mGlobalSharedFolders;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /** The VM instance handle. */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync PVM mpVM;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /** Holds the number of "readonly" mpVM callers (users) */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync uint32_t mVMCallers;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /** Semaphore posted when the number of mpVM callers drops to zero */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync RTSEMEVENT mVMZeroCallersSem;
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync /** true when Console has entered the mpVM destruction phase */
db2893e30b129fbadd201b8f56cd7bc1974b395dvboxsync bool mVMDestroying : 1;
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync /** true when power down is initiated by vmstateChangeCallback (EMT) */
66b15150e35f27f9499bb0a8399e452d6a04895dvboxsync bool mVMPoweredOff : 1;
/** The current DVD drive state in the VM.
* This does not have to match the state maintained in the DVD. */
DriveState_T meDVDState;
/** The current Floppy drive state in the VM.
* This does not have to match the state maintained in the Floppy. */
DriveState_T meFloppyState;
/** The current network attachment type in the VM.
* This does not have to match the state maintained in the NetworkAdapter. */
static NetworkAttachmentType_T meAttachmentType[SchemaDefs::NetworkAdapterCount];
VMMDev * const mVMMDev;
AudioSniffer * const mAudioSniffer;
PPDMLED mapFDLeds[2];
PPDMLED mapIDELeds[4];
PPDMLED mapSATALeds[30];
PPDMLED mapSCSILeds[16];
PPDMLED mapNetworkLeds[SchemaDefs::NetworkAdapterCount];
PPDMLED mapSharedFolderLed;
PPDMLED mapUSBLed[2];
#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
Utf8Str maTAPDeviceName[8];
RTFILE maTapFD[8];
#endif
bool mVMStateChangeCallbackDisabled;
/* Local machine state value */
MachineState_T mMachineState;
typedef std::list <ComPtr <IConsoleCallback> > CallbackList;
CallbackList mCallbacks;
struct
{
/** OnMousePointerShapeChange() cache */
struct
{
bool valid;
bool visible;
bool alpha;
uint32_t xHot;
uint32_t yHot;
uint32_t width;
uint32_t height;
BYTE *shape;
size_t shapeSize;
}
mpsc;
/** OnMouseCapabilityChange() cache */
struct
{
bool valid;
BOOL supportsAbsolute;
BOOL needsHostCursor;
}
mcc;
/** OnKeyboardLedsChange() cache */
struct
{
bool valid;
bool numLock;
bool capsLock;
bool scrollLock;
}
klc;
}
mCallbackData;
friend struct VMTask;
};
#endif // ____H_CONSOLEIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */