VirtualBox

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

Last change on this file since 74948 was 74804, checked in by vboxsync, 6 years ago

Main/Progress: Split into safe public interface and a private one which is used purely by API implementation code (for updating). Needed quite a few minor adjustments elsewhere.

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