VirtualBox

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

Last change on this file since 97864 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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