VirtualBox

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

最後變更 在這個檔案從52016是 51925,由 vboxsync 提交於 11 年 前

Console,DrvVD: Clear the encryption keys on suspend

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 43.6 KB
 
1/* $Id: ConsoleImpl.h 51925 2014-07-08 11:13:51Z 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.alldomusa.eu.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/mem.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 RTMemWipeThoroughly(m_pbKey, m_cbKey, 3 /* cPasses */);
588 RTMemLockedFree(m_pbKey);
589 m_cRefs = 0;
590 m_pbKey = NULL;
591 m_cbKey = 0;
592 }
593
594 /** Reference counter of the key. */
595 volatile uint32_t m_cRefs;
596 /** Key material. */
597 uint8_t *m_pbKey;
598 /** Size of the key in bytes. */
599 size_t m_cbKey;
600 };
601
602 typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
603 typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
604 typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
605 typedef std::list <USBStorageDevice> USBStorageDeviceList;
606 typedef std::map<Utf8Str, SecretKey *> SecretKeyMap;
607
608private:
609
610 typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
611 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
612
613 HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
614 void i_releaseVMCaller();
615 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
616 void i_safeVMPtrReleaser(PUVM *a_ppUVM);
617
618 HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
619
620 HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
621 HRESULT i_powerDown(IProgress *aProgress = NULL);
622
623/* Note: FreeBSD needs this whether netflt is used or not. */
624#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
625 HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
626 HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
627#endif
628 HRESULT i_powerDownHostInterfaces();
629
630 HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
631 HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
632 {
633 return i_setMachineState(aMachineState, false /* aUpdateServer */);
634 }
635
636 HRESULT i_findSharedFolder(const Utf8Str &strName,
637 ComObjPtr<SharedFolder> &aSharedFolder,
638 bool aSetError = false);
639
640 HRESULT i_fetchSharedFolders(BOOL aGlobal);
641 bool i_findOtherSharedFolder(const Utf8Str &straName,
642 SharedFolderDataMap::const_iterator &aIt);
643
644 HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
645 HRESULT i_removeSharedFolder(const Utf8Str &strName);
646
647 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
648 void i_resumeAfterConfigChange(PUVM pUVM);
649
650 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
651 int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
652 int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
653 int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
654
655 int i_configGraphicsController(PCFGMNODE pDevices,
656 const GraphicsControllerType_T graphicsController,
657 BusAssignmentManager *pBusMgr,
658 const ComPtr<IMachine> &pMachine,
659 const ComPtr<IBIOSSettings> &biosSettings,
660 bool fHMEnabled);
661 int i_configMediumAttachment(PCFGMNODE pCtlInst,
662 const char *pcszDevice,
663 unsigned uInstance,
664 StorageBus_T enmBus,
665 bool fUseHostIOCache,
666 bool fBuiltinIoCache,
667 bool fSetupMerge,
668 unsigned uMergeSource,
669 unsigned uMergeTarget,
670 IMediumAttachment *pMediumAtt,
671 MachineState_T aMachineState,
672 HRESULT *phrc,
673 bool fAttachDetach,
674 bool fForceUnmount,
675 bool fHotplug,
676 PUVM pUVM,
677 DeviceType_T *paLedDevType,
678 PCFGMNODE *ppLunL0);
679 int i_configMedium(PCFGMNODE pLunL0,
680 bool fPassthrough,
681 DeviceType_T enmType,
682 bool fUseHostIOCache,
683 bool fBuiltinIoCache,
684 bool fSetupMerge,
685 unsigned uMergeSource,
686 unsigned uMergeTarget,
687 const char *pcszBwGroup,
688 bool fDiscard,
689 IMedium *pMedium,
690 MachineState_T aMachineState,
691 HRESULT *phrc);
692 static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
693 PUVM pUVM,
694 const char *pcszDevice,
695 unsigned uInstance,
696 StorageBus_T enmBus,
697 bool fUseHostIOCache,
698 bool fBuiltinIoCache,
699 bool fSetupMerge,
700 unsigned uMergeSource,
701 unsigned uMergeTarget,
702 IMediumAttachment *aMediumAtt,
703 MachineState_T aMachineState,
704 HRESULT *phrc);
705 static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
706 PUVM pUVM,
707 const char *pcszDevice,
708 unsigned uInstance,
709 StorageBus_T enmBus,
710 bool fUseHostIOCache,
711 IMediumAttachment *aMediumAtt,
712 bool fForce);
713
714 HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
715 void i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
716 uint64_t uFirst, uint64_t uLast,
717 Console::MediumAttachmentMap *pmapMediumAttachments,
718 const char *pcszDevice, unsigned uInstance);
719
720 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
721 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
722 PCFGMNODE pLunL0, PCFGMNODE pInst,
723 bool fAttachDetach, bool fIgnoreConnectFailure);
724
725 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole, PUVM pUVM);
726 static DECLCALLBACK(int) i_configGuestControl(void *pvConsole);
727 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
728 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
729 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
730 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
731 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM);
732 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM);
733
734 HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
735 unsigned uLun, INetworkAdapter *aNetworkAdapter);
736 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
737 unsigned uInstance, unsigned uLun,
738 INetworkAdapter *aNetworkAdapter);
739
740 void i_changeClipboardMode(ClipboardMode_T aClipboardMode);
741 int i_changeDnDMode(DnDMode_T aDnDMode);
742
743#ifdef VBOX_WITH_USB
744 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
745 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
746
747 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
748 bool aRemote, const char *aAddress, void *pvRemoteBackend,
749 USHORT aPortVersion, ULONG aMaskedIfs);
750 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
751#endif
752
753 static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
754 PUVM pUVM,
755 const char *pcszDevice,
756 unsigned uInstance,
757 StorageBus_T enmBus,
758 bool fUseHostIOCache,
759 IMediumAttachment *aMediumAtt,
760 bool fSilent);
761 static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
762 PUVM pUVM,
763 const char *pcszDevice,
764 unsigned uInstance,
765 StorageBus_T enmBus,
766 IMediumAttachment *aMediumAtt,
767 bool fSilent);
768 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
769 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
770
771 static DECLCALLBACK(int) i_fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
772
773 static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
774
775 static DECLCALLBACK(void) i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
776 const char *pszErrorFmt, va_list va);
777
778 void i_setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
779 static DECLCALLBACK(void) i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
780 const char *pszErrorId, const char *pszFormat, va_list va);
781
782 HRESULT i_captureUSBDevices(PUVM pUVM);
783 void i_detachAllUSBDevices(bool aDone);
784
785 static DECLCALLBACK(int) i_powerUpThread(RTTHREAD Thread, void *pvUser);
786 static DECLCALLBACK(int) i_saveStateThread(RTTHREAD Thread, void *pvUser);
787 static DECLCALLBACK(int) i_powerDownThread(RTTHREAD Thread, void *pvUser);
788
789 static DECLCALLBACK(int) i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
790 static DECLCALLBACK(void) i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
791 static DECLCALLBACK(void) i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
792 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
793 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
794 static DECLCALLBACK(void) i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
795
796 static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
797 static DECLCALLBACK(void) i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
798 static DECLCALLBACK(int) i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
799 static DECLCALLBACK(void) i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
800 static DECLCALLBACK(int) i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
801
802 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
803 size_t *pcbKey);
804 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
805
806 int mcAudioRefs;
807 volatile uint32_t mcVRDPClients;
808 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
809 volatile bool mcGuestCredentialsProvided;
810
811 static const char *sSSMConsoleUnit;
812 static uint32_t sSSMConsoleVer;
813
814 HRESULT i_loadDataFromSavedState();
815 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
816
817 static DECLCALLBACK(void) i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
818 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
819
820#ifdef VBOX_WITH_GUEST_PROPS
821 static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
822 HRESULT i_doEnumerateGuestProperties(CBSTR aPatterns,
823 ComSafeArrayOut(BSTR, aNames),
824 ComSafeArrayOut(BSTR, aValues),
825 ComSafeArrayOut(LONG64, aTimestamps),
826 ComSafeArrayOut(BSTR, aFlags));
827
828 void i_guestPropertiesHandleVMReset(void);
829 bool i_guestPropertiesVRDPEnabled(void);
830 void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
831 void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
832 void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
833 void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
834 void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
835 void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
836 void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
837 void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
838#endif
839
840 bool i_isResetTurnedIntoPowerOff(void);
841
842 /** @name Disk encryption support
843 * @{ */
844 HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
845 HRESULT i_configureEncryptionForDisk(const char *pszUuid);
846 HRESULT i_clearDiskEncryptionKeysOnAllAttachments(void);
847 int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
848 char **ppszKey, char **ppszVal);
849 /** @} */
850
851 /** @name Teleporter support
852 * @{ */
853 static DECLCALLBACK(int) i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
854 HRESULT i_teleporterSrc(TeleporterStateSrc *pState);
855 HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
856 HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
857 HRESULT i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
858 Progress *pProgress, bool *pfPowerOffOnFailure);
859 static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
860 /** @} */
861
862 bool mSavedStateDataLoaded : 1;
863
864 const ComPtr<IMachine> mMachine;
865 const ComPtr<IInternalMachineControl> mControl;
866
867 const ComPtr<IVRDEServer> mVRDEServer;
868
869 ConsoleVRDPServer * const mConsoleVRDPServer;
870 bool mfVRDEChangeInProcess;
871 bool mfVRDEChangePending;
872
873 const ComObjPtr<Guest> mGuest;
874 const ComObjPtr<Keyboard> mKeyboard;
875 const ComObjPtr<Mouse> mMouse;
876 const ComObjPtr<Display> mDisplay;
877 const ComObjPtr<MachineDebugger> mDebugger;
878 const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
879 /** This can safely be used without holding any locks.
880 * An AutoCaller suffices to prevent it being destroy while in use and
881 * internally there is a lock providing the necessary serialization. */
882 const ComObjPtr<EventSource> mEventSource;
883#ifdef VBOX_WITH_EXTPACK
884 const ComObjPtr<ExtPackManager> mptrExtPackManager;
885#endif
886 const ComObjPtr<EmulatedUSB> mEmulatedUSB;
887
888 USBDeviceList mUSBDevices;
889 RemoteUSBDeviceList mRemoteUSBDevices;
890
891 SharedFolderDataMap m_mapGlobalSharedFolders;
892 SharedFolderDataMap m_mapMachineSharedFolders;
893 SharedFolderMap m_mapSharedFolders; // the console instances
894
895 /** The user mode VM handle. */
896 PUVM mpUVM;
897 /** Holds the number of "readonly" mpUVM callers (users). */
898 uint32_t mVMCallers;
899 /** Semaphore posted when the number of mpUVM callers drops to zero. */
900 RTSEMEVENT mVMZeroCallersSem;
901 /** true when Console has entered the mpUVM destruction phase. */
902 bool mVMDestroying : 1;
903 /** true when power down is initiated by vmstateChangeCallback (EMT). */
904 bool mVMPoweredOff : 1;
905 /** true when vmstateChangeCallback shouldn't initiate a power down. */
906 bool mVMIsAlreadyPoweringOff : 1;
907 /** true if we already showed the snapshot folder size warning. */
908 bool mfSnapshotFolderSizeWarningShown : 1;
909 /** true if we already showed the snapshot folder ext4/xfs bug warning. */
910 bool mfSnapshotFolderExt4WarningShown : 1;
911 /** true if we already listed the disk type of the snapshot folder. */
912 bool mfSnapshotFolderDiskTypeShown : 1;
913 /** true if a USB controller is available (i.e. USB devices can be attached). */
914 bool mfVMHasUsbController : 1;
915 /** true if the VM power off was caused by reset. */
916 bool mfPowerOffCausedByReset : 1;
917
918 /** Pointer to the VMM -> User (that's us) callbacks. */
919 struct MYVMM2USERMETHODS : public VMM2USERMETHODS
920 {
921 Console *pConsole;
922 } *mpVmm2UserMethods;
923
924 /** The current network attachment type in the VM.
925 * This doesn't have to match the network attachment type maintained in the
926 * NetworkAdapter. This is needed to change the network attachment
927 * dynamically.
928 */
929 typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
930 NetworkAttachmentTypeVector meAttachmentType;
931
932 VMMDev * m_pVMMDev;
933#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
934 AudioVRDE * const mAudioVRDE;
935#else
936 AudioSniffer * const mAudioSniffer;
937#endif
938 Nvram * const mNvram;
939#ifdef VBOX_WITH_USB_CARDREADER
940 UsbCardReader * const mUsbCardReader;
941#endif
942 BusAssignmentManager* mBusMgr;
943
944 enum
945 {
946 iLedFloppy = 0,
947 cLedFloppy = 2,
948 iLedIde = iLedFloppy + cLedFloppy,
949 cLedIde = 4,
950 iLedSata = iLedIde + cLedIde,
951 cLedSata = 30,
952 iLedScsi = iLedSata + cLedSata,
953 cLedScsi = 16,
954 iLedSas = iLedScsi + cLedScsi,
955 cLedSas = 8,
956 iLedUsb = iLedSas + cLedSas,
957 cLedUsb = 8,
958 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb
959 };
960 DeviceType_T maStorageDevType[cLedStorage];
961 PPDMLED mapStorageLeds[cLedStorage];
962 PPDMLED mapNetworkLeds[36]; /**< @todo adapt this to the maximum network card count */
963 PPDMLED mapSharedFolderLed;
964 PPDMLED mapUSBLed[2];
965 PPDMLED mapCrOglLed;
966
967 MediumAttachmentMap mapMediumAttachments;
968
969 /** List of attached USB storage devices. */
970 USBStorageDeviceList mUSBStorageDevices;
971
972 /** Map of secret keys used for disk encryption. */
973 SecretKeyMap m_mapSecretKeys;
974
975 /** Pointer to the key consumer -> provider (that's us) callbacks. */
976 struct MYPDMISECKEY : public PDMISECKEY
977 {
978 Console *pConsole;
979 } *mpIfSecKey;
980
981/* Note: FreeBSD needs this whether netflt is used or not. */
982#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
983 Utf8Str maTAPDeviceName[8];
984 RTFILE maTapFD[8];
985#endif
986
987 bool mVMStateChangeCallbackDisabled;
988
989 bool mfUseHostClipboard;
990
991 /** Local machine state value. */
992 MachineState_T mMachineState;
993
994 /** Pointer to the progress object of a live cancelable task.
995 *
996 * This is currently only used by Console::Teleport(), but is intended to later
997 * be used by the live snapshot code path as well. Actions like
998 * Console::PowerDown, which automatically cancels out the running snapshot /
999 * teleportation operation, will cancel the teleportation / live snapshot
1000 * operation before starting. */
1001 ComObjPtr<Progress> mptrCancelableProgress;
1002
1003 /* The purpose of caching of some events is probably in order to
1004 automatically fire them at new event listeners. However, there is no
1005 (longer?) any code making use of this... */
1006#ifdef CONSOLE_WITH_EVENT_CACHE
1007 struct
1008 {
1009 /** OnMousePointerShapeChange() cache */
1010 struct
1011 {
1012 bool valid;
1013 bool visible;
1014 bool alpha;
1015 uint32_t xHot;
1016 uint32_t yHot;
1017 uint32_t width;
1018 uint32_t height;
1019 com::SafeArray<BYTE> shape;
1020 } mpsc;
1021
1022 /** OnMouseCapabilityChange() cache */
1023 struct
1024 {
1025 bool valid;
1026 BOOL supportsAbsolute;
1027 BOOL supportsRelative;
1028 BOOL needsHostCursor;
1029 } mcc;
1030
1031 /** OnKeyboardLedsChange() cache */
1032 struct
1033 {
1034 bool valid;
1035 bool numLock;
1036 bool capsLock;
1037 bool scrollLock;
1038 } klc;
1039
1040 void clear()
1041 {
1042 RT_ZERO(mcc);
1043 RT_ZERO(klc);
1044
1045 /* We cannot RT_ZERO mpsc because of shape's vtable. */
1046 mpsc.shape.setNull();
1047 mpsc.valid = mpsc.visible = mpsc.alpha = false;
1048 mpsc.xHot = mpsc.yHot = mpsc.width = mpsc.height = 0;
1049 }
1050 } mCallbackData;
1051#endif
1052 ComPtr<IEventListener> mVmListener;
1053
1054 friend struct VMTask;
1055};
1056
1057#endif // !____H_CONSOLEIMPL
1058/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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