VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/VNC/VBoxVNCMain.cpp@ 106724

Last change on this file since 106724 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: VBoxVNCMain.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VNC main module.
4 */
5
6/*
7 * Copyright (C) 2010-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include <VBox/ExtPack/ExtPack.h>
33
34#include <iprt/errcore.h>
35#include <VBox/version.h>
36#include <iprt/string.h>
37#include <iprt/param.h>
38#include <iprt/path.h>
39
40
41/*********************************************************************************************************************************
42* Global Variables *
43*********************************************************************************************************************************/
44/** Pointer to the extension pack helpers. */
45static PCVBOXEXTPACKHLP g_pHlp;
46
47
48// /**
49// * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled}
50// */
51// static DECLCALLBACK(void) vboxVNCExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, PRTERRINFO pErrInfo);
52//
53// /**
54// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
55// */
56// static DECLCALLBACK(int) vboxVNCExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
57//
58// /**
59// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
60// */
61// static DECLCALLBACK(void) vboxVNCExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
62//
63// /**
64// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
65// */
66// static DECLCALLBACK(void) vboxVNCExtPack_Unload(PCVBOXEXTPACKREG pThis);
67//
68// /**
69// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
70// */
71// static DECLCALLBACK(int) vboxVNCExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, VBOXEXTPACK_IF_CS(IMachine) *pMachine);
72//
73// /**
74// * @interface_method_impl{VBOXEXTPACKREG,pfnQueryObject}
75// */
76// static DECLCALLBACK(void) vboxVNCExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
77
78
79static const VBOXEXTPACKREG g_vboxVNCExtPackReg =
80{
81 VBOXEXTPACKREG_VERSION,
82 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION,
83 /* .pszNlsBaseName = */ NULL,
84 /* .pfnInstalled = */ NULL,
85 /* .pfnUninstall = */ NULL,
86 /* .pfnVirtualBoxReady =*/ NULL,
87 /* .pfnUnload = */ NULL,
88 /* .pfnVMCreated = */ NULL,
89 /* .pfnQueryObject = */ NULL,
90 /* .pfnReserved1 = */ NULL,
91 /* .pfnReserved2 = */ NULL,
92 /* .pfnReserved3 = */ NULL,
93 /* .pfnReserved4 = */ NULL,
94 /* .pfnReserved5 = */ NULL,
95 /* .pfnReserved6 = */ NULL,
96 /* .uReserved7 = */ 0,
97 VBOXEXTPACKREG_VERSION
98};
99
100
101/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
102extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
103{
104 /*
105 * Check the VirtualBox version.
106 */
107 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
108 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
109 "Helper version mismatch - expected %#x got %#x",
110 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
111 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
112 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
113 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
114 "VirtualBox version mismatch - expected %u.%u got %u.%u",
115 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
116 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
117 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
118
119 /*
120 * We're good, save input and return the registration structure.
121 */
122 g_pHlp = pHlp;
123 *ppReg = &g_vboxVNCExtPackReg;
124
125 return VINF_SUCCESS;
126}
127
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