VirtualBox

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

Last change on this file since 86620 was 86060, checked in by vboxsync, 4 years ago

Main/ExtPack: Forward declare IVetoEvent.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.7 KB
Line 
1/** @file
2 * VirtualBox - Extension Pack Interface.
3 */
4
5/*
6 * Copyright (C) 2010-2020 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 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
330 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
331 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
332 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
333 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
334 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */
335
336 /** End of structure marker (VBOXEXTPACKHLP_VERSION). */
337 uint32_t u32EndMarker;
338} VBOXEXTPACKHLP;
339/** Current version of the VBOXEXTPACKHLP structure. */
340#define VBOXEXTPACKHLP_VERSION RT_MAKE_U32(4, 0)
341
342
343/** Pointer to the extension pack callback table. */
344typedef struct VBOXEXTPACKREG const *PCVBOXEXTPACKREG;
345/**
346 * Callback table returned by VBoxExtPackRegister.
347 *
348 * All the callbacks are called the context of the per-user service (VBoxSVC).
349 *
350 * This must be valid until the extension pack main module is unloaded.
351 */
352typedef struct VBOXEXTPACKREG
353{
354 /** Interface version.
355 * This is set to VBOXEXTPACKREG_VERSION. */
356 uint32_t u32Version;
357 /** The VirtualBox version this extension pack was built against. */
358 uint32_t uVBoxVersion;
359
360 /**
361 * Hook for doing setups after the extension pack was installed.
362 *
363 * @returns VBox status code.
364 * @retval VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL if the extension pack
365 * requires some different host version or a prerequisite is
366 * missing from the host. Automatic uninstall will be attempted.
367 * Must set error info.
368 *
369 * @param pThis Pointer to this structure.
370 * @param pVirtualBox The VirtualBox interface.
371 * @param pErrInfo Where to return extended error information.
372 */
373 DECLCALLBACKMEMBER(int, pfnInstalled,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
374 PRTERRINFO pErrInfo));
375
376 /**
377 * Hook for cleaning up before the extension pack is uninstalled.
378 *
379 * @returns VBox status code.
380 * @param pThis Pointer to this structure.
381 * @param pVirtualBox The VirtualBox interface.
382 *
383 * @todo This is currently called holding locks making pVirtualBox
384 * relatively unusable.
385 */
386 DECLCALLBACKMEMBER(int, pfnUninstall,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox));
387
388 /**
389 * Hook for doing work after the VirtualBox object is ready.
390 *
391 * @param pThis Pointer to this structure.
392 * @param pVirtualBox The VirtualBox interface.
393 */
394 DECLCALLBACKMEMBER(void, pfnVirtualBoxReady,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox));
395
396 /**
397 * Hook for doing work before unloading.
398 *
399 * @param pThis Pointer to this structure.
400 *
401 * @remarks The helpers are not available at this point in time.
402 * @remarks This is not called on uninstall, then pfnUninstall will be the
403 * last callback.
404 */
405 DECLCALLBACKMEMBER(void, pfnUnload,(PCVBOXEXTPACKREG pThis));
406
407 /**
408 * Hook for changing the default VM configuration upon creation.
409 *
410 * @returns VBox status code.
411 * @param pThis Pointer to this structure.
412 * @param pVirtualBox The VirtualBox interface.
413 * @param pMachine The machine interface.
414 */
415 DECLCALLBACKMEMBER(int, pfnVMCreated,(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox,
416 VBOXEXTPACK_IF_CS(IMachine) *pMachine));
417
418 /**
419 * Query the IUnknown interface to an object in the main module.
420 *
421 * @returns IUnknown pointer (referenced) on success, NULL on failure.
422 * @param pThis Pointer to this structure.
423 * @param pObjectId Pointer to the object ID (UUID).
424 */
425 DECLCALLBACKMEMBER(void *, pfnQueryObject,(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId));
426
427 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
428 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
429 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
430 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
431 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
432 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKREG pThis)); /**< Reserved for minor structure revisions. */
433
434 /** Reserved for minor structure revisions. */
435 uint32_t uReserved7;
436
437 /** End of structure marker (VBOXEXTPACKREG_VERSION). */
438 uint32_t u32EndMarker;
439} VBOXEXTPACKREG;
440/** Current version of the VBOXEXTPACKREG structure. */
441#define VBOXEXTPACKREG_VERSION RT_MAKE_U32(2, 0)
442
443
444/**
445 * The VBoxExtPackRegister callback function.
446 *
447 * The Main API (as in VBoxSVC) will invoke this function after loading an
448 * extension pack Main module. Its job is to do version compatibility checking
449 * and returning the extension pack registration structure.
450 *
451 * @returns VBox status code.
452 * @param pHlp Pointer to the extension pack helper function
453 * table. This is valid until the module is unloaded.
454 * @param ppReg Where to return the pointer to the registration
455 * structure containing all the hooks. This structure
456 * be valid and unchanged until the module is unloaded
457 * (i.e. use some static const data for it).
458 * @param pErrInfo Where to return extended error information.
459 */
460typedef DECLCALLBACKTYPE(int, FNVBOXEXTPACKREGISTER,(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo));
461/** Pointer to a FNVBOXEXTPACKREGISTER. */
462typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER;
463
464/** The name of the main module entry point. */
465#define VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT "VBoxExtPackRegister"
466
467
468/** Pointer to the extension pack VM callback table. */
469typedef struct VBOXEXTPACKVMREG const *PCVBOXEXTPACKVMREG;
470/**
471 * Callback table returned by VBoxExtPackVMRegister.
472 *
473 * All the callbacks are called the context of a VM process.
474 *
475 * This must be valid until the extension pack main VM module is unloaded.
476 */
477typedef struct VBOXEXTPACKVMREG
478{
479 /** Interface version.
480 * This is set to VBOXEXTPACKVMREG_VERSION. */
481 uint32_t u32Version;
482 /** The VirtualBox version this extension pack was built against. */
483 uint32_t uVBoxVersion;
484
485 /**
486 * Hook for doing work after the Console object is ready.
487 *
488 * @param pThis Pointer to this structure.
489 * @param pConsole The Console interface.
490 */
491 DECLCALLBACKMEMBER(void, pfnConsoleReady,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole));
492
493 /**
494 * Hook for doing work before unloading.
495 *
496 * @param pThis Pointer to this structure.
497 *
498 * @remarks The helpers are not available at this point in time.
499 */
500 DECLCALLBACKMEMBER(void, pfnUnload,(PCVBOXEXTPACKVMREG pThis));
501
502 /**
503 * Hook for configuring the VMM for a VM.
504 *
505 * @returns VBox status code.
506 * @param pThis Pointer to this structure.
507 * @param pConsole The console interface.
508 * @param pVM The cross context VM structure.
509 */
510 DECLCALLBACKMEMBER(int, pfnVMConfigureVMM,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM));
511
512 /**
513 * Hook for doing work right before powering on the VM.
514 *
515 * @returns VBox status code.
516 * @param pThis Pointer to this structure.
517 * @param pConsole The console interface.
518 * @param pVM The cross context VM structure.
519 */
520 DECLCALLBACKMEMBER(int, pfnVMPowerOn,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM));
521
522 /**
523 * Hook for doing work after powering off the VM.
524 *
525 * @param pThis Pointer to this structure.
526 * @param pConsole The console interface.
527 * @param pVM The cross context VM structure. Can be NULL.
528 */
529 DECLCALLBACKMEMBER(void, pfnVMPowerOff,(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM));
530
531 /**
532 * Query the IUnknown interface to an object in the main VM module.
533 *
534 * @returns IUnknown pointer (referenced) on success, NULL on failure.
535 * @param pThis Pointer to this structure.
536 * @param pObjectId Pointer to the object ID (UUID).
537 */
538 DECLCALLBACKMEMBER(void *, pfnQueryObject,(PCVBOXEXTPACKVMREG pThis, PCRTUUID pObjectId));
539
540 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
541 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
542 DECLR3CALLBACKMEMBER(int, pfnReserved3,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
543 DECLR3CALLBACKMEMBER(int, pfnReserved4,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
544 DECLR3CALLBACKMEMBER(int, pfnReserved5,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
545 DECLR3CALLBACKMEMBER(int, pfnReserved6,(PCVBOXEXTPACKVMREG pThis)); /**< Reserved for minor structure revisions. */
546
547 /** Reserved for minor structure revisions. */
548 uint32_t uReserved7;
549
550 /** End of structure marker (VBOXEXTPACKVMREG_VERSION). */
551 uint32_t u32EndMarker;
552} VBOXEXTPACKVMREG;
553/** Current version of the VBOXEXTPACKVMREG structure. */
554#define VBOXEXTPACKVMREG_VERSION RT_MAKE_U32(2, 0)
555
556
557/**
558 * The VBoxExtPackVMRegister callback function.
559 *
560 * The Main API (in a VM process) will invoke this function after loading an
561 * extension pack VM module. Its job is to do version compatibility checking
562 * and returning the extension pack registration structure for a VM.
563 *
564 * @returns VBox status code.
565 * @param pHlp Pointer to the extension pack helper function
566 * table. This is valid until the module is unloaded.
567 * @param ppReg Where to return the pointer to the registration
568 * structure containing all the hooks. This structure
569 * be valid and unchanged until the module is unloaded
570 * (i.e. use some static const data for it).
571 * @param pErrInfo Where to return extended error information.
572 */
573typedef DECLCALLBACKTYPE(int, FNVBOXEXTPACKVMREGISTER,(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKVMREG *ppReg, PRTERRINFO pErrInfo));
574/** Pointer to a FNVBOXEXTPACKVMREGISTER. */
575typedef FNVBOXEXTPACKVMREGISTER *PFNVBOXEXTPACKVMREGISTER;
576
577/** The name of the main VM module entry point. */
578#define VBOX_EXTPACK_MAIN_VM_MOD_ENTRY_POINT "VBoxExtPackVMRegister"
579
580
581/**
582 * Checks if extension pack interface version is compatible.
583 *
584 * @returns true if the do, false if they don't.
585 * @param u32Provider The provider version.
586 * @param u32User The user version.
587 */
588#define VBOXEXTPACK_IS_VER_COMPAT(u32Provider, u32User) \
589 ( VBOXEXTPACK_IS_MAJOR_VER_EQUAL(u32Provider, u32User) \
590 && (int32_t)RT_LOWORD(u32Provider) >= (int32_t)RT_LOWORD(u32User) ) /* stupid casts to shut up gcc */
591
592/**
593 * Check if two extension pack interface versions has the same major version.
594 *
595 * @returns true if the do, false if they don't.
596 * @param u32Ver1 The first version number.
597 * @param u32Ver2 The second version number.
598 */
599#define VBOXEXTPACK_IS_MAJOR_VER_EQUAL(u32Ver1, u32Ver2) (RT_HIWORD(u32Ver1) == RT_HIWORD(u32Ver2))
600
601#endif /* !VBOX_INCLUDED_ExtPack_ExtPack_h */
602
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