ConsoleImpl.h revision e002a6fbaa6b849653af1b51baa7b3713cfc9725
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * VBox Console COM Class definition
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Copyright (C) 2006-2008 Sun Microsystems, Inc.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This file is part of VirtualBox Open Source Edition (OSE), as
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * available from http://www.virtualbox.org. This file is free software;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * you can redistribute it and/or modify it under the terms of the GNU
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * General Public License (GPL) as published by the Free Software
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Foundation, in version 2 as it comes in the "COPYING" file of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Clara, CA 95054 USA or visit http://www.sun.com if you need
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * additional information or have any questions.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi///////////////////////////////////////////////////////////////////////////////
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Checks the availability of the underlying VM device driver corresponding
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The translatable error message is defined in null context.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Intended to used only within Console children (i.e. Keyboard, Mouse,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Display, etc.).
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * @param drv driver pointer to check (compare it with NULL)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi } while (0)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi///////////////////////////////////////////////////////////////////////////////
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/** IConsole implementation class */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi public VirtualBoxSupportErrorInfoImpl <Console, IConsole>,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi // public initializers/uninitializers for internal purposes only
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi // IConsole properties
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi STDMETHOD(COMGETTER(USBDevices)) (IUSBDeviceCollection **aUSBDevices);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi STDMETHOD(COMGETTER(RemoteUSBDevices)) (IHostUSBDeviceCollection **aRemoteUSBDevices);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut (ISharedFolder *, aSharedFolders));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi // IConsole methods
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi STDMETHOD(DetachUSBDevice) (IN_GUID aId, IUSBDevice **aDevice);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi STDMETHOD(TakeSnapshot) (IN_BSTR aName, IN_BSTR aDescription,
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston STDMETHOD(DiscardSnapshot) (IN_GUID aId, IProgress **aProgress);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston // public methods for internal purposes only
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj * Note: the following methods do not increase refcount. intended to be
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * called only by the VM execution thread.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi MachineDebugger *getMachineDebugger() const { return mDebugger; }
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston const ComPtr <IMachine> &machine() const { return mMachine; }
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi /** Method is called only from ConsoleVRDPServer */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IVRDPServer *getVRDPServer() const { return mVRDPServer; }
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT updateMachineState (MachineState_T aMachineState);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi // events from IInternalSessionControl
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT onSerialPortChange (ISerialPort *aSerialPort);
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj HRESULT onParallelPortChange (IParallelPort *aParallelPort);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT onUSBDeviceDetach (IN_GUID aId, IVirtualBoxErrorInfo *aError);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT getGuestProperty (IN_BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT setGuestProperty (IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi HRESULT enumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi // callback callers (partly; for some events console callbacks are notified
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi // directly from IInternalSessionControl event handlers declared above)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi void onMousePointerShapeChange(bool fVisible, bool fAlpha,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void reportAuthLibraryError (const char *filename, int rc)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi // for VirtualBoxSupportErrorInfoImpl
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi static const wchar_t *getComponentName() { return L"Console"; }
void release()
void add()
SharedFolderData() {}
void releaseVMCaller();
bool aSetError = false);
bool fPassthrough);
#ifdef VBOX_WITH_USB
static DECLCALLBACK(int)
static DECLCALLBACK(int)
static DECLCALLBACK (int)
static DECLCALLBACK(void)
static DECLCALLBACK(void)
const char *pszErrorID,
static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
int mcAudioRefs;
static const char *sSSMConsoleUnit;
#ifdef VBOX_WITH_GUEST_PROPS
bool valid;
bool visible;
bool alpha;
mpsc;
bool valid;
mcc;
bool valid;
bool numLock;
bool capsLock;
bool scrollLock;
klc;