Make winvnc4 and Windows vncconfig compilable via MinGW.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3913 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/win/Makefile.am b/win/Makefile.am
index 945e4e8..4aa1cde 100644
--- a/win/Makefile.am
+++ b/win/Makefile.am
@@ -1,2 +1,3 @@
-SUBDIRS = rfb_win32 vncviewer
+SUBDIRS = rfb_win32 vncviewer vncconfig winvnc
 
+EXTRA_DIST = logmessages/messages.h
diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx
index 39cca11..60ea159 100644
--- a/win/rfb_win32/CleanDesktop.cxx
+++ b/win/rfb_win32/CleanDesktop.cxx
@@ -181,7 +181,7 @@
     }
 
     // -=- Switch of normal wallpaper and notify apps
-    SysParamsInfo(SPI_SETDESKWALLPAPER, 0, "", SPIF_SENDCHANGE);
+    SysParamsInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) "", SPIF_SENDCHANGE);
     restoreWallpaper = true;
 
   } catch (rdr::Exception& e) {
@@ -225,7 +225,7 @@
     ImpersonateCurrentUser icu;
 
     vlog.debug("disable desktop pattern");
-    SysParamsInfo(SPI_SETDESKPATTERN, 0, "", SPIF_SENDCHANGE);
+    SysParamsInfo(SPI_SETDESKPATTERN, 0, (PVOID) "", SPIF_SENDCHANGE);
     restorePattern = true;
 
   } catch (rdr::Exception& e) {
diff --git a/win/rfb_win32/Makefile.am b/win/rfb_win32/Makefile.am
index 7c5d1c5..3d8545a 100644
--- a/win/rfb_win32/Makefile.am
+++ b/win/rfb_win32/Makefile.am
@@ -55,12 +55,10 @@
   WMShatter.h \
   WMWindowCopyRect.h
 
-
-##  CleanDesktop.cxx not built - MinGW does not provide COM
-
 librfb_win32_la_SOURCES = $(HDRS) \
   AboutDialog.cxx \
   CKeyboard.cxx \
+  CleanDesktop.cxx \
   Clipboard.cxx \
   CPointer.cxx \
   CurrentUser.cxx \
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 7512cc6..209e4fd 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -62,7 +62,7 @@
         pattern.replaceBuf(0);
       }
       bool onOk() {
-        TCharArray host = getItemString(IDC_HOST_PATTERN);
+        TCharArray host(getItemString(IDC_HOST_PATTERN));
         TCharArray newPat(_tcslen(host.buf)+2);
         if (isItemChecked(IDC_ALLOW))
           newPat.buf[0] = _T('+');
@@ -248,8 +248,8 @@
       }
       bool isChanged() {
         try {
-          CharArray new_hosts = getHosts();
-          CharArray old_hosts = hosts.getData();
+          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)) ||
diff --git a/win/vncconfig/Desktop.h b/win/vncconfig/Desktop.h
index 164269a..6479cb2 100644
--- a/win/vncconfig/Desktop.h
+++ b/win/vncconfig/Desktop.h
@@ -32,7 +32,7 @@
       DesktopPage(const RegKey& rk)
         : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {}
       void initDialog() {
-        CharArray action = rfb::win32::SDisplay::disconnectAction.getData();
+        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)();
@@ -59,7 +59,7 @@
         case IDC_REMOVE_WALLPAPER:
         case IDC_REMOVE_PATTERN:
         case IDC_DISABLE_EFFECTS:
-          CharArray action = rfb::win32::SDisplay::disconnectAction.getData();
+          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)) ||
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index ae5d716..f8c2028 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -71,7 +71,7 @@
 
             // Reformat AuthHosts to Hosts.  Wish I'd left the format the same. :( :( :(
             try {
-              CharArray tmp = strDup(authHosts.buf);
+              CharArray tmp(authHosts.buf);
               while (tmp.buf) {
 
                 // Split the AuthHosts string into patterns to match
diff --git a/win/vncconfig/Makefile.am b/win/vncconfig/Makefile.am
new file mode 100644
index 0000000..17420b0
--- /dev/null
+++ b/win/vncconfig/Makefile.am
@@ -0,0 +1,20 @@
+bin_PROGRAMS = vncconfig

+

+HDRS = Authentication.h Connections.h Desktop.h Hooking.h Inputs.h Legacy.h \

+	PasswordDialog.h resource.h Sharing.h

+

+vncconfig_SOURCES = $(HDRS) Legacy.cxx PasswordDialog.cxx vncconfig.cxx

+

+vncconfig_CPPFLAGS = -I$(top_srcdir)/win -I$(top_srcdir)/common

+

+vncconfig_LDADD = $(top_srcdir)/win/rfb_win32/librfb_win32.la \

+	$(top_srcdir)/common/rfb/librfb.la \

+	$(top_srcdir)/common/Xregion/libXregion.la \

+	$(top_srcdir)/common/network/libnetwork.la \

+	$(top_srcdir)/common/rdr/librdr.la -lws2_32 -lgdi32 -lversion -lole32 \

+	-lcomctl32 resources.o

+

+EXTRA_DIST = connected.ico vncconfig.ico vncconfig.rc vncconfig.exe.manifest

+

+resources.o: vncconfig.rc

+	$(WINDRES) $^ -o $@

diff --git a/win/vncviewer/Makefile.am b/win/vncviewer/Makefile.am
index 201f1e1..d58df37 100644
--- a/win/vncviewer/Makefile.am
+++ b/win/vncviewer/Makefile.am
@@ -41,5 +41,8 @@
 
 vncviewer_LDFLAGS = -I$(top_srcdir)/win -mwindows
 
+EXTRA_DIST = vncviewer.rc vncviewer.ico cursor1.cur vncviewer.exe.manifest \
+	vncviewer.bmp toolbar.bmp
+
 resources.o: vncviewer.rc
 	$(WINDRES) $^ -o $@
diff --git a/win/winvnc/JavaViewer.cxx b/win/winvnc/JavaViewer.cxx
index 15c05c4..ca9c285 100644
--- a/win/winvnc/JavaViewer.cxx
+++ b/win/winvnc/JavaViewer.cxx
@@ -21,7 +21,7 @@
 #include <winvnc/resource.h>
 #include <rdr/MemInStream.h>
 #include <rfb/LogWriter.h>
-#include <rfb/VNCserverST.h>
+#include <rfb/VNCServerST.h>
 #include <rfb_win32/TCharArray.h>
 
 #define strcasecmp _stricmp
diff --git a/win/winvnc/Makefile.am b/win/winvnc/Makefile.am
new file mode 100644
index 0000000..da555fe
--- /dev/null
+++ b/win/winvnc/Makefile.am
@@ -0,0 +1,27 @@
+bin_PROGRAMS = winvnc4

+

+HDRS = AddNewClientDialog.h ControlPanel.h JavaViewer.h ManagedListener.h \

+	QueryConnectDialog.h STrayIcon.h VNCServerService.h VNCServerWin32.h \

+	resource.h

+

+winvnc4_SOURCES = $(HDRS) buildTime.cxx ControlPanel.cxx JavaViewer.cxx \

+	ManagedListener.cxx QueryConnectDialog.cxx STrayIcon.cxx \

+	VNCServerService.cxx VNCServerWin32.cxx winvnc.cxx

+

+winvnc4_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/win

+

+winvnc4_LDADD = $(top_srcdir)/common/rfb/librfb.la \

+	$(top_srcdir)/win/rfb_win32/librfb_win32.la \

+	$(top_srcdir)/common/Xregion/libXregion.la \

+	$(top_srcdir)/common/network/libnetwork.la \

+	$(top_srcdir)/common/rdr/librdr.la resources.o -lws2_32 -lgdi32 \

+	-lole32 -lcomctl32 -lversion

+

+winvnc4_LDFLAGS = -mwindows

+

+EXTRA_DIST = winvnc.rc winvnc.ico connected.ico icon_dis.ico connecte.ico \

+	winvnc4.exe.manifest winvnc.bmp

+

+resources.o: winvnc.rc

+	$(WINDRES) $^ -o $@

+

diff --git a/win/winvnc/STrayIcon.cxx b/win/winvnc/STrayIcon.cxx
index 0b10fa5..354575a 100644
--- a/win/winvnc/STrayIcon.cxx
+++ b/win/winvnc/STrayIcon.cxx
@@ -59,8 +59,9 @@
 
 const UINT WM_SET_TOOLTIP = WM_USER + 1;
 
+namespace winvnc {
 
-class winvnc::STrayIcon : public TrayIcon {
+class STrayIcon : public TrayIcon {
 public:
   STrayIcon(STrayIconThread& t) : thread(t),
     vncConfig(_T("vncconfig.exe"), isServiceProcess() ? _T("-noconsole -service") : _T("-noconsole")),
@@ -183,7 +184,7 @@
         switch (command->dwData) {
         case 1:
           {
-            CharArray viewer = new char[command->cbData + 1];
+            CharArray viewer(command->cbData + 1);
             memcpy(viewer.buf, command->lpData, command->cbData);
             viewer.buf[command->cbData] = 0;
             return thread.server.addNewClient(viewer.buf) ? 1 : 0;
@@ -277,4 +278,5 @@
   PostMessage(windowHandle, WM_SET_TOOLTIP, 0, 0);
 }
 
+}
 
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index 9e8fa88..cd0978b 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -112,7 +112,7 @@
   _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
+    TCharArray addr(*i);    // Assumes ownership of string
     _tcscat(toolTip.buf, addr.buf);
     if (next_i != addrs.end())
       _tcscat(toolTip.buf, _T(","));
diff --git a/win/winvnc/winvnc.rc b/win/winvnc/winvnc.rc
index 56ce598..db428db 100644
--- a/win/winvnc/winvnc.rc
+++ b/win/winvnc/winvnc.rc
@@ -9,6 +9,10 @@
 //
 #include "windows.h"
 
+#ifndef IDC_STATIC
+#define IDC_STATIC -1
+#endif
+
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
@@ -210,8 +214,8 @@
 // HTTPFILE
 //
 
-/VNCVIEWER.JAR          HTTPFILE DISCARDABLE    "..\\..\\java\\src\\com\\tigervnc\\vncviewer\\VncViewer.jar"
-/INDEX.VNC              HTTPFILE DISCARDABLE    "index.vnc"
+//VNCVIEWER.JAR          HTTPFILE DISCARDABLE    "..\\..\\java\\src\\com\\tigervnc\\vncviewer\\VncViewer.jar"
+//INDEX.VNC              HTTPFILE DISCARDABLE    "index.vnc"
 
 /////////////////////////////////////////////////////////////////////////////
 //