VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp@ 64462

最後變更 在這個檔案從64462是 62496,由 vboxsync 提交於 8 年 前

(C) 2016

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.9 KB
 
1/* $Id: VBoxSkeletonMain.cpp 62496 2016-07-22 18:47:44Z vboxsync $ */
2/** @file
3 * Skeleton main module.
4 */
5
6/*
7 * Copyright (C) 2010-2016 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{VBOXEXTPACKREG,pfnInstalled}
54// */
55// static DECLCALLBACK(void) vboxSkeletonExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
56// /**
57// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
58// */
59// static DECLCALLBACK(int) vboxSkeletonExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
60//
61// /**
62// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
63// */
64// static DECLCALLBACK(void) vboxSkeletonExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
65//
66// /**
67// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
68// */
69// static DECLCALLBACK(void) vboxSkeletonExtPack_Unload(PCVBOXEXTPACKREG pThis);
70// /**
71// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
72// */
73// static DECLCALLBACK(int) vboxSkeletonExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, IMachine *pMachine);
74//
75// /**
76// * @interface_method_impl{VBOXEXTPACKREG,pfnVMConfigureVMM}
77// */
78// static DECLCALLBACK(int) vboxSkeletonExtPack_VMConfigureVMM(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
79//
80// /**
81// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOn}
82// */
83// static DECLCALLBACK(int) vboxSkeletonExtPack_VMPowerOn(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
84// /**
85// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
86// */
87// static DECLCALLBACK(void) vboxSkeletonExtPack_VMPowerOff(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
88// /**
89// * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
90// */
91// static DECLCALLBACK(void) vboxSkeletonExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
92
93
94static const VBOXEXTPACKREG g_vboxSkeletonExtPackReg =
95{
96 VBOXEXTPACKREG_VERSION,
97 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION,
98 /* .pfnInstalled = */ NULL,
99 /* .pfnUninstall = */ NULL,
100 /* .pfnVirtualBoxReady =*/ NULL,
101 /* .pfnConsoleReady = */ NULL,
102 /* .pfnUnload = */ NULL,
103 /* .pfnVMCreated = */ NULL,
104 /* .pfnVMConfigureVMM = */ NULL,
105 /* .pfnVMPowerOn = */ NULL,
106 /* .pfnVMPowerOff = */ NULL,
107 /* .pfnQueryObject = */ NULL,
108 /* .pfnReserved1 = */ NULL,
109 /* .pfnReserved2 = */ NULL,
110 /* .pfnReserved3 = */ NULL,
111 /* .pfnReserved4 = */ NULL,
112 /* .pfnReserved5 = */ NULL,
113 /* .pfnReserved6 = */ NULL,
114 /* .u32Reserved7 = */ 0,
115 VBOXEXTPACKREG_VERSION
116};
117
118
119/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
120extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
121{
122 /*
123 * Check the VirtualBox version.
124 */
125 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
126 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
127 "Helper version mismatch - expected %#x got %#x",
128 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
129 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
130 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
131 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
132 "VirtualBox version mismatch - expected %u.%u got %u.%u",
133 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
134 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
135 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
136
137 /*
138 * We're good, save input and return the registration structure.
139 */
140 g_pHlp = pHlp;
141 *ppReg = &g_vboxSkeletonExtPackReg;
142
143 return VINF_SUCCESS;
144}
145
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette