VirtualBox

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

Last change on this file since 95827 was 95827, checked in by vboxsync, 2 years ago

Additions/VBoxTray: Added long overdue command line handling to VBoxTray to specify verbosity and log file handling, to make it easier for normal users to enable debugging (also as a runtime setting). When verbosity is increased, this also will enable VBoxTray's popup menu (via right click in system tray). bugref:10267

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