VirtualBox

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

Last change on this file since 16560 was 15708, checked in by vboxsync, 15 years ago

Main: #3424: Bumped XML format version to 1.6 and so that the auto-converter will delete old <HostInterface> nodes containing TAPSetup/TAPTerminate attributes. Removed all (obsolete) sections of code in #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING (that uses these attributes); removed the define itself.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use