CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/vncdll/winvnc/VideoDriver.h
Views: 11778
1
// Copyright (C) 2005-2006 Lev Kazarkin. All Rights Reserved.
2
//
3
// TightVNC is free software; you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation; either version 2 of the License, or
6
// (at your option) any later version.
7
//
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16
// USA.
17
//
18
// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
19
20
#ifndef _WINVNC_VIDEODRIVER
21
#define _WINVNC_VIDEODRIVER
22
23
#include "stdhdrs.h"
24
#include "vncRegion.h"
25
26
#define ESC_QVI 1026
27
28
#define MAP1 1030
29
#define UNMAP1 1031
30
#define TESTMAPPED 1051
31
32
#define MAXCHANGES_BUF 20000
33
34
typedef enum
35
{
36
dmf_dfo_IGNORE = 0,
37
dmf_dfo_FROM_SCREEN = 1,
38
dmf_dfo_FROM_DIB = 2,
39
dmf_dfo_TO_SCREEN = 3,
40
41
dmf_dfo_SCREEN_SCREEN = 11,
42
dmf_dfo_BLIT = 12,
43
dmf_dfo_SOLIDFILL = 13,
44
dmf_dfo_BLEND = 14,
45
dmf_dfo_TRANS = 15,
46
dmf_dfo_PLG = 17,
47
dmf_dfo_TEXTOUT = 18,
48
49
dmf_dfo_Ptr_Engage = 48, // point is used with this record
50
dmf_dfo_Ptr_Avert = 49,
51
52
// 1.0.9.0
53
// mode-assert notifications to manifest PDEV limbo status
54
dmf_dfn_assert_on = 64, // DrvAssert(TRUE): PDEV reenabled
55
dmf_dfn_assert_off = 65, // DrvAssert(FALSE): PDEV disabled
56
57
} dmf_UpdEvent;
58
59
60
#define CDS_UPDATEREGISTRY 0x00000001
61
#define CDS_TEST 0x00000002
62
#define CDS_FULLSCREEN 0x00000004
63
#define CDS_GLOBAL 0x00000008
64
#define CDS_SET_PRIMARY 0x00000010
65
#define CDS_RESET 0x40000000
66
#define CDS_SETRECT 0x20000000
67
#define CDS_NORESET 0x10000000
68
69
typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
70
typedef LONG (WINAPI* pChangeDisplaySettingsEx)(LPCTSTR, LPDEVMODE, HWND, DWORD, LPVOID);
71
72
//*********************************************************************
73
74
typedef struct _CHANGES_RECORD
75
{
76
ULONG type; //screen_to_screen, blit, newcache,oldcache
77
RECT rect;
78
RECT origrect;
79
POINT point;
80
ULONG color; //number used in cache array
81
ULONG refcolor; //slot used to pase btimap data
82
}CHANGES_RECORD;
83
typedef CHANGES_RECORD *PCHANGES_RECORD;
84
typedef struct _CHANGES_BUF
85
{
86
ULONG counter;
87
CHANGES_RECORD pointrect[MAXCHANGES_BUF];
88
}CHANGES_BUF;
89
typedef CHANGES_BUF *PCHANGES_BUF;
90
91
typedef struct _GETCHANGESBUF
92
{
93
PCHANGES_BUF buffer;
94
PVOID Userbuffer;
95
}GETCHANGESBUF;
96
typedef GETCHANGESBUF *PGETCHANGESBUF;
97
98
#define DMF_VERSION_DEFINE(_ver_0,_ver_1,_ver_2,_ver_3) ((_ver_0<<24) | (_ver_1<<16) | (_ver_2<<8) | _ver_3)
99
100
#define DMF_PROTO_VER_CURRENT DMF_VERSION_DEFINE(1,2,0,0)
101
#define DMF_PROTO_VER_MINCOMPAT DMF_VERSION_DEFINE(0,9,0,1)
102
103
struct Esc_dmf_Qvi_IN
104
{
105
ULONG cbSize;
106
107
ULONG app_actual_version;
108
ULONG display_minreq_version;
109
110
ULONG connect_options; // reserved. must be 0.
111
};
112
113
enum
114
{
115
esc_qvi_prod_name_max = 16,
116
};
117
118
#define ESC_QVI_PROD_MIRAGE "MIRAGE"
119
120
struct Esc_dmf_Qvi_OUT
121
{
122
ULONG cbSize;
123
124
ULONG display_actual_version;
125
ULONG miniport_actual_version;
126
ULONG app_minreq_version;
127
ULONG display_buildno;
128
ULONG miniport_buildno;
129
130
char prod_name[esc_qvi_prod_name_max];
131
};
132
133
class vncDesktop;
134
135
class vncVideoDriver
136
{
137
138
// Fields
139
public:
140
141
// Methods
142
public:
143
// Make the desktop thread & window proc friends
144
145
vncVideoDriver();
146
~vncVideoDriver();
147
BOOL Activate(BOOL fForDirectAccess, const RECT *prcltarget);
148
void Deactivate();
149
BOOL Activate_NT50(BOOL fForDirectAccess, const RECT *prcltarget);
150
void Deactivate_NT50();
151
BOOL Activate_NT46(BOOL fForDirectAccess);
152
void Deactivate_NT46();
153
BOOL CheckVersion();
154
BOOL MapSharedbuffers(BOOL fForDirectScreenAccess);
155
void UnMapSharedbuffers();
156
BOOL TestMapped();
157
void HandleDriverChanges(
158
vncDesktop *pDesk,
159
vncRegion &rgn,
160
int xoffset,
161
int yoffset,
162
BOOL &bPointerShapeChange);
163
void HandleDriverChangesSeries(
164
vncDesktop *pDesk,
165
vncRegion &rgn,
166
int xoffset,
167
int yoffset,
168
const CHANGES_RECORD *first,
169
const CHANGES_RECORD *last,
170
BOOL &bPointerShapeChange);
171
void ResetCounter() { oldCounter = bufdata.buffer->counter; }
172
173
BYTE *GetScreenView(void) { return (BYTE*)bufdata.Userbuffer; }
174
175
BOOL IsActive(void) { return m_fIsActive; }
176
BOOL IsDirectAccessInEffect(void) { return m_fDirectAccessInEffect; }
177
BOOL IsHandlingScreen2ScreenBlt(void) { return m_fHandleScreen2ScreenBlt; }
178
179
protected:
180
181
static BOOL LookupVideoDeviceAlt(
182
LPCTSTR szDevStr,
183
LPCTSTR szDevStrAlt,
184
INT &devNum,
185
DISPLAY_DEVICE *pDd);
186
static HKEY CreateDeviceKey(LPCTSTR szMpName);
187
188
char m_devname[32];
189
ULONG m_drv_ver_mj;
190
ULONG m_drv_ver_mn;
191
192
GETCHANGESBUF bufdata;
193
ULONG oldCounter;
194
HDC m_gdc;
195
196
bool m_fIsActive;
197
bool m_fDirectAccessInEffect;
198
bool m_fHandleScreen2ScreenBlt;
199
200
static char vncVideoDriver::szDriverString[];
201
static char vncVideoDriver::szDriverStringAlt[];
202
static char vncVideoDriver::szMiniportName[];
203
};
204
205
VOID DebugPrint(PCHAR DebugMessage, ...);
206
207
#ifdef _DEBUG
208
#define DPF(x) DebugPrint x
209
#else
210
#define DPF(x)
211
#endif
212
213
#endif
214
215