1 | /* $Id: ConsoleImpl.h 94804 2022-05-04 08:02:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Console COM Class definition
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2005-2022 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 MAIN_INCLUDED_ConsoleImpl_h
|
---|
19 | #define MAIN_INCLUDED_ConsoleImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "VirtualBoxBase.h"
|
---|
25 | #include "VBox/com/array.h"
|
---|
26 | #include "EventImpl.h"
|
---|
27 | #include "SecretKeyStore.h"
|
---|
28 | #include "ConsoleWrap.h"
|
---|
29 | #ifdef VBOX_WITH_RECORDING
|
---|
30 | # include "Recording.h"
|
---|
31 | #endif
|
---|
32 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
33 | #include "CloudGateway.h"
|
---|
34 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
35 |
|
---|
36 | class Guest;
|
---|
37 | class Keyboard;
|
---|
38 | class Mouse;
|
---|
39 | class Display;
|
---|
40 | class MachineDebugger;
|
---|
41 | class TeleporterStateSrc;
|
---|
42 | class OUSBDevice;
|
---|
43 | class RemoteUSBDevice;
|
---|
44 | class SharedFolder;
|
---|
45 | class VRDEServerInfo;
|
---|
46 | class EmulatedUSB;
|
---|
47 | class AudioVRDE;
|
---|
48 | #ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
49 | class AudioVideoRec;
|
---|
50 | #endif
|
---|
51 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
52 | class UsbCardReader;
|
---|
53 | #endif
|
---|
54 | class ConsoleVRDPServer;
|
---|
55 | class VMMDev;
|
---|
56 | class Progress;
|
---|
57 | class BusAssignmentManager;
|
---|
58 | COM_STRUCT_OR_CLASS(IEventListener);
|
---|
59 | #ifdef VBOX_WITH_EXTPACK
|
---|
60 | class ExtPackManager;
|
---|
61 | #endif
|
---|
62 | class VMMDevMouseInterface;
|
---|
63 | class DisplayMouseInterface;
|
---|
64 | class VMPowerUpTask;
|
---|
65 | class VMPowerDownTask;
|
---|
66 | class NvramStore;
|
---|
67 |
|
---|
68 | #include <iprt/uuid.h>
|
---|
69 | #include <iprt/log.h>
|
---|
70 | #include <iprt/memsafer.h>
|
---|
71 | #include <VBox/RemoteDesktop/VRDE.h>
|
---|
72 | #include <VBox/vmm/pdmdrv.h>
|
---|
73 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
74 | # include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
|
---|
75 | #endif
|
---|
76 | #ifdef VBOX_WITH_USB
|
---|
77 | # include <VBox/vrdpusb.h>
|
---|
78 | #endif
|
---|
79 | #include <VBox/VBoxCryptoIf.h>
|
---|
80 |
|
---|
81 | #if defined(VBOX_WITH_GUEST_PROPS) || defined(VBOX_WITH_SHARED_CLIPBOARD) \
|
---|
82 | || defined(VBOX_WITH_DRAG_AND_DROP)
|
---|
83 | # include "HGCM.h" /** @todo It should be possible to register a service
|
---|
84 | * extension using a VMMDev callback. */
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | struct VUSBIRHCONFIG;
|
---|
88 | typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
|
---|
89 |
|
---|
90 | #include <list>
|
---|
91 | #include <vector>
|
---|
92 |
|
---|
93 | // defines
|
---|
94 | ///////////////////////////////////////////////////////////////////////////////
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Checks the availability of the underlying VM device driver corresponding
|
---|
98 | * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
|
---|
99 | * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
|
---|
100 | * The translatable error message is defined in null context.
|
---|
101 | *
|
---|
102 | * Intended to used only within Console children (i.e. Keyboard, Mouse,
|
---|
103 | * Display, etc.).
|
---|
104 | *
|
---|
105 | * @param drv driver pointer to check (compare it with NULL)
|
---|
106 | */
|
---|
107 | #define CHECK_CONSOLE_DRV(drv) \
|
---|
108 | do { \
|
---|
109 | if (!!(drv)) {} \
|
---|
110 | else return setError(E_ACCESSDENIED, Console::tr("The console is not powered up (%Rfn)"), __FUNCTION__); \
|
---|
111 | } while (0)
|
---|
112 |
|
---|
113 | // Console
|
---|
114 | ///////////////////////////////////////////////////////////////////////////////
|
---|
115 |
|
---|
116 | class ConsoleMouseInterface
|
---|
117 | {
|
---|
118 | public:
|
---|
119 | virtual ~ConsoleMouseInterface() { }
|
---|
120 | virtual VMMDevMouseInterface *i_getVMMDevMouseInterface(){return NULL;}
|
---|
121 | virtual DisplayMouseInterface *i_getDisplayMouseInterface(){return NULL;}
|
---|
122 | virtual void i_onMouseCapabilityChange(BOOL supportsAbsolute,
|
---|
123 | BOOL supportsRelative,
|
---|
124 | BOOL supportsMT,
|
---|
125 | BOOL needsHostCursor){NOREF(supportsAbsolute); NOREF(supportsRelative); NOREF(supportsMT); NOREF(needsHostCursor);}
|
---|
126 | };
|
---|
127 |
|
---|
128 | /** IConsole implementation class */
|
---|
129 | class ATL_NO_VTABLE Console :
|
---|
130 | public ConsoleWrap,
|
---|
131 | public ConsoleMouseInterface
|
---|
132 | {
|
---|
133 |
|
---|
134 | public:
|
---|
135 |
|
---|
136 | DECLARE_COMMON_CLASS_METHODS(Console)
|
---|
137 |
|
---|
138 | HRESULT FinalConstruct();
|
---|
139 | void FinalRelease();
|
---|
140 |
|
---|
141 | // public initializers/uninitializers for internal purposes only
|
---|
142 | HRESULT initWithMachine(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);
|
---|
143 | void uninit();
|
---|
144 |
|
---|
145 |
|
---|
146 | // public methods for internal purposes only
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Note: the following methods do not increase refcount. intended to be
|
---|
150 | * called only by the VM execution thread.
|
---|
151 | */
|
---|
152 |
|
---|
153 | PCVMMR3VTABLE i_getVMMVTable() const RT_NOEXCEPT { return mpVMM; }
|
---|
154 | Guest *i_getGuest() const { return mGuest; }
|
---|
155 | Keyboard *i_getKeyboard() const { return mKeyboard; }
|
---|
156 | Mouse *i_getMouse() const { return mMouse; }
|
---|
157 | Display *i_getDisplay() const { return mDisplay; }
|
---|
158 | MachineDebugger *i_getMachineDebugger() const { return mDebugger; }
|
---|
159 | #ifdef VBOX_WITH_AUDIO_VRDE
|
---|
160 | AudioVRDE *i_getAudioVRDE() const { return mAudioVRDE; }
|
---|
161 | #endif
|
---|
162 | #ifdef VBOX_WITH_RECORDING
|
---|
163 | int i_recordingCreate(void);
|
---|
164 | void i_recordingDestroy(void);
|
---|
165 | int i_recordingEnable(BOOL fEnable, util::AutoWriteLock *pAutoLock);
|
---|
166 | int i_recordingGetSettings(settings::RecordingSettings &Settings);
|
---|
167 | int i_recordingStart(util::AutoWriteLock *pAutoLock = NULL);
|
---|
168 | int i_recordingStop(util::AutoWriteLock *pAutoLock = NULL);
|
---|
169 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
170 | AudioVideoRec *i_recordingGetAudioDrv(void) const { return mRecording.mAudioRec; }
|
---|
171 | # endif
|
---|
172 | RecordingContext *i_recordingGetContext(void) const { return mRecording.mpCtx; }
|
---|
173 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
174 | HRESULT i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs);
|
---|
175 | # endif
|
---|
176 | #endif
|
---|
177 |
|
---|
178 | const ComPtr<IMachine> &i_machine() const { return mMachine; }
|
---|
179 | const Bstr &i_getId() const { return mstrUuid; }
|
---|
180 |
|
---|
181 | bool i_useHostClipboard() { return mfUseHostClipboard; }
|
---|
182 |
|
---|
183 | /** Method is called only from ConsoleVRDPServer */
|
---|
184 | IVRDEServer *i_getVRDEServer() const { return mVRDEServer; }
|
---|
185 |
|
---|
186 | ConsoleVRDPServer *i_consoleVRDPServer() const { return mConsoleVRDPServer; }
|
---|
187 |
|
---|
188 | HRESULT i_updateMachineState(MachineState_T aMachineState);
|
---|
189 | HRESULT i_getNominalState(MachineState_T &aNominalState);
|
---|
190 | Utf8Str i_getAudioAdapterDeviceName(IAudioAdapter *aAudioAdapter);
|
---|
191 |
|
---|
192 | // events from IInternalSessionControl
|
---|
193 | HRESULT i_onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
|
---|
194 | HRESULT i_onAudioAdapterChange(IAudioAdapter *aAudioAdapter);
|
---|
195 | HRESULT i_onSerialPortChange(ISerialPort *aSerialPort);
|
---|
196 | HRESULT i_onParallelPortChange(IParallelPort *aParallelPort);
|
---|
197 | HRESULT i_onStorageControllerChange(const com::Guid& aMachineId, const com::Utf8Str& aControllerName);
|
---|
198 | HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
|
---|
199 | HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
|
---|
200 | HRESULT i_onCPUExecutionCapChange(ULONG aExecutionCap);
|
---|
201 | HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
|
---|
202 | HRESULT i_onClipboardFileTransferModeChange(bool aEnabled);
|
---|
203 | HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
|
---|
204 | HRESULT i_onVRDEServerChange(BOOL aRestart);
|
---|
205 | HRESULT i_onRecordingChange(BOOL fEnable);
|
---|
206 | HRESULT i_onUSBControllerChange();
|
---|
207 | HRESULT i_onSharedFolderChange(BOOL aGlobal);
|
---|
208 | HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs,
|
---|
209 | const Utf8Str &aCaptureFilename);
|
---|
210 | HRESULT i_onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
|
---|
211 | HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
|
---|
212 | HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
|
---|
213 | HRESULT i_onExtraDataChange(const Bstr &aMachineId, const Bstr &aKey, const Bstr &aVal);
|
---|
214 |
|
---|
215 | HRESULT i_getGuestProperty(const Utf8Str &aName, Utf8Str *aValue, LONG64 *aTimestamp, Utf8Str *aFlags);
|
---|
216 | HRESULT i_setGuestProperty(const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags);
|
---|
217 | HRESULT i_deleteGuestProperty(const Utf8Str &aName);
|
---|
218 | HRESULT i_enumerateGuestProperties(const Utf8Str &aPatterns,
|
---|
219 | std::vector<Utf8Str> &aNames,
|
---|
220 | std::vector<Utf8Str> &aValues,
|
---|
221 | std::vector<LONG64> &aTimestamps,
|
---|
222 | std::vector<Utf8Str> &aFlags);
|
---|
223 | HRESULT i_onlineMergeMedium(IMediumAttachment *aMediumAttachment,
|
---|
224 | ULONG aSourceIdx, ULONG aTargetIdx,
|
---|
225 | IProgress *aProgress);
|
---|
226 | HRESULT i_reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments);
|
---|
227 | HRESULT i_onVMProcessPriorityChange(VMProcPriority_T priority);
|
---|
228 | int i_hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
|
---|
229 | VMMDev *i_getVMMDev() { return m_pVMMDev; }
|
---|
230 |
|
---|
231 | #ifdef VBOX_WITH_EXTPACK
|
---|
232 | ExtPackManager *i_getExtPackManager();
|
---|
233 | #endif
|
---|
234 | EventSource *i_getEventSource() { return mEventSource; }
|
---|
235 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
236 | UsbCardReader *i_getUsbCardReader() { return mUsbCardReader; }
|
---|
237 | #endif
|
---|
238 |
|
---|
239 | int i_VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
|
---|
240 | void i_VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
|
---|
241 | void i_VRDPClientConnect(uint32_t u32ClientId);
|
---|
242 | void i_VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
|
---|
243 | void i_VRDPInterceptAudio(uint32_t u32ClientId);
|
---|
244 | void i_VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
|
---|
245 | void i_VRDPInterceptClipboard(uint32_t u32ClientId);
|
---|
246 |
|
---|
247 | void i_processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
|
---|
248 | void i_reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
|
---|
249 | ULONG aCpuKernel, ULONG aCpuIdle,
|
---|
250 | ULONG aMemTotal, ULONG aMemFree,
|
---|
251 | ULONG aMemBalloon, ULONG aMemShared,
|
---|
252 | ULONG aMemCache, ULONG aPageTotal,
|
---|
253 | ULONG aAllocVMM, ULONG aFreeVMM,
|
---|
254 | ULONG aBalloonedVMM, ULONG aSharedVMM,
|
---|
255 | ULONG aVmNetRx, ULONG aVmNetTx)
|
---|
256 | {
|
---|
257 | mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
|
---|
258 | aMemTotal, aMemFree, aMemBalloon, aMemShared,
|
---|
259 | aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
|
---|
260 | aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
|
---|
261 | }
|
---|
262 | void i_enableVMMStatistics(BOOL aEnable);
|
---|
263 |
|
---|
264 | HRESULT i_pause(Reason_T aReason);
|
---|
265 | HRESULT i_resume(Reason_T aReason, AutoWriteLock &alock);
|
---|
266 | HRESULT i_saveState(Reason_T aReason, const ComPtr<IProgress> &aProgress,
|
---|
267 | const ComPtr<ISnapshot> &aSnapshot,
|
---|
268 | const Utf8Str &aStateFilePath, bool fPauseVM, bool &fLeftPaused);
|
---|
269 | HRESULT i_cancelSaveState();
|
---|
270 |
|
---|
271 | // callback callers (partly; for some events console callbacks are notified
|
---|
272 | // directly from IInternalSessionControl event handlers declared above)
|
---|
273 | void i_onMousePointerShapeChange(bool fVisible, bool fAlpha,
|
---|
274 | uint32_t xHot, uint32_t yHot,
|
---|
275 | uint32_t width, uint32_t height,
|
---|
276 | const uint8_t *pu8Shape,
|
---|
277 | uint32_t cbShape);
|
---|
278 | void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
|
---|
279 | BOOL supportsMT, BOOL needsHostCursor);
|
---|
280 | void i_onStateChange(MachineState_T aMachineState);
|
---|
281 | void i_onAdditionsStateChange();
|
---|
282 | void i_onAdditionsOutdated();
|
---|
283 | void i_onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
284 | void i_onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
|
---|
285 | IVirtualBoxErrorInfo *aError);
|
---|
286 | void i_onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
|
---|
287 | HRESULT i_onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
|
---|
288 | void i_onVRDEServerInfoChange();
|
---|
289 | HRESULT i_sendACPIMonitorHotPlugEvent();
|
---|
290 |
|
---|
291 | static const PDMDRVREG DrvStatusReg;
|
---|
292 |
|
---|
293 | static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
|
---|
294 | static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *pcsz, ...);
|
---|
295 | HRESULT i_setInvalidMachineStateError();
|
---|
296 |
|
---|
297 | static const char *i_storageControllerTypeToStr(StorageControllerType_T enmCtrlType);
|
---|
298 | static HRESULT i_storageBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
|
---|
299 | // Called from event listener
|
---|
300 | HRESULT i_onNATRedirectRuleChanged(ULONG ulInstance, BOOL aNatRuleRemove,
|
---|
301 | NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
|
---|
302 | HRESULT i_onNATDnsChanged();
|
---|
303 |
|
---|
304 | // Mouse interface
|
---|
305 | VMMDevMouseInterface *i_getVMMDevMouseInterface();
|
---|
306 | DisplayMouseInterface *i_getDisplayMouseInterface();
|
---|
307 |
|
---|
308 | EmulatedUSB *i_getEmulatedUSB(void) { return mEmulatedUSB; }
|
---|
309 |
|
---|
310 | /**
|
---|
311 | * Sets the disk encryption keys.
|
---|
312 | *
|
---|
313 | * @returns COM status code.
|
---|
314 | * @param strCfg The config for the disks.
|
---|
315 | *
|
---|
316 | * @note One line in the config string contains all required data for one disk.
|
---|
317 | * The format for one disk is some sort of comma separated value using
|
---|
318 | * key=value pairs.
|
---|
319 | * There are two keys defined at the moment:
|
---|
320 | * - uuid: The uuid of the base image the key is for (with or without)
|
---|
321 | * the curly braces.
|
---|
322 | * - dek: The data encryption key in base64 encoding
|
---|
323 | */
|
---|
324 | HRESULT i_setDiskEncryptionKeys(const Utf8Str &strCfg);
|
---|
325 |
|
---|
326 | int i_retainCryptoIf(PCVBOXCRYPTOIF *ppCryptoIf);
|
---|
327 | int i_releaseCryptoIf(PCVBOXCRYPTOIF pCryptoIf);
|
---|
328 | HRESULT i_unloadCryptoIfModule(void);
|
---|
329 |
|
---|
330 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
331 | // VMMDev needs:
|
---|
332 | HRESULT i_pullGuestProperties(ComSafeArrayOut(BSTR, names), ComSafeArrayOut(BSTR, values),
|
---|
333 | ComSafeArrayOut(LONG64, timestamps), ComSafeArrayOut(BSTR, flags));
|
---|
334 | static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
|
---|
335 | #endif
|
---|
336 |
|
---|
337 | private:
|
---|
338 |
|
---|
339 | // wrapped IConsole properties
|
---|
340 | HRESULT getMachine(ComPtr<IMachine> &aMachine);
|
---|
341 | HRESULT getState(MachineState_T *aState);
|
---|
342 | HRESULT getGuest(ComPtr<IGuest> &aGuest);
|
---|
343 | HRESULT getKeyboard(ComPtr<IKeyboard> &aKeyboard);
|
---|
344 | HRESULT getMouse(ComPtr<IMouse> &aMouse);
|
---|
345 | HRESULT getDisplay(ComPtr<IDisplay> &aDisplay);
|
---|
346 | HRESULT getDebugger(ComPtr<IMachineDebugger> &aDebugger);
|
---|
347 | HRESULT getUSBDevices(std::vector<ComPtr<IUSBDevice> > &aUSBDevices);
|
---|
348 | HRESULT getRemoteUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aRemoteUSBDevices);
|
---|
349 | HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
|
---|
350 | HRESULT getVRDEServerInfo(ComPtr<IVRDEServerInfo> &aVRDEServerInfo);
|
---|
351 | HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
|
---|
352 | HRESULT getAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttachedPCIDevices);
|
---|
353 | HRESULT getUseHostClipboard(BOOL *aUseHostClipboard);
|
---|
354 | HRESULT setUseHostClipboard(BOOL aUseHostClipboard);
|
---|
355 | HRESULT getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB);
|
---|
356 |
|
---|
357 | // wrapped IConsole methods
|
---|
358 | HRESULT powerUp(ComPtr<IProgress> &aProgress);
|
---|
359 | HRESULT powerUpPaused(ComPtr<IProgress> &aProgress);
|
---|
360 | HRESULT powerDown(ComPtr<IProgress> &aProgress);
|
---|
361 | HRESULT reset();
|
---|
362 | HRESULT pause();
|
---|
363 | HRESULT resume();
|
---|
364 | HRESULT powerButton();
|
---|
365 | HRESULT sleepButton();
|
---|
366 | HRESULT getPowerButtonHandled(BOOL *aHandled);
|
---|
367 | HRESULT getGuestEnteredACPIMode(BOOL *aEntered);
|
---|
368 | HRESULT getDeviceActivity(const std::vector<DeviceType_T> &aType,
|
---|
369 | std::vector<DeviceActivity_T> &aActivity);
|
---|
370 | HRESULT attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename);
|
---|
371 | HRESULT detachUSBDevice(const com::Guid &aId,
|
---|
372 | ComPtr<IUSBDevice> &aDevice);
|
---|
373 | HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
|
---|
374 | ComPtr<IUSBDevice> &aDevice);
|
---|
375 | HRESULT findUSBDeviceById(const com::Guid &aId,
|
---|
376 | ComPtr<IUSBDevice> &aDevice);
|
---|
377 | HRESULT createSharedFolder(const com::Utf8Str &aName,
|
---|
378 | const com::Utf8Str &aHostPath,
|
---|
379 | BOOL aWritable,
|
---|
380 | BOOL aAutomount,
|
---|
381 | const com::Utf8Str &aAutoMountPoint);
|
---|
382 | HRESULT removeSharedFolder(const com::Utf8Str &aName);
|
---|
383 | HRESULT teleport(const com::Utf8Str &aHostname,
|
---|
384 | ULONG aTcpport,
|
---|
385 | const com::Utf8Str &aPassword,
|
---|
386 | ULONG aMaxDowntime,
|
---|
387 | ComPtr<IProgress> &aProgress);
|
---|
388 | HRESULT addEncryptionPassword(const com::Utf8Str &aId, const com::Utf8Str &aPassword,
|
---|
389 | BOOL aClearOnSuspend);
|
---|
390 | HRESULT addEncryptionPasswords(const std::vector<com::Utf8Str> &aIds, const std::vector<com::Utf8Str> &aPasswords,
|
---|
391 | BOOL aClearOnSuspend);
|
---|
392 | HRESULT removeEncryptionPassword(const com::Utf8Str &aId);
|
---|
393 | HRESULT clearAllEncryptionPasswords();
|
---|
394 |
|
---|
395 | void notifyNatDnsChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, ULONG ulInstanceMax);
|
---|
396 | Utf8Str VRDPServerErrorToMsg(int vrc);
|
---|
397 |
|
---|
398 | /**
|
---|
399 | * Base template for AutoVMCaller and SafeVMPtr. Template arguments
|
---|
400 | * have the same meaning as arguments of Console::addVMCaller().
|
---|
401 | */
|
---|
402 | template <bool taQuiet = false, bool taAllowNullVM = false>
|
---|
403 | class AutoVMCallerBase
|
---|
404 | {
|
---|
405 | public:
|
---|
406 | AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(E_FAIL)
|
---|
407 | {
|
---|
408 | Assert(aThat);
|
---|
409 | mRC = aThat->i_addVMCaller(taQuiet, taAllowNullVM);
|
---|
410 | }
|
---|
411 | ~AutoVMCallerBase()
|
---|
412 | {
|
---|
413 | doRelease();
|
---|
414 | }
|
---|
415 | /** Decreases the number of callers before the instance is destroyed. */
|
---|
416 | void releaseCaller()
|
---|
417 | {
|
---|
418 | Assert(SUCCEEDED(mRC));
|
---|
419 | doRelease();
|
---|
420 | }
|
---|
421 | /** Restores the number of callers after by #release(). #rc() must be
|
---|
422 | * rechecked to ensure the operation succeeded. */
|
---|
423 | void addYY()
|
---|
424 | {
|
---|
425 | AssertReturnVoid(!SUCCEEDED(mRC));
|
---|
426 | mRC = mThat->i_addVMCaller(taQuiet, taAllowNullVM);
|
---|
427 | }
|
---|
428 | /** Returns the result of Console::addVMCaller() */
|
---|
429 | HRESULT rc() const { return mRC; }
|
---|
430 | /** Shortcut to SUCCEEDED(rc()) */
|
---|
431 | bool isOk() const { return SUCCEEDED(mRC); }
|
---|
432 | protected:
|
---|
433 | Console *mThat;
|
---|
434 | void doRelease()
|
---|
435 | {
|
---|
436 | if (SUCCEEDED(mRC))
|
---|
437 | {
|
---|
438 | mThat->i_releaseVMCaller();
|
---|
439 | mRC = E_FAIL;
|
---|
440 | }
|
---|
441 | }
|
---|
442 | private:
|
---|
443 | HRESULT mRC; /* Whether the caller was added. */
|
---|
444 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase);
|
---|
445 | };
|
---|
446 |
|
---|
447 | #if 0
|
---|
448 | /**
|
---|
449 | * Helper class that protects sections of code using the mpUVM pointer by
|
---|
450 | * automatically calling addVMCaller() on construction and
|
---|
451 | * releaseVMCaller() on destruction. Intended for Console methods dealing
|
---|
452 | * with mpUVM. The usage pattern is:
|
---|
453 | * <code>
|
---|
454 | * AutoVMCaller autoVMCaller(this);
|
---|
455 | * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
|
---|
456 | * ...
|
---|
457 | * VMR3ReqCall (mpUVM, ...
|
---|
458 | * </code>
|
---|
459 | *
|
---|
460 | * @note Temporarily locks the argument for writing.
|
---|
461 | *
|
---|
462 | * @sa SafeVMPtr, SafeVMPtrQuiet
|
---|
463 | * @note Obsolete, use SafeVMPtr
|
---|
464 | */
|
---|
465 | typedef AutoVMCallerBase<false, false> AutoVMCaller;
|
---|
466 | #endif
|
---|
467 |
|
---|
468 | /**
|
---|
469 | * Same as AutoVMCaller but doesn't set extended error info on failure.
|
---|
470 | *
|
---|
471 | * @note Temporarily locks the argument for writing.
|
---|
472 | * @note Obsolete, use SafeVMPtrQuiet
|
---|
473 | */
|
---|
474 | typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
|
---|
475 |
|
---|
476 | /**
|
---|
477 | * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
|
---|
478 | * instead of assertion).
|
---|
479 | *
|
---|
480 | * @note Temporarily locks the argument for writing.
|
---|
481 | * @note Obsolete, use SafeVMPtr
|
---|
482 | */
|
---|
483 | typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * Same as AutoVMCaller but doesn't set extended error info on failure
|
---|
487 | * and allows a null VM pointer (to trigger an error instead of
|
---|
488 | * assertion).
|
---|
489 | *
|
---|
490 | * @note Temporarily locks the argument for writing.
|
---|
491 | * @note Obsolete, use SafeVMPtrQuiet
|
---|
492 | */
|
---|
493 | typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
|
---|
494 |
|
---|
495 | /**
|
---|
496 | * Base template for SafeVMPtr and SafeVMPtrQuiet.
|
---|
497 | */
|
---|
498 | template<bool taQuiet = false>
|
---|
499 | class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
|
---|
500 | {
|
---|
501 | typedef AutoVMCallerBase<taQuiet, true> Base;
|
---|
502 | public:
|
---|
503 | SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL), mpVMM(NULL)
|
---|
504 | {
|
---|
505 | if (Base::isOk())
|
---|
506 | mRC = aThat->i_safeVMPtrRetainer(&mpUVM, &mpVMM, taQuiet);
|
---|
507 | }
|
---|
508 | ~SafeVMPtrBase()
|
---|
509 | {
|
---|
510 | doRelease();
|
---|
511 | }
|
---|
512 | /** Direct PUVM access. */
|
---|
513 | PUVM rawUVM() const { return mpUVM; }
|
---|
514 | /** Direct PCVMMR3VTABLE access. */
|
---|
515 | PCVMMR3VTABLE vtable() const { return mpVMM; }
|
---|
516 | /** Release the handles. */
|
---|
517 | void release()
|
---|
518 | {
|
---|
519 | Assert(SUCCEEDED(mRC));
|
---|
520 | doRelease();
|
---|
521 | }
|
---|
522 |
|
---|
523 | /** The combined result of Console::addVMCaller() and Console::safeVMPtrRetainer */
|
---|
524 | HRESULT rc() const { return Base::isOk()? mRC: Base::rc(); }
|
---|
525 | /** Shortcut to SUCCEEDED(rc()) */
|
---|
526 | bool isOk() const { return SUCCEEDED(mRC) && Base::isOk(); }
|
---|
527 |
|
---|
528 | private:
|
---|
529 | void doRelease()
|
---|
530 | {
|
---|
531 | if (SUCCEEDED(mRC))
|
---|
532 | {
|
---|
533 | Base::mThat->i_safeVMPtrReleaser(&mpUVM);
|
---|
534 | mRC = E_FAIL;
|
---|
535 | }
|
---|
536 | Base::doRelease();
|
---|
537 | }
|
---|
538 | HRESULT mRC; /* Whether the VM ptr was retained. */
|
---|
539 | PUVM mpUVM;
|
---|
540 | PCVMMR3VTABLE mpVMM;
|
---|
541 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase);
|
---|
542 | };
|
---|
543 |
|
---|
544 | public:
|
---|
545 |
|
---|
546 | /*
|
---|
547 | * Helper class that safely manages the Console::mpUVM pointer
|
---|
548 | * by calling addVMCaller() on construction and releaseVMCaller() on
|
---|
549 | * destruction. Intended for Console children. The usage pattern is:
|
---|
550 | * <code>
|
---|
551 | * Console::SafeVMPtr ptrVM(mParent);
|
---|
552 | * if (!ptrVM.isOk())
|
---|
553 | * return ptrVM.rc();
|
---|
554 | * ...
|
---|
555 | * VMR3ReqCall(ptrVM.rawUVM(), ...
|
---|
556 | * ...
|
---|
557 | * printf("%p\n", ptrVM.rawUVM());
|
---|
558 | * </code>
|
---|
559 | *
|
---|
560 | * @note Temporarily locks the argument for writing.
|
---|
561 | *
|
---|
562 | * @sa SafeVMPtrQuiet, AutoVMCaller
|
---|
563 | */
|
---|
564 | typedef SafeVMPtrBase<false> SafeVMPtr;
|
---|
565 |
|
---|
566 | /**
|
---|
567 | * A deviation of SafeVMPtr that doesn't set the error info on failure.
|
---|
568 | * Intended for pieces of code that don't need to return the VM access
|
---|
569 | * failure to the caller. The usage pattern is:
|
---|
570 | * <code>
|
---|
571 | * Console::SafeVMPtrQuiet pVM(mParent);
|
---|
572 | * if (pVM.rc())
|
---|
573 | * VMR3ReqCall(pVM, ...
|
---|
574 | * return S_OK;
|
---|
575 | * </code>
|
---|
576 | *
|
---|
577 | * @note Temporarily locks the argument for writing.
|
---|
578 | *
|
---|
579 | * @sa SafeVMPtr, AutoVMCaller
|
---|
580 | */
|
---|
581 | typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
|
---|
582 |
|
---|
583 | class SharedFolderData
|
---|
584 | {
|
---|
585 | public:
|
---|
586 | SharedFolderData()
|
---|
587 | { }
|
---|
588 |
|
---|
589 | SharedFolderData(const Utf8Str &aHostPath,
|
---|
590 | bool aWritable,
|
---|
591 | bool aAutoMount,
|
---|
592 | const Utf8Str &aAutoMountPoint)
|
---|
593 | : m_strHostPath(aHostPath)
|
---|
594 | , m_fWritable(aWritable)
|
---|
595 | , m_fAutoMount(aAutoMount)
|
---|
596 | , m_strAutoMountPoint(aAutoMountPoint)
|
---|
597 | { }
|
---|
598 |
|
---|
599 | /** Copy constructor. */
|
---|
600 | SharedFolderData(const SharedFolderData& aThat)
|
---|
601 | : m_strHostPath(aThat.m_strHostPath)
|
---|
602 | , m_fWritable(aThat.m_fWritable)
|
---|
603 | , m_fAutoMount(aThat.m_fAutoMount)
|
---|
604 | , m_strAutoMountPoint(aThat.m_strAutoMountPoint)
|
---|
605 | { }
|
---|
606 |
|
---|
607 | /** Copy assignment operator. */
|
---|
608 | SharedFolderData &operator=(SharedFolderData const &a_rThat) RT_NOEXCEPT
|
---|
609 | {
|
---|
610 | m_strHostPath = a_rThat.m_strHostPath;
|
---|
611 | m_fWritable = a_rThat.m_fWritable;
|
---|
612 | m_fAutoMount = a_rThat.m_fAutoMount;
|
---|
613 | m_strAutoMountPoint = a_rThat.m_strAutoMountPoint;
|
---|
614 |
|
---|
615 | return *this;
|
---|
616 | }
|
---|
617 |
|
---|
618 | Utf8Str m_strHostPath;
|
---|
619 | bool m_fWritable;
|
---|
620 | bool m_fAutoMount;
|
---|
621 | Utf8Str m_strAutoMountPoint;
|
---|
622 | };
|
---|
623 |
|
---|
624 | /**
|
---|
625 | * Class for managing emulated USB MSDs.
|
---|
626 | */
|
---|
627 | class USBStorageDevice
|
---|
628 | {
|
---|
629 | public:
|
---|
630 | USBStorageDevice()
|
---|
631 | { }
|
---|
632 | /** The UUID associated with the USB device. */
|
---|
633 | RTUUID mUuid;
|
---|
634 | /** Port of the storage device. */
|
---|
635 | LONG iPort;
|
---|
636 | };
|
---|
637 |
|
---|
638 | typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
|
---|
639 | typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
|
---|
640 | typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
|
---|
641 | typedef std::list <USBStorageDevice> USBStorageDeviceList;
|
---|
642 |
|
---|
643 | static void i_powerUpThreadTask(VMPowerUpTask *pTask);
|
---|
644 | static void i_powerDownThreadTask(VMPowerDownTask *pTask);
|
---|
645 |
|
---|
646 | private:
|
---|
647 |
|
---|
648 | typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
|
---|
649 | typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
|
---|
650 |
|
---|
651 | HRESULT i_loadVMM(void) RT_NOEXCEPT;
|
---|
652 | HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
|
---|
653 | void i_releaseVMCaller();
|
---|
654 | HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, PCVMMR3VTABLE *a_ppVMM, bool aQuiet) RT_NOEXCEPT;
|
---|
655 | void i_safeVMPtrReleaser(PUVM *a_ppUVM);
|
---|
656 |
|
---|
657 | HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
|
---|
658 |
|
---|
659 | HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
|
---|
660 | HRESULT i_powerDown(IProgress *aProgress = NULL);
|
---|
661 |
|
---|
662 | /* Note: FreeBSD needs this whether netflt is used or not. */
|
---|
663 | #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
|
---|
664 | HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
|
---|
665 | HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
|
---|
666 | #endif
|
---|
667 | HRESULT i_powerDownHostInterfaces();
|
---|
668 |
|
---|
669 | HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
|
---|
670 | HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
|
---|
671 | {
|
---|
672 | return i_setMachineState(aMachineState, false /* aUpdateServer */);
|
---|
673 | }
|
---|
674 |
|
---|
675 | HRESULT i_findSharedFolder(const Utf8Str &strName,
|
---|
676 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
677 | bool aSetError = false);
|
---|
678 |
|
---|
679 | HRESULT i_fetchSharedFolders(BOOL aGlobal);
|
---|
680 | bool i_findOtherSharedFolder(const Utf8Str &straName,
|
---|
681 | SharedFolderDataMap::const_iterator &aIt);
|
---|
682 |
|
---|
683 | HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
|
---|
684 | HRESULT i_removeSharedFolder(const Utf8Str &strName);
|
---|
685 |
|
---|
686 | HRESULT i_suspendBeforeConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock, bool *pfResume);
|
---|
687 | void i_resumeAfterConfigChange(PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
688 |
|
---|
689 | static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvConsole);
|
---|
690 | void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const char *pcszValue);
|
---|
691 | void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue);
|
---|
692 | void InsertConfigString(PCFGMNODE pNode, const char *pcszName, const Bstr &rBstrValue);
|
---|
693 | void InsertConfigPassword(PCFGMNODE pNode, const char *pcszName, const Utf8Str &rStrValue);
|
---|
694 | void InsertConfigBytes(PCFGMNODE pNode, const char *pcszName, const void *pvBytes, size_t cbBytes);
|
---|
695 | void InsertConfigInteger(PCFGMNODE pNode, const char *pcszName, uint64_t u64Integer);
|
---|
696 | void InsertConfigNode(PCFGMNODE pNode, const char *pcszName, PCFGMNODE *ppChild);
|
---|
697 | void InsertConfigNodeF(PCFGMNODE pNode, PCFGMNODE *ppChild, const char *pszNameFormat, ...);
|
---|
698 | void RemoveConfigValue(PCFGMNODE pNode, const char *pcszName);
|
---|
699 | int SetBiosDiskInfo(ComPtr<IMachine> pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg,
|
---|
700 | Bstr controllerName, const char * const s_apszBiosConfig[4]);
|
---|
701 | void i_configAudioDriver(IVirtualBox *pVirtualBox, IMachine *pMachine, PCFGMNODE pLUN, const char *pszDriverName,
|
---|
702 | bool fAudioEnabledIn, bool fAudioEnabledOut);
|
---|
703 | int i_configConstructorInner(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, AutoWriteLock *pAlock);
|
---|
704 | int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
|
---|
705 | int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
|
---|
706 |
|
---|
707 | int i_configGraphicsController(PCFGMNODE pDevices,
|
---|
708 | const GraphicsControllerType_T graphicsController,
|
---|
709 | BusAssignmentManager *pBusMgr,
|
---|
710 | const ComPtr<IMachine> &ptrMachine,
|
---|
711 | const ComPtr<IGraphicsAdapter> &ptrGraphicsAdapter,
|
---|
712 | const ComPtr<IBIOSSettings> &ptrBiosSettings,
|
---|
713 | bool fHMEnabled);
|
---|
714 | int i_checkMediumLocation(IMedium *pMedium, bool *pfUseHostIOCache);
|
---|
715 | int i_unmountMediumFromGuest(PUVM pUVM, PCVMMR3VTABLE pVMM, StorageBus_T enmBus, DeviceType_T enmDevType,
|
---|
716 | const char *pcszDevice, unsigned uInstance, unsigned uLUN,
|
---|
717 | bool fForceUnmount) RT_NOEXCEPT;
|
---|
718 | int i_removeMediumDriverFromVm(PCFGMNODE pCtlInst,
|
---|
719 | const char *pcszDevice,
|
---|
720 | unsigned uInstance,
|
---|
721 | unsigned uLUN,
|
---|
722 | StorageBus_T enmBus,
|
---|
723 | bool fAttachDetach,
|
---|
724 | bool fHotplug,
|
---|
725 | bool fForceUnmount,
|
---|
726 | PUVM pUVM,
|
---|
727 | PCVMMR3VTABLE pVMM,
|
---|
728 | DeviceType_T enmDevType,
|
---|
729 | PCFGMNODE *ppLunL0);
|
---|
730 | int i_configMediumAttachment(const char *pcszDevice,
|
---|
731 | unsigned uInstance,
|
---|
732 | StorageBus_T enmBus,
|
---|
733 | bool fUseHostIOCache,
|
---|
734 | bool fBuiltinIoCache,
|
---|
735 | bool fInsertDiskIntegrityDrv,
|
---|
736 | bool fSetupMerge,
|
---|
737 | unsigned uMergeSource,
|
---|
738 | unsigned uMergeTarget,
|
---|
739 | IMediumAttachment *pMediumAtt,
|
---|
740 | MachineState_T aMachineState,
|
---|
741 | HRESULT *phrc,
|
---|
742 | bool fAttachDetach,
|
---|
743 | bool fForceUnmount,
|
---|
744 | bool fHotplug,
|
---|
745 | PUVM pUVM,
|
---|
746 | PCVMMR3VTABLE pVMM,
|
---|
747 | DeviceType_T *paLedDevType,
|
---|
748 | PCFGMNODE *ppLunL0);
|
---|
749 | int i_configMedium(PCFGMNODE pLunL0,
|
---|
750 | bool fPassthrough,
|
---|
751 | DeviceType_T enmType,
|
---|
752 | bool fUseHostIOCache,
|
---|
753 | bool fBuiltinIoCache,
|
---|
754 | bool fInsertDiskIntegrityDrv,
|
---|
755 | bool fSetupMerge,
|
---|
756 | unsigned uMergeSource,
|
---|
757 | unsigned uMergeTarget,
|
---|
758 | const char *pcszBwGroup,
|
---|
759 | bool fDiscard,
|
---|
760 | bool fNonRotational,
|
---|
761 | ComPtr<IMedium> ptrMedium,
|
---|
762 | MachineState_T aMachineState,
|
---|
763 | HRESULT *phrc);
|
---|
764 | int i_configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP, bool *pfEncrypted);
|
---|
765 | static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
|
---|
766 | PUVM pUVM,
|
---|
767 | PCVMMR3VTABLE pVMM,
|
---|
768 | const char *pcszDevice,
|
---|
769 | unsigned uInstance,
|
---|
770 | StorageBus_T enmBus,
|
---|
771 | bool fUseHostIOCache,
|
---|
772 | bool fBuiltinIoCache,
|
---|
773 | bool fInsertDiskIntegrityDrv,
|
---|
774 | bool fSetupMerge,
|
---|
775 | unsigned uMergeSource,
|
---|
776 | unsigned uMergeTarget,
|
---|
777 | IMediumAttachment *aMediumAtt,
|
---|
778 | MachineState_T aMachineState,
|
---|
779 | HRESULT *phrc);
|
---|
780 | static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
|
---|
781 | PUVM pUVM,
|
---|
782 | PCVMMR3VTABLE pVMM,
|
---|
783 | const char *pcszDevice,
|
---|
784 | unsigned uInstance,
|
---|
785 | StorageBus_T enmBus,
|
---|
786 | bool fUseHostIOCache,
|
---|
787 | IMediumAttachment *aMediumAtt,
|
---|
788 | bool fForce);
|
---|
789 |
|
---|
790 | HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
|
---|
791 | struct LEDSET;
|
---|
792 | typedef struct LEDSET *PLEDSET;
|
---|
793 | PPDMLED *i_getLedSet(uint32_t iLedSet);
|
---|
794 | uint32_t i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppSubTypes);
|
---|
795 | void i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType,
|
---|
796 | uint32_t uFirst, uint32_t uLast,
|
---|
797 | DeviceType_T **ppaSubTypes,
|
---|
798 | Console::MediumAttachmentMap *pmapMediumAttachments,
|
---|
799 | const char *pcszDevice, unsigned uInstance);
|
---|
800 |
|
---|
801 | int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun, INetworkAdapter *aNetworkAdapter,
|
---|
802 | PCFGMNODE pCfg, PCFGMNODE pLunL0, PCFGMNODE pInst, bool fAttachDetach, bool fIgnoreConnectFailure,
|
---|
803 | PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
804 | int i_configProxy(ComPtr<IVirtualBox> virtualBox, PCFGMNODE pCfg, const char *pcszPrefix, const com::Utf8Str &strIpAddr);
|
---|
805 |
|
---|
806 | int i_configSerialPort(PCFGMNODE pInst, PortMode_T ePortMode, const char *pszPath, bool fServer);
|
---|
807 | static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState,
|
---|
808 | VMSTATE enmOldState, void *pvUser);
|
---|
809 | static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu);
|
---|
810 | static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu);
|
---|
811 | HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
812 | HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
813 | HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
814 |
|
---|
815 | HRESULT i_doNetworkAdapterChange(PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice, unsigned uInstance,
|
---|
816 | unsigned uLun, INetworkAdapter *aNetworkAdapter);
|
---|
817 | static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, const char *pszDevice,
|
---|
818 | unsigned uInstance, unsigned uLun, INetworkAdapter *aNetworkAdapter);
|
---|
819 | static DECLCALLBACK(int) i_changeSerialPortAttachment(Console *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, ISerialPort *pSerialPort);
|
---|
820 |
|
---|
821 | int i_changeClipboardMode(ClipboardMode_T aClipboardMode);
|
---|
822 | int i_changeClipboardFileTransferMode(bool aEnabled);
|
---|
823 | int i_changeDnDMode(DnDMode_T aDnDMode);
|
---|
824 |
|
---|
825 | #ifdef VBOX_WITH_USB
|
---|
826 | HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename);
|
---|
827 | HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
|
---|
828 |
|
---|
829 | static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, IUSBDevice *aHostDevice,
|
---|
830 | PCRTUUID aUuid, const char *aBackend, const char *aAddress,
|
---|
831 | PCFGMNODE pRemoteCfg, USBConnectionSpeed_T enmSpeed, ULONG aMaskedIfs,
|
---|
832 | const char *pszCaptureFilename);
|
---|
833 | static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCVMMR3VTABLE pVMM, PCRTUUID aUuid);
|
---|
834 | static DECLCALLBACK(PREMOTEUSBCALLBACK) i_usbQueryRemoteUsbBackend(void *pvUser, PCRTUUID pUuid, uint32_t idClient);
|
---|
835 |
|
---|
836 | /** Interface for the VRDP USB proxy backend to query for a device remote callback table. */
|
---|
837 | REMOTEUSBIF mRemoteUsbIf;
|
---|
838 | #endif
|
---|
839 |
|
---|
840 | static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
|
---|
841 | PUVM pUVM,
|
---|
842 | PCVMMR3VTABLE pVMM,
|
---|
843 | const char *pcszDevice,
|
---|
844 | unsigned uInstance,
|
---|
845 | StorageBus_T enmBus,
|
---|
846 | bool fUseHostIOCache,
|
---|
847 | IMediumAttachment *aMediumAtt,
|
---|
848 | bool fSilent);
|
---|
849 | static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
|
---|
850 | PUVM pUVM,
|
---|
851 | PCVMMR3VTABLE pVMM,
|
---|
852 | const char *pcszDevice,
|
---|
853 | unsigned uInstance,
|
---|
854 | StorageBus_T enmBus,
|
---|
855 | IMediumAttachment *aMediumAtt,
|
---|
856 | bool fSilent);
|
---|
857 | HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent);
|
---|
858 | HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, PCVMMR3VTABLE pVMM, bool fSilent);
|
---|
859 |
|
---|
860 | static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
|
---|
861 |
|
---|
862 | static DECLCALLBACK(void) i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
|
---|
863 | const char *pszErrorFmt, va_list va);
|
---|
864 |
|
---|
865 | void i_atVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
|
---|
866 | static DECLCALLBACK(void) i_atVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
|
---|
867 | const char *pszErrorId, const char *pszFormat, va_list va);
|
---|
868 |
|
---|
869 | HRESULT i_captureUSBDevices(PUVM pUVM);
|
---|
870 | void i_detachAllUSBDevices(bool aDone);
|
---|
871 |
|
---|
872 |
|
---|
873 | static DECLCALLBACK(int) i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
874 | static DECLCALLBACK(void) i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
|
---|
875 | static DECLCALLBACK(void) i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
|
---|
876 | static DECLCALLBACK(void) i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
877 | static DECLCALLBACK(void) i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
878 | static DECLCALLBACK(void) i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
|
---|
879 | static DECLCALLBACK(void *) i_vmm2User_QueryGenericObject(PCVMM2USERMETHODS pThis, PUVM pUVM, PCRTUUID pUuid);
|
---|
880 |
|
---|
881 | static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
882 | static DECLCALLBACK(void) i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
|
---|
883 | static DECLCALLBACK(int) i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
|
---|
884 | static DECLCALLBACK(void) i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
|
---|
885 | static DECLCALLBACK(int) i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
886 |
|
---|
887 | static DECLCALLBACK(int) i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
|
---|
888 | size_t *pcbKey);
|
---|
889 | static DECLCALLBACK(int) i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
|
---|
890 | static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRetain(PPDMISECKEY pInterface, const char *pszId, const char **ppszPassword);
|
---|
891 | static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRelease(PPDMISECKEY pInterface, const char *pszId);
|
---|
892 |
|
---|
893 | static DECLCALLBACK(int) i_pdmIfSecKeyHlp_KeyMissingNotify(PPDMISECKEYHLP pInterface);
|
---|
894 |
|
---|
895 | int mcAudioRefs;
|
---|
896 | volatile uint32_t mcVRDPClients;
|
---|
897 | uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
|
---|
898 | volatile bool mcGuestCredentialsProvided;
|
---|
899 |
|
---|
900 | static const char *sSSMConsoleUnit;
|
---|
901 |
|
---|
902 | HRESULT i_loadDataFromSavedState();
|
---|
903 | int i_loadStateFileExecInternal(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t u32Version);
|
---|
904 |
|
---|
905 | static DECLCALLBACK(int) i_saveStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
|
---|
906 | static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
|
---|
907 | uint32_t uVersion, uint32_t uPass);
|
---|
908 |
|
---|
909 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
910 | HRESULT i_doEnumerateGuestProperties(const Utf8Str &aPatterns,
|
---|
911 | std::vector<Utf8Str> &aNames,
|
---|
912 | std::vector<Utf8Str> &aValues,
|
---|
913 | std::vector<LONG64> &aTimestamps,
|
---|
914 | std::vector<Utf8Str> &aFlags);
|
---|
915 |
|
---|
916 | void i_guestPropertiesHandleVMReset(void);
|
---|
917 | bool i_guestPropertiesVRDPEnabled(void);
|
---|
918 | void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
|
---|
919 | void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
|
---|
920 | void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
|
---|
921 | void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
|
---|
922 | void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
|
---|
923 | void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
|
---|
924 | void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
|
---|
925 | void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
|
---|
926 | #endif
|
---|
927 |
|
---|
928 | /** @name Disk encryption support
|
---|
929 | * @{ */
|
---|
930 | HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
|
---|
931 | HRESULT i_configureEncryptionForDisk(const Utf8Str &strId, unsigned *pcDisksConfigured);
|
---|
932 | HRESULT i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(const Utf8Str &strId);
|
---|
933 | HRESULT i_initSecretKeyIfOnAllAttachments(void);
|
---|
934 | int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
|
---|
935 | char **ppszKey, char **ppszVal);
|
---|
936 | void i_removeSecretKeysOnSuspend();
|
---|
937 | /** @} */
|
---|
938 |
|
---|
939 | /** @name Teleporter support
|
---|
940 | * @{ */
|
---|
941 | static DECLCALLBACK(int) i_teleporterSrcThreadWrapper(RTTHREAD hThreadSelf, void *pvUser);
|
---|
942 | HRESULT i_teleporterSrc(TeleporterStateSrc *pState);
|
---|
943 | HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
|
---|
944 | HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
|
---|
945 | HRESULT i_teleporterTrg(PUVM pUVM, PCVMMR3VTABLE pVMM, IMachine *pMachine, Utf8Str *pErrorMsg,
|
---|
946 | bool fStartPaused, Progress *pProgress, bool *pfPowerOffOnFailure);
|
---|
947 | static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
|
---|
948 | /** @} */
|
---|
949 |
|
---|
950 | #ifdef VBOX_WITH_FULL_VM_ENCRYPTION
|
---|
951 | /** @name Encrypted log interface
|
---|
952 | * @{ */
|
---|
953 | static DECLCALLBACK(int) i_logEncryptedOpen(PCRTLOGOUTPUTIF pIf, void *pvUser, const char *pszFilename, uint32_t fFlags);
|
---|
954 | static DECLCALLBACK(int) i_logEncryptedClose(PCRTLOGOUTPUTIF pIf, void *pvUser);
|
---|
955 | static DECLCALLBACK(int) i_logEncryptedDelete(PCRTLOGOUTPUTIF pIf, void *pvUser, const char *pszFilename);
|
---|
956 | static DECLCALLBACK(int) i_logEncryptedRename(PCRTLOGOUTPUTIF pIf, void *pvUser, const char *pszFilenameOld,
|
---|
957 | const char *pszFilenameNew, uint32_t fFlags);
|
---|
958 | static DECLCALLBACK(int) i_logEncryptedQuerySize(PCRTLOGOUTPUTIF pIf, void *pvUser, uint64_t *pcbSize);
|
---|
959 | static DECLCALLBACK(int) i_logEncryptedWrite(PCRTLOGOUTPUTIF pIf, void *pvUser, const void *pvBuf,
|
---|
960 | size_t cbWrite, size_t *pcbWritten);
|
---|
961 | static DECLCALLBACK(int) i_logEncryptedFlush(PCRTLOGOUTPUTIF pIf, void *pvUser);
|
---|
962 | /** @} */
|
---|
963 | #endif
|
---|
964 |
|
---|
965 | bool mSavedStateDataLoaded : 1;
|
---|
966 |
|
---|
967 | const ComPtr<IMachine> mMachine;
|
---|
968 | const ComPtr<IInternalMachineControl> mControl;
|
---|
969 |
|
---|
970 | const ComPtr<IVRDEServer> mVRDEServer;
|
---|
971 |
|
---|
972 | ConsoleVRDPServer * const mConsoleVRDPServer;
|
---|
973 | bool mfVRDEChangeInProcess;
|
---|
974 | bool mfVRDEChangePending;
|
---|
975 | const ComObjPtr<Guest> mGuest;
|
---|
976 | const ComObjPtr<Keyboard> mKeyboard;
|
---|
977 | const ComObjPtr<Mouse> mMouse;
|
---|
978 | const ComObjPtr<Display> mDisplay;
|
---|
979 | const ComObjPtr<MachineDebugger> mDebugger;
|
---|
980 | const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
|
---|
981 | /** This can safely be used without holding any locks.
|
---|
982 | * An AutoCaller suffices to prevent it being destroy while in use and
|
---|
983 | * internally there is a lock providing the necessary serialization. */
|
---|
984 | const ComObjPtr<EventSource> mEventSource;
|
---|
985 | #ifdef VBOX_WITH_EXTPACK
|
---|
986 | const ComObjPtr<ExtPackManager> mptrExtPackManager;
|
---|
987 | #endif
|
---|
988 | const ComObjPtr<EmulatedUSB> mEmulatedUSB;
|
---|
989 | const ComObjPtr<NvramStore> mptrNvramStore;
|
---|
990 |
|
---|
991 | USBDeviceList mUSBDevices;
|
---|
992 | RemoteUSBDeviceList mRemoteUSBDevices;
|
---|
993 |
|
---|
994 | SharedFolderDataMap m_mapGlobalSharedFolders;
|
---|
995 | SharedFolderDataMap m_mapMachineSharedFolders;
|
---|
996 | SharedFolderMap m_mapSharedFolders; // the console instances
|
---|
997 |
|
---|
998 | /** VMM loader handle. */
|
---|
999 | RTLDRMOD mhModVMM;
|
---|
1000 | /** The VMM vtable. */
|
---|
1001 | PCVMMR3VTABLE mpVMM;
|
---|
1002 | /** The user mode VM handle. */
|
---|
1003 | PUVM mpUVM;
|
---|
1004 | /** Holds the number of "readonly" mpUVM callers (users). */
|
---|
1005 | uint32_t mVMCallers;
|
---|
1006 | /** Semaphore posted when the number of mpUVM callers drops to zero. */
|
---|
1007 | RTSEMEVENT mVMZeroCallersSem;
|
---|
1008 | /** true when Console has entered the mpUVM destruction phase. */
|
---|
1009 | bool mVMDestroying : 1;
|
---|
1010 | /** true when power down is initiated by vmstateChangeCallback (EMT). */
|
---|
1011 | bool mVMPoweredOff : 1;
|
---|
1012 | /** true when vmstateChangeCallback shouldn't initiate a power down. */
|
---|
1013 | bool mVMIsAlreadyPoweringOff : 1;
|
---|
1014 | /** true if we already showed the snapshot folder size warning. */
|
---|
1015 | bool mfSnapshotFolderSizeWarningShown : 1;
|
---|
1016 | /** true if we already showed the snapshot folder ext4/xfs bug warning. */
|
---|
1017 | bool mfSnapshotFolderExt4WarningShown : 1;
|
---|
1018 | /** true if we already listed the disk type of the snapshot folder. */
|
---|
1019 | bool mfSnapshotFolderDiskTypeShown : 1;
|
---|
1020 | /** true if a USB controller is available (i.e. USB devices can be attached). */
|
---|
1021 | bool mfVMHasUsbController : 1;
|
---|
1022 | /** Shadow of the VBoxInternal2/TurnResetIntoPowerOff extra data setting.
|
---|
1023 | * This is initialized by Console::i_configConstructorInner(). */
|
---|
1024 | bool mfTurnResetIntoPowerOff : 1;
|
---|
1025 | /** true if the VM power off was caused by reset. */
|
---|
1026 | bool mfPowerOffCausedByReset : 1;
|
---|
1027 |
|
---|
1028 | /** Pointer to the VMM -> User (that's us) callbacks. */
|
---|
1029 | struct MYVMM2USERMETHODS : public VMM2USERMETHODS
|
---|
1030 | {
|
---|
1031 | Console *pConsole;
|
---|
1032 | /** The in-progress snapshot. */
|
---|
1033 | ISnapshot *pISnapshot;
|
---|
1034 | } *mpVmm2UserMethods;
|
---|
1035 |
|
---|
1036 | /** The current network attachment type in the VM.
|
---|
1037 | * This doesn't have to match the network attachment type maintained in the
|
---|
1038 | * NetworkAdapter. This is needed to change the network attachment
|
---|
1039 | * dynamically.
|
---|
1040 | */
|
---|
1041 | typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
|
---|
1042 | NetworkAttachmentTypeVector meAttachmentType;
|
---|
1043 |
|
---|
1044 | VMMDev * m_pVMMDev;
|
---|
1045 | AudioVRDE * const mAudioVRDE;
|
---|
1046 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
1047 | UsbCardReader * const mUsbCardReader;
|
---|
1048 | #endif
|
---|
1049 | BusAssignmentManager* mBusMgr;
|
---|
1050 |
|
---|
1051 | /** @name LEDs and their management
|
---|
1052 | * @{ */
|
---|
1053 | /** Number of LED sets in use in maLedSets. */
|
---|
1054 | uint32_t mcLedSets;
|
---|
1055 | /** LED sets. */
|
---|
1056 | struct LEDSET
|
---|
1057 | {
|
---|
1058 | PPDMLED *papLeds;
|
---|
1059 | uint32_t cLeds;
|
---|
1060 | DeviceType_T enmType;
|
---|
1061 | DeviceType_T *paSubTypes; /**< Optionally, device types for each individual LED. Runs parallel to papLeds. */
|
---|
1062 | } maLedSets[32];
|
---|
1063 | /** @} */
|
---|
1064 |
|
---|
1065 | MediumAttachmentMap mapMediumAttachments;
|
---|
1066 |
|
---|
1067 | /** List of attached USB storage devices. */
|
---|
1068 | USBStorageDeviceList mUSBStorageDevices;
|
---|
1069 |
|
---|
1070 | /** Store for secret keys. */
|
---|
1071 | SecretKeyStore * const m_pKeyStore;
|
---|
1072 | /** Number of disks configured for encryption. */
|
---|
1073 | unsigned m_cDisksEncrypted;
|
---|
1074 | /** Number of disks which have the key in the map. */
|
---|
1075 | unsigned m_cDisksPwProvided;
|
---|
1076 |
|
---|
1077 | /** Current active port modes of the supported serial ports. */
|
---|
1078 | PortMode_T m_aeSerialPortMode[4];
|
---|
1079 |
|
---|
1080 | /** Pointer to the key consumer -> provider (that's us) callbacks. */
|
---|
1081 | struct MYPDMISECKEY : public PDMISECKEY
|
---|
1082 | {
|
---|
1083 | Console *pConsole;
|
---|
1084 | } *mpIfSecKey;
|
---|
1085 |
|
---|
1086 | /** Pointer to the key helpers -> provider (that's us) callbacks. */
|
---|
1087 | struct MYPDMISECKEYHLP : public PDMISECKEYHLP
|
---|
1088 | {
|
---|
1089 | Console *pConsole;
|
---|
1090 | } *mpIfSecKeyHlp;
|
---|
1091 |
|
---|
1092 | /* Note: FreeBSD needs this whether netflt is used or not. */
|
---|
1093 | #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
|
---|
1094 | Utf8Str maTAPDeviceName[8];
|
---|
1095 | RTFILE maTapFD[8];
|
---|
1096 | #endif
|
---|
1097 |
|
---|
1098 | bool mVMStateChangeCallbackDisabled;
|
---|
1099 |
|
---|
1100 | bool mfUseHostClipboard;
|
---|
1101 |
|
---|
1102 | /** Local machine state value. */
|
---|
1103 | MachineState_T mMachineState;
|
---|
1104 |
|
---|
1105 | /** Machine uuid string. */
|
---|
1106 | Bstr mstrUuid;
|
---|
1107 |
|
---|
1108 | /** @name Members related to the cryptographic support interface.
|
---|
1109 | * @{ */
|
---|
1110 | /** The loaded module handle if loaded. */
|
---|
1111 | RTLDRMOD mhLdrModCrypto;
|
---|
1112 | /** Reference counter tracking how many users of the cryptographic support
|
---|
1113 | * are there currently. */
|
---|
1114 | volatile uint32_t mcRefsCrypto;
|
---|
1115 | /** Pointer to the cryptographic support interface. */
|
---|
1116 | PCVBOXCRYPTOIF mpCryptoIf;
|
---|
1117 | /** @} */
|
---|
1118 |
|
---|
1119 | #ifdef VBOX_WITH_FULL_VM_ENCRYPTION
|
---|
1120 | /** Flag whether the log is encrypted. */
|
---|
1121 | bool m_fEncryptedLog;
|
---|
1122 | /** The file handle of the encrypted log. */
|
---|
1123 | RTVFSFILE m_hVfsFileLog;
|
---|
1124 | /** The logging output interface for encrypted logs. */
|
---|
1125 | RTLOGOUTPUTIF m_LogOutputIf;
|
---|
1126 | /** The log file key ID. */
|
---|
1127 | Utf8Str m_strLogKeyId;
|
---|
1128 | /** The log file key store. */
|
---|
1129 | Utf8Str m_strLogKeyStore;
|
---|
1130 | #endif
|
---|
1131 |
|
---|
1132 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
1133 | HGCMSVCEXTHANDLE m_hHgcmSvcExtDragAndDrop;
|
---|
1134 | #endif
|
---|
1135 |
|
---|
1136 | /** Pointer to the progress object of a live cancelable task.
|
---|
1137 | *
|
---|
1138 | * This is currently only used by Console::Teleport(), but is intended to later
|
---|
1139 | * be used by the live snapshot code path as well. Actions like
|
---|
1140 | * Console::PowerDown, which automatically cancels out the running snapshot /
|
---|
1141 | * teleportation operation, will cancel the teleportation / live snapshot
|
---|
1142 | * operation before starting. */
|
---|
1143 | ComPtr<IProgress> mptrCancelableProgress;
|
---|
1144 |
|
---|
1145 | ComPtr<IEventListener> mVmListener;
|
---|
1146 |
|
---|
1147 | #ifdef VBOX_WITH_RECORDING
|
---|
1148 | struct Recording
|
---|
1149 | {
|
---|
1150 | Recording()
|
---|
1151 | : mpCtx(NULL)
|
---|
1152 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
1153 | , mAudioRec(NULL)
|
---|
1154 | # endif
|
---|
1155 | { }
|
---|
1156 |
|
---|
1157 | /** The recording context. */
|
---|
1158 | RecordingContext *mpCtx;
|
---|
1159 | # ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
1160 | /** Pointer to capturing audio backend. */
|
---|
1161 | AudioVideoRec * const mAudioRec;
|
---|
1162 | # endif
|
---|
1163 | } mRecording;
|
---|
1164 | #endif /* VBOX_WITH_RECORDING */
|
---|
1165 |
|
---|
1166 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
1167 | GatewayInfo mGateway;
|
---|
1168 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
1169 |
|
---|
1170 | friend class VMTask;
|
---|
1171 | friend class ConsoleVRDPServer;
|
---|
1172 | };
|
---|
1173 |
|
---|
1174 | #endif /* !MAIN_INCLUDED_ConsoleImpl_h */
|
---|
1175 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|