]> source.dussan.org Git - tigervnc.git/commitdiff
WinVNC merged with VNC 4.1.1 code.
authorConstantin Kaplinsky <const@tightvnc.com>
Thu, 11 May 2006 10:30:11 +0000 (10:30 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Thu, 11 May 2006 10:30:11 +0000 (10:30 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/merge-with-vnc-4.1.1@550 3789f03b-4d11-0410-bbf8-ca57d06f2519

20 files changed:
winvnc/AddNewClientDialog.h
winvnc/JavaViewer.cxx
winvnc/JavaViewer.h
winvnc/ManagedListener.cxx [new file with mode: 0644]
winvnc/ManagedListener.h [new file with mode: 0644]
winvnc/QueryConnectDialog.cxx
winvnc/QueryConnectDialog.h
winvnc/STrayIcon.cxx
winvnc/STrayIcon.h
winvnc/VNCServerService.cxx
winvnc/VNCServerService.h
winvnc/VNCServerWin32.cxx
winvnc/VNCServerWin32.h
winvnc/buildTime.cxx
winvnc/msvcwarning.h [deleted file]
winvnc/resource.h
winvnc/winvnc.bmp [new file with mode: 0644]
winvnc/winvnc.cxx
winvnc/winvnc.dsp
winvnc/winvnc.rc

index d8e0af36eac49516937c8b72f36346ed370087ec..9bf51355961d48b2b4fdbf81e56e5fc44debf9d0 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
index fecbcee0f6f62da0dc774f96d2dcc28480807cf5..15c05c4697369127eb432bc71bcd8a3e99c993af 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -16,7 +16,6 @@
  * USA.
  */
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winvnc/JavaViewer.h>
 #include <winvnc/resource.h>
@@ -39,7 +38,11 @@ JavaViewerServer::JavaViewerServer(rfb::VNCServerST* svr) : server(svr) {
 JavaViewerServer::~JavaViewerServer() {
 }
 
-rdr::InStream* JavaViewerServer::getFile(const char* name, const char** contentType) {
+rdr::InStream* JavaViewerServer::getFile(const char* name,
+                                         const char** contentType,
+                                         int* contentLength,
+                                         time_t* lastModified)
+{
   if (strcmp(name, "/") == 0)
     name = "/index.vnc";
 
index 20af786bdb8fd19a170b43dbe22e2a738265cf0f..ecda4d3e8b1ecd862eff068a5f337afd77d035d9 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -35,7 +35,8 @@ namespace winvnc {
     JavaViewerServer(rfb::VNCServerST* desktop);
     virtual ~JavaViewerServer();
 
-    virtual rdr::InStream* getFile(const char* name, const char** contentType);
+    virtual rdr::InStream* getFile(const char* name, const char** contentType,
+                                   int* contentLength, time_t* lastModified);
 
     // rdr::Substitutor callback
     virtual char* substitute(const char* varName);
diff --git a/winvnc/ManagedListener.cxx b/winvnc/ManagedListener.cxx
new file mode 100644 (file)
index 0000000..9bf1b9a
--- /dev/null
@@ -0,0 +1,94 @@
+/* Copyright (C) 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 <winvnc/ManagedListener.h>
+#include <rfb/LogWriter.h>
+
+using namespace winvnc;
+using namespace rfb;
+using namespace win32;
+
+static LogWriter vlog("ManagedListener");
+
+
+ManagedListener::ManagedListener(SocketManager* mgr)
+: sock(0), filter(0), manager(mgr), addrChangeNotifier(0), server(0), port(0), localOnly(false) {
+}
+
+ManagedListener::~ManagedListener() {
+  if (sock)
+    manager->remListener(sock);
+  delete filter;
+}
+
+
+void ManagedListener::setServer(network::SocketServer* svr) {
+  if (svr == server)
+    return;
+  vlog.info("set server to %p", svr);
+  server = svr;
+  refresh();
+}
+
+void ManagedListener::setPort(int port_, bool localOnly_) {
+  if ((port_ == port) && (localOnly == localOnly_))
+    return;
+  vlog.info("set port to %d", port_);
+  port = port_;
+  localOnly = localOnly_;
+  refresh();
+}
+
+void ManagedListener::setFilter(const char* filterStr) {
+  vlog.info("set filter to %s", filterStr);
+  delete filter;
+  filter = new network::TcpFilter(filterStr);
+  if (sock && !localOnly)
+    sock->setFilter(filter);
+}
+
+void ManagedListener::setAddressChangeNotifier(SocketManager::AddressChangeNotifier* acn) {
+  if (acn == addrChangeNotifier)
+    return;
+  addrChangeNotifier = acn;
+  refresh();
+}
+
+
+void ManagedListener::refresh() {
+  if (sock)
+    manager->remListener(sock);
+  sock = 0;
+  if (!server)
+    return;
+  try {
+    if (port)
+      sock = new network::TcpListener(port, localOnly);
+  } catch (rdr::Exception& e) {
+    vlog.error(e.str());
+  }
+  if (sock) {
+    if (!localOnly)
+      sock->setFilter(filter);
+    try {
+      manager->addListener(sock, server, addrChangeNotifier);
+    } catch (...) {
+      sock = 0;
+      throw;
+    }
+  }
+}
diff --git a/winvnc/ManagedListener.h b/winvnc/ManagedListener.h
new file mode 100644 (file)
index 0000000..e83aa0b
--- /dev/null
@@ -0,0 +1,57 @@
+/* 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 __VNCSERVER_MANAGED_LISTENER_H__
+#define __VNCSERVER_MANAGED_LISTENER_H__
+
+#include <winsock2.h>
+#include <network/TcpSocket.h>
+#include <rfb_win32/SocketManager.h>
+
+namespace winvnc {
+
+  // -=- ManagedListener
+  //     Wrapper class which simplifies the management of a listening socket
+  //     on a specified port, attached to a SocketManager and SocketServer.
+  //     Reopens sockets & reconfigures filters & callbacks as appropriate.
+  //     Handles addition/removal of Listeners from SocketManager internally.
+
+  class ManagedListener {
+  public:
+    ManagedListener(rfb::win32::SocketManager* mgr);
+    ~ManagedListener();
+    
+    void setServer(network::SocketServer* svr);
+    void setPort(int port, bool localOnly=false);
+    void setFilter(const char* filter);
+    void setAddressChangeNotifier(rfb::win32::SocketManager::AddressChangeNotifier* acn);
+  
+    network::TcpListener* sock;
+  protected:
+    void refresh();
+    network::TcpFilter* filter;
+    rfb::win32::SocketManager* manager;
+    rfb::win32::SocketManager::AddressChangeNotifier* addrChangeNotifier;
+    network::SocketServer* server;
+    int port;
+    bool localOnly;
+  };
+
+};
+
+#endif
index 52d7249d0add98afea19f55f6fc28b504bdc65bc..dc50eab3b9925e14f154ff24b09177490da6ea86 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
index 30dd2705d0d003786cef1be474332129f1ad8388..b28de19866fed0f7c1cccb1dd3347ba8d57da819 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
index 229f1ce51ea1476a71eb6db6f593db698b42b326..0b10fa5b61c650c4f0e2224fee846a566fa1789e 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -19,6 +19,7 @@
 // -=- WinVNC Version 4.0 Tray Icon implementation
 
 #include <winvnc/STrayIcon.h>
+#include <winvnc/VNCServerService.h>
 #include <winvnc/resource.h>
 
 #include <rfb/LogWriter.h>
@@ -26,7 +27,7 @@
 #include <rfb_win32/LaunchProcess.h>
 #include <rfb_win32/TrayIcon.h>
 #include <rfb_win32/AboutDialog.h>
-#include <rfb_win32/Win32Util.h>
+#include <rfb_win32/MsgBox.h>
 #include <rfb_win32/Service.h>
 #include <rfb_win32/CurrentUser.h>
 #include <winvnc/ControlPanel.h>
@@ -38,6 +39,7 @@ using namespace winvnc;
 static LogWriter vlog("STrayIcon");
 
 BoolParameter STrayIconThread::disableOptions("DisableOptions", "Disable the Options entry in the VNC Server tray menu.", false);
+BoolParameter STrayIconThread::disableClose("DisableClose", "Disable the Close entry in the VNC Server tray menu.", false);
 
 
 //
@@ -62,7 +64,7 @@ class winvnc::STrayIcon : public TrayIcon {
 public:
   STrayIcon(STrayIconThread& t) : thread(t),
     vncConfig(_T("vncconfig.exe"), isServiceProcess() ? _T("-noconsole -service") : _T("-noconsole")),
-    vncConnect(_T("winvnc4.exe"), _T("-connect")) {
+    vncConnect(_T("winvnc4.exe"), _T("-noconsole -connect")) {
 
     // ***
     SetWindowText(getHandle(), _T("winvnc::IPC_Interface"));
@@ -79,8 +81,9 @@ public:
 
     case WM_USER:
       {
-        bool userKnown = CurrentUserToken().isValid();
+        bool userKnown = CurrentUserToken().canImpersonate();
         bool allowOptions = !STrayIconThread::disableOptions && userKnown;
+        bool allowClose = !STrayIconThread::disableClose && userKnown;
 
         switch (lParam) {
         case WM_LBUTTONDBLCLK:
@@ -97,7 +100,7 @@ public:
           // Enable/disable options as required
           EnableMenuItem(trayMenu, ID_OPTIONS, (!allowOptions ? MF_GRAYED : MF_ENABLED) | MF_BYCOMMAND);
           EnableMenuItem(trayMenu, ID_CONNECT, (!userKnown ? MF_GRAYED : MF_ENABLED) | MF_BYCOMMAND);
-          EnableMenuItem(trayMenu, ID_CLOSE, (isServiceProcess() ? MF_GRAYED : MF_ENABLED) | MF_BYCOMMAND);
+          EnableMenuItem(trayMenu, ID_CLOSE, (!allowClose ? MF_GRAYED : MF_ENABLED) | MF_BYCOMMAND);
 
           thread.server.getClientsInfo(&LCInfo);
           CheckMenuItem(trayMenu, ID_DISABLE_NEW_CLIENTS, (LCInfo.getDisable() ? MF_CHECKED : MF_UNCHECKED) | MF_BYCOMMAND);
@@ -134,8 +137,8 @@ public:
       case ID_OPTIONS:
         {
           CurrentUserToken token;
-          if (token.isValid())
-            vncConfig.start(isServiceProcess() ? (HANDLE)token : 0);
+          if (token.canImpersonate())
+            vncConfig.start(isServiceProcess() ? (HANDLE)token : INVALID_HANDLE_VALUE);
           else
             vlog.error("Options: unknown current user");
         }
@@ -143,8 +146,8 @@ public:
       case ID_CONNECT:
         {
           CurrentUserToken token;
-          if (token.isValid())
-            vncConnect.start(isServiceProcess() ? (HANDLE)token : 0);
+          if (token.canImpersonate())
+            vncConnect.start(isServiceProcess() ? (HANDLE)token : INVALID_HANDLE_VALUE);
           else
             vlog.error("Options: unknown current user");
         }
@@ -153,8 +156,19 @@ public:
         thread.server.disconnectClients("tray menu disconnect");
         break;
       case ID_CLOSE:
-        if (!isServiceProcess())
-          thread.server.stop();
+        if (MsgBox(0, _T("Are you sure you want to close the server?"),
+                   MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
+          if (isServiceProcess()) {
+            ImpersonateCurrentUser icu;
+            try {
+              rfb::win32::stopService(VNCServerService::Name);
+            } catch (rdr::Exception& e) {
+              MsgBox(0, TStr(e.str()), MB_ICONERROR | MB_OK);
+            }
+          } else {
+            thread.server.stop();
+          }
+        }
         break;
       case ID_ABOUT:
         AboutDialog::instance.showDialog();
@@ -172,12 +186,10 @@ public:
             CharArray viewer = new char[command->cbData + 1];
             memcpy(viewer.buf, command->lpData, command->cbData);
             viewer.buf[command->cbData] = 0;
-            thread.server.addNewClient(viewer.buf);
+            return thread.server.addNewClient(viewer.buf) ? 1 : 0;
           }
-          break;
         case 2:
-          thread.server.disconnectClients("IPC disconnect");
-          break;
+          return thread.server.disconnectClients("IPC disconnect") ? 1 : 0;
         case 3:
           thread.server.setClientsStatus((rfb::ListConnInfo *)command->cbData);
         case 4:
@@ -231,7 +243,7 @@ protected:
 
 STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_, 
                                  UINT dis_inactiveIcon_, UINT dis_activeIcon_, UINT menu_)
-: server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_),
+: Thread("TrayIcon"), server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_),
   dis_inactiveIcon(dis_inactiveIcon_), dis_activeIcon(dis_activeIcon_),menu(menu_),
   windowHandle(0), runTrayIcon(true) {
   start();
index ef32eba648ff173e6b3b7d03ad29468174dfbf2a..309d3f4a4492e26bdb60bc37b959890dcdc4bdec 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -40,6 +40,7 @@ namespace winvnc {
     void setToolTip(const TCHAR* text);
 
     static rfb::BoolParameter disableOptions;
+    static rfb::BoolParameter disableClose;
 
     friend class STrayIcon;
   protected:
@@ -57,4 +58,4 @@ namespace winvnc {
 
 };
 
-#endif
\ No newline at end of file
+#endif
index c967a5a5ea1188f5bf2fff2c16a2d1783885e2a3..2ef2ee080ba827c9f8209db73a762027633b9f71 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
index 378ad0c5471a896209259eddde7b5e2103c95279..c7a76cce459e5532ae644de33f9610383caf38d0 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2003 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -31,9 +31,6 @@ namespace winvnc {
     DWORD serviceMain(int argc, TCHAR* argv[]);
     void stop();
 
-    void osShuttingDown() {}
-    void readParams() {}
-
     static const TCHAR* Name;
   protected:
     VNCServerWin32& server;
index 67b3ec51f35b32500d13a8462a7d67e2edf1919f..8d681c228b36d7a7eeb73da8480e8be3cca73d9b 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -21,8 +21,8 @@
 #include <winvnc/VNCServerWin32.h>
 #include <winvnc/resource.h>
 #include <winvnc/STrayIcon.h>
-
-#include <rfb_win32/Win32Util.h>
+#include <rfb_win32/ComputerName.h>
+#include <rfb_win32/CurrentUser.h>
 #include <rfb_win32/Service.h>
 #include <rfb/SSecurityFactoryStandard.h>
 #include <rfb/Hostname.h>
@@ -38,90 +38,28 @@ static LogWriter vlog("VNCServerWin32");
 
 const TCHAR* winvnc::VNCServerWin32::RegConfigPath = _T("Software\\TightVNC\\WinVNC4");
 
-const UINT VNCM_REG_CHANGED = WM_USER;
-const UINT VNCM_COMMAND = WM_USER + 1;
-
 
 static IntParameter http_port("HTTPPortNumber",
   "TCP/IP port on which the server will serve the Java applet VNC Viewer ", 5800);
 static IntParameter port_number("PortNumber",
   "TCP/IP port on which the server will accept connections", 5900);
 static StringParameter hosts("Hosts",
-  "Filter describing which hosts are allowed access to this server", "+");
-static VncAuthPasswdConfigParameter vncAuthPasswd;
+  "Filter describing which hosts are allowed access to this server", "+0.0.0.0/0.0.0.0");
 static BoolParameter localHost("LocalHost",
   "Only accept connections from via the local loop-back network interface", false);
-
-
-// -=- ManagedListener
-//     Wrapper class which simplifies the management of a listening socket
-//     on a specified port, attached to a SocketManager and SocketServer.
-//     Ensures that socket and filter are deleted and updated appropriately.
-
-class ManagedListener {
-public:
-  ManagedListener(win32::SocketManager* mgr, SocketServer* svr)
-    : sock(0), filter(0), port(0), manager(mgr),
-      server(svr), localOnly(0) {}
-  ~ManagedListener() {setPort(0);}
-  void setPort(int port, bool localOnly=false);
-  void setFilter(const char* filter);
-  TcpListener* sock;
-protected:
-  TcpFilter* filter;
-  win32::SocketManager* manager;
-  SocketServer* server;
-  int port;
-  bool localOnly;
-};
-
-// - If the port number/localHost setting has changed then tell the
-//   SocketManager to shutdown and delete it.  Also remove &
-//   delete the filter.  Then try to open a socket on the new port.
-void ManagedListener::setPort(int newPort, bool newLocalOnly) {
-  if ((port == newPort) && (localOnly == newLocalOnly) && sock) return;
-  if (sock) {
-    vlog.info("Closed TcpListener on port %d", port);
-    sock->setFilter(0);
-    delete filter;
-    manager->remListener(sock);
-    sock = 0;
-    filter = 0;
-  }
-  port = newPort;
-  localOnly = newLocalOnly;
-  if (port != 0) {
-    try {
-      sock = new TcpListener(port, localOnly);
-      vlog.info("Created TcpListener on port %d%s", port,
-                localOnly ? "(localhost)" : "(any)");
-    } catch (rdr::Exception& e) {
-      vlog.error("TcpListener on port %d failed (%s)", port, e.str());
-    }
-  }
-  if (sock)
-    manager->addListener(sock, server);
-}
-
-void ManagedListener::setFilter(const char* newFilter) {
-  if (!sock) return;
-  vlog.info("Updating TcpListener filter");
-  sock->setFilter(0);
-  delete filter;
-  filter = new TcpFilter(newFilter);
-  sock->setFilter(filter);
-}
+static BoolParameter queryOnlyIfLoggedOn("QueryOnlyIfLoggedOn",
+  "Only prompt for a local user to accept incoming connections if there is a user logged on", false);
 
 
 VNCServerWin32::VNCServerWin32()
-  : vncServer(CStr(ComputerName().buf), &desktop),
-    httpServer(0), runServer(false),
-    isDesktopStarted(false),
-    command(NoCommand), commandSig(commandLock),
-    queryConnectDialog(0) {
-  // Create the Java-viewer HTTP server
-  httpServer = new JavaViewerServer(&vncServer);
-
+  : command(NoCommand), commandSig(commandLock),
+    commandEvent(CreateEvent(0, TRUE, FALSE, 0)),
+    vncServer(CStr(ComputerName().buf), &desktop),
+    hostThread(0), runServer(false), isDesktopStarted(false),
+    httpServer(&vncServer), config(&sockMgr), trayIcon(0),
+    rfbSock(&sockMgr), httpSock(&sockMgr),
+    queryConnectDialog(0)
+{
   // Initialise the desktop
   desktop.setStatusLocation(&isDesktopStarted);
 
@@ -130,14 +68,78 @@ VNCServerWin32::VNCServerWin32()
 
   // Register the desktop's event to be handled
   sockMgr.addEvent(desktop.getUpdateEvent(), &desktop);
+
+  // Register the queued command event to be handled
+  sockMgr.addEvent(commandEvent, this);
 }
 
 VNCServerWin32::~VNCServerWin32() {
+  delete trayIcon;
+
   // Stop the SDisplay from updating our state
   desktop.setStatusLocation(0);
 
-  // Destroy the HTTP server
-  delete httpServer;
+  // Join the Accept/Reject dialog thread
+  if (queryConnectDialog)
+    delete queryConnectDialog->join();
+}
+
+
+void VNCServerWin32::processAddressChange(network::SocketListener* sock_) {
+  if (!trayIcon || (sock_ != rfbSock.sock))
+    return;
+
+  // Tool-tip prefix depends on server mode
+  const TCHAR* prefix = _T("VNC Server (User):");
+  if (isServiceProcess())
+    prefix = _T("VNC Server (Service):");
+
+  // Fetch the list of addresses
+  std::list<char*> addrs;
+  if (rfbSock.sock)
+    rfbSock.sock->getMyAddresses(&addrs);
+  else
+    addrs.push_front(strDup("Not accepting connections"));
+
+  // Allocate space for the new tip
+  std::list<char*>::iterator i, next_i;
+  int length = _tcslen(prefix)+1;
+  for (i=addrs.begin(); i!= addrs.end(); i++)
+    length += strlen(*i) + 1;
+
+  // Build the new tip
+  TCharArray toolTip(length);
+  _tcscpy(toolTip.buf, prefix);
+  for (i=addrs.begin(); i!= addrs.end(); i=next_i) {
+    next_i = i; next_i ++;
+    TCharArray addr = *i;    // Assumes ownership of string
+    _tcscat(toolTip.buf, addr.buf);
+    if (next_i != addrs.end())
+      _tcscat(toolTip.buf, _T(","));
+  }
+  
+  // Pass the new tip to the tray icon
+  vlog.info("Refreshing tray icon");
+  trayIcon->setToolTip(toolTip.buf);
+}
+
+void VNCServerWin32::regConfigChanged() {
+  // -=- Make sure we're listening on the right ports.
+  rfbSock.setServer(&vncServer);
+  rfbSock.setPort(port_number, localHost);
+  httpSock.setServer(&httpServer);
+  httpSock.setPort(http_port, localHost);
+
+  // -=- Update the Java viewer's web page port number.
+  httpServer.setRFBport(rfbSock.sock ? port_number : 0);
+
+  // -=- Update the TCP address filter for both ports, if open.
+  CharArray pattern(hosts.getData());
+  rfbSock.setFilter(pattern.buf);
+  httpSock.setFilter(pattern.buf);
+
+  // -=- Update the tray icon tooltip text with IP addresses
+  processAddressChange(rfbSock.sock);
 }
 
 
@@ -147,85 +149,37 @@ int VNCServerWin32::run() {
     runServer = true;
   }
 
+  // - Create the tray icon (if possible)
+  trayIcon = new STrayIconThread(*this, IDI_ICON, IDI_CONNECTED,
+                                 IDI_ICON_DISABLE, IDI_CONNECTED_DISABLE,
+                                 IDR_TRAY);
+
   // - Register for notification of configuration changes
+  config.setCallback(this);
   if (isServiceProcess())
     config.setKey(HKEY_LOCAL_MACHINE, RegConfigPath);
   else
     config.setKey(HKEY_CURRENT_USER, RegConfigPath);
-  config.setNotifyThread(Thread::self(), VNCM_REG_CHANGED);
 
-  // - Create the tray icon if possible
-  STrayIconThread trayIcon(*this, IDI_ICON, IDI_CONNECTED, IDI_ICON_DISABLE,
-                            IDI_CONNECTED_DISABLE, IDR_TRAY);
+  // - Set the address-changed handler for the RFB socket
+  rfbSock.setAddressChangeNotifier(this);
 
   DWORD result = 0;
   try {
-    // - Create some managed listening sockets
-    ManagedListener rfb(&sockMgr, &vncServer);
-    ManagedListener http(&sockMgr, httpServer);
+    vlog.debug("Entering message loop");
 
-    // - Continue to operate until WM_QUIT is processed
+    // - Run the server until we're told to quit
     MSG msg;
-    do {
-      // -=- Make sure we're listening on the right ports.
-      rfb.setPort(port_number, localHost);
-      http.setPort(http_port, localHost);
-
-      // -=- Update the Java viewer's web page port number.
-      httpServer->setRFBport(rfb.sock ? port_number : 0);
-
-      // -=- Update the TCP address filter for both ports, if open.
-      CharArray pattern;
-      pattern.buf = hosts.getData();
-      if (!localHost) {
-        rfb.setFilter(pattern.buf);
-        http.setFilter(pattern.buf);
-      }
-
-      // - If there is a listening port then add the address to the
-      //   tray icon's tool-tip text.
-      {
-        const TCHAR* prefix = isServiceProcess() ?
-          _T("VNC Server (Service):") : _T("VNC Server (User):");
-
-        std::list<char*> addrs;
-        if (rfb.sock)
-          rfb.sock->getMyAddresses(&addrs);
-        else
-          addrs.push_front(strDup("Not accepting connections"));
-
-        std::list<char*>::iterator i, next_i;
-        int length = _tcslen(prefix)+1;
-        for (i=addrs.begin(); i!= addrs.end(); i++)
-          length += strlen(*i) + 1;
-
-        TCharArray toolTip(length);
-        _tcscpy(toolTip.buf, prefix);
-        for (i=addrs.begin(); i!= addrs.end(); i=next_i) {
-          next_i = i; next_i ++;
-          TCharArray addr = *i;    // Assumes ownership of string
-          _tcscat(toolTip.buf, addr.buf);
-          if (next_i != addrs.end())
-            _tcscat(toolTip.buf, _T(","));
-        }
-        trayIcon.setToolTip(toolTip.buf);
-      }
-
-      vlog.debug("Entering message loop");
-
-      // - Run the server until the registry changes, or we're told to quit
-      while (sockMgr.getMessage(&msg, NULL, 0, 0)) {
-        if (msg.hwnd == 0) {
-          if (msg.message == VNCM_REG_CHANGED)
-            break;
-          if (msg.message == VNCM_COMMAND)
-            doCommand();
-        }
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-      }
-
-    } while ((msg.message != WM_QUIT) || runServer);
+    int result = 0;
+    while (runServer) {
+      result = sockMgr.getMessage(&msg, NULL, 0, 0);
+      if (result < 0)
+        throw rdr::SystemException("getMessage", GetLastError());
+      if (!isServiceProcess() && (result == 0))
+        break;
+      TranslateMessage(&msg);
+      DispatchMessage(&msg);
+    }
 
     vlog.debug("Server exited cleanly");
   } catch (rdr::SystemException &s) {
@@ -246,7 +200,8 @@ int VNCServerWin32::run() {
 void VNCServerWin32::stop() {
   Lock l(runLock);
   runServer = false;
-  PostThreadMessage(hostThread->getThreadId(), WM_QUIT, 0, 0);
+  if (hostThread)
+    PostThreadMessage(hostThread->getThreadId(), WM_QUIT, 0, 0);
 }
 
 
@@ -283,6 +238,8 @@ VNCServerST::queryResult VNCServerWin32::queryConnection(network::Socket* sock,
                                             const char* userName,
                                             char** reason)
 {
+  if (queryOnlyIfLoggedOn && CurrentUserToken().noUserLoggedOn())
+    return VNCServerST::ACCEPT;
   if (queryConnectDialog) {
     *reason = rfb::strDup("Another connection is currently being queried.");
     return VNCServerST::REJECT;
@@ -293,51 +250,49 @@ VNCServerST::queryResult VNCServerWin32::queryConnection(network::Socket* sock,
 }
 
 void VNCServerWin32::queryConnectionComplete() {
-  Thread* qcd = queryConnectDialog;
-  queueCommand(QueryConnectionComplete, 0, 0);
-  delete qcd->join();
+  queueCommand(QueryConnectionComplete, 0, 0, false);
 }
 
 
-bool VNCServerWin32::queueCommand(Command cmd, const void* data, int len) {
+bool VNCServerWin32::queueCommand(Command cmd, const void* data, int len, bool wait) {
   Lock l(commandLock);
-  while (command != NoCommand) commandSig.wait();
+  while (command != NoCommand)
+    commandSig.wait();
   command = cmd;
   commandData = data;
   commandDataLen = len;
-  if (PostThreadMessage(hostThread->getThreadId(), VNCM_COMMAND, 0, 0))
-    while (command != NoCommand) commandSig.wait();
-  else
-    return false;
+  SetEvent(commandEvent);
+  if (wait) {
+    while (command != NoCommand)
+      commandSig.wait();
+    commandSig.signal();
+  }
   return true;
 }
 
-void VNCServerWin32::doCommand() {
-  Lock l(commandLock);
-  if (command == NoCommand) return;
+void VNCServerWin32::processEvent(HANDLE event_) {
+  ResetEvent(event_);
 
-  // Perform the required command
-  switch (command) {
+  if (event_ == commandEvent.h) {
+    // If there is no command queued then return immediately
+    {
+      Lock l(commandLock);
+      if (command == NoCommand)
+        return;
+    }
 
-  case DisconnectClients:
-    // Disconnect all currently active VNC Viewers
-    vncServer.closeClients((const char*)commandData);
-    break;
+    // Perform the required command
+    switch (command) {
 
-  case AddClient:
-    // Make a reverse connection to a VNC Viewer
-    vncServer.addClient((network::Socket*)commandData, true);
-    sockMgr.addSocket((network::Socket*)commandData, &vncServer);
-    break;
+    case DisconnectClients:
+      // Disconnect all currently active VNC Viewers
+      vncServer.closeClients((const char*)commandData);
+      break;
 
-  case QueryConnectionComplete:
-    // The Accept/Reject dialog has completed
-    // Get the result, then clean it up
-    vncServer.approveConnection(queryConnectDialog->getSock(),
-                                queryConnectDialog->isAccepted(),
-                                "Connection rejected by user");
-    queryConnectDialog = 0;
-    break;
+    case AddClient:
+      // Make a reverse connection to a VNC Viewer
+      sockMgr.addSocket((network::Socket*)commandData, &vncServer);
+      break;
   case GetClientsInfo:
     vncServer.getConnInfo((ListConnInfo*)commandData); 
     break;
@@ -345,11 +300,26 @@ void VNCServerWin32::doCommand() {
     vncServer.setConnStatus((ListConnInfo*)commandData); 
     break;
 
-  default:
-    vlog.error("unknown command %d queued", command);
-  };
-
-  // Clear the command and signal completion
-  command = NoCommand;
-  commandSig.signal();
+    case QueryConnectionComplete:
+      // The Accept/Reject dialog has completed
+      // Get the result, then clean it up
+      vncServer.approveConnection(queryConnectDialog->getSock(),
+                                  queryConnectDialog->isAccepted(),
+                                  "Connection rejected by user");
+      delete queryConnectDialog->join();
+      queryConnectDialog = 0;
+      break;
+
+    default:
+      vlog.error("unknown command %d queued", command);
+    };
+
+    // Clear the command and signal completion
+    {
+      Lock l(commandLock);
+      command = NoCommand;
+      commandSig.signal();
+    }
+  }
 }
+
index 0af5fd5a209cccc4c5b6a1c2e159b68672a479c6..f05f2c7041d78018748c166fae29cceafd7526b6 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
 #include <rfb_win32/TCharArray.h>
 #include <winvnc/QueryConnectDialog.h>
 #include <winvnc/JavaViewer.h>
-//#include <rfb/ListConnInfo.h>
+#include <winvnc/ManagedListener.h>
 
 namespace winvnc {
 
-  class VNCServerWin32 : rfb::VNCServerST::QueryConnectionHandler {
+  class STrayIconThread;
+
+  class VNCServerWin32 : rfb::VNCServerST::QueryConnectionHandler,
+                         rfb::win32::SocketManager::AddressChangeNotifier,
+                         rfb::win32::RegConfig::Callback,
+                         rfb::win32::EventHandler {
   public:
     VNCServerWin32();
     virtual ~VNCServerWin32();
@@ -60,31 +65,43 @@ namespace winvnc {
     // CALLED FROM AcceptConnectDialog THREAD
     void queryConnectionComplete();
 
-    // Overridden VNCServerST::QueryConnectionHandler callback,
-    // used to prompt user to accept or reject a connection.
+    // Where to read the configuration settings from
+    static const TCHAR* RegConfigPath;
+
+    bool getClientsInfo(rfb::ListConnInfo* LCInfo);
+
+    bool setClientsStatus(rfb::ListConnInfo* LCInfo);
+
+  protected:
+    // VNCServerST::QueryConnectionHandler interface
+    // Callback used to prompt user to accept or reject a connection.
     // CALLBACK IN VNCServerST "HOST" THREAD
     virtual rfb::VNCServerST::queryResult queryConnection(network::Socket* sock,
                                                           const char* userName,
                                                           char** reason);
 
-    bool getClientsInfo(rfb::ListConnInfo* LCInfo);
+    // SocketManager::AddressChangeNotifier interface
+    // Used to keep tray icon up to date
+    virtual void processAddressChange(network::SocketListener* sl);
 
-    bool setClientsStatus(rfb::ListConnInfo* LCInfo);
+    // RegConfig::Callback interface
+    // Called via the EventManager whenver RegConfig sees the registry change
+    virtual void regConfigChanged();
 
-    // Where to read the configuration settings from
-    static const TCHAR* RegConfigPath;
+    // EventHandler interface
+    // Used to perform queued commands
+    virtual void processEvent(HANDLE event);
 
   protected:
-
     // Perform a particular internal function in the server thread
     typedef enum {NoCommand, DisconnectClients, AddClient, QueryConnectionComplete, SetClientsStatus, GetClientsInfo} Command;
-    bool queueCommand(Command cmd, const void* data, int len);
-    void doCommand();
+    bool queueCommand(Command cmd, const void* data, int len, bool wait=true);
     Command command;
     const void* commandData;
     int commandDataLen;
     rfb::Mutex commandLock;
     rfb::Condition commandSig;
+    rfb::win32::Handle commandEvent;
 
     // VNCServerWin32 Server-internal state
     rfb::win32::SDisplay desktop;
@@ -93,9 +110,16 @@ namespace winvnc {
     rfb::Thread* hostThread;
     bool runServer;
     bool isDesktopStarted;
-    JavaViewerServer* httpServer;
-    rfb::win32::RegistryReader config;
+    JavaViewerServer httpServer;
     rfb::win32::SocketManager sockMgr;
+    rfb::win32::RegConfig config;
+
+    ManagedListener rfbSock;
+    ManagedListener httpSock;
+    STrayIconThread* trayIcon;
+
+    //rfb::SSecurityFactoryStandard securityFactory;
+
     QueryConnectDialog* queryConnectDialog;
   };
 
index bab2e137e23d11dc4ae5ca96423de3c290b7df32..9f37b3874b8203203e71b3701a7bcb1b6a061dee 100644 (file)
@@ -1 +1,18 @@
-const char* buildTime = "Built on " __DATE__ " at " __TIME__;
\ No newline at end of file
+/* Copyright (C) 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.
+ */
+const char* buildTime = "Built on " __DATE__ " at " __TIME__;
diff --git a/winvnc/msvcwarning.h b/winvnc/msvcwarning.h
deleted file mode 100644 (file)
index 53a0678..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2002-2003 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.
- */
-#pragma warning( disable : 4800 ) // forcing bool 'true' or 'false'
-#pragma warning( disable : 4786 ) // debug identifier truncated
index 1cb074b9f8f140d06a8d9b3b9fccad02f137c354..68316be9aa6d4820e0834175e62af7c1fb4bf7b3 100644 (file)
@@ -9,11 +9,12 @@
 #define IDD_ABOUT                       104
 #define IDI_CONNECTED                   105
 #define IDR_VNCVIEWER_JAR               106
-#define IDD_CONTROL_PANEL               106
 #define IDD_QUERY_CONNECT               107
 #define IDD_ADD_NEW_CLIENT              108
-#define IDI_ICON_DISABLE                109
-#define IDI_CONNECTED_DISABLE           110
+#define IDB_BITMAP                      109
+#define IDD_CONTROL_PANEL               110
+#define IDI_ICON_DISABLE                111
+#define IDI_CONNECTED_DISABLE           112
 #define IDC_DESCRIPTION                 1000
 #define IDC_BUILDTIME                   1001
 #define IDC_VERSION                     1002
@@ -45,9 +46,9 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        111
+#define _APS_NEXT_RESOURCE_VALUE        113
 #define _APS_NEXT_COMMAND_VALUE         40008
-#define _APS_NEXT_CONTROL_VALUE         1024
+#define _APS_NEXT_CONTROL_VALUE         1023
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/winvnc/winvnc.bmp b/winvnc/winvnc.bmp
new file mode 100644 (file)
index 0000000..90c02f8
Binary files /dev/null and b/winvnc/winvnc.bmp differ
index 5ba6ebc502b2b79a245db1d7468ed2bbec8e9619..2d01f8935dd8a826900533d5b196afef7d885624 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002-2004 RealVNC Ltd.  All Rights Reserved.
- *    
+/* 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
@@ -31,7 +31,7 @@
 #include <rfb/Logger_file.h>
 #include <rfb/LogWriter.h>
 #include <rfb_win32/AboutDialog.h>
-#include <rfb_win32/Win32Util.h>
+#include <rfb_win32/MsgBox.h>
 #include <network/TcpSocket.h>
 
 using namespace winvnc;
@@ -53,8 +53,7 @@ static bool close_console = false;
 //     Read in the command-line parameters and interpret them.
 //
 
-void
-programInfo() {
+static void programInfo() {
   win32::FileVersionInfo inf;
   _tprintf(_T("%s - %s, Version %s\n"),
     inf.getVerString(_T("ProductName")),
@@ -64,8 +63,7 @@ programInfo() {
   _tprintf(_T("%s\n\n"), inf.getVerString(_T("LegalCopyright")));
 }
 
-void
-programUsage() {
+static void programUsage() {
   printf("Command-line options:\n");
   printf("  -connect [<host[::port]>]            - Connect an existing WinVNC server to a listening viewer.\n");
   printf("  -disconnect                          - Disconnect all clients from an existing WinVNC server.\n");
@@ -86,8 +84,22 @@ programUsage() {
   Configuration::listParams();
 }
 
-void
-processParams(int argc, const char* argv[]) {
+static void MsgBoxOrLog(const char* msg, bool isError=false) {
+  if (close_console) {
+    MsgBox(0, TStr(msg), (isError ? MB_ICONERROR : MB_ICONINFORMATION) | MB_OK);
+  } else {
+    if (isError) {
+      try {
+        vlog.error(msg);
+        return;
+      } catch (...) {
+      }
+    }
+    fprintf(stderr, "%s\n", msg);
+  }
+}
+
+static void processParams(int argc, const char* argv[]) {
   for (int i=1; i<argc; i++) {
     try {
 
@@ -96,6 +108,7 @@ processParams(int argc, const char* argv[]) {
         CharArray host;
         if (i+1 < argc) {
           host.buf = strDup(argv[i+1]);
+          i++;
         } else {
           AddNewClientDialog ancd;
           if (ancd.showDialog())
@@ -103,38 +116,47 @@ processParams(int argc, const char* argv[]) {
         }
         if (host.buf) {
           HWND hwnd = FindWindow(0, _T("winvnc::IPC_Interface"));
+          if (!hwnd)
+            throw rdr::Exception("Unable to locate existing VNC Server.");
           COPYDATASTRUCT copyData;
           copyData.dwData = 1; // *** AddNewClient
           copyData.cbData = strlen(host.buf);
           copyData.lpData = (void*)host.buf;
-          i++;
-          SendMessage(hwnd, WM_COPYDATA, 0, (LPARAM)&copyData);
-          printf("Sent connect request to VNC Server...\n");
+          printf("Sending connect request to VNC Server...\n");
+          if (!SendMessage(hwnd, WM_COPYDATA, 0, (LPARAM)&copyData))
+            MsgBoxOrLog("Connection failed.", true);
         }
       } else if (strcasecmp(argv[i], "-disconnect") == 0) {
+        runServer = false;
         HWND hwnd = FindWindow(0, _T("winvnc::IPC_Interface"));
+        if (!hwnd)
+          throw rdr::Exception("Unable to locate existing VNC Server.");
         COPYDATASTRUCT copyData;
         copyData.dwData = 2; // *** DisconnectClients
         copyData.lpData = 0;
         copyData.cbData = 0;
-        SendMessage(hwnd, WM_COPYDATA, 0, (LPARAM)&copyData);
-        printf("Sent disconnect request to VNC Server...\n");
-        runServer = false;
+        printf("Sending disconnect request to VNC Server...\n");
+        if (!SendMessage(hwnd, WM_COPYDATA, 0, (LPARAM)&copyData))
+          MsgBoxOrLog("Failed to disconnect clients.", true);
       } else if (strcasecmp(argv[i], "-start") == 0) {
         printf("Attempting to start service...\n");
         runServer = false;
         if (rfb::win32::startService(VNCServerService::Name))
-          printf("Started service successfully\n");
+          MsgBoxOrLog("Started service successfully");
       } else if (strcasecmp(argv[i], "-stop") == 0) {
         printf("Attempting to stop service...\n");
         runServer = false;
         if (rfb::win32::stopService(VNCServerService::Name))
-          printf("Stopped service successfully\n");
+          MsgBoxOrLog("Stopped service successfully");
       } else if (strcasecmp(argv[i], "-status") == 0) {
         printf("Querying service status...\n");
         runServer = false;
-        rfb::win32::printServiceStatus(VNCServerService::Name);
-
+        DWORD state = rfb::win32::getServiceState(VNCServerService::Name);
+        CharArray stateStr(rfb::win32::serviceStateName(state));
+        const char* stateMsg = "The %s Service is in the %s state.";
+        CharArray result(strlen(stateStr.buf) + _tcslen(VNCServerService::Name) + strlen(stateMsg) + 1);
+        sprintf(result.buf, stateMsg, (const char*)CStr(VNCServerService::Name), stateStr.buf);
+        MsgBoxOrLog(result.buf);
       } else if (strcasecmp(argv[i], "-service") == 0) {
         printf("Run in service mode\n");
         runAsService = true;
@@ -147,15 +169,18 @@ processParams(int argc, const char* argv[]) {
         if (rfb::win32::registerService(VNCServerService::Name,
                                         _T("VNC Server Version 4"),
                                         argc-(j+1), &argv[j+1]))
-          printf("Registered service successfully\n");
+          MsgBoxOrLog("Registered service successfully");
       } else if (strcasecmp(argv[i], "-unregister") == 0) {
         printf("Attempting to unregister service...\n");
         runServer = false;
         if (rfb::win32::unregisterService(VNCServerService::Name))
-          printf("Unregistered service successfully\n");
+          MsgBoxOrLog("Unregistered service successfully");
 
       } else if (strcasecmp(argv[i], "-noconsole") == 0) {
         close_console = true;
+        vlog.info("closing console");
+        if (!FreeConsole())
+          vlog.info("unable to close console:%u", GetLastError());
 
       } else if ((strcasecmp(argv[i], "-help") == 0) ||
         (strcasecmp(argv[i], "--help") == 0) ||
@@ -183,7 +208,7 @@ processParams(int argc, const char* argv[]) {
       }
 
     } catch (rdr::Exception& e) {
-      vlog.error(e.str());
+      MsgBoxOrLog(e.str(), true);
     }
   }
 }
@@ -213,13 +238,7 @@ int main(int argc, const char* argv[]) {
 
     // - Run the server if required
     if (runServer) {
-      if (close_console) {
-        vlog.info("closing console");
-        if (!FreeConsole())
-          vlog.info("unable to close console:%u", GetLastError());
-      }
-
-      network::TcpSocket::initTcpSockets();
+      // Start the network subsystem and run the server
       VNCServerWin32 server;
 
       if (runAsService) {
@@ -235,13 +254,7 @@ int main(int argc, const char* argv[]) {
 
     vlog.debug("WinVNC service destroyed");
   } catch (rdr::Exception& e) {
-    try {
-      vlog.error("Fatal Error: %s", e.str());
-    } catch (...) {
-      fprintf(stderr, "WinVNC: Fatal Error: %s\n", e.str());
-    }
-    if (!runAsService)
-      MsgBox(0, TStr(e.str()), MB_ICONERROR | MB_OK);
+    MsgBoxOrLog(e.str(), true);
   }
 
   vlog.debug("WinVNC process quitting");
index 1daa0f1947e194d91a0fd5fc6e63089871c28b91..a3a56e3642bd9dbbd32159276c1c03bccc4a91b3 100644 (file)
@@ -43,7 +43,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /FI"msvcwarning.h" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /FI"rdr/msvcwarning.h" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX /FD /c\r
 # ADD BASE RSC /l 0x809 /d "NDEBUG"\r
 # ADD RSC /l 0x809 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -73,7 +73,7 @@ PreLink_Cmds=cl /c /nologo /FoRelease\ /FdRelease\ /MT buildTime.cxx
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /FI"msvcwarning.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /FI"rdr/msvcwarning.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c\r
 # ADD BASE RSC /l 0x809 /d "_DEBUG"\r
 # ADD RSC /l 0x809 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -104,7 +104,7 @@ PreLink_Cmds=cl /c /nologo /FoDebug\ /FdDebug\ /MTd buildTime.cxx
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /FI"msvcwarning.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /FI"msvcwarning.h" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_UNICODE" /D "UNICODE" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /FI"rdr/msvcwarning.h" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_UNICODE" /D "UNICODE" /YX /FD /GZ /c\r
 # ADD BASE RSC /l 0x809 /d "_DEBUG"\r
 # ADD RSC /l 0x809 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -145,6 +145,10 @@ SOURCE=.\JavaViewer.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\ManagedListener.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\QueryConnectDialog.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -185,6 +189,10 @@ SOURCE=.\JavaViewer.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\ManagedListener.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\QueryConnectDialog.h\r
 # End Source File\r
 # Begin Source File\r
@@ -221,6 +229,10 @@ SOURCE=.\java\logo150x150.gif
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\winvnc.bmp\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\winvnc.ico\r
 # End Source File\r
 # End Group\r
@@ -234,10 +246,6 @@ SOURCE=.\java\vncviewer.jar
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\vncviewer.jar\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\winvnc4.exe.manifest\r
 # End Source File\r
 # End Target\r
index 9965f3d6f352bd7201b6a7420ad5e6b2106eab60..777d24ccce17b227b0f429be009586ec73cbbff0 100644 (file)
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (U.K.) resources
 
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
 #ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 #pragma code_page(1252)
 #endif //_WIN32
 
+#ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
 //
-// Dialog
+// TEXTINCLUDE
 //
 
-IDD_CONTROL_PANEL DIALOG DISCARDABLE  0, 0, 267, 238
-STYLE DS_MODALFRAME | DS_CENTER | DS_CONTEXTHELP | WS_VISIBLE | WS_CAPTION | 
-    WS_SYSMENU
-CAPTION "Control Panel"
-FONT 8, "MS Sans Serif"
+1 TEXTINCLUDE DISCARDABLE 
 BEGIN
-    CONTROL         "List1",IDC_LIST_CONNECTIONS,"SysListView32",LVS_REPORT | 
-                    LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | 
-                    WS_BORDER | WS_TABSTOP,7,25,253,76
-    LTEXT           "Authorised clients list",IDC_STATIC_KLIENTS_LIST,87,7,
-                    74,11,SS_CENTERIMAGE
-    GROUPBOX        "Control of selected clients",
-                    IDC_STATIC_SELECTED_KLIENTS,7,108,124,103
-    PUSHBUTTON      "View-only",IDC_VIEW_ONLY,13,121,111,14
-    PUSHBUTTON      "Full control ",IDC_FULL_CONTROL,13,145,112,14
-    PUSHBUTTON      "Stop updating",IDC_STOP_UPDATE,13,167,111,14
-    PUSHBUTTON      "Kill Clients",IDC_KILL_SEL_CLIENT,13,190,111,14
-    PUSHBUTTON      "Properties",IDC_PROPERTIES,144,121,111,14
-    PUSHBUTTON      "Add New Client",IDC_ADD_CLIENT,144,145,111,14
-    PUSHBUTTON      "Kill All Clients",IDC_KILL_ALL,144,167,111,14
-    CONTROL         "Disable New Clients",IDC_DISABLE_CLIENTS,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,144,191,111,13
-    PUSHBUTTON      "Close",IDCANCEL,144,217,111,14
+    "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
+
+
+#ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
 //
-// DESIGNINFO
+// Version
 //
 
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
+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
-    IDD_CONTROL_PANEL, DIALOG
+    BLOCK "StringFileInfo"
     BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 260
-        VERTGUIDE, 13
-        VERTGUIDE, 124
-        VERTGUIDE, 144
-        VERTGUIDE, 255
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 231
-        HORZGUIDE, 121
-        HORZGUIDE, 135
-        HORZGUIDE, 145
-        HORZGUIDE, 159
-        HORZGUIDE, 181
-        HORZGUIDE, 191
-        HORZGUIDE, 204
-        HORZGUIDE, 217
+        BLOCK "080904b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "Constantin Kaplinsky\0"
+            VALUE "FileDescription", "TightVNC Server for Win32\0"
+            VALUE "FileVersion", "4.1.1\0"
+            VALUE "InternalName", "winvnc\0"
+            VALUE "LegalCopyright", "Copyright (C) 1998-2005 [many holders]\0"
+            VALUE "LegalTrademarks", "TightVNC\0"
+            VALUE "OriginalFilename", "winvnc4.exe\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "TightVNC Server\0"
+            VALUE "ProductVersion", "4.1.1\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x809, 1200
     END
 END
-#endif    // APSTUDIO_INVOKED
+
+#endif    // !_MAC
 
 
 /////////////////////////////////////////////////////////////////////////////
@@ -90,19 +100,32 @@ END
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
+IDI_ICON                ICON    DISCARDABLE     "winvnc.ico"
+IDI_CONNECTED           ICON    DISCARDABLE     "connected.ico"
 IDI_ICON_DISABLE        ICON    DISCARDABLE     "icon_dis.ico"
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
+IDI_CONNECTED_DISABLE   ICON    DISCARDABLE     "connecte.ico"
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+//
+// Menu
+//
+
+IDR_TRAY MENU DISCARDABLE 
+BEGIN
+    POPUP "Tray Menu"
+    BEGIN
+        MENUITEM "Control &Panel",              ID_CONTR0L_PANEL
+        MENUITEM SEPARATOR
+        MENUITEM "&Options...",                 ID_OPTIONS
+        MENUITEM "Add &New Client...",          ID_CONNECT
+        MENUITEM "&Disconnect Clients",         ID_DISCONNECT
+        MENUITEM "D&isable New Clients",        ID_DISABLE_NEW_CLIENTS
+        MENUITEM SEPARATOR
+        MENUITEM "&Close VNC Server",           ID_CLOSE
+        MENUITEM "&About...",                   ID_ABOUT
+    END
+END
 
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
-#pragma code_page(1252)
-#endif //_WIN32
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -116,13 +139,13 @@ CAPTION "About VNC Server 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
+    CONTROL         109,IDC_STATIC,"Static",SS_BITMAP,5,10,33,31
+    LTEXT           ">appname<",IDC_DESCRIPTION,45,10,125,15
+    LTEXT           ">version<",IDC_VERSION,170,10,72,15
+    LTEXT           ">buildtime<",IDC_BUILDTIME,45,25,202,15
+    LTEXT           ">copyright<",IDC_COPYRIGHT,45,40,202,15
+    LTEXT           "See http://www.tightvnc.com for more information on VNC.",
+                    IDC_STATIC,45,55,202,15
 END
 
 IDD_QUERY_CONNECT DIALOG DISCARDABLE  0, 0, 164, 93
@@ -142,21 +165,62 @@ BEGIN
     LTEXT           "-",IDC_QUERY_HOST,40,30,117,15,SS_CENTERIMAGE
 END
 
-IDD_ADD_NEW_CLIENT DIALOG DISCARDABLE  0, 0, 183, 53
+IDD_ADD_NEW_CLIENT DIALOG DISCARDABLE  0, 0, 177, 52
 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | 
     WS_CAPTION | WS_SYSMENU
 CAPTION "VNC Server : Add New Client"
 FONT 8, "MS Sans Serif"
 BEGIN
-    EDITTEXT        IDC_HOST,70,10,105,15,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "OK",IDOK,70,32,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,125,32,50,14
-    ICON            IDI_ICON,IDC_STATIC,7,10,21,20,SS_REALSIZEIMAGE
-    CONTROL         "Viewer:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | 
-                    SS_CENTERIMAGE | WS_GROUP,35,10,30,15
+    EDITTEXT        IDC_HOST,80,10,90,15,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,80,31,40,14
+    PUSHBUTTON      "Cancel",IDCANCEL,125,31,45,14
+    CONTROL         109,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE,7,
+                    10,33,31
+    RTEXT           "Viewer:",IDC_STATIC,45,10,30,15,SS_CENTERIMAGE
+END
+
+IDD_CONTROL_PANEL DIALOG DISCARDABLE  0, 0, 267, 238
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | DS_CONTEXTHELP | 
+    WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Control Panel"
+FONT 8, "MS Sans Serif"
+BEGIN
+    CONTROL         "List1",IDC_LIST_CONNECTIONS,"SysListView32",LVS_REPORT | 
+                    LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | 
+                    WS_BORDER | WS_TABSTOP,7,25,253,76
+    LTEXT           "Authorised clients list",IDC_STATIC_KLIENTS_LIST,87,7,
+                    74,11,SS_CENTERIMAGE
+    GROUPBOX        "Control of selected clients",
+                    IDC_STATIC_SELECTED_KLIENTS,7,108,124,103
+    PUSHBUTTON      "View-only",IDC_VIEW_ONLY,13,121,111,14
+    PUSHBUTTON      "Full control ",IDC_FULL_CONTROL,13,145,112,14
+    PUSHBUTTON      "Stop updating",IDC_STOP_UPDATE,13,167,111,14
+    PUSHBUTTON      "Kill Clients",IDC_KILL_SEL_CLIENT,13,190,111,14
+    PUSHBUTTON      "Properties",IDC_PROPERTIES,144,121,111,14
+    PUSHBUTTON      "Add New Client",IDC_ADD_CLIENT,144,145,111,14
+    PUSHBUTTON      "Kill All Clients",IDC_KILL_ALL,144,167,111,14
+    CONTROL         "Disable New Clients",IDC_DISABLE_CLIENTS,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,144,191,111,13
+    PUSHBUTTON      "Close",IDCANCEL,144,217,111,14
 END
 
 
+/////////////////////////////////////////////////////////////////////////////
+//
+// HTTPFILE
+//
+
+/VNCVIEWER.JAR          HTTPFILE DISCARDABLE    "java\\vncviewer.jar"
+/LOGO150X150.GIF        HTTPFILE DISCARDABLE    "java\\logo150x150.gif"
+/INDEX.VNC              HTTPFILE DISCARDABLE    "java\\index.vnc"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 24
+//
+
+IDR_MANIFEST            24      DISCARDABLE     "winvnc4.exe.manifest"
+
 /////////////////////////////////////////////////////////////////////////////
 //
 // DESIGNINFO
@@ -165,6 +229,22 @@ END
 #ifdef APSTUDIO_INVOKED
 GUIDELINES DESIGNINFO DISCARDABLE 
 BEGIN
+    IDD_ABOUT, DIALOG
+    BEGIN
+        LEFTMARGIN, 5
+        VERTGUIDE, 45
+        VERTGUIDE, 170
+        VERTGUIDE, 195
+        VERTGUIDE, 242
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 85
+        HORZGUIDE, 10
+        HORZGUIDE, 25
+        HORZGUIDE, 40
+        HORZGUIDE, 55
+        HORZGUIDE, 70
+    END
+
     IDD_QUERY_CONNECT, DIALOG
     BEGIN
         LEFTMARGIN, 7
@@ -187,142 +267,50 @@ BEGIN
     IDD_ADD_NEW_CLIENT, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 176
-        VERTGUIDE, 35
-        VERTGUIDE, 65
-        VERTGUIDE, 70
+        RIGHTMARGIN, 170
+        VERTGUIDE, 45
+        VERTGUIDE, 75
+        VERTGUIDE, 80
         VERTGUIDE, 120
         VERTGUIDE, 125
-        VERTGUIDE, 175
+        VERTGUIDE, 170
         TOPMARGIN, 7
-        BOTTOMMARGIN, 46
+        BOTTOMMARGIN, 45
         HORZGUIDE, 10
         HORZGUIDE, 25
+        HORZGUIDE, 30
+        HORZGUIDE, 45
     END
-END
-#endif    // APSTUDIO_INVOKED
-
-
-#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
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 4,0,0,26
- PRODUCTVERSION 4,0,0,26
- 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 for Win32\0"
-            VALUE "FileVersion", "4.0\0"
-            VALUE "InternalName", "WinVNC 4.0\0"
-            VALUE "LegalCopyright", "Copyright (C) 1998-2004 [many holders]\0"
-            VALUE "LegalTrademarks", "TightVNC\0"
-            VALUE "OriginalFilename", "winvnc4.exe\0"
-            VALUE "PrivateBuild", "\0"
-            VALUE "ProductName", "TightVNC Server 4.0\0"
-            VALUE "ProductVersion", "4.0\0"
-            VALUE "SpecialBuild", "\0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x809, 1200
-    END
-END
-
-#endif    // !_MAC
-
 
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_ICON                ICON    DISCARDABLE     "winvnc.ico"
-IDI_CONNECTED           ICON    DISCARDABLE     "connected.ico"
-IDI_CONNECTED_DISABLE   ICON    DISCARDABLE     "connecte.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_TRAY MENU DISCARDABLE 
-BEGIN
-    POPUP "Tray Menu"
+    IDD_CONTROL_PANEL, DIALOG
     BEGIN
-        MENUITEM "Control &Panel",              ID_CONTR0L_PANEL
-        MENUITEM SEPARATOR
-        MENUITEM "&Options...",                 ID_OPTIONS
-        MENUITEM "Add &New Client",             ID_CONNECT
-        MENUITEM "&Disconnect Clients",         ID_DISCONNECT
-        MENUITEM "Disable New &Clients",        ID_DISABLE_NEW_CLIENTS
-        MENUITEM SEPARATOR
-        MENUITEM "Close &VNC Server",           ID_CLOSE
-        MENUITEM "&About...",                   ID_ABOUT
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 260
+        VERTGUIDE, 13
+        VERTGUIDE, 124
+        VERTGUIDE, 144
+        VERTGUIDE, 255
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 231
+        HORZGUIDE, 121
+        HORZGUIDE, 135
+        HORZGUIDE, 145
+        HORZGUIDE, 159
+        HORZGUIDE, 181
+        HORZGUIDE, 191
+        HORZGUIDE, 204
+        HORZGUIDE, 217
     END
 END
+#endif    // APSTUDIO_INVOKED
 
 
 /////////////////////////////////////////////////////////////////////////////
 //
-// HTTPFILE
-//
-
-/VNCVIEWER.JAR          HTTPFILE DISCARDABLE    "java\\vncviewer.jar"
-/LOGO150X150.GIF        HTTPFILE DISCARDABLE    "java\\logo150x150.gif"
-/INDEX.VNC              HTTPFILE DISCARDABLE    "java\\index.vnc"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// 24
+// Bitmap
 //
 
-IDR_MANIFEST            24      DISCARDABLE     "winvnc4.exe.manifest"
+IDB_BITMAP              BITMAP  DISCARDABLE     "winvnc.bmp"
 #endif    // English (U.K.) resources
 /////////////////////////////////////////////////////////////////////////////