From 934f63cba1bf9646e3fd40b9575930e8c3371853 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Mon, 12 Oct 2009 15:54:59 +0000 Subject: [PATCH] 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 --- configure.ac | 2 ++ win/Makefile.am | 3 ++- win/rfb_win32/CleanDesktop.cxx | 4 ++-- win/rfb_win32/Makefile.am | 4 +--- win/vncconfig/Connections.h | 6 +++--- win/vncconfig/Desktop.h | 4 ++-- win/vncconfig/Legacy.cxx | 2 +- win/vncconfig/Makefile.am | 20 ++++++++++++++++++++ win/vncviewer/Makefile.am | 3 +++ win/winvnc/JavaViewer.cxx | 2 +- win/winvnc/Makefile.am | 27 +++++++++++++++++++++++++++ win/winvnc/STrayIcon.cxx | 6 ++++-- win/winvnc/VNCServerWin32.cxx | 2 +- win/winvnc/winvnc.rc | 8 ++++++-- 14 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 win/vncconfig/Makefile.am create mode 100644 win/winvnc/Makefile.am diff --git a/configure.ac b/configure.ac index 47091b4b..f030412f 100644 --- a/configure.ac +++ b/configure.ac @@ -160,5 +160,7 @@ unix/vncpasswd/Makefile win/Makefile win/vncviewer/Makefile win/rfb_win32/Makefile +win/vncconfig/Makefile +win/winvnc/Makefile po/Makefile.in ]) diff --git a/win/Makefile.am b/win/Makefile.am index 945e4e8e..4aa1cdeb 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 39cca119..60ea1597 100644 --- a/win/rfb_win32/CleanDesktop.cxx +++ b/win/rfb_win32/CleanDesktop.cxx @@ -181,7 +181,7 @@ void CleanDesktop::disableWallpaper() { } // -=- 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 @@ void CleanDesktop::disablePattern() { 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 7c5d1c54..3d8545a9 100644 --- a/win/rfb_win32/Makefile.am +++ b/win/rfb_win32/Makefile.am @@ -55,12 +55,10 @@ HDRS = \ 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 7512cc65..209e4fd8 100644 --- a/win/vncconfig/Connections.h +++ b/win/vncconfig/Connections.h @@ -62,7 +62,7 @@ namespace rfb { 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 @@ namespace rfb { } 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 164269a2..6479cb26 100644 --- a/win/vncconfig/Desktop.h +++ b/win/vncconfig/Desktop.h @@ -32,7 +32,7 @@ namespace rfb { 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 @@ namespace rfb { 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 ae5d7166..f8c20280 100644 --- a/win/vncconfig/Legacy.cxx +++ b/win/vncconfig/Legacy.cxx @@ -71,7 +71,7 @@ void LegacyPage::LoadPrefs() // 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 00000000..17420b0b --- /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 201f1e13..d58df378 100644 --- a/win/vncviewer/Makefile.am +++ b/win/vncviewer/Makefile.am @@ -41,5 +41,8 @@ vncviewer_LDADD = $(top_srcdir)/common/rfb/librfb.la \ 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 15c05c46..ca9c285f 100644 --- a/win/winvnc/JavaViewer.cxx +++ b/win/winvnc/JavaViewer.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #define strcasecmp _stricmp diff --git a/win/winvnc/Makefile.am b/win/winvnc/Makefile.am new file mode 100644 index 00000000..da555fe3 --- /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 0b10fa5b..354575ad 100644 --- a/win/winvnc/STrayIcon.cxx +++ b/win/winvnc/STrayIcon.cxx @@ -59,8 +59,9 @@ const WORD rfb::win32::AboutDialog::Description = IDC_DESCRIPTION; 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 @@ public: 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 @@ void STrayIconThread::setToolTip(const TCHAR* text) { PostMessage(windowHandle, WM_SET_TOOLTIP, 0, 0); } +} diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index 9e8fa887..cd0978b6 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -112,7 +112,7 @@ void VNCServerWin32::processAddressChange(network::SocketListener* sock_) { _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 56ce5986..db428db6 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 @@ END // 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" ///////////////////////////////////////////////////////////////////////////// // -- 2.39.5