VirtualBox

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

Last change on this file since 85794 was 82968, checked in by vboxsync, 5 years 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.6 KB
Line 
1/* $Id: VBoxVNCMain.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * VNC main module.
4 */
5
6/*
7 * Copyright (C) 2010-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#include <VBox/ExtPack/ExtPack.h>
23
24#include <iprt/errcore.h>
25#include <VBox/version.h>
26#include <iprt/string.h>
27#include <iprt/param.h>
28#include <iprt/path.h>
29
30
31/*********************************************************************************************************************************
32* Global Variables *
33*********************************************************************************************************************************/
34/** Pointer to the extension pack helpers. */
35static PCVBOXEXTPACKHLP g_pHlp;
36
37
38// /**
39// * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled}
40// */
41// static DECLCALLBACK(void) vboxVNCExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, PRTERRINFO pErrInfo);
42//
43// /**
44// * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
45// */
46// static DECLCALLBACK(int) vboxVNCExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
47//
48// /**
49// * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
50// */
51// static DECLCALLBACK(void) vboxVNCExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
52//
53// /**
54// * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
55// */
56// static DECLCALLBACK(void) vboxVNCExtPack_Unload(PCVBOXEXTPACKREG pThis);
57//
58// /**
59// * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
60// */
61// static DECLCALLBACK(int) vboxVNCExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, VBOXEXTPACK_IF_CS(IMachine) *pMachine);
62//
63// /**
64// * @interface_method_impl{VBOXEXTPACKREG,pfnQueryObject}
65// */
66// static DECLCALLBACK(void) vboxVNCExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
67
68
69static const VBOXEXTPACKREG g_vboxVNCExtPackReg =
70{
71 VBOXEXTPACKREG_VERSION,
72 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION,
73 /* .pfnInstalled = */ NULL,
74 /* .pfnUninstall = */ NULL,
75 /* .pfnVirtualBoxReady =*/ NULL,
76 /* .pfnUnload = */ NULL,
77 /* .pfnVMCreated = */ NULL,
78 /* .pfnQueryObject = */ NULL,
79 /* .pfnReserved1 = */ NULL,
80 /* .pfnReserved2 = */ NULL,
81 /* .pfnReserved3 = */ NULL,
82 /* .pfnReserved4 = */ NULL,
83 /* .pfnReserved5 = */ NULL,
84 /* .pfnReserved6 = */ NULL,
85 /* .u32Reserved7 = */ 0,
86 VBOXEXTPACKREG_VERSION
87};
88
89
90/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
91extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
92{
93 /*
94 * Check the VirtualBox version.
95 */
96 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
97 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
98 "Helper version mismatch - expected %#x got %#x",
99 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
100 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
101 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
102 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
103 "VirtualBox version mismatch - expected %u.%u got %u.%u",
104 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
105 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
106 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
107
108 /*
109 * We're good, save input and return the registration structure.
110 */
111 g_pHlp = pHlp;
112 *ppReg = &g_vboxVNCExtPackReg;
113
114 return VINF_SUCCESS;
115}
116
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