VirtualBox

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

Last change on this file since 17571 was 17553, checked in by vboxsync, 16 years ago

#3551: “Main: Replace remaining collections with safe arrays”
Replaced IUSBDeviceCollection. Reviewed by Christian.

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

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