db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/* $Id$ */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/** @file
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * Skeleton main module.
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/*
dd4229306cc4ad8b39518abc8d1ca5a6d1e1ca4fvboxsync * Copyright (C) 2010-2012 Oracle Corporation
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync *
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * Permission is hereby granted, free of charge, to any person
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * obtaining a copy of this software and associated documentation
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * files (the "Software"), to deal in the Software without
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * restriction, including without limitation the rights to use,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * copy, modify, merge, publish, distribute, sublicense, and/or sell
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * copies of the Software, and to permit persons to whom the
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * Software is furnished to do so, subject to the following
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * conditions:
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync *
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * The above copyright notice and this permission notice shall be
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * included in all copies or substantial portions of the Software.
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync *
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * OTHER DEALINGS IN THE SOFTWARE.
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/*******************************************************************************
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync* Header Files *
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync*******************************************************************************/
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <VBox/ExtPack/ExtPack.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <VBox/err.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <VBox/version.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <VBox/vmm/cfgm.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <iprt/string.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <iprt/param.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync#include <iprt/path.h>
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/*******************************************************************************
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync* Global Variables *
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync*******************************************************************************/
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/** Pointer to the extension pack helpers. */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsyncstatic PCVBOXEXTPACKHLP g_pHlp;
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(void) vboxSkeletonExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(int) vboxSkeletonExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync//
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(void) vboxSkeletonExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync//
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(void) vboxSkeletonExtPack_Unload(PCVBOXEXTPACKREG pThis);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(int) vboxSkeletonExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, IMachine *pMachine);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync//
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVMConfigureVMM}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(int) vboxSkeletonExtPack_VMConfigureVMM(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync//
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOn}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(int) vboxSkeletonExtPack_VMPowerOn(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(void) vboxSkeletonExtPack_VMPowerOff(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// /**
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync// static DECLCALLBACK(void) vboxSkeletonExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsyncstatic const VBOXEXTPACKREG g_vboxSkeletonExtPackReg =
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync{
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOXEXTPACKREG_VERSION,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnInstalled = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnUninstall = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnVirtualBoxReady =*/ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnConsoleReady = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnUnload = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnVMCreated = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnVMConfigureVMM = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnVMPowerOn = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnVMPowerOff = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /* .pfnQueryObject = */ NULL,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOXEXTPACKREG_VERSION
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync};
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsyncextern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync{
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /*
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * Check the VirtualBox version.
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync "Helper version mismatch - expected %#x got %#x",
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync "VirtualBox version mismatch - expected %u.%u got %u.%u",
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync /*
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync * We're good, save input and return the registration structure.
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync */
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync g_pHlp = pHlp;
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync *ppReg = &g_vboxSkeletonExtPackReg;
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync return VINF_SUCCESS;
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync}
db214f7eb929a8c9907c9aa8a4af75617101ca79vboxsync