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