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