VirtualBox

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

Last change on this file since 52052 was 52019, checked in by vboxsync, 10 years ago

Main/Console: Switch to RTMemSafer* for key backings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.5 KB
Line 
1/* $Id: ConsoleImpl.h 52019 2014-07-14 20:01:03Z vboxsync $ */
2/** @file
3 * VBox Console COM Class definition
4 */
5
6/*
7 * Copyright (C) 2005-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_CONSOLEIMPL
19#define ____H_CONSOLEIMPL
20
21#include "VirtualBoxBase.h"
22#include "VBox/com/array.h"
23#include "EventImpl.h"
24#include "ConsoleWrap.h"
25
26class Guest;
27class Keyboard;
28class Mouse;
29class Display;
30class MachineDebugger;
31class TeleporterStateSrc;
32class OUSBDevice;
33class RemoteUSBDevice;
34class SharedFolder;
35class VRDEServerInfo;
36class EmulatedUSB;
37#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
38class AudioVRDE;
39#else
40class AudioSniffer;
41#endif
42class Nvram;
43#ifdef VBOX_WITH_USB_CARDREADER
44class UsbCardReader;
45#endif
46class ConsoleVRDPServer;
47class VMMDev;
48class Progress;
49class BusAssignmentManager;
50COM_STRUCT_OR_CLASS(IEventListener);
51#ifdef VBOX_WITH_EXTPACK
52class ExtPackManager;
53#endif
54class VMMDevMouseInterface;
55class DisplayMouseInterface;
56
57#include <iprt/uuid.h>
58#include <iprt/memsafer.h>
59#include <VBox/RemoteDesktop/VRDE.h>
60#include <VBox/vmm/pdmdrv.h>
61#ifdef VBOX_WITH_GUEST_PROPS
62# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
63#endif
64
65#ifdef RT_OS_WINDOWS
66# include "../src-server/win/VBoxComEvents.h"
67#endif
68
69struct VUSBIRHCONFIG;
70typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
71
72#include <list>
73#include <vector>
74
75// defines
76///////////////////////////////////////////////////////////////////////////////
77
78/**
79 * Checks the availability of the underlying VM device driver corresponding
80 * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
81 * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
82 * The translatable error message is defined in null context.
83 *
84 * Intended to used only within Console children (i.e. Keyboard, Mouse,
85 * Display, etc.).
86 *
87 * @param drv driver pointer to check (compare it with NULL)
88 */
89#define CHECK_CONSOLE_DRV(drv) \
90 do { \
91 if (!(drv)) \
92 return setError(E_ACCESSDENIED, tr("The console is not powered up")); \
93 } while (0)
94
95// Console
96///////////////////////////////////////////////////////////////////////////////
97
98class ConsoleMouseInterface
99{
100public:
101 virtual VMMDevMouseInterface *i_getVMMDevMouseInterface(){return NULL;}
102 virtual DisplayMouseInterface *i_getDisplayMouseInterface(){return NULL;}
103 virtual void i_onMouseCapabilityChange(BOOL supportsAbsolute,
104 BOOL supportsRelative,
105 BOOL supportsMT,
106 BOOL needsHostCursor){NOREF(supportsAbsolute); NOREF(supportsRelative); NOREF(supportsMT); NOREF(needsHostCursor);}
107};
108
109/** IConsole implementation class */
110class ATL_NO_VTABLE Console :
111 public ConsoleWrap,
112 public ConsoleMouseInterface
113{
114
115public:
116
117 DECLARE_EMPTY_CTOR_DTOR(Console)
118
119 HRESULT FinalConstruct();
120 void FinalRelease();
121
122 // public initializers/uninitializers for internal purposes only
123 HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);
124 void uninit();
125
126
127 // public methods for internal purposes only
128
129 /*
130 * Note: the following methods do not increase refcount. intended to be
131 * called only by the VM execution thread.
132 */
133
134 Guest *i_getGuest() const { return mGuest; }
135 Keyboard *i_getKeyboard() const { return mKeyboard; }
136 Mouse *i_getMouse() const { return mMouse; }
137 Display *i_getDisplay() const { return mDisplay; }
138 MachineDebugger *i_getMachineDebugger() const { return mDebugger; }
139#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
140 AudioVRDE *i_getAudioVRDE() const { return mAudioVRDE; }
141#else
142 AudioSniffer *i_getAudioSniffer() const { return mAudioSniffer; }
143#endif
144
145 const ComPtr<IMachine> &i_machine() const { return mMachine; }
146
147 bool i_useHostClipboard() { return mfUseHostClipboard; }
148
149 /** Method is called only from ConsoleVRDPServer */
150 IVRDEServer *i_getVRDEServer() const { return mVRDEServer; }
151
152 ConsoleVRDPServer *i_consoleVRDPServer() const { return mConsoleVRDPServer; }
153
154 HRESULT i_updateMachineState(MachineState_T aMachineState);
155
156 // events from IInternalSessionControl
157 HRESULT i_onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
158 HRESULT i_onSerialPortChange(ISerialPort *aSerialPort);
159 HRESULT i_onParallelPortChange(IParallelPort *aParallelPort);
160 HRESULT i_onStorageControllerChange();
161 HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
162 HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
163 HRESULT i_onCPUExecutionCapChange(ULONG aExecutionCap);
164 HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
165 HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
166 HRESULT i_onVRDEServerChange(BOOL aRestart);
167 HRESULT i_onVideoCaptureChange();
168 HRESULT i_onUSBControllerChange();
169 HRESULT i_onSharedFolderChange(BOOL aGlobal);
170 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
171 HRESULT i_onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
172 HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
173 HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
174 HRESULT i_onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
175
176 HRESULT i_getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
177 HRESULT i_setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
178 HRESULT i_enumerateGuestProperties(IN_BSTR aPatterns,
179 ComSafeArrayOut(BSTR, aNames),
180 ComSafeArrayOut(BSTR, aValues),
181 ComSafeArrayOut(LONG64, aTimestamps),
182 ComSafeArrayOut(BSTR, aFlags));
183 HRESULT i_onlineMergeMedium(IMediumAttachment *aMediumAttachment,
184 ULONG aSourceIdx, ULONG aTargetIdx,
185 IProgress *aProgress);
186 int i_hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
187 VMMDev *i_getVMMDev() { return m_pVMMDev; }
188#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
189 AudioVRDE *i_getAudioVRDE() { return mAudioVRDE; }
190#else
191 AudioSniffer *i_getAudioSniffer() { return mAudioSniffer; }
192#endif
193
194#ifdef VBOX_WITH_EXTPACK
195 ExtPackManager *i_getExtPackManager();
196#endif
197 EventSource *i_getEventSource() { return mEventSource; }
198#ifdef VBOX_WITH_USB_CARDREADER
199 UsbCardReader *i_getUsbCardReader() { return mUsbCardReader; }
200#endif
201
202 int i_VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
203 void i_VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
204 void i_VRDPClientConnect(uint32_t u32ClientId);
205 void i_VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
206 void i_VRDPInterceptAudio(uint32_t u32ClientId);
207 void i_VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
208 void i_VRDPInterceptClipboard(uint32_t u32ClientId);
209
210 void i_processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
211 void i_reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
212 ULONG aCpuKernel, ULONG aCpuIdle,
213 ULONG aMemTotal, ULONG aMemFree,
214 ULONG aMemBalloon, ULONG aMemShared,
215 ULONG aMemCache, ULONG aPageTotal,
216 ULONG aAllocVMM, ULONG aFreeVMM,
217 ULONG aBalloonedVMM, ULONG aSharedVMM,
218 ULONG aVmNetRx, ULONG aVmNetTx)
219 {
220 mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
221 aMemTotal, aMemFree, aMemBalloon, aMemShared,
222 aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
223 aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
224 }
225 void i_enableVMMStatistics(BOOL aEnable);
226
227 HRESULT i_pause(Reason_T aReason);
228 HRESULT i_resume(Reason_T aReason);
229 HRESULT i_saveState(Reason_T aReason, IProgress **aProgress);
230
231 // callback callers (partly; for some events console callbacks are notified
232 // directly from IInternalSessionControl event handlers declared above)
233 void i_onMousePointerShapeChange(bool fVisible, bool fAlpha,
234 uint32_t xHot, uint32_t yHot,
235 uint32_t width, uint32_t height,
236 ComSafeArrayIn(uint8_t, aShape));
237 void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
238 BOOL supportsMT, BOOL needsHostCursor);
239 void i_onStateChange(MachineState_T aMachineState);
240 void i_onAdditionsStateChange();
241 void i_onAdditionsOutdated();
242 void i_onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
243 void i_onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
244 IVirtualBoxErrorInfo *aError);
245 void i_onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
246 HRESULT i_onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
247 void i_onVRDEServerInfoChange();
248
249 static const PDMDRVREG DrvStatusReg;
250
251 static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
252 HRESULT i_setInvalidMachineStateError();
253
254 static const char *i_convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
255 static HRESULT i_convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
256 // Called from event listener
257 HRESULT i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
258 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
259
260 // Mouse interface
261 VMMDevMouseInterface *i_getVMMDevMouseInterface();
262 DisplayMouseInterface *i_getDisplayMouseInterface();
263
264 EmulatedUSB *i_getEmulatedUSB(void) { return mEmulatedUSB; }
265
266 /**
267 * Sets the disk encryption keys.
268 *
269 * @returns COM status code.
270 * @þaram strCfg The config for the disks.
271 *
272 * @note: One line in the config string contains all required data for one disk.
273 * The format for one disk is some sort of comma separated value using
274 * key=value pairs.
275 * There are two keys defined at the moment:
276 * - uuid: The uuid of the base image the key is for (with or without)
277 * the curly braces.
278 * - dek: The data encryption key in base64 encoding
279 */
280 HRESULT i_setDiskEncryptionKeys(const Utf8Str &strCfg);
281
282private:
283
284 // wraped IConsole properties
285 HRESULT getMachine(ComPtr<IMachine> &aMachine);
286 HRESULT getState(MachineState_T *aState);
287 HRESULT getGuest(ComPtr<IGuest> &aGuest);
288 HRESULT getKeyboard(ComPtr<IKeyboard> &aKeyboard);
289 HRESULT getMouse(ComPtr<IMouse> &aMouse);
290 HRESULT getDisplay(ComPtr<IDisplay> &aDisplay);
291 HRESULT getDebugger(ComPtr<IMachineDebugger> &aDebugger);
292 HRESULT getUSBDevices(std::vector<ComPtr<IUSBDevice> > &aUSBDevices);
293 HRESULT getRemoteUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aRemoteUSBDevices);
294 HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
295 HRESULT getVRDEServerInfo(ComPtr<IVRDEServerInfo> &aVRDEServerInfo);
296 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
297 HRESULT getAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttachedPCIDevices);
298 HRESULT getUseHostClipboard(BOOL *aUseHostClipboard);
299 HRESULT setUseHostClipboard(BOOL aUseHostClipboard);
300 HRESULT getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB);
301
302 // wraped IConsole methods
303 HRESULT powerUp(ComPtr<IProgress> &aProgress);
304 HRESULT powerUpPaused(ComPtr<IProgress> &aProgress);
305 HRESULT powerDown(ComPtr<IProgress> &aProgress);
306 HRESULT reset();
307 HRESULT pause();
308 HRESULT resume();
309 HRESULT powerButton();
310 HRESULT sleepButton();
311 HRESULT getPowerButtonHandled(BOOL *aHandled);
312 HRESULT getGuestEnteredACPIMode(BOOL *aEntered);
313 HRESULT saveState(ComPtr<IProgress> &aProgress);
314 HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
315 HRESULT discardSavedState(BOOL aFRemoveFile);
316 HRESULT getDeviceActivity(DeviceType_T aType,
317 DeviceActivity_T *aActivity);
318 HRESULT attachUSBDevice(const com::Guid &aId);
319 HRESULT detachUSBDevice(const com::Guid &aId,
320 ComPtr<IUSBDevice> &aDevice);
321 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
322 ComPtr<IUSBDevice> &aDevice);
323 HRESULT findUSBDeviceById(const com::Guid &aId,
324 ComPtr<IUSBDevice> &aDevice);
325 HRESULT createSharedFolder(const com::Utf8Str &aName,
326 const com::Utf8Str &aHostPath,
327 BOOL aWritable,
328 BOOL aAutomount);
329 HRESULT removeSharedFolder(const com::Utf8Str &aName);
330 HRESULT takeSnapshot(const com::Utf8Str &aName,
331 const com::Utf8Str &aDescription,
332 ComPtr<IProgress> &aProgress);
333 HRESULT deleteSnapshot(const com::Guid &aId,
334 ComPtr<IProgress> &aProgress);
335 HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
336 ComPtr<IProgress> &aProgress);
337 HRESULT deleteSnapshotRange(const com::Guid &aStartId,
338 const com::Guid &aEndId,
339 ComPtr<IProgress> &aProgress);
340 HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
341 ComPtr<IProgress> &aProgress);
342 HRESULT teleport(const com::Utf8Str &aHostname,
343 ULONG aTcpport,
344 const com::Utf8Str &aPassword,
345 ULONG aMaxDowntime,
346 ComPtr<IProgress> &aProgress);
347
348 /**
349 * Base template for AutoVMCaller and SafeVMPtr. Template arguments
350 * have the same meaning as arguments of Console::addVMCaller().
351 */
352 template <bool taQuiet = false, bool taAllowNullVM = false>
353 class AutoVMCallerBase
354 {
355 public:
356 AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(E_FAIL)
357 {
358 Assert(aThat);
359 mRC = aThat->i_addVMCaller(taQuiet, taAllowNullVM);
360 }
361 ~AutoVMCallerBase()
362 {
363 doRelease();
364 }
365 /** Decreases the number of callers before the instance is destroyed. */
366 void releaseCaller()
367 {
368 Assert(SUCCEEDED(mRC));
369 doRelease();
370 }
371 /** Restores the number of callers after by #release(). #rc() must be
372 * rechecked to ensure the operation succeeded. */
373 void addYY()
374 {
375 AssertReturnVoid(!SUCCEEDED(mRC));
376 mRC = mThat->i_addVMCaller(taQuiet, taAllowNullVM);
377 }
378 /** Returns the result of Console::addVMCaller() */
379 HRESULT rc() const { return mRC; }
380 /** Shortcut to SUCCEEDED(rc()) */
381 bool isOk() const { return SUCCEEDED(mRC); }
382 protected:
383 Console *mThat;
384 void doRelease()
385 {
386 if (SUCCEEDED(mRC))
387 {
388 mThat->i_releaseVMCaller();
389 mRC = E_FAIL;
390 }
391 }
392 private:
393 HRESULT mRC; /* Whether the caller was added. */
394 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase)
395 };
396
397#if 0
398 /**
399 * Helper class that protects sections of code using the mpUVM pointer by
400 * automatically calling addVMCaller() on construction and
401 * releaseVMCaller() on destruction. Intended for Console methods dealing
402 * with mpUVM. The usage pattern is:
403 * <code>
404 * AutoVMCaller autoVMCaller(this);
405 * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
406 * ...
407 * VMR3ReqCall (mpUVM, ...
408 * </code>
409 *
410 * @note Temporarily locks the argument for writing.
411 *
412 * @sa SafeVMPtr, SafeVMPtrQuiet
413 * @obsolete Use SafeVMPtr
414 */
415 typedef AutoVMCallerBase<false, false> AutoVMCaller;
416#endif
417
418 /**
419 * Same as AutoVMCaller but doesn't set extended error info on failure.
420 *
421 * @note Temporarily locks the argument for writing.
422 * @obsolete Use SafeVMPtrQuiet
423 */
424 typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
425
426 /**
427 * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
428 * instead of assertion).
429 *
430 * @note Temporarily locks the argument for writing.
431 * @obsolete Use SafeVMPtr
432 */
433 typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
434
435 /**
436 * Same as AutoVMCaller but doesn't set extended error info on failure
437 * and allows a null VM pointer (to trigger an error instead of
438 * assertion).
439 *
440 * @note Temporarily locks the argument for writing.
441 * @obsolete Use SafeVMPtrQuiet
442 */
443 typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
444
445 /**
446 * Base template for SafeVMPtr and SafeVMPtrQuiet.
447 */
448 template<bool taQuiet = false>
449 class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
450 {
451 typedef AutoVMCallerBase<taQuiet, true> Base;
452 public:
453 SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL)
454 {
455 if (Base::isOk())
456 mRC = aThat->i_safeVMPtrRetainer(&mpUVM, taQuiet);
457 }
458 ~SafeVMPtrBase()
459 {
460 doRelease();
461 }
462 /** Direct PUVM access. */
463 PUVM rawUVM() const { return mpUVM; }
464 /** Release the handles. */
465 void release()
466 {
467 Assert(SUCCEEDED(mRC));
468 doRelease();
469 }
470
471 /** The combined result of Console::addVMCaller() and Console::safeVMPtrRetainer */
472 HRESULT rc() const { return Base::isOk()? mRC: Base::rc(); }
473 /** Shortcut to SUCCEEDED(rc()) */
474 bool isOk() const { return SUCCEEDED(mRC) && Base::isOk(); }
475
476 private:
477 void doRelease()
478 {
479 if (SUCCEEDED(mRC))
480 {
481 Base::mThat->i_safeVMPtrReleaser(&mpUVM);
482 mRC = E_FAIL;
483 }
484 Base::doRelease();
485 }
486 HRESULT mRC; /* Whether the VM ptr was retained. */
487 PUVM mpUVM;
488 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
489 };
490
491public:
492
493 /*
494 * Helper class that safely manages the Console::mpUVM pointer
495 * by calling addVMCaller() on construction and releaseVMCaller() on
496 * destruction. Intended for Console children. The usage pattern is:
497 * <code>
498 * Console::SafeVMPtr ptrVM(mParent);
499 * if (!ptrVM.isOk())
500 * return ptrVM.rc();
501 * ...
502 * VMR3ReqCall(ptrVM.rawUVM(), ...
503 * ...
504 * printf("%p\n", ptrVM.rawUVM());
505 * </code>
506 *
507 * @note Temporarily locks the argument for writing.
508 *
509 * @sa SafeVMPtrQuiet, AutoVMCaller
510 */
511 typedef SafeVMPtrBase<false> SafeVMPtr;
512
513 /**
514 * A deviation of SafeVMPtr that doesn't set the error info on failure.
515 * Intended for pieces of code that don't need to return the VM access
516 * failure to the caller. The usage pattern is:
517 * <code>
518 * Console::SafeVMPtrQuiet pVM(mParent);
519 * if (pVM.rc())
520 * VMR3ReqCall(pVM, ...
521 * return S_OK;
522 * </code>
523 *
524 * @note Temporarily locks the argument for writing.
525 *
526 * @sa SafeVMPtr, AutoVMCaller
527 */
528 typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
529
530 class SharedFolderData
531 {
532 public:
533 SharedFolderData()
534 { }
535
536 SharedFolderData(const Utf8Str &aHostPath,
537 bool aWritable,
538 bool aAutoMount)
539 : m_strHostPath(aHostPath),
540 m_fWritable(aWritable),
541 m_fAutoMount(aAutoMount)
542 { }
543
544 // copy constructor
545 SharedFolderData(const SharedFolderData& aThat)
546 : m_strHostPath(aThat.m_strHostPath),
547 m_fWritable(aThat.m_fWritable),
548 m_fAutoMount(aThat.m_fAutoMount)
549 { }
550
551 Utf8Str m_strHostPath;
552 bool m_fWritable;
553 bool m_fAutoMount;
554 };
555
556 /**
557 * Class for managing emulated USB MSDs.
558 */
559 class USBStorageDevice
560 {
561 public:
562 USBStorageDevice()
563 { }
564 /** The UUID associated with the USB device. */
565 RTUUID mUuid;
566 /** Port of the storage device. */
567 LONG iPort;
568 };
569
570 /**
571 * Class for managing cryptographic keys.
572 * @todo: Replace with a keystore implementation once it is ready.
573 */
574 class SecretKey
575 {
576 public:
577 SecretKey() { }
578
579 SecretKey(uint8_t *pbKey, size_t cbKey)
580 : m_cRefs(0),
581 m_pbKey(pbKey),
582 m_cbKey(cbKey)
583 { }
584
585 ~SecretKey()
586 {
587 RTMemSaferFree(m_pbKey, m_cbKey);
588 m_cRefs = 0;
589 m_pbKey = NULL;
590 m_cbKey = 0;
591 }
592
593 /** Reference counter of the key. */
594 volatile uint32_t m_cRefs;
595 /** Key material. */
596 uint8_t *m_pbKey;
597 /** Size of the key in bytes. */
598 size_t m_cbKey;
599 };
600
601 typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
602 typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
603 typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
604 typedef std::list <USBStorageDevice> USBStorageDeviceList;
605 typedef std::map<Utf8Str, SecretKey *> SecretKeyMap;
606
607private:
608
609 typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
610 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
611
612 HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
613 void i_releaseVMCaller();
614 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
615 void i_safeVMPtrReleaser(PUVM *a_ppUVM);
616
617 HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
618
619 HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
620 HRESULT i_powerDown(IProgress *aProgress = NULL);
621
622/* Note: FreeBSD needs this whether netflt is used or not. */
623#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
624 HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
625 HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
626#endif
627 HRESULT i_powerDownHostInterfaces();
628
629 HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
630 HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
631 {
632 return i_setMachineState(aMachineState, false /* aUpdateServer */);
633 }
634
635 HRESULT i_findSharedFolder(const Utf8Str &strName,
636 ComObjPtr<SharedFolder> &aSharedFolder,
637 bool aSetError = false);
638
639 HRESULT i_fetchSharedFolders(BOOL aGlobal);
640 bool i_findOtherSharedFolder(const Utf8Str &straName,
641 SharedFolderDataMap::const_iterator &aIt);
642
643 HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
644 HRESULT i_removeSharedFolder(const Utf8Str &strName);
645
646 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
647 void i_resumeAfterConfigChange(PUVM pUVM);
648
649 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
650 int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
651 int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
652 int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
653
654 int i_configGraphicsController(PCFGMNODE pDevices,
655 const GraphicsControllerType_T graphicsController,
656 BusAssignmentManager *pBusMgr,
657 const ComPtr<IMachine> &pMachine,
658 const ComPtr<IBIOSSettings> &biosSettings,
659 bool fHMEnabled);
660 int i_configMediumAttachment(PCFGMNODE pCtlInst,
661 const char *pcszDevice,
662 unsigned uInstance,
663 StorageBus_T enmBus,
664 bool fUseHostIOCache,
665 bool fBuiltinIoCache,
666 bool fSetupMerge,
667 unsigned uMergeSource,
668 unsigned uMergeTarget,
669 IMediumAttachment *pMediumAtt,
670 MachineState_T aMachineState,
671 HRESULT *phrc,
672 bool fAttachDetach,
673 bool fForceUnmount,
674 bool fHotplug,
675 PUVM pUVM,
676 DeviceType_T *paLedDevType,
677 PCFGMNODE *ppLunL0);
678 int i_configMedium(PCFGMNODE pLunL0,
679 bool fPassthrough,
680 DeviceType_T enmType,
681 bool fUseHostIOCache,
682 bool fBuiltinIoCache,
683 bool fSetupMerge,
684 unsigned uMergeSource,
685 unsigned uMergeTarget,
686 const char *pcszBwGroup,
687 bool fDiscard,
688 IMedium *pMedium,
689 MachineState_T aMachineState,
690 HRESULT *phrc);
691 static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
692 PUVM pUVM,
693 const char *pcszDevice,
694 unsigned uInstance,
695 StorageBus_T enmBus,
696 bool fUseHostIOCache,
697 bool fBuiltinIoCache,
698 bool fSetupMerge,
699 unsigned uMergeSource,
700 unsigned uMergeTarget,
701 IMediumAttachment *aMediumAtt,
702 MachineState_T aMachineState,
703 HRESULT *phrc);
704 static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
705 PUVM pUVM,
706 const char *pcszDevice,
707 unsigned uInstance,
708 StorageBus_T enmBus,
709 bool fUseHostIOCache,
710 IMediumAttachment *aMediumAtt,
711 bool fForce);
712
713 HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
714 void i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
715 uint64_t uFirst, uint64_t uLast,
716 Console::MediumAttachmentMap *pmapMediumAttachments,
717 const char *pcszDevice, unsigned uInstance);
718
719 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
720 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
721 PCFGMNODE pLunL0, PCFGMNODE pInst,
722 bool fAttachDetach, bool fIgnoreConnectFailure);
723
724 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole, PUVM pUVM);
725 static DECLCALLBACK(int) i_configGuestControl(void *pvConsole);
726 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
727 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
728 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
729 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
730 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM);
731 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM);
732
733 HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
734 unsigned uLun, INetworkAdapter *aNetworkAdapter);
735 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
736 unsigned uInstance, unsigned uLun,
737 INetworkAdapter *aNetworkAdapter);
738
739 void i_changeClipboardMode(ClipboardMode_T aClipboardMode);
740 int i_changeDnDMode(DnDMode_T aDnDMode);
741
742#ifdef VBOX_WITH_USB
743 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
744 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
745
746 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
747 bool aRemote, const char *aAddress, void *pvRemoteBackend,
748 USHORT aPortVersion, ULONG aMaskedIfs);
749 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
750#endif
751
752 static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
753 PUVM pUVM,
754 const char *pcszDevice,
755 unsigned uInstance,
756 StorageBus_T enmBus,
757 bool fUseHostIOCache,
758 IMediumAttachment *aMediumAtt,
759 bool fSilent);
760 static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
761 PUVM pUVM,
762 const char *pcszDevice,
763 unsigned uInstance,
764 StorageBus_T enmBus,
765 IMediumAttachment *aMediumAtt,
766 bool fSilent);
767 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
768 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
769
770 static DECLCALLBACK(int) i_fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
771
772 static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
773
774 static DECLCALLBACK(void) i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
775 const char *pszErrorFmt, va_list va);
776
777 void i_setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
778 static DECLCALLBACK(void) i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
779 const char *pszErrorId, const char *pszFormat, va_list va);
780
781 HRESULT i_captureUSBDevices(PUVM pUVM);
782 void i_detachAllUSBDevices(bool aDone);
783
784 static DECLCALLBACK(int) i_powerUpThread(RTTHREAD Thread, void *pvUser);
785 static DECLCALLBACK(int) i_saveStateThread(RTTHREAD Thread, void *pvUser);
786 static DECLCALLBACK(int) i_powerDownThread(RTTHREAD Thread, void *pvUser);
787
788 static DECLCALLBACK(int) i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
789 static DECLCALLBACK(void) i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
790 static DECLCALLBACK(void) i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
791 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
792 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
793 static DECLCALLBACK(void) i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
794
795 static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
796 static DECLCALLBACK(void) i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
797 static DECLCALLBACK(int) i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
798 static DECLCALLBACK(void) i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
799 static DECLCALLBACK(int) i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
800
801 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
802 size_t *pcbKey);
803 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
804
805 int mcAudioRefs;
806 volatile uint32_t mcVRDPClients;
807 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
808 volatile bool mcGuestCredentialsProvided;
809
810 static const char *sSSMConsoleUnit;
811 static uint32_t sSSMConsoleVer;
812
813 HRESULT i_loadDataFromSavedState();
814 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
815
816 static DECLCALLBACK(void) i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
817 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
818
819#ifdef VBOX_WITH_GUEST_PROPS
820 static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
821 HRESULT i_doEnumerateGuestProperties(CBSTR aPatterns,
822 ComSafeArrayOut(BSTR, aNames),
823 ComSafeArrayOut(BSTR, aValues),
824 ComSafeArrayOut(LONG64, aTimestamps),
825 ComSafeArrayOut(BSTR, aFlags));
826
827 void i_guestPropertiesHandleVMReset(void);
828 bool i_guestPropertiesVRDPEnabled(void);
829 void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
830 void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
831 void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
832 void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
833 void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
834 void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
835 void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
836 void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
837#endif
838
839 bool i_isResetTurnedIntoPowerOff(void);
840
841 /** @name Disk encryption support
842 * @{ */
843 HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
844 HRESULT i_configureEncryptionForDisk(const char *pszUuid);
845 HRESULT i_clearDiskEncryptionKeysOnAllAttachments(void);
846 int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
847 char **ppszKey, char **ppszVal);
848 /** @} */
849
850 /** @name Teleporter support
851 * @{ */
852 static DECLCALLBACK(int) i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
853 HRESULT i_teleporterSrc(TeleporterStateSrc *pState);
854 HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
855 HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
856 HRESULT i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
857 Progress *pProgress, bool *pfPowerOffOnFailure);
858 static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
859 /** @} */
860
861 bool mSavedStateDataLoaded : 1;
862
863 const ComPtr<IMachine> mMachine;
864 const ComPtr<IInternalMachineControl> mControl;
865
866 const ComPtr<IVRDEServer> mVRDEServer;
867
868 ConsoleVRDPServer * const mConsoleVRDPServer;
869 bool mfVRDEChangeInProcess;
870 bool mfVRDEChangePending;
871
872 const ComObjPtr<Guest> mGuest;
873 const ComObjPtr<Keyboard> mKeyboard;
874 const ComObjPtr<Mouse> mMouse;
875 const ComObjPtr<Display> mDisplay;
876 const ComObjPtr<MachineDebugger> mDebugger;
877 const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
878 /** This can safely be used without holding any locks.
879 * An AutoCaller suffices to prevent it being destroy while in use and
880 * internally there is a lock providing the necessary serialization. */
881 const ComObjPtr<EventSource> mEventSource;
882#ifdef VBOX_WITH_EXTPACK
883 const ComObjPtr<ExtPackManager> mptrExtPackManager;
884#endif
885 const ComObjPtr<EmulatedUSB> mEmulatedUSB;
886
887 USBDeviceList mUSBDevices;
888 RemoteUSBDeviceList mRemoteUSBDevices;
889
890 SharedFolderDataMap m_mapGlobalSharedFolders;
891 SharedFolderDataMap m_mapMachineSharedFolders;
892 SharedFolderMap m_mapSharedFolders; // the console instances
893
894 /** The user mode VM handle. */
895 PUVM mpUVM;
896 /** Holds the number of "readonly" mpUVM callers (users). */
897 uint32_t mVMCallers;
898 /** Semaphore posted when the number of mpUVM callers drops to zero. */
899 RTSEMEVENT mVMZeroCallersSem;
900 /** true when Console has entered the mpUVM destruction phase. */
901 bool mVMDestroying : 1;
902 /** true when power down is initiated by vmstateChangeCallback (EMT). */
903 bool mVMPoweredOff : 1;
904 /** true when vmstateChangeCallback shouldn't initiate a power down. */
905 bool mVMIsAlreadyPoweringOff : 1;
906 /** true if we already showed the snapshot folder size warning. */
907 bool mfSnapshotFolderSizeWarningShown : 1;
908 /** true if we already showed the snapshot folder ext4/xfs bug warning. */
909 bool mfSnapshotFolderExt4WarningShown : 1;
910 /** true if we already listed the disk type of the snapshot folder. */
911 bool mfSnapshotFolderDiskTypeShown : 1;
912 /** true if a USB controller is available (i.e. USB devices can be attached). */
913 bool mfVMHasUsbController : 1;
914 /** true if the VM power off was caused by reset. */
915 bool mfPowerOffCausedByReset : 1;
916
917 /** Pointer to the VMM -> User (that's us) callbacks. */
918 struct MYVMM2USERMETHODS : public VMM2USERMETHODS
919 {
920 Console *pConsole;
921 } *mpVmm2UserMethods;
922
923 /** The current network attachment type in the VM.
924 * This doesn't have to match the network attachment type maintained in the
925 * NetworkAdapter. This is needed to change the network attachment
926 * dynamically.
927 */
928 typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
929 NetworkAttachmentTypeVector meAttachmentType;
930
931 VMMDev * m_pVMMDev;
932#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
933 AudioVRDE * const mAudioVRDE;
934#else
935 AudioSniffer * const mAudioSniffer;
936#endif
937 Nvram * const mNvram;
938#ifdef VBOX_WITH_USB_CARDREADER
939 UsbCardReader * const mUsbCardReader;
940#endif
941 BusAssignmentManager* mBusMgr;
942
943 enum
944 {
945 iLedFloppy = 0,
946 cLedFloppy = 2,
947 iLedIde = iLedFloppy + cLedFloppy,
948 cLedIde = 4,
949 iLedSata = iLedIde + cLedIde,
950 cLedSata = 30,
951 iLedScsi = iLedSata + cLedSata,
952 cLedScsi = 16,
953 iLedSas = iLedScsi + cLedScsi,
954 cLedSas = 8,
955 iLedUsb = iLedSas + cLedSas,
956 cLedUsb = 8,
957 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb
958 };
959 DeviceType_T maStorageDevType[cLedStorage];
960 PPDMLED mapStorageLeds[cLedStorage];
961 PPDMLED mapNetworkLeds[36]; /**< @todo adapt this to the maximum network card count */
962 PPDMLED mapSharedFolderLed;
963 PPDMLED mapUSBLed[2];
964 PPDMLED mapCrOglLed;
965
966 MediumAttachmentMap mapMediumAttachments;
967
968 /** List of attached USB storage devices. */
969 USBStorageDeviceList mUSBStorageDevices;
970
971 /** Map of secret keys used for disk encryption. */
972 SecretKeyMap m_mapSecretKeys;
973
974 /** Pointer to the key consumer -> provider (that's us) callbacks. */
975 struct MYPDMISECKEY : public PDMISECKEY
976 {
977 Console *pConsole;
978 } *mpIfSecKey;
979
980/* Note: FreeBSD needs this whether netflt is used or not. */
981#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
982 Utf8Str maTAPDeviceName[8];
983 RTFILE maTapFD[8];
984#endif
985
986 bool mVMStateChangeCallbackDisabled;
987
988 bool mfUseHostClipboard;
989
990 /** Local machine state value. */
991 MachineState_T mMachineState;
992
993 /** Pointer to the progress object of a live cancelable task.
994 *
995 * This is currently only used by Console::Teleport(), but is intended to later
996 * be used by the live snapshot code path as well. Actions like
997 * Console::PowerDown, which automatically cancels out the running snapshot /
998 * teleportation operation, will cancel the teleportation / live snapshot
999 * operation before starting. */
1000 ComObjPtr<Progress> mptrCancelableProgress;
1001
1002 /* The purpose of caching of some events is probably in order to
1003 automatically fire them at new event listeners. However, there is no
1004 (longer?) any code making use of this... */
1005#ifdef CONSOLE_WITH_EVENT_CACHE
1006 struct
1007 {
1008 /** OnMousePointerShapeChange() cache */
1009 struct
1010 {
1011 bool valid;
1012 bool visible;
1013 bool alpha;
1014 uint32_t xHot;
1015 uint32_t yHot;
1016 uint32_t width;
1017 uint32_t height;
1018 com::SafeArray<BYTE> shape;
1019 } mpsc;
1020
1021 /** OnMouseCapabilityChange() cache */
1022 struct
1023 {
1024 bool valid;
1025 BOOL supportsAbsolute;
1026 BOOL supportsRelative;
1027 BOOL needsHostCursor;
1028 } mcc;
1029
1030 /** OnKeyboardLedsChange() cache */
1031 struct
1032 {
1033 bool valid;
1034 bool numLock;
1035 bool capsLock;
1036 bool scrollLock;
1037 } klc;
1038
1039 void clear()
1040 {
1041 RT_ZERO(mcc);
1042 RT_ZERO(klc);
1043
1044 /* We cannot RT_ZERO mpsc because of shape's vtable. */
1045 mpsc.shape.setNull();
1046 mpsc.valid = mpsc.visible = mpsc.alpha = false;
1047 mpsc.xHot = mpsc.yHot = mpsc.width = mpsc.height = 0;
1048 }
1049 } mCallbackData;
1050#endif
1051 ComPtr<IEventListener> mVmListener;
1052
1053 friend struct VMTask;
1054};
1055
1056#endif // !____H_CONSOLEIMPL
1057/* 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