VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp@ 73749

Last change on this file since 73749 was 69279, checked in by vboxsync, 7 years ago

ExtPacks/Skeleton: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/* $Id: VBoxSkeletonMainVM.cpp 69279 2017-10-25 10:40:26Z vboxsync $ */
2/** @file
3 * Skeleton main VM module.
4 */
5
6/*
7 * Copyright (C) 2010-2017 Oracle Corporation
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31
32/*********************************************************************************************************************************
33* Header Files *
34*********************************************************************************************************************************/
35#include <VBox/ExtPack/ExtPack.h>
36
37#include <VBox/err.h>
38#include <VBox/version.h>
39#include <VBox/vmm/cfgm.h>
40#include <iprt/string.h>
41#include <iprt/param.h>
42#include <iprt/path.h>
43
44
45/*********************************************************************************************************************************
46* Global Variables *
47*********************************************************************************************************************************/
48/** Pointer to the extension pack helpers. */
49static PCVBOXEXTPACKHLP g_pHlp;
50
51
52// /**
53// * @interface_method_impl{VBOXEXTPACKVMREG,pfnConsoleReady}
54// */
55// static DECLCALLBACK(void) vboxSkeletonExtPackVM_ConsoleReady(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole);
56//
57// /**
58// * @interface_method_impl{VBOXEXTPACKVMREG,pfnUnload}
59// */
60// static DECLCALLBACK(void) vboxSkeletonExtPackVM_Unload(PCVBOXEXTPACKVMREG pThis);
61//
62// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMConfigureVMM}
63// */
64// static DECLCALLBACK(int) vboxSkeletonExtPackVM_VMConfigureVMM(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM);
65//
66// /**
67// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMPowerOn}
68// */
69// static DECLCALLBACK(int) vboxSkeletonExtPackVM_VMPowerOn(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM);
70//
71// /**
72// * @interface_method_impl{VBOXEXTPACKVMREG,pfnVMPowerOff}
73// */
74// static DECLCALLBACK(void) vboxSkeletonExtPackVM_VMPowerOff(PCVBOXEXTPACKVMREG pThis, VBOXEXTPACK_IF_CS(IConsole) *pConsole, PVM pVM);
75//
76// /**
77// * @interface_method_impl{VBOXEXTPACKVMREG,pfnQueryObject}
78// */
79// static DECLCALLBACK(void) vboxSkeletonExtPackVM_QueryObject(PCVBOXEXTPACKVMREG pThis, PCRTUUID pObjectId);
80
81
82static const VBOXEXTPACKVMREG g_vboxSkeletonExtPackVMReg =
83{
84 VBOXEXTPACKVMREG_VERSION,
85 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION,
86 /* .pfnConsoleReady = */ NULL,
87 /* .pfnUnload = */ NULL,
88 /* .pfnVMConfigureVMM = */ NULL,
89 /* .pfnVMPowerOn = */ NULL,
90 /* .pfnVMPowerOff = */ NULL,
91 /* .pfnQueryObject = */ NULL,
92 /* .pfnReserved1 = */ NULL,
93 /* .pfnReserved2 = */ NULL,
94 /* .pfnReserved3 = */ NULL,
95 /* .pfnReserved4 = */ NULL,
96 /* .pfnReserved5 = */ NULL,
97 /* .pfnReserved6 = */ NULL,
98 /* .u32Reserved7 = */ 0,
99 VBOXEXTPACKVMREG_VERSION
100};
101
102
103/** @callback_method_impl{FNVBOXEXTPACKVMREGISTER} */
104extern "C" DECLEXPORT(int) VBoxExtPackVMRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKVMREG *ppReg, PRTERRINFO pErrInfo)
105{
106 /*
107 * Check the VirtualBox version.
108 */
109 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
110 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
111 "Helper version mismatch - expected %#x got %#x",
112 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
113 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
114 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
115 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
116 "VirtualBox version mismatch - expected %u.%u got %u.%u",
117 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
118 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
119 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
120
121 /*
122 * We're good, save input and return the registration structure.
123 */
124 g_pHlp = pHlp;
125 *ppReg = &g_vboxSkeletonExtPackVMReg;
126
127 return VINF_SUCCESS;
128}
129
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