VirtualBox

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

Last change on this file since 74715 was 74219, checked in by vboxsync, 6 years ago

Main/ExtPack: Add another extpack helper function related to IProgress objects ( a bit of a hack, skipping the version bump)

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