1 | /* $Id: ConsoleImpl.h 36991 2011-05-06 19:16:50Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Console COM Class definition
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2011 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 "SchemaDefs.h"
|
---|
23 | #include "VBox/com/array.h"
|
---|
24 | #include "EventImpl.h"
|
---|
25 |
|
---|
26 | class Guest;
|
---|
27 | class Keyboard;
|
---|
28 | class Mouse;
|
---|
29 | class Display;
|
---|
30 | class MachineDebugger;
|
---|
31 | class TeleporterStateSrc;
|
---|
32 | class OUSBDevice;
|
---|
33 | class RemoteUSBDevice;
|
---|
34 | class SharedFolder;
|
---|
35 | class VRDEServerInfo;
|
---|
36 | class AudioSniffer;
|
---|
37 | class ConsoleVRDPServer;
|
---|
38 | class VMMDev;
|
---|
39 | class Progress;
|
---|
40 | class BusAssignmentManager;
|
---|
41 | COM_STRUCT_OR_CLASS(IEventListener);
|
---|
42 | #ifdef VBOX_WITH_EXTPACK
|
---|
43 | class ExtPackManager;
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #include <VBox/RemoteDesktop/VRDE.h>
|
---|
47 | #include <VBox/vmm/pdmdrv.h>
|
---|
48 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
49 | # include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #ifdef RT_OS_WINDOWS
|
---|
53 | # include "../src-server/win/VBoxComEvents.h"
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | struct VUSBIRHCONFIG;
|
---|
57 | typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
|
---|
58 |
|
---|
59 | #include <list>
|
---|
60 |
|
---|
61 | // defines
|
---|
62 | ///////////////////////////////////////////////////////////////////////////////
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Checks the availability of the underlying VM device driver corresponding
|
---|
66 | * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
|
---|
67 | * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
|
---|
68 | * The translatable error message is defined in null context.
|
---|
69 | *
|
---|
70 | * Intended to used only within Console children (i.e. Keyboard, Mouse,
|
---|
71 | * Display, etc.).
|
---|
72 | *
|
---|
73 | * @param drv driver pointer to check (compare it with NULL)
|
---|
74 | */
|
---|
75 | #define CHECK_CONSOLE_DRV(drv) \
|
---|
76 | do { \
|
---|
77 | if (!(drv)) \
|
---|
78 | return setError(E_ACCESSDENIED, tr("The console is not powered up")); \
|
---|
79 | } while (0)
|
---|
80 |
|
---|
81 | // Console
|
---|
82 | ///////////////////////////////////////////////////////////////////////////////
|
---|
83 |
|
---|
84 | /** IConsole implementation class */
|
---|
85 | class ATL_NO_VTABLE Console :
|
---|
86 | public VirtualBoxBase,
|
---|
87 | VBOX_SCRIPTABLE_IMPL(IConsole)
|
---|
88 | {
|
---|
89 | Q_OBJECT
|
---|
90 |
|
---|
91 | public:
|
---|
92 |
|
---|
93 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Console, IConsole)
|
---|
94 |
|
---|
95 | DECLARE_NOT_AGGREGATABLE(Console)
|
---|
96 |
|
---|
97 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
98 |
|
---|
99 | BEGIN_COM_MAP(Console)
|
---|
100 | VBOX_DEFAULT_INTERFACE_ENTRIES(IConsole)
|
---|
101 | END_COM_MAP()
|
---|
102 |
|
---|
103 | Console();
|
---|
104 | ~Console();
|
---|
105 |
|
---|
106 | HRESULT FinalConstruct();
|
---|
107 | void FinalRelease();
|
---|
108 |
|
---|
109 | // public initializers/uninitializers for internal purposes only
|
---|
110 | HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl);
|
---|
111 | void uninit();
|
---|
112 |
|
---|
113 | // IConsole properties
|
---|
114 | STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
|
---|
115 | STDMETHOD(COMGETTER(State))(MachineState_T *aMachineState);
|
---|
116 | STDMETHOD(COMGETTER(Guest))(IGuest **aGuest);
|
---|
117 | STDMETHOD(COMGETTER(Keyboard))(IKeyboard **aKeyboard);
|
---|
118 | STDMETHOD(COMGETTER(Mouse))(IMouse **aMouse);
|
---|
119 | STDMETHOD(COMGETTER(Display))(IDisplay **aDisplay);
|
---|
120 | STDMETHOD(COMGETTER(Debugger))(IMachineDebugger **aDebugger);
|
---|
121 | STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IUSBDevice *, aUSBDevices));
|
---|
122 | STDMETHOD(COMGETTER(RemoteUSBDevices))(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices));
|
---|
123 | STDMETHOD(COMGETTER(VRDEServerInfo))(IVRDEServerInfo **aVRDEServerInfo);
|
---|
124 | STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
|
---|
125 | STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
|
---|
126 | STDMETHOD(COMGETTER(AttachedPciDevices))(ComSafeArrayOut(IPciDeviceAttachment *, aAttachments));
|
---|
127 |
|
---|
128 | // IConsole methods
|
---|
129 | STDMETHOD(PowerUp)(IProgress **aProgress);
|
---|
130 | STDMETHOD(PowerUpPaused)(IProgress **aProgress);
|
---|
131 | STDMETHOD(PowerDown)(IProgress **aProgress);
|
---|
132 | STDMETHOD(Reset)();
|
---|
133 | STDMETHOD(Pause)();
|
---|
134 | STDMETHOD(Resume)();
|
---|
135 | STDMETHOD(PowerButton)();
|
---|
136 | STDMETHOD(SleepButton)();
|
---|
137 | STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
|
---|
138 | STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
|
---|
139 | STDMETHOD(SaveState)(IProgress **aProgress);
|
---|
140 | STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
|
---|
141 | STDMETHOD(DiscardSavedState)(BOOL aRemoveFile);
|
---|
142 | STDMETHOD(GetDeviceActivity)(DeviceType_T aDeviceType,
|
---|
143 | DeviceActivity_T *aDeviceActivity);
|
---|
144 | STDMETHOD(AttachUSBDevice)(IN_BSTR aId);
|
---|
145 | STDMETHOD(DetachUSBDevice)(IN_BSTR aId, IUSBDevice **aDevice);
|
---|
146 | STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IUSBDevice **aDevice);
|
---|
147 | STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IUSBDevice **aDevice);
|
---|
148 | STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
|
---|
149 | STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
|
---|
150 | STDMETHOD(TakeSnapshot)(IN_BSTR aName, IN_BSTR aDescription,
|
---|
151 | IProgress **aProgress);
|
---|
152 | STDMETHOD(DeleteSnapshot)(IN_BSTR aId, IProgress **aProgress);
|
---|
153 | STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress);
|
---|
154 | STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress);
|
---|
155 |
|
---|
156 | // public methods for internal purposes only
|
---|
157 |
|
---|
158 | /*
|
---|
159 | * Note: the following methods do not increase refcount. intended to be
|
---|
160 | * called only by the VM execution thread.
|
---|
161 | */
|
---|
162 |
|
---|
163 | Guest *getGuest() const { return mGuest; }
|
---|
164 | Keyboard *getKeyboard() const { return mKeyboard; }
|
---|
165 | Mouse *getMouse() const { return mMouse; }
|
---|
166 | Display *getDisplay() const { return mDisplay; }
|
---|
167 | MachineDebugger *getMachineDebugger() const { return mDebugger; }
|
---|
168 | AudioSniffer *getAudioSniffer() const { return mAudioSniffer; }
|
---|
169 |
|
---|
170 | const ComPtr<IMachine> &machine() const { return mMachine; }
|
---|
171 |
|
---|
172 | /** Method is called only from ConsoleVRDPServer */
|
---|
173 | IVRDEServer *getVRDEServer() const { return mVRDEServer; }
|
---|
174 |
|
---|
175 | ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
|
---|
176 |
|
---|
177 | HRESULT updateMachineState(MachineState_T aMachineState);
|
---|
178 |
|
---|
179 | // events from IInternalSessionControl
|
---|
180 | HRESULT onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
|
---|
181 | HRESULT onSerialPortChange(ISerialPort *aSerialPort);
|
---|
182 | HRESULT onParallelPortChange(IParallelPort *aParallelPort);
|
---|
183 | HRESULT onStorageControllerChange();
|
---|
184 | HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
|
---|
185 | HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
|
---|
186 | HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
|
---|
187 | HRESULT onVRDEServerChange(BOOL aRestart);
|
---|
188 | HRESULT onUSBControllerChange();
|
---|
189 | HRESULT onSharedFolderChange(BOOL aGlobal);
|
---|
190 | HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
|
---|
191 | HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
|
---|
192 | HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
|
---|
193 | HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
|
---|
194 | HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
|
---|
195 | HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
|
---|
196 | HRESULT enumerateGuestProperties(IN_BSTR aPatterns,
|
---|
197 | ComSafeArrayOut(BSTR, aNames),
|
---|
198 | ComSafeArrayOut(BSTR, aValues),
|
---|
199 | ComSafeArrayOut(LONG64, aTimestamps),
|
---|
200 | ComSafeArrayOut(BSTR, aFlags));
|
---|
201 | HRESULT onlineMergeMedium(IMediumAttachment *aMediumAttachment,
|
---|
202 | ULONG aSourceIdx, ULONG aTargetIdx,
|
---|
203 | IMedium *aSource, IMedium *aTarget,
|
---|
204 | BOOL aMergeForward, IMedium *aParentForTarget,
|
---|
205 | ComSafeArrayIn(IMedium *, aChildrenToReparent),
|
---|
206 | IProgress *aProgress);
|
---|
207 | VMMDev *getVMMDev() { return m_pVMMDev; }
|
---|
208 | AudioSniffer *getAudioSniffer() { return mAudioSniffer; }
|
---|
209 | #ifdef VBOX_WITH_EXTPACK
|
---|
210 | ExtPackManager *getExtPackManager();
|
---|
211 | #endif
|
---|
212 | EventSource *getEventSource() { return mEventSource; }
|
---|
213 |
|
---|
214 | int VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
|
---|
215 | void VRDPClientConnect(uint32_t u32ClientId);
|
---|
216 | void VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
|
---|
217 | void VRDPInterceptAudio(uint32_t u32ClientId);
|
---|
218 | void VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
|
---|
219 | void VRDPInterceptClipboard(uint32_t u32ClientId);
|
---|
220 |
|
---|
221 | void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList);
|
---|
222 |
|
---|
223 | // callback callers (partly; for some events console callbacks are notified
|
---|
224 | // directly from IInternalSessionControl event handlers declared above)
|
---|
225 | void onMousePointerShapeChange(bool fVisible, bool fAlpha,
|
---|
226 | uint32_t xHot, uint32_t yHot,
|
---|
227 | uint32_t width, uint32_t height,
|
---|
228 | ComSafeArrayIn(uint8_t, aShape));
|
---|
229 | void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor);
|
---|
230 | void onStateChange(MachineState_T aMachineState);
|
---|
231 | void onAdditionsStateChange();
|
---|
232 | void onAdditionsOutdated();
|
---|
233 | void onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
234 | void onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
|
---|
235 | IVirtualBoxErrorInfo *aError);
|
---|
236 | void onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
|
---|
237 | HRESULT onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
|
---|
238 | void onVRDEServerInfoChange();
|
---|
239 |
|
---|
240 | static const PDMDRVREG DrvStatusReg;
|
---|
241 |
|
---|
242 | static HRESULT setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
|
---|
243 | HRESULT setInvalidMachineStateError();
|
---|
244 |
|
---|
245 | static HRESULT handleUnexpectedExceptions(RT_SRC_POS_DECL);
|
---|
246 |
|
---|
247 | static const char *convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
|
---|
248 | static HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
|
---|
249 | // Called from event listener
|
---|
250 | HRESULT onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
|
---|
251 | NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
|
---|
252 |
|
---|
253 | private:
|
---|
254 |
|
---|
255 | /**
|
---|
256 | * Base template for AutoVMCaller and SaveVMPtr. Template arguments
|
---|
257 | * have the same meaning as arguments of Console::addVMCaller().
|
---|
258 | */
|
---|
259 | template <bool taQuiet = false, bool taAllowNullVM = false>
|
---|
260 | class AutoVMCallerBase
|
---|
261 | {
|
---|
262 | public:
|
---|
263 | AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(S_OK)
|
---|
264 | {
|
---|
265 | Assert(aThat);
|
---|
266 | mRC = aThat->addVMCaller(taQuiet, taAllowNullVM);
|
---|
267 | }
|
---|
268 | ~AutoVMCallerBase()
|
---|
269 | {
|
---|
270 | if (SUCCEEDED(mRC))
|
---|
271 | mThat->releaseVMCaller();
|
---|
272 | }
|
---|
273 | /** Decreases the number of callers before the instance is destroyed. */
|
---|
274 | void releaseCaller()
|
---|
275 | {
|
---|
276 | AssertReturnVoid(SUCCEEDED(mRC));
|
---|
277 | mThat->releaseVMCaller();
|
---|
278 | mRC = E_FAIL;
|
---|
279 | }
|
---|
280 | /** Restores the number of callers after by #release(). #rc() must be
|
---|
281 | * rechecked to ensure the operation succeeded. */
|
---|
282 | void addYY()
|
---|
283 | {
|
---|
284 | AssertReturnVoid(!SUCCEEDED(mRC));
|
---|
285 | mRC = mThat->addVMCaller(taQuiet, taAllowNullVM);
|
---|
286 | }
|
---|
287 | /** Returns the result of Console::addVMCaller() */
|
---|
288 | HRESULT rc() const { return mRC; }
|
---|
289 | /** Shortcut to SUCCEEDED(rc()) */
|
---|
290 | bool isOk() const { return SUCCEEDED(mRC); }
|
---|
291 | protected:
|
---|
292 | Console *mThat;
|
---|
293 | HRESULT mRC;
|
---|
294 | private:
|
---|
295 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase)
|
---|
296 | };
|
---|
297 |
|
---|
298 | #if 0
|
---|
299 | /**
|
---|
300 | * Helper class that protects sections of code using the mpVM pointer by
|
---|
301 | * automatically calling addVMCaller() on construction and
|
---|
302 | * releaseVMCaller() on destruction. Intended for Console methods dealing
|
---|
303 | * with mpVM. The usage pattern is:
|
---|
304 | * <code>
|
---|
305 | * AutoVMCaller autoVMCaller(this);
|
---|
306 | * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
|
---|
307 | * ...
|
---|
308 | * VMR3ReqCall (mpVM, ...
|
---|
309 | * </code>
|
---|
310 | *
|
---|
311 | * @note Temporarily locks the argument for writing.
|
---|
312 | *
|
---|
313 | * @sa SafeVMPtr, SafeVMPtrQuiet
|
---|
314 | * @obsolete Use SafeVMPtr
|
---|
315 | */
|
---|
316 | typedef AutoVMCallerBase<false, false> AutoVMCaller;
|
---|
317 | #endif
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * Same as AutoVMCaller but doesn't set extended error info on failure.
|
---|
321 | *
|
---|
322 | * @note Temporarily locks the argument for writing.
|
---|
323 | * @obsolete Use SafeVMPtrQuiet
|
---|
324 | */
|
---|
325 | typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
|
---|
329 | * instead of assertion).
|
---|
330 | *
|
---|
331 | * @note Temporarily locks the argument for writing.
|
---|
332 | * @obsolete Use SafeVMPtr
|
---|
333 | */
|
---|
334 | typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
|
---|
335 |
|
---|
336 | /**
|
---|
337 | * Same as AutoVMCaller but doesn't set extended error info on failure
|
---|
338 | * and allows a null VM pointer (to trigger an error instead of
|
---|
339 | * assertion).
|
---|
340 | *
|
---|
341 | * @note Temporarily locks the argument for writing.
|
---|
342 | * @obsolete Use SafeVMPtrQuiet
|
---|
343 | */
|
---|
344 | typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * Base template for SaveVMPtr and SaveVMPtrQuiet.
|
---|
348 | */
|
---|
349 | template<bool taQuiet = false>
|
---|
350 | class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
|
---|
351 | {
|
---|
352 | typedef AutoVMCallerBase<taQuiet, true> Base;
|
---|
353 | public:
|
---|
354 | SafeVMPtrBase(Console *aThat) : Base(aThat), mpVM(NULL), mpUVM(NULL)
|
---|
355 | {
|
---|
356 | if (SUCCEEDED(Base::mRC))
|
---|
357 | Base::mRC = aThat->safeVMPtrRetainer(&mpVM, &mpUVM, taQuiet);
|
---|
358 | }
|
---|
359 | ~SafeVMPtrBase()
|
---|
360 | {
|
---|
361 | if (SUCCEEDED(Base::mRC))
|
---|
362 | release();
|
---|
363 | }
|
---|
364 | /** Smart SaveVMPtr to PVM cast operator */
|
---|
365 | operator PVM() const { return mpVM; }
|
---|
366 | /** Direct PVM access for printf()-like functions */
|
---|
367 | PVM raw() const { return mpVM; }
|
---|
368 | /** Direct PUVM access for printf()-like functions */
|
---|
369 | PUVM rawUVM() const { return mpUVM; }
|
---|
370 | /** Release the handles. */
|
---|
371 | void release()
|
---|
372 | {
|
---|
373 | AssertReturnVoid(SUCCEEDED(Base::mRC));
|
---|
374 | Base::mThat->safeVMPtrReleaser(&mpVM, &mpUVM);
|
---|
375 | Base::releaseCaller();
|
---|
376 | }
|
---|
377 |
|
---|
378 | private:
|
---|
379 | PVM mpVM;
|
---|
380 | PUVM mpUVM;
|
---|
381 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
|
---|
382 | };
|
---|
383 |
|
---|
384 | public:
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * Helper class that safely manages the Console::mpVM pointer
|
---|
388 | * by calling addVMCaller() on construction and releaseVMCaller() on
|
---|
389 | * destruction. Intended for Console children. The usage pattern is:
|
---|
390 | * <code>
|
---|
391 | * Console::SaveVMPtr pVM(mParent);
|
---|
392 | * if (FAILED(pVM.rc())) return pVM.rc();
|
---|
393 | * ...
|
---|
394 | * VMR3ReqCall(pVM, ...
|
---|
395 | * ...
|
---|
396 | * printf("%p\n", pVM.raw());
|
---|
397 | * </code>
|
---|
398 | *
|
---|
399 | * @note Temporarily locks the argument for writing.
|
---|
400 | *
|
---|
401 | * @sa SafeVMPtrQuiet, AutoVMCaller
|
---|
402 | */
|
---|
403 | typedef SafeVMPtrBase<false> SafeVMPtr;
|
---|
404 |
|
---|
405 | /**
|
---|
406 | * A deviation of SaveVMPtr that doesn't set the error info on failure.
|
---|
407 | * Intended for pieces of code that don't need to return the VM access
|
---|
408 | * failure to the caller. The usage pattern is:
|
---|
409 | * <code>
|
---|
410 | * Console::SaveVMPtrQuiet pVM(mParent);
|
---|
411 | * if (pVM.rc())
|
---|
412 | * VMR3ReqCall(pVM, ...
|
---|
413 | * return S_OK;
|
---|
414 | * </code>
|
---|
415 | *
|
---|
416 | * @note Temporarily locks the argument for writing.
|
---|
417 | *
|
---|
418 | * @sa SafeVMPtr, AutoVMCaller
|
---|
419 | */
|
---|
420 | typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
|
---|
421 |
|
---|
422 | class SharedFolderData
|
---|
423 | {
|
---|
424 | public:
|
---|
425 | SharedFolderData()
|
---|
426 | { }
|
---|
427 |
|
---|
428 | SharedFolderData(const Utf8Str &aHostPath,
|
---|
429 | bool aWritable,
|
---|
430 | bool aAutoMount)
|
---|
431 | : m_strHostPath(aHostPath),
|
---|
432 | m_fWritable(aWritable),
|
---|
433 | m_fAutoMount(aAutoMount)
|
---|
434 | { }
|
---|
435 |
|
---|
436 | // copy constructor
|
---|
437 | SharedFolderData(const SharedFolderData& aThat)
|
---|
438 | : m_strHostPath(aThat.m_strHostPath),
|
---|
439 | m_fWritable(aThat.m_fWritable),
|
---|
440 | m_fAutoMount(aThat.m_fAutoMount)
|
---|
441 | { }
|
---|
442 |
|
---|
443 | Utf8Str m_strHostPath;
|
---|
444 | bool m_fWritable;
|
---|
445 | bool m_fAutoMount;
|
---|
446 | };
|
---|
447 |
|
---|
448 | typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
|
---|
449 | typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
|
---|
450 |
|
---|
451 | private:
|
---|
452 |
|
---|
453 | typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
|
---|
454 | typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
|
---|
455 |
|
---|
456 | HRESULT addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
|
---|
457 | void releaseVMCaller();
|
---|
458 | HRESULT safeVMPtrRetainer(PVM *a_ppVM, PUVM *a_ppUVM, bool aQuiet);
|
---|
459 | void safeVMPtrReleaser(PVM *a_ppVM, PUVM *a_ppUVM);
|
---|
460 |
|
---|
461 | HRESULT consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
|
---|
462 |
|
---|
463 | HRESULT powerUp(IProgress **aProgress, bool aPaused);
|
---|
464 | HRESULT powerDown(IProgress *aProgress = NULL);
|
---|
465 |
|
---|
466 | /* Note: FreeBSD needs this whether netflt is used or not. */
|
---|
467 | #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
|
---|
468 | HRESULT attachToTapInterface(INetworkAdapter *networkAdapter);
|
---|
469 | HRESULT detachFromTapInterface(INetworkAdapter *networkAdapter);
|
---|
470 | #endif
|
---|
471 | HRESULT powerDownHostInterfaces();
|
---|
472 |
|
---|
473 | HRESULT setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
|
---|
474 | HRESULT setMachineStateLocally(MachineState_T aMachineState)
|
---|
475 | {
|
---|
476 | return setMachineState(aMachineState, false /* aUpdateServer */);
|
---|
477 | }
|
---|
478 |
|
---|
479 | HRESULT findSharedFolder(const Utf8Str &strName,
|
---|
480 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
481 | bool aSetError = false);
|
---|
482 |
|
---|
483 | HRESULT fetchSharedFolders(BOOL aGlobal);
|
---|
484 | bool findOtherSharedFolder(const Utf8Str &straName,
|
---|
485 | SharedFolderDataMap::const_iterator &aIt);
|
---|
486 |
|
---|
487 | HRESULT createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
|
---|
488 | HRESULT removeSharedFolder(const Utf8Str &strName);
|
---|
489 |
|
---|
490 | static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
|
---|
491 | int configConstructorInner(PVM pVM, AutoWriteLock *pAlock);
|
---|
492 | int configCfgmOverlay(PVM pVM, IVirtualBox *pVirtualBox, IMachine *pMachine);
|
---|
493 |
|
---|
494 | int configMediumAttachment(PCFGMNODE pCtlInst,
|
---|
495 | const char *pcszDevice,
|
---|
496 | unsigned uInstance,
|
---|
497 | StorageBus_T enmBus,
|
---|
498 | bool fUseHostIOCache,
|
---|
499 | bool fBuiltinIoCache,
|
---|
500 | bool fSetupMerge,
|
---|
501 | unsigned uMergeSource,
|
---|
502 | unsigned uMergeTarget,
|
---|
503 | IMediumAttachment *pMediumAtt,
|
---|
504 | MachineState_T aMachineState,
|
---|
505 | HRESULT *phrc,
|
---|
506 | bool fAttachDetach,
|
---|
507 | bool fForceUnmount,
|
---|
508 | bool fHotplug,
|
---|
509 | PVM pVM,
|
---|
510 | DeviceType_T *paLedDevType);
|
---|
511 | int configMedium(PCFGMNODE pLunL0,
|
---|
512 | bool fPassthrough,
|
---|
513 | DeviceType_T enmType,
|
---|
514 | bool fUseHostIOCache,
|
---|
515 | bool fBuiltinIoCache,
|
---|
516 | bool fSetupMerge,
|
---|
517 | unsigned uMergeSource,
|
---|
518 | unsigned uMergeTarget,
|
---|
519 | const char *pcszBwGroup,
|
---|
520 | IMedium *pMedium,
|
---|
521 | MachineState_T aMachineState,
|
---|
522 | HRESULT *phrc);
|
---|
523 | static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pConsole,
|
---|
524 | PVM pVM,
|
---|
525 | const char *pcszDevice,
|
---|
526 | unsigned uInstance,
|
---|
527 | StorageBus_T enmBus,
|
---|
528 | bool fUseHostIOCache,
|
---|
529 | bool fBuiltinIoCache,
|
---|
530 | bool fSetupMerge,
|
---|
531 | unsigned uMergeSource,
|
---|
532 | unsigned uMergeTarget,
|
---|
533 | IMediumAttachment *aMediumAtt,
|
---|
534 | MachineState_T aMachineState,
|
---|
535 | HRESULT *phrc);
|
---|
536 | static DECLCALLBACK(int) changeRemovableMedium(Console *pThis,
|
---|
537 | PVM pVM,
|
---|
538 | const char *pcszDevice,
|
---|
539 | unsigned uInstance,
|
---|
540 | StorageBus_T enmBus,
|
---|
541 | bool fUseHostIOCache,
|
---|
542 | IMediumAttachment *aMediumAtt,
|
---|
543 | bool fForce);
|
---|
544 |
|
---|
545 | int configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
|
---|
546 | INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
|
---|
547 | PCFGMNODE pLunL0, PCFGMNODE pInst,
|
---|
548 | bool fAttachDetach, bool fIgnoreConnectFailure);
|
---|
549 |
|
---|
550 | static DECLCALLBACK(int) configGuestProperties(void *pvConsole);
|
---|
551 | static DECLCALLBACK(int) configGuestControl(void *pvConsole);
|
---|
552 | static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
|
---|
553 | VMSTATE aOldState, void *aUser);
|
---|
554 | static DECLCALLBACK(int) unplugCpu(Console *pThis, PVM pVM, unsigned uCpu);
|
---|
555 | static DECLCALLBACK(int) plugCpu(Console *pThis, PVM pVM, unsigned uCpu);
|
---|
556 | HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PVM pVM);
|
---|
557 | HRESULT doCPURemove(ULONG aCpu, PVM pVM);
|
---|
558 | HRESULT doCPUAdd(ULONG aCpu, PVM pVM);
|
---|
559 |
|
---|
560 | HRESULT doNetworkAdapterChange(PVM pVM, const char *pszDevice, unsigned uInstance,
|
---|
561 | unsigned uLun, INetworkAdapter *aNetworkAdapter);
|
---|
562 | static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PVM pVM, const char *pszDevice,
|
---|
563 | unsigned uInstance, unsigned uLun,
|
---|
564 | INetworkAdapter *aNetworkAdapter);
|
---|
565 |
|
---|
566 | #ifdef VBOX_WITH_USB
|
---|
567 | HRESULT attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
|
---|
568 | HRESULT detachUSBDevice(USBDeviceList::iterator &aIt);
|
---|
569 |
|
---|
570 | static DECLCALLBACK(int) usbAttachCallback(Console *that, PVM pVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
|
---|
571 | bool aRemote, const char *aAddress, ULONG aMaskedIfs);
|
---|
572 | static DECLCALLBACK(int) usbDetachCallback(Console *that, PVM pVM, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
|
---|
573 | #endif
|
---|
574 |
|
---|
575 | static DECLCALLBACK(int) attachStorageDevice(Console *pThis,
|
---|
576 | PVM pVM,
|
---|
577 | const char *pcszDevice,
|
---|
578 | unsigned uInstance,
|
---|
579 | StorageBus_T enmBus,
|
---|
580 | bool fUseHostIOCache,
|
---|
581 | IMediumAttachment *aMediumAtt);
|
---|
582 | static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
|
---|
583 | PVM pVM,
|
---|
584 | const char *pcszDevice,
|
---|
585 | unsigned uInstance,
|
---|
586 | StorageBus_T enmBus,
|
---|
587 | IMediumAttachment *aMediumAtt);
|
---|
588 | HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PVM pVM);
|
---|
589 | HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PVM pVM);
|
---|
590 |
|
---|
591 | static DECLCALLBACK(int) fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
|
---|
592 |
|
---|
593 | static DECLCALLBACK(int) stateProgressCallback(PVM pVM, unsigned uPercent, void *pvUser);
|
---|
594 |
|
---|
595 | static DECLCALLBACK(void) genericVMSetErrorCallback(PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
|
---|
596 | const char *pszErrorFmt, va_list va);
|
---|
597 |
|
---|
598 | static void setVMRuntimeErrorCallbackF(PVM pVM, void *pvUser, uint32_t fFatal,
|
---|
599 | const char *pszErrorId, const char *pszFormat, ...);
|
---|
600 | static DECLCALLBACK(void) setVMRuntimeErrorCallback(PVM pVM, void *pvUser, uint32_t fFatal,
|
---|
601 | const char *pszErrorId, const char *pszFormat, va_list va);
|
---|
602 |
|
---|
603 | HRESULT captureUSBDevices(PVM pVM);
|
---|
604 | void detachAllUSBDevices(bool aDone);
|
---|
605 |
|
---|
606 | static DECLCALLBACK(int) powerUpThread(RTTHREAD Thread, void *pvUser);
|
---|
607 | static DECLCALLBACK(int) saveStateThread(RTTHREAD Thread, void *pvUser);
|
---|
608 | static DECLCALLBACK(int) powerDownThread(RTTHREAD Thread, void *pvUser);
|
---|
609 |
|
---|
610 | static DECLCALLBACK(int) vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
611 | static DECLCALLBACK(void) vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
|
---|
612 | static DECLCALLBACK(void) vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
|
---|
613 | static DECLCALLBACK(void) vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
614 | static DECLCALLBACK(void) vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
615 |
|
---|
616 | static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
617 | static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
|
---|
618 | static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
|
---|
619 | static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
620 |
|
---|
621 | int mcAudioRefs;
|
---|
622 | volatile uint32_t mcVRDPClients;
|
---|
623 | uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
|
---|
624 | volatile bool mcGuestCredentialsProvided;
|
---|
625 |
|
---|
626 | static const char *sSSMConsoleUnit;
|
---|
627 | static uint32_t sSSMConsoleVer;
|
---|
628 |
|
---|
629 | HRESULT loadDataFromSavedState();
|
---|
630 | int loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
631 |
|
---|
632 | static DECLCALLBACK(void) saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
|
---|
633 | static DECLCALLBACK(int) loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
|
---|
634 |
|
---|
635 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
636 | static DECLCALLBACK(int) doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
|
---|
637 | HRESULT doEnumerateGuestProperties(CBSTR aPatterns,
|
---|
638 | ComSafeArrayOut(BSTR, aNames),
|
---|
639 | ComSafeArrayOut(BSTR, aValues),
|
---|
640 | ComSafeArrayOut(LONG64, aTimestamps),
|
---|
641 | ComSafeArrayOut(BSTR, aFlags));
|
---|
642 |
|
---|
643 | void guestPropertiesHandleVMReset(void);
|
---|
644 | bool guestPropertiesVRDPEnabled(void);
|
---|
645 | void guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
|
---|
646 | void guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
|
---|
647 | #endif
|
---|
648 |
|
---|
649 | /** @name Teleporter support
|
---|
650 | * @{ */
|
---|
651 | static DECLCALLBACK(int) teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
|
---|
652 | HRESULT teleporterSrc(TeleporterStateSrc *pState);
|
---|
653 | HRESULT teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
|
---|
654 | HRESULT teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
|
---|
655 | HRESULT teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
|
---|
656 | Progress *pProgress, bool *pfPowerOffOnFailure);
|
---|
657 | static DECLCALLBACK(int) teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
|
---|
658 | /** @} */
|
---|
659 |
|
---|
660 | bool mSavedStateDataLoaded : 1;
|
---|
661 |
|
---|
662 | const ComPtr<IMachine> mMachine;
|
---|
663 | const ComPtr<IInternalMachineControl> mControl;
|
---|
664 |
|
---|
665 | const ComPtr<IVRDEServer> mVRDEServer;
|
---|
666 |
|
---|
667 | ConsoleVRDPServer * const mConsoleVRDPServer;
|
---|
668 |
|
---|
669 | const ComObjPtr<Guest> mGuest;
|
---|
670 | const ComObjPtr<Keyboard> mKeyboard;
|
---|
671 | const ComObjPtr<Mouse> mMouse;
|
---|
672 | const ComObjPtr<Display> mDisplay;
|
---|
673 | const ComObjPtr<MachineDebugger> mDebugger;
|
---|
674 | const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
|
---|
675 | const ComObjPtr<EventSource> mEventSource;
|
---|
676 | #ifdef VBOX_WITH_EXTPACK
|
---|
677 | const ComObjPtr<ExtPackManager> mptrExtPackManager;
|
---|
678 | #endif
|
---|
679 |
|
---|
680 | USBDeviceList mUSBDevices;
|
---|
681 | RemoteUSBDeviceList mRemoteUSBDevices;
|
---|
682 |
|
---|
683 | SharedFolderDataMap m_mapGlobalSharedFolders;
|
---|
684 | SharedFolderDataMap m_mapMachineSharedFolders;
|
---|
685 | SharedFolderMap m_mapSharedFolders; // the console instances
|
---|
686 |
|
---|
687 | /** The user mode VM handle. */
|
---|
688 | PUVM mpUVM;
|
---|
689 | /** Holds the number of "readonly" mpVM callers (users) */
|
---|
690 | uint32_t mVMCallers;
|
---|
691 | /** Semaphore posted when the number of mpVM callers drops to zero */
|
---|
692 | RTSEMEVENT mVMZeroCallersSem;
|
---|
693 | /** true when Console has entered the mpVM destruction phase */
|
---|
694 | bool mVMDestroying : 1;
|
---|
695 | /** true when power down is initiated by vmstateChangeCallback (EMT) */
|
---|
696 | bool mVMPoweredOff : 1;
|
---|
697 | /** true when vmstateChangeCallback shouldn't initiate a power down. */
|
---|
698 | bool mVMIsAlreadyPoweringOff : 1;
|
---|
699 | /** true if we already showed the snapshot folder size warning. */
|
---|
700 | bool mfSnapshotFolderSizeWarningShown : 1;
|
---|
701 | /** true if we already showed the snapshot folder ext4/xfs bug warning. */
|
---|
702 | bool mfSnapshotFolderExt4WarningShown : 1;
|
---|
703 | /** true if we already listed the disk type of the snapshot folder. */
|
---|
704 | bool mfSnapshotFolderDiskTypeShown : 1;
|
---|
705 |
|
---|
706 | /** Pointer to the VMM -> User (that's us) callbacks. */
|
---|
707 | struct MYVMM2USERMETHODS : public VMM2USERMETHODS
|
---|
708 | {
|
---|
709 | Console *pConsole;
|
---|
710 | } *mpVmm2UserMethods;
|
---|
711 |
|
---|
712 | /** The current network attachment type in the VM.
|
---|
713 | * This doesn't have to match the network attachment type maintained in the
|
---|
714 | * NetworkAdapter. This is needed to change the network attachment
|
---|
715 | * dynamically.
|
---|
716 | */
|
---|
717 | NetworkAttachmentType_T meAttachmentType[SchemaDefs::NetworkAdapterCount];
|
---|
718 |
|
---|
719 | VMMDev * m_pVMMDev;
|
---|
720 | AudioSniffer * const mAudioSniffer;
|
---|
721 | BusAssignmentManager* mBusMgr;
|
---|
722 |
|
---|
723 | enum
|
---|
724 | {
|
---|
725 | iLedFloppy = 0,
|
---|
726 | cLedFloppy = 1,
|
---|
727 | iLedIde = iLedFloppy + cLedFloppy,
|
---|
728 | cLedIde = 4,
|
---|
729 | iLedSata = iLedIde + cLedIde,
|
---|
730 | cLedSata = 30,
|
---|
731 | iLedScsi = iLedSata + cLedSata,
|
---|
732 | cLedScsi = 16,
|
---|
733 | iLedSas = iLedScsi + cLedScsi,
|
---|
734 | cLedSas = 8,
|
---|
735 | cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas
|
---|
736 | };
|
---|
737 | DeviceType_T maStorageDevType[cLedStorage];
|
---|
738 | PPDMLED mapStorageLeds[cLedStorage];
|
---|
739 | PPDMLED mapNetworkLeds[SchemaDefs::NetworkAdapterCount];
|
---|
740 | PPDMLED mapSharedFolderLed;
|
---|
741 | PPDMLED mapUSBLed[2];
|
---|
742 | /* Note: FreeBSD needs this whether netflt is used or not. */
|
---|
743 | #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
|
---|
744 | Utf8Str maTAPDeviceName[8];
|
---|
745 | RTFILE maTapFD[8];
|
---|
746 | #endif
|
---|
747 |
|
---|
748 | bool mVMStateChangeCallbackDisabled;
|
---|
749 |
|
---|
750 | /** Local machine state value. */
|
---|
751 | MachineState_T mMachineState;
|
---|
752 |
|
---|
753 | /** Pointer to the progress object of a live cancelable task.
|
---|
754 | *
|
---|
755 | * This is currently only used by Console::Teleport(), but is intended to later
|
---|
756 | * be used by the live snapshot code path as well. Actions like
|
---|
757 | * Console::PowerDown, which automatically cancels out the running snapshot /
|
---|
758 | * teleportation operation, will cancel the teleportation / live snapshot
|
---|
759 | * operation before starting. */
|
---|
760 | ComObjPtr<Progress> mptrCancelableProgress;
|
---|
761 |
|
---|
762 | struct
|
---|
763 | {
|
---|
764 | /** OnMousePointerShapeChange() cache */
|
---|
765 | struct
|
---|
766 | {
|
---|
767 | bool valid;
|
---|
768 | bool visible;
|
---|
769 | bool alpha;
|
---|
770 | uint32_t xHot;
|
---|
771 | uint32_t yHot;
|
---|
772 | uint32_t width;
|
---|
773 | uint32_t height;
|
---|
774 | com::SafeArray<BYTE> shape;
|
---|
775 | }
|
---|
776 | mpsc;
|
---|
777 |
|
---|
778 | /** OnMouseCapabilityChange() cache */
|
---|
779 | struct
|
---|
780 | {
|
---|
781 | bool valid;
|
---|
782 | BOOL supportsAbsolute;
|
---|
783 | BOOL supportsRelative;
|
---|
784 | BOOL needsHostCursor;
|
---|
785 | }
|
---|
786 | mcc;
|
---|
787 |
|
---|
788 | /** OnKeyboardLedsChange() cache */
|
---|
789 | struct
|
---|
790 | {
|
---|
791 | bool valid;
|
---|
792 | bool numLock;
|
---|
793 | bool capsLock;
|
---|
794 | bool scrollLock;
|
---|
795 | }
|
---|
796 | klc;
|
---|
797 |
|
---|
798 | void clear()
|
---|
799 | {
|
---|
800 | /* We cannot do memset() on mpsc to avoid cleaning shape's vtable */
|
---|
801 | mpsc.shape.setNull();
|
---|
802 | mpsc.valid = mpsc.visible = mpsc.alpha = false;
|
---|
803 | mpsc.xHot = mpsc.yHot = mpsc.width = mpsc.height = 0;
|
---|
804 | ::memset(&mcc, 0, sizeof mcc);
|
---|
805 | ::memset(&klc, 0, sizeof klc);
|
---|
806 | }
|
---|
807 | }
|
---|
808 | mCallbackData;
|
---|
809 | ComPtr<IEventListener> mVmListener;
|
---|
810 |
|
---|
811 | friend struct VMTask;
|
---|
812 | };
|
---|
813 |
|
---|
814 | #endif // !____H_CONSOLEIMPL
|
---|
815 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|