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