VirtualBox

source: vbox/trunk/src/VBox/Main/include/ConsoleImpl.h@ 19614

Last change on this file since 19614 was 19239, checked in by vboxsync, 16 years ago

Main: support for using VBox from Python on Windows (still certain limitation apply, such as enum visibility)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.1 KB
Line 
1/* $Id: ConsoleImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */
2
3/** @file
4 *
5 * VBox Console COM Class definition
6 */
7
8/*
9 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_CONSOLEIMPL
25#define ____H_CONSOLEIMPL
26
27#include "VirtualBoxBase.h"
28#include "ProgressImpl.h"
29
30class Guest;
31class Keyboard;
32class Mouse;
33class Display;
34class MachineDebugger;
35class OUSBDevice;
36class RemoteUSBDevice;
37class SharedFolder;
38class RemoteDisplayInfo;
39class AudioSniffer;
40class ConsoleVRDPServer;
41class VMMDev;
42
43#include <VBox/vrdpapi.h>
44#include <VBox/pdmdrv.h>
45#ifdef VBOX_WITH_GUEST_PROPS
46# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
47#endif
48
49struct VUSBIRHCONFIG;
50typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
51
52#include <list>
53
54// defines
55///////////////////////////////////////////////////////////////////////////////
56
57/**
58 * Checks the availability of the underlying VM device driver corresponding
59 * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
60 * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
61 * The translatable error message is defined in null context.
62 *
63 * Intended to used only within Console children (i.e. Keyboard, Mouse,
64 * Display, etc.).
65 *
66 * @param drv driver pointer to check (compare it with NULL)
67 */
68#define CHECK_CONSOLE_DRV(drv) \
69 do { \
70 if (!(drv)) \
71 return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
72 } while (0)
73
74// Console
75///////////////////////////////////////////////////////////////////////////////
76
77/** IConsole implementation class */
78class ATL_NO_VTABLE Console :
79 public VirtualBoxBaseWithChildrenNEXT,
80 public VirtualBoxSupportErrorInfoImpl <Console, IConsole>,
81 public VirtualBoxSupportTranslation <Console>,
82 VBOX_SCRIPTABLE_IMPL(IConsole)
83{
84 Q_OBJECT
85
86public:
87
88 DECLARE_NOT_AGGREGATABLE(Console)
89
90 DECLARE_PROTECT_FINAL_CONSTRUCT()
91
92 BEGIN_COM_MAP(Console)
93 COM_INTERFACE_ENTRY(ISupportErrorInfo)
94 COM_INTERFACE_ENTRY(IConsole)
95 COM_INTERFACE_ENTRY(IDispatch)
96 END_COM_MAP()
97
98 NS_DECL_ISUPPORTS
99
100 Console();
101 ~Console();
102
103 HRESULT FinalConstruct();
104 void FinalRelease();
105
106 // public initializers/uninitializers for internal purposes only
107 HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
108 void uninit();
109
110 // IConsole properties
111 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
112 STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
113 STDMETHOD(COMGETTER(Guest)) (IGuest **aGuest);
114 STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
115 STDMETHOD(COMGETTER(Mouse)) (IMouse **aMouse);
116 STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
117 STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
118 STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut (IUSBDevice *, aUSBDevices));
119 STDMETHOD(COMGETTER(RemoteUSBDevices)) (ComSafeArrayOut (IHostUSBDevice *, aRemoteUSBDevices));
120 STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
121 STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut (ISharedFolder *, aSharedFolders));
122
123 // IConsole methods
124 STDMETHOD(PowerUp) (IProgress **aProgress);
125 STDMETHOD(PowerUpPaused) (IProgress **aProgress);
126 STDMETHOD(PowerDown)();
127 STDMETHOD(PowerDownAsync) (IProgress **aProgress);
128 STDMETHOD(Reset)();
129 STDMETHOD(Pause)();
130 STDMETHOD(Resume)();
131 STDMETHOD(PowerButton)();
132 STDMETHOD(SleepButton)();
133 STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
134 STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
135 STDMETHOD(SaveState) (IProgress **aProgress);
136 STDMETHOD(AdoptSavedState) (IN_BSTR aSavedStateFile);
137 STDMETHOD(DiscardSavedState)();
138 STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
139 DeviceActivity_T *aDeviceActivity);
140 STDMETHOD(AttachUSBDevice) (IN_BSTR aId);
141 STDMETHOD(DetachUSBDevice) (IN_BSTR aId, IUSBDevice **aDevice);
142 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IUSBDevice **aDevice);
143 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IUSBDevice **aDevice);
144 STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
145 STDMETHOD(RemoveSharedFolder) (IN_BSTR aName);
146 STDMETHOD(TakeSnapshot) (IN_BSTR aName, IN_BSTR aDescription,
147 IProgress **aProgress);
148 STDMETHOD(DiscardSnapshot) (IN_BSTR aId, IProgress **aProgress);
149 STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
150 STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
151 STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
152 STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
153
154 // public methods for internal purposes only
155
156 /*
157 * Note: the following methods do not increase refcount. intended to be
158 * called only by the VM execution thread.
159 */
160
161 Guest *getGuest() const { return mGuest; }
162 Keyboard *getKeyboard() const { return mKeyboard; }
163 Mouse *getMouse() const { return mMouse; }
164 Display *getDisplay() const { return mDisplay; }
165 MachineDebugger *getMachineDebugger() const { return mDebugger; }
166
167 const ComPtr <IMachine> &machine() const { return mMachine; }
168
169 /** Method is called only from ConsoleVRDPServer */
170 IVRDPServer *getVRDPServer() const { return mVRDPServer; }
171
172 ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
173
174 HRESULT updateMachineState (MachineState_T aMachineState);
175
176 // events from IInternalSessionControl
177 HRESULT onDVDDriveChange();
178 HRESULT onFloppyDriveChange();
179 HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
180 HRESULT onSerialPortChange (ISerialPort *aSerialPort);
181 HRESULT onParallelPortChange (IParallelPort *aParallelPort);
182 HRESULT onStorageControllerChange ();
183 HRESULT onVRDPServerChange();
184 HRESULT onUSBControllerChange();
185 HRESULT onSharedFolderChange (BOOL aGlobal);
186 HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
187 HRESULT onUSBDeviceDetach (IN_BSTR aId, IVirtualBoxErrorInfo *aError);
188 HRESULT getGuestProperty (IN_BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
189 HRESULT setGuestProperty (IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
190 HRESULT enumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
191 VMMDev *getVMMDev() { return mVMMDev; }
192 AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
193
194 int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
195 void VRDPClientConnect (uint32_t u32ClientId);
196 void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
197 void VRDPInterceptAudio (uint32_t u32ClientId);
198 void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
199 void VRDPInterceptClipboard (uint32_t u32ClientId);
200
201 void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
202
203 // callback callers (partly; for some events console callbacks are notified
204 // directly from IInternalSessionControl event handlers declared above)
205 void onMousePointerShapeChange(bool fVisible, bool fAlpha,
206 uint32_t xHot, uint32_t yHot,
207 uint32_t width, uint32_t height,
208 void *pShape);
209 void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
210 void onStateChange (MachineState_T aMachineState);
211 void onAdditionsStateChange();
212 void onAdditionsOutdated();
213 void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
214 void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
215 IVirtualBoxErrorInfo *aError);
216 void onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
217 HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
218
219 static const PDMDRVREG DrvStatusReg;
220
221 void reportAuthLibraryError (const char *filename, int rc)
222 {
223 setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
224 }
225
226 // for VirtualBoxSupportErrorInfoImpl
227 static const wchar_t *getComponentName() { return L"Console"; }
228
229private:
230
231 /**
232 * Base template for AutoVMCaller and SaveVMPtr. Template arguments
233 * have the same meaning as arguments of Console::addVMCaller().
234 */
235 template <bool taQuiet = false, bool taAllowNullVM = false>
236 class AutoVMCallerBase
237 {
238 public:
239 AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
240 {
241 Assert (aThat);
242 mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
243 }
244 ~AutoVMCallerBase()
245 {
246 if (SUCCEEDED (mRC))
247 mThat->releaseVMCaller();
248 }
249 /** Decreases the number of callers before the instance is destroyed. */
250 void release()
251 {
252 AssertReturnVoid (SUCCEEDED (mRC));
253 mThat->releaseVMCaller();
254 mRC = E_FAIL;
255 }
256 /** Restores the number of callers after by #release(). #rc() must be
257 * rechecked to ensure the operation succeeded. */
258 void add()
259 {
260 AssertReturnVoid (!SUCCEEDED (mRC));
261 mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
262 }
263 /** Returns the result of Console::addVMCaller() */
264 HRESULT rc() const { return mRC; }
265 /** Shortcut to SUCCEEDED (rc()) */
266 bool isOk() const { return SUCCEEDED (mRC); }
267 protected:
268 Console *mThat;
269 HRESULT mRC;
270 private:
271 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoVMCallerBase)
272 DECLARE_CLS_NEW_DELETE_NOOP (AutoVMCallerBase)
273 };
274
275 /**
276 * Helper class that protects sections of code using the mpVM pointer by
277 * automatically calling addVMCaller() on construction and
278 * releaseVMCaller() on destruction. Intended for Console methods dealing
279 * with mpVM. The usage pattern is:
280 * <code>
281 * AutoVMCaller autoVMCaller (this);
282 * CheckComRCReturnRC (autoVMCaller.rc());
283 * ...
284 * VMR3ReqCall (mpVM, ...
285 * </code>
286 *
287 * @note Temporarily locks the argument for writing.
288 *
289 * @sa SafeVMPtr, SafeVMPtrQuiet
290 */
291 typedef AutoVMCallerBase <false, false> AutoVMCaller;
292
293 /**
294 * Same as AutoVMCaller but doesn't set extended error info on failure.
295 *
296 * @note Temporarily locks the argument for writing.
297 */
298 typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
299
300 /**
301 * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
302 * instead of assertion).
303 *
304 * @note Temporarily locks the argument for writing.
305 */
306 typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
307
308 /**
309 * Same as AutoVMCaller but doesn't set extended error info on failure
310 * and allows a null VM pointer (to trigger an error instead of
311 * assertion).
312 *
313 * @note Temporarily locks the argument for writing.
314 */
315 typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
316
317 /**
318 * Base template for SaveVMPtr and SaveVMPtrQuiet.
319 */
320 template <bool taQuiet = false>
321 class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
322 {
323 typedef AutoVMCallerBase <taQuiet, true> Base;
324 public:
325 SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
326 {
327 if (SUCCEEDED (Base::mRC))
328 mpVM = aThat->mpVM;
329 }
330 /** Smart SaveVMPtr to PVM cast operator */
331 operator PVM() const { return mpVM; }
332 /** Direct PVM access for printf()-like functions */
333 PVM raw() const { return mpVM; }
334 private:
335 PVM mpVM;
336 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (SafeVMPtrBase)
337 DECLARE_CLS_NEW_DELETE_NOOP (SafeVMPtrBase)
338 };
339
340public:
341
342 /**
343 * Helper class that safely manages the Console::mpVM pointer
344 * by calling addVMCaller() on construction and releaseVMCaller() on
345 * destruction. Intended for Console children. The usage pattern is:
346 * <code>
347 * Console::SaveVMPtr pVM (mParent);
348 * CheckComRCReturnRC (pVM.rc());
349 * ...
350 * VMR3ReqCall (pVM, ...
351 * ...
352 * printf ("%p\n", pVM.raw());
353 * </code>
354 *
355 * @note Temporarily locks the argument for writing.
356 *
357 * @sa SafeVMPtrQuiet, AutoVMCaller
358 */
359 typedef SafeVMPtrBase <false> SafeVMPtr;
360
361 /**
362 * A deviation of SaveVMPtr that doesn't set the error info on failure.
363 * Intended for pieces of code that don't need to return the VM access
364 * failure to the caller. The usage pattern is:
365 * <code>
366 * Console::SaveVMPtrQuiet pVM (mParent);
367 * if (pVM.rc())
368 * VMR3ReqCall (pVM, ...
369 * return S_OK;
370 * </code>
371 *
372 * @note Temporarily locks the argument for writing.
373 *
374 * @sa SafeVMPtr, AutoVMCaller
375 */
376 typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
377
378 class SharedFolderData
379 {
380 public:
381 SharedFolderData() {}
382 SharedFolderData(Bstr aHostPath, BOOL aWritable)
383 : mHostPath (aHostPath)
384 , mWritable (aWritable) {}
385 SharedFolderData(const SharedFolderData& aThat)
386 : mHostPath (aThat.mHostPath)
387 , mWritable (aThat.mWritable) {}
388 Bstr mHostPath;
389 BOOL mWritable;
390 };
391 typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
392 typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap;
393
394private:
395
396 typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
397 typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
398
399 HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false);
400 void releaseVMCaller();
401
402 HRESULT consoleInitReleaseLog (const ComPtr <IMachine> aMachine);
403
404 HRESULT powerUp (IProgress **aProgress, bool aPaused);
405 HRESULT powerDown (Progress *aProgress = NULL);
406
407 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
408 Bstr &tapSetupApplication);
409 HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter);
410 HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter);
411 HRESULT powerDownHostInterfaces();
412
413 HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
414 HRESULT setMachineStateLocally (MachineState_T aMachineState)
415 {
416 return setMachineState (aMachineState, false /* aUpdateServer */);
417 }
418
419 HRESULT findSharedFolder (CBSTR aName,
420 ComObjPtr <SharedFolder> &aSharedFolder,
421 bool aSetError = false);
422
423 HRESULT fetchSharedFolders (BOOL aGlobal);
424 bool findOtherSharedFolder (IN_BSTR aName,
425 SharedFolderDataMap::const_iterator &aIt);
426
427 HRESULT createSharedFolder (CBSTR aName, SharedFolderData aData);
428 HRESULT removeSharedFolder (CBSTR aName);
429
430 static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
431 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
432 VMSTATE aOldState, void *aUser);
433 HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
434 unsigned uLun, DriveState_T eState,
435 DriveState_T *peState, const char *pszPath,
436 bool fPassthrough);
437 static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
438 unsigned uInstance, unsigned uLun,
439 DriveState_T eState, DriveState_T *peState,
440 const char *pszPath, bool fPassthrough);
441
442#ifdef VBOX_WITH_USB
443 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
444 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
445
446 static DECLCALLBACK(int)
447 usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
448 bool aRemote, const char *aAddress, ULONG aMaskedIfs);
449 static DECLCALLBACK(int)
450 usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
451#endif
452
453 static DECLCALLBACK (int)
454 stateProgressCallback (PVM pVM, unsigned uPercent, void *pvUser);
455
456 static DECLCALLBACK(void)
457 setVMErrorCallback (PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
458 const char *pszFormat, va_list args);
459
460 static DECLCALLBACK(void)
461 setVMRuntimeErrorCallback (PVM pVM, void *pvUser, uint32_t fFatal,
462 const char *pszErrorId,
463 const char *pszFormat, va_list va);
464
465 HRESULT captureUSBDevices (PVM pVM);
466 void detachAllUSBDevices (bool aDone);
467
468 static DECLCALLBACK (int) powerUpThread (RTTHREAD Thread, void *pvUser);
469 static DECLCALLBACK (int) saveStateThread (RTTHREAD Thread, void *pvUser);
470 static DECLCALLBACK (int) powerDownThread (RTTHREAD Thread, void *pvUser);
471
472 static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
473 static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
474 static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
475 static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
476
477 int mcAudioRefs;
478 volatile uint32_t mcVRDPClients;
479 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
480
481 static const char *sSSMConsoleUnit;
482 static uint32_t sSSMConsoleVer;
483
484 HRESULT loadDataFromSavedState();
485
486 static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
487 static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
488
489#ifdef VBOX_WITH_GUEST_PROPS
490 static DECLCALLBACK(int) doGuestPropNotification (void *pvExtension, uint32_t,
491 void *pvParms, uint32_t cbParms);
492 HRESULT doEnumerateGuestProperties (CBSTR aPatterns,
493 ComSafeArrayOut(BSTR, aNames),
494 ComSafeArrayOut(BSTR, aValues),
495 ComSafeArrayOut(ULONG64, aTimestamps),
496 ComSafeArrayOut(BSTR, aFlags));
497#endif
498
499 bool mSavedStateDataLoaded : 1;
500
501 const ComPtr <IMachine> mMachine;
502 const ComPtr <IInternalMachineControl> mControl;
503
504 const ComPtr <IVRDPServer> mVRDPServer;
505 const ComPtr <IDVDDrive> mDVDDrive;
506 const ComPtr <IFloppyDrive> mFloppyDrive;
507
508 ConsoleVRDPServer * const mConsoleVRDPServer;
509
510 const ComObjPtr <Guest> mGuest;
511 const ComObjPtr <Keyboard> mKeyboard;
512 const ComObjPtr <Mouse> mMouse;
513 const ComObjPtr <Display> mDisplay;
514 const ComObjPtr <MachineDebugger> mDebugger;
515 const ComObjPtr <RemoteDisplayInfo> mRemoteDisplayInfo;
516
517 USBDeviceList mUSBDevices;
518 RemoteUSBDeviceList mRemoteUSBDevices;
519
520 SharedFolderMap mSharedFolders;
521 SharedFolderDataMap mMachineSharedFolders;
522 SharedFolderDataMap mGlobalSharedFolders;
523
524 /** The VM instance handle. */
525 PVM mpVM;
526 /** Holds the number of "readonly" mpVM callers (users) */
527 uint32_t mVMCallers;
528 /** Semaphore posted when the number of mpVM callers drops to zero */
529 RTSEMEVENT mVMZeroCallersSem;
530 /** true when Console has entered the mpVM destruction phase */
531 bool mVMDestroying : 1;
532 /** true when power down is initiated by vmstateChangeCallback (EMT) */
533 bool mVMPoweredOff : 1;
534
535 /** The current DVD drive state in the VM.
536 * This does not have to match the state maintained in the DVD. */
537 DriveState_T meDVDState;
538 /** The current Floppy drive state in the VM.
539 * This does not have to match the state maintained in the Floppy. */
540 DriveState_T meFloppyState;
541
542 VMMDev * const mVMMDev;
543 AudioSniffer * const mAudioSniffer;
544
545 PPDMLED mapFDLeds[2];
546 PPDMLED mapIDELeds[4];
547 PPDMLED mapSATALeds[30];
548 PPDMLED mapSCSILeds[16];
549 PPDMLED mapNetworkLeds[8];
550 PPDMLED mapSharedFolderLed;
551 PPDMLED mapUSBLed[2];
552#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
553 Utf8Str maTAPDeviceName[8];
554 RTFILE maTapFD[8];
555#endif
556
557 bool mVMStateChangeCallbackDisabled;
558
559 /* Local machine state value */
560 MachineState_T mMachineState;
561
562 typedef std::list <ComPtr <IConsoleCallback> > CallbackList;
563 CallbackList mCallbacks;
564
565 struct
566 {
567 /** OnMousePointerShapeChange() cache */
568 struct
569 {
570 bool valid;
571 bool visible;
572 bool alpha;
573 uint32_t xHot;
574 uint32_t yHot;
575 uint32_t width;
576 uint32_t height;
577 BYTE *shape;
578 size_t shapeSize;
579 }
580 mpsc;
581
582 /** OnMouseCapabilityChange() cache */
583 struct
584 {
585 bool valid;
586 BOOL supportsAbsolute;
587 BOOL needsHostCursor;
588 }
589 mcc;
590
591 /** OnKeyboardLedsChange() cache */
592 struct
593 {
594 bool valid;
595 bool numLock;
596 bool capsLock;
597 bool scrollLock;
598 }
599 klc;
600 }
601 mCallbackData;
602
603 friend struct VMTask;
604};
605
606#endif // ____H_CONSOLEIMPL
607/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette