vncproperties.cpp
5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// Copyright (C) 2002 Ultr@VNC Team Members. All Rights Reserved.
// Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
// Copyright (C) 2002 TightVNC. All Rights Reserved.
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncProperties.cpp
// Implementation of the Properties dialog!
#include "stdhdrs.h"
#include "lmcons.h"
#include "vncService.h"
#include "WinVNC.h"
#include "vncProperties.h"
#include "vncServer.h"
//#include "vncPasswd.h"
#include "vncOSVersion.h"
//#include "vncSecurityEditor.h"
#include "localization.h" // ACT : Add localization on messages
//extern HINSTANCE g_hInst;
const char WINVNC_REGISTRY_KEY [] = "Software\\ORL\\WinVNC3";
// Marscha@2004 - authSSP: Function pointer for dyn. linking
typedef void (*vncEditSecurityFn) (HWND hwnd, HINSTANCE hInstance);
vncEditSecurityFn vncEditSecurity = 0;
extern BOOL g_plugin;
// Constructor & Destructor
vncProperties::vncProperties()
{
m_alloweditclients = TRUE;
m_allowproperties = TRUE;
m_allowshutdown = TRUE;
m_dlgvisible = FALSE;
m_usersettings = TRUE;
}
vncProperties::~vncProperties()
{
}
// Initialisation
BOOL
vncProperties::Init(vncServer *server)
{
// Save the server pointer
m_server = server;
vnclog.Print(LL_INTINFO, VNCLOG("loading local-only settings\n"));
vnclog.SetMode(0);
vnclog.SetLevel(0);
m_pref_RequireMSLogon=false;
m_pref_NewMSLogon = false;
m_pref_AutoPortSelect=TRUE;
m_pref_PortNumber = RFB_PORT_OFFSET;
m_pref_SockConnect=TRUE;
m_pref_QuerySetting=2;
m_pref_QueryTimeout=10;
m_pref_QueryAccept=0;
m_pref_IdleTimeout=0;
m_pref_EnableRemoteInputs=TRUE;
m_pref_DisableLocalInputs=FALSE;
m_pref_LockSettings=-1;
m_pref_RemoveWallpaper=TRUE;
m_alloweditclients = TRUE;
m_allowshutdown = TRUE;
m_allowproperties = TRUE;
m_pref_SingleWindow = FALSE;
m_pref_UseDSMPlugin = g_plugin;
*m_pref_szDSMPlugin = '\0';
m_pref_EnableFileTransfer = TRUE;
m_pref_EnableBlankMonitor = TRUE;
m_pref_DefaultScale = 1;
if(OSVersion()==1)
{
m_pref_CaptureAlphaBlending = TRUE;
m_pref_BlackAlphaBlending = TRUE;
}
else
{
m_pref_CaptureAlphaBlending = false;
m_pref_BlackAlphaBlending = false;
}
// Make the loaded settings active..
m_server->SetDisableTrayIcon(0);
m_server->SetLoopbackOnly(true);
m_server->SetLoopbackOk(true);
m_server->SetLoopbackOk(true);
m_server->SetAuthRequired(false);
m_server->SetConnectPriority(3);
m_server->SetAuthHosts(0);;
m_server->SetNewMSLogon(m_pref_NewMSLogon);
m_server->RequireMSLogon(m_pref_RequireMSLogon);
m_server->EnableFileTransfer(m_pref_EnableFileTransfer);
m_server->BlankMonitorEnabled(m_pref_EnableBlankMonitor);
m_server->SetDefaultScale(m_pref_DefaultScale);
m_server->SetQuerySetting(4);
m_server->SetQueryTimeout(10);
m_server->SetQueryAccept(1);
m_server->SetAutoIdleDisconnectTimeout(m_pref_IdleTimeout);
m_server->EnableRemoveWallpaper(m_pref_RemoveWallpaper);
m_server->SockConnect(0);
m_server->BlackAlphaBlending(m_pref_BlackAlphaBlending);
m_server->CaptureAlphaBlending(m_pref_CaptureAlphaBlending);
// Are inputs being disabled?
if (!m_pref_EnableRemoteInputs)
m_server->EnableRemoteInputs(m_pref_EnableRemoteInputs);
if (m_pref_DisableLocalInputs)
m_server->DisableLocalInputs(m_pref_DisableLocalInputs);
// Update the password
// m_server->SetPassword(m_pref_passwd);
// Now change the listening port settings
m_server->SetAutoPortSelect(m_pref_AutoPortSelect);
if (!m_pref_AutoPortSelect)
// m_server->SetPort(m_pref_PortNumber);
m_server->SetPorts(m_pref_PortNumber, m_pref_HttpPortNumber); // Tight 1.2.7
m_server->SockConnect(0);
// Remote access prefs
m_server->EnableRemoteInputs(m_pref_EnableRemoteInputs);
m_server->SetLockSettings(m_pref_LockSettings);
m_server->DisableLocalInputs(m_pref_DisableLocalInputs);
// DSM Plugin prefs
m_server->EnableDSMPlugin(m_pref_UseDSMPlugin);
m_server->SetDSMPluginName("MSRC4Plugin.dsm");
if (m_server->IsDSMPluginEnabled()) m_server->SetDSMPlugin();
return TRUE;
}