VirtualBox

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

Last change on this file since 85520 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: VBoxTray.h 85121 2020-07-08 19:33:26Z vboxsync $ */
2/** @file
3 * VBoxTray - Guest Additions Tray, Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-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#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 */
64typedef 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. */
74typedef VBOXSERVICEENV *PVBOXSERVICEENV;
75/** Pointer to a const VBoxTray service env info structure. */
76typedef VBOXSERVICEENV const *PCVBOXSERVICEENV;
77
78/**
79 * A service descriptor.
80 */
81typedef 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
125extern VBOXSERVICEDESC g_SvcDescDisplay;
126#ifdef VBOX_WITH_SHARED_CLIPBOARD
127extern VBOXSERVICEDESC g_SvcDescClipboard;
128#endif
129extern VBOXSERVICEDESC g_SvcDescSeamless;
130extern VBOXSERVICEDESC g_SvcDescVRDP;
131extern VBOXSERVICEDESC g_SvcDescIPC;
132extern VBOXSERVICEDESC g_SvcDescLA;
133#ifdef VBOX_WITH_DRAG_AND_DROP
134extern VBOXSERVICEDESC g_SvcDescDnD;
135#endif
136
137/**
138 * The service initialization info and runtime variables.
139 */
140typedef 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. */
162typedef 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
176extern HINSTANCE g_hInstance;
177extern HWND g_hwndToolWindow;
178extern uint32_t g_fGuestDisplaysChanged;
179
180RTEXITCODE VBoxTrayShowError(const char *pszFormat, ...);
181
182#endif /* !GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxTray_h */
183
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