VirtualBox

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

Last change on this file since 78425 was 76563, checked in by vboxsync, 6 years ago

Additions: Use GA_INCLUDED_ and variations_ as header guard prefixes with scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
1/* $Id: VBoxTray.h 76563 2019-01-01 03:53:56Z vboxsync $ */
2/** @file
3 * VBoxTray - Guest Additions Tray, Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
25# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
26# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
27# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
28# define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
29# define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
30# define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
31# define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
32# pragma warning(disable : 4163)
33#include <iprt/win/windows.h>
34# pragma warning(default : 4163)
35# undef _InterlockedExchange
36# undef _InterlockedExchangeAdd
37# undef _InterlockedCompareExchange
38# undef _InterlockedAddLargeStatistic
39# undef _interlockedbittestandset
40# undef _interlockedbittestandreset
41# undef _interlockedbittestandset64
42# undef _interlockedbittestandreset64
43
44#include <tchar.h>
45#include <stdio.h>
46#include <stdarg.h>
47#include <process.h>
48
49#include <iprt/initterm.h>
50#include <iprt/string.h>
51#include <iprt/thread.h>
52
53#include <VBox/version.h>
54#include <VBox/VBoxGuestLib.h>
55#include <VBoxDisplay.h>
56
57#include "VBoxDispIf.h"
58
59/*
60 * Windows messsages.
61 */
62
63/**
64 * General VBoxTray messages.
65 */
66#define WM_VBOXTRAY_TRAY_ICON WM_APP + 40
67
68/* The tray icon's ID. */
69#define ID_TRAYICON 2000
70
71/*
72 * Timer IDs.
73 */
74#define TIMERID_VBOXTRAY_CHECK_HOSTVERSION 1000
75#define TIMERID_VBOXTRAY_CAPS_TIMER 1001
76#define TIMERID_VBOXTRAY_DT_TIMER 1002
77#define TIMERID_VBOXTRAY_ST_DELAYED_INIT_TIMER 1003
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 char *pszName;
103 /** The service description. */
104 char *pszDesc;
105
106 /** Callbacks. */
107
108 /**
109 * Initializes a service.
110 * @returns VBox status code.
111 * @param pEnv
112 * @param ppInstance Where to return the thread-specific instance data.
113 * @todo r=bird: The pEnv type is WRONG! Please check all your const pointers.
114 */
115 DECLCALLBACKMEMBER(int, pfnInit) (const PVBOXSERVICEENV pEnv, void **ppInstance);
116
117 /** Called from the worker thread.
118 *
119 * @returns VBox status code.
120 * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
121 * @param pInstance Pointer to thread-specific instance data.
122 * @param pfShutdown Pointer to a per service termination flag to check
123 * before and after blocking.
124 */
125 DECLCALLBACKMEMBER(int, pfnWorker) (void *pInstance, bool volatile *pfShutdown);
126
127 /**
128 * Stops a service.
129 */
130 DECLCALLBACKMEMBER(int, pfnStop) (void *pInstance);
131
132 /**
133 * Does termination cleanups.
134 *
135 * @remarks This may be called even if pfnInit hasn't been called!
136 */
137 DECLCALLBACKMEMBER(void, pfnDestroy)(void *pInstance);
138} VBOXSERVICEDESC, *PVBOXSERVICEDESC;
139
140extern VBOXSERVICEDESC g_SvcDescDisplay;
141extern VBOXSERVICEDESC g_SvcDescClipboard;
142extern VBOXSERVICEDESC g_SvcDescSeamless;
143extern VBOXSERVICEDESC g_SvcDescVRDP;
144extern VBOXSERVICEDESC g_SvcDescIPC;
145extern VBOXSERVICEDESC g_SvcDescLA;
146#ifdef VBOX_WITH_DRAG_AND_DROP
147extern VBOXSERVICEDESC g_SvcDescDnD;
148#endif
149
150/**
151 * The service initialization info and runtime variables.
152 */
153typedef struct _VBOXSERVICEINFO
154{
155 /** Pointer to the service descriptor. */
156 PVBOXSERVICEDESC pDesc;
157 /** Thread handle. */
158 RTTHREAD hThread;
159 /** Pointer to service-specific instance data.
160 * Must be free'd by the service itself. */
161 void *pInstance;
162 /** Whether Pre-init was called. */
163 bool fPreInited;
164 /** Shutdown indicator. */
165 bool volatile fShutdown;
166 /** Indicator set by the service thread exiting. */
167 bool volatile fStopped;
168 /** Whether the service was started or not. */
169 bool fStarted;
170 /** Whether the service is enabled or not. */
171 bool fEnabled;
172} VBOXSERVICEINFO, *PVBOXSERVICEINFO;
173
174/* Globally unique (system wide) message registration. */
175typedef struct _VBOXGLOBALMESSAGE
176{
177 /** Message name. */
178 char *pszName;
179 /** Function pointer for handling the message. */
180 int (* pfnHandler) (WPARAM wParam, LPARAM lParam);
181
182 /* Variables. */
183
184 /** Message ID;
185 * to be filled in when registering the actual message. */
186 UINT uMsgID;
187} VBOXGLOBALMESSAGE, *PVBOXGLOBALMESSAGE;
188
189extern HWND g_hwndToolWindow;
190extern HINSTANCE g_hInstance;
191extern uint32_t g_fGuestDisplaysChanged;
192
193RTEXITCODE VBoxTrayShowError(const char *pszFormat, ...);
194
195#endif /* !GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxTray_h */
196
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