1 | /* $Id: VBoxTray.h 27955 2010-04-02 09:12:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxTray - Guest Additions Tray, Internal Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___VBOXTRAY_H
|
---|
23 | #define ___VBOXTRAY_H
|
---|
24 |
|
---|
25 | #include <windows.h>
|
---|
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 |
|
---|
34 | #include <VBox/version.h>
|
---|
35 | #include <VBox/Log.h>
|
---|
36 | #include <VBox/VBoxGuest.h> /** @todo use the VbglR3 interface! */
|
---|
37 | #include <VBox/VBoxGuestLib.h>
|
---|
38 | #include <VBoxDisplay.h>
|
---|
39 | #ifdef VBOXWDDM
|
---|
40 | # include <d3dkmthk.h>
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #define WM_VBOX_RESTORED WM_APP + 1
|
---|
44 | #define WM_VBOX_CHECK_VRDP WM_APP + 2
|
---|
45 | #define WM_VBOX_CHECK_HOSTVERSION WM_APP + 3
|
---|
46 | #define WM_VBOX_TRAY WM_APP + 4
|
---|
47 |
|
---|
48 | #define ID_TRAYICON 2000
|
---|
49 |
|
---|
50 | typedef enum
|
---|
51 | {
|
---|
52 | VBOXDISPIF_MODE_UNKNOWN = 0,
|
---|
53 | VBOXDISPIF_MODE_XPDM = 1
|
---|
54 | #ifdef VBOXWDDM
|
---|
55 | , VBOXDISPIF_MODE_WDDM = 2
|
---|
56 | #endif
|
---|
57 | } VBOXDISPIF_MODE;
|
---|
58 | /* display driver interface abstraction for XPDM & WDDM
|
---|
59 | * with WDDM we can not use ExtEscape to communicate with our driver
|
---|
60 | * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
|
---|
61 | * that knows nothing about us
|
---|
62 | * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
|
---|
63 | * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
|
---|
64 | * It's caller's responsibility to initiate it to work in the correct mode */
|
---|
65 | typedef struct VBOXDISPIF
|
---|
66 | {
|
---|
67 | VBOXDISPIF_MODE enmMode;
|
---|
68 | #ifdef VBOXWDDM
|
---|
69 | /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
|
---|
70 | * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
|
---|
71 | /* open adapter */
|
---|
72 | union
|
---|
73 | {
|
---|
74 | struct
|
---|
75 | {
|
---|
76 | PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
|
---|
77 | PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName;
|
---|
78 | /* close adapter */
|
---|
79 | PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
|
---|
80 | /* escape */
|
---|
81 | PFND3DKMT_ESCAPE pfnD3DKMTEscape;
|
---|
82 | } wddm;
|
---|
83 | } modeData;
|
---|
84 | #endif
|
---|
85 | } VBOXDISPIF, *PVBOXDISPIF;
|
---|
86 | typedef const struct VBOXDISPIF *PCVBOXDISPIF;
|
---|
87 |
|
---|
88 | /* initializes the DispIf
|
---|
89 | * Initially the DispIf is configured to work in XPDM mode
|
---|
90 | * call VBoxDispIfSwitchMode to switch the mode to WDDM */
|
---|
91 | DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
|
---|
92 | DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
|
---|
93 | DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
|
---|
94 | DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
|
---|
95 | DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
|
---|
96 |
|
---|
97 | /* The environment information for services. */
|
---|
98 | typedef struct _VBOXSERVICEENV
|
---|
99 | {
|
---|
100 | HINSTANCE hInstance;
|
---|
101 | HANDLE hDriver;
|
---|
102 | HANDLE hStopEvent;
|
---|
103 | /* display driver interface, XPDM - WDDM abstraction see VBOXDISPIF** definitions above */
|
---|
104 | VBOXDISPIF dispIf;
|
---|
105 | } VBOXSERVICEENV;
|
---|
106 |
|
---|
107 | /* The service initialization info and runtime variables. */
|
---|
108 | typedef struct _VBOXSERVICEINFO
|
---|
109 | {
|
---|
110 | char *pszName;
|
---|
111 | int (* pfnInit) (const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread);
|
---|
112 | unsigned (__stdcall * pfnThread) (void *pInstance);
|
---|
113 | void (* pfnDestroy) (const VBOXSERVICEENV *pEnv, void *pInstance);
|
---|
114 |
|
---|
115 | /* Variables. */
|
---|
116 | HANDLE hThread;
|
---|
117 | void *pInstance;
|
---|
118 | bool fStarted;
|
---|
119 |
|
---|
120 | } VBOXSERVICEINFO;
|
---|
121 |
|
---|
122 |
|
---|
123 | extern HWND gToolWindow;
|
---|
124 | extern HINSTANCE gInstance;
|
---|
125 |
|
---|
126 | extern void VBoxServiceReloadCursor(void);
|
---|
127 |
|
---|
128 | #endif /* !___VBOXTRAY_H */
|
---|
129 |
|
---|