VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.h@ 103631

Last change on this file since 103631 was 99829, checked in by vboxsync, 19 months ago

*: A bunch of adjustments that allows using /permissive- with Visual C++ (qt 6.x necessity). [scm fixes]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1/* $Id: VBoxTray.h 99829 2023-05-17 13:51:57Z vboxsync $ */
2/** @file
3 * VBoxTray - Guest Additions Tray, Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-2023 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#ifndef GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxTray_h
29#define GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxTray_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <iprt/win/windows.h>
35
36#include <iprt/initterm.h>
37#include <iprt/string.h>
38#include <iprt/thread.h>
39
40#include <VBox/version.h>
41#include <VBox/VBoxGuestLib.h>
42#include <VBoxDisplay.h>
43
44#include "VBoxDispIf.h"
45
46
47/*********************************************************************************************************************************
48* Defined Constants And Macros *
49*********************************************************************************************************************************/
50/** Title of the program to show.
51 * Also shown as part of message boxes. */
52#define VBOX_VBOXTRAY_TITLE "VBoxTray"
53
54/*
55 * Windows messsages.
56 */
57
58/**
59 * General VBoxTray messages.
60 */
61#define WM_VBOXTRAY_TRAY_ICON WM_APP + 40
62
63/* The tray icon's ID. */
64#define ID_TRAYICON 2000
65
66/*
67 * Timer IDs.
68 */
69#define TIMERID_VBOXTRAY_CHECK_HOSTVERSION 1000
70#define TIMERID_VBOXTRAY_CAPS_TIMER 1001
71#define TIMERID_VBOXTRAY_DT_TIMER 1002
72#define TIMERID_VBOXTRAY_ST_DELAYED_INIT_TIMER 1003
73
74
75/*********************************************************************************************************************************
76* Common structures *
77*********************************************************************************************************************************/
78
79/**
80 * The environment information for services.
81 */
82typedef struct VBOXSERVICEENV
83{
84 /** hInstance of VBoxTray. */
85 HINSTANCE hInstance;
86 /* Display driver interface, XPDM - WDDM abstraction see VBOXDISPIF** definitions above */
87 /** @todo r=andy Argh. Needed by the "display" + "seamless" services (which in turn get called
88 * by the VBoxCaps facility. See #8037. */
89 VBOXDISPIF dispIf;
90} VBOXSERVICEENV;
91/** Pointer to a VBoxTray service env info structure. */
92typedef VBOXSERVICEENV *PVBOXSERVICEENV;
93/** Pointer to a const VBoxTray service env info structure. */
94typedef VBOXSERVICEENV const *PCVBOXSERVICEENV;
95
96/**
97 * A service descriptor.
98 */
99typedef struct VBOXSERVICEDESC
100{
101 /** The service's name. RTTHREAD_NAME_LEN maximum characters. */
102 const char *pszName;
103 /** The service description. */
104 const char *pszDesc;
105
106 /** Callbacks. */
107
108 /**
109 * Initializes a service.
110 * @returns VBox status code.
111 * VERR_NOT_SUPPORTED if the service is not supported on this guest system. Logged.
112 * VERR_HGCM_SERVICE_NOT_FOUND if the service is not available on the host system. Logged.
113 * Returning any other error will be considered as a fatal error.
114 * @param pEnv
115 * @param ppInstance Where to return the thread-specific instance data.
116 * @todo r=bird: The pEnv type is WRONG! Please check all your const pointers.
117 */
118 DECLCALLBACKMEMBER(int, pfnInit,(const PVBOXSERVICEENV pEnv, void **ppInstance));
119
120 /** Called from the worker thread.
121 *
122 * @returns VBox status code.
123 * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
124 * @param pInstance Pointer to thread-specific instance data.
125 * @param pfShutdown Pointer to a per service termination flag to check
126 * before and after blocking.
127 */
128 DECLCALLBACKMEMBER(int, pfnWorker,(void *pInstance, bool volatile *pfShutdown));
129
130 /**
131 * Stops a service.
132 */
133 DECLCALLBACKMEMBER(int, pfnStop,(void *pInstance));
134
135 /**
136 * Does termination cleanups.
137 *
138 * @remarks This may be called even if pfnInit hasn't been called!
139 */
140 DECLCALLBACKMEMBER(void, pfnDestroy,(void *pInstance));
141} VBOXSERVICEDESC, *PVBOXSERVICEDESC;
142
143
144/**
145 * The service initialization info and runtime variables.
146 */
147typedef struct VBOXSERVICEINFO
148{
149 /** Pointer to the service descriptor. */
150 PVBOXSERVICEDESC pDesc;
151 /** Thread handle. */
152 RTTHREAD hThread;
153 /** Pointer to service-specific instance data.
154 * Must be free'd by the service itself. */
155 void *pInstance;
156 /** Whether Pre-init was called. */
157 bool fPreInited;
158 /** Shutdown indicator. */
159 bool volatile fShutdown;
160 /** Indicator set by the service thread exiting. */
161 bool volatile fStopped;
162 /** Whether the service was started or not. */
163 bool fStarted;
164 /** Whether the service is enabled or not. */
165 bool fEnabled;
166} VBOXSERVICEINFO, *PVBOXSERVICEINFO;
167
168/**
169 * Globally unique (system wide) message registration.
170 */
171typedef struct VBOXGLOBALMESSAGE
172{
173 /** Message name. */
174 const char *pszName;
175 /** Function pointer for handling the message. */
176 int (*pfnHandler)(WPARAM wParam, LPARAM lParam);
177
178 /* Variables. */
179
180 /** Message ID;
181 * to be filled in when registering the actual message. */
182 UINT uMsgID;
183} VBOXGLOBALMESSAGE, *PVBOXGLOBALMESSAGE;
184
185
186/*********************************************************************************************************************************
187* Externals *
188*********************************************************************************************************************************/
189extern VBOXSERVICEDESC g_SvcDescDisplay;
190#ifdef VBOX_WITH_SHARED_CLIPBOARD
191extern VBOXSERVICEDESC g_SvcDescClipboard;
192#endif
193extern VBOXSERVICEDESC g_SvcDescSeamless;
194extern VBOXSERVICEDESC g_SvcDescVRDP;
195extern VBOXSERVICEDESC g_SvcDescIPC;
196extern VBOXSERVICEDESC g_SvcDescLA;
197#ifdef VBOX_WITH_DRAG_AND_DROP
198extern VBOXSERVICEDESC g_SvcDescDnD;
199#endif
200
201extern int g_cVerbosity;
202extern HINSTANCE g_hInstance;
203extern HWND g_hwndToolWindow;
204extern uint32_t g_fGuestDisplaysChanged;
205
206RTEXITCODE VBoxTrayShowError(const char *pszFormat, ...);
207
208#endif /* !GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxTray_h */
209
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