diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
commit | f215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch) | |
tree | 6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/ExtPacks/Skeleton | |
parent | Initial commit. (diff) | |
download | virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip |
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/VBox/ExtPacks/Skeleton/.scm-settings | 33 | ||||
-rw-r--r-- | src/VBox/ExtPacks/Skeleton/ExtPack.xml | 11 | ||||
-rw-r--r-- | src/VBox/ExtPacks/Skeleton/Makefile.kmk | 171 | ||||
-rw-r--r-- | src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp | 130 | ||||
-rw-r--r-- | src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp | 130 |
5 files changed, 475 insertions, 0 deletions
diff --git a/src/VBox/ExtPacks/Skeleton/.scm-settings b/src/VBox/ExtPacks/Skeleton/.scm-settings new file mode 100644 index 00000000..14dcf95b --- /dev/null +++ b/src/VBox/ExtPacks/Skeleton/.scm-settings @@ -0,0 +1,33 @@ +# $Id: .scm-settings $ +## @file +# Source code massager settings for extension pack skeleton. +# + +# +# Copyright (C) 2010-2023 Oracle and/or its affiliates. +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +# This directory contains sample code and are therefore under MIT license. +--license-mit + diff --git a/src/VBox/ExtPacks/Skeleton/ExtPack.xml b/src/VBox/ExtPacks/Skeleton/ExtPack.xml new file mode 100644 index 00000000..a8e8726b --- /dev/null +++ b/src/VBox/ExtPacks/Skeleton/ExtPack.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<VirtualBoxExtensionPack xmlns="http://www.virtualbox.org/VirtualBoxExtensionPack" version="1.0"> + <Name>Skeleton</Name> + <Description>The extension pack skeleton sample.</Description> + <Version revision="@VBOX_SVN_REV@">@VBOX_VERSION_STRING@</Version> + <MainModule>VBoxSkeletonMain</MainModule> + <MainVMModule>VBoxSkeletonMainVM</MainVMModule> + <!-- VRDEModule>VBoxVNC</VRDEModule --> + <ShowLicense/> +</VirtualBoxExtensionPack> + diff --git a/src/VBox/ExtPacks/Skeleton/Makefile.kmk b/src/VBox/ExtPacks/Skeleton/Makefile.kmk new file mode 100644 index 00000000..1dd4ba8c --- /dev/null +++ b/src/VBox/ExtPacks/Skeleton/Makefile.kmk @@ -0,0 +1,171 @@ +# $Id: Makefile.kmk $ +## @file +# Sub-Makefile for the Skeleton Extension Pack Sample. +# + +# +# Copyright (C) 2010-2023 Oracle and/or its affiliates. +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +SUB_DEPTH = ../../../.. +include $(KBUILD_PATH)/subheader.kmk + +# +# Extend the extension pack templates. +# +TEMPLATE_VBoxR3ExtPackSkeleton = For the ring-3 context modules in the Skeleton extension pack. +TEMPLATE_VBoxR3ExtPackSkeleton_EXTENDS = VBoxR3ExtPack +TEMPLATE_VBoxR3ExtPackSkeleton_INST = $(INST_EXTPACK)Skeleton/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ + +TEMPLATE_VBoxR0ExtPackSkeleton = For the ring-0 context modules in the Skeleton extension pack. +TEMPLATE_VBoxR0ExtPackSkeleton_EXTENDS = VBoxR0ExtPack +TEMPLATE_VBoxR0ExtPackSkeleton_INST = $(INST_EXTPACK)Skeleton/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ + +TEMPLATE_VBoxRcExtPackSkeleton = For the raw-mode context modules in the Skeleton extension pack. +TEMPLATE_VBoxRcExtPackSkeleton_EXTENDS = VBoxRcExtPack +TEMPLATE_VBoxRcExtPackSkeleton_INST = $(INST_EXTPACK)Skeleton/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ + +TEMPLATE_VBoxInsExtPackSkeleton = For the install targets of an extension pack. +TEMPLATE_VBoxInsExtPackSkeleton_EXTENDS = VBoxR0ExtPack +TEMPLATE_VBoxInsExtPackSkeleton_INST = $(INST_EXTPACK)Skeleton/ + +# +# Globals. +# +VBOX_SKELETON_NAME = Skeleton +VBOX_SKELETON_MANGLED_NAME = Skeleton +VBOX_PATH_EXTPACK_SKELETON = $(PATH_STAGE)/$(INST_EXTPACK)Skeleton + + +# +# VBoxSkeletonMain - The module which the VirtualBox Main API talks to. +# +DLLS += VBoxSkeletonMain +VBoxSkeletonMain_TEMPLATE = VBoxR3ExtPackSkeleton +VBoxSkeletonMain_SOURCES = VBoxSkeletonMain.cpp +VBoxSkeletonMain_DEFS = + +# +# VBoxSkeletonMainVM - The module in a VM which the VirtualBox Main API talks to. +# +DLLS += VBoxSkeletonMainVM +VBoxSkeletonMainVM_TEMPLATE = VBoxR3ExtPackSkeleton +VBoxSkeletonMainVM_SOURCES = VBoxSkeletonMainVM.cpp +VBoxSkeletonMainVM_DEFS = + +# +# Install the description. +# +INSTALLS += VBoxSkeletonIns +VBoxSkeletonIns_TEMPLATE = VBoxInsExtPackSkeleton +VBoxSkeletonIns_SOURCES = \ + $(VBoxSkeletonIns_0_OUTDIR)/ExtPack.xml +$(call VBOX_EDIT_VERSION_RULE_FN,VBoxSkeletonIns,ExtPack.xml) + + +# +# Packing. +# +ifndef VBOX_WITHOUT_EXTPACK_SKELETON_PACKING + PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_SKELETON_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack +endif + +ifndef VBOX_WITH_EXTPACK_OS_ARCHS + ifeq ($(USER),bird) # for now + VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) + endif +endif + +# Build the file list. The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib +VBOX_SKELETON_FILES_MACRO = \ + $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_SKELETON_MANGLED_NAME)/$(1)/VBoxSkeletonMain.$(3)=>$(1)/VBoxSkeletonMain.$(3) \ + $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_SKELETON_MANGLED_NAME)/$(1)/VBoxSkeletonMainVM.$(3)=>$(1)/VBoxSkeletonMainVM.$(3) + +VBOX_SKELETON_FILES := \ + $(VBOX_PATH_EXTPACK_SKELETON)/ExtPack.xml=>ExtPack.xml + +if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib) +endif +if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib) +endif +if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,freebsd.amd64,bin,so) +endif +if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,freebsd.x86,bin,so) +endif +if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,linux.amd64,bin,so) +endif +if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,linux.x86,bin,so) +endif +if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,os2.x86,bin,so) +endif +if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,solaris.amd64,bin,so) +endif +if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,solaris.x86,bin,so) +endif +if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,win.amd64,bin,dll) +endif +if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS)) + VBOX_SKELETON_FILES += $(call VBOX_SKELETON_FILES_MACRO,win.x86,bin,dll) +endif + +# Pack it all up using a temporary staging directory. +$(VBOX_PATH_PACKAGES)/$(VBOX_SKELETON_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \ + $$(foreach file, $$(VBOX_SKELETON_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \ + | $(VBOX_PATH_PACKAGES)/ + $(RM) -f $(wildcard $(VBOX_PATH_PACKAGES)/$(VBOX_SKELETON_MANGLED_NAME)-*.vbox-extpack) \ + $(VBoxSkeletonIns_0_OUTDIR)/ExtPack.manifest \ + $(VBoxSkeletonIns_0_OUTDIR)/ExtPack.signature +# Stage all the files + $(RM) -Rf $(VBoxSkeletonIns_0_OUTDIR)/Stage/ + $(foreach file, $(VBOX_SKELETON_FILES),\ + $(NLTAB)$(MKDIR) -p $(dir $(lastword $(subst =>,$(SP)$(VBoxSkeletonIns_0_OUTDIR)/Stage/,$(file)))) \ + $(NLTAB)$(CP) $(subst =>,$(SP)$(VBoxSkeletonIns_0_OUTDIR)/Stage/,$(file)) ) +# Create the manifest + $(VBOX_RTMANIFEST) \ + --manifest $(VBoxSkeletonIns_0_OUTDIR)/Stage/ExtPack.manifest \ + --chdir $(VBoxSkeletonIns_0_OUTDIR)/Stage/ \ + $(foreach file, $(VBOX_SKELETON_FILES), $(lastword $(subst =>,$(SP),$(file)))) + $(APPEND) $(VBoxSkeletonIns_0_OUTDIR)/Stage/ExtPack.signature "todo" + $(CHMOD) a+r \ + $(VBoxSkeletonIns_0_OUTDIR)/Stage/ExtPack.manifest \ + $(VBoxSkeletonIns_0_OUTDIR)/Stage/ExtPack.signature +# Tar it up. + tar -cvf - -C $(VBoxSkeletonIns_0_OUTDIR)/Stage/ . | gzip -9c > $@ +# Clean up + $(RM) -Rf $(VBoxSkeletonIns_0_OUTDIR)/Stage/ + +BLDDIRS += $(VBOX_PATH_PACKAGES)/ + +include $(FILE_KBUILD_SUB_FOOTER) + diff --git a/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp b/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp new file mode 100644 index 00000000..9d7d8d5b --- /dev/null +++ b/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp @@ -0,0 +1,130 @@ +/* $Id: VBoxSkeletonMain.cpp $ */ +/** @file + * Skeleton main module. + */ + +/* + * Copyright (C) 2010-2023 Oracle and/or its affiliates. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#include <VBox/ExtPack/ExtPack.h> + +#include <iprt/errcore.h> +#include <VBox/version.h> +#include <iprt/string.h> +#include <iprt/param.h> +#include <iprt/path.h> + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ +/** Pointer to the extension pack helpers. */ +static PCVBOXEXTPACKHLP g_pHlp; + + +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, PRTERRINFO pErrInfo); +// +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall} +// */ +// static DECLCALLBACK(int) vboxSkeletonExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox); +// +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox); +// +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPack_Unload(PCVBOXEXTPACKREG pThis); +// +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated} +// */ +// static DECLCALLBACK(int) vboxSkeletonExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, VBOXEXTPACK_IF_CS(IMachine) *pMachine); +// +// /** +// * @interface_method_impl{VBOXEXTPACKREG,pfnQueryObject} +// */ +// static DECLCALLBACK(int) vboxSkeletonExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId); + + +static const VBOXEXTPACKREG g_vboxSkeletonExtPackReg = +{ + VBOXEXTPACKREG_VERSION, + /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, + /* .pszNlsBaseName = */ NULL, + /* .pfnInstalled = */ NULL, + /* .pfnUninstall = */ NULL, + /* .pfnVirtualBoxReady =*/ NULL, + /* .pfnUnload = */ NULL, + /* .pfnVMCreated = */ NULL, + /* .pfnQueryObject = */ NULL, + /* .pfnReserved1 = */ NULL, + /* .pfnReserved2 = */ NULL, + /* .pfnReserved3 = */ NULL, + /* .pfnReserved4 = */ NULL, + /* .pfnReserved5 = */ NULL, + /* .pfnReserved6 = */ NULL, + /* .uReserved7 = */ 0, + VBOXEXTPACKREG_VERSION +}; + + +/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */ +extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo) +{ + /* + * Check the VirtualBox version. + */ + if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION)) + return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH, + "Helper version mismatch - expected %#x got %#x", + VBOXEXTPACKHLP_VERSION, pHlp->u32Version); + if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR + || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR) + return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH, + "VirtualBox version mismatch - expected %u.%u got %u.%u", + VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, + VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion), + VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion)); + + /* + * We're good, save input and return the registration structure. + */ + g_pHlp = pHlp; + *ppReg = &g_vboxSkeletonExtPackReg; + + return VINF_SUCCESS; +} + diff --git a/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp b/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp new file mode 100644 index 00000000..56063db1 --- /dev/null +++ b/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp @@ -0,0 +1,130 @@ +/* $Id: VBoxSkeletonMainVM.cpp $ */ +/** @file + * Skeleton main VM module. + */ + +/* + * Copyright (C) 2010-2023 Oracle and/or its affiliates. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#include <VBox/ExtPack/ExtPack.h> + +#include <iprt/errcore.h> +#include <VBox/version.h> +#include <VBox/vmm/cfgm.h> +#include <iprt/string.h> +#include <iprt/param.h> +#include <iprt/path.h> + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ +/** Pointer to the extension pack helpers. */ +static PCVBOXEXTPACKHLP g_pHlp; + + +// /** +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnConsoleReady} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPackVM_ConsoleReady(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole); +// +// /** +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnUnload} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPackVM_Unload(PCVBOXEXTPACKVMREG pThis); +// +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMConfigureVMM} +// */ +// static DECLCALLBACK(int) vboxSkeletonExtPackVM_VMConfigureVMM(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM); +// +// /** +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMPowerOn} +// */ +// static DECLCALLBACK(int) vboxSkeletonExtPackVM_VMPowerOn(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM); +// +// /** +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMPowerOff} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPackVM_VMPowerOff(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM); +// +// /** +// * @interface_method_impl{VBOXEXTPACKVMREG,pfnQueryObject} +// */ +// static DECLCALLBACK(void) vboxSkeletonExtPackVM_QueryObject(PCVBOXEXTPACKVMREG pThis, PCRTUUID pObjectId); + + +static const VBOXEXTPACKVMREG g_vboxSkeletonExtPackVMReg = +{ + VBOXEXTPACKVMREG_VERSION, + /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, + /* .pszNlsBaseName = */ NULL, + /* .pfnConsoleReady = */ NULL, + /* .pfnUnload = */ NULL, + /* .pfnVMConfigureVMM = */ NULL, + /* .pfnVMPowerOn = */ NULL, + /* .pfnVMPowerOff = */ NULL, + /* .pfnQueryObject = */ NULL, + /* .pfnReserved1 = */ NULL, + /* .pfnReserved2 = */ NULL, + /* .pfnReserved3 = */ NULL, + /* .pfnReserved4 = */ NULL, + /* .pfnReserved5 = */ NULL, + /* .pfnReserved6 = */ NULL, + /* .uReserved7 = */ 0, + VBOXEXTPACKVMREG_VERSION +}; + + +/** @callback_method_impl{FNVBOXEXTPACKVMREGISTER} */ +extern "C" DECLEXPORT(int) VBoxExtPackVMRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKVMREG *ppReg, PRTERRINFO pErrInfo) +{ + /* + * Check the VirtualBox version. + */ + if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION)) + return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH, + "Helper version mismatch - expected %#x got %#x", + VBOXEXTPACKHLP_VERSION, pHlp->u32Version); + if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR + || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR) + return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH, + "VirtualBox version mismatch - expected %u.%u got %u.%u", + VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, + VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion), + VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion)); + + /* + * We're good, save input and return the registration structure. + */ + g_pHlp = pHlp; + *ppReg = &g_vboxSkeletonExtPackVMReg; + + return VINF_SUCCESS; +} + |