VirtualBox

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

Last change on this file since 91509 was 91312, checked in by vboxsync, 3 years ago

Main: bugref:1909: Prepared the API translation engine to using in ExtPacks and VBoxManage. Added using API translation engine in ExtPacks. Allowed VBox compilation with NLS enabled and GUI disabled. Allowed ExtPacks only compilation with NLS translation enabled.

  • 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 91312 2021-09-20 11:06:57Z 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 /* .pszNlsBaseName = */ NULL,
74 /* .pfnInstalled = */ NULL,
75 /* .pfnUninstall = */ NULL,
76 /* .pfnVirtualBoxReady =*/ NULL,
77 /* .pfnUnload = */ NULL,
78 /* .pfnVMCreated = */ NULL,
79 /* .pfnQueryObject = */ NULL,
80 /* .pfnReserved1 = */ NULL,
81 /* .pfnReserved2 = */ NULL,
82 /* .pfnReserved3 = */ NULL,
83 /* .pfnReserved4 = */ NULL,
84 /* .pfnReserved5 = */ NULL,
85 /* .pfnReserved6 = */ NULL,
86 /* .u32Reserved7 = */ 0,
87 VBOXEXTPACKREG_VERSION
88};
89
90
91/** @callback_method_impl{FNVBOXEXTPACKREGISTER} */
92extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
93{
94 /*
95 * Check the VirtualBox version.
96 */
97 if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
98 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
99 "Helper version mismatch - expected %#x got %#x",
100 VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
101 if ( VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
102 || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
103 return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
104 "VirtualBox version mismatch - expected %u.%u got %u.%u",
105 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
106 VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
107 VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
108
109 /*
110 * We're good, save input and return the registration structure.
111 */
112 g_pHlp = pHlp;
113 *ppReg = &g_vboxVNCExtPackReg;
114
115 return VINF_SUCCESS;
116}
117
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