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