VirtualBox

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

Last change on this file since 69500 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

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