diff options
author | Constantin Kaplinsky <const@tightvnc.com> | 2006-05-25 05:12:25 +0000 |
---|---|---|
committer | Constantin Kaplinsky <const@tightvnc.com> | 2006-05-25 05:12:25 +0000 |
commit | 729598cb00d791bbdfe23ebe0023d3a1c3962f83 (patch) | |
tree | ffe1b87705a0541998b8d7c44ea75dc4702dc515 /win/vncconfig | |
parent | b30ae7facbdf8273f34f5d67d3d2e9c81db75576 (diff) | |
download | tigervnc-729598cb00d791bbdfe23ebe0023d3a1c3962f83.tar.gz tigervnc-729598cb00d791bbdfe23ebe0023d3a1c3962f83.zip |
Migrating to new directory structure adopted from the RealVNC's source tree. More changes will follow.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@591 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'win/vncconfig')
-rw-r--r-- | win/vncconfig/Authentication.h | 142 | ||||
-rw-r--r-- | win/vncconfig/Connections.h | 298 | ||||
-rw-r--r-- | win/vncconfig/Desktop.h | 94 | ||||
-rw-r--r-- | win/vncconfig/Hooking.h | 88 | ||||
-rw-r--r-- | win/vncconfig/Inputs.h | 84 | ||||
-rw-r--r-- | win/vncconfig/Legacy.cxx | 248 | ||||
-rw-r--r-- | win/vncconfig/Legacy.h | 85 | ||||
-rw-r--r-- | win/vncconfig/PasswordDialog.cxx | 52 | ||||
-rw-r--r-- | win/vncconfig/PasswordDialog.h | 40 | ||||
-rw-r--r-- | win/vncconfig/Sharing.h | 59 | ||||
-rw-r--r-- | win/vncconfig/resource.h | 102 | ||||
-rw-r--r-- | win/vncconfig/vncconfig.cxx | 191 | ||||
-rw-r--r-- | win/vncconfig/vncconfig.dsp | 196 | ||||
-rw-r--r-- | win/vncconfig/vncconfig.exe.manifest | 22 | ||||
-rw-r--r-- | win/vncconfig/vncconfig.ico | bin | 0 -> 1078 bytes | |||
-rw-r--r-- | win/vncconfig/vncconfig.rc | 496 |
16 files changed, 2197 insertions, 0 deletions
diff --git a/win/vncconfig/Authentication.h b/win/vncconfig/Authentication.h new file mode 100644 index 00000000..f4b38f8c --- /dev/null +++ b/win/vncconfig/Authentication.h @@ -0,0 +1,142 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_AUTHENTICATION +#define WINVNCCONF_AUTHENTICATION + +#include <vncconfig/PasswordDialog.h> +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/OSVersion.h> +#include <rfb_win32/MsgBox.h> +#include <rfb/ServerCore.h> +#include <rfb/secTypes.h> +#include <rfb/Password.h> + +static rfb::BoolParameter queryOnlyIfLoggedOn("QueryOnlyIfLoggedOn", + "Only prompt for a local user to accept incoming connections if there is a user logged on", false); + +namespace rfb { + + namespace win32 { + + class AuthenticationPage : public PropSheetPage { + public: + AuthenticationPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_AUTHENTICATION)), regKey(rk) {} + void initDialog() { + CharArray sec_types_str(SSecurityFactoryStandard::sec_types.getData()); + std::list<int> sec_types = parseSecTypes(sec_types_str.buf); + + useNone = useVNC = false; + std::list<int>::iterator i; + for (i=sec_types.begin(); i!=sec_types.end(); i++) { + if ((*i) == secTypeNone) useNone = true; + else if ((*i) == secTypeVncAuth) useVNC = true; + } + + HWND security = GetDlgItem(handle, IDC_ENCRYPTION); + SendMessage(security, CB_ADDSTRING, 0, (LPARAM)_T("Always Off")); + SendMessage(security, CB_SETCURSEL, 0, 0); + enableItem(IDC_AUTH_NT, false); enableItem(IDC_AUTH_NT_CONF, false); + enableItem(IDC_ENCRYPTION, false); enableItem(IDC_AUTH_RA2_CONF, false); + + setItemChecked(IDC_AUTH_NONE, useNone); + setItemChecked(IDC_AUTH_VNC, useVNC); + setItemChecked(IDC_QUERY_CONNECT, rfb::Server::queryConnect); + setItemChecked(IDC_QUERY_LOGGED_ON, queryOnlyIfLoggedOn); + onCommand(IDC_AUTH_NONE, 0); + } + bool onCommand(int id, int cmd) { + switch (id) { + case IDC_AUTH_VNC_PASSWD: + { + PasswordDialog passwdDlg(regKey, registryInsecure); + passwdDlg.showDialog(handle); + } + return true; + case IDC_AUTH_NONE: + case IDC_AUTH_VNC: + enableItem(IDC_AUTH_VNC_PASSWD, isItemChecked(IDC_AUTH_VNC)); + case IDC_QUERY_CONNECT: + case IDC_QUERY_LOGGED_ON: + setChanged((useNone != isItemChecked(IDC_AUTH_NONE)) || + (useVNC != isItemChecked(IDC_AUTH_VNC)) || + (rfb::Server::queryConnect != isItemChecked(IDC_QUERY_CONNECT)) || + (queryOnlyIfLoggedOn != isItemChecked(IDC_QUERY_LOGGED_ON))); + enableItem(IDC_QUERY_LOGGED_ON, enableQueryOnlyIfLoggedOn()); + return false; + }; + return false; + } + bool onOk() { + bool useVncChanged = useVNC != isItemChecked(IDC_AUTH_VNC); + useVNC = isItemChecked(IDC_AUTH_VNC); + useNone = isItemChecked(IDC_AUTH_NONE); + if (useVNC) { + verifyVncPassword(regKey); + regKey.setString(_T("SecurityTypes"), _T("VncAuth")); + } else { + if (haveVncPassword() && useVncChanged && + MsgBox(0, _T("The VNC authentication method is disabled, but a password is still stored for it.\n") + _T("Do you want to remove the VNC authentication password from the registry?"), + MB_ICONWARNING | MB_YESNO) == IDYES) { + regKey.setBinary(_T("Password"), 0, 0); + } + regKey.setString(_T("SecurityTypes"), _T("None")); + } + regKey.setString(_T("ReverseSecurityTypes"), _T("None")); + regKey.setBool(_T("QueryConnect"), isItemChecked(IDC_QUERY_CONNECT)); + regKey.setBool(_T("QueryOnlyIfLoggedOn"), isItemChecked(IDC_QUERY_LOGGED_ON)); + return true; + } + void setWarnPasswdInsecure(bool warn) { + registryInsecure = warn; + } + bool enableQueryOnlyIfLoggedOn() { + return isItemChecked(IDC_QUERY_CONNECT) && osVersion.isPlatformNT && (osVersion.dwMajorVersion >= 5); + } + + + static bool haveVncPassword() { + PlainPasswd password(SSecurityFactoryStandard::vncAuthPasswd.getVncAuthPasswd()); + return password.buf && strlen(password.buf) != 0; + } + + static void verifyVncPassword(const RegKey& regKey) { + if (!haveVncPassword()) { + MsgBox(0, _T("The VNC authentication method is enabled, but no password is specified.\n") + _T("The password dialog will now be shown."), MB_ICONINFORMATION | MB_OK); + PasswordDialog passwd(regKey, registryInsecure); + passwd.showDialog(); + } + } + + protected: + RegKey regKey; + static bool registryInsecure; + bool useNone; + bool useVNC; + }; + + }; + + bool AuthenticationPage::registryInsecure = false; + +}; + +#endif diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h new file mode 100644 index 00000000..7512cc65 --- /dev/null +++ b/win/vncconfig/Connections.h @@ -0,0 +1,298 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_CONNECTIONS +#define WINVNCCONF_CONNECTIONS + +#include <vector> + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/ModuleFileName.h> +#include <rfb/Configuration.h> +#include <rfb/Blacklist.h> +#include <network/TcpSocket.h> + +static rfb::IntParameter http_port("HTTPPortNumber", + "TCP/IP port on which the server will serve the Java applet VNC Viewer ", 5800); +static rfb::IntParameter port_number("PortNumber", + "TCP/IP port on which the server will accept connections", 5900); +static rfb::StringParameter hosts("Hosts", + "Filter describing which hosts are allowed access to this server", "+"); +static rfb::BoolParameter localHost("LocalHost", + "Only accept connections from via the local loop-back network interface", false); + +namespace rfb { + + namespace win32 { + + class ConnHostDialog : public Dialog { + public: + ConnHostDialog() : Dialog(GetModuleHandle(0)) {} + bool showDialog(const TCHAR* pat) { + pattern.replaceBuf(tstrDup(pat)); + return Dialog::showDialog(MAKEINTRESOURCE(IDD_CONN_HOST)); + } + void initDialog() { + if (_tcslen(pattern.buf) == 0) + pattern.replaceBuf(tstrDup("+")); + + if (pattern.buf[0] == _T('+')) + setItemChecked(IDC_ALLOW, true); + else if (pattern.buf[0] == _T('?')) + setItemChecked(IDC_QUERY, true); + else + setItemChecked(IDC_DENY, true); + + setItemString(IDC_HOST_PATTERN, &pattern.buf[1]); + pattern.replaceBuf(0); + } + bool onOk() { + TCharArray host = getItemString(IDC_HOST_PATTERN); + TCharArray newPat(_tcslen(host.buf)+2); + if (isItemChecked(IDC_ALLOW)) + newPat.buf[0] = _T('+'); + else if (isItemChecked(IDC_QUERY)) + newPat.buf[0] = _T('?'); + else + newPat.buf[0] = _T('-'); + newPat.buf[1] = 0; + _tcscat(newPat.buf, host.buf); + + network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(CStr(newPat.buf))); + pattern.replaceBuf(TCharArray(network::TcpFilter::patternToStr(pat)).takeBuf()); + return true; + } + const TCHAR* getPattern() {return pattern.buf;} + protected: + TCharArray pattern; + }; + + class ConnectionsPage : public PropSheetPage { + public: + ConnectionsPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_CONNECTIONS)), regKey(rk) {} + void initDialog() { + vlog.debug("set IDC_PORT %d", (int)port_number); + setItemInt(IDC_PORT, port_number ? port_number : 5900); + setItemChecked(IDC_RFB_ENABLE, port_number != 0); + setItemInt(IDC_IDLE_TIMEOUT, rfb::Server::idleTimeout); + vlog.debug("set IDC_HTTP_PORT %d", (int)http_port); + setItemInt(IDC_HTTP_PORT, http_port ? http_port : 5800); + setItemChecked(IDC_HTTP_ENABLE, http_port != 0); + enableItem(IDC_HTTP_PORT, http_port != 0); + setItemChecked(IDC_LOCALHOST, localHost); + + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + while (SendMessage(listBox, LB_GETCOUNT, 0, 0)) + SendMessage(listBox, LB_DELETESTRING, 0, 0); + + CharArray tmp; + tmp.buf = hosts.getData(); + while (tmp.buf) { + CharArray first; + strSplit(tmp.buf, ',', &first.buf, &tmp.buf); + if (strlen(first.buf)) + SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)(const TCHAR*)TStr(first.buf)); + } + + onCommand(IDC_RFB_ENABLE, EN_CHANGE); + } + bool onCommand(int id, int cmd) { + switch (id) { + case IDC_HOSTS: + { + DWORD selected = SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_GETCURSEL, 0, 0); + int count = SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_GETCOUNT, 0, 0); + bool enable = selected != LB_ERR; + enableItem(IDC_HOST_REMOVE, enable); + enableItem(IDC_HOST_UP, enable && (selected > 0)); + enableItem(IDC_HOST_DOWN, enable && (selected < count-1)); + enableItem(IDC_HOST_EDIT, enable); + setChanged(isChanged()); + } + return true; + + case IDC_PORT: + if (cmd == EN_CHANGE) { + try { + setItemInt(IDC_HTTP_PORT, rfbPortToHTTP(getItemInt(IDC_PORT))); + } catch (...) { + } + } + case IDC_HTTP_PORT: + case IDC_IDLE_TIMEOUT: + if (cmd == EN_CHANGE) + setChanged(isChanged()); + return false; + + case IDC_HTTP_ENABLE: + case IDC_RFB_ENABLE: + case IDC_LOCALHOST: + { + // HTTP port + enableItem(IDC_HTTP_PORT, isItemChecked(IDC_HTTP_ENABLE) && isItemChecked(IDC_RFB_ENABLE)); + enableItem(IDC_HTTP_ENABLE, isItemChecked(IDC_RFB_ENABLE)); + + // RFB port + enableItem(IDC_PORT, isItemChecked(IDC_RFB_ENABLE)); + + // Hosts + enableItem(IDC_LOCALHOST, isItemChecked(IDC_RFB_ENABLE)); + + bool enableHosts = !isItemChecked(IDC_LOCALHOST) && isItemChecked(IDC_RFB_ENABLE); + enableItem(IDC_HOSTS, enableHosts); + enableItem(IDC_HOST_ADD, enableHosts); + if (!enableHosts) { + enableItem(IDC_HOST_REMOVE, enableHosts); + enableItem(IDC_HOST_UP, enableHosts); + enableItem(IDC_HOST_DOWN, enableHosts); + enableItem(IDC_HOST_EDIT, enableHosts); + } else { + onCommand(IDC_HOSTS, EN_CHANGE); + } + setChanged(isChanged()); + return false; + } + + case IDC_HOST_ADD: + if (hostDialog.showDialog(_T(""))) + { + const TCHAR* pattern = hostDialog.getPattern(); + if (pattern) + SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_ADDSTRING, 0, (LPARAM)pattern); + } + return true; + + case IDC_HOST_EDIT: + { + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + int item = SendMessage(listBox, LB_GETCURSEL, 0, 0); + TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1); + SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf); + + if (hostDialog.showDialog(pattern.buf)) { + const TCHAR* newPat = hostDialog.getPattern(); + if (newPat) { + item = SendMessage(listBox, LB_FINDSTRINGEXACT, item, (LPARAM)pattern.buf); + if (item != LB_ERR) { + SendMessage(listBox, LB_DELETESTRING, item, 0); + SendMessage(listBox, LB_INSERTSTRING, item, (LPARAM)newPat); + SendMessage(listBox, LB_SETCURSEL, item, 0); + onCommand(IDC_HOSTS, EN_CHANGE); + } + } + } + } + return true; + + case IDC_HOST_UP: + { + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + int item = SendMessage(listBox, LB_GETCURSEL, 0, 0); + TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1); + SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf); + SendMessage(listBox, LB_DELETESTRING, item, 0); + SendMessage(listBox, LB_INSERTSTRING, item-1, (LPARAM)pattern.buf); + SendMessage(listBox, LB_SETCURSEL, item-1, 0); + onCommand(IDC_HOSTS, EN_CHANGE); + } + return true; + + case IDC_HOST_DOWN: + { + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + int item = SendMessage(listBox, LB_GETCURSEL, 0, 0); + TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1); + SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf); + SendMessage(listBox, LB_DELETESTRING, item, 0); + SendMessage(listBox, LB_INSERTSTRING, item+1, (LPARAM)pattern.buf); + SendMessage(listBox, LB_SETCURSEL, item+1, 0); + onCommand(IDC_HOSTS, EN_CHANGE); + } + return true; + + case IDC_HOST_REMOVE: + { + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + int item = SendMessage(listBox, LB_GETCURSEL, 0, 0); + SendMessage(listBox, LB_DELETESTRING, item, 0); + onCommand(IDC_HOSTS, EN_CHANGE); + } + + } + return false; + } + bool onOk() { + regKey.setInt(_T("PortNumber"), isItemChecked(IDC_RFB_ENABLE) ? getItemInt(IDC_PORT) : 0); + regKey.setInt(_T("IdleTimeout"), getItemInt(IDC_IDLE_TIMEOUT)); + regKey.setInt(_T("HTTPPortNumber"), isItemChecked(IDC_HTTP_ENABLE) && isItemChecked(IDC_RFB_ENABLE) + ? getItemInt(IDC_HTTP_PORT) : 0); + regKey.setInt(_T("LocalHost"), isItemChecked(IDC_LOCALHOST)); + regKey.setString(_T("Hosts"), TCharArray(getHosts()).buf); + return true; + } + bool isChanged() { + try { + CharArray new_hosts = getHosts(); + CharArray old_hosts = hosts.getData(); + return (strcmp(new_hosts.buf, old_hosts.buf) != 0) || + (localHost != isItemChecked(IDC_LOCALHOST)) || + (port_number != getItemInt(IDC_PORT)) || + (http_port != getItemInt(IDC_HTTP_PORT)) || + ((http_port!=0) != (isItemChecked(IDC_HTTP_ENABLE)!=0)) || + (rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT)); + } catch (rdr::Exception) { + return false; + } + } + char* getHosts() { + int bufLen = 1, i; + HWND listBox = GetDlgItem(handle, IDC_HOSTS); + for (i=0; i<SendMessage(listBox, LB_GETCOUNT, 0, 0); i++) + bufLen+=SendMessage(listBox, LB_GETTEXTLEN, i, 0)+1; + TCharArray hosts_str(bufLen); + hosts_str.buf[0] = 0; + TCHAR* outPos = hosts_str.buf; + for (i=0; i<SendMessage(listBox, LB_GETCOUNT, 0, 0); i++) { + outPos += SendMessage(listBox, LB_GETTEXT, i, (LPARAM)outPos); + outPos[0] = ','; + outPos[1] = 0; + outPos++; + } + return strDup(hosts_str.buf); + } + int rfbPortToHTTP(int rfbPort) { + int offset = -100; + if (http_port) + offset = http_port - port_number; + int httpPort = rfbPort + offset; + if (httpPort <= 0) + httpPort = rfbPort; + return httpPort; + } + + protected: + RegKey regKey; + ConnHostDialog hostDialog; + }; + + }; + +}; + +#endif diff --git a/win/vncconfig/Desktop.h b/win/vncconfig/Desktop.h new file mode 100644 index 00000000..164269a2 --- /dev/null +++ b/win/vncconfig/Desktop.h @@ -0,0 +1,94 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_DESKTOP +#define WINVNCCONF_DESKTOP + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/SDisplay.h> +#include <rfb_win32/DynamicFn.h> + +namespace rfb { + + namespace win32 { + + class DesktopPage : public PropSheetPage { + public: + DesktopPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {} + void initDialog() { + CharArray action = rfb::win32::SDisplay::disconnectAction.getData(); + bool disconnectLock = stricmp(action.buf, "Lock") == 0; + bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0; + typedef BOOL (WINAPI *_LockWorkStation_proto)(); + DynamicFn<_LockWorkStation_proto> _LockWorkStation(_T("user32.dll"), "LockWorkStation"); + if (!_LockWorkStation.isValid()) { + enableItem(IDC_DISCONNECT_LOCK, false); + if (disconnectLock) { + disconnectLogoff = true; + disconnectLock = false; + } + } + setItemChecked(IDC_DISCONNECT_LOGOFF, disconnectLogoff); + setItemChecked(IDC_DISCONNECT_LOCK, disconnectLock); + setItemChecked(IDC_DISCONNECT_NONE, !disconnectLock && !disconnectLogoff); + setItemChecked(IDC_REMOVE_WALLPAPER, rfb::win32::SDisplay::removeWallpaper); + setItemChecked(IDC_REMOVE_PATTERN, rfb::win32::SDisplay::removePattern); + setItemChecked(IDC_DISABLE_EFFECTS, rfb::win32::SDisplay::disableEffects); + } + bool onCommand(int id, int cmd) { + switch (id) { + case IDC_DISCONNECT_LOGOFF: + case IDC_DISCONNECT_LOCK: + case IDC_DISCONNECT_NONE: + case IDC_REMOVE_WALLPAPER: + case IDC_REMOVE_PATTERN: + case IDC_DISABLE_EFFECTS: + CharArray action = rfb::win32::SDisplay::disconnectAction.getData(); + bool disconnectLock = stricmp(action.buf, "Lock") == 0; + bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0; + setChanged((disconnectLogoff != isItemChecked(IDC_DISCONNECT_LOGOFF)) || + (disconnectLock != isItemChecked(IDC_DISCONNECT_LOCK)) || + (isItemChecked(IDC_REMOVE_WALLPAPER) != rfb::win32::SDisplay::removeWallpaper) || + (isItemChecked(IDC_REMOVE_PATTERN) != rfb::win32::SDisplay::removePattern) || + (isItemChecked(IDC_DISABLE_EFFECTS) != rfb::win32::SDisplay::disableEffects)); + break; + } + return false; + } + bool onOk() { + const TCHAR* action = _T("None"); + if (isItemChecked(IDC_DISCONNECT_LOGOFF)) + action = _T("Logoff"); + else if (isItemChecked(IDC_DISCONNECT_LOCK)) + action = _T("Lock"); + regKey.setString(_T("DisconnectAction"), action); + regKey.setBool(_T("RemoveWallpaper"), isItemChecked(IDC_REMOVE_WALLPAPER)); + regKey.setBool(_T("RemovePattern"), isItemChecked(IDC_REMOVE_PATTERN)); + regKey.setBool(_T("DisableEffects"), isItemChecked(IDC_DISABLE_EFFECTS)); + return true; + } + protected: + RegKey regKey; + }; + + }; + +}; + +#endif diff --git a/win/vncconfig/Hooking.h b/win/vncconfig/Hooking.h new file mode 100644 index 00000000..9be82f3a --- /dev/null +++ b/win/vncconfig/Hooking.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_HOOKING +#define WINVNCCONF_HOOKING + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/SDisplay.h> +#include <rfb_win32/WMPoller.h> +#include <rfb/ServerCore.h> + +namespace rfb { + + namespace win32 { + + class HookingPage : public PropSheetPage { + public: + HookingPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_HOOKING)), regKey(rk) {} + void initDialog() { + setItemChecked(IDC_USEPOLLING, rfb::win32::SDisplay::updateMethod == 0); + setItemChecked(IDC_USEHOOKS, (rfb::win32::SDisplay::updateMethod == 1) && + rfb::win32::SDisplay::areHooksAvailable()); + enableItem(IDC_USEHOOKS, rfb::win32::SDisplay::areHooksAvailable()); + setItemChecked(IDC_USEDRIVER, (rfb::win32::SDisplay::updateMethod == 2) && + rfb::win32::SDisplay::isDriverAvailable()); + enableItem(IDC_USEDRIVER, rfb::win32::SDisplay::isDriverAvailable()); + setItemChecked(IDC_POLLCONSOLES, rfb::win32::WMPoller::poll_console_windows); + setItemChecked(IDC_CAPTUREBLT, osVersion.isPlatformNT && + rfb::win32::DeviceFrameBuffer::useCaptureBlt); + enableItem(IDC_CAPTUREBLT, osVersion.isPlatformNT); + onCommand(IDC_USEHOOKS, 0); + } + bool onCommand(int id, int cmd) { + switch (id) { + case IDC_USEPOLLING: + case IDC_USEHOOKS: + case IDC_USEDRIVER: + case IDC_POLLCONSOLES: + case IDC_CAPTUREBLT: + setChanged(((rfb::win32::SDisplay::updateMethod == 0) != isItemChecked(IDC_USEPOLLING)) || + ((rfb::win32::SDisplay::updateMethod == 1) != isItemChecked(IDC_USEHOOKS)) || + ((rfb::win32::SDisplay::updateMethod == 2) != isItemChecked(IDC_USEDRIVER)) || + (rfb::win32::WMPoller::poll_console_windows != isItemChecked(IDC_POLLCONSOLES)) || + (rfb::win32::DeviceFrameBuffer::useCaptureBlt != isItemChecked(IDC_CAPTUREBLT))); + enableItem(IDC_POLLCONSOLES, isItemChecked(IDC_USEHOOKS)); + break; + } + return false; + } + bool onOk() { + if (isItemChecked(IDC_USEPOLLING)) + regKey.setInt(_T("UpdateMethod"), 0); + if (isItemChecked(IDC_USEHOOKS)) + regKey.setInt(_T("UpdateMethod"), 1); + if (isItemChecked(IDC_USEDRIVER)) + regKey.setInt(_T("UpdateMethod"), 2); + regKey.setBool(_T("PollConsoleWindows"), isItemChecked(IDC_POLLCONSOLES)); + regKey.setBool(_T("UseCaptureBlt"), isItemChecked(IDC_CAPTUREBLT)); + + // *** LEGACY compatibility *** + regKey.setBool(_T("UseHooks"), isItemChecked(IDC_USEHOOKS)); + return true; + } + protected: + RegKey regKey; + }; + + }; + +}; + +#endif diff --git a/win/vncconfig/Inputs.h b/win/vncconfig/Inputs.h new file mode 100644 index 00000000..1e0b4bac --- /dev/null +++ b/win/vncconfig/Inputs.h @@ -0,0 +1,84 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_INPUTS +#define WINVNCCONF_INPUTS + +#ifndef SPI_GETBLOCKSENDINPUTRESETS +#define SPI_GETBLOCKSENDINPUTRESETS 0x1026 +#define SPI_SETBLOCKSENDINPUTRESETS 0x1027 +#endif + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/OSVersion.h> +#include <rfb/ServerCore.h> + +namespace rfb { + namespace win32 { + + class InputsPage : public PropSheetPage { + public: + InputsPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_INPUTS)), + regKey(rk), enableAffectSSaver(true) {} + void initDialog() { + setItemChecked(IDC_ACCEPT_KEYS, rfb::Server::acceptKeyEvents); + setItemChecked(IDC_ACCEPT_PTR, rfb::Server::acceptPointerEvents); + setItemChecked(IDC_ACCEPT_CUTTEXT, rfb::Server::acceptCutText); + setItemChecked(IDC_SEND_CUTTEXT, rfb::Server::sendCutText); + setItemChecked(IDC_DISABLE_LOCAL_INPUTS, SDisplay::disableLocalInputs); + enableItem(IDC_DISABLE_LOCAL_INPUTS, !osVersion.isPlatformWindows); + BOOL blocked = FALSE; + if (SystemParametersInfo(SPI_GETBLOCKSENDINPUTRESETS, 0, &blocked, 0)) + setItemChecked(IDC_AFFECT_SCREENSAVER, !blocked); + else + enableAffectSSaver = false; + enableItem(IDC_AFFECT_SCREENSAVER, enableAffectSSaver); + } + bool onCommand(int id, int cmd) { + BOOL inputResetsBlocked; + SystemParametersInfo(SPI_GETBLOCKSENDINPUTRESETS, 0, &inputResetsBlocked, 0); + setChanged((rfb::Server::acceptKeyEvents != isItemChecked(IDC_ACCEPT_KEYS)) || + (rfb::Server::acceptPointerEvents != isItemChecked(IDC_ACCEPT_PTR)) || + (rfb::Server::acceptCutText != isItemChecked(IDC_ACCEPT_CUTTEXT)) || + (rfb::Server::sendCutText != isItemChecked(IDC_SEND_CUTTEXT)) || + (SDisplay::disableLocalInputs != isItemChecked(IDC_DISABLE_LOCAL_INPUTS)) || + (enableAffectSSaver && (!inputResetsBlocked != isItemChecked(IDC_AFFECT_SCREENSAVER)))); + return false; + } + bool onOk() { + regKey.setBool(_T("AcceptKeyEvents"), isItemChecked(IDC_ACCEPT_KEYS)); + regKey.setBool(_T("AcceptPointerEvents"), isItemChecked(IDC_ACCEPT_PTR)); + regKey.setBool(_T("AcceptCutText"), isItemChecked(IDC_ACCEPT_CUTTEXT)); + regKey.setBool(_T("SendCutText"), isItemChecked(IDC_SEND_CUTTEXT)); + regKey.setBool(_T("DisableLocalInputs"), isItemChecked(IDC_DISABLE_LOCAL_INPUTS)); + if (enableAffectSSaver) { + BOOL blocked = !isItemChecked(IDC_AFFECT_SCREENSAVER); + SystemParametersInfo(SPI_SETBLOCKSENDINPUTRESETS, blocked, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); + } + return true; + } + protected: + RegKey regKey; + bool enableAffectSSaver; + }; + + }; +}; + +#endif diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx new file mode 100644 index 00000000..ae5d7166 --- /dev/null +++ b/win/vncconfig/Legacy.cxx @@ -0,0 +1,248 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include <vncconfig/Legacy.h> + +#include <rfb/LogWriter.h> +#include <rfb/Password.h> +#include <rfb_win32/CurrentUser.h> + +using namespace rfb; +using namespace win32; + +static LogWriter vlog("Legacy"); + + +void LegacyPage::LoadPrefs() + { + // VNC 3.3.3R3 Preferences Algorithm, as described by vncProperties.cpp + // - Load user-specific settings, based on logged-on user name, + // from HKLM/Software/ORL/WinVNC3/<user>. If they don't exist, + // try again with username "Default". + // - Load system-wide settings from HKLM/Software/ORL/WinVNC3. + // - If AllowProperties is non-zero then load the user's own + // settings from HKCU/Software/ORL/WinVNC3. + + // Get the name of the current user + TCharArray username; + try { + UserName name; + username.buf = name.takeBuf(); + } catch (rdr::SystemException& e) { + if (e.err != ERROR_NOT_LOGGED_ON) + throw; + } + + // Open and read the WinVNC3 registry key + allowProperties = true; + RegKey winvnc3; + try { + winvnc3.openKey(HKEY_LOCAL_MACHINE, _T("Software\\ORL\\WinVNC3")); + int debugMode = winvnc3.getInt(_T("DebugMode"), 0); + const char* debugTarget = 0; + if (debugMode & 2) debugTarget = "file"; + if (debugMode & 4) debugTarget = "stderr"; + if (debugTarget) { + char logSetting[32]; + sprintf(logSetting, "*:%s:%d", debugTarget, winvnc3.getInt(_T("DebugLevel"), 0)); + regKey.setString(_T("Log"), TStr(logSetting)); + } + + TCharArray authHosts; + authHosts.buf = winvnc3.getString(_T("AuthHosts"), 0); + if (authHosts.buf) { + CharArray newHosts; + newHosts.buf = strDup(""); + + // Reformat AuthHosts to Hosts. Wish I'd left the format the same. :( :( :( + try { + CharArray tmp = strDup(authHosts.buf); + while (tmp.buf) { + + // Split the AuthHosts string into patterns to match + CharArray first; + rfb::strSplit(tmp.buf, ':', &first.buf, &tmp.buf); + if (strlen(first.buf)) { + int bits = 0; + CharArray pattern(1+4*4+4); + pattern.buf[0] = first.buf[0]; + pattern.buf[1] = 0; + + // Split the pattern into IP address parts and process + rfb::CharArray address; + address.buf = rfb::strDup(&first.buf[1]); + while (address.buf) { + rfb::CharArray part; + rfb::strSplit(address.buf, '.', &part.buf, &address.buf); + if (bits) + strcat(pattern.buf, "."); + if (strlen(part.buf) > 3) + throw rdr::Exception("Invalid IP address part"); + if (strlen(part.buf) > 0) { + strcat(pattern.buf, part.buf); + bits += 8; + } + } + + // Pad out the address specification if required + int addrBits = bits; + while (addrBits < 32) { + if (addrBits) strcat(pattern.buf, "."); + strcat(pattern.buf, "0"); + addrBits += 8; + } + + // Append the number of bits to match + char buf[4]; + sprintf(buf, "/%d", bits); + strcat(pattern.buf, buf); + + // Append this pattern to the Hosts value + int length = strlen(newHosts.buf) + strlen(pattern.buf) + 2; + CharArray tmpHosts(length); + strcpy(tmpHosts.buf, pattern.buf); + if (strlen(newHosts.buf)) { + strcat(tmpHosts.buf, ","); + strcat(tmpHosts.buf, newHosts.buf); + } + delete [] newHosts.buf; + newHosts.buf = tmpHosts.takeBuf(); + } + } + + // Finally, save the Hosts value + regKey.setString(_T("Hosts"), TStr(newHosts.buf)); + } catch (rdr::Exception) { + MsgBox(0, _T("Unable to convert AuthHosts setting to Hosts format."), + MB_ICONWARNING | MB_OK); + } + } else { + regKey.setString(_T("Hosts"), _T("+")); + } + + regKey.setBool(_T("LocalHost"), winvnc3.getBool(_T("LoopbackOnly"), false)); + // *** check AllowLoopback? + + if (winvnc3.getBool(_T("AuthRequired"), true)) + regKey.setString(_T("SecurityTypes"), _T("VncAuth")); + else + regKey.setString(_T("SecurityTypes"), _T("None")); + + int connectPriority = winvnc3.getInt(_T("ConnectPriority"), 0); + regKey.setBool(_T("DisconnectClients"), connectPriority == 0); + regKey.setBool(_T("AlwaysShared"), connectPriority == 1); + regKey.setBool(_T("NeverShared"), connectPriority == 2); + + } catch(rdr::Exception) { + } + + // Open the local, default-user settings + allowProperties = true; + try { + RegKey userKey; + userKey.openKey(winvnc3, _T("Default")); + vlog.info("loading Default prefs"); + LoadUserPrefs(userKey); + } catch(rdr::Exception& e) { + vlog.error("error reading Default settings:%s", e.str()); + } + + // Open the local, user-specific settings + if (userSettings && username.buf) { + try { + RegKey userKey; + userKey.openKey(winvnc3, username.buf); + vlog.info("loading local User prefs"); + LoadUserPrefs(userKey); + } catch(rdr::Exception& e) { + vlog.error("error reading local User settings:%s", e.str()); + } + + // Open the user's own settings + if (allowProperties) { + try { + RegKey userKey; + userKey.openKey(HKEY_CURRENT_USER, _T("Software\\ORL\\WinVNC3")); + vlog.info("loading global User prefs"); + LoadUserPrefs(userKey); + } catch(rdr::Exception& e) { + vlog.error("error reading global User settings:%s", e.str()); + } + } + } + + // Disable the Options menu item if appropriate + regKey.setBool(_T("DisableOptions"), !allowProperties); + } + + void LegacyPage::LoadUserPrefs(const RegKey& key) + { + if (key.getBool(_T("HTTPConnect"), true)) + regKey.setInt(_T("HTTPPortNumber"), key.getInt(_T("PortNumber"), 5900)-100); + else + regKey.setInt(_T("HTTPPortNumber"), 0); + regKey.setInt(_T("PortNumber"), key.getBool(_T("SocketConnect")) ? key.getInt(_T("PortNumber"), 5900) : 0); + if (key.getBool(_T("AutoPortSelect"), false)) { + MsgBox(0, _T("The AutoPortSelect setting is not supported by this release.") + _T("The port number will default to 5900."), + MB_ICONWARNING | MB_OK); + regKey.setInt(_T("PortNumber"), 5900); + } + regKey.setInt(_T("IdleTimeout"), key.getInt(_T("IdleTimeout"), 0)); + + regKey.setBool(_T("RemoveWallpaper"), key.getBool(_T("RemoveWallpaper"))); + regKey.setBool(_T("RemovePattern"), key.getBool(_T("RemoveWallpaper"))); + regKey.setBool(_T("DisableEffects"), key.getBool(_T("RemoveWallpaper"))); + + if (key.getInt(_T("QuerySetting"), 2) != 2) { + regKey.setBool(_T("QueryConnect"), key.getInt(_T("QuerySetting")) > 2); + MsgBox(0, _T("The QuerySetting option has been replaced by QueryConnect.") + _T("Please see the documentation for details of the QueryConnect option."), + MB_ICONWARNING | MB_OK); + } + regKey.setInt(_T("QueryTimeout"), key.getInt(_T("QueryTimeout"), 10)); + + ObfuscatedPasswd passwd; + key.getBinary(_T("Password"), (void**)&passwd.buf, &passwd.length, 0, 0); + regKey.setBinary(_T("Password"), passwd.buf, passwd.length); + + bool enableInputs = key.getBool(_T("InputsEnabled"), true); + regKey.setBool(_T("AcceptKeyEvents"), enableInputs); + regKey.setBool(_T("AcceptPointerEvents"), enableInputs); + regKey.setBool(_T("AcceptCutText"), enableInputs); + regKey.setBool(_T("SendCutText"), enableInputs); + + switch (key.getInt(_T("LockSetting"), 0)) { + case 0: regKey.setString(_T("DisconnectAction"), _T("None")); break; + case 1: regKey.setString(_T("DisconnectAction"), _T("Lock")); break; + case 2: regKey.setString(_T("DisconnectAction"), _T("Logoff")); break; + }; + + regKey.setBool(_T("DisableLocalInputs"), key.getBool(_T("LocalInputsDisabled"), false)); + + // *** ignore polling preferences + // PollUnderCursor, PollForeground, OnlyPollConsole, OnlyPollOnEvent + regKey.setBool(_T("UseHooks"), !key.getBool(_T("PollFullScreen"), false)); + + if (key.isValue(_T("AllowShutdown"))) + MsgBox(0, _T("The AllowShutdown option is not supported by this release."), MB_ICONWARNING | MB_OK); + if (key.isValue(_T("AllowEditClients"))) + MsgBox(0, _T("The AllowEditClients option is not supported by this release."), MB_ICONWARNING | MB_OK); + + allowProperties = key.getBool(_T("AllowProperties"), allowProperties); + } diff --git a/win/vncconfig/Legacy.h b/win/vncconfig/Legacy.h new file mode 100644 index 00000000..02059a64 --- /dev/null +++ b/win/vncconfig/Legacy.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#ifndef WINVNCCONF_LEGACY +#define WINVNCCONF_LEGACY + +#include <windows.h> +#include <lmcons.h> +#include <vncconfig/resource.h> +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/MsgBox.h> +#include <rfb/ServerCore.h> +#include <rfb/secTypes.h> + +namespace rfb { + + namespace win32 { + + class LegacyPage : public PropSheetPage { + public: + LegacyPage(const RegKey& rk, bool userSettings_) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_LEGACY)), regKey(rk), userSettings(userSettings_) {} + void initDialog() { + setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3); + } + bool onCommand(int id, int cmd) { + switch (id) { + case IDC_LEGACY_IMPORT: + { + DWORD result = MsgBox(0, + _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n") + _T("Are you sure you wish to continue?"), + MB_ICONWARNING | MB_YESNO); + if (result == IDYES) { + LoadPrefs(); + MsgBox(0, _T("Imported VNC 3.3 settings successfully."), + MB_ICONINFORMATION | MB_OK); + + // Sleep to allow RegConfig thread to reload settings + Sleep(1000); + propSheet->reInitPages(); + } + } + return true; + case IDC_PROTOCOL_3_3: + setChanged(isItemChecked(IDC_PROTOCOL_3_3) != rfb::Server::protocol3_3); + return false; + }; + return false; + } + bool onOk() { + regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3)); + return true; + } + + void LoadPrefs(); + void LoadUserPrefs(const RegKey& key); + + protected: + bool allowProperties; + RegKey regKey; + bool userSettings; + }; + + }; + +}; + +#endif diff --git a/win/vncconfig/PasswordDialog.cxx b/win/vncconfig/PasswordDialog.cxx new file mode 100644 index 00000000..d26d86f6 --- /dev/null +++ b/win/vncconfig/PasswordDialog.cxx @@ -0,0 +1,52 @@ +/* Copyright (C) 2004-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include <vncconfig/resource.h> +#include <vncconfig/PasswordDialog.h> +#include <rfb_win32/MsgBox.h> +#include <rfb/Password.h> + +using namespace rfb; +using namespace win32; + +PasswordDialog::PasswordDialog(const RegKey& rk, bool registryInsecure_) + : Dialog(GetModuleHandle(0)), regKey(rk), registryInsecure(registryInsecure_) { +} + +bool PasswordDialog::showDialog(HWND owner) { + return Dialog::showDialog(MAKEINTRESOURCE(IDD_AUTH_VNC_PASSWD), owner); +} + +bool PasswordDialog::onOk() { + TPlainPasswd password1(getItemString(IDC_PASSWORD1)); + TPlainPasswd password2(getItemString(IDC_PASSWORD2)); + if (_tcscmp(password1.buf, password2.buf) != 0) { + MsgBox(0, _T("The supplied passwords do not match"), + MB_ICONEXCLAMATION | MB_OK); + return false; + } + if (registryInsecure && + (MsgBox(0, _T("Please note that your password cannot be stored securely on this system. ") + _T("Are you sure you wish to continue?"), + MB_YESNO | MB_ICONWARNING) == IDNO)) + return false; + PlainPasswd password(strDup(password1.buf)); + ObfuscatedPasswd obfPwd(password); + regKey.setBinary(_T("Password"), obfPwd.buf, obfPwd.length); + return true; +} diff --git a/win/vncconfig/PasswordDialog.h b/win/vncconfig/PasswordDialog.h new file mode 100644 index 00000000..dd23f8e3 --- /dev/null +++ b/win/vncconfig/PasswordDialog.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2004-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_PASSWORD_DIALOG +#define WINVNCCONF_PASSWORD_DIALOG + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> + +namespace rfb { + namespace win32 { + + class PasswordDialog : public Dialog { + public: + PasswordDialog(const RegKey& rk, bool registryInsecure_); + bool showDialog(HWND owner=0); + bool onOk(); + protected: + const RegKey& regKey; + bool registryInsecure; + }; + + }; +}; + +#endif
\ No newline at end of file diff --git a/win/vncconfig/Sharing.h b/win/vncconfig/Sharing.h new file mode 100644 index 00000000..872ae133 --- /dev/null +++ b/win/vncconfig/Sharing.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef WINVNCCONF_SHARING +#define WINVNCCONF_SHARING + +#include <rfb_win32/Registry.h> +#include <rfb_win32/Dialog.h> +#include <rfb/ServerCore.h> + +namespace rfb { + + namespace win32 { + + class SharingPage : public PropSheetPage { + public: + SharingPage(const RegKey& rk) + : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_SHARING)), regKey(rk) {} + void initDialog() { + setItemChecked(IDC_DISCONNECT_CLIENTS, rfb::Server::disconnectClients); + setItemChecked(IDC_SHARE_NEVER, rfb::Server::neverShared); + setItemChecked(IDC_SHARE_ALWAYS, rfb::Server::alwaysShared); + setItemChecked(IDC_SHARE_CLIENT, !(rfb::Server::neverShared || rfb::Server::alwaysShared)); + } + bool onCommand(int id, int cmd) { + setChanged((isItemChecked(IDC_DISCONNECT_CLIENTS) != rfb::Server::disconnectClients) || + (isItemChecked(IDC_SHARE_NEVER) != rfb::Server::neverShared) || + (isItemChecked(IDC_SHARE_ALWAYS) != rfb::Server::alwaysShared)); + return true; + } + bool onOk() { + regKey.setBool(_T("DisconnectClients"), isItemChecked(IDC_DISCONNECT_CLIENTS)); + regKey.setBool(_T("AlwaysShared"), isItemChecked(IDC_SHARE_ALWAYS)); + regKey.setBool(_T("NeverShared"), isItemChecked(IDC_SHARE_NEVER)); + return true; + } + protected: + RegKey regKey; + }; + + }; + +}; + +#endif diff --git a/win/vncconfig/resource.h b/win/vncconfig/resource.h new file mode 100644 index 00000000..ca1fbf5a --- /dev/null +++ b/win/vncconfig/resource.h @@ -0,0 +1,102 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by vncconfig.rc +// +#define IDR_MANIFEST 1 +#define IDI_ICON 101 +#define IDD_DIALOG1 102 +#define IDD_DIALOG2 103 +#define IDD_SECURITY 104 +#define IDD_AUTHENTICATION 104 +#define IDD_CONNECTIONS 105 +#define IDD_HOOKING 106 +#define IDD_VNC_PASSWD 107 +#define IDD_AUTH_VNC_PASSWD 107 +#define IDD_LEGACY 108 +#define IDD_CONN_HOST 109 +#define IDD_SHARING 110 +#define IDD_INPUTS 111 +#define IDR_TRAY 112 +#define IDD_ABOUT 113 +#define IDI_CONNECTED 115 +#define IDD_DESKTOP 116 +#define IDC_EDIT1 1000 +#define IDC_PORT 1000 +#define IDC_PASSWORD1 1000 +#define IDC_HOST_PATTERN 1000 +#define IDC_AUTH_NONE 1002 +#define IDC_AUTH_VNC 1003 +#define IDC_AUTH_VNC_PASSWD 1009 +#define IDC_USEHOOKS 1011 +#define IDC_POLLCONSOLES 1012 +#define IDC_COMPAREFB 1013 +#define IDC_IDLE_TIMEOUT 1015 +#define IDC_HOSTS 1016 +#define IDC_HOST_ADD 1017 +#define IDC_HOST_REMOVE 1018 +#define IDC_HOST_UP 1019 +#define IDC_BUTTON4 1020 +#define IDC_HOST_DOWN 1020 +#define IDC_AUTH_INPUTONLY_PASSWD 1020 +#define IDC_HOST_EDIT 1021 +#define IDC_PASSWORD2 1022 +#define IDC_LEGACY_IMPORT 1023 +#define IDC_ALLOW 1024 +#define IDC_DENY 1025 +#define IDC_SHARE_ALWAYS 1030 +#define IDC_SHARE_NEVER 1031 +#define IDC_SHARE_CLIENT 1032 +#define IDC_DISCONNECT_CLIENTS 1033 +#define IDC_ACCEPT_KEYS 1034 +#define IDC_ACCEPT_PTR 1035 +#define IDC_ACCEPT_CUTTEXT 1036 +#define IDC_SEND_CUTTEXT 1037 +#define IDC_PROTOCOL_3_3 1038 +#define IDC_DESCRIPTION 1039 +#define IDC_BUILDTIME 1040 +#define IDC_VERSION 1041 +#define IDC_COPYRIGHT 1042 +#define IDC_HTTP_ENABLE 1043 +#define IDC_HTTP_PORT 1044 +#define IDC_BL_THRESHOLD 1046 +#define IDC_BL_TIMEOUT 1047 +#define IDC_AFFECT_SCREENSAVER 1048 +#define IDC_LOCALHOST 1049 +#define IDC_DISABLE_LOCAL_INPUTS 1050 +#define IDC_AUTH_NT 1051 +#define IDC_AUTH_NT_CONF 1052 +#define IDC_AUTH_RA2_CONF 1053 +#define IDC_QUERY_CONNECT 1055 +#define IDC_DISCONNECT_NONE 1056 +#define IDC_DISCONNECT_LOCK 1057 +#define IDC_DISCONNECT_LOGOFF 1058 +#define IDC_REMOVE_WALLPAPER 1059 +#define IDC_REMOVE_PATTERN 1060 +#define IDC_DISABLE_EFFECTS 1061 +#define IDC_CAPTUREBLT 1062 +#define IDC_ENCRYPTION 1063 +#define IDC_QUERY 1064 +#define IDC_USEPOLLING 1066 +#define IDC_USEDRIVER 1068 +#define IDC_QUERY_LOGGED_ON 1069 +#define IDC_AUTH_ADMIN_PASSWD 1076 +#define IDC_AUTH_VIEWONLY_PASSWD 1077 +#define IDC_AUTH_ADMIN_ENABLE 1078 +#define IDC_AUTH_VIEWONLY_ENABLE 1079 +#define IDC_AUTH_INPUTONLY_ENABLE 1080 +#define IDC_AUTH_VNC_EXT 1081 +#define IDC_RFB_ENABLE 1082 +#define ID_OPTIONS 40001 +#define ID_CLOSE 40002 +#define ID_ABOUT 40003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 117 +#define _APS_NEXT_COMMAND_VALUE 40004 +#define _APS_NEXT_CONTROL_VALUE 1083 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx new file mode 100644 index 00000000..6c9e1c5a --- /dev/null +++ b/win/vncconfig/vncconfig.cxx @@ -0,0 +1,191 @@ +/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * + * This 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 software 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 software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include <windows.h> +#include <commctrl.h> +#include <string.h> +#ifdef WIN32 +#define strcasecmp _stricmp +#endif + +#include "resource.h" +#include <rfb/Logger_stdio.h> +#include <rfb/LogWriter.h> +#include <rfb/SSecurityFactoryStandard.h> +#include <rfb_win32/Dialog.h> +#include <rfb_win32/RegConfig.h> +#include <rfb_win32/CurrentUser.h> + +using namespace rfb; +using namespace rfb::win32; + +static LogWriter vlog("main"); + + +#include <vncconfig/Authentication.h> +#include <vncconfig/Connections.h> +#include <vncconfig/Sharing.h> +#include <vncconfig/Hooking.h> +#include <vncconfig/Inputs.h> +#include <vncconfig/Legacy.h> +#include <vncconfig/Desktop.h> + + +TStr rfb::win32::AppName("VNC Config"); + + +#ifdef _DEBUG +BoolParameter captureDialogs("CaptureDialogs", "", false); +#endif + +HKEY configKey = HKEY_CURRENT_USER; + + +void +processParams(int argc, char* argv[]) { + for (int i=1; i<argc; i++) { + if (strcasecmp(argv[i], "-service") == 0) { + configKey = HKEY_LOCAL_MACHINE; + } else if (strcasecmp(argv[i], "-user") == 0) { + configKey = HKEY_CURRENT_USER; + } else { + // Try to process <option>=<value>, or -<bool> + if (Configuration::setParam(argv[i], true)) + continue; + // Try to process -<option> <value> + if ((argv[i][0] == '-') && (i+1 < argc)) { + if (Configuration::setParam(&argv[i][1], argv[i+1], true)) { + i++; + continue; + } + } + } + } +} + + +int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, char* cmdLine, int cmdShow) { + + // Configure debugging output +#ifdef _DEBUG + AllocConsole(); + freopen("CONIN$","rb",stdin); + freopen("CONOUT$","wb",stdout); + freopen("CONOUT$","wb",stderr); + setbuf(stderr, 0); + initStdIOLoggers(); + LogWriter vlog("main"); + logParams.setParam("*:stderr:100"); + vlog.info("Starting vncconfig applet"); +#endif + + try { + try { + // Process command-line args + int argc = __argc; + char** argv = __argv; + processParams(argc, argv); + + /* *** Required if we wish to use IP address control + INITCOMMONCONTROLSEX icce; + icce.dwSize = sizeof(icce); + icce.dwICC = ICC_INTERNET_CLASSES; + InitCommonControlsEx(&icce); + */ + + // Create the required configuration registry key + RegKey rootKey; + rootKey.createKey(configKey, _T("Software\\TightVNC\\WinVNC4")); + + // Override whatever security it already had (NT only) + bool warnOnChangePassword = false; + try { + AccessEntries access; + Sid::Administrators adminSID; + Sid::SYSTEM systemSID; + access.addEntry(adminSID, KEY_ALL_ACCESS, GRANT_ACCESS); + access.addEntry(systemSID, KEY_ALL_ACCESS, GRANT_ACCESS); + UserSID userSID; + if (configKey == HKEY_CURRENT_USER) + access.addEntry(userSID, KEY_ALL_ACCESS, GRANT_ACCESS); + AccessControlList acl(CreateACL(access)); + + // Set the DACL, and don't allow the key to inherit its parent's DACL + rootKey.setDACL(acl, false); + } catch (rdr::SystemException& e) { + // Something weird happens on NT 4.0 SP5 but I can't reproduce it on other + // NT 4.0 service pack revisions. + if (e.err == ERROR_INVALID_PARAMETER) { + MsgBox(0, _T("Windows reported an error trying to secure the VNC Server settings for this user. ") + _T("Your settings may not be secure!"), MB_ICONWARNING | MB_OK); + } else if (e.err != ERROR_CALL_NOT_IMPLEMENTED && + e.err != ERROR_NOT_LOGGED_ON) { + // If the call is not implemented, ignore the error and continue + // If we are on Win9x and no user is logged on, ignore error and continue + throw; + } + warnOnChangePassword = true; + } + + // Start a RegConfig thread, to load in existing settings + RegConfigThread config; + config.start(configKey, _T("Software\\TightVNC\\WinVNC4")); + + // Build the dialog + std::list<PropSheetPage*> pages; + AuthenticationPage auth(rootKey); pages.push_back(&auth); + auth.setWarnPasswdInsecure(warnOnChangePassword); + ConnectionsPage conn(rootKey); pages.push_back(&conn); + InputsPage inputs(rootKey); pages.push_back(&inputs); + SharingPage sharing(rootKey); pages.push_back(&sharing); + DesktopPage desktop(rootKey); pages.push_back(&desktop); + HookingPage hooks(rootKey); pages.push_back(&hooks); + LegacyPage legacy(rootKey, configKey == HKEY_CURRENT_USER); pages.push_back(&legacy); + + // Load the default icon to use + HICON icon = (HICON)LoadImage(inst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_SHARED); + + // Create the PropertySheet handler + TCHAR* propSheetTitle = _T("VNC Server Properties (Service-Mode)"); + if (configKey == HKEY_CURRENT_USER) + propSheetTitle = _T("VNC Server Properties (User-Mode)"); + PropSheet sheet(inst, propSheetTitle, pages, icon); + +#ifdef _DEBUG + vlog.debug("capture dialogs=%s", captureDialogs ? "true" : "false"); + sheet.showPropSheet(0, true, false, captureDialogs); +#else + sheet.showPropSheet(0, true, false); +#endif + } catch (rdr::SystemException& e) { + switch (e.err) { + case ERROR_ACCESS_DENIED: + MsgBox(0, _T("You do not have sufficient access rights to run the VNC Configuration applet"), + MB_ICONSTOP | MB_OK); + return 1; + }; + throw; + } + + } catch (rdr::Exception& e) { + MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK); + return 1; + } + + return 0; +} diff --git a/win/vncconfig/vncconfig.dsp b/win/vncconfig/vncconfig.dsp new file mode 100644 index 00000000..b096ded0 --- /dev/null +++ b/win/vncconfig/vncconfig.dsp @@ -0,0 +1,196 @@ +# Microsoft Developer Studio Project File - Name="vncconfig" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=vncconfig - Win32 Debug Unicode
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "vncconfig.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "vncconfig.mak" CFG="vncconfig - Win32 Debug Unicode"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "vncconfig - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "vncconfig - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "vncconfig - Win32 Debug Unicode" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "vncconfig - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "..\Release\vncconfig"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../../common" /FI"rdr/msvcwarning.h" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "_MBCS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 user32.lib gdi32.lib advapi32.lib version.lib shell32.lib comctl32.lib ws2_32.lib ole32.lib /nologo /subsystem:windows /machine:I386
+
+!ELSEIF "$(CFG)" == "vncconfig - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "vncconfig___Win32_Debug"
+# PROP BASE Intermediate_Dir "vncconfig___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug"
+# PROP Intermediate_Dir "..\Debug\vncconfig"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "../../common" /FI"rdr/msvcwarning.h" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib gdi32.lib advapi32.lib version.lib shell32.lib comctl32.lib ws2_32.lib ole32.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "vncconfig - Win32 Debug Unicode"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "vncconfig___Win32_Debug_Unicode"
+# PROP BASE Intermediate_Dir "vncconfig___Win32_Debug_Unicode"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug_Unicode"
+# PROP Intermediate_Dir "..\Debug_Unicode\vncconfig"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "../../common" /FI"rdr/msvcwarning.h" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_UNICODE" /D "UNICODE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib version.lib shell32.lib comctl32.lib ws2_32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib gdi32.lib advapi32.lib version.lib shell32.lib comctl32.lib ws2_32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "vncconfig - Win32 Release"
+# Name "vncconfig - Win32 Debug"
+# Name "vncconfig - Win32 Debug Unicode"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Legacy.cxx
+# End Source File
+# Begin Source File
+
+SOURCE=.\PasswordDialog.cxx
+# End Source File
+# Begin Source File
+
+SOURCE=.\vncconfig.cxx
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Authentication.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Connections.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Desktop.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hooking.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Inputs.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Legacy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PasswordDialog.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Sharing.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\connected.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\vncconfig.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\vncconfig.rc
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\vncconfig.exe.manifest
+# End Source File
+# End Target
+# End Project
diff --git a/win/vncconfig/vncconfig.exe.manifest b/win/vncconfig/vncconfig.exe.manifest new file mode 100644 index 00000000..77cb1b9a --- /dev/null +++ b/win/vncconfig/vncconfig.exe.manifest @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity + version="4.0.0.26" + processorArchitecture="X86" + name="TightVNC.vncconfig.exe" + type="win32" +/> +<description>.NET control deployment tool</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="X86" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> +</dependency> +</assembly> diff --git a/win/vncconfig/vncconfig.ico b/win/vncconfig/vncconfig.ico Binary files differnew file mode 100644 index 00000000..1b42416c --- /dev/null +++ b/win/vncconfig/vncconfig.ico diff --git a/win/vncconfig/vncconfig.rc b/win/vncconfig/vncconfig.rc new file mode 100644 index 00000000..bf2f9696 --- /dev/null +++ b/win/vncconfig/vncconfig.rc @@ -0,0 +1,496 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON DISCARDABLE "vncconfig.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_AUTHENTICATION DIALOG DISCARDABLE 0, 0, 193, 135 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Authentication" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "No Authentication",IDC_AUTH_NONE,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,7,10,113,15 + CONTROL "VNC Password Authentication",IDC_AUTH_VNC,"Button", + BS_AUTORADIOBUTTON,7,30,113,15 + PUSHBUTTON "Configure",IDC_AUTH_VNC_PASSWD,125,30,61,15 + CONTROL "NT Logon Authentication",IDC_AUTH_NT,"Button", + BS_AUTORADIOBUTTON,7,50,113,15 + PUSHBUTTON "Configure",IDC_AUTH_NT_CONF,125,50,61,15 + LTEXT "Encryption:",IDC_STATIC,7,70,42,15,SS_CENTERIMAGE + COMBOBOX IDC_ENCRYPTION,49,70,71,50,CBS_DROPDOWN | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "Generate Keys",IDC_AUTH_RA2_CONF,125,70,61,15 + CONTROL "Prompt local user to accept connections", + IDC_QUERY_CONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 7,95,181,15 + CONTROL "Only prompt when there is a user logged on", + IDC_QUERY_LOGGED_ON,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,20,110,166,15 +END + +IDD_CONNECTIONS DIALOG DISCARDABLE 0, 0, 218, 198 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Connections" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Accept connections on port:",IDC_RFB_ENABLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,10,138,15 + EDITTEXT IDC_PORT,150,10,61,15,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Disconnect idle clients after (seconds):",IDC_STATIC,7, + 25,138,15,SS_CENTERIMAGE + EDITTEXT IDC_IDLE_TIMEOUT,150,25,61,15,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Serve Java viewer via HTTP on port:",IDC_HTTP_ENABLE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,40,138,15 + EDITTEXT IDC_HTTP_PORT,150,40,61,15,ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Access Control",IDC_STATIC,7,55,204,135 + CONTROL "Only accept connections from the local machine", + IDC_LOCALHOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15, + 70,190,15 + LISTBOX IDC_HOSTS,15,90,130,95,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "&Add",IDC_HOST_ADD,150,90,55,15 + PUSHBUTTON "&Remove",IDC_HOST_REMOVE,150,110,55,15 + PUSHBUTTON "Move Up",IDC_HOST_UP,150,130,55,15 + PUSHBUTTON "Move Down",IDC_HOST_DOWN,150,150,55,15 + PUSHBUTTON "&Edit",IDC_HOST_EDIT,150,170,55,15 +END + +IDD_HOOKING DIALOG DISCARDABLE 0, 0, 197, 101 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Capture Method" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Poll for changes to the desktop",IDC_USEPOLLING,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,7,10,183,15 + CONTROL "Use VNC hooks to track changes",IDC_USEHOOKS,"Button", + BS_AUTORADIOBUTTON,7,25,183,15 + CONTROL "Poll console windows for updates",IDC_POLLCONSOLES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,40,165,15 + CONTROL "Use VNC Mirror driver to track changes",IDC_USEDRIVER, + "Button",BS_AUTORADIOBUTTON,7,55,183,15 + CONTROL "Capture alpha-blended windows",IDC_CAPTUREBLT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,70,183,15 +END + +IDD_AUTH_VNC_PASSWD DIALOG DISCARDABLE 0, 0, 212, 70 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "VNC Server Password" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "New Password:",IDC_STATIC,7,10,63,15 + EDITTEXT IDC_PASSWORD1,75,10,130,15,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Confirm Password:",IDC_STATIC,7,30,63,14 + EDITTEXT IDC_PASSWORD2,75,30,130,14,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,100,50,50,15 + PUSHBUTTON "Cancel",IDCANCEL,155,50,50,15 +END + +IDD_LEGACY DIALOG DISCARDABLE 0, 0, 166, 92 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Legacy" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Import VNC 3.3 Settings",IDC_LEGACY_IMPORT,7,10,92,20 + CONTROL "Only use protocol version 3.3",IDC_PROTOCOL_3_3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,35,152,15 +END + +IDD_CONN_HOST DIALOG DISCARDABLE 0, 0, 225, 57 +STYLE DS_SYSMODAL | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +CAPTION "Specify Host IP Address Pattern" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_HOST_PATTERN,65,5,100,15,ES_AUTOHSCROLL + CONTROL "&Allow",IDC_ALLOW,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,7,5,53,15 + CONTROL "&Deny",IDC_DENY,"Button",BS_AUTORADIOBUTTON,7,20,53,15 + CONTROL "Query",IDC_QUERY,"Button",BS_AUTORADIOBUTTON,7,35,53,15 + DEFPUSHBUTTON "OK",IDOK,115,35,50,15 + PUSHBUTTON "Cancel",IDCANCEL,170,35,50,15 + LTEXT "e.g. 192.168.0.0/255.255.0.0",IDC_STATIC,65,20,100,15 +END + +IDD_SHARING DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Sharing" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Always treat new connections as shared", + IDC_SHARE_ALWAYS,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 7,10,172,15 + CONTROL "Never treat new connections as shared",IDC_SHARE_NEVER, + "Button",BS_AUTORADIOBUTTON,7,25,172,15 + CONTROL "Use client's preferred sharing setting", + IDC_SHARE_CLIENT,"Button",BS_AUTORADIOBUTTON,7,40,172,15 + CONTROL "Non-shared connections replace existing ones", + IDC_DISCONNECT_CLIENTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,55,172,15 +END + +IDD_INPUTS DIALOG DISCARDABLE 0, 0, 186, 119 +STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Inputs" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Accept pointer events from clients",IDC_ACCEPT_PTR, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,10,172,15 + CONTROL "Accept keyboard events from clients",IDC_ACCEPT_KEYS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,25,172,15 + CONTROL "Accept clipboard updates from clients", + IDC_ACCEPT_CUTTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 7,40,172,15 + CONTROL "Send clipboard updates to clients",IDC_SEND_CUTTEXT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,55,172,15 + CONTROL "Allow input events to affect the screen-saver", + IDC_AFFECT_SCREENSAVER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,70,172,15 + CONTROL "Disable local inputs while server is in use", + IDC_DISABLE_LOCAL_INPUTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,95,172,15 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 249, 92 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "About VNC Config for Windows" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,195,70,47,15 + ICON IDI_ICON,IDC_STATIC,7,7,20,20 + LTEXT ">appname<",IDC_DESCRIPTION,40,7,125,18 + LTEXT ">version<",IDC_VERSION,165,7,77,18 + LTEXT ">buildtime<",IDC_BUILDTIME,40,25,202,15 + LTEXT ">copyright<",IDC_COPYRIGHT,40,40,202,15 + LTEXT "See http://www.tightvnc.com for more information on TightVNC.", + IDC_STATIC,40,55,202,15 +END + +IDD_DESKTOP DIALOG DISCARDABLE 0, 0, 185, 137 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CONTROL | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Desktop" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "While connected",IDC_STATIC,7,5,171,60 + CONTROL "Remove wallpaper",IDC_REMOVE_WALLPAPER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,15,155,15 + CONTROL "Remove background pattern",IDC_REMOVE_PATTERN,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,30,155,15 + CONTROL "Disable user interface effects",IDC_DISABLE_EFFECTS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,46,155,14 + GROUPBOX "When last client disconnects",IDC_STATIC,7,70,171,60 + CONTROL "Do nothing",IDC_DISCONNECT_NONE,"Button", + BS_AUTORADIOBUTTON,15,80,155,15 + CONTROL "Lock workstation",IDC_DISCONNECT_LOCK,"Button", + BS_AUTORADIOBUTTON,15,95,155,15 + CONTROL "Logoff user",IDC_DISCONNECT_LOGOFF,"Button", + BS_AUTORADIOBUTTON,15,110,155,15 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_AUTHENTICATION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 186 + VERTGUIDE, 20 + VERTGUIDE, 49 + VERTGUIDE, 120 + VERTGUIDE, 125 + TOPMARGIN, 7 + BOTTOMMARGIN, 128 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 30 + HORZGUIDE, 45 + HORZGUIDE, 50 + HORZGUIDE, 65 + HORZGUIDE, 70 + HORZGUIDE, 85 + HORZGUIDE, 90 + HORZGUIDE, 105 + HORZGUIDE, 110 + HORZGUIDE, 125 + END + + IDD_CONNECTIONS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 211 + VERTGUIDE, 15 + VERTGUIDE, 145 + VERTGUIDE, 150 + VERTGUIDE, 205 + TOPMARGIN, 7 + BOTTOMMARGIN, 191 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 40 + HORZGUIDE, 55 + HORZGUIDE, 70 + HORZGUIDE, 85 + HORZGUIDE, 90 + HORZGUIDE, 105 + HORZGUIDE, 110 + HORZGUIDE, 125 + HORZGUIDE, 130 + HORZGUIDE, 145 + HORZGUIDE, 150 + HORZGUIDE, 165 + HORZGUIDE, 170 + HORZGUIDE, 185 + HORZGUIDE, 190 + END + + IDD_HOOKING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 190 + VERTGUIDE, 25 + TOPMARGIN, 7 + BOTTOMMARGIN, 94 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 40 + HORZGUIDE, 55 + HORZGUIDE, 70 + HORZGUIDE, 85 + END + + IDD_AUTH_VNC_PASSWD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 205 + VERTGUIDE, 70 + VERTGUIDE, 75 + VERTGUIDE, 90 + VERTGUIDE, 100 + VERTGUIDE, 150 + VERTGUIDE, 155 + VERTGUIDE, 205 + TOPMARGIN, 7 + BOTTOMMARGIN, 65 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 30 + HORZGUIDE, 44 + HORZGUIDE, 50 + HORZGUIDE, 65 + END + + IDD_LEGACY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 159 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + HORZGUIDE, 10 + HORZGUIDE, 30 + HORZGUIDE, 35 + HORZGUIDE, 50 + END + + IDD_CONN_HOST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 220 + VERTGUIDE, 60 + VERTGUIDE, 65 + VERTGUIDE, 115 + VERTGUIDE, 165 + VERTGUIDE, 170 + TOPMARGIN, 5 + BOTTOMMARGIN, 50 + HORZGUIDE, 20 + HORZGUIDE, 35 + END + + IDD_SHARING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 40 + HORZGUIDE, 55 + HORZGUIDE, 70 + END + + IDD_INPUTS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 112 + HORZGUIDE, 10 + HORZGUIDE, 25 + HORZGUIDE, 40 + HORZGUIDE, 55 + HORZGUIDE, 70 + HORZGUIDE, 85 + HORZGUIDE, 95 + HORZGUIDE, 110 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 242 + VERTGUIDE, 40 + VERTGUIDE, 165 + VERTGUIDE, 195 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + HORZGUIDE, 7 + HORZGUIDE, 25 + HORZGUIDE, 40 + HORZGUIDE, 55 + HORZGUIDE, 70 + END + + IDD_DESKTOP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 182 + TOPMARGIN, 7 + BOTTOMMARGIN, 32 + END +END +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 4,1,1,0 + PRODUCTVERSION 4,1,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Constantin Kaplinsky\0" + VALUE "FileDescription", "TightVNC Server Configuration Applet for Win32\0" + VALUE "FileVersion", "4.1.1\0" + VALUE "InternalName", "vncconfig\0" + VALUE "LegalCopyright", "Copyright (C) 1998-2005 [many holders]\0" + VALUE "LegalTrademarks", "TightVNC\0" + VALUE "OriginalFilename", "vncconfig.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "TightVNC Configurator\0" + VALUE "ProductVersion", "4.1.1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// 24 +// + +IDR_MANIFEST 24 DISCARDABLE "vncconfig.exe.manifest" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + |