VirtualBox

source: vbox/trunk/include/VBox/ExtPack/ExtPack.h@ 93449

Last change on this file since 93449 was 93449, checked in by vboxsync, 3 years ago

Main,ExtPacks: Don't like with the VMM anymore, use the function table. bugref:10074

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.6 KB
Line 
1/** @file
2 * VirtualBox - Extension Pack Interface.
3 */
4
5/*
6 * Copyright (C) 2010-2022 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_ExtPack_ExtPack_h
27#define VBOX_INCLUDED_ExtPack_ExtPack_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33
34/** @def VBOXEXTPACK_IF_CS
35 * Selects 'class' on 'struct' for interface references.
36 * @param I The interface name
37 */
38#if defined(__cplusplus) && !defined(RT_OS_WINDOWS)
39# define VBOXEXTPACK_IF_CS(I) class I
40#else
41# define VBOXEXTPACK_IF_CS(I) struct I
42#endif
43
44VBOXEXTPACK_IF_CS(IUnknown);
45VBOXEXTPACK_IF_CS(IConsole);
46VBOXEXTPACK_IF_CS(IMachine);
47VBOXEXTPACK_IF_CS(IVirtualBox);
48VBOXEXTPACK_IF_CS(IProgress);
49VBOXEXTPACK_IF_CS(IEvent);
50VBOXEXTPACK_IF_CS(IVetoEvent);
51VBOXEXTPACK_IF_CS(IEventSource);
52
53/**
54 * Module kind for use with VBOXEXTPACKHLP::pfnFindModule.
55 */
56typedef enum VBOXEXTPACKMODKIND
57{
58 /** Zero is invalid as always. */
59 VBOXEXTPACKMODKIND_INVALID = 0,
60 /** Raw-mode context module. */
61 VBOXEXTPACKMODKIND_RC,
62 /** Ring-0 context module. */
63 VBOXEXTPACKMODKIND_R0,
64 /** Ring-3 context module. */
65 VBOXEXTPACKMODKIND_R3,
66 /** End of the valid values (exclusive). */
67 VBOXEXTPACKMODKIND_END,
68 /** The usual 32-bit type hack. */
69 VBOXEXTPACKMODKIND_32BIT_HACK = 0x7fffffff
70} VBOXEXTPACKMODKIND;
71
72/**
73 * Contexts returned by VBOXEXTPACKHLP::pfnGetContext.
74 */
75typedef enum VBOXEXTPACKCTX
76{
77 /** Zero is invalid as always. */
78 VBOXEXTPACKCTX_INVALID = 0,
79 /** The per-user daemon process (VBoxSVC). */
80 VBOXEXTPACKCTX_PER_USER_DAEMON,
81 /** A VM process. */
82 VBOXEXTPACKCTX_VM_PROCESS,
83 /** An API client process.
84 * @remarks This will not be returned by VirtualBox yet. */
85 VBOXEXTPACKCTX_CLIENT_PROCESS,
86 /** End of the valid values (exclusive). */
87 VBOXEXTPACKCTX_END,
88 /** The usual 32-bit type hack. */
89 VBOXEXTPACKCTX_32BIT_HACK = 0x7fffffff
90} VBOXEXTPACKCTX;
91
92
93/** Pointer to const helpers passed to the VBoxExtPackRegister() call. */
94typedef const struct VBOXEXTPACKHLP *PCVBOXEXTPACKHLP;
95/**
96 * Extension pack helpers passed to VBoxExtPackRegister().
97 *
98 * This will be valid until the module is unloaded.
99 */
100typedef struct VBOXEXTPACKHLP
101{
102 /** Interface version.
103 * This is set to VBOXEXTPACKHLP_VERSION. */
104 uint32_t u32Version;
105
106 /** The VirtualBox full version (see VBOX_FULL_VERSION). */
107 uint32_t uVBoxFullVersion;
108 /** The VirtualBox subversion tree revision. */
109 uint32_t uVBoxInternalRevision;
110 /** Explicit alignment padding, must be zero. */
111 uint32_t u32Padding;
112 /** Pointer to the version string (read-only). */
113 const char *pszVBoxVersion;
114
115 /**
116 * Finds a module belonging to this extension pack.
117 *
118 * @returns VBox status code.
119 * @param pHlp Pointer to this helper structure.
120 * @param pszName The module base name.
121 * @param pszExt The extension. If NULL the default ring-3
122 * library extension will be used.
123 * @param enmKind The kind of module to locate.
124 * @param pszFound Where to return the path to the module on
125 * success.
126 * @param cbFound The size of the buffer @a pszFound points to.
127 * @param pfNative Where to return the native/agnostic indicator.
128 */
129 DECLR3CALLBACKMEMBER(int, pfnFindModule,(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
130 VBOXEXTPACKMODKIND enmKind,
131 char *pszFound, size_t cbFound, bool *pfNative));
132
133 /**
134 * Gets the path to a file belonging to this extension pack.
135 *
136 * @returns VBox status code.
137 * @retval VERR_INVALID_POINTER if any of the pointers are invalid.
138 * @retval VERR_BUFFER_OVERFLOW if the buffer is too small. The buffer
139 * will contain nothing.
140 *
141 * @param pHlp Pointer to this helper structure.
142 * @param pszFilename The filename.
143 * @param pszPath Where to return the path to the file on
144 * success.
145 * @param cbPath The size of the buffer @a pszPath.
146 */
147 DECLR3CALLBACKMEMBER(int, pfnGetFilePath,(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath));
148
149 /**
150 * Gets the context the extension pack is operating in.
151 *
152 * @returns The context.
153 * @retval VBOXEXTPACKCTX_INVALID if @a pHlp is invalid.
154 *
155 * @param pHlp Pointer to this helper structure.
156 */
157 DECLR3CALLBACKMEMBER(VBOXEXTPACKCTX, pfnGetContext,(PCVBOXEXTPACKHLP pHlp));
158
159 /**
160 * Loads a HGCM service provided by an extension pack.
161 *
162 * @returns VBox status code.
163 * @param pHlp Pointer to this helper structure.
164 * @param pConsole Pointer to the VM's console object.
165 * @param pszServiceLibrary Name of the library file containing the
166 * service implementation, without extension.
167 * @param pszServiceName Name of HGCM service.
168 */
169 DECLR3CALLBACKMEMBER(int, pfnLoadHGCMService,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
170 const char *pszServiceLibrary, const char *pszServiceName));
171
172 /**
173 * Loads a VD plugin provided by an extension pack.
174 *
175 * This makes sense only in the context of the per-user service (VBoxSVC).
176 *
177 * @returns VBox status code.
178 * @param pHlp Pointer to this helper structure.
179 * @param pVirtualBox Pointer to the VirtualBox object.
180 * @param pszPluginLibrary Name of the library file containing the plugin
181 * implementation, without extension.
182 */
183 DECLR3CALLBACKMEMBER(int, pfnLoadVDPlugin,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
184 const char *pszPluginLibrary));
185
186 /**
187 * Unloads a VD plugin provided by an extension pack.
188 *
189 * This makes sense only in the context of the per-user service (VBoxSVC).
190 *
191 * @returns VBox status code.
192 * @param pHlp Pointer to this helper structure.
193 * @param pVirtualBox Pointer to the VirtualBox object.
194 * @param pszPluginLibrary Name of the library file containing the plugin
195 * implementation, without extension.
196 */
197 DECLR3CALLBACKMEMBER(int, pfnUnloadVDPlugin,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
198 const char *pszPluginLibrary));
199
200 /**
201 * Creates an IProgress object instance for a long running extension
202 * pack provided API operation which is executed asynchronously.
203 *
204 * This implicitly creates a cancellable progress object, since anything
205 * else is user unfriendly. You need to design your code to handle
206 * cancellation with reasonable response time.
207 *
208 * @returns COM status code.
209 * @param pHlp Pointer to this helper structure.
210 * @param pInitiator Pointer to the initiating object.
211 * @param pcszDescription Description of the overall task.
212 * @param cOperations Number of operations for this task.
213 * @param uTotalOperationsWeight Overall weight for the entire task.
214 * @param pcszFirstOperationDescription Description of the first operation.
215 * @param uFirstOperationWeight Weight for the first operation.
216 * @param ppProgressOut Output parameter for the IProgress object reference.
217 */
218 DECLR3CALLBACKMEMBER(uint32_t, pfnCreateProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IUnknown) *pInitiator,
219 const char *pcszDescription, uint32_t cOperations,
220 uint32_t uTotalOperationsWeight, const char *pcszFirstOperationDescription,
221 uint32_t uFirstOperationWeight, VBOXEXTPACK_IF_CS(IProgress) **ppProgressOut));
222
223 /**
224 * Checks if the Progress object is marked as canceled.
225 *
226 * @returns COM status code.
227 * @param pHlp Pointer to this helper structure.
228 * @param pProgress Pointer to the IProgress object reference returned
229 * by pfnCreateProgress.
230 * @param pfCanceled @c true if canceled, @c false otherwise.
231 */
232 DECLR3CALLBACKMEMBER(uint32_t, pfnGetCanceledProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress,
233 bool *pfCanceled));
234
235 /**
236 * Updates the percentage value of the current operation of the
237 * Progress object.
238 *
239 * @returns COM status code.
240 * @param pHlp Pointer to this helper structure.
241 * @param pProgress Pointer to the IProgress object reference returned
242 * by pfnCreateProgress.
243 * @param uPercent Result of the overall task.
244 */
245 DECLR3CALLBACKMEMBER(uint32_t, pfnUpdateProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress,
246 uint32_t uPercent));
247
248 /**
249 * Signals that the current operation is successfully completed and
250 * advances to the next operation. The operation percentage is reset
251 * to 0.
252 *
253 * If the operation count is exceeded this returns an error.
254 *
255 * @returns COM status code.
256 * @param pHlp Pointer to this helper structure.
257 * @param pProgress Pointer to the IProgress object reference returned
258 * by pfnCreateProgress.
259 * @param pcszNextOperationDescription Description of the next operation.
260 * @param uNextOperationWeight Weight for the next operation.
261 */
262 DECLR3CALLBACKMEMBER(uint32_t, pfnNextOperationProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress,
263 const char *pcszNextOperationDescription,
264 uint32_t uNextOperationWeight));
265
266 /**
267 * Waits until the other task is completed (including all sub-operations)
268 * and forward all changes from the other progress to this progress. This
269 * means sub-operation number, description, percent and so on.
270 *
271 * The caller is responsible for having at least the same count of
272 * sub-operations in this progress object as there are in the other
273 * progress object.
274 *
275 * If the other progress object supports cancel and this object gets any
276 * cancel request (when here enabled as well), it will be forwarded to
277 * the other progress object.
278 *
279 * Error information is automatically preserved (by transferring it to
280 * the current thread's error information). If the caller wants to set it
281 * as the completion state of this progress it needs to be done separately.
282 *
283 * @returns COM status code.
284 * @param pHlp Pointer to this helper structure.
285 * @param pProgress Pointer to the IProgress object reference returned
286 * by pfnCreateProgress.
287 * @param pProgressOther Pointer to an IProgress object reference, the one
288 * to be waited for.
289 * @param cTimeoutMS Timeout in milliseconds, 0 for indefinite wait.
290 */
291 DECLR3CALLBACKMEMBER(uint32_t, pfnWaitOtherProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress,
292 VBOXEXTPACK_IF_CS(IProgress) *pProgressOther,
293 uint32_t cTimeoutMS));
294
295 /**
296 * Marks the whole task as complete and sets the result code.
297 *
298 * If the result code indicates a failure then this method will store
299 * the currently set COM error info from the current thread in the
300 * the errorInfo attribute of this Progress object instance. If there
301 * is no error information available then an error is returned.
302 *
303 * If the result code indicates success then the task is terminated,
304 * without paying attention to the current operation being the last.
305 *
306 * Note that this must be called only once for the given Progress
307 * object. Subsequent calls will return errors.
308 *
309 * @returns COM status code.
310 * @param pHlp Pointer to this helper structure.
311 * @param pProgress Pointer to the IProgress object reference returned
312 * by pfnCreateProgress.
313 * @param uResultCode Result of the overall task.
314 */
315 DECLR3CALLBACKMEMBER(uint32_t, pfnCompleteProgress,(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress,
316 uint32_t uResultCode));
317
318
319 DECLR3CALLBACKMEMBER(uint32_t, pfnCreateEvent,(PCVBOXEXTPACKHLP pHlp,
320 VBOXEXTPACK_IF_CS(IEventSource) *aSource,
321 /* VBoxEventType_T */ uint32_t aType, bool aWaitable,
322 VBOXEXTPACK_IF_CS(IEvent) **ppEventOut));
323
324 DECLR3CALLBACKMEMBER(uint32_t, pfnCreateVetoEvent,(PCVBOXEXTPACKHLP pHlp,
325 VBOXEXTPACK_IF_CS(IEventSource) *aSource,
326 /* VBoxEventType_T */ uint32_t aType,
327 VBOXEXTPACK_IF_CS(IVetoEvent) **ppEventOut));
328
329 /**
330 * Translate the string using registered translation files.
331 *
332 * Translation files are excluded from translation engine. Although
333 * the already loaded translation remains in the translation cache the new
334 * translation will not be loaded after returning from the function if the
335 * user changes the language.
336 *
337 * @returns Translated string on success the pszSourceText otherwise.
338 * @param pHlp Pointer to this helper structure.
339 * @param aComponent Translation context e.g. class name
340 * @param pszSourceText String to translate
341 * @param pszComment Comment to the string to resolve possible ambiguities
342 * (NULL means no comment).
343 * @param aNum Number used to define plural form of the translation
344 */
345 DECLR3CALLBACKMEMBER(const char *, pfnTranslate,(PCVBOXEXTPACKHLP pHlp,
346 const char *pszComponent,
347 const char *pszSourceText,
348 const char *pszComment,
349 const size_t aNum));
350
351 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
352 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
353 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
354 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
355 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
356 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
357
358 /** Reserved for minor structure revisions. */
359 uint32_t uReserved7;
360
361 /** End of structure marker (VBOXEXTPACKHLP_VERSION). */
362 uint32_t u32EndMarker;
363} VBOXEXTPACKHLP;
364/** Current version of the VBOXEXTPACKHLP structure. */
365#define VBOXEXTPACKHLP_VERSION RT_MAKE_U32(0, 5)
366
367
368/** Pointer to the extension pack callback table. */
369typedef struct VBOXEXTPACKREG const *PCVBOXEXTPACKREG;
370/**
371 * Callback table returned by VBoxExtPackRegister.
372 *
373 * All the callbacks are called the context of the per-user service (VBoxSVC).
374 *
375 * This must be valid until the extension pack main module is unloaded.
376 */
377typedef struct VBOXEXTPACKREG
378{
379 /** Interface version.
380 * This is set to VBOXEXTPACKREG_VERSION. */
381 uint32_t u32Version;
382 /** The VirtualBox version this extension pack was built against. */
383 uint32_t uVBoxVersion;
384 /** Translation files base name. Set to NULL if no translation files. */
385 const char *pszNlsBaseName;
386
387 /**
388 * Hook for doing setups after the extension pack was installed.
389 *
390 * @returns VBox status code.
391 * @retval VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL if the extension pack
392 * requires some different host version or a prerequisite is
393 * missing from the host. Automatic uninstall will be attempted.
394 * Must set error info.
395 *
396 * @param pThis Pointer to this structure.
397 * @param pVirtualBox The VirtualBox interface.
398 * @param pErrInfo Where to return extended error information.
399 */
400 DECLCALLBACKMEMBER(int, pfnInstalled,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
401 PRTERRINFO pErrInfo));
402
403 /**
404 * Hook for cleaning up before the extension pack is uninstalled.
405 *
406 * @returns VBox status code.
407 * @param pThis Pointer to this structure.
408 * @param pVirtualBox The VirtualBox interface.
409 *
410 * @todo This is currently called holding locks making pVirtualBox
411 * relatively unusable.
412 */
413 DECLCALLBACKMEMBER(int, pfnUninstall,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox));
414
415 /**
416 * Hook for doing work after the VirtualBox object is ready.
417 *
418 * @param pThis Pointer to this structure.
419 * @param pVirtualBox The VirtualBox interface.
420 */
421 DECLCALLBACKMEMBER(void, pfnVirtualBoxReady,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox));
422
423 /**
424 * Hook for doing work before unloading.
425 *
426 * @param pThis Pointer to this structure.
427 *
428 * @remarks The helpers are not available at this point in time.
429 * @remarks This is not called on uninstall, then pfnUninstall will be the
430 * last callback.
431 */
432 DECLCALLBACKMEMBER(void, pfnUnload,(PCVBOXEXTPACKREG pThis));
433
434 /**
435 * Hook for changing the default VM configuration upon creation.
436 *
437 * @returns VBox status code.
438 * @param pThis Pointer to this structure.
439 * @param pVirtualBox The VirtualBox interface.
440 * @param pMachine The machine interface.
441 */
442 DECLCALLBACKMEMBER(int, pfnVMCreated,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
443 VBOXEXTPACK_IF_CS(IMachine) *pMachine));
444
445 /**
446 * Query the IUnknown interface to an object in the main module.
447 *
448 * @returns IUnknown pointer (referenced) on success, NULL on failure.
449 * @param pThis Pointer to this structure.
450 * @param pObjectId Pointer to the object ID (UUID).
451 */
452 DECLCALLBACKMEMBER(void *, pfnQueryObject,(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId));
453
454 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
455 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
456 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
457 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
458 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
459 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
460
461 /** Reserved for minor structure revisions. */
462 uint32_t uReserved7;
463
464 /** End of structure marker (VBOXEXTPACKREG_VERSION). */
465 uint32_t u32EndMarker;
466} VBOXEXTPACKREG;
467/** Current version of the VBOXEXTPACKREG structure. */
468#define VBOXEXTPACKREG_VERSION RT_MAKE_U32(0, 3)
469
470
471/**
472 * The VBoxExtPackRegister callback function.
473 *
474 * The Main API (as in VBoxSVC) will invoke this function after loading an
475 * extension pack Main module. Its job is to do version compatibility checking
476 * and returning the extension pack registration structure.
477 *
478 * @returns VBox status code.
479 * @param pHlp Pointer to the extension pack helper function
480 * table. This is valid until the module is unloaded.
481 * @param ppReg Where to return the pointer to the registration
482 * structure containing all the hooks. This structure
483 * be valid and unchanged until the module is unloaded
484 * (i.e. use some static const data for it).
485 * @param pErrInfo Where to return extended error information.
486 */
487typedef DECLCALLBACKTYPE(int, FNVBOXEXTPACKREGISTER,(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo));
488/** Pointer to a FNVBOXEXTPACKREGISTER. */
489typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER;
490
491/** The name of the main module entry point. */
492#define VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT "VBoxExtPackRegister"
493
494
495/** Pointer to the extension pack VM callback table. */
496typedef struct VBOXEXTPACKVMREG const *PCVBOXEXTPACKVMREG;
497/**
498 * Callback table returned by VBoxExtPackVMRegister.
499 *
500 * All the callbacks are called the context of a VM process.
501 *
502 * This must be valid until the extension pack main VM module is unloaded.
503 */
504typedef struct VBOXEXTPACKVMREG
505{
506 /** Interface version.
507 * This is set to VBOXEXTPACKVMREG_VERSION. */
508 uint32_t u32Version;
509 /** The VirtualBox version this extension pack was built against. */
510 uint32_t uVBoxVersion;
511 /** Translation files base name. Set to NULL if no translation files. */
512 const char *pszNlsBaseName;
513
514 /**
515 * Hook for doing work after the Console object is ready.
516 *
517 * @param pThis Pointer to this structure.
518 * @param pConsole The Console interface.
519 */
520 DECLCALLBACKMEMBER(void, pfnConsoleReady,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole));
521
522 /**
523 * Hook for doing work before unloading.
524 *
525 * @param pThis Pointer to this structure.
526 *
527 * @remarks The helpers are not available at this point in time.
528 */
529 DECLCALLBACKMEMBER(void, pfnUnload,(PCVBOXEXTPACKVMREG pThis));
530
531 /**
532 * Hook for configuring the VMM for a VM.
533 *
534 * @returns VBox status code.
535 * @param pThis Pointer to this structure.
536 * @param pConsole The console interface.
537 * @param pVM The cross context VM structure.
538 * @param pVMM The VMM function table.
539 */
540 DECLCALLBACKMEMBER(int, pfnVMConfigureVMM,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
541 PVM pVM, PCVMMR3VTABLE pVMM));
542
543 /**
544 * Hook for doing work right before powering on the VM.
545 *
546 * @returns VBox status code.
547 * @param pThis Pointer to this structure.
548 * @param pConsole The console interface.
549 * @param pVM The cross context VM structure.
550 * @param pVMM The VMM function table.
551 */
552 DECLCALLBACKMEMBER(int, pfnVMPowerOn,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
553 PVM pVM, PCVMMR3VTABLE pVMM));
554
555 /**
556 * Hook for doing work after powering off the VM.
557 *
558 * @param pThis Pointer to this structure.
559 * @param pConsole The console interface.
560 * @param pVM The cross context VM structure. Can be NULL.
561 * @param pVMM The VMM function table.
562 */
563 DECLCALLBACKMEMBER(void, pfnVMPowerOff,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
564 PVM pVM, PCVMMR3VTABLE pVMM));
565
566 /**
567 * Query the IUnknown interface to an object in the main VM module.
568 *
569 * @returns IUnknown pointer (referenced) on success, NULL on failure.
570 * @param pThis Pointer to this structure.
571 * @param pObjectId Pointer to the object ID (UUID).
572 */
573 DECLCALLBACKMEMBER(void *, pfnQueryObject,(PCVBOXEXTPACKVMREG pThis, PCRTUUID pObjectId));
574
575 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
576 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
577 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
578 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
579 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
580 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
581
582 /** Reserved for minor structure revisions. */
583 uint32_t uReserved7;
584
585 /** End of structure marker (VBOXEXTPACKVMREG_VERSION). */
586 uint32_t u32EndMarker;
587} VBOXEXTPACKVMREG;
588/** Current version of the VBOXEXTPACKVMREG structure. */
589#define VBOXEXTPACKVMREG_VERSION RT_MAKE_U32(1, 0)
590
591
592/**
593 * The VBoxExtPackVMRegister callback function.
594 *
595 * The Main API (in a VM process) will invoke this function after loading an
596 * extension pack VM module. Its job is to do version compatibility checking
597 * and returning the extension pack registration structure for a VM.
598 *
599 * @returns VBox status code.
600 * @param pHlp Pointer to the extension pack helper function
601 * table. This is valid until the module is unloaded.
602 * @param ppReg Where to return the pointer to the registration
603 * structure containing all the hooks. This structure
604 * be valid and unchanged until the module is unloaded
605 * (i.e. use some static const data for it).
606 * @param pErrInfo Where to return extended error information.
607 */
608typedef DECLCALLBACKTYPE(int, FNVBOXEXTPACKVMREGISTER,(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKVMREG *ppReg, PRTERRINFO pErrInfo));
609/** Pointer to a FNVBOXEXTPACKVMREGISTER. */
610typedef FNVBOXEXTPACKVMREGISTER *PFNVBOXEXTPACKVMREGISTER;
611
612/** The name of the main VM module entry point. */
613#define VBOX_EXTPACK_MAIN_VM_MOD_ENTRY_POINT "VBoxExtPackVMRegister"
614
615
616/**
617 * Checks if extension pack interface version is compatible.
618 *
619 * @returns true if the do, false if they don't.
620 * @param u32Provider The provider version.
621 * @param u32User The user version.
622 */
623#define VBOXEXTPACK_IS_VER_COMPAT(u32Provider, u32User) \
624 ( VBOXEXTPACK_IS_MAJOR_VER_EQUAL(u32Provider, u32User) \
625 && (int32_t)RT_LOWORD(u32Provider) >= (int32_t)RT_LOWORD(u32User) ) /* stupid casts to shut up gcc */
626
627/**
628 * Check if two extension pack interface versions has the same major version.
629 *
630 * @returns true if the do, false if they don't.
631 * @param u32Ver1 The first version number.
632 * @param u32Ver2 The second version number.
633 */
634#define VBOXEXTPACK_IS_MAJOR_VER_EQUAL(u32Ver1, u32Ver2) (RT_HIWORD(u32Ver1) == RT_HIWORD(u32Ver2))
635
636#endif /* !VBOX_INCLUDED_ExtPack_ExtPack_h */
637
Note: See TracBrowser for help on using the repository browser.

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