diff --git a/Makefile.am b/Makefile.am
index 811b496..8e2e7c6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -89,7 +89,7 @@ endif
 # * -z2 - Unix style line endings
 # Also add the -n to make it not save .orig files (we have git for that)
 style:
-	astyle -n -p -b -S -t4 -k3 -z2 `find . -name "*.cpp" -o -name "*.h" | egrep -v "(wx-build|xrcDialogs|pgscript/test)"`
+	astyle -n -p -b -S -t4 -k3 -z2 `find . -name "*.cpp" -o -name "*.h" | egrep -v "(wx-build|xrcDialogs|pgscript/test|pgadmin/libssh2|pgadmin/include/libssh2)"`
 
 # Create HTML docs
 doc:
diff --git a/acinclude-ssh2.m4 b/acinclude-ssh2.m4
new file mode 100644
index 0000000..14b4736
--- /dev/null
+++ b/acinclude-ssh2.m4
@@ -0,0 +1,134 @@
+dnl CURL_CHECK_NONBLOCKING_SOCKET
+dnl -------------------------------------------------
+dnl Check for how to set a socket to non-blocking state. There seems to exist
+dnl four known different ways, with the one used almost everywhere being POSIX
+dnl and XPG3, while the other different ways for different systems (old BSD,
+dnl Windows and Amiga).
+dnl
+dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
+dnl O_NONBLOCK define is found but does not work. This condition is attempted
+dnl to get caught in this script by using an excessive number of #ifdefs...
+dnl
+AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
+[
+	AC_MSG_CHECKING([non-blocking sockets style])
+	AC_TRY_COMPILE([
+		/* headers for O_NONBLOCK test */
+		#include <sys/types.h>
+		#include <unistd.h>
+		#include <fcntl.h>
+	],[
+		/* try to compile O_NONBLOCK */
+
+		#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+			# if defined(__SVR4) || defined(__srv4__)
+				#  define PLATFORM_SOLARIS
+			# else
+				#  define PLATFORM_SUNOS4
+			# endif
+		#endif
+		#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
+			# define PLATFORM_AIX_V3
+		#endif
+
+		#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
+			#error "O_NONBLOCK does not work on this platform"
+		#endif
+		int socket;
+		int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
+	],[
+		dnl the O_NONBLOCK test was fine
+		nonblock="O_NONBLOCK"
+		AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
+	],[
+		dnl the code was bad, try a different program now, test 2
+
+		AC_TRY_COMPILE([
+			/* headers for FIONBIO test */
+			#include <unistd.h>
+			#include <stropts.h>
+		],[
+			/* FIONBIO source test (old-style unix) */
+			int socket;
+			int flags = ioctl(socket, FIONBIO, &flags);
+		],[
+			dnl FIONBIO test was good
+			nonblock="FIONBIO"
+			AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
+		],[
+			dnl FIONBIO test was also bad
+			dnl the code was bad, try a different program now, test 3
+
+			AC_TRY_COMPILE([
+				/* headers for ioctlsocket test (Windows) */
+				#undef inline
+				#ifdef HAVE_WINDOWS_H
+					#ifndef WIN32_LEAN_AND_MEAN
+						#define WIN32_LEAN_AND_MEAN
+					#endif
+					#include <windows.h>
+					#ifdef HAVE_WINSOCK2_H
+						#include <winsock2.h>
+					#else
+						#ifdef HAVE_WINSOCK_H
+							#include <winsock.h>
+						#endif
+					#endif
+				#endif
+			],[
+				/* ioctlsocket source code */
+				SOCKET sd;
+				unsigned long flags = 0;
+				sd = socket(0, 0, 0);
+				ioctlsocket(sd, FIONBIO, &flags);
+			],[
+				dnl ioctlsocket test was good
+				nonblock="ioctlsocket"
+				AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
+			],[
+				dnl ioctlsocket didnt compile!, go to test 4
+				AC_TRY_LINK([
+					/* headers for IoctlSocket test (Amiga?) */
+					#include <sys/ioctl.h>
+				],[
+					/* IoctlSocket source code */
+					int socket;
+					int flags = IoctlSocket(socket, FIONBIO, (long)1);
+				],[
+					dnl ioctlsocket test was good
+					nonblock="IoctlSocket"
+					AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
+				],[
+					dnl Ioctlsocket didnt compile, do test 5!
+					AC_TRY_COMPILE([
+						/* headers for SO_NONBLOCK test (BeOS) */
+						#include <socket.h>
+					],[
+						/* SO_NONBLOCK source code */
+						long b = 1;
+						int socket;
+						int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
+					],[
+						dnl the SO_NONBLOCK test was good
+						nonblock="SO_NONBLOCK"
+						AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
+					],[
+						dnl test 5 didnt compile!
+						nonblock="nada"
+						AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
+					])
+					dnl end of fifth test
+				])
+				dnl end of forth test
+			])
+			dnl end of third test
+		])
+		dnl end of second test
+	])
+	dnl end of non-blocking try-compile test
+	AC_MSG_RESULT($nonblock)
+
+	if test "$nonblock" = "nada"; then
+		AC_MSG_WARN([non-block sockets disabled])
+	fi
+])
diff --git a/acinclude.m4 b/acinclude.m4
index e9c5a5d..fca9d82 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -13,6 +13,8 @@
 # Check there is a C++ compiler #
 #################################
 
+sinclude(acinclude-ssh2.m4)
+
 AC_DEFUN([CHECK_CPP_COMPILER],
 [
 	if test "$ac_cv_prog_cxx_g" = no; then
@@ -666,7 +668,7 @@ AC_DEFUN([SETUP_POSTGRESQL],
 
 		if test "$PG_SSL" = "yes"
 		then
-			CPPFLAGS="$CPPFLAGS -DSSL"
+			CPPFLAGS="$CPPFLAGS -DPG_SSL"
 		fi
 		if test "$HAVE_CONNINFO_PARSE" = "yes"
 		then
@@ -889,6 +891,25 @@ AC_DEFUN([SUMMARY],
 		echo "Building Database Designer:		No"
 	fi
 	echo
+	if test "$BUILD_SSH_TUNNEL" = yes
+	then
+		echo "Building SSH Tunnel:			Yes"
+		if test "$ac_cv_libssl" = yes
+		then
+			echo "Crypto library:				openssl= yes libgcrypt= no"
+		else test "$ac_cv_libgcrypt" = yes
+			echo "Crypto library:				openssl= no libgcrypt= yes"
+		fi
+		if test "$ac_cv_libz" = yes
+		then
+			echo "libz compression:			yes"
+		else
+			echo "libz compression:			no"
+		fi
+	else
+		echo "Building SSH Tunnel:			No"
+	fi
+	echo
 	if test "$BUILD_DEBUG" = yes
 	then
 		echo "Building a debug version of pgAdmin:	Yes"
diff --git a/bootstrap b/bootstrap
index 41ba2e0..6a234cc 100755
--- a/bootstrap
+++ b/bootstrap
@@ -37,5 +37,6 @@ set -x
 
 aclocal && \
 autoheader && \
+cp -f config.rpath.in config/config.rpath && \
 automake --foreign --add-missing --copy && \
 autoconf
diff --git a/config.rpath.in b/config.rpath.in
new file mode 100644
index 0000000..e082db6
--- /dev/null
+++ b/config.rpath.in
@@ -0,0 +1,660 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2006 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   This file is free software; the Free Software Foundation gives
+#   unlimited permission to copy and/or distribute it, with or without
+#   modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    darwin*)
+      case $cc_basename in
+        xlc*)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    mingw* | pw32* | os2*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    newsos6)
+      ;;
+    linux*)
+      case $cc_basename in
+        icc* | ecc*)
+          wl='-Wl,'
+          ;;
+        pgcc | pgf77 | pgf90)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+        *)
+          case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ C*)
+              wl='-Wl,'
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      wl='-Wl,'
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # Set some defaults for GNU ld with shared library support. These
+  # are reset later if shared libraries are not supported. Putting them
+  # here allows them to be overridden if necessary.
+  # Unlike libtool, we use -rpath here, not --rpath, since the documented
+  # option of GNU ld is called -rpath, not --rpath.
+  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  case "$host_os" in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we cannot use
+      # them.
+      ld_shlibs=no
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    interix3*)
+      hardcode_direct=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      ;;
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+          ld_shlibs=no
+          ;;
+        *)
+          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+          else
+            ld_shlibs=no
+          fi
+          ;;
+      esac
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = no; then
+    hardcode_libdir_flag_spec=
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+          ;;
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            hardcode_direct=yes
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+          ;;
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if test "$GCC" = yes ; then
+        :
+      else
+        case $cc_basename in
+          xlc*)
+            ;;
+          *)
+            ld_shlibs=no
+            ;;
+        esac
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        hardcode_direct=yes
+        # hardcode_minus_L: Not really in the search PATH,
+        # but as the default location of the library.
+        hardcode_minus_L=yes
+      fi
+      ;;
+    hpux11*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct=no
+            ;;
+          *)
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    openbsd*)
+      hardcode_direct=yes
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      else
+        case "$host_os" in
+          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+            hardcode_libdir_flag_spec='-R$libdir'
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+            ;;
+        esac
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      ;;
+    sysv5* | sco3.2v5* | sco5v6*)
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    library_names_spec='$libname.a'
+    ;;
+  aix4* | aix5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  amigaos*)
+    library_names_spec='$libname.a'
+    ;;
+  beos*)
+    library_names_spec='$libname$shrext'
+    ;;
+  bsdi[45]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  cygwin* | mingw* | pw32*)
+    shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    library_names_spec='$libname$shrext'
+    ;;
+  dgux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd1*)
+    ;;
+  kfreebsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd* | dragonfly*)
+    case "$host_os" in
+      freebsd[123]*)
+        library_names_spec='$libname$shrext$versuffix' ;;
+      *)
+        library_names_spec='$libname$shrext' ;;
+    esac
+    ;;
+  gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case $host_cpu in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    library_names_spec='$libname$shrext'
+    ;;
+  interix3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  netbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  newsos6)
+    library_names_spec='$libname$shrext'
+    ;;
+  nto-qnx*)
+    library_names_spec='$libname$shrext'
+    ;;
+  openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    library_names_spec='$libname.a'
+    ;;
+  osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  solaris*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv4*MP*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  uts4*)
+    library_names_spec='$libname$shrext'
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/configure.ac.in b/configure.ac.in
index 64f364f..1d5a748 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -22,6 +22,11 @@ AM_CONDITIONAL([SUN_CXX], [test x$SUN_CXX_COMPILER = xyes])
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h])
+AC_CHECK_HEADERS([errno.h fcntl.h stdio.h unistd.h sys/uio.h])
+AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
+AC_CHECK_HEADERS([sys/un.h], [have_sys_un_h=yes], [have_sys_un_h=no])
+AM_CONDITIONAL([HAVE_SYS_UN_H], test "x$have_sys_un_h" = xyes)
+AC_CONFIG_HEADERS([pgadmin/include/libssh2/libssh2_config.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -64,6 +69,73 @@ CHECK_LIBXML2
 LOCATE_LIBXSLT
 SETUP_LIBXSLT
 
+# Configure parameters
+AC_ARG_WITH(libgcrypt,
+	AC_HELP_STRING([--with-libgcrypt],[Use Libgcrypt for crypto]),
+	use_libgcrypt=$withval,use_libgcrypt=auto)
+AC_ARG_WITH(openssl,
+	AC_HELP_STRING([--with-openssl],[Use OpenSSL for crypto]),
+	use_openssl=$withval,use_openssl=auto)
+AC_ARG_WITH(libz,
+	AC_HELP_STRING([--with-libz],[Use Libz for compression]),
+	use_libz=$withval,use_libz=auto)
+
+# Look for OpenSSL (default)
+if test "$use_openssl" != "no" && test "$use_libgcrypt" != "yes"; then
+	AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include <openssl/ssl.h>])
+	LIBSREQUIRED=libssl,libcrypto
+fi
+
+# Look for libgcrypt
+if test "$ac_cv_libssl" != "yes" && test "$use_libgcrypt" != "no"; then
+	AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
+	LIBSREQUIRED=libgcrypt
+fi
+
+AC_SUBST(LIBSREQUIRED)
+
+if test "$ac_cv_libssl" != "yes" && test "$ac_cv_libgcrypt" != "yes"; then
+	AC_MSG_NOTICE([cannot find OpenSSL or Libgcrypt, try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH])
+	BUILD_SSH_TUNNEL="no"
+else
+	BUILD_SSH_TUNNEL="yes"
+fi
+AM_CONDITIONAL([BUILD_SSH_TUNNEL], [test x$BUILD_SSH_TUNNEL = xyes])
+
+if test "$ac_cv_libssl" = "yes"; then
+	CPPFLAGS="$CPPFLAGS -DHAVE_OPENSSL_CRYPTO"
+	LDFLAGS="$LDFLAGS -lssl -lcrypto"
+fi
+
+if test "$ac_cv_libgcrypt" = "yes"; then
+	CPPFLAGS="$CPPFLAGS -DHAVE_GCRYPT"
+	LDFLAGS="$LDFLAGS -lgcrypt"
+	AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt])
+fi
+AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
+
+# Not all OpenSSL have AES-CTR functions.
+if test "$ac_cv_libssl" = "yes"; then
+	save_LDFLAGS="$LDFLAGS"
+	LDFLAGS="$LDFLAGS $LIBSSL"
+	AC_CHECK_FUNCS(EVP_aes_128_ctr)
+	LDFLAGS="$save_LDFLAGS"
+fi
+
+# Look for Libz
+if test "$use_libz" != "no"; then
+	AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
+	if test "$ac_cv_libz" != yes; then
+		AC_MSG_NOTICE([Cannot find libz, disabling compression])
+		AC_MSG_NOTICE([Try --with-libz-prefix=PATH if you know you have it])
+	else
+		LDFLAGS="$LDFLAGS -lz"
+		AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support])
+	fi
+fi
+
+CURL_CHECK_NONBLOCKING_SOCKET
+
 LOCATE_SPHINX
 AM_CONDITIONAL([SPHINX_BUILD], [test x$SPHINX_BUILD != x])
 
diff --git a/pgadmin/Makefile.am b/pgadmin/Makefile.am
index 572268a..2aaf81e 100644
--- a/pgadmin/Makefile.am
+++ b/pgadmin/Makefile.am
@@ -49,6 +49,7 @@ include gqb/module.mk
 include hotdraw/module.mk
 include ui/module.mk
 include utils/module.mk
+include libssh2/module.mk
 
 if SUN_CC
   __CFLAGS=""
diff --git a/pgadmin/db/pgConn.cpp b/pgadmin/db/pgConn.cpp
index ab97d2e..181fd04 100644
--- a/pgadmin/db/pgConn.cpp
+++ b/pgadmin/db/pgConn.cpp
@@ -652,7 +652,7 @@ wxString pgConn::GetName() const
 	return str;
 }
 
-#ifdef SSL
+#ifdef PG_SSL
 // we don't define USE_SSL so we don't get ssl.h included
 extern "C"
 {
diff --git a/pgadmin/dlg/dlgServer.cpp b/pgadmin/dlg/dlgServer.cpp
index 53eae0e..d58a32f 100644
--- a/pgadmin/dlg/dlgServer.cpp
+++ b/pgadmin/dlg/dlgServer.cpp
@@ -53,7 +53,20 @@
 #define pickerSSLRootCert CTRL_FILEPICKER("pickerSSLRootCert")
 #define pickerSSLCrl      CTRL_FILEPICKER("pickerSSLCrl")
 #define chkSSLCompression CTRL_CHECKBOX("chkSSLCompression")
-
+#define nbNotebook        CTRL_NOTEBOOK("nbNotebook")
+
+// SSH Tunnel Tab
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+#define chkSSHTunnel		 CTRL_CHECKBOX("chkSSHTunnel")
+#define txtTunnelHost		 CTRL_TEXT("txtTunnelHost")
+#define txtTunnelUsername	 CTRL_TEXT("txtTunnelUsername")
+#define radioBtnPassword	 CTRL_RADIOBUTTON("radioBtnPassword")
+#define radioBtnKeyfile      CTRL_RADIOBUTTON("radioBtnKeyfile")
+#define txtTunnelPassword	 CTRL_TEXT("txtTunnelPassword")
+#define pickerPublicKeyFile	 CTRL_FILEPICKER("pickerPublicKeyFile")
+#define pickerIdentityFile	 CTRL_FILEPICKER("pickerIdentityFile")
+#define stPublicKeyFile		 CTRL_STATIC("stPublicKeyFile")
+#endif
 
 BEGIN_EVENT_TABLE(dlgServer, dlgProperty)
 	EVT_NOTEBOOK_PAGE_CHANGED(XRCID("nbNotebook"),     dlgServer::OnPageSelect)
@@ -80,6 +93,13 @@ BEGIN_EVENT_TABLE(dlgServer, dlgProperty)
 	EVT_COMBOBOX(XRCID("cbGroup"),                     dlgProperty::OnChange)
 	EVT_CHECKBOX(XRCID("chkSSLCompression"),           dlgProperty::OnChange)
 	EVT_BUTTON(wxID_OK,                                dlgServer::OnOK)
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	EVT_TEXT(XRCID("txtTunnelHost"),                   dlgProperty::OnChange)
+	EVT_TEXT(XRCID("txtTunnelUsername"),               dlgProperty::OnChange)
+	EVT_CHECKBOX(XRCID("chkSSHTunnel"),                dlgServer::OnCheckSSHTunnel)
+	EVT_RADIOBUTTON(XRCID("radioBtnPassword"),         dlgServer::OnChangeAuthOption)
+	EVT_RADIOBUTTON(XRCID("radioBtnKeyfile"),          dlgServer::OnChangeAuthOption)
+#endif
 END_EVENT_TABLE();
 
 
@@ -134,6 +154,25 @@ dlgServer::dlgServer(pgaFactory *f, frmMain *frame, pgServer *node)
 			groupitem = browser->GetNextChild(browser->GetRootItem(), groupcookie);
 		}
 	}
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	EnableSSHTunnelControls(false);
+	radioBtnPassword->SetValue(true);
+	radioBtnKeyfile->SetValue(false);
+	txtTunnelPassword->SetMaxLength(SSH_MAX_PASSWORD_LEN);
+#ifdef HAVE_OPENSSL_CRYPTO
+	stPublicKeyFile->Show(false);
+	pickerPublicKeyFile->Show(false);
+#endif
+#else
+	for(size_t i = 0; i < nbNotebook->GetPageCount(); i++)
+	{
+		if(nbNotebook->GetPageText(i).compare(wxT("SSH Tunnel")) == 0)
+		{
+			nbNotebook->RemovePage(i);
+		}
+	}
+#endif
 }
 
 
@@ -197,6 +236,15 @@ void dlgServer::OnOK(wxCommandEvent &ev)
 		server->SetSSLRootCert(pickerSSLRootCert->GetPath());
 		server->SetSSLCrl(pickerSSLCrl->GetPath());
 		server->iSetSSLCompression(chkSSLCompression->GetValue());
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		server->iSetSSHTunnel(chkSSHTunnel->GetValue());
+		server->SetTunnelHost(txtTunnelHost->GetValue());
+		server->SetTunnelUserName(txtTunnelUsername->GetValue());
+		server->iSetAuthModePwd(radioBtnPassword->GetValue());
+		server->SetTunnelPassword(txtTunnelPassword->GetValue());
+		server->SetPublicKeyFile(pickerPublicKeyFile->GetPath());
+		server->SetIdentityFile(pickerIdentityFile->GetPath());
+#endif
 		wxColour colour = colourPicker->GetColour();
 		wxString sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
 		server->iSetColour(sColour);
@@ -225,7 +273,18 @@ void dlgServer::OnOK(wxCommandEvent &ev)
 			    server->GetRestore(),
 			    server->GetSSL(),
 			    server->GetColour(),
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+			    server->GetGroup(),
+			    server->GetSSHTunnel(),
+			    server->GetTunnelHost(),
+			    server->GetTunnelUserName(),
+			    server->GetAuthModePwd(),
+			    server->GetTunnelPassword(),
+			    server->GetPublicKeyFile(),
+			    server->GetIdentityFile());
+#else
 			    server->GetGroup());
+#endif
 			newserver->iSetDbRestriction(server->GetDbRestriction().Trim());
 			newserver->iSetServiceID(server->GetServiceID().Trim());
 			newserver->iSetDiscoveryID(server->GetDiscoveryID().Trim());
@@ -366,7 +425,7 @@ int dlgServer::Go(bool modal)
 	cbSSL->Clear();
 	cbSSL->Append(wxT(" "));
 
-#ifdef SSL
+#ifdef PG_SSL
 	cbSSL->Append(_("require"));
 	cbSSL->Append(_("prefer"));
 
@@ -414,6 +473,29 @@ int dlgServer::Go(bool modal)
 
 		chkSSLCompression->SetValue(server->GetSSLCompression());
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		chkSSHTunnel->SetValue(server->GetSSHTunnel());
+		if(server->GetSSHTunnel())
+		{
+			chkStorePwd->SetValue(false);
+			chkStorePwd->Enable(false);
+		}
+		txtTunnelHost->SetValue(server->GetTunnelHost());
+		txtTunnelUsername->SetValue(server->GetTunnelUserName());
+		if (server->GetAuthModePwd())
+		{
+			radioBtnPassword->SetValue(true);
+			radioBtnKeyfile->SetValue(false);
+		}
+		else
+		{
+			radioBtnPassword->SetValue(false);
+			radioBtnKeyfile->SetValue(true);
+		}
+		txtTunnelPassword->SetValue(server->GetTunnelPassword());
+		pickerPublicKeyFile->SetPath(server->GetPublicKeyFile());
+		pickerIdentityFile->SetPath(server->GetIdentityFile());
+#endif
 		stPassword->Disable();
 		txtPassword->Disable();
 		if (connection)
@@ -439,6 +521,19 @@ int dlgServer::Go(bool modal)
 			pickerSSLCrl->Disable();
 			chkSSLCompression->Disable();
 			EnableOK(false);
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+			chkSSHTunnel->Enable(false);
+			EnableSSHTunnelControls(false);
+		}
+		else
+		{
+			if (server->GetSSHTunnel())
+			{
+				chkSSHTunnel->Enable(true);
+				EnableSSHTunnelControls(true);
+				EnableAuthenticationOptions();
+			}
+#endif
 		}
 	}
 	else
@@ -468,13 +563,32 @@ wxString dlgServer::GetPassword()
 pgObject *dlgServer::CreateObject(pgCollection *collection)
 {
 	wxString name = GetName();
+	pgServer *obj = NULL;
 
-	pgServer *obj = new pgServer(GetName(), txtHostAddr->GetValue(), txtDescription->GetValue(),
-	                             txtService->GetValue(), cbDatabase->GetValue(),
-	                             txtUsername->GetValue(), StrToLong(txtPort->GetValue()),
-	                             chkTryConnect->GetValue() && chkStorePwd->GetValue(),
-	                             txtRolename->GetValue(), chkRestore->GetValue(), cbSSL->GetCurrentSelection(),
-	                             colourPicker->GetColourString(), cbGroup->GetValue());
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if (chkSSHTunnel->GetValue())
+	{
+		obj = new pgServer(GetName(), txtHostAddr->GetValue(), txtDescription->GetValue(),
+		                   txtService->GetValue(), cbDatabase->GetValue(),
+		                   txtUsername->GetValue(), StrToLong(txtPort->GetValue()),
+		                   chkTryConnect->GetValue() && chkStorePwd->GetValue(),
+		                   txtRolename->GetValue(), chkRestore->GetValue(), cbSSL->GetCurrentSelection(),
+		                   colourPicker->GetColourString(), cbGroup->GetValue(),
+		                   chkSSHTunnel->GetValue(), txtTunnelHost->GetValue(), txtTunnelUsername->GetValue(),
+		                   radioBtnPassword->GetValue(),
+		                   txtTunnelPassword->GetValue(), pickerPublicKeyFile->GetPath(),
+		                   pickerIdentityFile->GetPath());
+	}
+	else
+#endif
+	{
+		obj = new pgServer(GetName(), txtHostAddr->GetValue(), txtDescription->GetValue(),
+		                   txtService->GetValue(), cbDatabase->GetValue(),
+		                   txtUsername->GetValue(), StrToLong(txtPort->GetValue()),
+		                   chkTryConnect->GetValue() && chkStorePwd->GetValue(),
+		                   txtRolename->GetValue(), chkRestore->GetValue(), cbSSL->GetCurrentSelection(),
+		                   colourPicker->GetColourString(), cbGroup->GetValue());
+	}
 
 	obj->iSetDbRestriction(txtDbRestriction->GetValue().Trim());
 
@@ -543,6 +657,14 @@ void dlgServer::CheckChange()
 	}
 	CheckValid(enable, dbRestrictionOk, _("Restriction not valid."));
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if(chkSSHTunnel->GetValue())
+	{
+		CheckValid(enable, !txtTunnelHost->GetValue().IsEmpty(), _("Please specify ssh tunnel host."));
+		CheckValid(enable, !txtTunnelUsername->GetValue().IsEmpty(), _("Please specify ssh tunnel user name."));
+	}
+#endif
+
 	EnableOK(enable && !connection);
 }
 
@@ -551,3 +673,58 @@ wxString dlgServer::GetSql()
 {
 	return wxEmptyString;
 }
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+
+void dlgServer::OnCheckSSHTunnel(wxCommandEvent &ev)
+{
+	if (chkSSHTunnel->IsChecked())
+	{
+		if(chkStorePwd->GetValue())
+		{
+			wxMessageBox(_("Database passwords cannot be stored when using SSH tunnelling. The 'Store password' option has been turned off."), _("Stored Password"), wxICON_EXCLAMATION | wxOK, this);
+		}
+		chkStorePwd->SetValue(false);
+		chkStorePwd->Enable(false);
+		EnableSSHTunnelControls(true);
+		EnableAuthenticationOptions();
+	}
+	else
+	{
+		chkStorePwd->Enable();
+		EnableSSHTunnelControls(false);
+	}
+
+	CheckChange();
+}
+
+void dlgServer::OnChangeAuthOption(wxCommandEvent &ev)
+{
+	EnableAuthenticationOptions();
+}
+
+void dlgServer::EnableSSHTunnelControls(const bool &bEnable)
+{
+	txtTunnelHost->Enable(bEnable);
+	txtTunnelUsername->Enable(bEnable);
+	pickerPublicKeyFile->Enable(bEnable);
+	pickerIdentityFile->Enable(bEnable);
+	radioBtnPassword->Enable(bEnable);
+	radioBtnKeyfile->Enable(bEnable);
+	txtTunnelPassword->Enable(bEnable);
+}
+
+void dlgServer::EnableAuthenticationOptions()
+{
+	if (radioBtnPassword->GetValue())
+	{
+		pickerIdentityFile->Enable(false);
+		pickerPublicKeyFile->Enable(false);
+	}
+	else
+	{
+		pickerIdentityFile->Enable(true);
+		pickerPublicKeyFile->Enable(true);
+	}
+}
+#endif
diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp
index 0e3313e..ccb47ed 100644
--- a/pgadmin/frm/events.cpp
+++ b/pgadmin/frm/events.cpp
@@ -77,6 +77,11 @@ BEGIN_EVENT_TABLE(frmMain, pgFrame)
 #ifdef __WXGTK__
 	EVT_TREE_KEY_DOWN(CTL_BROWSER,          frmMain::OnTreeKeyDown)
 #endif
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	EVT_COMMAND (wxID_ANY, SSH_TUNNEL_ERROR_EVENT, frmMain::OnSSHTunnelEvent)
+#endif
+
 END_EVENT_TABLE()
 
 void frmMain::OnChildFocus(wxChildFocusEvent &event)
diff --git a/pgadmin/frm/frmMain.cpp b/pgadmin/frm/frmMain.cpp
index b727ccc..76127ad 100644
--- a/pgadmin/frm/frmMain.cpp
+++ b/pgadmin/frm/frmMain.cpp
@@ -85,11 +85,18 @@
 #include "schema/pgCheck.h"
 #include "schema/pgDomain.h"
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+#include "utils/sshTunnel.h"
+#endif
 
 #if wxDIALOG_UNIT_COMPATIBILITY
 #error wxWindows must be compiled with wxDIALOG_UNIT_COMPATIBILITY=0!
 #endif
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+DEFINE_EVENT_TYPE(SSH_TUNNEL_ERROR_EVENT);
+#endif
+
 frmMain::frmMain(const wxString &title)
 	: pgFrame((wxFrame *)NULL, title)
 {
@@ -243,6 +250,14 @@ frmMain::~frmMain()
 
 	if (treeContextMenu)
 		delete treeContextMenu;
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if(pgadminTunnelThread && pgadminTunnelThread->IsAlive())
+	{
+		pgadminTunnelThread->Cleanup();
+		pgadminTunnelThread = NULL;
+	}
+#endif
 }
 
 
@@ -1027,7 +1042,7 @@ int frmMain::ReconnectServer(pgServer *server, bool restore)
 	wxMilliSleep(100);
 	wxSafeYield();
 
-	int res = server->Connect(this, true);
+	int res = server->Connect(this, true, wxEmptyString, false, true);
 
 	// Check the result, and handle it as appropriate
 	wxTreeItemId item;
@@ -1198,7 +1213,14 @@ void frmMain::StoreServers()
 					settings->Write(key + wxT("SSLRootCert"), server->GetSSLRootCert());
 					settings->Write(key + wxT("SSLCrl"), server->GetSSLCrl());
 					settings->WriteBool(key + wxT("SSLCompression"), server->GetSSLCompression());
-
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+					settings->WriteBool(key + wxT("SSHTunnel"), server->GetSSHTunnel());
+					settings->Write(key + wxT("TunnelHost"), server->GetTunnelHost());
+					settings->Write(key + wxT("TunnelUserName"), server->GetTunnelUserName());
+					settings->WriteBool(key + wxT("TunnelModePwd"), server->GetAuthModePwd());
+					settings->Write(key + wxT("PublicKeyFile"), server->GetPublicKeyFile());
+					settings->Write(key + wxT("IdentityFile"), server->GetIdentityFile());
+#endif
 					pgCollection *coll = browser->FindCollection(databaseFactory, server->GetId());
 					if (coll)
 					{
@@ -1346,6 +1368,12 @@ void frmMain::SetItemBackgroundColour(wxTreeItemId item, wxColour colour)
 	}
 }
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+void frmMain::OnSSHTunnelEvent(wxCommandEvent &event)
+{
+	wxLogError(event.GetString());
+}
+#endif
 
 /////////////////////////////////////////
 
diff --git a/pgadmin/include/db/pgConn.h b/pgadmin/include/db/pgConn.h
index 027c300..1a070f5 100644
--- a/pgadmin/include/db/pgConn.h
+++ b/pgadmin/include/db/pgConn.h
@@ -29,7 +29,8 @@ enum
     PGCONN_REFUSED,
     PGCONN_DNSERR,
     PGCONN_ABORTED,     // connect user aborted
-    PGCONN_BROKEN       // tcp/pipe broken
+    PGCONN_BROKEN,       // tcp/pipe broken
+    PGCONN_SSHTUNNEL_ERROR
 };
 
 enum
diff --git a/pgadmin/include/dlg/dlgServer.h b/pgadmin/include/dlg/dlgServer.h
index 0196cdc..d0bdb56 100644
--- a/pgadmin/include/dlg/dlgServer.h
+++ b/pgadmin/include/dlg/dlgServer.h
@@ -47,6 +47,12 @@ private:
 	void OnChangeColour(wxColourPickerEvent &ev);
 	void OnChangeFile(wxFileDirPickerEvent &ev);
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	void OnCheckSSHTunnel(wxCommandEvent &ev);
+	void OnChangeAuthOption(wxCommandEvent &ev);
+	void EnableSSHTunnelControls(const bool &bEnable);
+	void EnableAuthenticationOptions();
+#endif
 	DECLARE_EVENT_TABLE()
 };
 
diff --git a/pgadmin/include/frm/frmMain.h b/pgadmin/include/frm/frmMain.h
index 4dc801b..6b5df8f 100644
--- a/pgadmin/include/frm/frmMain.h
+++ b/pgadmin/include/frm/frmMain.h
@@ -82,6 +82,12 @@ enum
     REFRESH_OBJECT_AND_CHILDREN
 };
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+BEGIN_DECLARE_EVENT_TYPES()
+extern const wxEventType SSH_TUNNEL_ERROR_EVENT;
+END_DECLARE_EVENT_TYPES()
+#endif
+
 // Class declarations
 class frmMain : public pgFrame
 {
@@ -166,6 +172,10 @@ public:
 		m_refreshing = refresh;
 	}
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	void OnSSHTunnelEvent(wxCommandEvent &event);
+#endif
+
 private:
 	wxAuiManager manager;
 	ctlTree *browser;
diff --git a/pgadmin/include/libssh2/Win32/libssh2_config.h b/pgadmin/include/libssh2/Win32/libssh2_config.h
new file mode 100644
index 0000000..4e2ae29
--- /dev/null
+++ b/pgadmin/include/libssh2/Win32/libssh2_config.h
@@ -0,0 +1,42 @@
+#ifndef LIBSSH2_CONFIG_H
+#define LIBSSH2_CONFIG_H
+
+#ifndef WIN32
+#define WIN32
+#endif
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE 1
+#endif /* _CRT_SECURE_NO_DEPRECATE */
+#include <winsock2.h>
+#include <mswsock.h>
+#include <ws2tcpip.h>
+
+#ifdef __MINGW32__
+#define HAVE_UNISTD_H
+#define HAVE_INTTYPES_H
+#define HAVE_SYS_TIME_H
+#define HAVE_GETTIMEOFDAY
+#endif
+
+#define HAVE_WINSOCK2_H
+#define HAVE_IOCTLSOCKET
+#define HAVE_SELECT
+
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#if _MSC_VER < 1500
+#define vsnprintf _vsnprintf
+#endif
+#define strdup _strdup
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+#else
+#define strncasecmp strnicmp
+#define strcasecmp stricmp
+#endif /* _MSC_VER */
+
+/* Enable newer diffie-hellman-group-exchange-sha1 syntax */
+#define LIBSSH2_DH_GEX_NEW 1
+
+#endif /* LIBSSH2_CONFIG_H */
+
diff --git a/pgadmin/include/libssh2/channel.h b/pgadmin/include/libssh2/channel.h
new file mode 100644
index 0000000..dc0ee37
--- /dev/null
+++ b/pgadmin/include/libssh2/channel.h
@@ -0,0 +1,141 @@
+#ifndef __LIBSSH2_CHANNEL_H
+#define __LIBSSH2_CHANNEL_H
+/* Copyright (c) 2008-2010 by Daniel Stenberg
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/*
+ * _libssh2_channel_receive_window_adjust
+ *
+ * Adjust the receive window for a channel by adjustment bytes. If the amount
+ * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
+ * adjustment amount will be queued for a later packet.
+ *
+ * Always non-blocking.
+ */
+int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
+                                           uint32_t adjustment,
+                                           unsigned char force,
+                                           unsigned int *store);
+
+/*
+ * _libssh2_channel_flush
+ *
+ * Flush data from one (or all) stream
+ * Returns number of bytes flushed, or negative on failure
+ */
+int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid);
+
+/*
+ * _libssh2_channel_free
+ *
+ * Make sure a channel is closed, then remove the channel from the session
+ * and free its resource(s)
+ *
+ * Returns 0 on success, negative on failure
+ */
+int _libssh2_channel_free(LIBSSH2_CHANNEL *channel);
+
+int
+_libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode);
+
+/*
+ * _libssh2_channel_write
+ *
+ * Send data to a channel
+ */
+ssize_t
+_libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
+                       const unsigned char *buf, size_t buflen);
+
+/*
+ * _libssh2_channel_open
+ *
+ * Establish a generic session channel
+ */
+LIBSSH2_CHANNEL *
+_libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type,
+                      uint32_t channel_type_len,
+                      uint32_t window_size,
+                      uint32_t packet_size,
+                      const unsigned char *message, size_t message_len);
+
+
+/*
+ * _libssh2_channel_process_startup
+ *
+ * Primitive for libssh2_channel_(shell|exec|subsystem)
+ */
+int
+_libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
+                                 const char *request, size_t request_len,
+                                 const char *message, size_t message_len);
+
+/*
+ * _libssh2_channel_read
+ *
+ * Read data from a channel
+ *
+ * It is important to not return 0 until the currently read channel is
+ * complete. If we read stuff from the wire but it was no payload data to fill
+ * in the buffer with, we MUST make sure to return PACKET_EAGAIN.
+ */
+ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
+                              char *buf, size_t buflen);
+
+uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION * session);
+
+LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION * session,
+                                         uint32_t channel_id);
+
+size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel,
+                                        int stream_id);
+
+int _libssh2_channel_close(LIBSSH2_CHANNEL * channel);
+
+/*
+ * _libssh2_channel_forward_cancel
+ *
+ * Stop listening on a remote port and free the listener
+ * Toss out any pending (un-accept()ed) connections
+ *
+ * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error
+ */
+int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
+
+#endif /* __LIBSSH2_CHANNEL_H */
+
diff --git a/pgadmin/include/libssh2/comp.h b/pgadmin/include/libssh2/comp.h
new file mode 100644
index 0000000..8edc150
--- /dev/null
+++ b/pgadmin/include/libssh2/comp.h
@@ -0,0 +1,45 @@
+#ifndef __LIBSSH2_COMP_H
+#define __LIBSSH2_COMP_H
+
+/* Copyright (C) 2009-2010 by Daniel Stenberg
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+#include "libssh2_priv.h"
+
+const LIBSSH2_COMP_METHOD **_libssh2_comp_methods(LIBSSH2_SESSION *session);
+
+#endif /* __LIBSSH2_COMP_H */
diff --git a/pgadmin/include/libssh2/crypto.h b/pgadmin/include/libssh2/crypto.h
new file mode 100644
index 0000000..fb576b6
--- /dev/null
+++ b/pgadmin/include/libssh2/crypto.h
@@ -0,0 +1,120 @@
+/* Copyright (C) 2009, 2010 Simon Josefsson
+ * Copyright (C) 2006, 2007 The Written Word, Inc.  All rights reserved.
+ * Copyright (C) 2010 Daniel Stenberg
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+#ifndef LIBSSH2_CRYPTO_H
+#define LIBSSH2_CRYPTO_H
+
+#ifdef LIBSSH2_LIBGCRYPT
+#include "libgcrypt.h"
+#else
+#include "openssl.h"
+#endif
+
+int _libssh2_rsa_new(libssh2_rsa_ctx ** rsa,
+                     const unsigned char *edata,
+                     unsigned long elen,
+                     const unsigned char *ndata,
+                     unsigned long nlen,
+                     const unsigned char *ddata,
+                     unsigned long dlen,
+                     const unsigned char *pdata,
+                     unsigned long plen,
+                     const unsigned char *qdata,
+                     unsigned long qlen,
+                     const unsigned char *e1data,
+                     unsigned long e1len,
+                     const unsigned char *e2data,
+                     unsigned long e2len,
+                     const unsigned char *coeffdata, unsigned long coefflen);
+int _libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa,
+                             LIBSSH2_SESSION * session,
+                             const char *filename,
+                             unsigned const char *passphrase);
+int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa,
+                             const unsigned char *sig,
+                             unsigned long sig_len,
+                             const unsigned char *m, unsigned long m_len);
+int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session,
+                           libssh2_rsa_ctx * rsactx,
+                           const unsigned char *hash,
+                           size_t hash_len,
+                           unsigned char **signature,
+                           size_t *signature_len);
+
+#if LIBSSH2_DSA
+int _libssh2_dsa_new(libssh2_dsa_ctx ** dsa,
+                     const unsigned char *pdata,
+                     unsigned long plen,
+                     const unsigned char *qdata,
+                     unsigned long qlen,
+                     const unsigned char *gdata,
+                     unsigned long glen,
+                     const unsigned char *ydata,
+                     unsigned long ylen,
+                     const unsigned char *x, unsigned long x_len);
+int _libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa,
+                             LIBSSH2_SESSION * session,
+                             const char *filename,
+                             unsigned const char *passphrase);
+int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx * dsactx,
+                             const unsigned char *sig,
+                             const unsigned char *m, unsigned long m_len);
+int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx,
+                           const unsigned char *hash,
+                           unsigned long hash_len, unsigned char *sig);
+#endif
+
+int _libssh2_cipher_init(_libssh2_cipher_ctx * h,
+                         _libssh2_cipher_type(algo),
+                         unsigned char *iv,
+                         unsigned char *secret, int encrypt);
+
+int _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx,
+                          _libssh2_cipher_type(algo),
+                          int encrypt, unsigned char *block, size_t blocksize);
+
+int _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
+                              unsigned char **method,
+                              size_t *method_len,
+                              unsigned char **pubkeydata,
+                              size_t *pubkeydata_len,
+                              const char *privatekey,
+                              const char *passphrase);
+
+void _libssh2_init_aes_ctr(void);
+
+#endif
diff --git a/pgadmin/include/libssh2/libgcrypt.h b/pgadmin/include/libssh2/libgcrypt.h
new file mode 100644
index 0000000..1f0276e
--- /dev/null
+++ b/pgadmin/include/libssh2/libgcrypt.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2008, 2009, 2010 Simon Josefsson
+ * Copyright (C) 2006, 2007, The Written Word, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include <gcrypt.h>
+
+#define LIBSSH2_MD5 1
+
+#define LIBSSH2_HMAC_RIPEMD 1
+
+#define LIBSSH2_AES 1
+#define LIBSSH2_AES_CTR 1
+#define LIBSSH2_BLOWFISH 1
+#define LIBSSH2_RC4 1
+#define LIBSSH2_CAST 1
+#define LIBSSH2_3DES 1
+
+#define LIBSSH2_RSA 1
+#define LIBSSH2_DSA 1
+
+#define MD5_DIGEST_LENGTH 16
+#define SHA_DIGEST_LENGTH 20
+
+#define _libssh2_random(buf, len)                \
+  (gcry_randomize ((buf), (len), GCRY_STRONG_RANDOM), 1)
+
+#define libssh2_sha1_ctx gcry_md_hd_t
+#define libssh2_sha1_init(ctx) gcry_md_open (ctx,  GCRY_MD_SHA1, 0);
+#define libssh2_sha1_update(ctx, data, len) gcry_md_write (ctx, data, len)
+#define libssh2_sha1_final(ctx, out) \
+  memcpy (out, gcry_md_read (ctx, 0), SHA_DIGEST_LENGTH), gcry_md_close (ctx)
+#define libssh2_sha1(message, len, out) \
+  gcry_md_hash_buffer (GCRY_MD_SHA1, out, message, len)
+
+#define libssh2_md5_ctx gcry_md_hd_t
+
+/* returns 0 in case of failure */
+#define libssh2_md5_init(ctx) \
+  (GPG_ERR_NO_ERROR == gcry_md_open (ctx,  GCRY_MD_MD5, 0))
+
+#define libssh2_md5_update(ctx, data, len) gcry_md_write (ctx, data, len)
+#define libssh2_md5_final(ctx, out) \
+  memcpy (out, gcry_md_read (ctx, 0), MD5_DIGEST_LENGTH), gcry_md_close (ctx)
+#define libssh2_md5(message, len, out) \
+  gcry_md_hash_buffer (GCRY_MD_MD5, out, message, len)
+
+#define libssh2_hmac_ctx gcry_md_hd_t
+#define libssh2_hmac_sha1_init(ctx, key, keylen) \
+  gcry_md_open (ctx, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC), \
+    gcry_md_setkey (*ctx, key, keylen)
+#define libssh2_hmac_md5_init(ctx, key, keylen) \
+  gcry_md_open (ctx, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC), \
+    gcry_md_setkey (*ctx, key, keylen)
+#define libssh2_hmac_ripemd160_init(ctx, key, keylen) \
+  gcry_md_open (ctx, GCRY_MD_RMD160, GCRY_MD_FLAG_HMAC), \
+    gcry_md_setkey (*ctx, key, keylen)
+#define libssh2_hmac_update(ctx, data, datalen) \
+  gcry_md_write (ctx, data, datalen)
+#define libssh2_hmac_final(ctx, data) \
+  memcpy (data, gcry_md_read (ctx, 0), \
+      gcry_md_get_algo_dlen (gcry_md_get_algo (ctx)))
+#define libssh2_hmac_cleanup(ctx) gcry_md_close (*ctx);
+
+#define libssh2_crypto_init() gcry_control (GCRYCTL_DISABLE_SECMEM)
+#define libssh2_crypto_exit()
+
+#define libssh2_rsa_ctx struct gcry_sexp
+
+#define _libssh2_rsa_free(rsactx)  gcry_sexp_release (rsactx)
+
+#define libssh2_dsa_ctx struct gcry_sexp
+
+#define _libssh2_dsa_free(dsactx)  gcry_sexp_release (dsactx)
+
+#define _libssh2_cipher_type(name) int name
+#define _libssh2_cipher_ctx gcry_cipher_hd_t
+
+#define _libssh2_gcry_ciphermode(c,m) ((c << 8) | m)
+#define _libssh2_gcry_cipher(c) (c >> 8)
+#define _libssh2_gcry_mode(m) (m & 0xFF)
+
+#define _libssh2_cipher_aes256ctr \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CTR)
+#define _libssh2_cipher_aes192ctr \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CTR)
+#define _libssh2_cipher_aes128ctr \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR)
+#define _libssh2_cipher_aes256 \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC)
+#define _libssh2_cipher_aes192 \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CBC)
+#define _libssh2_cipher_aes128 \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC)
+#define _libssh2_cipher_blowfish \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CBC)
+#define _libssh2_cipher_arcfour \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM)
+#define _libssh2_cipher_cast5 \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_CAST5, GCRY_CIPHER_MODE_CBC)
+#define _libssh2_cipher_3des \
+  _libssh2_gcry_ciphermode(GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC)
+
+
+#define _libssh2_cipher_dtor(ctx) gcry_cipher_close(*(ctx))
+
+#define _libssh2_bn struct gcry_mpi
+#define _libssh2_bn_ctx int
+#define _libssh2_bn_ctx_new() 0
+#define _libssh2_bn_ctx_free(bnctx) ((void)0)
+#define _libssh2_bn_init() gcry_mpi_new(0)
+#define _libssh2_bn_rand(bn, bits, top, bottom) gcry_mpi_randomize (bn, bits, GCRY_WEAK_RANDOM)
+#define _libssh2_bn_mod_exp(r, a, p, m, ctx) gcry_mpi_powm (r, a, p, m)
+#define _libssh2_bn_set_word(bn, val) gcry_mpi_set_ui(bn, val)
+#define _libssh2_bn_from_bin(bn, len, val) gcry_mpi_scan(&((bn)), GCRYMPI_FMT_USG, val, len, NULL)
+#define _libssh2_bn_to_bin(bn, val) gcry_mpi_print (GCRYMPI_FMT_USG, val, _libssh2_bn_bytes(bn), NULL, bn)
+#define _libssh2_bn_bytes(bn) (gcry_mpi_get_nbits (bn) / 8 + ((gcry_mpi_get_nbits (bn) % 8 == 0) ? 0 : 1))
+#define _libssh2_bn_bits(bn) gcry_mpi_get_nbits (bn)
+#define _libssh2_bn_free(bn) gcry_mpi_release(bn)
+
diff --git a/pgadmin/include/libssh2/libssh2.h b/pgadmin/include/libssh2/libssh2.h
new file mode 100644
index 0000000..9b1a6e1
--- /dev/null
+++ b/pgadmin/include/libssh2/libssh2.h
@@ -0,0 +1,1189 @@
+/* Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2012 Daniel Stenberg
+ * Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef LIBSSH2_H
+#define LIBSSH2_H 1
+
+#define LIBSSH2_COPYRIGHT "2004-2012 The libssh2 project and its contributors."
+
+/* We use underscore instead of dash when appending DEV in dev versions just
+   to make the BANNER define (used by src/session.c) be a valid SSH
+   banner. Release versions have no appended strings and may of course not
+   have dashes either. */
+#define LIBSSH2_VERSION "1.4.3"
+
+/* The numeric version number is also available "in parts" by using these
+   defines: */
+#define LIBSSH2_VERSION_MAJOR 1
+#define LIBSSH2_VERSION_MINOR 4
+#define LIBSSH2_VERSION_PATCH 3
+
+/* This is the numeric version of the libssh2 version number, meant for easier
+   parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will
+   always follow this syntax:
+
+         0xXXYYZZ
+
+   Where XX, YY and ZZ are the main version, release and patch numbers in
+   hexadecimal (using 8 bits each). All three numbers are always represented
+   using two digits.  1.2 would appear as "0x010200" while version 9.11.7
+   appears as "0x090b07".
+
+   This 6-digit (24 bits) hexadecimal number does not show pre-release number,
+   and it is always a greater number in a more recent release. It makes
+   comparisons with greater than and less than work.
+*/
+#define LIBSSH2_VERSION_NUM 0x010403
+
+/*
+ * This is the date and time when the full source package was created. The
+ * timestamp is not stored in the source code repo, as the timestamp is
+ * properly set in the tarballs by the maketgz script.
+ *
+ * The format of the date should follow this template:
+ *
+ * "Mon Feb 12 11:35:33 UTC 2007"
+ */
+#define LIBSSH2_TIMESTAMP "Tue Nov 27 21:45:20 UTC 2012"
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef _WIN32
+# include <basetsd.h>
+# include <winsock2.h>
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Allow alternate API prefix from CFLAGS or calling app */
+#ifndef LIBSSH2_API
+# ifdef LIBSSH2_WIN32
+#  ifdef LIBSSH2_LIBRARY
+#   define LIBSSH2_API __declspec(dllexport)
+#  else
+#   define LIBSSH2_API __declspec(dllimport)
+#  endif /* LIBSSH2_LIBRARY */
+# else /* !LIBSSH2_WIN32 */
+#  define LIBSSH2_API
+# endif /* LIBSSH2_WIN32 */
+#endif /* LIBSSH2_API */
+
+#if defined(LIBSSH2_DARWIN)
+# include <sys/uio.h>
+#endif
+
+#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
+# include <sys/bsdskt.h>
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+#endif
+
+#ifdef _MSC_VER
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef unsigned __int64 libssh2_uint64_t;
+typedef __int64 libssh2_int64_t;
+#ifndef ssize_t
+typedef SSIZE_T ssize_t;
+#endif
+#else
+typedef unsigned long long libssh2_uint64_t;
+typedef long long libssh2_int64_t;
+#endif
+
+#ifdef WIN32
+typedef SOCKET libssh2_socket_t;
+#define LIBSSH2_INVALID_SOCKET INVALID_SOCKET
+#else /* !WIN32 */
+typedef int libssh2_socket_t;
+#define LIBSSH2_INVALID_SOCKET -1
+#endif /* WIN32 */
+
+/* Part of every banner, user specified or not */
+#define LIBSSH2_SSH_BANNER                  "SSH-2.0-libssh2_" LIBSSH2_VERSION
+
+/* We *could* add a comment here if we so chose */
+#define LIBSSH2_SSH_DEFAULT_BANNER                  LIBSSH2_SSH_BANNER
+#define LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF        LIBSSH2_SSH_DEFAULT_BANNER "\r\n"
+
+/* Default generate and safe prime sizes for diffie-hellman-group-exchange-sha1 */
+#define LIBSSH2_DH_GEX_MINGROUP     1024
+#define LIBSSH2_DH_GEX_OPTGROUP     1536
+#define LIBSSH2_DH_GEX_MAXGROUP     2048
+
+/* Defaults for pty requests */
+#define LIBSSH2_TERM_WIDTH      80
+#define LIBSSH2_TERM_HEIGHT     24
+#define LIBSSH2_TERM_WIDTH_PX   0
+#define LIBSSH2_TERM_HEIGHT_PX  0
+
+/* 1/4 second */
+#define LIBSSH2_SOCKET_POLL_UDELAY      250000
+/* 0.25 * 120 == 30 seconds */
+#define LIBSSH2_SOCKET_POLL_MAXLOOPS    120
+
+/* Maximum size to allow a payload to compress to, plays it safe by falling
+   short of spec limits */
+#define LIBSSH2_PACKET_MAXCOMP      32000
+
+/* Maximum size to allow a payload to deccompress to, plays it safe by
+   allowing more than spec requires */
+#define LIBSSH2_PACKET_MAXDECOMP    40000
+
+/* Maximum size for an inbound compressed payload, plays it safe by
+   overshooting spec limits */
+#define LIBSSH2_PACKET_MAXPAYLOAD   40000
+
+/* Malloc callbacks */
+#define LIBSSH2_ALLOC_FUNC(name)   void *name(size_t count, void **abstract)
+#define LIBSSH2_REALLOC_FUNC(name) void *name(void *ptr, size_t count, \
+                                              void **abstract)
+#define LIBSSH2_FREE_FUNC(name)    void name(void *ptr, void **abstract)
+
+typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT
+{
+    char* text;
+    unsigned int length;
+    unsigned char echo;
+} LIBSSH2_USERAUTH_KBDINT_PROMPT;
+
+typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
+{
+    char* text;
+    unsigned int length;
+} LIBSSH2_USERAUTH_KBDINT_RESPONSE;
+
+/* 'publickey' authentication callback */
+#define LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC(name) \
+  int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, \
+           const unsigned char *data, size_t data_len, void **abstract)
+
+/* 'keyboard-interactive' authentication callback */
+#define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \
+ void name_(const char* name, int name_len, const char* instruction, \
+            int instruction_len, int num_prompts, \
+            const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts, \
+            LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses, void **abstract)
+
+/* Callbacks for special SSH packets */
+#define LIBSSH2_IGNORE_FUNC(name) \
+ void name(LIBSSH2_SESSION *session, const char *message, int message_len, \
+           void **abstract)
+
+#define LIBSSH2_DEBUG_FUNC(name) \
+ void name(LIBSSH2_SESSION *session, int always_display, const char *message, \
+           int message_len, const char *language, int language_len, \
+           void **abstract)
+
+#define LIBSSH2_DISCONNECT_FUNC(name) \
+ void name(LIBSSH2_SESSION *session, int reason, const char *message, \
+           int message_len, const char *language, int language_len, \
+           void **abstract)
+
+#define LIBSSH2_PASSWD_CHANGEREQ_FUNC(name) \
+ void name(LIBSSH2_SESSION *session, char **newpw, int *newpw_len, \
+           void **abstract)
+
+#define LIBSSH2_MACERROR_FUNC(name) \
+ int name(LIBSSH2_SESSION *session, const char *packet, int packet_len, \
+          void **abstract)
+
+#define LIBSSH2_X11_OPEN_FUNC(name) \
+ void name(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel, \
+           const char *shost, int sport, void **abstract)
+
+#define LIBSSH2_CHANNEL_CLOSE_FUNC(name) \
+  void name(LIBSSH2_SESSION *session, void **session_abstract, \
+            LIBSSH2_CHANNEL *channel, void **channel_abstract)
+
+/* I/O callbacks */
+#define LIBSSH2_RECV_FUNC(name)  ssize_t name(libssh2_socket_t socket, \
+                                              void *buffer, size_t length, \
+                                              int flags, void **abstract)
+#define LIBSSH2_SEND_FUNC(name)  ssize_t name(libssh2_socket_t socket, \
+                                              const void *buffer, size_t length,\
+                                              int flags, void **abstract)
+
+/* libssh2_session_callback_set() constants */
+#define LIBSSH2_CALLBACK_IGNORE             0
+#define LIBSSH2_CALLBACK_DEBUG              1
+#define LIBSSH2_CALLBACK_DISCONNECT         2
+#define LIBSSH2_CALLBACK_MACERROR           3
+#define LIBSSH2_CALLBACK_X11                4
+#define LIBSSH2_CALLBACK_SEND               5
+#define LIBSSH2_CALLBACK_RECV               6
+
+/* libssh2_session_method_pref() constants */
+#define LIBSSH2_METHOD_KEX          0
+#define LIBSSH2_METHOD_HOSTKEY      1
+#define LIBSSH2_METHOD_CRYPT_CS     2
+#define LIBSSH2_METHOD_CRYPT_SC     3
+#define LIBSSH2_METHOD_MAC_CS       4
+#define LIBSSH2_METHOD_MAC_SC       5
+#define LIBSSH2_METHOD_COMP_CS      6
+#define LIBSSH2_METHOD_COMP_SC      7
+#define LIBSSH2_METHOD_LANG_CS      8
+#define LIBSSH2_METHOD_LANG_SC      9
+
+/* flags */
+#define LIBSSH2_FLAG_SIGPIPE        1
+#define LIBSSH2_FLAG_COMPRESS       2
+
+typedef struct _LIBSSH2_SESSION                     LIBSSH2_SESSION;
+typedef struct _LIBSSH2_CHANNEL                     LIBSSH2_CHANNEL;
+typedef struct _LIBSSH2_LISTENER                    LIBSSH2_LISTENER;
+typedef struct _LIBSSH2_KNOWNHOSTS                  LIBSSH2_KNOWNHOSTS;
+typedef struct _LIBSSH2_AGENT                       LIBSSH2_AGENT;
+
+typedef struct _LIBSSH2_POLLFD {
+    unsigned char type; /* LIBSSH2_POLLFD_* below */
+
+    union {
+        int socket; /* File descriptors -- examined with system select() call */
+        LIBSSH2_CHANNEL *channel; /* Examined by checking internal state */
+        LIBSSH2_LISTENER *listener; /* Read polls only -- are inbound
+                                       connections waiting to be accepted? */
+    } fd;
+
+    unsigned long events; /* Requested Events */
+    unsigned long revents; /* Returned Events */
+} LIBSSH2_POLLFD;
+
+/* Poll FD Descriptor Types */
+#define LIBSSH2_POLLFD_SOCKET       1
+#define LIBSSH2_POLLFD_CHANNEL      2
+#define LIBSSH2_POLLFD_LISTENER     3
+
+/* Note: Win32 Doesn't actually have a poll() implementation, so some of these
+   values are faked with select() data */
+/* Poll FD events/revents -- Match sys/poll.h where possible */
+#define LIBSSH2_POLLFD_POLLIN           0x0001 /* Data available to be read or
+                                                  connection available --
+                                                  All */
+#define LIBSSH2_POLLFD_POLLPRI          0x0002 /* Priority data available to
+                                                  be read -- Socket only */
+#define LIBSSH2_POLLFD_POLLEXT          0x0002 /* Extended data available to
+                                                  be read -- Channel only */
+#define LIBSSH2_POLLFD_POLLOUT          0x0004 /* Can may be written --
+                                                  Socket/Channel */
+/* revents only */
+#define LIBSSH2_POLLFD_POLLERR          0x0008 /* Error Condition -- Socket */
+#define LIBSSH2_POLLFD_POLLHUP          0x0010 /* HangUp/EOF -- Socket */
+#define LIBSSH2_POLLFD_SESSION_CLOSED   0x0010 /* Session Disconnect */
+#define LIBSSH2_POLLFD_POLLNVAL         0x0020 /* Invalid request -- Socket
+                                                  Only */
+#define LIBSSH2_POLLFD_POLLEX           0x0040 /* Exception Condition --
+                                                  Socket/Win32 */
+#define LIBSSH2_POLLFD_CHANNEL_CLOSED   0x0080 /* Channel Disconnect */
+#define LIBSSH2_POLLFD_LISTENER_CLOSED  0x0080 /* Listener Disconnect */
+
+#define HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
+/* Block Direction Types */
+#define LIBSSH2_SESSION_BLOCK_INBOUND                  0x0001
+#define LIBSSH2_SESSION_BLOCK_OUTBOUND                 0x0002
+
+/* Hash Types */
+#define LIBSSH2_HOSTKEY_HASH_MD5                            1
+#define LIBSSH2_HOSTKEY_HASH_SHA1                           2
+
+/* Hostkey Types */
+#define LIBSSH2_HOSTKEY_TYPE_UNKNOWN			    0
+#define LIBSSH2_HOSTKEY_TYPE_RSA			    1
+#define LIBSSH2_HOSTKEY_TYPE_DSS			    2
+
+/* Disconnect Codes (defined by SSH protocol) */
+#define SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT          1
+#define SSH_DISCONNECT_PROTOCOL_ERROR                       2
+#define SSH_DISCONNECT_KEY_EXCHANGE_FAILED                  3
+#define SSH_DISCONNECT_RESERVED                             4
+#define SSH_DISCONNECT_MAC_ERROR                            5
+#define SSH_DISCONNECT_COMPRESSION_ERROR                    6
+#define SSH_DISCONNECT_SERVICE_NOT_AVAILABLE                7
+#define SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED       8
+#define SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE              9
+#define SSH_DISCONNECT_CONNECTION_LOST                      10
+#define SSH_DISCONNECT_BY_APPLICATION                       11
+#define SSH_DISCONNECT_TOO_MANY_CONNECTIONS                 12
+#define SSH_DISCONNECT_AUTH_CANCELLED_BY_USER               13
+#define SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE       14
+#define SSH_DISCONNECT_ILLEGAL_USER_NAME                    15
+
+/* Error Codes (defined by libssh2) */
+#define LIBSSH2_ERROR_NONE                      0
+
+/* The library once used -1 as a generic error return value on numerous places
+   through the code, which subsequently was converted to
+   LIBSSH2_ERROR_SOCKET_NONE uses over time. As this is a generic error code,
+   the goal is to never ever return this code but instead make sure that a
+   more accurate and descriptive error code is used. */
+#define LIBSSH2_ERROR_SOCKET_NONE               -1
+
+#define LIBSSH2_ERROR_BANNER_RECV               -2
+#define LIBSSH2_ERROR_BANNER_SEND               -3
+#define LIBSSH2_ERROR_INVALID_MAC               -4
+#define LIBSSH2_ERROR_KEX_FAILURE               -5
+#define LIBSSH2_ERROR_ALLOC                     -6
+#define LIBSSH2_ERROR_SOCKET_SEND               -7
+#define LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE      -8
+#define LIBSSH2_ERROR_TIMEOUT                   -9
+#define LIBSSH2_ERROR_HOSTKEY_INIT              -10
+#define LIBSSH2_ERROR_HOSTKEY_SIGN              -11
+#define LIBSSH2_ERROR_DECRYPT                   -12
+#define LIBSSH2_ERROR_SOCKET_DISCONNECT         -13
+#define LIBSSH2_ERROR_PROTO                     -14
+#define LIBSSH2_ERROR_PASSWORD_EXPIRED          -15
+#define LIBSSH2_ERROR_FILE                      -16
+#define LIBSSH2_ERROR_METHOD_NONE               -17
+#define LIBSSH2_ERROR_AUTHENTICATION_FAILED     -18
+#define LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED    LIBSSH2_ERROR_AUTHENTICATION_FAILED
+#define LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED      -19
+#define LIBSSH2_ERROR_CHANNEL_OUTOFORDER        -20
+#define LIBSSH2_ERROR_CHANNEL_FAILURE           -21
+#define LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED    -22
+#define LIBSSH2_ERROR_CHANNEL_UNKNOWN           -23
+#define LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED   -24
+#define LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED   -25
+#define LIBSSH2_ERROR_CHANNEL_CLOSED            -26
+#define LIBSSH2_ERROR_CHANNEL_EOF_SENT          -27
+#define LIBSSH2_ERROR_SCP_PROTOCOL              -28
+#define LIBSSH2_ERROR_ZLIB                      -29
+#define LIBSSH2_ERROR_SOCKET_TIMEOUT            -30
+#define LIBSSH2_ERROR_SFTP_PROTOCOL             -31
+#define LIBSSH2_ERROR_REQUEST_DENIED            -32
+#define LIBSSH2_ERROR_METHOD_NOT_SUPPORTED      -33
+#define LIBSSH2_ERROR_INVAL                     -34
+#define LIBSSH2_ERROR_INVALID_POLL_TYPE         -35
+#define LIBSSH2_ERROR_PUBLICKEY_PROTOCOL        -36
+#define LIBSSH2_ERROR_EAGAIN                    -37
+#define LIBSSH2_ERROR_BUFFER_TOO_SMALL          -38
+#define LIBSSH2_ERROR_BAD_USE                   -39
+#define LIBSSH2_ERROR_COMPRESS                  -40
+#define LIBSSH2_ERROR_OUT_OF_BOUNDARY           -41
+#define LIBSSH2_ERROR_AGENT_PROTOCOL            -42
+#define LIBSSH2_ERROR_SOCKET_RECV               -43
+#define LIBSSH2_ERROR_ENCRYPT                   -44
+#define LIBSSH2_ERROR_BAD_SOCKET                -45
+#define LIBSSH2_ERROR_KNOWN_HOSTS               -46
+
+/* this is a define to provide the old (<= 1.2.7) name */
+#define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV
+
+/* Global API */
+#define LIBSSH2_INIT_NO_CRYPTO        0x0001
+
+/*
+ * libssh2_init()
+ *
+ * Initialize the libssh2 functions.  This typically initialize the
+ * crypto library.  It uses a global state, and is not thread safe --
+ * you must make sure this function is not called concurrently.
+ *
+ * Flags can be:
+ * 0:                              Normal initialize
+ * LIBSSH2_INIT_NO_CRYPTO:         Do not initialize the crypto library (ie.
+ *                                 OPENSSL_add_cipher_algoritms() for OpenSSL
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int libssh2_init(int flags);
+
+/*
+ * libssh2_exit()
+ *
+ * Exit the libssh2 functions and free's all memory used internal.
+ */
+LIBSSH2_API void libssh2_exit(void);
+
+/*
+ * libssh2_free()
+ *
+ * Deallocate memory allocated by earlier call to libssh2 functions.
+ */
+LIBSSH2_API void libssh2_free(LIBSSH2_SESSION *session, void *ptr);
+
+/*
+ * libssh2_session_supported_algs()
+ *
+ * Fills algs with a list of supported acryptographic algorithms. Returns a
+ * non-negative number (number of supported algorithms) on success or a
+ * negative number (an eror code) on failure.
+ *
+ * NOTE: on success, algs must be deallocated (by calling libssh2_free) when
+ * not needed anymore
+ */
+LIBSSH2_API int libssh2_session_supported_algs(LIBSSH2_SESSION* session,
+                                               int method_type,
+                                               const char*** algs);
+
+/* Session API */
+LIBSSH2_API LIBSSH2_SESSION *
+libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
+                        LIBSSH2_FREE_FUNC((*my_free)),
+                        LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract);
+#define libssh2_session_init() libssh2_session_init_ex(NULL, NULL, NULL, NULL)
+
+LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session);
+
+LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session,
+                                               int cbtype, void *callback);
+LIBSSH2_API int libssh2_session_banner_set(LIBSSH2_SESSION *session,
+                                           const char *banner);
+LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session,
+                                   const char *banner);
+
+LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int sock);
+LIBSSH2_API int libssh2_session_handshake(LIBSSH2_SESSION *session,
+                                          libssh2_socket_t sock);
+LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session,
+                                              int reason,
+                                              const char *description,
+                                              const char *lang);
+#define libssh2_session_disconnect(session, description) \
+  libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, \
+                                (description), "")
+
+LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session);
+
+LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session,
+                                             int hash_type);
+
+LIBSSH2_API const char *libssh2_session_hostkey(LIBSSH2_SESSION *session,
+                                                size_t *len, int *type);
+
+LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session,
+                                            int method_type,
+                                            const char *prefs);
+LIBSSH2_API const char *libssh2_session_methods(LIBSSH2_SESSION *session,
+                                                int method_type);
+LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session,
+                                           char **errmsg,
+                                           int *errmsg_len, int want_buf);
+LIBSSH2_API int libssh2_session_last_errno(LIBSSH2_SESSION *session);
+LIBSSH2_API int libssh2_session_block_directions(LIBSSH2_SESSION *session);
+
+LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag,
+                                     int value);
+LIBSSH2_API const char *libssh2_session_banner_get(LIBSSH2_SESSION *session);
+
+/* Userauth API */
+LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session,
+                                        const char *username,
+                                        unsigned int username_len);
+LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
+
+LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session,
+                                             const char *username,
+                                             unsigned int username_len,
+                                             const char *password,
+                                             unsigned int password_len,
+                                             LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
+
+#define libssh2_userauth_password(session, username, password) \
+ libssh2_userauth_password_ex((session), (username), strlen(username), \
+                              (password), strlen(password), NULL)
+
+LIBSSH2_API int
+libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
+                                       const char *username,
+                                       unsigned int username_len,
+                                       const char *publickey,
+                                       const char *privatekey,
+                                       const char *passphrase);
+
+#define libssh2_userauth_publickey_fromfile(session, username, publickey, \
+                                            privatekey, passphrase)     \
+  libssh2_userauth_publickey_fromfile_ex((session), (username), \
+                                         strlen(username), (publickey), \
+                                         (privatekey), (passphrase))
+
+LIBSSH2_API int
+libssh2_userauth_publickey(LIBSSH2_SESSION *session,
+                           const char *username,
+                           const unsigned char *pubkeydata,
+                           size_t pubkeydata_len,
+                           LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)),
+                           void **abstract);
+
+LIBSSH2_API int
+libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session,
+                                       const char *username,
+                                       unsigned int username_len,
+                                       const char *publickey,
+                                       const char *privatekey,
+                                       const char *passphrase,
+                                       const char *hostname,
+                                       unsigned int hostname_len,
+                                       const char *local_username,
+                                       unsigned int local_username_len);
+
+#define libssh2_userauth_hostbased_fromfile(session, username, publickey, \
+                                            privatekey, passphrase, hostname) \
+ libssh2_userauth_hostbased_fromfile_ex((session), (username), \
+                                        strlen(username), (publickey), \
+                                        (privatekey), (passphrase), \
+                                        (hostname), strlen(hostname), \
+                                        (username), strlen(username))
+
+/*
+ * response_callback is provided with filled by library prompts array,
+ * but client must allocate and fill individual responses. Responses
+ * array is already allocated. Responses data will be freed by libssh2
+ * after callback return, but before subsequent callback invokation.
+ */
+LIBSSH2_API int
+libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION* session,
+                                         const char *username,
+                                         unsigned int username_len,
+                                         LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)));
+
+#define libssh2_userauth_keyboard_interactive(session, username, \
+                                              response_callback) \
+ libssh2_userauth_keyboard_interactive_ex((session), (username), \
+                                          strlen(username), (response_callback))
+
+LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds,
+                             long timeout);
+
+/* Channel API */
+#define LIBSSH2_CHANNEL_WINDOW_DEFAULT  (256*1024)
+#define LIBSSH2_CHANNEL_PACKET_DEFAULT  32768
+#define LIBSSH2_CHANNEL_MINADJUST       1024
+
+/* Extended Data Handling */
+#define LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL        0
+#define LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE        1
+#define LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE         2
+
+#define SSH_EXTENDED_DATA_STDERR 1
+
+/* Returned by any function that would block during a read/write opperation */
+#define LIBSSH2CHANNEL_EAGAIN LIBSSH2_ERROR_EAGAIN
+
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type,
+                        unsigned int channel_type_len,
+                        unsigned int window_size, unsigned int packet_size,
+                        const char *message, unsigned int message_len);
+
+#define libssh2_channel_open_session(session) \
+  libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \
+                          LIBSSH2_CHANNEL_WINDOW_DEFAULT, \
+                          LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0)
+
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host,
+                                int port, const char *shost, int sport);
+#define libssh2_channel_direct_tcpip(session, host, port) \
+  libssh2_channel_direct_tcpip_ex((session), (host), (port), "127.0.0.1", 22)
+
+LIBSSH2_API LIBSSH2_LISTENER *
+libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host,
+                                  int port, int *bound_port, int queue_maxsize);
+#define libssh2_channel_forward_listen(session, port) \
+ libssh2_channel_forward_listen_ex((session), NULL, (port), NULL, 16)
+
+LIBSSH2_API int libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
+
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener);
+
+LIBSSH2_API int libssh2_channel_setenv_ex(LIBSSH2_CHANNEL *channel,
+                                          const char *varname,
+                                          unsigned int varname_len,
+                                          const char *value,
+                                          unsigned int value_len);
+
+#define libssh2_channel_setenv(channel, varname, value) \
+ libssh2_channel_setenv_ex((channel), (varname), strlen(varname), (value), \
+                           strlen(value))
+
+LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel,
+                                               const char *term,
+                                               unsigned int term_len,
+                                               const char *modes,
+                                               unsigned int modes_len,
+                                               int width, int height,
+                                               int width_px, int height_px);
+#define libssh2_channel_request_pty(channel, term) \
+ libssh2_channel_request_pty_ex((channel), (term), strlen(term), NULL, 0, \
+                                LIBSSH2_TERM_WIDTH, LIBSSH2_TERM_HEIGHT, \
+                                LIBSSH2_TERM_WIDTH_PX, LIBSSH2_TERM_HEIGHT_PX)
+
+LIBSSH2_API int libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel,
+                                                    int width, int height,
+                                                    int width_px,
+                                                    int height_px);
+#define libssh2_channel_request_pty_size(channel, width, height) \
+  libssh2_channel_request_pty_size_ex( (channel), (width), (height), 0, 0)
+
+LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel,
+                                           int single_connection,
+                                           const char *auth_proto,
+                                           const char *auth_cookie,
+                                           int screen_number);
+#define libssh2_channel_x11_req(channel, screen_number) \
+ libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number))
+
+LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
+                                                const char *request,
+                                                unsigned int request_len,
+                                                const char *message,
+                                                unsigned int message_len);
+#define libssh2_channel_shell(channel) \
+  libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, \
+                                  NULL, 0)
+#define libssh2_channel_exec(channel, command) \
+  libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, \
+                                  (command), strlen(command))
+#define libssh2_channel_subsystem(channel, subsystem) \
+  libssh2_channel_process_startup((channel), "subsystem",              \
+                                  sizeof("subsystem") - 1, (subsystem), \
+                                  strlen(subsystem))
+
+LIBSSH2_API ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel,
+                                            int stream_id, char *buf,
+                                            size_t buflen);
+#define libssh2_channel_read(channel, buf, buflen) \
+  libssh2_channel_read_ex((channel), 0, (buf), (buflen))
+#define libssh2_channel_read_stderr(channel, buf, buflen) \
+  libssh2_channel_read_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
+
+LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel,
+                                          int extended);
+
+LIBSSH2_API unsigned long
+libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
+                               unsigned long *read_avail,
+                               unsigned long *window_size_initial);
+#define libssh2_channel_window_read(channel) \
+  libssh2_channel_window_read_ex((channel), NULL, NULL)
+
+/* libssh2_channel_receive_window_adjust is DEPRECATED, do not use! */
+LIBSSH2_API unsigned long
+libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel,
+                                      unsigned long adjustment,
+                                      unsigned char force);
+
+LIBSSH2_API int
+libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel,
+                                       unsigned long adjustment,
+                                       unsigned char force,
+                                       unsigned int *storewindow);
+
+LIBSSH2_API ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel,
+                                             int stream_id, const char *buf,
+                                             size_t buflen);
+
+#define libssh2_channel_write(channel, buf, buflen) \
+  libssh2_channel_write_ex((channel), 0, (buf), (buflen))
+#define libssh2_channel_write_stderr(channel, buf, buflen)  \
+  libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
+
+LIBSSH2_API unsigned long
+libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
+                                unsigned long *window_size_initial);
+#define libssh2_channel_window_write(channel) \
+  libssh2_channel_window_write_ex((channel), NULL)
+
+LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session,
+                                              int blocking);
+LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
+
+LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
+                                              int blocking);
+
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
+/* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
+LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
+                                                      int ignore_mode);
+LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
+                                                      int ignore_mode);
+
+/* libssh2_channel_ignore_extended_data() is defined below for BC with version
+ * 0.1
+ *
+ * Future uses should use libssh2_channel_handle_extended_data() directly if
+ * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read
+ * (FIFO) from the standard data channel
+ */
+/* DEPRECATED */
+#define libssh2_channel_ignore_extended_data(channel, ignore) \
+  libssh2_channel_handle_extended_data((channel),                       \
+                                       (ignore) ?                       \
+                                       LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \
+                                       LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL )
+
+#define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA     -1
+#define LIBSSH2_CHANNEL_FLUSH_ALL               -2
+LIBSSH2_API int libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel,
+                                         int streamid);
+#define libssh2_channel_flush(channel) libssh2_channel_flush_ex((channel), 0)
+#define libssh2_channel_flush_stderr(channel) \
+ libssh2_channel_flush_ex((channel), SSH_EXTENDED_DATA_STDERR)
+
+LIBSSH2_API int libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel);
+LIBSSH2_API int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL* channel,
+                                                char **exitsignal,
+                                                size_t *exitsignal_len,
+                                                char **errmsg,
+                                                size_t *errmsg_len,
+                                                char **langtag,
+                                                size_t *langtag_len);
+LIBSSH2_API int libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel);
+LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
+LIBSSH2_API int libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel);
+LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel);
+LIBSSH2_API int libssh2_channel_wait_closed(LIBSSH2_CHANNEL *channel);
+LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel);
+
+LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session,
+                                              const char *path,
+                                              struct stat *sb);
+LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session,
+                                                 const char *path, int mode,
+                                                 size_t size, long mtime,
+                                                 long atime);
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
+                   libssh2_int64_t size, time_t mtime, time_t atime);
+
+#define libssh2_scp_send(session, path, mode, size) \
+  libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
+
+LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
+                                      unsigned int *dest_len,
+                                      const char *src, unsigned int src_len);
+
+LIBSSH2_API
+const char *libssh2_version(int req_version_num);
+
+#define HAVE_LIBSSH2_KNOWNHOST_API 0x010101 /* since 1.1.1 */
+#define HAVE_LIBSSH2_VERSION_API   0x010100 /* libssh2_version since 1.1 */
+
+struct libssh2_knownhost {
+    unsigned int magic;  /* magic stored by the library */
+    void *node; /* handle to the internal representation of this host */
+    char *name; /* this is NULL if no plain text host name exists */
+    char *key;  /* key in base64/printable format */
+    int typemask;
+};
+
+/*
+ * libssh2_knownhost_init
+ *
+ * Init a collection of known hosts. Returns the pointer to a collection.
+ *
+ */
+LIBSSH2_API LIBSSH2_KNOWNHOSTS *
+libssh2_knownhost_init(LIBSSH2_SESSION *session);
+
+/*
+ * libssh2_knownhost_add
+ *
+ * Add a host and its associated key to the collection of known hosts.
+ *
+ * The 'type' argument specifies on what format the given host and keys are:
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - SHA1(<salt> <host>) base64-encoded!
+ * custom - another hash
+ *
+ * If 'sha1' is selected as type, the salt must be provided to the salt
+ * argument. This too base64 encoded.
+ *
+ * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files.  If
+ * a custom type is used, salt is ignored and you must provide the host
+ * pre-hashed when checking for it in the libssh2_knownhost_check() function.
+ *
+ * The keylen parameter may be omitted (zero) if the key is provided as a
+ * NULL-terminated base64-encoded string.
+ */
+
+/* host format (2 bits) */
+#define LIBSSH2_KNOWNHOST_TYPE_MASK    0xffff
+#define LIBSSH2_KNOWNHOST_TYPE_PLAIN   1
+#define LIBSSH2_KNOWNHOST_TYPE_SHA1    2 /* always base64 encoded */
+#define LIBSSH2_KNOWNHOST_TYPE_CUSTOM  3
+
+/* key format (2 bits) */
+#define LIBSSH2_KNOWNHOST_KEYENC_MASK     (3<<16)
+#define LIBSSH2_KNOWNHOST_KEYENC_RAW      (1<<16)
+#define LIBSSH2_KNOWNHOST_KEYENC_BASE64   (2<<16)
+
+/* type of key (2 bits) */
+#define LIBSSH2_KNOWNHOST_KEY_MASK     (3<<18)
+#define LIBSSH2_KNOWNHOST_KEY_SHIFT    18
+#define LIBSSH2_KNOWNHOST_KEY_RSA1     (1<<18)
+#define LIBSSH2_KNOWNHOST_KEY_SSHRSA   (2<<18)
+#define LIBSSH2_KNOWNHOST_KEY_SSHDSS   (3<<18)
+
+LIBSSH2_API int
+libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
+                      const char *host,
+                      const char *salt,
+                      const char *key, size_t keylen, int typemask,
+                      struct libssh2_knownhost **store);
+
+/*
+ * libssh2_knownhost_addc
+ *
+ * Add a host and its associated key to the collection of known hosts.
+ *
+ * Takes a comment argument that may be NULL.  A NULL comment indicates
+ * there is no comment and the entry will end directly after the key
+ * when written out to a file.  An empty string "" comment will indicate an
+ * empty comment which will cause a single space to be written after the key.
+ *
+ * The 'type' argument specifies on what format the given host and keys are:
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - SHA1(<salt> <host>) base64-encoded!
+ * custom - another hash
+ *
+ * If 'sha1' is selected as type, the salt must be provided to the salt
+ * argument. This too base64 encoded.
+ *
+ * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files.  If
+ * a custom type is used, salt is ignored and you must provide the host
+ * pre-hashed when checking for it in the libssh2_knownhost_check() function.
+ *
+ * The keylen parameter may be omitted (zero) if the key is provided as a
+ * NULL-terminated base64-encoded string.
+ */
+
+LIBSSH2_API int
+libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
+                       const char *host,
+                       const char *salt,
+                       const char *key, size_t keylen,
+                       const char *comment, size_t commentlen, int typemask,
+                       struct libssh2_knownhost **store);
+
+/*
+ * libssh2_knownhost_check
+ *
+ * Check a host and its associated key against the collection of known hosts.
+ *
+ * The type is the type/format of the given host name.
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * custom - prehashed base64 encoded. Note that this cannot use any salts.
+ *
+ *
+ * 'knownhost' may be set to NULL if you don't care about that info.
+ *
+ * Returns:
+ *
+ * LIBSSH2_KNOWNHOST_CHECK_* values, see below
+ *
+ */
+
+#define LIBSSH2_KNOWNHOST_CHECK_MATCH    0
+#define LIBSSH2_KNOWNHOST_CHECK_MISMATCH 1
+#define LIBSSH2_KNOWNHOST_CHECK_NOTFOUND 2
+#define LIBSSH2_KNOWNHOST_CHECK_FAILURE  3
+
+LIBSSH2_API int
+libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
+                        const char *host, const char *key, size_t keylen,
+                        int typemask,
+                        struct libssh2_knownhost **knownhost);
+
+/* this function is identital to the above one, but also takes a port
+   argument that allows libssh2 to do a better check */
+LIBSSH2_API int
+libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
+                         const char *host, int port,
+                         const char *key, size_t keylen,
+                         int typemask,
+                         struct libssh2_knownhost **knownhost);
+
+/*
+ * libssh2_knownhost_del
+ *
+ * Remove a host from the collection of known hosts. The 'entry' struct is
+ * retrieved by a call to libssh2_knownhost_check().
+ *
+ */
+LIBSSH2_API int
+libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts,
+                      struct libssh2_knownhost *entry);
+
+/*
+ * libssh2_knownhost_free
+ *
+ * Free an entire collection of known hosts.
+ *
+ */
+LIBSSH2_API void
+libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts);
+
+/*
+ * libssh2_knownhost_readline()
+ *
+ * Pass in a line of a file of 'type'. It makes libssh2 read this line.
+ *
+ * LIBSSH2_KNOWNHOST_FILE_OPENSSH is the only supported type.
+ *
+ */
+LIBSSH2_API int
+libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts,
+                           const char *line, size_t len, int type);
+
+/*
+ * libssh2_knownhost_readfile
+ *
+ * Add hosts+key pairs from a given file.
+ *
+ * Returns a negative value for error or number of successfully added hosts.
+ *
+ * This implementation currently only knows one 'type' (openssh), all others
+ * are reserved for future use.
+ */
+
+#define LIBSSH2_KNOWNHOST_FILE_OPENSSH 1
+
+LIBSSH2_API int
+libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts,
+                           const char *filename, int type);
+
+/*
+ * libssh2_knownhost_writeline()
+ *
+ * Ask libssh2 to convert a known host to an output line for storage.
+ *
+ * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given
+ * output buffer is too small to hold the desired output.
+ *
+ * This implementation currently only knows one 'type' (openssh), all others
+ * are reserved for future use.
+ *
+ */
+LIBSSH2_API int
+libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
+                            struct libssh2_knownhost *known,
+                            char *buffer, size_t buflen,
+                            size_t *outlen, /* the amount of written data */
+                            int type);
+
+/*
+ * libssh2_knownhost_writefile
+ *
+ * Write hosts+key pairs to a given file.
+ *
+ * This implementation currently only knows one 'type' (openssh), all others
+ * are reserved for future use.
+ */
+
+LIBSSH2_API int
+libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts,
+                            const char *filename, int type);
+
+/*
+ * libssh2_knownhost_get()
+ *
+ * Traverse the internal list of known hosts. Pass NULL to 'prev' to get
+ * the first one. Or pass a poiner to the previously returned one to get the
+ * next.
+ *
+ * Returns:
+ * 0 if a fine host was stored in 'store'
+ * 1 if end of hosts
+ * [negative] on errors
+ */
+LIBSSH2_API int
+libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts,
+                      struct libssh2_knownhost **store,
+                      struct libssh2_knownhost *prev);
+
+#define HAVE_LIBSSH2_AGENT_API 0x010202 /* since 1.2.2 */
+
+struct libssh2_agent_publickey {
+    unsigned int magic;              /* magic stored by the library */
+    void *node;     /* handle to the internal representation of key */
+    unsigned char *blob;           /* public key blob */
+    size_t blob_len;               /* length of the public key blob */
+    char *comment;                 /* comment in printable format */
+};
+
+/*
+ * libssh2_agent_init
+ *
+ * Init an ssh-agent handle. Returns the pointer to the handle.
+ *
+ */
+LIBSSH2_API LIBSSH2_AGENT *
+libssh2_agent_init(LIBSSH2_SESSION *session);
+
+/*
+ * libssh2_agent_connect()
+ *
+ * Connect to an ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_connect(LIBSSH2_AGENT *agent);
+
+/*
+ * libssh2_agent_list_identities()
+ *
+ * Request an ssh-agent to list identities.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_list_identities(LIBSSH2_AGENT *agent);
+
+/*
+ * libssh2_agent_get_identity()
+ *
+ * Traverse the internal list of public keys. Pass NULL to 'prev' to get
+ * the first one. Or pass a poiner to the previously returned one to get the
+ * next.
+ *
+ * Returns:
+ * 0 if a fine public key was stored in 'store'
+ * 1 if end of public keys
+ * [negative] on errors
+ */
+LIBSSH2_API int
+libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
+               struct libssh2_agent_publickey **store,
+               struct libssh2_agent_publickey *prev);
+
+/*
+ * libssh2_agent_userauth()
+ *
+ * Do publickey user authentication with the help of ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_userauth(LIBSSH2_AGENT *agent,
+               const char *username,
+               struct libssh2_agent_publickey *identity);
+
+/*
+ * libssh2_agent_disconnect()
+ *
+ * Close a connection to an ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_disconnect(LIBSSH2_AGENT *agent);
+
+/*
+ * libssh2_agent_free()
+ *
+ * Free an ssh-agent handle.  This function also frees the internal
+ * collection of public keys.
+ */
+LIBSSH2_API void
+libssh2_agent_free(LIBSSH2_AGENT *agent);
+
+
+/*
+ * libssh2_keepalive_config()
+ *
+ * Set how often keepalive messages should be sent.  WANT_REPLY
+ * indicates whether the keepalive messages should request a response
+ * from the server.  INTERVAL is number of seconds that can pass
+ * without any I/O, use 0 (the default) to disable keepalives.  To
+ * avoid some busy-loop corner-cases, if you specify an interval of 1
+ * it will be treated as 2.
+ *
+ * Note that non-blocking applications are responsible for sending the
+ * keepalive messages using libssh2_keepalive_send().
+ */
+LIBSSH2_API void libssh2_keepalive_config (LIBSSH2_SESSION *session,
+                                           int want_reply,
+                                           unsigned interval);
+
+/*
+ * libssh2_keepalive_send()
+ *
+ * Send a keepalive message if needed.  SECONDS_TO_NEXT indicates how
+ * many seconds you can sleep after this call before you need to call
+ * it again.  Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on
+ * I/O errors.
+ */
+LIBSSH2_API int libssh2_keepalive_send (LIBSSH2_SESSION *session,
+                                        int *seconds_to_next);
+
+/* NOTE NOTE NOTE
+   libssh2_trace() has no function in builds that aren't built with debug
+   enabled
+ */
+LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask);
+#define LIBSSH2_TRACE_TRANS (1<<1)
+#define LIBSSH2_TRACE_KEX   (1<<2)
+#define LIBSSH2_TRACE_AUTH  (1<<3)
+#define LIBSSH2_TRACE_CONN  (1<<4)
+#define LIBSSH2_TRACE_SCP   (1<<5)
+#define LIBSSH2_TRACE_SFTP  (1<<6)
+#define LIBSSH2_TRACE_ERROR (1<<7)
+#define LIBSSH2_TRACE_PUBLICKEY (1<<8)
+#define LIBSSH2_TRACE_SOCKET (1<<9)
+
+typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*,
+                                           void*,
+                                           const char *,
+                                           size_t);
+LIBSSH2_API int libssh2_trace_sethandler(LIBSSH2_SESSION *session,
+                                         void* context,
+                                         libssh2_trace_handler_func callback);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !RC_INVOKED */
+
+#endif /* LIBSSH2_H */
diff --git a/pgadmin/include/libssh2/libssh2_config.h.in b/pgadmin/include/libssh2/libssh2_config.h.in
new file mode 100644
index 0000000..6a52f0c
--- /dev/null
+++ b/pgadmin/include/libssh2/libssh2_config.h.in
@@ -0,0 +1,223 @@
+/* src/libssh2_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* disabled non-blocking sockets */
+#undef HAVE_DISABLED_NONBLOCKING
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the `EVP_aes_128_ctr' function. */
+#undef HAVE_EVP_AES_128_CTR
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* use FIONBIO for non-blocking sockets */
+#undef HAVE_FIONBIO
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* use ioctlsocket() for non-blocking sockets */
+#undef HAVE_IOCTLSOCKET
+
+/* use Ioctlsocket() for non-blocking sockets */
+#undef HAVE_IOCTLSOCKET_CASE
+
+/* Define if you have the gcrypt library. */
+#undef HAVE_LIBGCRYPT
+
+/* Define if you have the ssl library. */
+#undef HAVE_LIBSSL
+
+/* Define if you have the z library. */
+#undef HAVE_LIBZ
+
+/* Define to 1 if the compiler supports the 'long long' data type. */
+#undef HAVE_LONGLONG
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* use O_NONBLOCK for non-blocking sockets */
+#undef HAVE_O_NONBLOCK
+
+/* Define to 1 if you have the `poll' function. */
+#undef HAVE_POLL
+
+/* Define to 1 if you have the select function. */
+#undef HAVE_SELECT
+
+/* use SO_NONBLOCK for non-blocking sockets */
+#undef HAVE_SO_NONBLOCK
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#undef HAVE_SYS_UN_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+#undef HAVE_WINSOCK2_H
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
+/* to make a symbol visible */
+#undef LIBSSH2_API
+
+/* Enable "none" cipher -- NOT RECOMMENDED */
+#undef LIBSSH2_CRYPT_NONE
+
+/* Enable newer diffie-hellman-group-exchange-sha1 syntax */
+#undef LIBSSH2_DH_GEX_NEW
+
+/* Compile in zlib support */
+#undef LIBSSH2_HAVE_ZLIB
+
+/* Use libgcrypt */
+#undef LIBSSH2_LIBGCRYPT
+
+/* Enable "none" MAC -- NOT RECOMMENDED */
+#undef LIBSSH2_MAC_NONE
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
+#undef NEED_REENTRANT
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
diff --git a/pgadmin/include/libssh2/libssh2_priv.h b/pgadmin/include/libssh2/libssh2_priv.h
new file mode 100644
index 0000000..4ec9f73
--- /dev/null
+++ b/pgadmin/include/libssh2/libssh2_priv.h
@@ -0,0 +1,1040 @@
+/* Copyright (c) 2004-2008, 2010, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2011 by Daniel Stenberg
+ * Copyright (c) 2010 Simon Josefsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef LIBSSH2_PRIV_H
+#define LIBSSH2_PRIV_H 1
+
+#define LIBSSH2_LIBRARY
+#include "libssh2_config.h"
+
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+
+#include <stdio.h>
+#include <time.h>
+
+/* The following CPP block should really only be in session.c and
+   packet.c.  However, AIX have #define's for 'events' and 'revents'
+   and we are using those names in libssh2.h, so we need to include
+   the AIX headers first, to make sure all code is compiled with
+   consistent names of these fields.  While arguable the best would to
+   change libssh2.h to use other names, that would break backwards
+   compatibility.  For more information, see:
+   http://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00003.html
+   http://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00224.html
+*/
+#ifdef HAVE_POLL
+# include <sys/poll.h>
+#else
+# if defined(HAVE_SELECT) && !defined(WIN32)
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# else
+# include <sys/time.h>
+# include <sys/types.h>
+# endif
+# endif
+#endif
+
+/* Needed for struct iovec on some platforms */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#include "libssh2.h"
+#include "libssh2_publickey.h"
+#include "libssh2_sftp.h"
+#include "misc.h" /* for the linked list stuff */
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+/* Provide iovec / writev on WIN32 platform. */
+#ifdef WIN32
+
+struct iovec {
+    size_t iov_len;
+    void * iov_base;
+};
+
+#define inline __inline
+
+static inline int writev(int sock, struct iovec *iov, int nvecs)
+{
+    DWORD ret;
+    if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) {
+        return ret;
+    }
+    return -1;
+}
+
+#endif /* WIN32 */
+
+#include "crypto.h"
+
+#ifdef HAVE_WINSOCK2_H
+
+#include <winsock2.h>
+#include <mswsock.h>
+#include <ws2tcpip.h>
+
+#ifdef _MSC_VER
+/* "inline" keyword is valid only with C++ engine! */
+#define inline __inline
+#endif
+
+#endif
+
+/* RFC4253 section 6.1 Maximum Packet Length says:
+ *
+ * "All implementations MUST be able to process packets with
+ * uncompressed payload length of 32768 bytes or less and
+ * total packet size of 35000 bytes or less (including length,
+ * padding length, payload, padding, and MAC.)."
+ */
+#define MAX_SSH_PACKET_LEN 35000
+
+#define LIBSSH2_ALLOC(session, count) \
+  session->alloc((count), &(session)->abstract)
+#define LIBSSH2_REALLOC(session, ptr, count) \
+ ((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : \
+ session->alloc((count), &(session)->abstract))
+#define LIBSSH2_FREE(session, ptr) \
+ session->free((ptr), &(session)->abstract)
+#define LIBSSH2_IGNORE(session, data, datalen) \
+ session->ssh_msg_ignore((session), (data), (datalen), &(session)->abstract)
+#define LIBSSH2_DEBUG(session, always_display, message, message_len, \
+                      language, language_len)    \
+    session->ssh_msg_debug((session), (always_display), (message), \
+                           (message_len), (language), (language_len), \
+                           &(session)->abstract)
+#define LIBSSH2_DISCONNECT(session, reason, message, message_len, \
+                           language, language_len)                \
+    session->ssh_msg_disconnect((session), (reason), (message),   \
+                                (message_len), (language), (language_len), \
+                                &(session)->abstract)
+
+#define LIBSSH2_MACERROR(session, data, datalen)         \
+    session->macerror((session), (data), (datalen), &(session)->abstract)
+#define LIBSSH2_X11_OPEN(channel, shost, sport)          \
+    channel->session->x11(((channel)->session), (channel), \
+                          (shost), (sport), (&(channel)->session->abstract))
+
+#define LIBSSH2_CHANNEL_CLOSE(session, channel)          \
+    channel->close_cb((session), &(session)->abstract, \
+                      (channel), &(channel)->abstract)
+
+#define LIBSSH2_SEND_FD(session, fd, buffer, length, flags) \
+    session->send(fd, buffer, length, flags, &session->abstract)
+#define LIBSSH2_RECV_FD(session, fd, buffer, length, flags) \
+    session->recv(fd, buffer, length, flags, &session->abstract)
+
+#define LIBSSH2_SEND(session, buffer, length, flags)  \
+    LIBSSH2_SEND_FD(session, session->socket_fd, buffer, length, flags)
+#define LIBSSH2_RECV(session, buffer, length, flags)                    \
+    LIBSSH2_RECV_FD(session, session->socket_fd, buffer, length, flags)
+
+typedef struct _LIBSSH2_KEX_METHOD LIBSSH2_KEX_METHOD;
+typedef struct _LIBSSH2_HOSTKEY_METHOD LIBSSH2_HOSTKEY_METHOD;
+typedef struct _LIBSSH2_CRYPT_METHOD LIBSSH2_CRYPT_METHOD;
+typedef struct _LIBSSH2_COMP_METHOD LIBSSH2_COMP_METHOD;
+
+typedef struct _LIBSSH2_PACKET LIBSSH2_PACKET;
+
+typedef enum
+{
+    libssh2_NB_state_idle = 0,
+    libssh2_NB_state_allocated,
+    libssh2_NB_state_created,
+    libssh2_NB_state_sent,
+    libssh2_NB_state_sent1,
+    libssh2_NB_state_sent2,
+    libssh2_NB_state_sent3,
+    libssh2_NB_state_sent4,
+    libssh2_NB_state_sent5,
+    libssh2_NB_state_sent6,
+    libssh2_NB_state_sent7,
+    libssh2_NB_state_jump1,
+    libssh2_NB_state_jump2,
+    libssh2_NB_state_jump3,
+    libssh2_NB_state_jump4,
+    libssh2_NB_state_jump5
+} libssh2_nonblocking_states;
+
+typedef struct packet_require_state_t
+{
+    libssh2_nonblocking_states state;
+    time_t start;
+} packet_require_state_t;
+
+typedef struct packet_requirev_state_t
+{
+    time_t start;
+} packet_requirev_state_t;
+
+typedef struct kmdhgGPsha1kex_state_t
+{
+    libssh2_nonblocking_states state;
+    unsigned char *e_packet;
+    unsigned char *s_packet;
+    unsigned char *tmp;
+    unsigned char h_sig_comp[SHA_DIGEST_LENGTH];
+    unsigned char c;
+    size_t e_packet_len;
+    size_t s_packet_len;
+    size_t tmp_len;
+    _libssh2_bn_ctx *ctx;
+    _libssh2_bn *x;
+    _libssh2_bn *e;
+    _libssh2_bn *f;
+    _libssh2_bn *k;
+    unsigned char *s;
+    unsigned char *f_value;
+    unsigned char *k_value;
+    unsigned char *h_sig;
+    size_t f_value_len;
+    size_t k_value_len;
+    size_t h_sig_len;
+    libssh2_sha1_ctx exchange_hash;
+    packet_require_state_t req_state;
+    libssh2_nonblocking_states burn_state;
+} kmdhgGPsha1kex_state_t;
+
+typedef struct key_exchange_state_low_t
+{
+    libssh2_nonblocking_states state;
+    packet_require_state_t req_state;
+    kmdhgGPsha1kex_state_t exchange_state;
+    _libssh2_bn *p;             /* SSH2 defined value (p_value) */
+    _libssh2_bn *g;             /* SSH2 defined value (2) */
+    unsigned char request[13];
+    unsigned char *data;
+    size_t request_len;
+    size_t data_len;
+} key_exchange_state_low_t;
+
+typedef struct key_exchange_state_t
+{
+    libssh2_nonblocking_states state;
+    packet_require_state_t req_state;
+    key_exchange_state_low_t key_state_low;
+    unsigned char *data;
+    size_t data_len;
+    unsigned char *oldlocal;
+    size_t oldlocal_len;
+} key_exchange_state_t;
+
+#define FwdNotReq "Forward not requested"
+
+typedef struct packet_queue_listener_state_t
+{
+    libssh2_nonblocking_states state;
+    unsigned char packet[17 + (sizeof(FwdNotReq) - 1)];
+    unsigned char *host;
+    unsigned char *shost;
+    uint32_t sender_channel;
+    uint32_t initial_window_size;
+    uint32_t packet_size;
+    uint32_t port;
+    uint32_t sport;
+    uint32_t host_len;
+    uint32_t shost_len;
+    LIBSSH2_CHANNEL *channel;
+} packet_queue_listener_state_t;
+
+#define X11FwdUnAvil "X11 Forward Unavailable"
+
+typedef struct packet_x11_open_state_t
+{
+    libssh2_nonblocking_states state;
+    unsigned char packet[17 + (sizeof(X11FwdUnAvil) - 1)];
+    unsigned char *shost;
+    uint32_t sender_channel;
+    uint32_t initial_window_size;
+    uint32_t packet_size;
+    uint32_t sport;
+    uint32_t shost_len;
+    LIBSSH2_CHANNEL *channel;
+} packet_x11_open_state_t;
+
+struct _LIBSSH2_PACKET
+{
+    struct list_node node; /* linked list header */
+
+    /* the raw unencrypted payload */
+    unsigned char *data;
+    size_t data_len;
+
+    /* Where to start reading data from,
+     * used for channel data that's been partially consumed */
+    size_t data_head;
+};
+
+typedef struct _libssh2_channel_data
+{
+    /* Identifier */
+    uint32_t id;
+
+    /* Limits and restrictions */
+    uint32_t window_size_initial, window_size, packet_size;
+
+    /* Set to 1 when CHANNEL_CLOSE / CHANNEL_EOF sent/received */
+    char close, eof, extended_data_ignore_mode;
+} libssh2_channel_data;
+
+struct _LIBSSH2_CHANNEL
+{
+    struct list_node node;
+
+    unsigned char *channel_type;
+    unsigned channel_type_len;
+
+    /* channel's program exit status */
+    int exit_status;
+
+    /* channel's program exit signal (without the SIG prefix) */
+    char *exit_signal;
+
+    libssh2_channel_data local, remote;
+    /* Amount of bytes to be refunded to receive window (but not yet sent) */
+    uint32_t adjust_queue;
+
+    LIBSSH2_SESSION *session;
+
+    void *abstract;
+      LIBSSH2_CHANNEL_CLOSE_FUNC((*close_cb));
+
+    /* State variables used in libssh2_channel_setenv_ex() */
+    libssh2_nonblocking_states setenv_state;
+    unsigned char *setenv_packet;
+    size_t setenv_packet_len;
+    unsigned char setenv_local_channel[4];
+    packet_requirev_state_t setenv_packet_requirev_state;
+
+    /* State variables used in libssh2_channel_request_pty_ex()
+       libssh2_channel_request_pty_size_ex() */
+    libssh2_nonblocking_states reqPTY_state;
+    unsigned char reqPTY_packet[41 + 256];
+    size_t reqPTY_packet_len;
+    unsigned char reqPTY_local_channel[4];
+    packet_requirev_state_t reqPTY_packet_requirev_state;
+
+    /* State variables used in libssh2_channel_x11_req_ex() */
+    libssh2_nonblocking_states reqX11_state;
+    unsigned char *reqX11_packet;
+    size_t reqX11_packet_len;
+    unsigned char reqX11_local_channel[4];
+    packet_requirev_state_t reqX11_packet_requirev_state;
+
+    /* State variables used in libssh2_channel_process_startup() */
+    libssh2_nonblocking_states process_state;
+    unsigned char *process_packet;
+    size_t process_packet_len;
+    unsigned char process_local_channel[4];
+    packet_requirev_state_t process_packet_requirev_state;
+
+    /* State variables used in libssh2_channel_flush_ex() */
+    libssh2_nonblocking_states flush_state;
+    size_t flush_refund_bytes;
+    size_t flush_flush_bytes;
+
+    /* State variables used in libssh2_channel_receive_window_adjust() */
+    libssh2_nonblocking_states adjust_state;
+    unsigned char adjust_adjust[9];     /* packet_type(1) + channel(4) + adjustment(4) */
+
+    /* State variables used in libssh2_channel_read_ex() */
+    libssh2_nonblocking_states read_state;
+
+    uint32_t read_local_id;
+
+    /* State variables used in libssh2_channel_write_ex() */
+    libssh2_nonblocking_states write_state;
+    unsigned char write_packet[13];
+    size_t write_packet_len;
+    size_t write_bufwrite;
+
+    /* State variables used in libssh2_channel_close() */
+    libssh2_nonblocking_states close_state;
+    unsigned char close_packet[5];
+
+    /* State variables used in libssh2_channel_wait_closedeof() */
+    libssh2_nonblocking_states wait_eof_state;
+
+    /* State variables used in libssh2_channel_wait_closed() */
+    libssh2_nonblocking_states wait_closed_state;
+
+    /* State variables used in libssh2_channel_free() */
+    libssh2_nonblocking_states free_state;
+
+    /* State variables used in libssh2_channel_handle_extended_data2() */
+    libssh2_nonblocking_states extData2_state;
+
+};
+
+struct _LIBSSH2_LISTENER
+{
+    struct list_node node; /* linked list header */
+
+    LIBSSH2_SESSION *session;
+
+    char *host;
+    int port;
+
+    /* a list of CHANNELs for this listener */
+    struct list_head queue;
+
+    int queue_size;
+    int queue_maxsize;
+
+    /* State variables used in libssh2_channel_forward_cancel() */
+    libssh2_nonblocking_states chanFwdCncl_state;
+    unsigned char *chanFwdCncl_data;
+    size_t chanFwdCncl_data_len;
+};
+
+typedef struct _libssh2_endpoint_data
+{
+    unsigned char *banner;
+
+    unsigned char *kexinit;
+    size_t kexinit_len;
+
+    const LIBSSH2_CRYPT_METHOD *crypt;
+    void *crypt_abstract;
+
+    const struct _LIBSSH2_MAC_METHOD *mac;
+    uint32_t seqno;
+    void *mac_abstract;
+
+    const LIBSSH2_COMP_METHOD *comp;
+    void *comp_abstract;
+
+    /* Method Preferences -- NULL yields "load order" */
+    char *crypt_prefs;
+    char *mac_prefs;
+    char *comp_prefs;
+    char *lang_prefs;
+} libssh2_endpoint_data;
+
+#define PACKETBUFSIZE (1024*16)
+
+struct transportpacket
+{
+    /* ------------- for incoming data --------------- */
+    unsigned char buf[PACKETBUFSIZE];
+    unsigned char init[5];  /* first 5 bytes of the incoming data stream,
+                               still encrypted */
+    size_t writeidx;        /* at what array index we do the next write into
+                               the buffer */
+    size_t readidx;         /* at what array index we do the next read from
+                               the buffer */
+    uint32_t packet_length; /* the most recent packet_length as read from the
+                               network data */
+    uint8_t padding_length; /* the most recent padding_length as read from the
+                               network data */
+    size_t data_num;        /* How much of the total package that has been read
+                               so far. */
+    size_t total_num;       /* How much a total package is supposed to be, in
+                               number of bytes. A full package is
+                               packet_length + padding_length + 4 +
+                               mac_length. */
+    unsigned char *payload; /* this is a pointer to a LIBSSH2_ALLOC()
+                               area to which we write decrypted data */
+    unsigned char *wptr;    /* write pointer into the payload to where we
+                               are currently writing decrypted data */
+
+    /* ------------- for outgoing data --------------- */
+    unsigned char outbuf[MAX_SSH_PACKET_LEN]; /* area for the outgoing data */
+
+    int ototal_num;         /* size of outbuf in number of bytes */
+    const unsigned char *odata; /* original pointer to the data */
+    size_t olen;            /* original size of the data we stored in
+                               outbuf */
+    size_t osent;           /* number of bytes already sent */
+};
+
+struct _LIBSSH2_PUBLICKEY
+{
+    LIBSSH2_CHANNEL *channel;
+    uint32_t version;
+
+    /* State variables used in libssh2_publickey_packet_receive() */
+    libssh2_nonblocking_states receive_state;
+    unsigned char *receive_packet;
+    size_t receive_packet_len;
+
+    /* State variables used in libssh2_publickey_add_ex() */
+    libssh2_nonblocking_states add_state;
+    unsigned char *add_packet;
+    unsigned char *add_s;
+
+    /* State variables used in libssh2_publickey_remove_ex() */
+    libssh2_nonblocking_states remove_state;
+    unsigned char *remove_packet;
+    unsigned char *remove_s;
+
+    /* State variables used in libssh2_publickey_list_fetch() */
+    libssh2_nonblocking_states listFetch_state;
+    unsigned char *listFetch_s;
+    unsigned char listFetch_buffer[12];
+    unsigned char *listFetch_data;
+    size_t listFetch_data_len;
+};
+
+#define LIBSSH2_SCP_RESPONSE_BUFLEN     256
+
+struct flags {
+    int sigpipe;  /* LIBSSH2_FLAG_SIGPIPE */
+    int compress; /* LIBSSH2_FLAG_COMPRESS */
+};
+
+struct _LIBSSH2_SESSION
+{
+    /* Memory management callbacks */
+    void *abstract;
+      LIBSSH2_ALLOC_FUNC((*alloc));
+      LIBSSH2_REALLOC_FUNC((*realloc));
+      LIBSSH2_FREE_FUNC((*free));
+
+    /* Other callbacks */
+      LIBSSH2_IGNORE_FUNC((*ssh_msg_ignore));
+      LIBSSH2_DEBUG_FUNC((*ssh_msg_debug));
+      LIBSSH2_DISCONNECT_FUNC((*ssh_msg_disconnect));
+      LIBSSH2_MACERROR_FUNC((*macerror));
+      LIBSSH2_X11_OPEN_FUNC((*x11));
+      LIBSSH2_SEND_FUNC((*send));
+      LIBSSH2_RECV_FUNC((*recv));
+
+    /* Method preferences -- NULL yields "load order" */
+    char *kex_prefs;
+    char *hostkey_prefs;
+
+    int state;
+
+    /* Flag options */
+    struct flags flag;
+
+    /* Agreed Key Exchange Method */
+    const LIBSSH2_KEX_METHOD *kex;
+    int burn_optimistic_kexinit:1;
+
+    unsigned char *session_id;
+    uint32_t session_id_len;
+
+    /* this is set to TRUE if a blocking API behavior is requested */
+    int api_block_mode;
+
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
+    /* Server's public key */
+    const LIBSSH2_HOSTKEY_METHOD *hostkey;
+    void *server_hostkey_abstract;
+
+    /* Either set with libssh2_session_hostkey() (for server mode)
+     * Or read from server in (eg) KEXDH_INIT (for client mode)
+     */
+    unsigned char *server_hostkey;
+    uint32_t server_hostkey_len;
+#if LIBSSH2_MD5
+    unsigned char server_hostkey_md5[MD5_DIGEST_LENGTH];
+    int server_hostkey_md5_valid;
+#endif                          /* ! LIBSSH2_MD5 */
+    unsigned char server_hostkey_sha1[SHA_DIGEST_LENGTH];
+
+    /* (remote as source of data -- packet_read ) */
+    libssh2_endpoint_data remote;
+
+    /* (local as source of data -- packet_write ) */
+    libssh2_endpoint_data local;
+
+    /* Inbound Data linked list -- Sometimes the packet that comes in isn't the
+       packet we're ready for */
+    struct list_head packets;
+
+    /* Active connection channels */
+    struct list_head channels;
+
+    uint32_t next_channel;
+
+    struct list_head listeners; /* list of LIBSSH2_LISTENER structs */
+
+    /* Actual I/O socket */
+    libssh2_socket_t socket_fd;
+    int socket_state;
+    int socket_block_directions;
+    int socket_prev_blockstate; /* stores the state of the socket blockiness
+                                   when libssh2_session_startup() is called */
+
+    /* Error tracking */
+    const char *err_msg;
+    int err_code;
+
+    /* struct members for packet-level reading */
+    struct transportpacket packet;
+#ifdef LIBSSH2DEBUG
+    int showmask;               /* what debug/trace messages to display */
+    libssh2_trace_handler_func tracehandler; /* callback to display trace messages */
+    void* tracehandler_context; /* context for the trace handler */
+#endif
+
+    /* State variables used in libssh2_banner_send() */
+    libssh2_nonblocking_states banner_TxRx_state;
+    char banner_TxRx_banner[256];
+    ssize_t banner_TxRx_total_send;
+
+    /* State variables used in libssh2_kexinit() */
+    libssh2_nonblocking_states kexinit_state;
+    unsigned char *kexinit_data;
+    size_t kexinit_data_len;
+
+    /* State variables used in libssh2_session_startup() */
+    libssh2_nonblocking_states startup_state;
+    unsigned char *startup_data;
+    size_t startup_data_len;
+    unsigned char startup_service[sizeof("ssh-userauth") + 5 - 1];
+    size_t startup_service_length;
+    packet_require_state_t startup_req_state;
+    key_exchange_state_t startup_key_state;
+
+    /* State variables used in libssh2_session_free() */
+    libssh2_nonblocking_states free_state;
+
+    /* State variables used in libssh2_session_disconnect_ex() */
+    libssh2_nonblocking_states disconnect_state;
+    unsigned char disconnect_data[256 + 13];
+    size_t disconnect_data_len;
+
+    /* State variables used in libssh2_packet_read() */
+    libssh2_nonblocking_states readPack_state;
+    int readPack_encrypted;
+
+    /* State variables used in libssh2_userauth_list() */
+    libssh2_nonblocking_states userauth_list_state;
+    unsigned char *userauth_list_data;
+    size_t userauth_list_data_len;
+    packet_requirev_state_t userauth_list_packet_requirev_state;
+
+    /* State variables used in libssh2_userauth_password_ex() */
+    libssh2_nonblocking_states userauth_pswd_state;
+    unsigned char *userauth_pswd_data;
+    unsigned char userauth_pswd_data0;
+    size_t userauth_pswd_data_len;
+    char *userauth_pswd_newpw;
+    int userauth_pswd_newpw_len;
+    packet_requirev_state_t userauth_pswd_packet_requirev_state;
+
+    /* State variables used in libssh2_userauth_hostbased_fromfile_ex() */
+    libssh2_nonblocking_states userauth_host_state;
+    unsigned char *userauth_host_data;
+    size_t userauth_host_data_len;
+    unsigned char *userauth_host_packet;
+    size_t userauth_host_packet_len;
+    unsigned char *userauth_host_method;
+    size_t userauth_host_method_len;
+    unsigned char *userauth_host_s;
+    packet_requirev_state_t userauth_host_packet_requirev_state;
+
+    /* State variables used in libssh2_userauth_publickey_fromfile_ex() */
+    libssh2_nonblocking_states userauth_pblc_state;
+    unsigned char *userauth_pblc_data;
+    size_t userauth_pblc_data_len;
+    unsigned char *userauth_pblc_packet;
+    size_t userauth_pblc_packet_len;
+    unsigned char *userauth_pblc_method;
+    size_t userauth_pblc_method_len;
+    unsigned char *userauth_pblc_s;
+    unsigned char *userauth_pblc_b;
+    packet_requirev_state_t userauth_pblc_packet_requirev_state;
+
+    /* State variables used in libssh2_userauth_keyboard_interactive_ex() */
+    libssh2_nonblocking_states userauth_kybd_state;
+    unsigned char *userauth_kybd_data;
+    size_t userauth_kybd_data_len;
+    unsigned char *userauth_kybd_packet;
+    size_t userauth_kybd_packet_len;
+    unsigned int userauth_kybd_auth_name_len;
+    char *userauth_kybd_auth_name;
+    unsigned userauth_kybd_auth_instruction_len;
+    char *userauth_kybd_auth_instruction;
+    unsigned int userauth_kybd_num_prompts;
+    int userauth_kybd_auth_failure;
+    LIBSSH2_USERAUTH_KBDINT_PROMPT *userauth_kybd_prompts;
+    LIBSSH2_USERAUTH_KBDINT_RESPONSE *userauth_kybd_responses;
+    packet_requirev_state_t userauth_kybd_packet_requirev_state;
+
+    /* State variables used in libssh2_channel_open_ex() */
+    libssh2_nonblocking_states open_state;
+    packet_requirev_state_t open_packet_requirev_state;
+    LIBSSH2_CHANNEL *open_channel;
+    unsigned char *open_packet;
+    size_t open_packet_len;
+    unsigned char *open_data;
+    size_t open_data_len;
+    uint32_t open_local_channel;
+
+    /* State variables used in libssh2_channel_direct_tcpip_ex() */
+    libssh2_nonblocking_states direct_state;
+    unsigned char *direct_message;
+    size_t direct_host_len;
+    size_t direct_shost_len;
+    size_t direct_message_len;
+
+    /* State variables used in libssh2_channel_forward_listen_ex() */
+    libssh2_nonblocking_states fwdLstn_state;
+    unsigned char *fwdLstn_packet;
+    uint32_t fwdLstn_host_len;
+    uint32_t fwdLstn_packet_len;
+    packet_requirev_state_t fwdLstn_packet_requirev_state;
+
+    /* State variables used in libssh2_publickey_init() */
+    libssh2_nonblocking_states pkeyInit_state;
+    LIBSSH2_PUBLICKEY *pkeyInit_pkey;
+    LIBSSH2_CHANNEL *pkeyInit_channel;
+    unsigned char *pkeyInit_data;
+    size_t pkeyInit_data_len;
+    /* 19 = packet_len(4) + version_len(4) + "version"(7) + version_num(4) */
+    unsigned char pkeyInit_buffer[19];
+    size_t pkeyInit_buffer_sent; /* how much of buffer that has been sent */
+
+    /* State variables used in libssh2_packet_add() */
+    libssh2_nonblocking_states packAdd_state;
+    LIBSSH2_CHANNEL *packAdd_channelp; /* keeper of the channel during EAGAIN
+                                          states */
+    packet_queue_listener_state_t packAdd_Qlstn_state;
+    packet_x11_open_state_t packAdd_x11open_state;
+
+    /* State variables used in fullpacket() */
+    libssh2_nonblocking_states fullpacket_state;
+    int fullpacket_macstate;
+    size_t fullpacket_payload_len;
+    int fullpacket_packet_type;
+
+    /* State variables used in libssh2_sftp_init() */
+    libssh2_nonblocking_states sftpInit_state;
+    LIBSSH2_SFTP *sftpInit_sftp;
+    LIBSSH2_CHANNEL *sftpInit_channel;
+    unsigned char sftpInit_buffer[9];   /* sftp_header(5){excludes request_id}
+                                           + version_id(4) */
+    int sftpInit_sent; /* number of bytes from the buffer that have been
+                          sent */
+
+    /* State variables used in libssh2_scp_recv() */
+    libssh2_nonblocking_states scpRecv_state;
+    unsigned char *scpRecv_command;
+    size_t scpRecv_command_len;
+    unsigned char scpRecv_response[LIBSSH2_SCP_RESPONSE_BUFLEN];
+    size_t scpRecv_response_len;
+    long scpRecv_mode;
+#if defined(HAVE_LONGLONG) && defined(HAVE_STRTOLL)
+    /* we have the type and we can parse such numbers */
+    long long scpRecv_size;
+#define scpsize_strtol strtoll
+#else
+    long scpRecv_size;
+#define scpsize_strtol strtol
+#endif
+    long scpRecv_mtime;
+    long scpRecv_atime;
+    LIBSSH2_CHANNEL *scpRecv_channel;
+
+    /* State variables used in libssh2_scp_send_ex() */
+    libssh2_nonblocking_states scpSend_state;
+    unsigned char *scpSend_command;
+    size_t scpSend_command_len;
+    unsigned char scpSend_response[LIBSSH2_SCP_RESPONSE_BUFLEN];
+    size_t scpSend_response_len;
+    LIBSSH2_CHANNEL *scpSend_channel;
+
+    /* Keepalive variables used by keepalive.c. */
+    int keepalive_interval;
+    int keepalive_want_reply;
+    time_t keepalive_last_sent;
+};
+
+/* session.state bits */
+#define LIBSSH2_STATE_EXCHANGING_KEYS   0x00000001
+#define LIBSSH2_STATE_NEWKEYS           0x00000002
+#define LIBSSH2_STATE_AUTHENTICATED     0x00000004
+#define LIBSSH2_STATE_KEX_ACTIVE        0x00000008
+
+/* session.flag helpers */
+#ifdef MSG_NOSIGNAL
+#define LIBSSH2_SOCKET_SEND_FLAGS(session)              \
+    (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL)
+#define LIBSSH2_SOCKET_RECV_FLAGS(session)              \
+    (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL)
+#else
+/* If MSG_NOSIGNAL isn't defined we're SOL on blocking SIGPIPE */
+#define LIBSSH2_SOCKET_SEND_FLAGS(session)      0
+#define LIBSSH2_SOCKET_RECV_FLAGS(session)      0
+#endif
+
+/* --------- */
+
+/* libssh2 extensible ssh api, ultimately I'd like to allow loading additional
+   methods via .so/.dll */
+
+struct _LIBSSH2_KEX_METHOD
+{
+    const char *name;
+
+    /* Key exchange, populates session->* and returns 0 on success, non-0 on error */
+    int (*exchange_keys) (LIBSSH2_SESSION * session,
+                          key_exchange_state_low_t * key_state);
+
+    long flags;
+};
+
+struct _LIBSSH2_HOSTKEY_METHOD
+{
+    const char *name;
+    unsigned long hash_len;
+
+    int (*init) (LIBSSH2_SESSION * session, const unsigned char *hostkey_data,
+                 size_t hostkey_data_len, void **abstract);
+    int (*initPEM) (LIBSSH2_SESSION * session, const char *privkeyfile,
+                    unsigned const char *passphrase, void **abstract);
+    int (*sig_verify) (LIBSSH2_SESSION * session, const unsigned char *sig,
+                       size_t sig_len, const unsigned char *m,
+                       size_t m_len, void **abstract);
+    int (*signv) (LIBSSH2_SESSION * session, unsigned char **signature,
+                  size_t *signature_len, int veccount,
+                  const struct iovec datavec[], void **abstract);
+    int (*encrypt) (LIBSSH2_SESSION * session, unsigned char **dst,
+                    size_t *dst_len, const unsigned char *src,
+                    size_t src_len, void **abstract);
+    int (*dtor) (LIBSSH2_SESSION * session, void **abstract);
+};
+
+struct _LIBSSH2_CRYPT_METHOD
+{
+    const char *name;
+
+    int blocksize;
+
+    /* iv and key sizes (-1 for variable length) */
+    int iv_len;
+    int secret_len;
+
+    long flags;
+
+    int (*init) (LIBSSH2_SESSION * session,
+                 const LIBSSH2_CRYPT_METHOD * method, unsigned char *iv,
+                 int *free_iv, unsigned char *secret, int *free_secret,
+                 int encrypt, void **abstract);
+    int (*crypt) (LIBSSH2_SESSION * session, unsigned char *block,
+                  size_t blocksize, void **abstract);
+    int (*dtor) (LIBSSH2_SESSION * session, void **abstract);
+
+      _libssh2_cipher_type(algo);
+};
+
+struct _LIBSSH2_COMP_METHOD
+{
+    const char *name;
+    int compress; /* 1 if it does compress, 0 if it doesn't */
+    int use_in_auth; /* 1 if compression should be used in userauth */
+    int (*init) (LIBSSH2_SESSION *session, int compress, void **abstract);
+    int (*comp) (LIBSSH2_SESSION *session,
+                 unsigned char *dest,
+                 size_t *dest_len,
+                 const unsigned char *src,
+                 size_t src_len,
+                 void **abstract);
+    int (*decomp) (LIBSSH2_SESSION *session,
+                   unsigned char **dest,
+                   size_t *dest_len,
+                   size_t payload_limit,
+                   const unsigned char *src,
+                   size_t src_len,
+                   void **abstract);
+    int (*dtor) (LIBSSH2_SESSION * session, int compress, void **abstract);
+};
+
+#ifdef LIBSSH2DEBUG
+void _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format,
+                    ...);
+#else
+#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(__GNUC__)
+/* C99 supported and also by older GCC */
+#define _libssh2_debug(x,y,z,...) do {} while (0)
+#else
+/* no gcc and not C99, do static and hopefully inline */
+static inline void
+_libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
+{
+}
+#endif
+#endif
+
+#define LIBSSH2_SOCKET_UNKNOWN                   1
+#define LIBSSH2_SOCKET_CONNECTED                 0
+#define LIBSSH2_SOCKET_DISCONNECTED             -1
+
+/* Initial packet state, prior to MAC check */
+#define LIBSSH2_MAC_UNCONFIRMED                  1
+/* When MAC type is "none" (proto initiation phase) all packets are deemed "confirmed" */
+#define LIBSSH2_MAC_CONFIRMED                    0
+/* Something very bad is going on */
+#define LIBSSH2_MAC_INVALID                     -1
+
+/* SSH Packet Types -- Defined by internet draft */
+/* Transport Layer */
+#define SSH_MSG_DISCONNECT                          1
+#define SSH_MSG_IGNORE                              2
+#define SSH_MSG_UNIMPLEMENTED                       3
+#define SSH_MSG_DEBUG                               4
+#define SSH_MSG_SERVICE_REQUEST                     5
+#define SSH_MSG_SERVICE_ACCEPT                      6
+
+#define SSH_MSG_KEXINIT                             20
+#define SSH_MSG_NEWKEYS                             21
+
+/* diffie-hellman-group1-sha1 */
+#define SSH_MSG_KEXDH_INIT                          30
+#define SSH_MSG_KEXDH_REPLY                         31
+
+/* diffie-hellman-group-exchange-sha1 */
+#define SSH_MSG_KEX_DH_GEX_REQUEST_OLD              30
+#define SSH_MSG_KEX_DH_GEX_REQUEST                  34
+#define SSH_MSG_KEX_DH_GEX_GROUP                    31
+#define SSH_MSG_KEX_DH_GEX_INIT                     32
+#define SSH_MSG_KEX_DH_GEX_REPLY                    33
+
+/* User Authentication */
+#define SSH_MSG_USERAUTH_REQUEST                    50
+#define SSH_MSG_USERAUTH_FAILURE                    51
+#define SSH_MSG_USERAUTH_SUCCESS                    52
+#define SSH_MSG_USERAUTH_BANNER                     53
+
+/* "public key" method */
+#define SSH_MSG_USERAUTH_PK_OK                      60
+/* "password" method */
+#define SSH_MSG_USERAUTH_PASSWD_CHANGEREQ           60
+/* "keyboard-interactive" method */
+#define SSH_MSG_USERAUTH_INFO_REQUEST               60
+#define SSH_MSG_USERAUTH_INFO_RESPONSE              61
+
+/* Channels */
+#define SSH_MSG_GLOBAL_REQUEST                      80
+#define SSH_MSG_REQUEST_SUCCESS                     81
+#define SSH_MSG_REQUEST_FAILURE                     82
+
+#define SSH_MSG_CHANNEL_OPEN                        90
+#define SSH_MSG_CHANNEL_OPEN_CONFIRMATION           91
+#define SSH_MSG_CHANNEL_OPEN_FAILURE                92
+#define SSH_MSG_CHANNEL_WINDOW_ADJUST               93
+#define SSH_MSG_CHANNEL_DATA                        94
+#define SSH_MSG_CHANNEL_EXTENDED_DATA               95
+#define SSH_MSG_CHANNEL_EOF                         96
+#define SSH_MSG_CHANNEL_CLOSE                       97
+#define SSH_MSG_CHANNEL_REQUEST                     98
+#define SSH_MSG_CHANNEL_SUCCESS                     99
+#define SSH_MSG_CHANNEL_FAILURE                     100
+
+/* Error codes returned in SSH_MSG_CHANNEL_OPEN_FAILURE message
+   (see RFC4254) */
+#define SSH_OPEN_ADMINISTRATIVELY_PROHIBITED 1
+#define SSH_OPEN_CONNECT_FAILED              2
+#define SSH_OPEN_UNKNOWN_CHANNELTYPE         3
+#define SSH_OPEN_RESOURCE_SHORTAGE           4
+
+ssize_t _libssh2_recv(libssh2_socket_t socket, void *buffer,
+                      size_t length, int flags, void **abstract);
+ssize_t _libssh2_send(libssh2_socket_t socket, const void *buffer,
+                      size_t length, int flags, void **abstract);
+
+#define LIBSSH2_READ_TIMEOUT 60 /* generic timeout in seconds used when
+                                   waiting for more data to arrive */
+
+
+int _libssh2_kex_exchange(LIBSSH2_SESSION * session, int reexchange,
+                          key_exchange_state_t * state);
+
+/* Let crypt.c/hostkey.c expose their method structs */
+const LIBSSH2_CRYPT_METHOD **libssh2_crypt_methods(void);
+const LIBSSH2_HOSTKEY_METHOD **libssh2_hostkey_methods(void);
+
+/* pem.c */
+int _libssh2_pem_parse(LIBSSH2_SESSION * session,
+                       const char *headerbegin,
+                       const char *headerend,
+                       FILE * fp, unsigned char **data, unsigned int *datalen);
+int _libssh2_pem_decode_sequence(unsigned char **data, unsigned int *datalen);
+int _libssh2_pem_decode_integer(unsigned char **data, unsigned int *datalen,
+                                unsigned char **i, unsigned int *ilen);
+
+/* global.c */
+void _libssh2_init_if_needed (void);
+
+
+#define ARRAY_SIZE(a) (sizeof ((a)) / sizeof ((a)[0]))
+
+/* define to output the libssh2_int64_t type in a *printf() */
+#if defined( __BORLANDC__ ) || defined( _MSC_VER ) || defined( __MINGW32__ )
+#define LIBSSH2_INT64_T_FORMAT "I64d"
+#else
+#define LIBSSH2_INT64_T_FORMAT "lld"
+#endif
+
+#endif /* LIBSSH2_H */
diff --git a/pgadmin/include/libssh2/libssh2_publickey.h b/pgadmin/include/libssh2/libssh2_publickey.h
new file mode 100644
index 0000000..7350e9f
--- /dev/null
+++ b/pgadmin/include/libssh2/libssh2_publickey.h
@@ -0,0 +1,118 @@
+/* Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/* Note: This include file is only needed for using the
+ * publickey SUBSYSTEM which is not the same as publickey
+ * authentication.  For authentication you only need libssh2.h
+ *
+ * For more information on the publickey subsystem,
+ * refer to IETF draft: secsh-publickey
+ */
+
+#ifndef LIBSSH2_PUBLICKEY_H
+#define LIBSSH2_PUBLICKEY_H 1
+
+#include "libssh2.h"
+
+typedef struct _LIBSSH2_PUBLICKEY               LIBSSH2_PUBLICKEY;
+
+typedef struct _libssh2_publickey_attribute {
+    const char *name;
+    unsigned long name_len;
+    const char *value;
+    unsigned long value_len;
+    char mandatory;
+} libssh2_publickey_attribute;
+
+typedef struct _libssh2_publickey_list {
+    unsigned char *packet; /* For freeing */
+
+    const unsigned char *name;
+    unsigned long name_len;
+    const unsigned char *blob;
+    unsigned long blob_len;
+    unsigned long num_attrs;
+    libssh2_publickey_attribute *attrs; /* free me */
+} libssh2_publickey_list;
+
+/* Generally use the first macro here, but if both name and value are string literals, you can use _fast() to take advantage of preprocessing */
+#define libssh2_publickey_attribute(name, value, mandatory) \
+  { (name), strlen(name), (value), strlen(value), (mandatory) },
+#define libssh2_publickey_attribute_fast(name, value, mandatory) \
+  { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) },
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Publickey Subsystem */
+LIBSSH2_API LIBSSH2_PUBLICKEY *libssh2_publickey_init(LIBSSH2_SESSION *session);
+
+LIBSSH2_API int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey,
+                                         const unsigned char *name,
+                                         unsigned long name_len,
+                                         const unsigned char *blob,
+                                         unsigned long blob_len, char overwrite,
+                                         unsigned long num_attrs,
+                                         const libssh2_publickey_attribute attrs[]);
+#define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \
+                              num_attrs, attrs)                         \
+  libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \
+                           (overwrite), (num_attrs), (attrs))
+
+LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey,
+                                            const unsigned char *name,
+                                            unsigned long name_len,
+                                            const unsigned char *blob,
+                                            unsigned long blob_len);
+#define libssh2_publickey_remove(pkey, name, blob, blob_len) \
+  libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len))
+
+LIBSSH2_API int
+libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey,
+                             unsigned long *num_keys,
+                             libssh2_publickey_list **pkey_list);
+LIBSSH2_API void libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey,
+                                             libssh2_publickey_list *pkey_list);
+
+LIBSSH2_API int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* ifndef: LIBSSH2_PUBLICKEY_H */
diff --git a/pgadmin/include/libssh2/libssh2_sftp.h b/pgadmin/include/libssh2/libssh2_sftp.h
new file mode 100644
index 0000000..74884fb
--- /dev/null
+++ b/pgadmin/include/libssh2/libssh2_sftp.h
@@ -0,0 +1,345 @@
+/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef LIBSSH2_SFTP_H
+#define LIBSSH2_SFTP_H 1
+
+#include "libssh2.h"
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Note: Version 6 was documented at the time of writing
+ * However it was marked as "DO NOT IMPLEMENT" due to pending changes
+ *
+ * Let's start with Version 3 (The version found in OpenSSH) and go from there
+ */
+#define LIBSSH2_SFTP_VERSION        3
+
+typedef struct _LIBSSH2_SFTP                LIBSSH2_SFTP;
+typedef struct _LIBSSH2_SFTP_HANDLE         LIBSSH2_SFTP_HANDLE;
+typedef struct _LIBSSH2_SFTP_ATTRIBUTES     LIBSSH2_SFTP_ATTRIBUTES;
+typedef struct _LIBSSH2_SFTP_STATVFS        LIBSSH2_SFTP_STATVFS;
+
+/* Flags for open_ex() */
+#define LIBSSH2_SFTP_OPENFILE           0
+#define LIBSSH2_SFTP_OPENDIR            1
+
+/* Flags for rename_ex() */
+#define LIBSSH2_SFTP_RENAME_OVERWRITE   0x00000001
+#define LIBSSH2_SFTP_RENAME_ATOMIC      0x00000002
+#define LIBSSH2_SFTP_RENAME_NATIVE      0x00000004
+
+/* Flags for stat_ex() */
+#define LIBSSH2_SFTP_STAT               0
+#define LIBSSH2_SFTP_LSTAT              1
+#define LIBSSH2_SFTP_SETSTAT            2
+
+/* Flags for symlink_ex() */
+#define LIBSSH2_SFTP_SYMLINK            0
+#define LIBSSH2_SFTP_READLINK           1
+#define LIBSSH2_SFTP_REALPATH           2
+
+/* SFTP attribute flag bits */
+#define LIBSSH2_SFTP_ATTR_SIZE              0x00000001
+#define LIBSSH2_SFTP_ATTR_UIDGID            0x00000002
+#define LIBSSH2_SFTP_ATTR_PERMISSIONS       0x00000004
+#define LIBSSH2_SFTP_ATTR_ACMODTIME         0x00000008
+#define LIBSSH2_SFTP_ATTR_EXTENDED          0x80000000
+
+/* SFTP statvfs flag bits */
+#define LIBSSH2_SFTP_ST_RDONLY              0x00000001
+#define LIBSSH2_SFTP_ST_NOSUID              0x00000002
+
+struct _LIBSSH2_SFTP_ATTRIBUTES {
+    /* If flags & ATTR_* bit is set, then the value in this struct will be
+     * meaningful Otherwise it should be ignored
+     */
+    unsigned long flags;
+
+    libssh2_uint64_t filesize;
+    unsigned long uid, gid;
+    unsigned long permissions;
+    unsigned long atime, mtime;
+};
+
+struct _LIBSSH2_SFTP_STATVFS {
+    libssh2_uint64_t  f_bsize;    /* file system block size */
+    libssh2_uint64_t  f_frsize;   /* fragment size */
+    libssh2_uint64_t  f_blocks;   /* size of fs in f_frsize units */
+    libssh2_uint64_t  f_bfree;    /* # free blocks */
+    libssh2_uint64_t  f_bavail;   /* # free blocks for non-root */
+    libssh2_uint64_t  f_files;    /* # inodes */
+    libssh2_uint64_t  f_ffree;    /* # free inodes */
+    libssh2_uint64_t  f_favail;   /* # free inodes for non-root */
+    libssh2_uint64_t  f_fsid;     /* file system ID */
+    libssh2_uint64_t  f_flag;     /* mount flags */
+    libssh2_uint64_t  f_namemax;  /* maximum filename length */
+};
+
+/* SFTP filetypes */
+#define LIBSSH2_SFTP_TYPE_REGULAR           1
+#define LIBSSH2_SFTP_TYPE_DIRECTORY         2
+#define LIBSSH2_SFTP_TYPE_SYMLINK           3
+#define LIBSSH2_SFTP_TYPE_SPECIAL           4
+#define LIBSSH2_SFTP_TYPE_UNKNOWN           5
+#define LIBSSH2_SFTP_TYPE_SOCKET            6
+#define LIBSSH2_SFTP_TYPE_CHAR_DEVICE       7
+#define LIBSSH2_SFTP_TYPE_BLOCK_DEVICE      8
+#define LIBSSH2_SFTP_TYPE_FIFO              9
+
+/*
+ * Reproduce the POSIX file modes here for systems that are not POSIX
+ * compliant.
+ *
+ * These is used in "permissions" of "struct _LIBSSH2_SFTP_ATTRIBUTES"
+ */
+/* File type */
+#define LIBSSH2_SFTP_S_IFMT         0170000     /* type of file mask */
+#define LIBSSH2_SFTP_S_IFIFO        0010000     /* named pipe (fifo) */
+#define LIBSSH2_SFTP_S_IFCHR        0020000     /* character special */
+#define LIBSSH2_SFTP_S_IFDIR        0040000     /* directory */
+#define LIBSSH2_SFTP_S_IFBLK        0060000     /* block special */
+#define LIBSSH2_SFTP_S_IFREG        0100000     /* regular */
+#define LIBSSH2_SFTP_S_IFLNK        0120000     /* symbolic link */
+#define LIBSSH2_SFTP_S_IFSOCK       0140000     /* socket */
+
+/* File mode */
+/* Read, write, execute/search by owner */
+#define LIBSSH2_SFTP_S_IRWXU        0000700     /* RWX mask for owner */
+#define LIBSSH2_SFTP_S_IRUSR        0000400     /* R for owner */
+#define LIBSSH2_SFTP_S_IWUSR        0000200     /* W for owner */
+#define LIBSSH2_SFTP_S_IXUSR        0000100     /* X for owner */
+/* Read, write, execute/search by group */
+#define LIBSSH2_SFTP_S_IRWXG        0000070     /* RWX mask for group */
+#define LIBSSH2_SFTP_S_IRGRP        0000040     /* R for group */
+#define LIBSSH2_SFTP_S_IWGRP        0000020     /* W for group */
+#define LIBSSH2_SFTP_S_IXGRP        0000010     /* X for group */
+/* Read, write, execute/search by others */
+#define LIBSSH2_SFTP_S_IRWXO        0000007     /* RWX mask for other */
+#define LIBSSH2_SFTP_S_IROTH        0000004     /* R for other */
+#define LIBSSH2_SFTP_S_IWOTH        0000002     /* W for other */
+#define LIBSSH2_SFTP_S_IXOTH        0000001     /* X for other */
+
+/* macros to check for specific file types, added in 1.2.5 */
+#define LIBSSH2_SFTP_S_ISLNK(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFLNK)
+#define LIBSSH2_SFTP_S_ISREG(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFREG)
+#define LIBSSH2_SFTP_S_ISDIR(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFDIR)
+#define LIBSSH2_SFTP_S_ISCHR(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFCHR)
+#define LIBSSH2_SFTP_S_ISBLK(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFBLK)
+#define LIBSSH2_SFTP_S_ISFIFO(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFIFO)
+#define LIBSSH2_SFTP_S_ISSOCK(m) \
+  (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK)
+
+/* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open())
+ * Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */
+#define LIBSSH2_FXF_READ                        0x00000001
+#define LIBSSH2_FXF_WRITE                       0x00000002
+#define LIBSSH2_FXF_APPEND                      0x00000004
+#define LIBSSH2_FXF_CREAT                       0x00000008
+#define LIBSSH2_FXF_TRUNC                       0x00000010
+#define LIBSSH2_FXF_EXCL                        0x00000020
+
+/* SFTP Status Codes (returned by libssh2_sftp_last_error() ) */
+#define LIBSSH2_FX_OK                       0
+#define LIBSSH2_FX_EOF                      1
+#define LIBSSH2_FX_NO_SUCH_FILE             2
+#define LIBSSH2_FX_PERMISSION_DENIED        3
+#define LIBSSH2_FX_FAILURE                  4
+#define LIBSSH2_FX_BAD_MESSAGE              5
+#define LIBSSH2_FX_NO_CONNECTION            6
+#define LIBSSH2_FX_CONNECTION_LOST          7
+#define LIBSSH2_FX_OP_UNSUPPORTED           8
+#define LIBSSH2_FX_INVALID_HANDLE           9
+#define LIBSSH2_FX_NO_SUCH_PATH             10
+#define LIBSSH2_FX_FILE_ALREADY_EXISTS      11
+#define LIBSSH2_FX_WRITE_PROTECT            12
+#define LIBSSH2_FX_NO_MEDIA                 13
+#define LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM   14
+#define LIBSSH2_FX_QUOTA_EXCEEDED           15
+#define LIBSSH2_FX_UNKNOWN_PRINCIPLE        16 /* Initial mis-spelling */
+#define LIBSSH2_FX_UNKNOWN_PRINCIPAL        16
+#define LIBSSH2_FX_LOCK_CONFlICT            17 /* Initial mis-spelling */
+#define LIBSSH2_FX_LOCK_CONFLICT            17
+#define LIBSSH2_FX_DIR_NOT_EMPTY            18
+#define LIBSSH2_FX_NOT_A_DIRECTORY          19
+#define LIBSSH2_FX_INVALID_FILENAME         20
+#define LIBSSH2_FX_LINK_LOOP                21
+
+/* Returned by any function that would block during a read/write opperation */
+#define LIBSSH2SFTP_EAGAIN LIBSSH2_ERROR_EAGAIN
+
+/* SFTP API */
+LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session);
+LIBSSH2_API int libssh2_sftp_shutdown(LIBSSH2_SFTP *sftp);
+LIBSSH2_API unsigned long libssh2_sftp_last_error(LIBSSH2_SFTP *sftp);
+LIBSSH2_API LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp);
+
+/* File / Directory Ops */
+LIBSSH2_API LIBSSH2_SFTP_HANDLE *libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp,
+                                                      const char *filename,
+                                                      unsigned int filename_len,
+                                                      unsigned long flags,
+                                                      long mode, int open_type);
+#define libssh2_sftp_open(sftp, filename, flags, mode) \
+    libssh2_sftp_open_ex((sftp), (filename), strlen(filename), (flags), \
+                         (mode), LIBSSH2_SFTP_OPENFILE)
+#define libssh2_sftp_opendir(sftp, path) \
+    libssh2_sftp_open_ex((sftp), (path), strlen(path), 0, 0, \
+                         LIBSSH2_SFTP_OPENDIR)
+
+LIBSSH2_API ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle,
+                                      char *buffer, size_t buffer_maxlen);
+
+LIBSSH2_API int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, \
+                                        char *buffer, size_t buffer_maxlen,
+                                        char *longentry,
+                                        size_t longentry_maxlen,
+                                        LIBSSH2_SFTP_ATTRIBUTES *attrs);
+#define libssh2_sftp_readdir(handle, buffer, buffer_maxlen, attrs)      \
+    libssh2_sftp_readdir_ex((handle), (buffer), (buffer_maxlen), NULL, 0, \
+                            (attrs))
+
+LIBSSH2_API ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle,
+                                       const char *buffer, size_t count);
+
+LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle);
+#define libssh2_sftp_close(handle) libssh2_sftp_close_handle(handle)
+#define libssh2_sftp_closedir(handle) libssh2_sftp_close_handle(handle)
+
+LIBSSH2_API void libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle, size_t offset);
+LIBSSH2_API void libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle,
+                                     libssh2_uint64_t offset);
+#define libssh2_sftp_rewind(handle) libssh2_sftp_seek64((handle), 0)
+
+LIBSSH2_API size_t libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle);
+LIBSSH2_API libssh2_uint64_t libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle);
+
+LIBSSH2_API int libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
+                                      LIBSSH2_SFTP_ATTRIBUTES *attrs,
+                                      int setstat);
+#define libssh2_sftp_fstat(handle, attrs) \
+    libssh2_sftp_fstat_ex((handle), (attrs), 0)
+#define libssh2_sftp_fsetstat(handle, attrs) \
+    libssh2_sftp_fstat_ex((handle), (attrs), 1)
+
+/* Miscellaneous Ops */
+LIBSSH2_API int libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp,
+                                       const char *source_filename,
+                                       unsigned int srouce_filename_len,
+                                       const char *dest_filename,
+                                       unsigned int dest_filename_len,
+                                       long flags);
+#define libssh2_sftp_rename(sftp, sourcefile, destfile) \
+    libssh2_sftp_rename_ex((sftp), (sourcefile), strlen(sourcefile), \
+                           (destfile), strlen(destfile),                \
+                           LIBSSH2_SFTP_RENAME_OVERWRITE | \
+                           LIBSSH2_SFTP_RENAME_ATOMIC | \
+                           LIBSSH2_SFTP_RENAME_NATIVE)
+
+LIBSSH2_API int libssh2_sftp_unlink_ex(LIBSSH2_SFTP *sftp,
+                                       const char *filename,
+                                       unsigned int filename_len);
+#define libssh2_sftp_unlink(sftp, filename) \
+    libssh2_sftp_unlink_ex((sftp), (filename), strlen(filename))
+
+LIBSSH2_API int libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle,
+                                      LIBSSH2_SFTP_STATVFS *st);
+
+LIBSSH2_API int libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp,
+                                     const char *path,
+                                     size_t path_len,
+                                     LIBSSH2_SFTP_STATVFS *st);
+
+LIBSSH2_API int libssh2_sftp_mkdir_ex(LIBSSH2_SFTP *sftp,
+                                      const char *path,
+                                      unsigned int path_len, long mode);
+#define libssh2_sftp_mkdir(sftp, path, mode) \
+    libssh2_sftp_mkdir_ex((sftp), (path), strlen(path), (mode))
+
+LIBSSH2_API int libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp,
+                                      const char *path,
+                                      unsigned int path_len);
+#define libssh2_sftp_rmdir(sftp, path) \
+    libssh2_sftp_rmdir_ex((sftp), (path), strlen(path))
+
+LIBSSH2_API int libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp,
+                                     const char *path,
+                                     unsigned int path_len,
+                                     int stat_type,
+                                     LIBSSH2_SFTP_ATTRIBUTES *attrs);
+#define libssh2_sftp_stat(sftp, path, attrs) \
+    libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_STAT, \
+                         (attrs))
+#define libssh2_sftp_lstat(sftp, path, attrs) \
+    libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_LSTAT, \
+                         (attrs))
+#define libssh2_sftp_setstat(sftp, path, attrs) \
+    libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_SETSTAT, \
+                         (attrs))
+
+LIBSSH2_API int libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp,
+                                        const char *path,
+                                        unsigned int path_len,
+                                        char *target,
+                                        unsigned int target_len, int link_type);
+#define libssh2_sftp_symlink(sftp, orig, linkpath) \
+    libssh2_sftp_symlink_ex((sftp), (orig), strlen(orig), (linkpath), \
+                            strlen(linkpath), LIBSSH2_SFTP_SYMLINK)
+#define libssh2_sftp_readlink(sftp, path, target, maxlen) \
+    libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \
+    LIBSSH2_SFTP_READLINK)
+#define libssh2_sftp_realpath(sftp, path, target, maxlen) \
+    libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \
+                            LIBSSH2_SFTP_REALPATH)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* LIBSSH2_SFTP_H */
diff --git a/pgadmin/include/libssh2/mac.h b/pgadmin/include/libssh2/mac.h
new file mode 100644
index 0000000..66d3e61
--- /dev/null
+++ b/pgadmin/include/libssh2/mac.h
@@ -0,0 +1,67 @@
+#ifndef __LIBSSH2_MAC_H
+#define __LIBSSH2_MAC_H
+
+/* Copyright (C) 2009-2010 by Daniel Stenberg
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+#include "libssh2_priv.h"
+
+struct _LIBSSH2_MAC_METHOD
+{
+    const char *name;
+
+    /* The length of a given MAC packet */
+    int mac_len;
+
+    /* integrity key length */
+    int key_len;
+
+    /* Message Authentication Code Hashing algo */
+    int (*init) (LIBSSH2_SESSION * session, unsigned char *key, int *free_key,
+                 void **abstract);
+    int (*hash) (LIBSSH2_SESSION * session, unsigned char *buf,
+                 uint32_t seqno, const unsigned char *packet,
+                 uint32_t packet_len, const unsigned char *addtl,
+                 uint32_t addtl_len, void **abstract);
+    int (*dtor) (LIBSSH2_SESSION * session, void **abstract);
+};
+
+typedef struct _LIBSSH2_MAC_METHOD LIBSSH2_MAC_METHOD;
+
+const LIBSSH2_MAC_METHOD **_libssh2_mac_methods(void);
+
+#endif /* __LIBSSH2_MAC_H */
diff --git a/pgadmin/include/libssh2/misc.h b/pgadmin/include/libssh2/misc.h
new file mode 100644
index 0000000..e25248d
--- /dev/null
+++ b/pgadmin/include/libssh2/misc.h
@@ -0,0 +1,94 @@
+#ifndef __LIBSSH2_MISC_H
+#define __LIBSSH2_MISC_H
+/* Copyright (c) 2009-2011 by Daniel Stenberg
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+struct list_head {
+    struct list_node *last;
+    struct list_node *first;
+};
+
+struct list_node {
+    struct list_node *next;
+    struct list_node *prev;
+    struct list_head *head;
+};
+
+int _libssh2_error(LIBSSH2_SESSION* session, int errcode, const char* errmsg);
+
+void _libssh2_list_init(struct list_head *head);
+
+/* add a node last in the list */
+void _libssh2_list_add(struct list_head *head,
+                       struct list_node *entry);
+
+/* return the "first" node in the list this head points to */
+void *_libssh2_list_first(struct list_head *head);
+
+/* return the next node in the list */
+void *_libssh2_list_next(struct list_node *node);
+
+/* return the prev node in the list */
+void *_libssh2_list_prev(struct list_node *node);
+
+/* remove this node from the list */
+void _libssh2_list_remove(struct list_node *entry);
+
+size_t _libssh2_base64_encode(struct _LIBSSH2_SESSION *session,
+                              const char *inp, size_t insize, char **outptr);
+
+unsigned int _libssh2_ntohu32(const unsigned char *buf);
+libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf);
+void _libssh2_htonu32(unsigned char *buf, uint32_t val);
+void _libssh2_store_u32(unsigned char **buf, uint32_t value);
+void _libssh2_store_str(unsigned char **buf, const char *str, size_t len);
+
+#if defined(LIBSSH2_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+/* provide a private one */
+#undef HAVE_GETTIMEOFDAY
+int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp);
+#define HAVE_LIBSSH2_GETTIMEOFDAY
+#define LIBSSH2_GETTIMEOFDAY_WIN32 /* enable the win32 implementation */
+#else
+#ifdef HAVE_GETTIMEOFDAY
+#define _libssh2_gettimeofday(x,y) gettimeofday(x,y)
+#define HAVE_LIBSSH2_GETTIMEOFDAY
+#endif
+#endif
+
+#endif /* _LIBSSH2_MISC_H */
diff --git a/pgadmin/include/libssh2/module.mk b/pgadmin/include/libssh2/module.mk
new file mode 100644
index 0000000..81bba3f
--- /dev/null
+++ b/pgadmin/include/libssh2/module.mk
@@ -0,0 +1,34 @@
+#######################################################################
+#
+# pgAdmin III - PostgreSQL Tools
+# 
+# Copyright (C) 2002 - 2012, The pgAdmin Development Team
+# This software is released under the PostgreSQL Licence
+#
+# module.mk - pgadmin/include/ Makefile fragment
+#
+#######################################################################
+
+if BUILD_SSH_TUNNEL
+
+pgadmin3_SOURCES += \
+		include/libssh2/channel.h \
+        include/libssh2/comp.h \
+        include/libssh2/crypto.h \
+        include/libssh2/libgcrypt.h \
+        include/libssh2/libssh2.h \
+        include/libssh2/libssh2_priv.h \
+        include/libssh2/libssh2_publickey.h \
+        include/libssh2/libssh2_sftp.h \
+        include/libssh2/mac.h \
+        include/libssh2/misc.h \
+        include/libssh2/openssl.h \
+        include/libssh2/packet.h \
+        include/libssh2/session.h \
+        include/libssh2/sftp.h \
+        include/libssh2/transport.h \
+        include/libssh2/userauth.h
+
+EXTRA_DIST += \
+	include/libssh2/module.mk
+endif
diff --git a/pgadmin/include/libssh2/openssl.h b/pgadmin/include/libssh2/openssl.h
new file mode 100644
index 0000000..6f21a1a
--- /dev/null
+++ b/pgadmin/include/libssh2/openssl.h
@@ -0,0 +1,187 @@
+/* Copyright (C) 2009, 2010 Simon Josefsson
+ * Copyright (C) 2006, 2007 The Written Word, Inc.  All rights reserved.
+ *
+ * Author: Simon Josefsson
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include <openssl/opensslconf.h>
+#include <openssl/sha.h>
+#ifndef OPENSSL_NO_MD5
+#include <openssl/md5.h>
+#endif
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#include <openssl/bn.h>
+#include <openssl/pem.h>
+#include <openssl/rand.h>
+
+#ifdef OPENSSL_NO_RSA
+# define LIBSSH2_RSA 0
+#else
+# define LIBSSH2_RSA 1
+#endif
+
+#ifdef OPENSSL_NO_DSA
+# define LIBSSH2_DSA 0
+#else
+# define LIBSSH2_DSA 1
+#endif
+
+#ifdef OPENSSL_NO_MD5
+# define LIBSSH2_MD5 0
+#else
+# define LIBSSH2_MD5 1
+#endif
+
+#ifdef OPENSSL_NO_RIPEMD
+# define LIBSSH2_HMAC_RIPEMD 0
+#else
+# define LIBSSH2_HMAC_RIPEMD 1
+#endif
+
+#if OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)
+# define LIBSSH2_AES_CTR 1
+# define LIBSSH2_AES 1
+#else
+# define LIBSSH2_AES_CTR 0
+# define LIBSSH2_AES 0
+#endif
+
+#ifdef OPENSSL_NO_BLOWFISH
+# define LIBSSH2_BLOWFISH 0
+#else
+# define LIBSSH2_BLOWFISH 1
+#endif
+
+#ifdef OPENSSL_NO_RC4
+# define LIBSSH2_RC4 0
+#else
+# define LIBSSH2_RC4 1
+#endif
+
+#ifdef OPENSSL_NO_CAST
+# define LIBSSH2_CAST 0
+#else
+# define LIBSSH2_CAST 1
+#endif
+
+#ifdef OPENSSL_NO_DES
+# define LIBSSH2_3DES 0
+#else
+# define LIBSSH2_3DES 1
+#endif
+
+#define _libssh2_random(buf, len) RAND_bytes ((buf), (len))
+
+#define libssh2_sha1_ctx EVP_MD_CTX
+#define libssh2_sha1_init(ctx) EVP_DigestInit(ctx, EVP_get_digestbyname("sha1"))
+#define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
+#define libssh2_sha1_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
+void libssh2_sha1(const unsigned char *message, unsigned long len, unsigned char *out);
+
+#define libssh2_md5_ctx EVP_MD_CTX
+
+/* returns 0 in case of failure */
+#define libssh2_md5_init(ctx) EVP_DigestInit(ctx, EVP_get_digestbyname("md5"))
+
+#define libssh2_md5_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
+#define libssh2_md5_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
+void libssh2_md5(const unsigned char *message, unsigned long len, unsigned char *out);
+
+#define libssh2_hmac_ctx HMAC_CTX
+#define libssh2_hmac_sha1_init(ctx, key, keylen) \
+  HMAC_Init(ctx, key, keylen, EVP_sha1())
+#define libssh2_hmac_md5_init(ctx, key, keylen) \
+  HMAC_Init(ctx, key, keylen, EVP_md5())
+#define libssh2_hmac_ripemd160_init(ctx, key, keylen) \
+  HMAC_Init(ctx, key, keylen, EVP_ripemd160())
+#define libssh2_hmac_update(ctx, data, datalen) \
+  HMAC_Update(&(ctx), data, datalen)
+#define libssh2_hmac_final(ctx, data) HMAC_Final(&(ctx), data, NULL)
+#define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx)
+
+#define libssh2_crypto_init() OpenSSL_add_all_algorithms()
+#define libssh2_crypto_exit()
+
+#define libssh2_rsa_ctx RSA
+
+#define _libssh2_rsa_free(rsactx) RSA_free(rsactx)
+
+#define libssh2_dsa_ctx DSA
+
+
+#define _libssh2_dsa_free(dsactx) DSA_free(dsactx)
+
+#define _libssh2_cipher_type(name) const EVP_CIPHER *(*name)(void)
+#define _libssh2_cipher_ctx EVP_CIPHER_CTX
+
+#define _libssh2_cipher_aes256 EVP_aes_256_cbc
+#define _libssh2_cipher_aes192 EVP_aes_192_cbc
+#define _libssh2_cipher_aes128 EVP_aes_128_cbc
+#ifdef HAVE_EVP_AES_128_CTR
+#define _libssh2_cipher_aes128ctr EVP_aes_128_ctr
+#define _libssh2_cipher_aes192ctr EVP_aes_192_ctr
+#define _libssh2_cipher_aes256ctr EVP_aes_256_ctr
+#else
+#define _libssh2_cipher_aes128ctr _libssh2_EVP_aes_128_ctr
+#define _libssh2_cipher_aes192ctr _libssh2_EVP_aes_192_ctr
+#define _libssh2_cipher_aes256ctr _libssh2_EVP_aes_256_ctr
+#endif
+#define _libssh2_cipher_blowfish EVP_bf_cbc
+#define _libssh2_cipher_arcfour EVP_rc4
+#define _libssh2_cipher_cast5 EVP_cast5_cbc
+#define _libssh2_cipher_3des EVP_des_ede3_cbc
+
+#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_cleanup(ctx)
+
+#define _libssh2_bn BIGNUM
+#define _libssh2_bn_ctx BN_CTX
+#define _libssh2_bn_ctx_new() BN_CTX_new()
+#define _libssh2_bn_ctx_free(bnctx) BN_CTX_free(bnctx)
+#define _libssh2_bn_init() BN_new()
+#define _libssh2_bn_rand(bn, bits, top, bottom) BN_rand(bn, bits, top, bottom)
+#define _libssh2_bn_mod_exp(r, a, p, m, ctx) BN_mod_exp(r, a, p, m, ctx)
+#define _libssh2_bn_set_word(bn, val) BN_set_word(bn, val)
+#define _libssh2_bn_from_bin(bn, len, val) BN_bin2bn(val, len, bn)
+#define _libssh2_bn_to_bin(bn, val) BN_bn2bin(bn, val)
+#define _libssh2_bn_bytes(bn) BN_num_bytes(bn)
+#define _libssh2_bn_bits(bn) BN_num_bits(bn)
+#define _libssh2_bn_free(bn) BN_clear_free(bn)
+
+const EVP_CIPHER *_libssh2_EVP_aes_128_ctr(void);
+const EVP_CIPHER *_libssh2_EVP_aes_192_ctr(void);
+const EVP_CIPHER *_libssh2_EVP_aes_256_ctr(void);
+
diff --git a/pgadmin/include/libssh2/packet.h b/pgadmin/include/libssh2/packet.h
new file mode 100644
index 0000000..d66b15b
--- /dev/null
+++ b/pgadmin/include/libssh2/packet.h
@@ -0,0 +1,76 @@
+#ifndef LIBSSH2_PACKET_H
+#define LIBSSH2_PACKET_H
+/*
+ * Copyright (C) 2010 by Daniel Stenberg
+ * Author: Daniel Stenberg <daniel@haxx.se>
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+int _libssh2_packet_read(LIBSSH2_SESSION * session);
+
+int _libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type,
+                        unsigned char **data, size_t *data_len,
+                        int match_ofs,
+                        const unsigned char *match_buf,
+                        size_t match_len);
+
+int _libssh2_packet_askv(LIBSSH2_SESSION * session,
+                         const unsigned char *packet_types,
+                         unsigned char **data, size_t *data_len,
+                         int match_ofs,
+                         const unsigned char *match_buf,
+                         size_t match_len);
+int _libssh2_packet_require(LIBSSH2_SESSION * session,
+                            unsigned char packet_type, unsigned char **data,
+                            size_t *data_len, int match_ofs,
+                            const unsigned char *match_buf,
+                            size_t match_len,
+                            packet_require_state_t * state);
+int _libssh2_packet_requirev(LIBSSH2_SESSION *session,
+                             const unsigned char *packet_types,
+                             unsigned char **data, size_t *data_len,
+                             int match_ofs,
+                             const unsigned char *match_buf,
+                             size_t match_len,
+                             packet_requirev_state_t * state);
+int _libssh2_packet_burn(LIBSSH2_SESSION * session,
+                         libssh2_nonblocking_states * state);
+int _libssh2_packet_write(LIBSSH2_SESSION * session, unsigned char *data,
+                          unsigned long data_len);
+int _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
+                        size_t datalen, int macstate);
+
+#endif /* LIBSSH2_PACKET_H */
diff --git a/pgadmin/include/libssh2/session.h b/pgadmin/include/libssh2/session.h
new file mode 100644
index 0000000..aff4f2c
--- /dev/null
+++ b/pgadmin/include/libssh2/session.h
@@ -0,0 +1,93 @@
+#ifndef LIBSSH2_SESSION_H
+#define LIBSSH2_SESSION_H
+/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2010 by Daniel Stenberg
+ * Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/* Conveniance-macros to allow code like this;
+
+   int rc = BLOCK_ADJUST(rc, session, session_startup(session, sock) );
+
+   int rc = BLOCK_ADJUST_ERRNO(ptr, session, session_startup(session, sock) );
+
+   The point of course being to make sure that while in non-blocking mode
+   these always return no matter what the return code is, but in blocking mode
+   it blocks if EAGAIN is the reason for the return from the underlying
+   function.
+
+*/
+#define BLOCK_ADJUST(rc,sess,x) \
+    do { \
+       time_t entry_time = time (NULL); \
+       do { \
+          rc = x; \
+          /* the order of the check below is important to properly deal with \
+             the case when the 'sess' is freed */ \
+          if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
+              break; \
+          rc = _libssh2_wait_socket(sess, entry_time);  \
+       } while(!rc);   \
+    } while(0)
+
+/*
+ * For functions that returns a pointer, we need to check if the API is
+ * non-blocking and return immediately. If the pointer is non-NULL we return
+ * immediately. If the API is blocking and we get a NULL we check the errno
+ * and *only* if that is EAGAIN we loop and wait for socket action.
+ */
+#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
+    do { \
+       time_t entry_time = time (NULL); \
+       int rc; \
+       do { \
+           ptr = x; \
+           if(!sess->api_block_mode || \
+              (ptr != NULL) || \
+              (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
+               break; \
+           rc = _libssh2_wait_socket(sess, entry_time); \
+        } while(!rc); \
+    } while(0)
+
+
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
+
+/* this is the lib-internal set blocking function */
+int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
+
+#endif /* LIBSSH2_SESSION_H */
diff --git a/pgadmin/include/libssh2/sftp.h b/pgadmin/include/libssh2/sftp.h
new file mode 100644
index 0000000..55bdb46
--- /dev/null
+++ b/pgadmin/include/libssh2/sftp.h
@@ -0,0 +1,230 @@
+#ifndef _LIBSSH2_SFTP_H
+#define _LIBSSH2_SFTP_H
+/*
+ * Copyright (C) 2010 - 2012 by Daniel Stenberg
+ * Author: Daniel Stenberg <daniel@haxx.se>
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * MAX_SFTP_OUTGOING_SIZE MUST not be larger than 32500 or so. This is the
+ * amount of data sent in each FXP_WRITE packet
+ */
+#define MAX_SFTP_OUTGOING_SIZE 30000
+
+/* MAX_SFTP_READ_SIZE is how much data is asked for at max in each FXP_READ
+ * packets.
+ */
+#define MAX_SFTP_READ_SIZE 2000
+
+struct sftp_pipeline_chunk {
+    struct list_node node;
+    size_t len; /* WRITE: size of the data to write
+                   READ: how many bytes that was asked for */
+    size_t sent;
+    ssize_t lefttosend; /* if 0, the entire packet has been sent off */
+    uint32_t request_id;
+    unsigned char packet[1]; /* data */
+};
+
+struct sftp_zombie_requests {
+    struct list_node node;
+    uint32_t request_id;
+};
+
+#ifndef MIN
+#define MIN(x,y) ((x)<(y)?(x):(y))
+#endif
+
+struct _LIBSSH2_SFTP_PACKET
+{
+    struct list_node node;   /* linked list header */
+    uint32_t request_id;
+    unsigned char *data;
+    size_t data_len;              /* payload size */
+};
+
+typedef struct _LIBSSH2_SFTP_PACKET LIBSSH2_SFTP_PACKET;
+
+#define SFTP_HANDLE_MAXLEN 256 /* according to spec! */
+
+struct _LIBSSH2_SFTP_HANDLE
+{
+    struct list_node node;
+
+    LIBSSH2_SFTP *sftp;
+
+    char handle[SFTP_HANDLE_MAXLEN];
+    size_t handle_len;
+
+    enum {
+        LIBSSH2_SFTP_HANDLE_FILE,
+        LIBSSH2_SFTP_HANDLE_DIR
+    } handle_type;
+
+    union _libssh2_sftp_handle_data
+    {
+        struct _libssh2_sftp_handle_file_data
+        {
+            libssh2_uint64_t offset;
+            libssh2_uint64_t offset_sent;
+            size_t acked; /* container for acked data that hasn't been
+                             returned to caller yet, used for sftp_write */
+
+            /* 'data' is used by sftp_read() and is allocated data that has
+               been received already from the server but wasn't returned to
+               the caller yet. It is of size 'data_len' and 'data_left is the
+               number of bytes not yet returned, counted from the end of the
+               buffer. */
+            unsigned char *data;
+            size_t data_len;
+            size_t data_left;
+
+            char eof; /* we have read to the end */
+        } file;
+        struct _libssh2_sftp_handle_dir_data
+        {
+            uint32_t names_left;
+            void *names_packet;
+            char *next_name;
+        } dir;
+    } u;
+
+    /* State variables used in libssh2_sftp_close_handle() */
+    libssh2_nonblocking_states close_state;
+    uint32_t close_request_id;
+    unsigned char *close_packet;
+
+    /* list of outstanding packets sent to server */
+    struct list_head packet_list;
+
+};
+
+struct _LIBSSH2_SFTP
+{
+    LIBSSH2_CHANNEL *channel;
+
+    uint32_t request_id, version;
+
+    struct list_head packets;
+
+    /* List of FXP_READ responses to ignore because EOF already received. */
+    struct list_head zombie_requests;
+
+    /* a list of _LIBSSH2_SFTP_HANDLE structs */
+    struct list_head sftp_handles;
+
+    uint32_t last_errno;
+
+    /* Holder for partial packet, use in libssh2_sftp_packet_read() */
+    unsigned char partial_size[4];      /* buffer for size field   */
+    size_t partial_size_len;            /* size field length       */
+    unsigned char *partial_packet;      /* The data                */
+    uint32_t partial_len;               /* Desired number of bytes */
+    size_t partial_received;            /* Bytes received so far   */
+
+    /* Time that libssh2_sftp_packet_requirev() started reading */
+    time_t requirev_start;
+
+    /* State variables used in libssh2_sftp_open_ex() */
+    libssh2_nonblocking_states open_state;
+    unsigned char *open_packet;
+    uint32_t open_packet_len; /* 32 bit on the wire */
+    size_t open_packet_sent;
+    uint32_t open_request_id;
+
+    /* State variable used in sftp_read() */
+    libssh2_nonblocking_states read_state;
+
+    /* State variable used in sftp_packet_read() */
+    libssh2_nonblocking_states packet_state;
+
+    /* State variable used in sftp_write() */
+    libssh2_nonblocking_states write_state;
+
+    /* State variables used in libssh2_sftp_readdir() */
+    libssh2_nonblocking_states readdir_state;
+    unsigned char *readdir_packet;
+    uint32_t readdir_request_id;
+
+    /* State variables used in libssh2_sftp_fstat_ex() */
+    libssh2_nonblocking_states fstat_state;
+    unsigned char *fstat_packet;
+    uint32_t fstat_request_id;
+
+    /* State variables used in libssh2_sftp_unlink_ex() */
+    libssh2_nonblocking_states unlink_state;
+    unsigned char *unlink_packet;
+    uint32_t unlink_request_id;
+
+    /* State variables used in libssh2_sftp_rename_ex() */
+    libssh2_nonblocking_states rename_state;
+    unsigned char *rename_packet;
+    unsigned char *rename_s;
+    uint32_t rename_request_id;
+
+    /* State variables used in libssh2_sftp_fstatvfs() */
+    libssh2_nonblocking_states fstatvfs_state;
+    unsigned char *fstatvfs_packet;
+    uint32_t fstatvfs_request_id;
+
+    /* State variables used in libssh2_sftp_statvfs() */
+    libssh2_nonblocking_states statvfs_state;
+    unsigned char *statvfs_packet;
+    uint32_t statvfs_request_id;
+
+    /* State variables used in libssh2_sftp_mkdir() */
+    libssh2_nonblocking_states mkdir_state;
+    unsigned char *mkdir_packet;
+    uint32_t mkdir_request_id;
+
+    /* State variables used in libssh2_sftp_rmdir() */
+    libssh2_nonblocking_states rmdir_state;
+    unsigned char *rmdir_packet;
+    uint32_t rmdir_request_id;
+
+    /* State variables used in libssh2_sftp_stat() */
+    libssh2_nonblocking_states stat_state;
+    unsigned char *stat_packet;
+    uint32_t stat_request_id;
+
+    /* State variables used in libssh2_sftp_symlink() */
+    libssh2_nonblocking_states symlink_state;
+    unsigned char *symlink_packet;
+    uint32_t symlink_request_id;
+};
+
+#endif
diff --git a/pgadmin/include/libssh2/transport.h b/pgadmin/include/libssh2/transport.h
new file mode 100644
index 0000000..89982a6
--- /dev/null
+++ b/pgadmin/include/libssh2/transport.h
@@ -0,0 +1,87 @@
+#ifndef __LIBSSH2_TRANSPORT_H
+#define __LIBSSH2_TRANSPORT_H
+
+/* Copyright (C) 2007 The Written Word, Inc.  All rights reserved.
+ * Copyright (C) 2009-2010 by Daniel Stenberg
+ * Author: Daniel Stenberg <daniel@haxx.se>
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file handles reading and writing to the SECSH transport layer. RFC4253.
+ */
+
+#include "libssh2_priv.h"
+#include "packet.h"
+
+
+/*
+ * libssh2_transport_send
+ *
+ * Send a packet, encrypting it and adding a MAC code if necessary
+ * Returns 0 on success, non-zero on failure.
+ *
+ * The data is provided as _two_ data areas that are combined by this
+ * function.  The 'data' part is sent immediately before 'data2'. 'data2' can
+ * be set to NULL (or data2_len to 0) to only use a single part.
+ *
+ * Returns LIBSSH2_ERROR_EAGAIN if it would block or if the whole packet was
+ * not sent yet. If it does so, the caller should call this function again as
+ * soon as it is likely that more data can be sent, and this function MUST
+ * then be called with the same argument set (same data pointer and same
+ * data_len) until ERROR_NONE or failure is returned.
+ *
+ * This function DOES NOT call _libssh2_error() on any errors.
+ */
+int _libssh2_transport_send(LIBSSH2_SESSION *session,
+                            const unsigned char *data, size_t data_len,
+                            const unsigned char *data2, size_t data2_len);
+
+/*
+ * _libssh2_transport_read
+ *
+ * Collect a packet into the input brigade block only controls whether or not
+ * to wait for a packet to start.
+ *
+ * Returns packet type added to input brigade (PACKET_NONE if nothing added),
+ * or PACKET_FAIL on failure and PACKET_EAGAIN if it couldn't process a full
+ * packet.
+ */
+
+/*
+ * This function reads the binary stream as specified in chapter 6 of RFC4253
+ * "The Secure Shell (SSH) Transport Layer Protocol"
+ */
+int _libssh2_transport_read(LIBSSH2_SESSION * session);
+
+#endif /* __LIBSSH2_TRANSPORT_H */
diff --git a/pgadmin/include/libssh2/userauth.h b/pgadmin/include/libssh2/userauth.h
new file mode 100644
index 0000000..c0442ae
--- /dev/null
+++ b/pgadmin/include/libssh2/userauth.h
@@ -0,0 +1,50 @@
+#ifndef LIBSSH2_USERAUTH_H
+#define LIBSSH2_USERAUTH_H
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2010 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+int
+_libssh2_userauth_publickey(LIBSSH2_SESSION *session,
+                            const char *username,
+                            unsigned int username_len,
+                            const unsigned char *pubkeydata,
+                            unsigned long pubkeydata_len,
+                            LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)),
+                            void *abstract);
+
+#endif /* LIBSSH2_USERAUTH_H */
diff --git a/pgadmin/include/module.mk b/pgadmin/include/module.mk
index 2224b96..47775a9 100644
--- a/pgadmin/include/module.mk
+++ b/pgadmin/include/module.mk
@@ -36,4 +36,5 @@ include include/gqb/module.mk
 include include/hotdraw/module.mk
 include include/utils/module.mk
 include include/ogl/module.mk
+include include/libssh2/module.mk
 
diff --git a/pgadmin/include/pgAdmin3.h b/pgadmin/include/pgAdmin3.h
index a37ca93..0e67099 100644
--- a/pgadmin/include/pgAdmin3.h
+++ b/pgadmin/include/pgAdmin3.h
@@ -19,6 +19,10 @@
 #include <wx/listctrl.h>
 #include <wx/xrc/xmlres.h>
 
+#ifdef WIN32
+#include <winsock2.h>
+#endif
+
 #include "utils/misc.h"
 #include <ctl/ctlTree.h>
 #include "ctl/ctlSQLBox.h"
@@ -91,6 +95,11 @@ extern wxLocale *locale;                // Application locale
 extern wxArrayInt existingLangs;        // Language IDs
 extern wxArrayString existingLangNames; // Language Names
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+class CSSHTunnelThread;
+extern CSSHTunnelThread *pgadminTunnelThread; // SSH Tunneling Thread Object
+#endif
+
 // Helper app paths - PG
 extern wxString pgBackupExecutable;
 extern wxString pgBackupAllExecutable;
diff --git a/pgadmin/include/schema/pgServer.h b/pgadmin/include/schema/pgServer.h
index ff58c24..618ffb6 100644
--- a/pgadmin/include/schema/pgServer.h
+++ b/pgadmin/include/schema/pgServer.h
@@ -15,9 +15,8 @@
 #include "db/pgConn.h"
 #include "pgCollection.h"
 
-
 class frmMain;
-
+class pgServer;
 
 class pgServerFactory : public pgaFactory
 {
@@ -37,11 +36,19 @@ protected:
 };
 extern pgServerFactory serverFactory;
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+class CSSHTunnelThread;
+#endif
 
 class pgServer : public pgObject
 {
 public:
-	pgServer(const wxString &newServer = wxT(""), const wxString &newHostAddr = wxT(""), const wxString &newDescription = wxT(""), const wxString &newService = wxT(""), const wxString &newDatabase = wxT(""), const wxString &newUsername = wxT(""), int newPort = 5432, bool storePwd = false, const wxString &newRolename = wxT(""), bool restore = true, int sslMode = 0, const wxString &colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).GetAsString(wxC2S_HTML_SYNTAX), const wxString &group = wxEmptyString);
+	pgServer(const wxString &newServer = wxT(""), const wxString &newHostAddr = wxT(""), const wxString &newDescription = wxT(""),
+	         const wxString &newService = wxT(""), const wxString &newDatabase = wxT(""), const wxString &newUsername = wxT(""), int newPort = 5432,
+	         bool storePwd = false, const wxString &newRolename = wxT(""), bool restore = true, int sslMode = 0,
+	         const wxString &colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).GetAsString(wxC2S_HTML_SYNTAX), const wxString &group = wxEmptyString,
+	         bool sshTunnel = false, const wxString &newTunnelHost = wxEmptyString, const wxString &newTunnelUserName = wxEmptyString, bool authModePwd = true,
+	         const wxString &newTunnelPassword = wxEmptyString, const wxString &newPublicKey = wxEmptyString, const wxString &newIdentityFile = wxEmptyString);
 	~pgServer();
 	int GetIconId();
 
@@ -50,7 +57,7 @@ public:
 		return wxT("Server");
 	}
 	wxString GetTranslatedMessage(int kindOfMessage) const;
-	int Connect(frmMain *form, bool askPassword = true, const wxString &pwd = wxEmptyString, bool forceStorePassword = false);
+	int Connect(frmMain *form, bool askPassword = true, const wxString &pwd = wxEmptyString, bool forceStorePassword = false, bool askTunnelPassword = false);
 	bool Disconnect(frmMain *form);
 	void StorePassword();
 	bool GetPasswordIsStored();
@@ -390,7 +397,6 @@ public:
 		return conn;
 	}
 
-
 	wxString GetSSLCert() const
 	{
 		return sslcert;
@@ -433,6 +439,82 @@ public:
 		sslcompression = b;
 	}
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	//SSH Tunnel
+	bool GetSSHTunnel() const
+	{
+		return sshTunnel;
+	}
+	void iSetSSHTunnel(const bool b)
+	{
+		sshTunnel = b;
+	}
+	bool GetAuthModePwd() const
+	{
+		return authModePwd;
+	}
+	void iSetAuthModePwd(const bool b)
+	{
+		authModePwd = b;
+	}
+	wxString GetLocalListenHost() const
+	{
+		return local_listenhost;
+	}
+	void SetLocalListenHost(const wxString &s)
+	{
+		local_listenhost = s;
+	}
+	int GetLocalListenPort() const
+	{
+		return local_listenport;
+	}
+	void SetLocalListenPort(int newVal)
+	{
+		local_listenport = newVal;
+	}
+	wxString GetTunnelHost() const
+	{
+		return tunnelHost;
+	}
+	void SetTunnelHost(const wxString &s)
+	{
+		tunnelHost = s;
+	}
+	wxString GetTunnelUserName() const
+	{
+		return tunnelUserName;
+	}
+	void SetTunnelUserName(const wxString &s)
+	{
+		tunnelUserName = s;
+	}
+	wxString GetTunnelPassword() const
+	{
+		return tunnelPassword;
+	}
+	void SetTunnelPassword(const wxString &s)
+	{
+		tunnelPassword = s;
+	}
+	wxString GetPublicKeyFile() const
+	{
+		return publicKeyFile;
+	}
+	void SetPublicKeyFile(const wxString &s)
+	{
+		publicKeyFile = s;
+	}
+	wxString GetIdentityFile() const
+	{
+		return identityFile;
+	}
+	void SetIdentityFile(const wxString &s)
+	{
+		identityFile = s;
+	}
+#endif
+
 	void ShowDependencies(frmMain *form, ctlListView *Dependencies, const wxString &where = wxEmptyString);
 	void ShowDependents(frmMain *form, ctlListView *referencedBy, const wxString &where = wxEmptyString);
 
@@ -455,11 +537,22 @@ private:
 	wxString group;
 	wxString sslcert, sslkey, sslrootcert, sslcrl;
 	bool sslcompression;
+	bool sshTunnel;
 
 	bool inRecovery, replayPaused;
 	wxString receiveLoc, replayLoc, replayTimestamp;
 	wxDateTime confLoadedSince;
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	bool createSSHTunnel();
+
+	//SSH Tunnel
+	CSSHTunnelThread *tunnelObj;
+	bool authModePwd;
+	int local_listenport;
+	wxString tunnelHost, tunnelUserName, tunnelPassword, publicKeyFile, identityFile, local_listenhost;
+#endif
+
 #ifdef WIN32
 	SC_HANDLE scmHandle;
 	SC_HANDLE serviceHandle;
diff --git a/pgadmin/include/utils/misc.h b/pgadmin/include/utils/misc.h
index 57fbfce..51a1102 100644
--- a/pgadmin/include/utils/misc.h
+++ b/pgadmin/include/utils/misc.h
@@ -26,6 +26,7 @@ class wxHelpControllerBase;
 #define __(str) wxT(str)
 
 typedef unsigned long OID;
+#define SSH_MAX_PASSWORD_LEN 256
 
 // we dont have an appropriate wxLongLong method
 #ifdef __WIN32__
diff --git a/pgadmin/include/utils/module.mk b/pgadmin/include/utils/module.mk
index da8811c..41d5546 100644
--- a/pgadmin/include/utils/module.mk
+++ b/pgadmin/include/utils/module.mk
@@ -24,6 +24,11 @@ pgadmin3_SOURCES += \
 	include/utils/utffile.h \
 	include/utils/macros.h
 
+if BUILD_SSH_TUNNEL
+pgadmin3_SOURCES += \
+	include/utils/sshTunnel.h
+endif
+
 EXTRA_DIST += \
         include/utils/module.mk
 
diff --git a/pgadmin/include/utils/sshTunnel.h b/pgadmin/include/utils/sshTunnel.h
new file mode 100644
index 0000000..18e7a48
--- /dev/null
+++ b/pgadmin/include/utils/sshTunnel.h
@@ -0,0 +1,117 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+//
+// Copyright (C) 2002 - 2013, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// sshTunnel.h - Used to create SSH Tunnels
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __SSH_TUNNELING
+#define __SSH_TUNNELING
+
+#include <wx/wx.h>
+#include <wx/defs.h>
+
+#ifdef WIN32
+#include <ws2tcpip.h>
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <errno.h>
+#endif
+
+#include <wx/thread.h>
+#include <wx/arrstr.h>
+#include <wx/hashset.h>
+#include "utils/misc.h"
+
+struct _LIBSSH2_CHANNEL;
+struct _LIBSSH2_SESSION;
+struct _LIBSSH2_USERAUTH_KBDINT_PROMPT;
+struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE;
+
+enum enAuthenticationMethod
+{
+    AUTH_NONE = 0,
+    AUTH_PASSWORD,
+    AUTH_KEYBOARD_INTERACTIVE,
+    AUTH_PUBLICKEY = 4
+};
+
+void LogSSHTunnelErrors(const wxString &msg, const int &id);
+static wxMutex g_SSHThreadMutex;
+
+WX_DECLARE_HASH_SET( int, wxIntegerHash, wxIntegerEqual, subThreadSDSet);
+static subThreadSDSet g_setSocketDescriptor;
+
+class CSSHTunnelThread :
+	public wxThread
+{
+public:
+	CSSHTunnelThread(const wxString tunnelhost, const wxString remote_desthost, const unsigned int remote_destport,
+	                 const wxString username, const wxString password, const wxString publickey, const wxString privatekey,
+	                 const enAuthenticationMethod &enAuthMethod);
+	virtual ~CSSHTunnelThread(void);
+	virtual void *Entry();
+	bool Initialize();
+	void Cleanup();
+
+	wxString GetLocalListenIP() const
+	{
+		return m_local_listenip;
+	}
+
+	unsigned int GetLocalListenPort() const
+	{
+		return m_local_listenport;
+	}
+
+private:
+	bool resolveDNS(const char *host, wxArrayString &arrIPAddress);
+	static void keyboard_interactive(const char *name, int name_len, const char *instr, int instr_len,
+	                                 int num_prompts, const struct _LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE *res, void **abstract);
+
+	int m_listensock, m_sock;
+	struct sockaddr_in m_sin;
+	socklen_t m_sinlen;
+	struct _LIBSSH2_SESSION *m_session;
+	static char m_keyboard_interactive_pwd[SSH_MAX_PASSWORD_LEN];
+
+	wxString m_publickey;
+	wxString m_privatekey;
+	wxString m_username;
+	wxString m_password;
+	wxString m_tunnelhost;
+	wxString m_local_listenip;
+	wxString m_remote_desthost;
+	unsigned int m_local_listenport;
+	unsigned int m_remote_destport;
+	enAuthenticationMethod m_enAuthMethod;
+};
+
+class CSubThread :
+	public wxThread
+{
+public:
+	CSubThread(const struct sockaddr_in sin, const wxString remote_desthost, const unsigned int remote_destport,
+	           struct _LIBSSH2_SESSION *session, int forwardsock);
+	virtual ~CSubThread(void);
+	virtual void *Entry();
+
+private:
+	struct sockaddr_in m_sin;
+	wxString m_remote_desthost;
+	unsigned int m_remote_destport;
+	struct _LIBSSH2_SESSION *m_subThreadSession;
+	struct _LIBSSH2_CHANNEL *m_channel;
+	int m_forwardsock;
+};
+
+#endif
diff --git a/pgadmin/libssh2/agent.c b/pgadmin/libssh2/agent.c
new file mode 100644
index 0000000..1c65149
--- /dev/null
+++ b/pgadmin/libssh2/agent.c
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 2009 by Daiki Ueno
+ * Copyright (C) 2010 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "misc.h"
+#include <errno.h>
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#else
+/* Use the existence of sys/un.h as a test if Unix domain socket is
+   supported.  winsock*.h define PF_UNIX/AF_UNIX but do not actually
+   support them. */
+#undef PF_UNIX
+#endif
+#include "userauth.h"
+#include "session.h"
+
+/* Requests from client to agent for protocol 1 key operations */
+#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
+#define SSH_AGENTC_RSA_CHALLENGE 3
+#define SSH_AGENTC_ADD_RSA_IDENTITY 7
+#define SSH_AGENTC_REMOVE_RSA_IDENTITY 8
+#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9
+#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24
+
+/* Requests from client to agent for protocol 2 key operations */
+#define SSH2_AGENTC_REQUEST_IDENTITIES 11
+#define SSH2_AGENTC_SIGN_REQUEST 13
+#define SSH2_AGENTC_ADD_IDENTITY 17
+#define SSH2_AGENTC_REMOVE_IDENTITY 18
+#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
+#define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
+
+/* Key-type independent requests from client to agent */
+#define SSH_AGENTC_ADD_SMARTCARD_KEY 20
+#define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21
+#define SSH_AGENTC_LOCK 22
+#define SSH_AGENTC_UNLOCK 23
+#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
+
+/* Generic replies from agent to client */
+#define SSH_AGENT_FAILURE 5
+#define SSH_AGENT_SUCCESS 6
+
+/* Replies from agent to client for protocol 1 key operations */
+#define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
+#define SSH_AGENT_RSA_RESPONSE 4
+
+/* Replies from agent to client for protocol 2 key operations */
+#define SSH2_AGENT_IDENTITIES_ANSWER 12
+#define SSH2_AGENT_SIGN_RESPONSE 14
+
+/* Key constraint identifiers */
+#define SSH_AGENT_CONSTRAIN_LIFETIME 1
+#define SSH_AGENT_CONSTRAIN_CONFIRM 2
+
+/* non-blocking mode on agent connection is not yet implemented, but
+   for future use. */
+typedef enum {
+    agent_NB_state_init = 0,
+    agent_NB_state_request_created,
+    agent_NB_state_request_length_sent,
+    agent_NB_state_request_sent,
+    agent_NB_state_response_length_received,
+    agent_NB_state_response_received
+} agent_nonblocking_states;
+
+typedef struct agent_transaction_ctx {
+    unsigned char *request;
+    size_t request_len;
+    unsigned char *response;
+    size_t response_len;
+    agent_nonblocking_states state;
+} *agent_transaction_ctx_t;
+
+typedef int (*agent_connect_func)(LIBSSH2_AGENT *agent);
+typedef int (*agent_transact_func)(LIBSSH2_AGENT *agent,
+                                   agent_transaction_ctx_t transctx);
+typedef int (*agent_disconnect_func)(LIBSSH2_AGENT *agent);
+
+struct agent_publickey {
+    struct list_node node;
+
+    /* this is the struct we expose externally */
+    struct libssh2_agent_publickey external;
+};
+
+struct agent_ops {
+    agent_connect_func connect;
+    agent_transact_func transact;
+    agent_disconnect_func disconnect;
+};
+
+struct _LIBSSH2_AGENT
+{
+    LIBSSH2_SESSION *session;  /* the session this "belongs to" */
+
+    libssh2_socket_t fd;
+
+    struct agent_ops *ops;
+
+    struct agent_transaction_ctx transctx;
+    struct agent_publickey *identity;
+    struct list_head head;              /* list of public keys */
+};
+
+#ifdef PF_UNIX
+static int
+agent_connect_unix(LIBSSH2_AGENT *agent)
+{
+    const char *path;
+    struct sockaddr_un s_un;
+
+    path = getenv("SSH_AUTH_SOCK");
+    if (!path)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_USE,
+                              "no auth sock variable");
+
+    agent->fd = socket(PF_UNIX, SOCK_STREAM, 0);
+    if (agent->fd < 0)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_SOCKET,
+                              "failed creating socket");
+
+    s_un.sun_family = AF_UNIX;
+    strncpy (s_un.sun_path, path, sizeof s_un.sun_path);
+    if (connect(agent->fd, (struct sockaddr*)(&s_un), sizeof s_un) != 0) {
+        close (agent->fd);
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
+                              "failed connecting with agent");
+    }
+
+    return LIBSSH2_ERROR_NONE;
+}
+
+static int
+agent_transact_unix(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
+{
+    unsigned char buf[4];
+    int rc;
+
+    /* Send the length of the request */
+    if (transctx->state == agent_NB_state_request_created) {
+        _libssh2_htonu32(buf, transctx->request_len);
+        rc = LIBSSH2_SEND_FD(agent->session, agent->fd, buf, sizeof buf, 0);
+        if (rc == -EAGAIN)
+            return LIBSSH2_ERROR_EAGAIN;
+        else if (rc < 0)
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "agent send failed");
+        transctx->state = agent_NB_state_request_length_sent;
+    }
+
+    /* Send the request body */
+    if (transctx->state == agent_NB_state_request_length_sent) {
+        rc = LIBSSH2_SEND_FD(agent->session, agent->fd, transctx->request,
+                           transctx->request_len, 0);
+        if (rc == -EAGAIN)
+            return LIBSSH2_ERROR_EAGAIN;
+        else if (rc < 0)
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "agent send failed");
+        transctx->state = agent_NB_state_request_sent;
+    }
+
+    /* Receive the length of a response */
+    if (transctx->state == agent_NB_state_request_sent) {
+        rc = LIBSSH2_RECV_FD(agent->session, agent->fd, buf, sizeof buf, 0);
+        if (rc < 0) {
+            if (rc == -EAGAIN)
+                return LIBSSH2_ERROR_EAGAIN;
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_SOCKET_RECV,
+                                  "agent recv failed");
+        }
+        transctx->response_len = _libssh2_ntohu32(buf);
+        transctx->response = LIBSSH2_ALLOC(agent->session,
+                                           transctx->response_len);
+        if (!transctx->response)
+            return LIBSSH2_ERROR_ALLOC;
+
+        transctx->state = agent_NB_state_response_length_received;
+    }
+
+    /* Receive the response body */
+    if (transctx->state == agent_NB_state_response_length_received) {
+        rc = LIBSSH2_RECV_FD(agent->session, agent->fd, transctx->response,
+                           transctx->response_len, 0);
+        if (rc < 0) {
+            if (rc == -EAGAIN)
+                return LIBSSH2_ERROR_EAGAIN;
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "agent recv failed");
+        }
+        transctx->state = agent_NB_state_response_received;
+    }
+
+    return 0;
+}
+
+static int
+agent_disconnect_unix(LIBSSH2_AGENT *agent)
+{
+    int ret;
+    ret = close(agent->fd);
+
+    if(ret == -1)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_SOCKET_DISCONNECT,
+                              "failed closing the agent socket");
+    return LIBSSH2_ERROR_NONE;
+}
+
+struct agent_ops agent_ops_unix = {
+    agent_connect_unix,
+    agent_transact_unix,
+    agent_disconnect_unix
+};
+#endif  /* PF_UNIX */
+
+#ifdef WIN32
+/* Code to talk to Pageant was taken from PuTTY.
+ *
+ * Portions copyright Robert de Bath, Joris van Rantwijk, Delian
+ * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas
+ * Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa,
+ * Markus Kuhn, Colin Watson, and CORE SDI S.A.
+ */
+#define PAGEANT_COPYDATA_ID 0x804e50ba   /* random goop */
+#define PAGEANT_MAX_MSGLEN  8192
+
+static int
+agent_connect_pageant(LIBSSH2_AGENT *agent)
+{
+    HWND hwnd;
+    hwnd = FindWindow("Pageant", "Pageant");
+    if (!hwnd)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
+                              "failed connecting agent");
+    agent->fd = 0;         /* Mark as the connection has been established */
+    return LIBSSH2_ERROR_NONE;
+}
+
+static int
+agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
+{
+    HWND hwnd;
+    char mapname[23];
+    HANDLE filemap;
+    unsigned char *p;
+    unsigned char *p2;
+    int id;
+    COPYDATASTRUCT cds;
+
+    if (!transctx || 4 + transctx->request_len > PAGEANT_MAX_MSGLEN)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_INVAL,
+                              "illegal input");
+
+    hwnd = FindWindow("Pageant", "Pageant");
+    if (!hwnd)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
+                              "found no pageant");
+
+    sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
+    filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
+                                0, PAGEANT_MAX_MSGLEN, mapname);
+
+    if (filemap == NULL || filemap == INVALID_HANDLE_VALUE)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
+                              "failed setting up pageant filemap");
+
+    p2 = p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
+    _libssh2_store_str(&p2, (const char *)transctx->request,
+                       transctx->request_len);
+
+    cds.dwData = PAGEANT_COPYDATA_ID;
+    cds.cbData = 1 + strlen(mapname);
+    cds.lpData = mapname;
+
+    id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds);
+    if (id > 0) {
+        transctx->response_len = _libssh2_ntohu32(p);
+        if (transctx->response_len > PAGEANT_MAX_MSGLEN) {
+            UnmapViewOfFile(p);
+            CloseHandle(filemap);
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
+                                  "agent setup fail");
+        }
+        transctx->response = LIBSSH2_ALLOC(agent->session,
+                                           transctx->response_len);
+        if (!transctx->response) {
+            UnmapViewOfFile(p);
+            CloseHandle(filemap);
+            return _libssh2_error(agent->session, LIBSSH2_ERROR_ALLOC,
+                                  "agent malloc");
+        }
+        memcpy(transctx->response, p + 4, transctx->response_len);
+    }
+
+    UnmapViewOfFile(p);
+    CloseHandle(filemap);
+    return 0;
+}
+
+static int
+agent_disconnect_pageant(LIBSSH2_AGENT *agent)
+{
+    agent->fd = LIBSSH2_INVALID_SOCKET;
+    return 0;
+}
+
+struct agent_ops agent_ops_pageant = {
+    agent_connect_pageant,
+    agent_transact_pageant,
+    agent_disconnect_pageant
+};
+#endif  /* WIN32 */
+
+static struct {
+    const char *name;
+    struct agent_ops *ops;
+} supported_backends[] = {
+#ifdef WIN32
+    {"Pageant", &agent_ops_pageant},
+#endif  /* WIN32 */
+#ifdef PF_UNIX
+    {"Unix", &agent_ops_unix},
+#endif  /* PF_UNIX */
+    {NULL, NULL}
+};
+
+static int
+agent_sign(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
+           const unsigned char *data, size_t data_len, void **abstract)
+{
+    LIBSSH2_AGENT *agent = (LIBSSH2_AGENT *) (*abstract);
+    agent_transaction_ctx_t transctx = &agent->transctx;
+    struct agent_publickey *identity = agent->identity;
+    ssize_t len = 1 + 4 + identity->external.blob_len + 4 + data_len + 4;
+    ssize_t method_len;
+    unsigned char *s;
+    int rc;
+
+    /* Create a request to sign the data */
+    if (transctx->state == agent_NB_state_init) {
+        s = transctx->request = LIBSSH2_ALLOC(session, len);
+        if (!transctx->request)
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "out of memory");
+
+        *s++ = SSH2_AGENTC_SIGN_REQUEST;
+        /* key blob */
+        _libssh2_store_str(&s, (const char *)identity->external.blob,
+                           identity->external.blob_len);
+        /* data */
+        _libssh2_store_str(&s, (const char *)data, data_len);
+
+        /* flags */
+        _libssh2_store_u32(&s, 0);
+
+        transctx->request_len = s - transctx->request;
+        transctx->state = agent_NB_state_request_created;
+    }
+
+    /* Make sure to be re-called as a result of EAGAIN. */
+    if (*transctx->request != SSH2_AGENTC_SIGN_REQUEST)
+        return _libssh2_error(session, LIBSSH2_ERROR_BAD_USE,
+                              "illegal request");
+
+    if (!agent->ops)
+        /* if no agent has been connected, bail out */
+        return _libssh2_error(session, LIBSSH2_ERROR_BAD_USE,
+                              "agent not connected");
+
+    rc = agent->ops->transact(agent, transctx);
+    if (rc) {
+        goto error;
+    }
+    LIBSSH2_FREE(session, transctx->request);
+    transctx->request = NULL;
+
+    len = transctx->response_len;
+    s = transctx->response;
+    len--;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    if (*s != SSH2_AGENT_SIGN_RESPONSE) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    s++;
+
+    /* Skip the entire length of the signature */
+    len -= 4;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    s += 4;
+
+    /* Skip signing method */
+    len -= 4;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    method_len = _libssh2_ntohu32(s);
+    s += 4;
+    len -= method_len;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    s += method_len;
+
+    /* Read the signature */
+    len -= 4;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    *sig_len = _libssh2_ntohu32(s);
+    s += 4;
+    len -= *sig_len;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+
+    *sig = LIBSSH2_ALLOC(session, *sig_len);
+    if (!*sig) {
+        rc = LIBSSH2_ERROR_ALLOC;
+        goto error;
+    }
+    memcpy(*sig, s, *sig_len);
+
+  error:
+    LIBSSH2_FREE(session, transctx->request);
+    transctx->request = NULL;
+
+    LIBSSH2_FREE(session, transctx->response);
+    transctx->response = NULL;
+
+    return _libssh2_error(session, rc, "agent sign failure");
+}
+
+static int
+agent_list_identities(LIBSSH2_AGENT *agent)
+{
+    agent_transaction_ctx_t transctx = &agent->transctx;
+    ssize_t len, num_identities;
+    unsigned char *s;
+    int rc;
+    unsigned char c = SSH2_AGENTC_REQUEST_IDENTITIES;
+
+    /* Create a request to list identities */
+    if (transctx->state == agent_NB_state_init) {
+        transctx->request = &c;
+        transctx->request_len = 1;
+        transctx->state = agent_NB_state_request_created;
+    }
+
+    /* Make sure to be re-called as a result of EAGAIN. */
+    if (*transctx->request != SSH2_AGENTC_REQUEST_IDENTITIES)
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_USE,
+                              "illegal agent request");
+
+    if (!agent->ops)
+        /* if no agent has been connected, bail out */
+        return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_USE,
+                              "agent not connected");
+
+    rc = agent->ops->transact(agent, transctx);
+    if (rc) {
+        goto error;
+    }
+    transctx->request = NULL;
+
+    len = transctx->response_len;
+    s = transctx->response;
+    len--;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    if (*s != SSH2_AGENT_IDENTITIES_ANSWER) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    s++;
+
+    /* Read the length of identities */
+    len -= 4;
+    if (len < 0) {
+        rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+        goto error;
+    }
+    num_identities = _libssh2_ntohu32(s);
+    s += 4;
+
+    while (num_identities--) {
+        struct agent_publickey *identity;
+        ssize_t comment_len;
+
+        identity = LIBSSH2_ALLOC(agent->session, sizeof *identity);
+        if (!identity) {
+            rc = LIBSSH2_ERROR_ALLOC;
+            goto error;
+        }
+
+        /* Read the length of the blob */
+        len -= 4;
+        if (len < 0) {
+            rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+            goto error;
+        }
+        identity->external.blob_len = _libssh2_ntohu32(s);
+        s += 4;
+
+        /* Read the blob */
+        len -= identity->external.blob_len;
+        if (len < 0) {
+            rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+            goto error;
+        }
+        identity->external.blob = LIBSSH2_ALLOC(agent->session,
+                                                identity->external.blob_len);
+        if (!identity->external.blob) {
+            rc = LIBSSH2_ERROR_ALLOC;
+            goto error;
+        }
+        memcpy(identity->external.blob, s, identity->external.blob_len);
+        s += identity->external.blob_len;
+
+        /* Read the length of the comment */
+        len -= 4;
+        if (len < 0) {
+            rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+            goto error;
+        }
+        comment_len = _libssh2_ntohu32(s);
+        s += 4;
+
+        /* Read the comment */
+        len -= comment_len;
+        if (len < 0) {
+            rc = LIBSSH2_ERROR_AGENT_PROTOCOL;
+            goto error;
+        }
+        identity->external.comment = LIBSSH2_ALLOC(agent->session,
+                                                   comment_len + 1);
+        if (!identity->external.comment) {
+            rc = LIBSSH2_ERROR_ALLOC;
+            goto error;
+        }
+        identity->external.comment[comment_len] = '\0';
+        memcpy(identity->external.comment, s, comment_len);
+        s += comment_len;
+
+        _libssh2_list_add(&agent->head, &identity->node);
+    }
+ error:
+    LIBSSH2_FREE(agent->session, transctx->response);
+    transctx->response = NULL;
+
+    return _libssh2_error(agent->session, rc,
+                          "agent list id failed");
+}
+
+static void
+agent_free_identities(LIBSSH2_AGENT *agent) {
+    struct agent_publickey *node;
+    struct agent_publickey *next;
+
+    for (node = _libssh2_list_first(&agent->head); node; node = next) {
+        next = _libssh2_list_next(&node->node);
+        LIBSSH2_FREE(agent->session, node->external.blob);
+        LIBSSH2_FREE(agent->session, node->external.comment);
+        LIBSSH2_FREE(agent->session, node);
+    }
+    _libssh2_list_init(&agent->head);
+}
+
+#define AGENT_PUBLICKEY_MAGIC 0x3bdefed2
+/*
+ * agent_publickey_to_external()
+ *
+ * Copies data from the internal to the external representation struct.
+ *
+ */
+static struct libssh2_agent_publickey *
+agent_publickey_to_external(struct agent_publickey *node)
+{
+    struct libssh2_agent_publickey *ext = &node->external;
+
+    ext->magic = AGENT_PUBLICKEY_MAGIC;
+    ext->node = node;
+
+    return ext;
+}
+
+/*
+ * libssh2_agent_init
+ *
+ * Init an ssh-agent handle. Returns the pointer to the handle.
+ *
+ */
+LIBSSH2_API LIBSSH2_AGENT *
+libssh2_agent_init(LIBSSH2_SESSION *session)
+{
+    LIBSSH2_AGENT *agent;
+
+    agent = LIBSSH2_ALLOC(session, sizeof *agent);
+    if (!agent) {
+        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                       "Unable to allocate space for agent connection");
+        return NULL;
+    }
+    memset(agent, 0, sizeof *agent);
+    agent->session = session;
+    _libssh2_list_init(&agent->head);
+
+    return agent;
+}
+
+/*
+ * libssh2_agent_connect()
+ *
+ * Connect to an ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_connect(LIBSSH2_AGENT *agent)
+{
+    int i, rc = -1;
+    for (i = 0; supported_backends[i].name; i++) {
+        agent->ops = supported_backends[i].ops;
+        rc = agent->ops->connect(agent);
+        if (!rc)
+            return 0;
+    }
+    return rc;
+}
+
+/*
+ * libssh2_agent_list_identities()
+ *
+ * Request ssh-agent to list identities.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_list_identities(LIBSSH2_AGENT *agent)
+{
+    memset(&agent->transctx, 0, sizeof agent->transctx);
+    /* Abondon the last fetched identities */
+    agent_free_identities(agent);
+    return agent_list_identities(agent);
+}
+
+/*
+ * libssh2_agent_get_identity()
+ *
+ * Traverse the internal list of public keys. Pass NULL to 'prev' to get
+ * the first one. Or pass a poiner to the previously returned one to get the
+ * next.
+ *
+ * Returns:
+ * 0 if a fine public key was stored in 'store'
+ * 1 if end of public keys
+ * [negative] on errors
+ */
+LIBSSH2_API int
+libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
+                           struct libssh2_agent_publickey **ext,
+                           struct libssh2_agent_publickey *oprev)
+{
+    struct agent_publickey *node;
+    if (oprev && oprev->node) {
+        /* we have a starting point */
+        struct agent_publickey *prev = oprev->node;
+
+        /* get the next node in the list */
+        node = _libssh2_list_next(&prev->node);
+    }
+    else
+        node = _libssh2_list_first(&agent->head);
+
+    if (!node)
+        /* no (more) node */
+        return 1;
+
+    *ext = agent_publickey_to_external(node);
+
+    return 0;
+}
+
+/*
+ * libssh2_agent_userauth()
+ *
+ * Do publickey user authentication with the help of ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_userauth(LIBSSH2_AGENT *agent,
+                       const char *username,
+                       struct libssh2_agent_publickey *identity)
+{
+    void *abstract = agent;
+    int rc;
+
+    if (agent->session->userauth_pblc_state == libssh2_NB_state_idle) {
+        memset(&agent->transctx, 0, sizeof agent->transctx);
+        agent->identity = identity->node;
+    }
+
+    BLOCK_ADJUST(rc, agent->session,
+                 _libssh2_userauth_publickey(agent->session, username,
+                                             strlen(username),
+                                             identity->blob,
+                                             identity->blob_len,
+                                             agent_sign,
+                                             &abstract));
+    return rc;
+}
+
+/*
+ * libssh2_agent_disconnect()
+ *
+ * Close a connection to an ssh-agent.
+ *
+ * Returns 0 if succeeded, or a negative value for error.
+ */
+LIBSSH2_API int
+libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
+{
+    if (agent->ops && agent->fd != LIBSSH2_INVALID_SOCKET)
+        return agent->ops->disconnect(agent);
+    return 0;
+}
+
+/*
+ * libssh2_agent_free()
+ *
+ * Free an ssh-agent handle.  This function also frees the internal
+ * collection of public keys.
+ */
+LIBSSH2_API void
+libssh2_agent_free(LIBSSH2_AGENT *agent) {
+    /* Allow connection freeing when the socket has lost its connection */
+    if (agent->fd != LIBSSH2_INVALID_SOCKET) {
+        libssh2_agent_disconnect(agent);
+    }
+    agent_free_identities(agent);
+    LIBSSH2_FREE(agent->session, agent);
+}
diff --git a/pgadmin/libssh2/channel.c b/pgadmin/libssh2/channel.c
new file mode 100644
index 0000000..4f41e1f
--- /dev/null
+++ b/pgadmin/libssh2/channel.c
@@ -0,0 +1,2571 @@
+/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2005 Mikhail Gusarov <dottedmag@dottedmag.net>
+ * Copyright (c) 2008-2011 by Daniel Stenberg
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#include <assert.h>
+
+#include "channel.h"
+#include "transport.h"
+#include "packet.h"
+#include "session.h"
+
+/*
+ *  _libssh2_channel_nextid
+ *
+ * Determine the next channel ID we can use at our end
+ */
+uint32_t
+_libssh2_channel_nextid(LIBSSH2_SESSION * session)
+{
+    uint32_t id = session->next_channel;
+    LIBSSH2_CHANNEL *channel;
+
+    channel = _libssh2_list_first(&session->channels);
+
+    while (channel) {
+        if (channel->local.id > id) {
+            id = channel->local.id;
+        }
+        channel = _libssh2_list_next(&channel->node);
+    }
+
+    /* This is a shortcut to avoid waiting for close packets on channels we've
+     * forgotten about, This *could* be a problem if we request and close 4
+     * billion or so channels in too rapid succession for the remote end to
+     * respond, but the worst case scenario is that some data meant for
+     * another channel Gets picked up by the new one.... Pretty unlikely all
+     * told...
+     */
+    session->next_channel = id + 1;
+    _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Allocated new channel ID#%lu",
+                   id);
+    return id;
+}
+
+/*
+ * _libssh2_channel_locate
+ *
+ * Locate a channel pointer by number
+ */
+LIBSSH2_CHANNEL *
+_libssh2_channel_locate(LIBSSH2_SESSION *session, uint32_t channel_id)
+{
+    LIBSSH2_CHANNEL *channel;
+    LIBSSH2_LISTENER *l;
+
+    for(channel = _libssh2_list_first(&session->channels);
+        channel;
+        channel = _libssh2_list_next(&channel->node)) {
+        if (channel->local.id == channel_id)
+            return channel;
+    }
+
+    /* We didn't find the channel in the session, let's then check its
+       listeners since each listener may have its own set of pending channels
+    */
+    for(l = _libssh2_list_first(&session->listeners); l;
+        l = _libssh2_list_next(&l->node)) {
+        for(channel = _libssh2_list_first(&l->queue);
+            channel;
+            channel = _libssh2_list_next(&channel->node)) {
+            if (channel->local.id == channel_id)
+                return channel;
+        }
+    }
+
+    return NULL;
+}
+
+/*
+ * _libssh2_channel_open
+ *
+ * Establish a generic session channel
+ */
+LIBSSH2_CHANNEL *
+_libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type,
+                      uint32_t channel_type_len,
+                      uint32_t window_size,
+                      uint32_t packet_size,
+                      const unsigned char *message,
+                      size_t message_len)
+{
+    static const unsigned char reply_codes[3] = {
+        SSH_MSG_CHANNEL_OPEN_CONFIRMATION,
+        SSH_MSG_CHANNEL_OPEN_FAILURE,
+        0
+    };
+    unsigned char *s;
+    int rc;
+
+    if (session->open_state == libssh2_NB_state_idle) {
+        session->open_channel = NULL;
+        session->open_packet = NULL;
+        session->open_data = NULL;
+        /* 17 = packet_type(1) + channel_type_len(4) + sender_channel(4) +
+         * window_size(4) + packet_size(4) */
+        session->open_packet_len = channel_type_len + 17;
+        session->open_local_channel = _libssh2_channel_nextid(session);
+
+        /* Zero the whole thing out */
+        memset(&session->open_packet_requirev_state, 0,
+               sizeof(session->open_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Opening Channel - win %d pack %d", window_size,
+                       packet_size);
+        session->open_channel =
+            LIBSSH2_ALLOC(session, sizeof(LIBSSH2_CHANNEL));
+        if (!session->open_channel) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate space for channel data");
+            return NULL;
+        }
+        memset(session->open_channel, 0, sizeof(LIBSSH2_CHANNEL));
+
+        session->open_channel->channel_type_len = channel_type_len;
+        session->open_channel->channel_type =
+            LIBSSH2_ALLOC(session, channel_type_len);
+        if (!session->open_channel->channel_type) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Failed allocating memory for channel type name");
+            LIBSSH2_FREE(session, session->open_channel);
+            session->open_channel = NULL;
+            return NULL;
+        }
+        memcpy(session->open_channel->channel_type, channel_type,
+               channel_type_len);
+
+        /* REMEMBER: local as in locally sourced */
+        session->open_channel->local.id = session->open_local_channel;
+        session->open_channel->remote.window_size = window_size;
+        session->open_channel->remote.window_size_initial = window_size;
+        session->open_channel->remote.packet_size = packet_size;
+        session->open_channel->session = session;
+
+        _libssh2_list_add(&session->channels,
+                          &session->open_channel->node);
+
+        s = session->open_packet =
+            LIBSSH2_ALLOC(session, session->open_packet_len);
+        if (!session->open_packet) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate temporary space for packet");
+            goto channel_error;
+        }
+        *(s++) = SSH_MSG_CHANNEL_OPEN;
+        _libssh2_store_str(&s, channel_type, channel_type_len);
+        _libssh2_store_u32(&s, session->open_local_channel);
+        _libssh2_store_u32(&s, window_size);
+        _libssh2_store_u32(&s, packet_size);
+
+        /* Do not copy the message */
+
+        session->open_state = libssh2_NB_state_created;
+    }
+
+    if (session->open_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session,
+                                     session->open_packet,
+                                     session->open_packet_len,
+                                     message, message_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending channel-open request");
+            return NULL;
+        }
+        else if (rc) {
+            _libssh2_error(session, rc,
+                           "Unable to send channel-open request");
+            goto channel_error;
+        }
+
+        session->open_state = libssh2_NB_state_sent;
+    }
+
+    if (session->open_state == libssh2_NB_state_sent) {
+        rc = _libssh2_packet_requirev(session, reply_codes,
+                                      &session->open_data,
+                                      &session->open_data_len, 1,
+                                      session->open_packet + 5 +
+                                      channel_type_len, 4,
+                                      &session->open_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+            return NULL;
+        } else if (rc) {
+            goto channel_error;
+        }
+
+        if (session->open_data[0] == SSH_MSG_CHANNEL_OPEN_CONFIRMATION) {
+            session->open_channel->remote.id =
+                _libssh2_ntohu32(session->open_data + 5);
+            session->open_channel->local.window_size =
+                _libssh2_ntohu32(session->open_data + 9);
+            session->open_channel->local.window_size_initial =
+                _libssh2_ntohu32(session->open_data + 9);
+            session->open_channel->local.packet_size =
+                _libssh2_ntohu32(session->open_data + 13);
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "Connection Established - ID: %lu/%lu win: %lu/%lu"
+                           " pack: %lu/%lu",
+                           session->open_channel->local.id,
+                           session->open_channel->remote.id,
+                           session->open_channel->local.window_size,
+                           session->open_channel->remote.window_size,
+                           session->open_channel->local.packet_size,
+                           session->open_channel->remote.packet_size);
+            LIBSSH2_FREE(session, session->open_packet);
+            session->open_packet = NULL;
+            LIBSSH2_FREE(session, session->open_data);
+            session->open_data = NULL;
+
+            session->open_state = libssh2_NB_state_idle;
+            return session->open_channel;
+        }
+
+        if (session->open_data[0] == SSH_MSG_CHANNEL_OPEN_FAILURE) {
+            _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE,
+                           "Channel open failure");
+        }
+    }
+
+  channel_error:
+
+    if (session->open_data) {
+        LIBSSH2_FREE(session, session->open_data);
+        session->open_data = NULL;
+    }
+    if (session->open_packet) {
+        LIBSSH2_FREE(session, session->open_packet);
+        session->open_packet = NULL;
+    }
+    if (session->open_channel) {
+        unsigned char channel_id[4];
+        LIBSSH2_FREE(session, session->open_channel->channel_type);
+
+        _libssh2_list_remove(&session->open_channel->node);
+
+        /* Clear out packets meant for this channel */
+        _libssh2_htonu32(channel_id, session->open_channel->local.id);
+        while ((_libssh2_packet_ask(session, SSH_MSG_CHANNEL_DATA,
+                                    &session->open_data,
+                                    &session->open_data_len, 1,
+                                    channel_id, 4) >= 0)
+               ||
+               (_libssh2_packet_ask(session, SSH_MSG_CHANNEL_EXTENDED_DATA,
+                                    &session->open_data,
+                                    &session->open_data_len, 1,
+                                    channel_id, 4) >= 0)) {
+            LIBSSH2_FREE(session, session->open_data);
+            session->open_data = NULL;
+        }
+
+        LIBSSH2_FREE(session, session->open_channel);
+        session->open_channel = NULL;
+    }
+
+    session->open_state = libssh2_NB_state_idle;
+    return NULL;
+}
+
+/*
+ * libssh2_channel_open_ex
+ *
+ * Establish a generic session channel
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *type,
+                        unsigned int type_len,
+                        unsigned int window_size, unsigned int packet_size,
+                        const char *msg, unsigned int msg_len)
+{
+    LIBSSH2_CHANNEL *ptr;
+
+    if(!session)
+        return NULL;
+
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       _libssh2_channel_open(session, type, type_len,
+                                             window_size, packet_size,
+                                             (unsigned char *)msg,
+                                             msg_len));
+    return ptr;
+}
+
+/*
+ * libssh2_channel_direct_tcpip_ex
+ *
+ * Tunnel TCP/IP connect through the SSH session to direct host/port
+ */
+static LIBSSH2_CHANNEL *
+channel_direct_tcpip(LIBSSH2_SESSION * session, const char *host,
+                     int port, const char *shost, int sport)
+{
+    LIBSSH2_CHANNEL *channel;
+    unsigned char *s;
+
+    if (session->direct_state == libssh2_NB_state_idle) {
+        session->direct_host_len = strlen(host);
+        session->direct_shost_len = strlen(shost);
+        /* host_len(4) + port(4) + shost_len(4) + sport(4) */
+        session->direct_message_len =
+            session->direct_host_len + session->direct_shost_len + 16;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Requesting direct-tcpip session to from %s:%d to %s:%d",
+                       shost, sport, host, port);
+
+        s = session->direct_message =
+            LIBSSH2_ALLOC(session, session->direct_message_len);
+        if (!session->direct_message) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memory for direct-tcpip connection");
+            return NULL;
+        }
+        _libssh2_store_str(&s, host, session->direct_host_len);
+        _libssh2_store_u32(&s, port);
+        _libssh2_store_str(&s, shost, session->direct_shost_len);
+        _libssh2_store_u32(&s, sport);
+    }
+
+    channel =
+        _libssh2_channel_open(session, "direct-tcpip",
+                              sizeof("direct-tcpip") - 1,
+                              LIBSSH2_CHANNEL_WINDOW_DEFAULT,
+                              LIBSSH2_CHANNEL_PACKET_DEFAULT,
+                              session->direct_message,
+                              session->direct_message_len);
+
+    if (!channel &&
+        libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN) {
+        /* The error code is still set to LIBSSH2_ERROR_EAGAIN, set our state
+           to created to avoid re-creating the package on next invoke */
+        session->direct_state = libssh2_NB_state_created;
+        return NULL;
+    }
+    /* by default we set (keep?) idle state... */
+    session->direct_state = libssh2_NB_state_idle;
+
+    LIBSSH2_FREE(session, session->direct_message);
+    session->direct_message = NULL;
+
+    return channel;
+}
+
+/*
+ * libssh2_channel_direct_tcpip_ex
+ *
+ * Tunnel TCP/IP connect through the SSH session to direct host/port
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host,
+                                int port, const char *shost, int sport)
+{
+    LIBSSH2_CHANNEL *ptr;
+
+    if(!session)
+        return NULL;
+
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       channel_direct_tcpip(session, host, port, shost, sport));
+    return ptr;
+}
+
+/*
+ * channel_forward_listen
+ *
+ * Bind a port on the remote host and listen for connections
+ */
+static LIBSSH2_LISTENER *
+channel_forward_listen(LIBSSH2_SESSION * session, const char *host,
+                       int port, int *bound_port, int queue_maxsize)
+{
+    unsigned char *s;
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_REQUEST_SUCCESS, SSH_MSG_REQUEST_FAILURE, 0 };
+    int rc;
+
+    if(!host)
+        host = "0.0.0.0";
+
+    if (session->fwdLstn_state == libssh2_NB_state_idle) {
+        session->fwdLstn_host_len = strlen(host);
+        /* 14 = packet_type(1) + request_len(4) + want_replay(1) + host_len(4)
+           + port(4) */
+        session->fwdLstn_packet_len =
+            session->fwdLstn_host_len + (sizeof("tcpip-forward") - 1) + 14;
+
+        /* Zero the whole thing out */
+        memset(&session->fwdLstn_packet_requirev_state, 0,
+               sizeof(session->fwdLstn_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Requesting tcpip-forward session for %s:%d", host,
+                       port);
+
+        s = session->fwdLstn_packet =
+            LIBSSH2_ALLOC(session, session->fwdLstn_packet_len);
+        if (!session->fwdLstn_packet) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memeory for setenv packet");
+            return NULL;
+        }
+
+        *(s++) = SSH_MSG_GLOBAL_REQUEST;
+        _libssh2_store_str(&s, "tcpip-forward", sizeof("tcpip-forward") - 1);
+        *(s++) = 0x01;          /* want_reply */
+
+        _libssh2_store_str(&s, host, session->fwdLstn_host_len);
+        _libssh2_store_u32(&s, port);
+
+        session->fwdLstn_state = libssh2_NB_state_created;
+    }
+
+    if (session->fwdLstn_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session,
+                                     session->fwdLstn_packet,
+                                     session->fwdLstn_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block sending global-request packet for "
+                           "forward listen request");
+            return NULL;
+        }
+        else if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send global-request packet for forward "
+                           "listen request");
+            LIBSSH2_FREE(session, session->fwdLstn_packet);
+            session->fwdLstn_packet = NULL;
+            session->fwdLstn_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+        LIBSSH2_FREE(session, session->fwdLstn_packet);
+        session->fwdLstn_packet = NULL;
+
+        session->fwdLstn_state = libssh2_NB_state_sent;
+    }
+
+    if (session->fwdLstn_state == libssh2_NB_state_sent) {
+        unsigned char *data;
+        size_t data_len;
+        rc = _libssh2_packet_requirev(session, reply_codes, &data, &data_len,
+                                      0, NULL, 0,
+                                      &session->fwdLstn_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+            return NULL;
+        } else if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_PROTO, "Unknown");
+            session->fwdLstn_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+
+        if (data[0] == SSH_MSG_REQUEST_SUCCESS) {
+            LIBSSH2_LISTENER *listener;
+
+            listener = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_LISTENER));
+            if (!listener)
+                _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                               "Unable to allocate memory for listener queue");
+            else {
+                memset(listener, 0, sizeof(LIBSSH2_LISTENER));
+                listener->host =
+                    LIBSSH2_ALLOC(session, session->fwdLstn_host_len + 1);
+                if (!listener->host) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for listener queue");
+                    LIBSSH2_FREE(session, listener);
+                    listener = NULL;
+                }
+                else {
+                    listener->session = session;
+                    memcpy(listener->host, host ? host : "0.0.0.0",
+                           session->fwdLstn_host_len);
+                    listener->host[session->fwdLstn_host_len] = 0;
+                    if (data_len >= 5 && !port) {
+                        listener->port = _libssh2_ntohu32(data + 1);
+                        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                       "Dynamic tcpip-forward port allocated: %d",
+                                       listener->port);
+                    }
+                    else
+                        listener->port = port;
+
+                    listener->queue_size = 0;
+                    listener->queue_maxsize = queue_maxsize;
+
+                    /* append this to the parent's list of listeners */
+                    _libssh2_list_add(&session->listeners, &listener->node);
+
+                    if (bound_port) {
+                        *bound_port = listener->port;
+                    }
+                }
+            }
+
+            LIBSSH2_FREE(session, data);
+            session->fwdLstn_state = libssh2_NB_state_idle;
+            return listener;
+        }
+        else if (data[0] == SSH_MSG_REQUEST_FAILURE) {
+            LIBSSH2_FREE(session, data);
+            _libssh2_error(session, LIBSSH2_ERROR_REQUEST_DENIED,
+                           "Unable to complete request for forward-listen");
+            session->fwdLstn_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+    }
+
+    session->fwdLstn_state = libssh2_NB_state_idle;
+
+    return NULL;
+}
+
+/*
+ * libssh2_channel_forward_listen_ex
+ *
+ * Bind a port on the remote host and listen for connections
+ */
+LIBSSH2_API LIBSSH2_LISTENER *
+libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host,
+                                  int port, int *bound_port, int queue_maxsize)
+{
+    LIBSSH2_LISTENER *ptr;
+
+    if(!session)
+        return NULL;
+
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       channel_forward_listen(session, host, port, bound_port,
+                                              queue_maxsize));
+    return ptr;
+}
+
+/*
+ * _libssh2_channel_forward_cancel
+ *
+ * Stop listening on a remote port and free the listener
+ * Toss out any pending (un-accept()ed) connections
+ *
+ * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error
+ */
+int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener)
+{
+    LIBSSH2_SESSION *session = listener->session;
+    LIBSSH2_CHANNEL *queued;
+    unsigned char *packet, *s;
+    size_t host_len = strlen(listener->host);
+    /* 14 = packet_type(1) + request_len(4) + want_replay(1) + host_len(4) +
+       port(4) */
+    size_t packet_len =
+        host_len + 14 + sizeof("cancel-tcpip-forward") - 1;
+    int rc;
+
+    if (listener->chanFwdCncl_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Cancelling tcpip-forward session for %s:%d",
+                       listener->host, listener->port);
+
+        s = packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!packet) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memeory for setenv packet");
+            return LIBSSH2_ERROR_ALLOC;
+        }
+
+        *(s++) = SSH_MSG_GLOBAL_REQUEST;
+        _libssh2_store_str(&s, "cancel-tcpip-forward",
+                           sizeof("cancel-tcpip-forward") - 1);
+        *(s++) = 0x00;          /* want_reply */
+
+        _libssh2_store_str(&s, listener->host, host_len);
+        _libssh2_store_u32(&s, listener->port);
+
+        listener->chanFwdCncl_state = libssh2_NB_state_created;
+    } else {
+        packet = listener->chanFwdCncl_data;
+    }
+
+    if (listener->chanFwdCncl_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, packet, packet_len, NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending forward request");
+            listener->chanFwdCncl_data = packet;
+            return rc;
+        }
+        else if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send global-request packet for forward "
+                           "listen request");
+            LIBSSH2_FREE(session, packet);
+            listener->chanFwdCncl_state = libssh2_NB_state_idle;
+            return LIBSSH2_ERROR_SOCKET_SEND;
+        }
+        LIBSSH2_FREE(session, packet);
+
+        listener->chanFwdCncl_state = libssh2_NB_state_sent;
+    }
+
+    queued = _libssh2_list_first(&listener->queue);
+    while (queued) {
+        LIBSSH2_CHANNEL *next = _libssh2_list_next(&queued->node);
+
+        rc = _libssh2_channel_free(queued);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        }
+        queued = next;
+    }
+    LIBSSH2_FREE(session, listener->host);
+
+    /* remove this entry from the parent's list of listeners */
+    _libssh2_list_remove(&listener->node);
+
+    LIBSSH2_FREE(session, listener);
+
+    listener->chanFwdCncl_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/*
+ * libssh2_channel_forward_cancel
+ *
+ * Stop listening on a remote port and free the listener
+ * Toss out any pending (un-accept()ed) connections
+ *
+ * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error
+ */
+LIBSSH2_API int
+libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener)
+{
+    int rc;
+
+    if(!listener)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, listener->session,
+                 _libssh2_channel_forward_cancel(listener));
+    return rc;
+}
+
+/*
+ * channel_forward_accept
+ *
+ * Accept a connection
+ */
+static LIBSSH2_CHANNEL *
+channel_forward_accept(LIBSSH2_LISTENER *listener)
+{
+    int rc;
+
+    do {
+        rc = _libssh2_transport_read(listener->session);
+    } while (rc > 0);
+
+    if (_libssh2_list_first(&listener->queue)) {
+        LIBSSH2_CHANNEL *channel = _libssh2_list_first(&listener->queue);
+
+        /* detach channel from listener's queue */
+        _libssh2_list_remove(&channel->node);
+
+        listener->queue_size--;
+
+        /* add channel to session's channel list */
+        _libssh2_list_add(&channel->session->channels, &channel->node);
+
+        return channel;
+    }
+
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        _libssh2_error(listener->session, LIBSSH2_ERROR_EAGAIN,
+                       "Would block waiting for packet");
+    }
+    else
+        _libssh2_error(listener->session, LIBSSH2_ERROR_CHANNEL_UNKNOWN,
+                       "Channel not found");
+    return NULL;
+}
+
+/*
+ * libssh2_channel_forward_accept
+ *
+ * Accept a connection
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener)
+{
+    LIBSSH2_CHANNEL *ptr;
+
+    if(!listener)
+        return NULL;
+
+    BLOCK_ADJUST_ERRNO(ptr, listener->session,
+                       channel_forward_accept(listener));
+    return ptr;
+
+}
+
+/*
+ * channel_setenv
+ *
+ * Set an environment variable prior to requesting a shell/program/subsystem
+ */
+static int channel_setenv(LIBSSH2_CHANNEL *channel,
+                          const char *varname, unsigned int varname_len,
+                          const char *value, unsigned int value_len)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *s, *data;
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 };
+    size_t data_len;
+    int rc;
+
+    if (channel->setenv_state == libssh2_NB_state_idle) {
+        /* 21 = packet_type(1) + channel_id(4) + request_len(4) +
+         * request(3)"env" + want_reply(1) + varname_len(4) + value_len(4) */
+        channel->setenv_packet_len = varname_len + value_len + 21;
+
+        /* Zero the whole thing out */
+        memset(&channel->setenv_packet_requirev_state, 0,
+               sizeof(channel->setenv_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Setting remote environment variable: %s=%s on "
+                       "channel %lu/%lu",
+                       varname, value, channel->local.id, channel->remote.id);
+
+        s = channel->setenv_packet =
+            LIBSSH2_ALLOC(session, channel->setenv_packet_len);
+        if (!channel->setenv_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memeory "
+                                  "for setenv packet");
+        }
+
+        *(s++) = SSH_MSG_CHANNEL_REQUEST;
+        _libssh2_store_u32(&s, channel->remote.id);
+        _libssh2_store_str(&s, "env", sizeof("env") - 1);
+        *(s++) = 0x01;
+        _libssh2_store_str(&s, varname, varname_len);
+        _libssh2_store_str(&s, value, value_len);
+
+        channel->setenv_state = libssh2_NB_state_created;
+    }
+
+    if (channel->setenv_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session,
+                                     channel->setenv_packet,
+                                     channel->setenv_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending setenv request");
+            return rc;
+        } else if (rc) {
+            LIBSSH2_FREE(session, channel->setenv_packet);
+            channel->setenv_packet = NULL;
+            channel->setenv_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send channel-request packet for "
+                                  "setenv request");
+        }
+        LIBSSH2_FREE(session, channel->setenv_packet);
+        channel->setenv_packet = NULL;
+
+        _libssh2_htonu32(channel->setenv_local_channel, channel->local.id);
+
+        channel->setenv_state = libssh2_NB_state_sent;
+    }
+
+    if (channel->setenv_state == libssh2_NB_state_sent) {
+        rc = _libssh2_packet_requirev(session, reply_codes, &data, &data_len,
+                                      1, channel->setenv_local_channel, 4,
+                                      &channel->
+                                      setenv_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        }
+        if (rc) {
+            channel->setenv_state = libssh2_NB_state_idle;
+            return rc;
+        }
+
+        if (data[0] == SSH_MSG_CHANNEL_SUCCESS) {
+            LIBSSH2_FREE(session, data);
+            channel->setenv_state = libssh2_NB_state_idle;
+            return 0;
+        }
+
+        LIBSSH2_FREE(session, data);
+    }
+
+    channel->setenv_state = libssh2_NB_state_idle;
+    return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED,
+                          "Unable to complete request for channel-setenv");
+}
+
+/*
+ * libssh2_channel_setenv_ex
+ *
+ * Set an environment variable prior to requesting a shell/program/subsystem
+ */
+LIBSSH2_API int
+libssh2_channel_setenv_ex(LIBSSH2_CHANNEL *channel,
+                          const char *varname, unsigned int varname_len,
+                          const char *value, unsigned int value_len)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 channel_setenv(channel, varname, varname_len,
+                                value, value_len));
+    return rc;
+}
+
+/*
+ * channel_request_pty
+ * Duh... Request a PTY
+ */
+static int channel_request_pty(LIBSSH2_CHANNEL *channel,
+                               const char *term, unsigned int term_len,
+                               const char *modes, unsigned int modes_len,
+                               int width, int height,
+                               int width_px, int height_px)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *s;
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 };
+    int rc;
+
+    if (channel->reqPTY_state == libssh2_NB_state_idle) {
+        /* 41 = packet_type(1) + channel(4) + pty_req_len(4) + "pty_req"(7) +
+         * want_reply(1) + term_len(4) + width(4) + height(4) + width_px(4) +
+         * height_px(4) + modes_len(4) */
+        if(term_len + modes_len > 256) {
+            return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                                  "term + mode lengths too large");
+        }
+
+        channel->reqPTY_packet_len = term_len + modes_len + 41;
+
+        /* Zero the whole thing out */
+        memset(&channel->reqPTY_packet_requirev_state, 0,
+               sizeof(channel->reqPTY_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Allocating tty on channel %lu/%lu", channel->local.id,
+                       channel->remote.id);
+
+        s = channel->reqPTY_packet;
+
+        *(s++) = SSH_MSG_CHANNEL_REQUEST;
+        _libssh2_store_u32(&s, channel->remote.id);
+        _libssh2_store_str(&s, (char *)"pty-req", sizeof("pty-req") - 1);
+
+        *(s++) = 0x01;
+
+        _libssh2_store_str(&s, term, term_len);
+        _libssh2_store_u32(&s, width);
+        _libssh2_store_u32(&s, height);
+        _libssh2_store_u32(&s, width_px);
+        _libssh2_store_u32(&s, height_px);
+        _libssh2_store_str(&s, modes, modes_len);
+
+        channel->reqPTY_state = libssh2_NB_state_created;
+    }
+
+    if (channel->reqPTY_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, channel->reqPTY_packet,
+                                     channel->reqPTY_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending pty request");
+            return rc;
+        } else if (rc) {
+            channel->reqPTY_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Unable to send pty-request packet");
+        }
+        _libssh2_htonu32(channel->reqPTY_local_channel, channel->local.id);
+
+        channel->reqPTY_state = libssh2_NB_state_sent;
+    }
+
+    if (channel->reqPTY_state == libssh2_NB_state_sent) {
+        unsigned char *data;
+        size_t data_len;
+        unsigned char code;
+        rc = _libssh2_packet_requirev(session, reply_codes, &data, &data_len,
+                                      1, channel->reqPTY_local_channel, 4,
+                                      &channel->reqPTY_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            channel->reqPTY_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_PROTO,
+                                  "Failed to require the PTY package");
+        }
+
+        code = data[0];
+
+        LIBSSH2_FREE(session, data);
+        channel->reqPTY_state = libssh2_NB_state_idle;
+
+        if (code == SSH_MSG_CHANNEL_SUCCESS)
+            return 0;
+    }
+
+    return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED,
+                          "Unable to complete request for channel request-pty");
+}
+
+/*
+ * libssh2_channel_request_pty_ex
+ * Duh... Request a PTY
+ */
+LIBSSH2_API int
+libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel, const char *term,
+                               unsigned int term_len, const char *modes,
+                               unsigned int modes_len, int width, int height,
+                               int width_px, int height_px)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 channel_request_pty(channel, term, term_len, modes,
+                                     modes_len, width, height,
+                                     width_px, height_px));
+    return rc;
+}
+
+static int
+channel_request_pty_size(LIBSSH2_CHANNEL * channel, int width,
+                         int height, int width_px, int height_px)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *s;
+    int rc;
+    int retcode = LIBSSH2_ERROR_PROTO;
+
+    if (channel->reqPTY_state == libssh2_NB_state_idle) {
+        channel->reqPTY_packet_len = 39;
+
+        /* Zero the whole thing out */
+        memset(&channel->reqPTY_packet_requirev_state, 0,
+               sizeof(channel->reqPTY_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+            "changing tty size on channel %lu/%lu",
+            channel->local.id,
+            channel->remote.id);
+
+        s = channel->reqPTY_packet;
+
+        *(s++) = SSH_MSG_CHANNEL_REQUEST;
+        _libssh2_store_u32(&s, channel->remote.id);
+        _libssh2_store_str(&s, (char *)"window-change",
+                           sizeof("window-change") - 1);
+        *(s++) = 0x00; /* Don't reply */
+        _libssh2_store_u32(&s, width);
+        _libssh2_store_u32(&s, height);
+        _libssh2_store_u32(&s, width_px);
+        _libssh2_store_u32(&s, height_px);
+
+        channel->reqPTY_state = libssh2_NB_state_created;
+    }
+
+    if (channel->reqPTY_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, channel->reqPTY_packet,
+                                     channel->reqPTY_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending window-change request");
+            return rc;
+        } else if (rc) {
+            channel->reqPTY_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Unable to send window-change packet");
+        }
+        _libssh2_htonu32(channel->reqPTY_local_channel, channel->local.id);
+        retcode = LIBSSH2_ERROR_NONE;
+    }
+
+    channel->reqPTY_state = libssh2_NB_state_idle;
+    return retcode;
+}
+
+LIBSSH2_API int
+libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel, int width,
+                                    int height, int width_px, int height_px)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 channel_request_pty_size(channel, width, height, width_px,
+                                          height_px));
+    return rc;
+}
+
+/* Keep this an even number */
+#define LIBSSH2_X11_RANDOM_COOKIE_LEN       32
+
+/*
+ * channel_x11_req
+ * Request X11 forwarding
+ */
+static int
+channel_x11_req(LIBSSH2_CHANNEL *channel, int single_connection,
+                const char *auth_proto, const char *auth_cookie,
+                int screen_number)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *s;
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 };
+    size_t proto_len =
+        auth_proto ? strlen(auth_proto) : (sizeof("MIT-MAGIC-COOKIE-1") - 1);
+    size_t cookie_len =
+        auth_cookie ? strlen(auth_cookie) : LIBSSH2_X11_RANDOM_COOKIE_LEN;
+    int rc;
+
+    if (channel->reqX11_state == libssh2_NB_state_idle) {
+        /* 30 = packet_type(1) + channel(4) + x11_req_len(4) + "x11-req"(7) +
+         * want_reply(1) + single_cnx(1) + proto_len(4) + cookie_len(4) +
+         * screen_num(4) */
+        channel->reqX11_packet_len = proto_len + cookie_len + 30;
+
+        /* Zero the whole thing out */
+        memset(&channel->reqX11_packet_requirev_state, 0,
+               sizeof(channel->reqX11_packet_requirev_state));
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Requesting x11-req for channel %lu/%lu: single=%d "
+                       "proto=%s cookie=%s screen=%d",
+                       channel->local.id, channel->remote.id,
+                       single_connection,
+                       auth_proto ? auth_proto : "MIT-MAGIC-COOKIE-1",
+                       auth_cookie ? auth_cookie : "<random>", screen_number);
+
+        s = channel->reqX11_packet =
+            LIBSSH2_ALLOC(session, channel->reqX11_packet_len);
+        if (!channel->reqX11_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for pty-request");
+        }
+
+        *(s++) = SSH_MSG_CHANNEL_REQUEST;
+        _libssh2_store_u32(&s, channel->remote.id);
+        _libssh2_store_str(&s, "x11-req", sizeof("x11-req") - 1);
+
+        *(s++) = 0x01;          /* want_reply */
+        *(s++) = single_connection ? 0x01 : 0x00;
+
+        _libssh2_store_str(&s, auth_proto?auth_proto:"MIT-MAGIC-COOKIE-1",
+                           proto_len);
+
+        _libssh2_store_u32(&s, cookie_len);
+        if (auth_cookie) {
+            memcpy(s, auth_cookie, cookie_len);
+        } else {
+            int i;
+            /* note: the extra +1 below is necessary since the sprintf()
+               loop will always write 3 bytes so the last one will write
+               the trailing zero at the LIBSSH2_X11_RANDOM_COOKIE_LEN/2
+               border */
+            unsigned char buffer[(LIBSSH2_X11_RANDOM_COOKIE_LEN / 2) +1];
+
+            _libssh2_random(buffer, LIBSSH2_X11_RANDOM_COOKIE_LEN / 2);
+            for(i = 0; i < (LIBSSH2_X11_RANDOM_COOKIE_LEN / 2); i++) {
+                sprintf((char *)&s[i*2], "%02X", buffer[i]);
+            }
+        }
+        s += cookie_len;
+
+        _libssh2_store_u32(&s, screen_number);
+        channel->reqX11_state = libssh2_NB_state_created;
+    }
+
+    if (channel->reqX11_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, channel->reqX11_packet,
+                                     channel->reqX11_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending X11-req packet");
+            return rc;
+        }
+        if (rc) {
+            LIBSSH2_FREE(session, channel->reqX11_packet);
+            channel->reqX11_packet = NULL;
+            channel->reqX11_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Unable to send x11-req packet");
+        }
+        LIBSSH2_FREE(session, channel->reqX11_packet);
+        channel->reqX11_packet = NULL;
+
+        _libssh2_htonu32(channel->reqX11_local_channel, channel->local.id);
+
+        channel->reqX11_state = libssh2_NB_state_sent;
+    }
+
+    if (channel->reqX11_state == libssh2_NB_state_sent) {
+        size_t data_len;
+        unsigned char *data;
+        unsigned char code;
+
+        rc = _libssh2_packet_requirev(session, reply_codes, &data, &data_len,
+                                      1, channel->reqX11_local_channel, 4,
+                                      &channel->reqX11_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            channel->reqX11_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "waiting for x11-req response packet");
+        }
+
+        code = data[0];
+        LIBSSH2_FREE(session, data);
+        channel->reqX11_state = libssh2_NB_state_idle;
+
+        if (code == SSH_MSG_CHANNEL_SUCCESS)
+            return 0;
+    }
+
+    return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED,
+                          "Unable to complete request for channel x11-req");
+}
+
+/*
+ * libssh2_channel_x11_req_ex
+ * Request X11 forwarding
+ */
+LIBSSH2_API int
+libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_connection,
+                           const char *auth_proto, const char *auth_cookie,
+                           int screen_number)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 channel_x11_req(channel, single_connection, auth_proto,
+                                 auth_cookie, screen_number));
+    return rc;
+}
+
+
+/*
+ * _libssh2_channel_process_startup
+ *
+ * Primitive for libssh2_channel_(shell|exec|subsystem)
+ */
+int
+_libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
+                                 const char *request, size_t request_len,
+                                 const char *message, size_t message_len)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *s;
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 };
+    int rc;
+
+    if (channel->process_state == libssh2_NB_state_idle) {
+        /* 10 = packet_type(1) + channel(4) + request_len(4) + want_reply(1) */
+        channel->process_packet_len = request_len + 10;
+
+        /* Zero the whole thing out */
+        memset(&channel->process_packet_requirev_state, 0,
+               sizeof(channel->process_packet_requirev_state));
+
+        if (message)
+            channel->process_packet_len += + 4;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "starting request(%s) on channel %lu/%lu, message=%s",
+                       request, channel->local.id, channel->remote.id,
+                       message?message:"<null>");
+        s = channel->process_packet =
+            LIBSSH2_ALLOC(session, channel->process_packet_len);
+        if (!channel->process_packet)
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory "
+                                  "for channel-process request");
+
+        *(s++) = SSH_MSG_CHANNEL_REQUEST;
+        _libssh2_store_u32(&s, channel->remote.id);
+        _libssh2_store_str(&s, request, request_len);
+        *(s++) = 0x01;
+
+        if (message)
+            _libssh2_store_u32(&s, message_len);
+
+        channel->process_state = libssh2_NB_state_created;
+    }
+
+    if (channel->process_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session,
+                                     channel->process_packet,
+                                     channel->process_packet_len,
+                                     (unsigned char *)message, message_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending channel request");
+            return rc;
+        }
+        else if (rc) {
+            LIBSSH2_FREE(session, channel->process_packet);
+            channel->process_packet = NULL;
+            channel->process_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Unable to send channel request");
+        }
+        LIBSSH2_FREE(session, channel->process_packet);
+        channel->process_packet = NULL;
+
+        _libssh2_htonu32(channel->process_local_channel, channel->local.id);
+
+        channel->process_state = libssh2_NB_state_sent;
+    }
+
+    if (channel->process_state == libssh2_NB_state_sent) {
+        unsigned char *data;
+        size_t data_len;
+        unsigned char code;
+        rc = _libssh2_packet_requirev(session, reply_codes, &data, &data_len,
+                                      1, channel->process_local_channel, 4,
+                                      &channel->process_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            channel->process_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Failed waiting for channel success");
+        }
+
+        code = data[0];
+        LIBSSH2_FREE(session, data);
+        channel->process_state = libssh2_NB_state_idle;
+
+        if (code == SSH_MSG_CHANNEL_SUCCESS)
+            return 0;
+    }
+
+    return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED,
+                          "Unable to complete request for "
+                          "channel-process-startup");
+}
+
+/*
+ * libssh2_channel_process_startup
+ *
+ * Primitive for libssh2_channel_(shell|exec|subsystem)
+ */
+LIBSSH2_API int
+libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
+                                const char *req, unsigned int req_len,
+                                const char *msg, unsigned int msg_len)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_process_startup(channel, req, req_len,
+                                                  msg, msg_len));
+    return rc;
+}
+
+
+/*
+ * libssh2_channel_set_blocking
+ *
+ * Set a channel's BEHAVIOR blocking on or off. The socket will remain non-
+ * blocking.
+ */
+LIBSSH2_API void
+libssh2_channel_set_blocking(LIBSSH2_CHANNEL * channel, int blocking)
+{
+    if(channel)
+        (void) _libssh2_session_set_blocking(channel->session, blocking);
+}
+
+/*
+ * _libssh2_channel_flush
+ *
+ * Flush data from one (or all) stream
+ * Returns number of bytes flushed, or negative on failure
+ */
+int
+_libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid)
+{
+    if (channel->flush_state == libssh2_NB_state_idle) {
+        LIBSSH2_PACKET *packet =
+            _libssh2_list_first(&channel->session->packets);
+        channel->flush_refund_bytes = 0;
+        channel->flush_flush_bytes = 0;
+
+        while (packet) {
+            LIBSSH2_PACKET *next = _libssh2_list_next(&packet->node);
+            unsigned char packet_type = packet->data[0];
+
+            if (((packet_type == SSH_MSG_CHANNEL_DATA)
+                 || (packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA))
+                && (_libssh2_ntohu32(packet->data + 1) == channel->local.id)) {
+                /* It's our channel at least */
+                long packet_stream_id =
+                    (packet_type == SSH_MSG_CHANNEL_DATA) ? 0 :
+                    _libssh2_ntohu32(packet->data + 5);
+                if ((streamid == LIBSSH2_CHANNEL_FLUSH_ALL)
+                    || ((packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA)
+                        && ((streamid == LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA)
+                            || (streamid == packet_stream_id)))
+                    || ((packet_type == SSH_MSG_CHANNEL_DATA)
+                        && (streamid == 0))) {
+                    int bytes_to_flush = packet->data_len - packet->data_head;
+
+                    _libssh2_debug(channel->session, LIBSSH2_TRACE_CONN,
+                                   "Flushing %d bytes of data from stream "
+                                   "%lu on channel %lu/%lu",
+                                   bytes_to_flush, packet_stream_id,
+                                   channel->local.id, channel->remote.id);
+
+                    /* It's one of the streams we wanted to flush */
+                    channel->flush_refund_bytes += packet->data_len - 13;
+                    channel->flush_flush_bytes += bytes_to_flush;
+
+                    LIBSSH2_FREE(channel->session, packet->data);
+
+                    /* remove this packet from the parent's list */
+                    _libssh2_list_remove(&packet->node);
+                    LIBSSH2_FREE(channel->session, packet);
+                }
+            }
+            packet = next;
+        }
+
+        channel->flush_state = libssh2_NB_state_created;
+    }
+
+    if (channel->flush_refund_bytes) {
+        int rc;
+
+        rc = _libssh2_channel_receive_window_adjust(channel,
+                                                    channel->flush_refund_bytes,
+                                                    1, NULL);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+            return rc;
+    }
+
+    channel->flush_state = libssh2_NB_state_idle;
+
+    return channel->flush_flush_bytes;
+}
+
+/*
+ * libssh2_channel_flush_ex
+ *
+ * Flush data from one (or all) stream
+ * Returns number of bytes flushed, or negative on failure
+ */
+LIBSSH2_API int
+libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel, int stream)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_flush(channel, stream));
+    return rc;
+}
+
+/*
+ * libssh2_channel_get_exit_status
+ *
+ * Return the channel's program exit status. Note that the actual protocol
+ * provides the full 32bit this function returns.  We cannot abuse it to
+ * return error values in case of errors so we return a zero if channel is
+ * NULL.
+ */
+LIBSSH2_API int
+libssh2_channel_get_exit_status(LIBSSH2_CHANNEL *channel)
+{
+    if(!channel)
+        return 0;
+
+    return channel->exit_status;
+}
+
+/*
+ * libssh2_channel_get_exit_signal
+ *
+ * Get exit signal (without leading "SIG"), error message, and language
+ * tag into newly allocated buffers of indicated length.  Caller can
+ * use NULL pointers to indicate that the value should not be set.  The
+ * *_len variables are set if they are non-NULL even if the
+ * corresponding string parameter is NULL.  Returns LIBSSH2_ERROR_NONE
+ * on success, or an API error code.
+ */
+LIBSSH2_API int
+libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel,
+                                char **exitsignal,
+                                size_t *exitsignal_len,
+                                char **errmsg,
+                                size_t *errmsg_len,
+                                char **langtag,
+                                size_t *langtag_len)
+{
+    size_t namelen = 0;
+
+    if (channel) {
+        LIBSSH2_SESSION *session = channel->session;
+
+        if (channel->exit_signal) {
+            namelen = strlen(channel->exit_signal);
+            if (exitsignal) {
+               *exitsignal = LIBSSH2_ALLOC(session, namelen + 1);
+                if (!*exitsignal) {
+                    return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                        "Unable to allocate memory for signal name");
+                }
+                memcpy(*exitsignal, channel->exit_signal, namelen);
+                (*exitsignal)[namelen] = '\0';
+            }
+            if (exitsignal_len)
+                *exitsignal_len = namelen;
+        } else {
+            if (exitsignal)
+                *exitsignal = NULL;
+            if (exitsignal_len)
+                *exitsignal_len = 0;
+        }
+
+        /* TODO: set error message and language tag */
+
+        if (errmsg)
+            *errmsg = NULL;
+
+        if (errmsg_len)
+            *errmsg_len = 0;
+
+        if (langtag)
+            *langtag = NULL;
+
+        if (langtag_len)
+            *langtag_len = 0;
+    }
+
+    return LIBSSH2_ERROR_NONE;
+}
+
+/*
+ * _libssh2_channel_receive_window_adjust
+ *
+ * Adjust the receive window for a channel by adjustment bytes. If the amount
+ * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
+ * adjustment amount will be queued for a later packet.
+ *
+ * Calls _libssh2_error() !
+ */
+int
+_libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
+                                       uint32_t adjustment,
+                                       unsigned char force,
+                                       unsigned int *store)
+{
+    int rc;
+
+    if (channel->adjust_state == libssh2_NB_state_idle) {
+        if (!force
+            && (adjustment + channel->adjust_queue <
+                LIBSSH2_CHANNEL_MINADJUST)) {
+            _libssh2_debug(channel->session, LIBSSH2_TRACE_CONN,
+                           "Queueing %lu bytes for receive window adjustment "
+                           "for channel %lu/%lu",
+                           adjustment, channel->local.id, channel->remote.id);
+            channel->adjust_queue += adjustment;
+            if(store)
+                *store = channel->remote.window_size;
+            return 0;
+        }
+
+        if (!adjustment && !channel->adjust_queue) {
+            if(store)
+                *store = channel->remote.window_size;
+            return 0;
+        }
+
+        adjustment += channel->adjust_queue;
+        channel->adjust_queue = 0;
+
+        /* Adjust the window based on the block we just freed */
+        channel->adjust_adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST;
+        _libssh2_htonu32(&channel->adjust_adjust[1], channel->remote.id);
+        _libssh2_htonu32(&channel->adjust_adjust[5], adjustment);
+        _libssh2_debug(channel->session, LIBSSH2_TRACE_CONN,
+                       "Adjusting window %lu bytes for data on "
+                       "channel %lu/%lu",
+                       adjustment, channel->local.id, channel->remote.id);
+
+        channel->adjust_state = libssh2_NB_state_created;
+    }
+
+    rc = _libssh2_transport_send(channel->session, channel->adjust_adjust, 9,
+                                 NULL, 0);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        _libssh2_error(channel->session, rc,
+                       "Would block sending window adjust");
+        return rc;
+    }
+    else if (rc) {
+        channel->adjust_queue = adjustment;
+        return _libssh2_error(channel->session, LIBSSH2_ERROR_SOCKET_SEND,
+                              "Unable to send transfer-window adjustment "
+                              "packet, deferring");
+    }
+    else {
+        channel->remote.window_size += adjustment;
+    }
+
+    channel->adjust_state = libssh2_NB_state_idle;
+
+    if(store)
+        *store = channel->remote.window_size;
+    return 0;
+}
+
+/*
+ * libssh2_channel_receive_window_adjust
+ *
+ * DEPRECATED
+ *
+ * Adjust the receive window for a channel by adjustment bytes. If the amount
+ * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
+ * adjustment amount will be queued for a later packet.
+ *
+ * Returns the new size of the receive window (as understood by remote end).
+ * Note that it might return EAGAIN too which is highly stupid.
+ *
+ */
+LIBSSH2_API unsigned long
+libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel,
+                                      unsigned long adj,
+                                      unsigned char force)
+{
+    unsigned int window;
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_receive_window_adjust(channel, adj,
+                                                        force, &window));
+
+    /* stupid - but this is how it was made to work before and this is just
+       kept for backwards compatibility */
+    return rc?(unsigned long)rc:window;
+}
+
+/*
+ * libssh2_channel_receive_window_adjust2
+ *
+ * Adjust the receive window for a channel by adjustment bytes. If the amount
+ * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
+ * adjustment amount will be queued for a later packet.
+ *
+ * Stores the new size of the receive window in the data 'window' points to.
+ *
+ * Returns the "normal" error code: 0 for success, negative for failure.
+ */
+LIBSSH2_API int
+libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel,
+                                       unsigned long adj,
+                                       unsigned char force,
+                                       unsigned int *window)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_receive_window_adjust(channel, adj, force,
+                                                        window));
+    return rc;
+}
+
+int
+_libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode)
+{
+    if (channel->extData2_state == libssh2_NB_state_idle) {
+        _libssh2_debug(channel->session, LIBSSH2_TRACE_CONN,
+                       "Setting channel %lu/%lu handle_extended_data"
+                       " mode to %d",
+                       channel->local.id, channel->remote.id, ignore_mode);
+        channel->remote.extended_data_ignore_mode = ignore_mode;
+
+        channel->extData2_state = libssh2_NB_state_created;
+    }
+
+    if (channel->extData2_state == libssh2_NB_state_idle) {
+        if (ignore_mode == LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE) {
+            int rc =
+                _libssh2_channel_flush(channel,
+                                       LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA);
+            if(LIBSSH2_ERROR_EAGAIN == rc)
+                return rc;
+        }
+    }
+
+    channel->extData2_state = libssh2_NB_state_idle;
+    return 0;
+}
+
+/*
+ * libssh2_channel_handle_extended_data2()
+ *
+ */
+LIBSSH2_API int
+libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
+                                      int mode)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, _libssh2_channel_extended_data(channel,
+                                                                      mode));
+    return rc;
+}
+
+/*
+ * libssh2_channel_handle_extended_data
+ *
+ * DEPRECATED DO NOTE USE!
+ *
+ * How should extended data look to the calling app?  Keep it in separate
+ * channels[_read() _read_stdder()]? (NORMAL) Merge the extended data to the
+ * standard data? [everything via _read()]? (MERGE) Ignore it entirely [toss
+ * out packets as they come in]? (IGNORE)
+ */
+LIBSSH2_API void
+libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
+                                     int ignore_mode)
+{
+    (void)libssh2_channel_handle_extended_data2(channel, ignore_mode);
+}
+
+
+
+/*
+ * _libssh2_channel_read
+ *
+ * Read data from a channel
+ *
+ * It is important to not return 0 until the currently read channel is
+ * complete. If we read stuff from the wire but it was no payload data to fill
+ * in the buffer with, we MUST make sure to return LIBSSH2_ERROR_EAGAIN.
+ *
+ * The receive window must be maintained (enlarged) by the user of this
+ * function.
+ */
+ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
+                              char *buf, size_t buflen)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    int rc;
+    int bytes_read = 0;
+    int bytes_want;
+    int unlink_packet;
+    LIBSSH2_PACKET *read_packet;
+    LIBSSH2_PACKET *read_next;
+
+    if (channel->read_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "channel_read() wants %d bytes from channel %lu/%lu "
+                       "stream #%d",
+                       (int) buflen, channel->local.id, channel->remote.id,
+                       stream_id);
+        channel->read_state = libssh2_NB_state_created;
+    }
+
+    rc = 1; /* set to >0 to let the while loop start */
+
+    /* Process all pending incoming packets in all states in order to "even
+       out" the network readings. Tests prove that this way produces faster
+       transfers. */
+    while (rc > 0)
+        rc = _libssh2_transport_read(session);
+
+    if ((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
+        return _libssh2_error(session, rc, "transport read");
+
+    read_packet = _libssh2_list_first(&session->packets);
+    while (read_packet && (bytes_read < (int) buflen)) {
+        /* previously this loop condition also checked for
+           !channel->remote.close but we cannot let it do this:
+
+           We may have a series of packets to read that are still pending even
+           if a close has been received. Acknowledging the close too early
+           makes us flush buffers prematurely and loose data.
+        */
+
+        LIBSSH2_PACKET *readpkt = read_packet;
+
+        /* In case packet gets destroyed during this iteration */
+        read_next = _libssh2_list_next(&readpkt->node);
+
+        channel->read_local_id =
+            _libssh2_ntohu32(readpkt->data + 1);
+
+        /*
+         * Either we asked for a specific extended data stream
+         * (and data was available),
+         * or the standard stream (and data was available),
+         * or the standard stream with extended_data_merge
+         * enabled and data was available
+         */
+        if ((stream_id
+             && (readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
+             && (channel->local.id == channel->read_local_id)
+             && (stream_id == (int) _libssh2_ntohu32(readpkt->data + 5)))
+            || (!stream_id && (readpkt->data[0] == SSH_MSG_CHANNEL_DATA)
+                && (channel->local.id == channel->read_local_id))
+            || (!stream_id
+                && (readpkt->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
+                && (channel->local.id == channel->read_local_id)
+                && (channel->remote.extended_data_ignore_mode ==
+                    LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
+
+            /* figure out much more data we want to read */
+            bytes_want = buflen - bytes_read;
+            unlink_packet = FALSE;
+
+            if (bytes_want >= (int) (readpkt->data_len - readpkt->data_head)) {
+                /* we want more than this node keeps, so adjust the number and
+                   delete this node after the copy */
+                bytes_want = readpkt->data_len - readpkt->data_head;
+                unlink_packet = TRUE;
+            }
+
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "channel_read() got %d of data from %lu/%lu/%d%s",
+                           bytes_want, channel->local.id,
+                           channel->remote.id, stream_id,
+                           unlink_packet?" [ul]":"");
+
+            /* copy data from this struct to the target buffer */
+            memcpy(&buf[bytes_read],
+                   &readpkt->data[readpkt->data_head], bytes_want);
+
+            /* advance pointer and counter */
+            readpkt->data_head += bytes_want;
+            bytes_read += bytes_want;
+
+            /* if drained, remove from list */
+            if (unlink_packet) {
+                /* detach readpkt from session->packets list */
+                _libssh2_list_remove(&readpkt->node);
+
+                LIBSSH2_FREE(session, readpkt->data);
+                LIBSSH2_FREE(session, readpkt);
+            }
+        }
+
+        /* check the next struct in the chain */
+        read_packet = read_next;
+    }
+
+    if (!bytes_read) {
+        channel->read_state = libssh2_NB_state_idle;
+
+        /* If the channel is already at EOF or even closed, we need to signal
+           that back. We may have gotten that info while draining the incoming
+           transport layer until EAGAIN so we must not be fooled by that
+           return code. */
+        if(channel->remote.eof || channel->remote.close)
+            return 0;
+        else if(rc != LIBSSH2_ERROR_EAGAIN)
+            return 0;
+
+        /* if the transport layer said EAGAIN then we say so as well */
+        return _libssh2_error(session, rc, "would block");
+    }
+    else
+        /* make sure we remain in the created state to focus on emptying the
+           data we already have in the packet brigade before we try to read
+           more off the network again */
+        channel->read_state = libssh2_NB_state_created;
+
+    return bytes_read;
+}
+
+/*
+ * libssh2_channel_read_ex
+ *
+ * Read data from a channel (blocking or non-blocking depending on set state)
+ *
+ * When this is done non-blocking, it is important to not return 0 until the
+ * currently read channel is complete. If we read stuff from the wire but it
+ * was no payload data to fill in the buffer with, we MUST make sure to return
+ * LIBSSH2_ERROR_EAGAIN.
+ *
+ * This function will first make sure there's a receive window enough to
+ * receive a full buffer's wort of contents. An application may choose to
+ * adjust the receive window more to increase transfer performance.
+ */
+LIBSSH2_API ssize_t
+libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, char *buf,
+                        size_t buflen)
+{
+    int rc;
+    unsigned long recv_window;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    recv_window = libssh2_channel_window_read_ex(channel, NULL, NULL);
+
+    if(buflen > recv_window) {
+        BLOCK_ADJUST(rc, channel->session,
+                     _libssh2_channel_receive_window_adjust(channel, buflen,
+                                                            1, NULL));
+    }
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_read(channel, stream_id, buf, buflen));
+    return rc;
+}
+
+/*
+ * _libssh2_channel_packet_data_len
+ *
+ * Return the size of the data block of the current packet, or 0 if there
+ * isn't a packet.
+ */
+size_t
+_libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, int stream_id)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    LIBSSH2_PACKET *read_packet;
+    uint32_t read_local_id;
+
+    read_packet = _libssh2_list_first(&session->packets);
+    if (read_packet == NULL)
+        return 0;
+
+    while (read_packet) {
+        read_local_id = _libssh2_ntohu32(read_packet->data + 1);
+
+        /*
+         * Either we asked for a specific extended data stream
+         * (and data was available),
+         * or the standard stream (and data was available),
+         * or the standard stream with extended_data_merge
+         * enabled and data was available
+         */
+        if ((stream_id
+             && (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
+             && (channel->local.id == read_local_id)
+             && (stream_id == (int) _libssh2_ntohu32(read_packet->data + 5)))
+            ||
+            (!stream_id
+             && (read_packet->data[0] == SSH_MSG_CHANNEL_DATA)
+             && (channel->local.id == read_local_id))
+            ||
+            (!stream_id
+             && (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)
+             && (channel->local.id == read_local_id)
+             && (channel->remote.extended_data_ignore_mode
+                 == LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE)))
+        {
+            return (read_packet->data_len - read_packet->data_head);
+        }
+        read_packet = _libssh2_list_next(&read_packet->node);
+    }
+
+    return 0;
+}
+
+/*
+ * _libssh2_channel_write
+ *
+ * Send data to a channel. Note that if this returns EAGAIN, the caller must
+ * call this function again with the SAME input arguments.
+ *
+ * Returns: number of bytes sent, or if it returns a negative number, that is
+ * the error code!
+ */
+ssize_t
+_libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
+                       const unsigned char *buf, size_t buflen)
+{
+    int rc = 0;
+    LIBSSH2_SESSION *session = channel->session;
+    ssize_t wrote = 0; /* counter for this specific this call */
+
+    /* In theory we could split larger buffers into several smaller packets
+     * but it turns out to be really hard and nasty to do while still offering
+     * the API/prototype.
+     *
+     * Instead we only deal with the first 32K in this call and for the parent
+     * function to call it again with the remainder! 32K is a conservative
+     * limit based on the text in RFC4253 section 6.1.
+     */
+    if(buflen > 32700)
+        buflen = 32700;
+
+    if (channel->write_state == libssh2_NB_state_idle) {
+        unsigned char *s = channel->write_packet;
+
+        _libssh2_debug(channel->session, LIBSSH2_TRACE_CONN,
+                       "Writing %d bytes on channel %lu/%lu, stream #%d",
+                       (int) buflen, channel->local.id, channel->remote.id,
+                       stream_id);
+
+        if (channel->local.close)
+            return _libssh2_error(channel->session,
+                                  LIBSSH2_ERROR_CHANNEL_CLOSED,
+                                  "We've already closed this channel");
+        else if (channel->local.eof)
+            return _libssh2_error(channel->session,
+                                  LIBSSH2_ERROR_CHANNEL_EOF_SENT,
+                                  "EOF has already been received, "
+                                  "data might be ignored");
+
+        /* drain the incoming flow first, mostly to make sure we get all
+         * pending window adjust packets */
+        do
+            rc = _libssh2_transport_read(session);
+        while (rc > 0);
+
+        if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
+            return rc;
+
+        if(channel->local.window_size <= 0)
+            /* there's no room for data so we stop */
+            return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
+
+        channel->write_bufwrite = buflen;
+
+        *(s++) = stream_id ? SSH_MSG_CHANNEL_EXTENDED_DATA :
+            SSH_MSG_CHANNEL_DATA;
+        _libssh2_store_u32(&s, channel->remote.id);
+        if (stream_id)
+            _libssh2_store_u32(&s, stream_id);
+
+        /* Don't exceed the remote end's limits */
+        /* REMEMBER local means local as the SOURCE of the data */
+        if (channel->write_bufwrite > channel->local.window_size) {
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "Splitting write block due to %lu byte "
+                           "window_size on %lu/%lu/%d",
+                           channel->local.window_size, channel->local.id,
+                           channel->remote.id, stream_id);
+            channel->write_bufwrite = channel->local.window_size;
+        }
+        if (channel->write_bufwrite > channel->local.packet_size) {
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "Splitting write block due to %lu byte "
+                           "packet_size on %lu/%lu/%d",
+                           channel->local.packet_size, channel->local.id,
+                           channel->remote.id, stream_id);
+            channel->write_bufwrite = channel->local.packet_size;
+        }
+        /* store the size here only, the buffer is passed in as-is to
+           _libssh2_transport_send() */
+        _libssh2_store_u32(&s, channel->write_bufwrite);
+        channel->write_packet_len = s - channel->write_packet;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Sending %d bytes on channel %lu/%lu, stream_id=%d",
+                       (int) channel->write_bufwrite, channel->local.id,
+                       channel->remote.id, stream_id);
+
+        channel->write_state = libssh2_NB_state_created;
+    }
+
+    if (channel->write_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, channel->write_packet,
+                                     channel->write_packet_len,
+                                     buf, channel->write_bufwrite);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, rc,
+                                  "Unable to send channel data");
+        }
+        else if (rc) {
+            channel->write_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Unable to send channel data");
+        }
+        /* Shrink local window size */
+        channel->local.window_size -= channel->write_bufwrite;
+
+        wrote += channel->write_bufwrite;
+
+        /* Since _libssh2_transport_write() succeeded, we must return
+           now to allow the caller to provide the next chunk of data.
+
+           We cannot move on to send the next piece of data that may
+           already have been provided in this same function call, as we
+           risk getting EAGAIN for that and we can't return information
+           both about sent data as well as EAGAIN. So, by returning short
+           now, the caller will call this function again with new data to
+           send */
+
+        channel->write_state = libssh2_NB_state_idle;
+
+        return wrote;
+    }
+
+    return LIBSSH2_ERROR_INVAL; /* reaching this point is really bad */
+}
+
+/*
+ * libssh2_channel_write_ex
+ *
+ * Send data to a channel
+ */
+LIBSSH2_API ssize_t
+libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id,
+                         const char *buf, size_t buflen)
+{
+    ssize_t rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session,
+                 _libssh2_channel_write(channel, stream_id,
+                                        (unsigned char *)buf, buflen));
+    return rc;
+}
+
+/*
+ * channel_send_eof
+ *
+ * Send EOF on channel
+ */
+static int channel_send_eof(LIBSSH2_CHANNEL *channel)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char packet[5];    /* packet_type(1) + channelno(4) */
+    int rc;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Sending EOF on channel %lu/%lu",
+                   channel->local.id, channel->remote.id);
+    packet[0] = SSH_MSG_CHANNEL_EOF;
+    _libssh2_htonu32(packet + 1, channel->remote.id);
+    rc = _libssh2_transport_send(session, packet, 5, NULL, 0);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        _libssh2_error(session, rc,
+                       "Would block sending EOF");
+        return rc;
+    }
+    else if (rc) {
+        return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                              "Unable to send EOF on channel");
+    }
+    channel->local.eof = 1;
+
+    return 0;
+}
+
+/*
+ * libssh2_channel_send_eof
+ *
+ * Send EOF on channel
+ */
+LIBSSH2_API int
+libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, channel_send_eof(channel));
+    return rc;
+}
+
+/*
+ * libssh2_channel_eof
+ *
+ * Read channel's eof status
+ */
+LIBSSH2_API int
+libssh2_channel_eof(LIBSSH2_CHANNEL * channel)
+{
+    LIBSSH2_SESSION *session;
+    LIBSSH2_PACKET *packet;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    session = channel->session;
+    packet = _libssh2_list_first(&session->packets);
+
+    while (packet) {
+        if (((packet->data[0] == SSH_MSG_CHANNEL_DATA)
+             || (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA))
+            && (channel->local.id == _libssh2_ntohu32(packet->data + 1))) {
+            /* There's data waiting to be read yet, mask the EOF status */
+            return 0;
+        }
+        packet = _libssh2_list_next(&packet->node);
+    }
+
+    return channel->remote.eof;
+}
+
+/*
+ * channel_wait_eof
+ *
+ * Awaiting channel EOF
+ */
+static int channel_wait_eof(LIBSSH2_CHANNEL *channel)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    int rc;
+
+    if (channel->wait_eof_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Awaiting close of channel %lu/%lu", channel->local.id,
+                       channel->remote.id);
+
+        channel->wait_eof_state = libssh2_NB_state_created;
+    }
+
+    /*
+     * While channel is not eof, read more packets from the network.
+     * Either the EOF will be set or network timeout will occur.
+     */
+    do {
+        if (channel->remote.eof) {
+            break;
+        }
+        rc = _libssh2_transport_read(session);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        }
+        else if (rc < 0) {
+            channel->wait_eof_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "_libssh2_transport_read() bailed out!");
+        }
+    } while (1);
+
+    channel->wait_eof_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/*
+ * libssh2_channel_wait_eof
+ *
+ * Awaiting channel EOF
+ */
+LIBSSH2_API int
+libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, channel_wait_eof(channel));
+    return rc;
+}
+
+int _libssh2_channel_close(LIBSSH2_CHANNEL * channel)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    int rc = 0;
+    int retcode;
+
+    if (channel->local.close) {
+        /* Already closed, act like we sent another close,
+         * even though we didn't... shhhhhh */
+        channel->close_state = libssh2_NB_state_idle;
+        return 0;
+    }
+
+    if (!channel->local.eof)
+        if ((retcode = channel_send_eof(channel)))
+            return retcode;
+
+    /* ignore if we have received a remote eof or not, as it is now too
+       late for us to wait for it. Continue closing! */
+
+    if (channel->close_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Closing channel %lu/%lu",
+                       channel->local.id, channel->remote.id);
+
+        channel->close_packet[0] = SSH_MSG_CHANNEL_CLOSE;
+        _libssh2_htonu32(channel->close_packet + 1, channel->remote.id);
+
+        channel->close_state = libssh2_NB_state_created;
+    }
+
+    if (channel->close_state == libssh2_NB_state_created) {
+        retcode = _libssh2_transport_send(session, channel->close_packet, 5,
+                                          NULL, 0);
+        if (retcode == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, rc,
+                           "Would block sending close-channel");
+            return retcode;
+        } else if (retcode) {
+            channel->close_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, retcode,
+                                  "Unable to send close-channel request");
+        }
+
+        channel->close_state = libssh2_NB_state_sent;
+    }
+
+    if (channel->close_state == libssh2_NB_state_sent) {
+        /* We must wait for the remote SSH_MSG_CHANNEL_CLOSE message */
+
+        while (!channel->remote.close && !rc &&
+               (session->socket_state != LIBSSH2_SOCKET_DISCONNECTED))
+            rc = _libssh2_transport_read(session);
+    }
+
+    if(rc != LIBSSH2_ERROR_EAGAIN) {
+        /* set the local close state first when we're perfectly confirmed to not
+           do any more EAGAINs */
+        channel->local.close = 1;
+
+        /* We call the callback last in this function to make it keep the local
+           data as long as EAGAIN is returned. */
+        if (channel->close_cb) {
+            LIBSSH2_CHANNEL_CLOSE(session, channel);
+        }
+
+        channel->close_state = libssh2_NB_state_idle;
+    }
+
+    /* return 0 or an error */
+    return rc>=0?0:rc;
+}
+
+/*
+ * libssh2_channel_close
+ *
+ * Close a channel
+ */
+LIBSSH2_API int
+libssh2_channel_close(LIBSSH2_CHANNEL *channel)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, _libssh2_channel_close(channel) );
+    return rc;
+}
+
+/*
+ * channel_wait_closed
+ *
+ * Awaiting channel close after EOF
+ */
+static int channel_wait_closed(LIBSSH2_CHANNEL *channel)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    int rc;
+
+    if (!libssh2_channel_eof(channel)) {
+        return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                              "libssh2_channel_wait_closed() invoked when "
+                              "channel is not in EOF state");
+    }
+
+    if (channel->wait_closed_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Awaiting close of channel %lu/%lu", channel->local.id,
+                       channel->remote.id);
+
+        channel->wait_closed_state = libssh2_NB_state_created;
+    }
+
+    /*
+     * While channel is not closed, read more packets from the network.
+     * Either the channel will be closed or network timeout will occur.
+     */
+    if (!channel->remote.close) {
+        do {
+            rc = _libssh2_transport_read(session);
+            if (channel->remote.close)
+                /* it is now closed, move on! */
+                break;
+        } while (rc > 0);
+        if(rc < 0)
+            return rc;
+    }
+
+    channel->wait_closed_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/*
+ * libssh2_channel_wait_closed
+ *
+ * Awaiting channel close after EOF
+ */
+LIBSSH2_API int
+libssh2_channel_wait_closed(LIBSSH2_CHANNEL *channel)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, channel_wait_closed(channel));
+    return rc;
+}
+
+/*
+ * _libssh2_channel_free
+ *
+ * Make sure a channel is closed, then remove the channel from the session
+ * and free its resource(s)
+ *
+ * Returns 0 on success, negative on failure
+ */
+int _libssh2_channel_free(LIBSSH2_CHANNEL *channel)
+{
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char channel_id[4];
+    unsigned char *data;
+    size_t data_len;
+    int rc;
+
+    assert(session);
+
+    if (channel->free_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Freeing channel %lu/%lu resources", channel->local.id,
+                       channel->remote.id);
+
+        channel->free_state = libssh2_NB_state_created;
+    }
+
+    /* Allow channel freeing even when the socket has lost its connection */
+    if (!channel->local.close
+        && (session->socket_state == LIBSSH2_SOCKET_CONNECTED)) {
+        rc = _libssh2_channel_close(channel);
+
+        if(rc == LIBSSH2_ERROR_EAGAIN)
+            return rc;
+
+        /* ignore all other errors as they otherwise risk blocking the channel
+           free from happening */
+    }
+
+    channel->free_state = libssh2_NB_state_idle;
+
+    if (channel->exit_signal) {
+        LIBSSH2_FREE(session, channel->exit_signal);
+    }
+
+    /*
+     * channel->remote.close *might* not be set yet, Well...
+     * We've sent the close packet, what more do you want?
+     * Just let packet_add ignore it when it finally arrives
+     */
+
+    /* Clear out packets meant for this channel */
+    _libssh2_htonu32(channel_id, channel->local.id);
+    while ((_libssh2_packet_ask(session, SSH_MSG_CHANNEL_DATA, &data,
+                                &data_len, 1, channel_id, 4) >= 0)
+           ||
+           (_libssh2_packet_ask(session, SSH_MSG_CHANNEL_EXTENDED_DATA, &data,
+                                &data_len, 1, channel_id, 4) >= 0)) {
+        LIBSSH2_FREE(session, data);
+    }
+
+    /* free "channel_type" */
+    if (channel->channel_type) {
+        LIBSSH2_FREE(session, channel->channel_type);
+    }
+
+    /* Unlink from channel list */
+    _libssh2_list_remove(&channel->node);
+
+    /*
+     * Make sure all memory used in the state variables are free
+     */
+    if (channel->setenv_packet) {
+        LIBSSH2_FREE(session, channel->setenv_packet);
+    }
+    if (channel->reqX11_packet) {
+        LIBSSH2_FREE(session, channel->reqX11_packet);
+    }
+    if (channel->process_packet) {
+        LIBSSH2_FREE(session, channel->process_packet);
+    }
+
+    LIBSSH2_FREE(session, channel);
+
+    return 0;
+}
+
+/*
+ * libssh2_channel_free
+ *
+ * Make sure a channel is closed, then remove the channel from the session
+ * and free its resource(s)
+ *
+ * Returns 0 on success, negative on failure
+ */
+LIBSSH2_API int
+libssh2_channel_free(LIBSSH2_CHANNEL *channel)
+{
+    int rc;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, channel->session, _libssh2_channel_free(channel));
+    return rc;
+}
+/*
+ * libssh2_channel_window_read_ex
+ *
+ * Check the status of the read window. Returns the number of bytes which the
+ * remote end may send without overflowing the window limit read_avail (if
+ * passed) will be populated with the number of bytes actually available to be
+ * read window_size_initial (if passed) will be populated with the
+ * window_size_initial as defined by the channel_open request
+ */
+LIBSSH2_API unsigned long
+libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
+                               unsigned long *read_avail,
+                               unsigned long *window_size_initial)
+{
+    if(!channel)
+        return 0; /* no channel, no window! */
+
+    if (window_size_initial) {
+        *window_size_initial = channel->remote.window_size_initial;
+    }
+
+    if (read_avail) {
+        size_t bytes_queued = 0;
+        LIBSSH2_PACKET *packet =
+            _libssh2_list_first(&channel->session->packets);
+
+        while (packet) {
+            unsigned char packet_type = packet->data[0];
+
+            if (((packet_type == SSH_MSG_CHANNEL_DATA)
+                 || (packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA))
+                && (_libssh2_ntohu32(packet->data + 1) == channel->local.id)) {
+                bytes_queued += packet->data_len - packet->data_head;
+            }
+
+            packet = _libssh2_list_next(&packet->node);
+        }
+
+        *read_avail = bytes_queued;
+    }
+
+    return channel->remote.window_size;
+}
+
+/*
+ * libssh2_channel_window_write_ex
+ *
+ * Check the status of the write window Returns the number of bytes which may
+ * be safely writen on the channel without blocking window_size_initial (if
+ * passed) will be populated with the size of the initial window as defined by
+ * the channel_open request
+ */
+LIBSSH2_API unsigned long
+libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
+                                unsigned long *window_size_initial)
+{
+    if(!channel)
+        return 0; /* no channel, no window! */
+
+    if (window_size_initial) {
+        /* For locally initiated channels this is very often 0, so it's not
+         * *that* useful as information goes */
+        *window_size_initial = channel->local.window_size_initial;
+    }
+
+    return channel->local.window_size;
+}
diff --git a/pgadmin/libssh2/comp.c b/pgadmin/libssh2/comp.c
new file mode 100644
index 0000000..4593ce4
--- /dev/null
+++ b/pgadmin/libssh2/comp.c
@@ -0,0 +1,376 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2010, Daniel Stenberg <daniel@haxx.se>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#ifdef LIBSSH2_HAVE_ZLIB
+# include <zlib.h>
+#endif
+
+#include "comp.h"
+
+/* ********
+ * none *
+ ******** */
+
+/*
+ * comp_method_none_comp
+ *
+ * Minimalist compression: Absolutely none
+ */
+static int
+comp_method_none_comp(LIBSSH2_SESSION *session,
+                      unsigned char *dest,
+                      size_t *dest_len,
+                      const unsigned char *src,
+                      size_t src_len,
+                      void **abstract)
+{
+    (void) session;
+    (void) abstract;
+    (void) dest;
+    (void) dest_len;
+    (void) src;
+    (void) src_len;
+
+    return 0;
+}
+
+/*
+ * comp_method_none_decomp
+ *
+ * Minimalist decompression: Absolutely none
+ */
+static int
+comp_method_none_decomp(LIBSSH2_SESSION * session,
+                        unsigned char **dest,
+                        size_t *dest_len,
+                        size_t payload_limit,
+                        const unsigned char *src,
+                        size_t src_len, void **abstract)
+{
+    (void) session;
+    (void) payload_limit;
+    (void) abstract;
+    *dest = (unsigned char *) src;
+    *dest_len = src_len;
+    return 0;
+}
+
+
+
+static const LIBSSH2_COMP_METHOD comp_method_none = {
+    "none",
+    0, /* not really compressing */
+    0, /* isn't used in userauth, go figure */
+    NULL,
+    comp_method_none_comp,
+    comp_method_none_decomp,
+    NULL
+};
+
+#ifdef LIBSSH2_HAVE_ZLIB
+/* ********
+ * zlib *
+ ******** */
+
+/* Memory management wrappers
+ * Yes, I realize we're doing a callback to a callback,
+ * Deal...
+ */
+
+static voidpf
+comp_method_zlib_alloc(voidpf opaque, uInt items, uInt size)
+{
+    LIBSSH2_SESSION *session = (LIBSSH2_SESSION *) opaque;
+
+    return (voidpf) LIBSSH2_ALLOC(session, items * size);
+}
+
+static void
+comp_method_zlib_free(voidpf opaque, voidpf address)
+{
+    LIBSSH2_SESSION *session = (LIBSSH2_SESSION *) opaque;
+
+    LIBSSH2_FREE(session, address);
+}
+
+
+
+/* libssh2_comp_method_zlib_init
+ * All your bandwidth are belong to us (so save some)
+ */
+static int
+comp_method_zlib_init(LIBSSH2_SESSION * session, int compr,
+                      void **abstract)
+{
+    z_stream *strm;
+    int status;
+
+    strm = LIBSSH2_ALLOC(session, sizeof(z_stream));
+    if (!strm) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate memory for "
+                              "zlib compression/decompression");
+    }
+    memset(strm, 0, sizeof(z_stream));
+
+    strm->opaque = (voidpf) session;
+    strm->zalloc = (alloc_func) comp_method_zlib_alloc;
+    strm->zfree = (free_func) comp_method_zlib_free;
+    if (compr) {
+        /* deflate */
+        status = deflateInit(strm, Z_DEFAULT_COMPRESSION);
+    } else {
+        /* inflate */
+        status = inflateInit(strm);
+    }
+
+    if (status != Z_OK) {
+        LIBSSH2_FREE(session, strm);
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "unhandled zlib error %d", status);
+        return LIBSSH2_ERROR_COMPRESS;
+    }
+    *abstract = strm;
+
+    return LIBSSH2_ERROR_NONE;
+}
+
+/*
+ * libssh2_comp_method_zlib_comp
+ *
+ * Compresses source to destination. Without allocation.
+ */
+static int
+comp_method_zlib_comp(LIBSSH2_SESSION *session,
+                      unsigned char *dest,
+
+                      /* dest_len is a pointer to allow this function to
+                         update it with the final actual size used */
+                      size_t *dest_len,
+                      const unsigned char *src,
+                      size_t src_len,
+                      void **abstract)
+{
+    z_stream *strm = *abstract;
+    int out_maxlen = *dest_len;
+    int status;
+
+    strm->next_in = (unsigned char *) src;
+    strm->avail_in = src_len;
+    strm->next_out = dest;
+    strm->avail_out = out_maxlen;
+
+    status = deflate(strm, Z_PARTIAL_FLUSH);
+
+    if (status != Z_OK) {
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "unhandled zlib compression error %d", status);
+        return _libssh2_error(session, LIBSSH2_ERROR_ZLIB,
+                              "compression failure");
+    }
+
+    *dest_len = out_maxlen - strm->avail_out;
+    return 0;
+}
+
+/*
+ * libssh2_comp_method_zlib_decomp
+ *
+ * Decompresses source to destination. Allocates the output memory.
+ */
+static int
+comp_method_zlib_decomp(LIBSSH2_SESSION * session,
+                        unsigned char **dest,
+                        size_t *dest_len,
+                        size_t payload_limit,
+                        const unsigned char *src,
+                        size_t src_len, void **abstract)
+{
+    z_stream *strm = *abstract;
+    /* A short-term alloc of a full data chunk is better than a series of
+       reallocs */
+    char *out;
+    int out_maxlen = 8 * src_len;
+    int limiter = 0;
+
+    /* If strm is null, then we have not yet been initialized. */
+    if (strm == NULL)
+        return _libssh2_error(session, LIBSSH2_ERROR_COMPRESS,
+                              "decompression unitilized");;
+
+    /* In practice they never come smaller than this */
+    if (out_maxlen < 25)
+        out_maxlen = 25;
+
+    if (out_maxlen > (int) payload_limit)
+        out_maxlen = payload_limit;
+
+    strm->next_in = (unsigned char *) src;
+    strm->avail_in = src_len;
+    strm->next_out = (unsigned char *) LIBSSH2_ALLOC(session, out_maxlen);
+    out = (char *) strm->next_out;
+    strm->avail_out = out_maxlen;
+    if (!strm->next_out)
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate decompression buffer");
+
+    /* Loop until it's all inflated or hit error */
+    for (;;) {
+        int status, grow_size;
+        size_t out_ofs;
+        char *newout;
+
+        status = inflate(strm, Z_PARTIAL_FLUSH);
+
+        if (status == Z_OK) {
+            if (! strm->avail_in) {
+                /* status is OK and input all used so we're done */
+                break;
+            }
+        } else if (status == Z_BUF_ERROR) {
+            /* This is OK, just drop through to grow the buffer */
+        } else {
+            /* error state */
+            LIBSSH2_FREE(session, out);
+            _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                           "unhandled zlib error %d", status);
+            return _libssh2_error(session, LIBSSH2_ERROR_ZLIB,
+                                  "decompression failure");
+        }
+
+        /* If we get here we need to grow the output buffer and try again */
+        out_ofs = out_maxlen - strm->avail_out;
+        if (strm->avail_in) {
+            grow_size = strm->avail_in * 8;
+        } else {
+            /* Not sure how much to grow by */
+            grow_size = 32;
+        }
+        out_maxlen += grow_size;
+
+        if ((out_maxlen > (int) payload_limit) && limiter++) {
+            LIBSSH2_FREE(session, out);
+            return _libssh2_error(session, LIBSSH2_ERROR_ZLIB,
+                                  "Excessive growth in decompression phase");
+        }
+
+        newout = LIBSSH2_REALLOC(session, out, out_maxlen);
+        if (!newout) {
+            LIBSSH2_FREE(session, out);
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to expand decompression buffer");
+        }
+        out = newout;
+        strm->next_out = (unsigned char *) out + out_ofs;
+        strm->avail_out += grow_size;
+    }
+
+    *dest = (unsigned char *) out;
+    *dest_len = out_maxlen - strm->avail_out;
+
+    return 0;
+}
+
+
+/* libssh2_comp_method_zlib_dtor
+ * All done, no more compression for you
+ */
+static int
+comp_method_zlib_dtor(LIBSSH2_SESSION *session, int compr, void **abstract)
+{
+    z_stream *strm = *abstract;
+
+    if (strm) {
+        if (compr)
+            deflateEnd(strm);
+        else
+            inflateEnd(strm);
+        LIBSSH2_FREE(session, strm);
+    }
+
+    *abstract = NULL;
+    return 0;
+}
+
+static const LIBSSH2_COMP_METHOD comp_method_zlib = {
+    "zlib",
+    1, /* yes, this compresses */
+    1, /* do compression during userauth */
+    comp_method_zlib_init,
+    comp_method_zlib_comp,
+    comp_method_zlib_decomp,
+    comp_method_zlib_dtor,
+};
+
+static const LIBSSH2_COMP_METHOD comp_method_zlib_openssh = {
+    "zlib@openssh.com",
+    1, /* yes, this compresses */
+    0, /* don't use compression during userauth */
+    comp_method_zlib_init,
+    comp_method_zlib_comp,
+    comp_method_zlib_decomp,
+    comp_method_zlib_dtor,
+};
+#endif /* LIBSSH2_HAVE_ZLIB */
+
+/* If compression is enabled by the API, then this array is used which then
+   may allow compression if zlib is available at build time */
+static const LIBSSH2_COMP_METHOD *comp_methods[] = {
+#ifdef LIBSSH2_HAVE_ZLIB
+    &comp_method_zlib,
+    &comp_method_zlib_openssh,
+#endif /* LIBSSH2_HAVE_ZLIB */
+    &comp_method_none,
+    NULL
+};
+
+/* If compression is disabled by the API, then this array is used */
+static const LIBSSH2_COMP_METHOD *no_comp_methods[] = {
+    &comp_method_none,
+    NULL
+};
+
+const LIBSSH2_COMP_METHOD **
+_libssh2_comp_methods(LIBSSH2_SESSION *session)
+{
+    if(session->flag.compress)
+        return comp_methods;
+    else
+        return no_comp_methods;
+}
diff --git a/pgadmin/libssh2/crypt.c b/pgadmin/libssh2/crypt.c
new file mode 100644
index 0000000..931ae8b
--- /dev/null
+++ b/pgadmin/libssh2/crypt.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2009, 2010 Simon Josefsson <simon@josefsson.org>
+ * Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#ifdef LIBSSH2_CRYPT_NONE
+
+/* crypt_none_crypt
+ * Minimalist cipher: VERY secure *wink*
+ */
+static int
+crypt_none_crypt(LIBSSH2_SESSION * session, unsigned char *buf,
+                         void **abstract)
+{
+    /* Do nothing to the data! */
+    return 0;
+}
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_none = {
+    "none",
+    8,                     /* blocksize (SSH2 defines minimum blocksize as 8) */
+    0,                     /* iv_len */
+    0,                     /* secret_len */
+    0,                     /* flags */
+    NULL,
+    crypt_none_crypt,
+    NULL
+};
+#endif /* LIBSSH2_CRYPT_NONE */
+
+struct crypt_ctx
+{
+    int encrypt;
+    _libssh2_cipher_type(algo);
+    _libssh2_cipher_ctx h;
+};
+
+static int
+crypt_init(LIBSSH2_SESSION * session,
+           const LIBSSH2_CRYPT_METHOD * method,
+           unsigned char *iv, int *free_iv,
+           unsigned char *secret, int *free_secret,
+           int encrypt, void **abstract)
+{
+    struct crypt_ctx *ctx = LIBSSH2_ALLOC(session,
+                                          sizeof(struct crypt_ctx));
+    if (!ctx)
+        return LIBSSH2_ERROR_ALLOC;
+
+    ctx->encrypt = encrypt;
+    ctx->algo = method->algo;
+    if (_libssh2_cipher_init(&ctx->h, ctx->algo, iv, secret, encrypt)) {
+        LIBSSH2_FREE(session, ctx);
+        return -1;
+    }
+    *abstract = ctx;
+    *free_iv = 1;
+    *free_secret = 1;
+    return 0;
+}
+
+static int
+crypt_encrypt(LIBSSH2_SESSION * session, unsigned char *block,
+              size_t blocksize, void **abstract)
+{
+    struct crypt_ctx *cctx = *(struct crypt_ctx **) abstract;
+    (void) session;
+    return _libssh2_cipher_crypt(&cctx->h, cctx->algo, cctx->encrypt, block,
+                                 blocksize);
+}
+
+static int
+crypt_dtor(LIBSSH2_SESSION * session, void **abstract)
+{
+    struct crypt_ctx **cctx = (struct crypt_ctx **) abstract;
+    if (cctx && *cctx) {
+        _libssh2_cipher_dtor(&(*cctx)->h);
+        LIBSSH2_FREE(session, *cctx);
+        *abstract = NULL;
+    }
+    return 0;
+}
+
+#if LIBSSH2_AES_CTR
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes128_ctr = {
+    "aes128-ctr",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    16,                         /* secret length -- 16*8 == 128bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes128ctr
+};
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes192_ctr = {
+    "aes192-ctr",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    24,                         /* secret length -- 24*8 == 192bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes192ctr
+};
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes256_ctr = {
+    "aes256-ctr",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    32,                         /* secret length -- 32*8 == 256bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes256ctr
+};
+#endif
+
+#if LIBSSH2_AES
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes128_cbc = {
+    "aes128-cbc",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    16,                         /* secret length -- 16*8 == 128bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes128
+};
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes192_cbc = {
+    "aes192-cbc",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    24,                         /* secret length -- 24*8 == 192bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes192
+};
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes256_cbc = {
+    "aes256-cbc",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    32,                         /* secret length -- 32*8 == 256bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes256
+};
+
+/* rijndael-cbc@lysator.liu.se == aes256-cbc */
+static const LIBSSH2_CRYPT_METHOD
+    libssh2_crypt_method_rijndael_cbc_lysator_liu_se = {
+    "rijndael-cbc@lysator.liu.se",
+    16,                         /* blocksize */
+    16,                         /* initial value length */
+    32,                         /* secret length -- 32*8 == 256bit */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_aes256
+};
+#endif /* LIBSSH2_AES */
+
+#if LIBSSH2_BLOWFISH
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_blowfish_cbc = {
+    "blowfish-cbc",
+    8,                          /* blocksize */
+    8,                          /* initial value length */
+    16,                         /* secret length */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_blowfish
+};
+#endif /* LIBSSH2_BLOWFISH */
+
+#if LIBSSH2_RC4
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_arcfour = {
+    "arcfour",
+    8,                          /* blocksize */
+    8,                          /* initial value length */
+    16,                         /* secret length */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_arcfour
+};
+
+static int
+crypt_init_arcfour128(LIBSSH2_SESSION * session,
+                      const LIBSSH2_CRYPT_METHOD * method,
+                      unsigned char *iv, int *free_iv,
+                      unsigned char *secret, int *free_secret,
+                      int encrypt, void **abstract)
+{
+    int rc;
+
+    rc = crypt_init (session, method, iv, free_iv, secret, free_secret,
+                     encrypt, abstract);
+    if (rc == 0) {
+        struct crypt_ctx *cctx = *(struct crypt_ctx **) abstract;
+        unsigned char block[8];
+        size_t discard = 1536;
+        for (; discard; discard -= 8)
+            _libssh2_cipher_crypt(&cctx->h, cctx->algo, cctx->encrypt, block,
+                                  method->blocksize);
+    }
+
+    return rc;
+}
+
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_arcfour128 = {
+    "arcfour128",
+    8,                          /* blocksize */
+    8,                          /* initial value length */
+    16,                         /* secret length */
+    0,                          /* flags */
+    &crypt_init_arcfour128,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_arcfour
+};
+#endif /* LIBSSH2_RC4 */
+
+#if LIBSSH2_CAST
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_cast128_cbc = {
+    "cast128-cbc",
+    8,                          /* blocksize */
+    8,                          /* initial value length */
+    16,                         /* secret length */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_cast5
+};
+#endif /* LIBSSH2_CAST */
+
+#if LIBSSH2_3DES
+static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_3des_cbc = {
+    "3des-cbc",
+    8,                          /* blocksize */
+    8,                          /* initial value length */
+    24,                         /* secret length */
+    0,                          /* flags */
+    &crypt_init,
+    &crypt_encrypt,
+    &crypt_dtor,
+    _libssh2_cipher_3des
+};
+#endif
+
+static const LIBSSH2_CRYPT_METHOD *_libssh2_crypt_methods[] = {
+#if LIBSSH2_AES_CTR
+  &libssh2_crypt_method_aes128_ctr,
+  &libssh2_crypt_method_aes192_ctr,
+  &libssh2_crypt_method_aes256_ctr,
+#endif /* LIBSSH2_AES */
+#if LIBSSH2_AES
+    &libssh2_crypt_method_aes256_cbc,
+    &libssh2_crypt_method_rijndael_cbc_lysator_liu_se,  /* == aes256-cbc */
+    &libssh2_crypt_method_aes192_cbc,
+    &libssh2_crypt_method_aes128_cbc,
+#endif /* LIBSSH2_AES */
+#if LIBSSH2_BLOWFISH
+    &libssh2_crypt_method_blowfish_cbc,
+#endif /* LIBSSH2_BLOWFISH */
+#if LIBSSH2_RC4
+    &libssh2_crypt_method_arcfour128,
+    &libssh2_crypt_method_arcfour,
+#endif /* LIBSSH2_RC4 */
+#if LIBSSH2_CAST
+    &libssh2_crypt_method_cast128_cbc,
+#endif /* LIBSSH2_CAST */
+#if LIBSSH2_3DES
+    &libssh2_crypt_method_3des_cbc,
+#endif /*  LIBSSH2_DES */
+#ifdef LIBSSH2_CRYPT_NONE
+    &libssh2_crypt_method_none,
+#endif
+    NULL
+};
+
+/* Expose to kex.c */
+const LIBSSH2_CRYPT_METHOD **
+libssh2_crypt_methods(void)
+{
+    return _libssh2_crypt_methods;
+}
diff --git a/pgadmin/libssh2/global.c b/pgadmin/libssh2/global.c
new file mode 100644
index 0000000..dc45e70
--- /dev/null
+++ b/pgadmin/libssh2/global.c
@@ -0,0 +1,78 @@
+/* Copyright (c) 2010 Lars Nordin <Lars.Nordin@SDlabs.se>
+ * Copyright (C) 2010 Simon Josefsson <simon@josefsson.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+static int _libssh2_initialized = 0;
+static int _libssh2_init_flags = 0;
+
+LIBSSH2_API int
+libssh2_init(int flags)
+{
+    if (_libssh2_initialized == 0 && !(flags & LIBSSH2_INIT_NO_CRYPTO)) {
+        libssh2_crypto_init();
+        _libssh2_init_aes_ctr();
+    }
+
+    _libssh2_initialized++;
+    _libssh2_init_flags |= flags;
+
+    return 0;
+}
+
+LIBSSH2_API void
+libssh2_exit(void)
+{
+    if (_libssh2_initialized == 0)
+        return;
+
+    _libssh2_initialized--;
+
+    if (!(_libssh2_init_flags & LIBSSH2_INIT_NO_CRYPTO)) {
+        libssh2_crypto_exit();
+    }
+
+    return;
+}
+
+void
+_libssh2_init_if_needed(void)
+{
+    if (_libssh2_initialized == 0)
+        (void)libssh2_init (0);
+}
diff --git a/pgadmin/libssh2/hostkey.c b/pgadmin/libssh2/hostkey.c
new file mode 100644
index 0000000..753563d
--- /dev/null
+++ b/pgadmin/libssh2/hostkey.c
@@ -0,0 +1,487 @@
+/* Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "misc.h"
+
+/* Needed for struct iovec on some platforms */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#if LIBSSH2_RSA
+/* ***********
+ * ssh-rsa *
+ *********** */
+
+static int hostkey_method_ssh_rsa_dtor(LIBSSH2_SESSION * session,
+                                       void **abstract);
+
+/*
+ * hostkey_method_ssh_rsa_init
+ *
+ * Initialize the server hostkey working area with e/n pair
+ */
+static int
+hostkey_method_ssh_rsa_init(LIBSSH2_SESSION * session,
+                            const unsigned char *hostkey_data,
+                            size_t hostkey_data_len,
+                            void **abstract)
+{
+    libssh2_rsa_ctx *rsactx;
+    const unsigned char *s, *e, *n;
+    unsigned long len, e_len, n_len;
+
+    (void) hostkey_data_len;
+
+    if (*abstract) {
+        hostkey_method_ssh_rsa_dtor(session, abstract);
+        *abstract = NULL;
+    }
+
+    s = hostkey_data;
+    len = _libssh2_ntohu32(s);
+    s += 4;
+
+    if (len != 7 || strncmp((char *) s, "ssh-rsa", 7) != 0) {
+        return -1;
+    }
+    s += 7;
+
+    e_len = _libssh2_ntohu32(s);
+    s += 4;
+
+    e = s;
+    s += e_len;
+    n_len = _libssh2_ntohu32(s);
+    s += 4;
+    n = s;
+
+    if (_libssh2_rsa_new(&rsactx, e, e_len, n, n_len, NULL, 0,
+                         NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0))
+        return -1;
+
+    *abstract = rsactx;
+
+    return 0;
+}
+
+/*
+ * hostkey_method_ssh_rsa_initPEM
+ *
+ * Load a Private Key from a PEM file
+ */
+static int
+hostkey_method_ssh_rsa_initPEM(LIBSSH2_SESSION * session,
+                               const char *privkeyfile,
+                               unsigned const char *passphrase,
+                               void **abstract)
+{
+    libssh2_rsa_ctx *rsactx;
+    int ret;
+
+    if (*abstract) {
+        hostkey_method_ssh_rsa_dtor(session, abstract);
+        *abstract = NULL;
+    }
+
+    ret = _libssh2_rsa_new_private(&rsactx, session, privkeyfile, passphrase);
+    if (ret) {
+        return -1;
+    }
+
+    *abstract = rsactx;
+
+    return 0;
+}
+
+/*
+ * hostkey_method_ssh_rsa_sign
+ *
+ * Verify signature created by remote
+ */
+static int
+hostkey_method_ssh_rsa_sig_verify(LIBSSH2_SESSION * session,
+                                  const unsigned char *sig,
+                                  size_t sig_len,
+                                  const unsigned char *m,
+                                  size_t m_len, void **abstract)
+{
+    libssh2_rsa_ctx *rsactx = (libssh2_rsa_ctx *) (*abstract);
+    (void) session;
+
+    /* Skip past keyname_len(4) + keyname(7){"ssh-rsa"} + signature_len(4) */
+    sig += 15;
+    sig_len -= 15;
+    return _libssh2_rsa_sha1_verify(rsactx, sig, sig_len, m, m_len);
+}
+
+/*
+ * hostkey_method_ssh_rsa_signv
+ *
+ * Construct a signature from an array of vectors
+ */
+static int
+hostkey_method_ssh_rsa_signv(LIBSSH2_SESSION * session,
+                             unsigned char **signature,
+                             size_t *signature_len,
+                             int veccount,
+                             const struct iovec datavec[],
+                             void **abstract)
+{
+    libssh2_rsa_ctx *rsactx = (libssh2_rsa_ctx *) (*abstract);
+    int ret;
+    int i;
+    unsigned char hash[SHA_DIGEST_LENGTH];
+    libssh2_sha1_ctx ctx;
+
+    libssh2_sha1_init(&ctx);
+    for(i = 0; i < veccount; i++) {
+        libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
+    }
+    libssh2_sha1_final(ctx, hash);
+
+    ret = _libssh2_rsa_sha1_sign(session, rsactx, hash, SHA_DIGEST_LENGTH,
+                                 signature, signature_len);
+    if (ret) {
+        return -1;
+    }
+
+    return 0;
+}
+
+/*
+ * hostkey_method_ssh_rsa_dtor
+ *
+ * Shutdown the hostkey
+ */
+static int
+hostkey_method_ssh_rsa_dtor(LIBSSH2_SESSION * session, void **abstract)
+{
+    libssh2_rsa_ctx *rsactx = (libssh2_rsa_ctx *) (*abstract);
+    (void) session;
+
+    _libssh2_rsa_free(rsactx);
+
+    *abstract = NULL;
+
+    return 0;
+}
+
+static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_rsa = {
+    "ssh-rsa",
+    MD5_DIGEST_LENGTH,
+    hostkey_method_ssh_rsa_init,
+    hostkey_method_ssh_rsa_initPEM,
+    hostkey_method_ssh_rsa_sig_verify,
+    hostkey_method_ssh_rsa_signv,
+    NULL,                       /* encrypt */
+    hostkey_method_ssh_rsa_dtor,
+};
+#endif /* LIBSSH2_RSA */
+
+#if LIBSSH2_DSA
+/* ***********
+ * ssh-dss *
+ *********** */
+
+static int hostkey_method_ssh_dss_dtor(LIBSSH2_SESSION * session,
+                                       void **abstract);
+
+/*
+ * hostkey_method_ssh_dss_init
+ *
+ * Initialize the server hostkey working area with p/q/g/y set
+ */
+static int
+hostkey_method_ssh_dss_init(LIBSSH2_SESSION * session,
+                            const unsigned char *hostkey_data,
+                            size_t hostkey_data_len,
+                            void **abstract)
+{
+    libssh2_dsa_ctx *dsactx;
+    const unsigned char *p, *q, *g, *y, *s;
+    unsigned long p_len, q_len, g_len, y_len, len;
+    (void) hostkey_data_len;
+
+    if (*abstract) {
+        hostkey_method_ssh_dss_dtor(session, abstract);
+        *abstract = NULL;
+    }
+
+    s = hostkey_data;
+    len = _libssh2_ntohu32(s);
+    s += 4;
+    if (len != 7 || strncmp((char *) s, "ssh-dss", 7) != 0) {
+        return -1;
+    }
+    s += 7;
+
+    p_len = _libssh2_ntohu32(s);
+    s += 4;
+    p = s;
+    s += p_len;
+    q_len = _libssh2_ntohu32(s);
+    s += 4;
+    q = s;
+    s += q_len;
+    g_len = _libssh2_ntohu32(s);
+    s += 4;
+    g = s;
+    s += g_len;
+    y_len = _libssh2_ntohu32(s);
+    s += 4;
+    y = s;
+    /* s += y_len; */
+
+    _libssh2_dsa_new(&dsactx, p, p_len, q, q_len, g, g_len, y, y_len, NULL, 0);
+
+    *abstract = dsactx;
+
+    return 0;
+}
+
+/*
+ * hostkey_method_ssh_dss_initPEM
+ *
+ * Load a Private Key from a PEM file
+ */
+static int
+hostkey_method_ssh_dss_initPEM(LIBSSH2_SESSION * session,
+                               const char *privkeyfile,
+                               unsigned const char *passphrase,
+                               void **abstract)
+{
+    libssh2_dsa_ctx *dsactx;
+    int ret;
+
+    if (*abstract) {
+        hostkey_method_ssh_dss_dtor(session, abstract);
+        *abstract = NULL;
+    }
+
+    ret = _libssh2_dsa_new_private(&dsactx, session, privkeyfile, passphrase);
+    if (ret) {
+        return -1;
+    }
+
+    *abstract = dsactx;
+
+    return 0;
+}
+
+/*
+ * libssh2_hostkey_method_ssh_dss_sign
+ *
+ * Verify signature created by remote
+ */
+static int
+hostkey_method_ssh_dss_sig_verify(LIBSSH2_SESSION * session,
+                                  const unsigned char *sig,
+                                  size_t sig_len,
+                                  const unsigned char *m,
+                                  size_t m_len, void **abstract)
+{
+    libssh2_dsa_ctx *dsactx = (libssh2_dsa_ctx *) (*abstract);
+
+    /* Skip past keyname_len(4) + keyname(7){"ssh-dss"} + signature_len(4) */
+    sig += 15;
+    sig_len -= 15;
+    if (sig_len != 40) {
+        return _libssh2_error(session, LIBSSH2_ERROR_PROTO,
+                              "Invalid DSS signature length");
+    }
+    return _libssh2_dsa_sha1_verify(dsactx, sig, m, m_len);
+}
+
+/*
+ * hostkey_method_ssh_dss_signv
+ *
+ * Construct a signature from an array of vectors
+ */
+static int
+hostkey_method_ssh_dss_signv(LIBSSH2_SESSION * session,
+                             unsigned char **signature,
+                             size_t *signature_len,
+                             int veccount,
+                             const struct iovec datavec[],
+                             void **abstract)
+{
+    libssh2_dsa_ctx *dsactx = (libssh2_dsa_ctx *) (*abstract);
+    unsigned char hash[SHA_DIGEST_LENGTH];
+    libssh2_sha1_ctx ctx;
+    int i;
+
+    *signature = LIBSSH2_ALLOC(session, 2 * SHA_DIGEST_LENGTH);
+    if (!*signature) {
+        return -1;
+    }
+
+    *signature_len = 2 * SHA_DIGEST_LENGTH;
+    memset(*signature, 0, 2 * SHA_DIGEST_LENGTH);
+
+    libssh2_sha1_init(&ctx);
+    for(i = 0; i < veccount; i++) {
+        libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
+    }
+    libssh2_sha1_final(ctx, hash);
+
+    if (_libssh2_dsa_sha1_sign(dsactx, hash, SHA_DIGEST_LENGTH, *signature)) {
+        LIBSSH2_FREE(session, *signature);
+        return -1;
+    }
+
+    return 0;
+}
+
+/*
+ * libssh2_hostkey_method_ssh_dss_dtor
+ *
+ * Shutdown the hostkey method
+ */
+static int
+hostkey_method_ssh_dss_dtor(LIBSSH2_SESSION * session, void **abstract)
+{
+    libssh2_dsa_ctx *dsactx = (libssh2_dsa_ctx *) (*abstract);
+    (void) session;
+
+    _libssh2_dsa_free(dsactx);
+
+    *abstract = NULL;
+
+    return 0;
+}
+
+static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_dss = {
+    "ssh-dss",
+    MD5_DIGEST_LENGTH,
+    hostkey_method_ssh_dss_init,
+    hostkey_method_ssh_dss_initPEM,
+    hostkey_method_ssh_dss_sig_verify,
+    hostkey_method_ssh_dss_signv,
+    NULL,                       /* encrypt */
+    hostkey_method_ssh_dss_dtor,
+};
+#endif /* LIBSSH2_DSA */
+
+static const LIBSSH2_HOSTKEY_METHOD *hostkey_methods[] = {
+#if LIBSSH2_RSA
+    &hostkey_method_ssh_rsa,
+#endif /* LIBSSH2_RSA */
+#if LIBSSH2_DSA
+    &hostkey_method_ssh_dss,
+#endif /* LIBSSH2_DSA */
+    NULL
+};
+
+const LIBSSH2_HOSTKEY_METHOD **
+libssh2_hostkey_methods(void)
+{
+    return hostkey_methods;
+}
+
+/*
+ * libssh2_hostkey_hash
+ *
+ * Returns hash signature
+ * Returned buffer should NOT be freed
+ * Length of buffer is determined by hash type
+ * i.e. MD5 == 16, SHA1 == 20
+ */
+LIBSSH2_API const char *
+libssh2_hostkey_hash(LIBSSH2_SESSION * session, int hash_type)
+{
+    switch (hash_type) {
+#if LIBSSH2_MD5
+    case LIBSSH2_HOSTKEY_HASH_MD5:
+        return (session->server_hostkey_md5_valid)
+          ? (char *) session->server_hostkey_md5
+          : NULL;
+        break;
+#endif /* LIBSSH2_MD5 */
+    case LIBSSH2_HOSTKEY_HASH_SHA1:
+        return (char *) session->server_hostkey_sha1;
+        break;
+    default:
+        return NULL;
+    }
+}
+
+static int hostkey_type(const unsigned char *hostkey, size_t len)
+{
+    const unsigned char rsa[] = {
+        0, 0, 0, 0x07, 's', 's', 'h', '-', 'r', 's', 'a'
+    };
+    const unsigned char dss[] = {
+        0, 0, 0, 0x07, 's', 's', 'h', '-', 'd', 's', 's'
+    };
+
+    if (len < 11)
+        return LIBSSH2_HOSTKEY_TYPE_UNKNOWN;
+
+    if (!memcmp(rsa, hostkey, 11))
+        return LIBSSH2_HOSTKEY_TYPE_RSA;
+
+    if (!memcmp(dss, hostkey, 11))
+        return LIBSSH2_HOSTKEY_TYPE_DSS;
+
+    return LIBSSH2_HOSTKEY_TYPE_UNKNOWN;
+}
+
+/*
+ * libssh2_session_hostkey()
+ *
+ * Returns the server key and length.
+ *
+ */
+LIBSSH2_API const char *
+libssh2_session_hostkey(LIBSSH2_SESSION *session, size_t *len, int *type)
+{
+    if(session->server_hostkey_len) {
+        if(len)
+            *len = session->server_hostkey_len;
+        if (type)
+            *type = hostkey_type(session->server_hostkey,
+                                 session->server_hostkey_len);
+        return (char *) session->server_hostkey;
+    }
+    if(len)
+        *len = 0;
+    return NULL;
+}
+
diff --git a/pgadmin/libssh2/keepalive.c b/pgadmin/libssh2/keepalive.c
new file mode 100644
index 0000000..260206a
--- /dev/null
+++ b/pgadmin/libssh2/keepalive.c
@@ -0,0 +1,98 @@
+/* Copyright (C) 2010  Simon Josefsson
+ * Author: Simon Josefsson
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+#include "libssh2_priv.h"
+#include "transport.h" /* _libssh2_transport_write */
+
+/* Keep-alive stuff. */
+
+LIBSSH2_API void
+libssh2_keepalive_config (LIBSSH2_SESSION *session,
+                          int want_reply,
+                          unsigned interval)
+{
+    if (interval == 1)
+        session->keepalive_interval = 2;
+    else
+        session->keepalive_interval = interval;
+    session->keepalive_want_reply = want_reply ? 1 : 0;
+}
+
+LIBSSH2_API int
+libssh2_keepalive_send (LIBSSH2_SESSION *session,
+                        int *seconds_to_next)
+{
+    time_t now;
+
+    if (!session->keepalive_interval) {
+        if (seconds_to_next)
+            *seconds_to_next = 0;
+        return 0;
+    }
+
+    now = time (NULL);
+
+    if (session->keepalive_last_sent + session->keepalive_interval <= now) {
+        /* Format is
+           "SSH_MSG_GLOBAL_REQUEST || 4-byte len || str || want-reply". */
+        unsigned char keepalive_data[]
+            = "\x50\x00\x00\x00\x15keepalive@libssh2.orgW";
+        size_t len = sizeof (keepalive_data) - 1;
+        int rc;
+
+        keepalive_data[len - 1] = session->keepalive_want_reply;
+
+        rc = _libssh2_transport_send(session, keepalive_data, len, NULL, 0);
+        /* Silently ignore PACKET_EAGAIN here: if the write buffer is
+           already full, sending another keepalive is not useful. */
+        if (rc && rc != LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send keepalive message");
+            return rc;
+        }
+
+        session->keepalive_last_sent = now;
+        if (seconds_to_next)
+            *seconds_to_next = session->keepalive_interval;
+    } else if (seconds_to_next) {
+        *seconds_to_next = (int) session->keepalive_last_sent
+            + session->keepalive_interval - now;
+    }
+
+    return 0;
+}
diff --git a/pgadmin/libssh2/kex.c b/pgadmin/libssh2/kex.c
new file mode 100644
index 0000000..07e717f
--- /dev/null
+++ b/pgadmin/libssh2/kex.c
@@ -0,0 +1,2013 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2010, Daniel Stenberg <daniel@haxx.se>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#include "transport.h"
+#include "comp.h"
+#include "mac.h"
+
+/* TODO: Switch this to an inline and handle alloc() failures */
+/* Helper macro called from kex_method_diffie_hellman_group1_sha1_key_exchange */
+#define LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(value, reqlen, version) \
+    {                                                                   \
+        libssh2_sha1_ctx hash;                                          \
+        unsigned long len = 0;                                          \
+        if (!(value)) {                                                 \
+            value = LIBSSH2_ALLOC(session, reqlen + SHA_DIGEST_LENGTH); \
+        }                                                               \
+        if (value)                                                      \
+            while (len < (unsigned long)reqlen) {                       \
+                libssh2_sha1_init(&hash);                               \
+                libssh2_sha1_update(hash, exchange_state->k_value,      \
+                                    exchange_state->k_value_len);       \
+                libssh2_sha1_update(hash, exchange_state->h_sig_comp,   \
+                                    SHA_DIGEST_LENGTH);                 \
+                if (len > 0) {                                          \
+                    libssh2_sha1_update(hash, value, len);              \
+                }    else {                                             \
+                    libssh2_sha1_update(hash, (version), 1);            \
+                    libssh2_sha1_update(hash, session->session_id,      \
+                                        session->session_id_len);       \
+                }                                                       \
+                libssh2_sha1_final(hash, (value) + len);                \
+                len += SHA_DIGEST_LENGTH;                               \
+            }                                                           \
+    }
+
+/*
+ * diffie_hellman_sha1
+ *
+ * Diffie Hellman Key Exchange, Group Agnostic
+ */
+static int diffie_hellman_sha1(LIBSSH2_SESSION *session,
+                               _libssh2_bn *g,
+                               _libssh2_bn *p,
+                               int group_order,
+                               unsigned char packet_type_init,
+                               unsigned char packet_type_reply,
+                               unsigned char *midhash,
+                               unsigned long midhash_len,
+                               kmdhgGPsha1kex_state_t *exchange_state)
+{
+    int ret = 0;
+    int rc;
+
+    if (exchange_state->state == libssh2_NB_state_idle) {
+        /* Setup initial values */
+        exchange_state->e_packet = NULL;
+        exchange_state->s_packet = NULL;
+        exchange_state->k_value = NULL;
+        exchange_state->ctx = _libssh2_bn_ctx_new();
+        exchange_state->x = _libssh2_bn_init(); /* Random from client */
+        exchange_state->e = _libssh2_bn_init(); /* g^x mod p */
+        exchange_state->f = _libssh2_bn_init(); /* g^(Random from server) mod p */
+        exchange_state->k = _libssh2_bn_init(); /* The shared secret: f^x mod p */
+
+        /* Zero the whole thing out */
+        memset(&exchange_state->req_state, 0, sizeof(packet_require_state_t));
+
+        /* Generate x and e */
+        _libssh2_bn_rand(exchange_state->x, group_order, 0, -1);
+        _libssh2_bn_mod_exp(exchange_state->e, g, exchange_state->x, p,
+                            exchange_state->ctx);
+
+        /* Send KEX init */
+        /* packet_type(1) + String Length(4) + leading 0(1) */
+        exchange_state->e_packet_len =
+            _libssh2_bn_bytes(exchange_state->e) + 6;
+        if (_libssh2_bn_bits(exchange_state->e) % 8) {
+            /* Leading 00 not needed */
+            exchange_state->e_packet_len--;
+        }
+
+        exchange_state->e_packet =
+            LIBSSH2_ALLOC(session, exchange_state->e_packet_len);
+        if (!exchange_state->e_packet) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                 "Out of memory error");
+            goto clean_exit;
+        }
+        exchange_state->e_packet[0] = packet_type_init;
+        _libssh2_htonu32(exchange_state->e_packet + 1,
+                         exchange_state->e_packet_len - 5);
+        if (_libssh2_bn_bits(exchange_state->e) % 8) {
+            _libssh2_bn_to_bin(exchange_state->e,
+                               exchange_state->e_packet + 5);
+        } else {
+            exchange_state->e_packet[5] = 0;
+            _libssh2_bn_to_bin(exchange_state->e,
+                               exchange_state->e_packet + 6);
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sending KEX packet %d",
+                       (int) packet_type_init);
+        exchange_state->state = libssh2_NB_state_created;
+    }
+
+    if (exchange_state->state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, exchange_state->e_packet,
+                                     exchange_state->e_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            ret = _libssh2_error(session, rc,
+                                 "Unable to send KEX init message");
+            goto clean_exit;
+        }
+        exchange_state->state = libssh2_NB_state_sent;
+    }
+
+    if (exchange_state->state == libssh2_NB_state_sent) {
+        if (session->burn_optimistic_kexinit) {
+            /* The first KEX packet to come along will be the guess initially
+             * sent by the server.  That guess turned out to be wrong so we
+             * need to silently ignore it */
+            int burn_type;
+
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                           "Waiting for badly guessed KEX packet (to be ignored)");
+            burn_type =
+                _libssh2_packet_burn(session, &exchange_state->burn_state);
+            if (burn_type == LIBSSH2_ERROR_EAGAIN) {
+                return burn_type;
+            } else if (burn_type <= 0) {
+                /* Failed to receive a packet */
+                ret = burn_type;
+                goto clean_exit;
+            }
+            session->burn_optimistic_kexinit = 0;
+
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                           "Burnt packet of type: %02x",
+                           (unsigned int) burn_type);
+        }
+
+        exchange_state->state = libssh2_NB_state_sent1;
+    }
+
+    if (exchange_state->state == libssh2_NB_state_sent1) {
+        /* Wait for KEX reply */
+        rc = _libssh2_packet_require(session, packet_type_reply,
+                                     &exchange_state->s_packet,
+                                     &exchange_state->s_packet_len, 0, NULL,
+                                     0, &exchange_state->req_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        }
+        if (rc) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
+                                 "Timed out waiting for KEX reply");
+            goto clean_exit;
+        }
+
+        /* Parse KEXDH_REPLY */
+        exchange_state->s = exchange_state->s_packet + 1;
+
+        session->server_hostkey_len = _libssh2_ntohu32(exchange_state->s);
+        exchange_state->s += 4;
+        session->server_hostkey =
+            LIBSSH2_ALLOC(session, session->server_hostkey_len);
+        if (!session->server_hostkey) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                 "Unable to allocate memory for a copy "
+                                 "of the host key");
+            goto clean_exit;
+        }
+        memcpy(session->server_hostkey, exchange_state->s,
+               session->server_hostkey_len);
+        exchange_state->s += session->server_hostkey_len;
+
+#if LIBSSH2_MD5
+        {
+            libssh2_md5_ctx fingerprint_ctx;
+
+            if (libssh2_md5_init(&fingerprint_ctx)) {
+                libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
+                                   session->server_hostkey_len);
+                libssh2_md5_final(fingerprint_ctx, session->server_hostkey_md5);
+                session->server_hostkey_md5_valid = TRUE;
+            }
+            else {
+                session->server_hostkey_md5_valid = FALSE;
+            }
+        }
+#ifdef LIBSSH2DEBUG
+        {
+            char fingerprint[50], *fprint = fingerprint;
+            int i;
+            for(i = 0; i < 16; i++, fprint += 3) {
+                snprintf(fprint, 4, "%02x:", session->server_hostkey_md5[i]);
+            }
+            *(--fprint) = '\0';
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                           "Server's MD5 Fingerprint: %s", fingerprint);
+        }
+#endif /* LIBSSH2DEBUG */
+#endif /* ! LIBSSH2_MD5 */
+
+        {
+            libssh2_sha1_ctx fingerprint_ctx;
+
+            libssh2_sha1_init(&fingerprint_ctx);
+            libssh2_sha1_update(fingerprint_ctx, session->server_hostkey,
+                                session->server_hostkey_len);
+            libssh2_sha1_final(fingerprint_ctx, session->server_hostkey_sha1);
+        }
+#ifdef LIBSSH2DEBUG
+        {
+            char fingerprint[64], *fprint = fingerprint;
+            int i;
+
+            for(i = 0; i < 20; i++, fprint += 3) {
+                snprintf(fprint, 4, "%02x:", session->server_hostkey_sha1[i]);
+            }
+            *(--fprint) = '\0';
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                           "Server's SHA1 Fingerprint: %s", fingerprint);
+        }
+#endif /* LIBSSH2DEBUG */
+
+        if (session->hostkey->init(session, session->server_hostkey,
+                                   session->server_hostkey_len,
+                                   &session->server_hostkey_abstract)) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_HOSTKEY_INIT,
+                                 "Unable to initialize hostkey importer");
+            goto clean_exit;
+        }
+
+        exchange_state->f_value_len = _libssh2_ntohu32(exchange_state->s);
+        exchange_state->s += 4;
+        exchange_state->f_value = exchange_state->s;
+        exchange_state->s += exchange_state->f_value_len;
+        _libssh2_bn_from_bin(exchange_state->f, exchange_state->f_value_len,
+                             exchange_state->f_value);
+
+        exchange_state->h_sig_len = _libssh2_ntohu32(exchange_state->s);
+        exchange_state->s += 4;
+        exchange_state->h_sig = exchange_state->s;
+
+        /* Compute the shared secret */
+        _libssh2_bn_mod_exp(exchange_state->k, exchange_state->f,
+                            exchange_state->x, p, exchange_state->ctx);
+        exchange_state->k_value_len = _libssh2_bn_bytes(exchange_state->k) + 5;
+        if (_libssh2_bn_bits(exchange_state->k) % 8) {
+            /* don't need leading 00 */
+            exchange_state->k_value_len--;
+        }
+        exchange_state->k_value =
+            LIBSSH2_ALLOC(session, exchange_state->k_value_len);
+        if (!exchange_state->k_value) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                 "Unable to allocate buffer for K");
+            goto clean_exit;
+        }
+        _libssh2_htonu32(exchange_state->k_value,
+                         exchange_state->k_value_len - 4);
+        if (_libssh2_bn_bits(exchange_state->k) % 8) {
+            _libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 4);
+        } else {
+            exchange_state->k_value[4] = 0;
+            _libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 5);
+        }
+
+        libssh2_sha1_init(&exchange_state->exchange_hash);
+        if (session->local.banner) {
+            _libssh2_htonu32(exchange_state->h_sig_comp,
+                             strlen((char *) session->local.banner) - 2);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                exchange_state->h_sig_comp, 4);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                (char *) session->local.banner,
+                                strlen((char *) session->local.banner) - 2);
+        } else {
+            _libssh2_htonu32(exchange_state->h_sig_comp,
+                             sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                exchange_state->h_sig_comp, 4);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                LIBSSH2_SSH_DEFAULT_BANNER,
+                                sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
+        }
+
+        _libssh2_htonu32(exchange_state->h_sig_comp,
+                         strlen((char *) session->remote.banner));
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->h_sig_comp, 4);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            session->remote.banner,
+                            strlen((char *) session->remote.banner));
+
+        _libssh2_htonu32(exchange_state->h_sig_comp,
+                         session->local.kexinit_len);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->h_sig_comp, 4);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            session->local.kexinit,
+                            session->local.kexinit_len);
+
+        _libssh2_htonu32(exchange_state->h_sig_comp,
+                         session->remote.kexinit_len);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->h_sig_comp, 4);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            session->remote.kexinit,
+                            session->remote.kexinit_len);
+
+        _libssh2_htonu32(exchange_state->h_sig_comp,
+                         session->server_hostkey_len);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->h_sig_comp, 4);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            session->server_hostkey,
+                            session->server_hostkey_len);
+
+        if (packet_type_init == SSH_MSG_KEX_DH_GEX_INIT) {
+            /* diffie-hellman-group-exchange hashes additional fields */
+#ifdef LIBSSH2_DH_GEX_NEW
+            _libssh2_htonu32(exchange_state->h_sig_comp,
+                             LIBSSH2_DH_GEX_MINGROUP);
+            _libssh2_htonu32(exchange_state->h_sig_comp + 4,
+                             LIBSSH2_DH_GEX_OPTGROUP);
+            _libssh2_htonu32(exchange_state->h_sig_comp + 8,
+                             LIBSSH2_DH_GEX_MAXGROUP);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                exchange_state->h_sig_comp, 12);
+#else
+            _libssh2_htonu32(exchange_state->h_sig_comp,
+                             LIBSSH2_DH_GEX_OPTGROUP);
+            libssh2_sha1_update(exchange_state->exchange_hash,
+                                exchange_state->h_sig_comp, 4);
+#endif
+        }
+
+        if (midhash) {
+            libssh2_sha1_update(exchange_state->exchange_hash, midhash,
+                                midhash_len);
+        }
+
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->e_packet + 1,
+                            exchange_state->e_packet_len - 1);
+
+        _libssh2_htonu32(exchange_state->h_sig_comp,
+                         exchange_state->f_value_len);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->h_sig_comp, 4);
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->f_value,
+                            exchange_state->f_value_len);
+
+        libssh2_sha1_update(exchange_state->exchange_hash,
+                            exchange_state->k_value,
+                            exchange_state->k_value_len);
+
+        libssh2_sha1_final(exchange_state->exchange_hash,
+                           exchange_state->h_sig_comp);
+
+        if (session->hostkey->
+            sig_verify(session, exchange_state->h_sig,
+                       exchange_state->h_sig_len, exchange_state->h_sig_comp,
+                       20, &session->server_hostkey_abstract)) {
+            ret = _libssh2_error(session, LIBSSH2_ERROR_HOSTKEY_SIGN,
+                                 "Unable to verify hostkey signature");
+            goto clean_exit;
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sending NEWKEYS message");
+        exchange_state->c = SSH_MSG_NEWKEYS;
+
+        exchange_state->state = libssh2_NB_state_sent2;
+    }
+
+    if (exchange_state->state == libssh2_NB_state_sent2) {
+        rc = _libssh2_transport_send(session, &exchange_state->c, 1, NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            ret = _libssh2_error(session, rc, "Unable to send NEWKEYS message");
+            goto clean_exit;
+        }
+
+        exchange_state->state = libssh2_NB_state_sent3;
+    }
+
+    if (exchange_state->state == libssh2_NB_state_sent3) {
+        rc = _libssh2_packet_require(session, SSH_MSG_NEWKEYS,
+                                     &exchange_state->tmp,
+                                     &exchange_state->tmp_len, 0, NULL, 0,
+                                     &exchange_state->req_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            ret = _libssh2_error(session, rc, "Timed out waiting for NEWKEYS");
+            goto clean_exit;
+        }
+        /* The first key exchange has been performed,
+           switch to active crypt/comp/mac mode */
+        session->state |= LIBSSH2_STATE_NEWKEYS;
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Received NEWKEYS message");
+
+        /* This will actually end up being just packet_type(1)
+           for this packet type anyway */
+        LIBSSH2_FREE(session, exchange_state->tmp);
+
+        if (!session->session_id) {
+            session->session_id = LIBSSH2_ALLOC(session, SHA_DIGEST_LENGTH);
+            if (!session->session_id) {
+                ret = _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                     "Unable to allocate buffer for SHA digest");
+                goto clean_exit;
+            }
+            memcpy(session->session_id, exchange_state->h_sig_comp,
+                   SHA_DIGEST_LENGTH);
+            session->session_id_len = SHA_DIGEST_LENGTH;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "session_id calculated");
+        }
+
+        /* Cleanup any existing cipher */
+        if (session->local.crypt->dtor) {
+            session->local.crypt->dtor(session,
+                                       &session->local.crypt_abstract);
+        }
+
+        /* Calculate IV/Secret/Key for each direction */
+        if (session->local.crypt->init) {
+            unsigned char *iv = NULL, *secret = NULL;
+            int free_iv = 0, free_secret = 0;
+
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(iv,
+                                                        session->local.crypt->
+                                                        iv_len, "A");
+            if (!iv) {
+                ret = -1;
+                goto clean_exit;
+            }
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(secret,
+                                                        session->local.crypt->
+                                                        secret_len, "C");
+            if (!secret) {
+                LIBSSH2_FREE(session, iv);
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+            if (session->local.crypt->
+                init(session, session->local.crypt, iv, &free_iv, secret,
+                     &free_secret, 1, &session->local.crypt_abstract)) {
+                LIBSSH2_FREE(session, iv);
+                LIBSSH2_FREE(session, secret);
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+
+            if (free_iv) {
+                memset(iv, 0, session->local.crypt->iv_len);
+                LIBSSH2_FREE(session, iv);
+            }
+
+            if (free_secret) {
+                memset(secret, 0, session->local.crypt->secret_len);
+                LIBSSH2_FREE(session, secret);
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Client to Server IV and Key calculated");
+
+        if (session->remote.crypt->dtor) {
+            /* Cleanup any existing cipher */
+            session->remote.crypt->dtor(session,
+                                        &session->remote.crypt_abstract);
+        }
+
+        if (session->remote.crypt->init) {
+            unsigned char *iv = NULL, *secret = NULL;
+            int free_iv = 0, free_secret = 0;
+
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(iv,
+                                                        session->remote.crypt->
+                                                        iv_len, "B");
+            if (!iv) {
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(secret,
+                                                        session->remote.crypt->
+                                                        secret_len, "D");
+            if (!secret) {
+                LIBSSH2_FREE(session, iv);
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+            if (session->remote.crypt->
+                init(session, session->remote.crypt, iv, &free_iv, secret,
+                     &free_secret, 0, &session->remote.crypt_abstract)) {
+                LIBSSH2_FREE(session, iv);
+                LIBSSH2_FREE(session, secret);
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+
+            if (free_iv) {
+                memset(iv, 0, session->remote.crypt->iv_len);
+                LIBSSH2_FREE(session, iv);
+            }
+
+            if (free_secret) {
+                memset(secret, 0, session->remote.crypt->secret_len);
+                LIBSSH2_FREE(session, secret);
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Server to Client IV and Key calculated");
+
+        if (session->local.mac->dtor) {
+            session->local.mac->dtor(session, &session->local.mac_abstract);
+        }
+
+        if (session->local.mac->init) {
+            unsigned char *key = NULL;
+            int free_key = 0;
+
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(key,
+                                                        session->local.mac->
+                                                        key_len, "E");
+            if (!key) {
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+            session->local.mac->init(session, key, &free_key,
+                                     &session->local.mac_abstract);
+
+            if (free_key) {
+                memset(key, 0, session->local.mac->key_len);
+                LIBSSH2_FREE(session, key);
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Client to Server HMAC Key calculated");
+
+        if (session->remote.mac->dtor) {
+            session->remote.mac->dtor(session, &session->remote.mac_abstract);
+        }
+
+        if (session->remote.mac->init) {
+            unsigned char *key = NULL;
+            int free_key = 0;
+
+            LIBSSH2_KEX_METHOD_DIFFIE_HELLMAN_SHA1_HASH(key,
+                                                        session->remote.mac->
+                                                        key_len, "F");
+            if (!key) {
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+            session->remote.mac->init(session, key, &free_key,
+                                      &session->remote.mac_abstract);
+
+            if (free_key) {
+                memset(key, 0, session->remote.mac->key_len);
+                LIBSSH2_FREE(session, key);
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Server to Client HMAC Key calculated");
+
+        /* Initialize compression for each direction */
+
+        /* Cleanup any existing compression */
+        if (session->local.comp && session->local.comp->dtor) {
+            session->local.comp->dtor(session, 1,
+                                      &session->local.comp_abstract);
+        }
+
+        if (session->local.comp && session->local.comp->init) {
+            if (session->local.comp->init(session, 1,
+                                          &session->local.comp_abstract)) {
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Client to Server compression initialized");
+
+        if (session->remote.comp && session->remote.comp->dtor) {
+            session->remote.comp->dtor(session, 0,
+                                       &session->remote.comp_abstract);
+        }
+
+        if (session->remote.comp && session->remote.comp->init) {
+            if (session->remote.comp->init(session, 0,
+                                           &session->remote.comp_abstract)) {
+                ret = LIBSSH2_ERROR_KEX_FAILURE;
+                goto clean_exit;
+            }
+        }
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Server to Client compression initialized");
+
+    }
+
+  clean_exit:
+    _libssh2_bn_free(exchange_state->x);
+    exchange_state->x = NULL;
+    _libssh2_bn_free(exchange_state->e);
+    exchange_state->e = NULL;
+    _libssh2_bn_free(exchange_state->f);
+    exchange_state->f = NULL;
+    _libssh2_bn_free(exchange_state->k);
+    exchange_state->k = NULL;
+    _libssh2_bn_ctx_free(exchange_state->ctx);
+    exchange_state->ctx = NULL;
+
+    if (exchange_state->e_packet) {
+        LIBSSH2_FREE(session, exchange_state->e_packet);
+        exchange_state->e_packet = NULL;
+    }
+
+    if (exchange_state->s_packet) {
+        LIBSSH2_FREE(session, exchange_state->s_packet);
+        exchange_state->s_packet = NULL;
+    }
+
+    if (exchange_state->k_value) {
+        LIBSSH2_FREE(session, exchange_state->k_value);
+        exchange_state->k_value = NULL;
+    }
+
+    exchange_state->state = libssh2_NB_state_idle;
+
+    return ret;
+}
+
+
+
+/* kex_method_diffie_hellman_group1_sha1_key_exchange
+ * Diffie-Hellman Group1 (Actually Group2) Key Exchange using SHA1
+ */
+static int
+kex_method_diffie_hellman_group1_sha1_key_exchange(LIBSSH2_SESSION *session,
+                                                   key_exchange_state_low_t
+                                                   * key_state)
+{
+    static const unsigned char p_value[128] = {
+        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+        0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34,
+        0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
+        0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74,
+        0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22,
+        0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
+        0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B,
+        0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37,
+        0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45,
+        0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6,
+        0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B,
+        0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED,
+        0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5,
+        0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6,
+        0x49, 0x28, 0x66, 0x51, 0xEC, 0xE6, 0x53, 0x81,
+        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+    };
+
+    int ret;
+
+    if (key_state->state == libssh2_NB_state_idle) {
+        /* g == 2 */
+        key_state->p = _libssh2_bn_init();      /* SSH2 defined value (p_value) */
+        key_state->g = _libssh2_bn_init();      /* SSH2 defined value (2) */
+
+        /* Initialize P and G */
+        _libssh2_bn_set_word(key_state->g, 2);
+        _libssh2_bn_from_bin(key_state->p, 128, p_value);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Initiating Diffie-Hellman Group1 Key Exchange");
+
+        key_state->state = libssh2_NB_state_created;
+    }
+    ret = diffie_hellman_sha1(session, key_state->g, key_state->p, 128,
+                              SSH_MSG_KEXDH_INIT, SSH_MSG_KEXDH_REPLY,
+                              NULL, 0, &key_state->exchange_state);
+    if (ret == LIBSSH2_ERROR_EAGAIN) {
+        return ret;
+    }
+
+    _libssh2_bn_free(key_state->p);
+    key_state->p = NULL;
+    _libssh2_bn_free(key_state->g);
+    key_state->g = NULL;
+    key_state->state = libssh2_NB_state_idle;
+
+    return ret;
+}
+
+
+
+/* kex_method_diffie_hellman_group14_sha1_key_exchange
+ * Diffie-Hellman Group14 Key Exchange using SHA1
+ */
+static int
+kex_method_diffie_hellman_group14_sha1_key_exchange(LIBSSH2_SESSION *session,
+                                                    key_exchange_state_low_t
+                                                    * key_state)
+{
+    static const unsigned char p_value[256] = {
+        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+        0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34,
+        0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
+        0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74,
+        0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22,
+        0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
+        0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B,
+        0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37,
+        0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45,
+        0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6,
+        0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B,
+        0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED,
+        0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5,
+        0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6,
+        0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D,
+        0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05,
+        0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A,
+        0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F,
+        0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96,
+        0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB,
+        0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D,
+        0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04,
+        0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C,
+        0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B,
+        0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03,
+        0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F,
+        0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9,
+        0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18,
+        0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5,
+        0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10,
+        0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68,
+        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+    };
+    int ret;
+
+    if (key_state->state == libssh2_NB_state_idle) {
+        key_state->p = _libssh2_bn_init();      /* SSH2 defined value (p_value) */
+        key_state->g = _libssh2_bn_init();      /* SSH2 defined value (2) */
+
+        /* g == 2 */
+        /* Initialize P and G */
+        _libssh2_bn_set_word(key_state->g, 2);
+        _libssh2_bn_from_bin(key_state->p, 256, p_value);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Initiating Diffie-Hellman Group14 Key Exchange");
+
+        key_state->state = libssh2_NB_state_created;
+    }
+    ret = diffie_hellman_sha1(session, key_state->g, key_state->p,
+                              256, SSH_MSG_KEXDH_INIT, SSH_MSG_KEXDH_REPLY,
+                              NULL, 0, &key_state->exchange_state);
+    if (ret == LIBSSH2_ERROR_EAGAIN) {
+        return ret;
+    }
+
+    key_state->state = libssh2_NB_state_idle;
+    _libssh2_bn_free(key_state->p);
+    key_state->p = NULL;
+    _libssh2_bn_free(key_state->g);
+    key_state->g = NULL;
+
+    return ret;
+}
+
+
+
+/* kex_method_diffie_hellman_group_exchange_sha1_key_exchange
+ * Diffie-Hellman Group Exchange Key Exchange using SHA1
+ * Negotiates random(ish) group for secret derivation
+ */
+static int
+kex_method_diffie_hellman_group_exchange_sha1_key_exchange
+(LIBSSH2_SESSION * session, key_exchange_state_low_t * key_state)
+{
+    unsigned long p_len, g_len;
+    int ret = 0;
+    int rc;
+
+    if (key_state->state == libssh2_NB_state_idle) {
+        key_state->p = _libssh2_bn_init();
+        key_state->g = _libssh2_bn_init();
+        /* Ask for a P and G pair */
+#ifdef LIBSSH2_DH_GEX_NEW
+        key_state->request[0] = SSH_MSG_KEX_DH_GEX_REQUEST;
+        _libssh2_htonu32(key_state->request + 1, LIBSSH2_DH_GEX_MINGROUP);
+        _libssh2_htonu32(key_state->request + 5, LIBSSH2_DH_GEX_OPTGROUP);
+        _libssh2_htonu32(key_state->request + 9, LIBSSH2_DH_GEX_MAXGROUP);
+        key_state->request_len = 13;
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Initiating Diffie-Hellman Group-Exchange (New Method)");
+#else
+        key_state->request[0] = SSH_MSG_KEX_DH_GEX_REQUEST_OLD;
+        _libssh2_htonu32(key_state->request + 1, LIBSSH2_DH_GEX_OPTGROUP);
+        key_state->request_len = 5;
+        _libssh2_debug(session, LIBSSH2_TRACE_KEX,
+                       "Initiating Diffie-Hellman Group-Exchange (Old Method)");
+#endif
+
+        key_state->state = libssh2_NB_state_created;
+    }
+
+    if (key_state->state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, key_state->request,
+                                     key_state->request_len, NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            ret = _libssh2_error(session, rc,
+                                 "Unable to send Group Exchange Request");
+            goto dh_gex_clean_exit;
+        }
+
+        key_state->state = libssh2_NB_state_sent;
+    }
+
+    if (key_state->state == libssh2_NB_state_sent) {
+        rc = _libssh2_packet_require(session, SSH_MSG_KEX_DH_GEX_GROUP,
+                                     &key_state->data, &key_state->data_len,
+                                     0, NULL, 0, &key_state->req_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            ret = _libssh2_error(session, rc,
+                                 "Timeout waiting for GEX_GROUP reply");
+            goto dh_gex_clean_exit;
+        }
+
+        key_state->state = libssh2_NB_state_sent1;
+    }
+
+    if (key_state->state == libssh2_NB_state_sent1) {
+        unsigned char *s = key_state->data + 1;
+        p_len = _libssh2_ntohu32(s);
+        s += 4;
+        _libssh2_bn_from_bin(key_state->p, p_len, s);
+        s += p_len;
+
+        g_len = _libssh2_ntohu32(s);
+        s += 4;
+        _libssh2_bn_from_bin(key_state->g, g_len, s);
+
+        ret = diffie_hellman_sha1(session, key_state->g, key_state->p, p_len,
+                                  SSH_MSG_KEX_DH_GEX_INIT,
+                                  SSH_MSG_KEX_DH_GEX_REPLY,
+                                  key_state->data + 1,
+                                  key_state->data_len - 1,
+                                  &key_state->exchange_state);
+        if (ret == LIBSSH2_ERROR_EAGAIN) {
+            return ret;
+        }
+
+        LIBSSH2_FREE(session, key_state->data);
+    }
+
+  dh_gex_clean_exit:
+    key_state->state = libssh2_NB_state_idle;
+    _libssh2_bn_free(key_state->g);
+    key_state->g = NULL;
+    _libssh2_bn_free(key_state->p);
+    key_state->p = NULL;
+
+    return ret;
+}
+
+
+
+#define LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY     0x0001
+#define LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY    0x0002
+
+static const LIBSSH2_KEX_METHOD kex_method_diffie_helman_group1_sha1 = {
+    "diffie-hellman-group1-sha1",
+    kex_method_diffie_hellman_group1_sha1_key_exchange,
+    LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
+};
+
+static const LIBSSH2_KEX_METHOD kex_method_diffie_helman_group14_sha1 = {
+    "diffie-hellman-group14-sha1",
+    kex_method_diffie_hellman_group14_sha1_key_exchange,
+    LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
+};
+
+static const LIBSSH2_KEX_METHOD
+kex_method_diffie_helman_group_exchange_sha1 = {
+    "diffie-hellman-group-exchange-sha1",
+    kex_method_diffie_hellman_group_exchange_sha1_key_exchange,
+    LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
+};
+
+static const LIBSSH2_KEX_METHOD *libssh2_kex_methods[] = {
+    &kex_method_diffie_helman_group14_sha1,
+    &kex_method_diffie_helman_group_exchange_sha1,
+    &kex_method_diffie_helman_group1_sha1,
+    NULL
+};
+
+typedef struct _LIBSSH2_COMMON_METHOD
+{
+    const char *name;
+} LIBSSH2_COMMON_METHOD;
+
+/* kex_method_strlen
+ * Calculate the length of a particular method list's resulting string
+ * Includes SUM(strlen() of each individual method plus 1 (for coma)) - 1 (because the last coma isn't used)
+ * Another sign of bad coding practices gone mad.  Pretend you don't see this.
+ */
+static size_t
+kex_method_strlen(LIBSSH2_COMMON_METHOD ** method)
+{
+    size_t len = 0;
+
+    if (!method || !*method) {
+        return 0;
+    }
+
+    while (*method && (*method)->name) {
+        len += strlen((*method)->name) + 1;
+        method++;
+    }
+
+    return len - 1;
+}
+
+
+
+/* kex_method_list
+ * Generate formatted preference list in buf
+ */
+static size_t
+kex_method_list(unsigned char *buf, size_t list_strlen,
+                LIBSSH2_COMMON_METHOD ** method)
+{
+    _libssh2_htonu32(buf, list_strlen);
+    buf += 4;
+
+    if (!method || !*method) {
+        return 4;
+    }
+
+    while (*method && (*method)->name) {
+        int mlen = strlen((*method)->name);
+        memcpy(buf, (*method)->name, mlen);
+        buf += mlen;
+        *(buf++) = ',';
+        method++;
+    }
+
+    return list_strlen + 4;
+}
+
+
+
+#define LIBSSH2_METHOD_PREFS_LEN(prefvar, defaultvar)           \
+    ((prefvar) ? strlen(prefvar) :                              \
+     kex_method_strlen((LIBSSH2_COMMON_METHOD**)(defaultvar)))
+
+#define LIBSSH2_METHOD_PREFS_STR(buf, prefvarlen, prefvar, defaultvar)  \
+    if (prefvar) {                                                      \
+        _libssh2_htonu32((buf), (prefvarlen));                          \
+        buf += 4;                                                       \
+        memcpy((buf), (prefvar), (prefvarlen));                         \
+        buf += (prefvarlen);                                            \
+    } else {                                                            \
+        buf += kex_method_list((buf), (prefvarlen),                     \
+                               (LIBSSH2_COMMON_METHOD**)(defaultvar));  \
+    }
+
+/* kexinit
+ * Send SSH_MSG_KEXINIT packet
+ */
+static int kexinit(LIBSSH2_SESSION * session)
+{
+    /* 62 = packet_type(1) + cookie(16) + first_packet_follows(1) +
+       reserved(4) + length longs(40) */
+    size_t data_len = 62;
+    size_t kex_len, hostkey_len = 0;
+    size_t crypt_cs_len, crypt_sc_len;
+    size_t comp_cs_len, comp_sc_len;
+    size_t mac_cs_len, mac_sc_len;
+    size_t lang_cs_len, lang_sc_len;
+    unsigned char *data, *s;
+    int rc;
+
+    if (session->kexinit_state == libssh2_NB_state_idle) {
+        kex_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->kex_prefs, libssh2_kex_methods);
+        hostkey_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->hostkey_prefs,
+                                     libssh2_hostkey_methods());
+        crypt_cs_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->local.crypt_prefs,
+                                     libssh2_crypt_methods());
+        crypt_sc_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->remote.crypt_prefs,
+                                     libssh2_crypt_methods());
+        mac_cs_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->local.mac_prefs,
+                                     _libssh2_mac_methods());
+        mac_sc_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->remote.mac_prefs,
+                                     _libssh2_mac_methods());
+        comp_cs_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->local.comp_prefs,
+                                     _libssh2_comp_methods(session));
+        comp_sc_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->remote.comp_prefs,
+                                     _libssh2_comp_methods(session));
+        lang_cs_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->local.lang_prefs, NULL);
+        lang_sc_len =
+            LIBSSH2_METHOD_PREFS_LEN(session->remote.lang_prefs, NULL);
+
+        data_len += kex_len + hostkey_len + crypt_cs_len + crypt_sc_len +
+            comp_cs_len + comp_sc_len + mac_cs_len + mac_sc_len +
+            lang_cs_len + lang_sc_len;
+
+        s = data = LIBSSH2_ALLOC(session, data_len);
+        if (!data) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory");
+        }
+
+        *(s++) = SSH_MSG_KEXINIT;
+
+        _libssh2_random(s, 16);
+        s += 16;
+
+        /* Ennumerating through these lists twice is probably (certainly?)
+           inefficient from a CPU standpoint, but it saves multiple
+           malloc/realloc calls */
+        LIBSSH2_METHOD_PREFS_STR(s, kex_len, session->kex_prefs,
+                                 libssh2_kex_methods);
+        LIBSSH2_METHOD_PREFS_STR(s, hostkey_len, session->hostkey_prefs,
+                                 libssh2_hostkey_methods());
+        LIBSSH2_METHOD_PREFS_STR(s, crypt_cs_len, session->local.crypt_prefs,
+                                 libssh2_crypt_methods());
+        LIBSSH2_METHOD_PREFS_STR(s, crypt_sc_len, session->remote.crypt_prefs,
+                                 libssh2_crypt_methods());
+        LIBSSH2_METHOD_PREFS_STR(s, mac_cs_len, session->local.mac_prefs,
+                                 _libssh2_mac_methods());
+        LIBSSH2_METHOD_PREFS_STR(s, mac_sc_len, session->remote.mac_prefs,
+                                 _libssh2_mac_methods());
+        LIBSSH2_METHOD_PREFS_STR(s, comp_cs_len, session->local.comp_prefs,
+                                 _libssh2_comp_methods(session));
+        LIBSSH2_METHOD_PREFS_STR(s, comp_sc_len, session->remote.comp_prefs,
+                                 _libssh2_comp_methods(session));
+        LIBSSH2_METHOD_PREFS_STR(s, lang_cs_len, session->local.lang_prefs,
+                                 NULL);
+        LIBSSH2_METHOD_PREFS_STR(s, lang_sc_len, session->remote.lang_prefs,
+                                 NULL);
+
+        /* No optimistic KEX packet follows */
+        /* Deal with optimistic packets
+         * session->flags |= KEXINIT_OPTIMISTIC
+         * session->flags |= KEXINIT_METHODSMATCH
+         */
+        *(s++) = 0;
+
+        /* Reserved == 0 */
+        _libssh2_htonu32(s, 0);
+
+#ifdef LIBSSH2DEBUG
+        {
+            /* Funnily enough, they'll all "appear" to be '\0' terminated */
+            unsigned char *p = data + 21;       /* type(1) + cookie(16) + len(4) */
+
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent KEX: %s", p);
+            p += kex_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent HOSTKEY: %s", p);
+            p += hostkey_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent CRYPT_CS: %s", p);
+            p += crypt_cs_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent CRYPT_SC: %s", p);
+            p += crypt_sc_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent MAC_CS: %s", p);
+            p += mac_cs_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent MAC_SC: %s", p);
+            p += mac_sc_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent COMP_CS: %s", p);
+            p += comp_cs_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent COMP_SC: %s", p);
+            p += comp_sc_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent LANG_CS: %s", p);
+            p += lang_cs_len + 4;
+            _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Sent LANG_SC: %s", p);
+            p += lang_sc_len + 4;
+        }
+#endif /* LIBSSH2DEBUG */
+
+        session->kexinit_state = libssh2_NB_state_created;
+    } else {
+        data = session->kexinit_data;
+        data_len = session->kexinit_data_len;
+        /* zap the variables to ensure there is NOT a double free later */
+        session->kexinit_data = NULL;
+        session->kexinit_data_len = 0;
+    }
+
+    rc = _libssh2_transport_send(session, data, data_len, NULL, 0);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        session->kexinit_data = data;
+        session->kexinit_data_len = data_len;
+        return rc;
+    }
+    else if (rc) {
+        LIBSSH2_FREE(session, data);
+        session->kexinit_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Unable to send KEXINIT packet to remote host");
+
+    }
+
+    if (session->local.kexinit) {
+        LIBSSH2_FREE(session, session->local.kexinit);
+    }
+
+    session->local.kexinit = data;
+    session->local.kexinit_len = data_len;
+
+    session->kexinit_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/* kex_agree_instr
+ * Kex specific variant of strstr()
+ * Needle must be preceed by BOL or ',', and followed by ',' or EOL
+ */
+static unsigned char *
+kex_agree_instr(unsigned char *haystack, unsigned long haystack_len,
+                const unsigned char *needle, unsigned long needle_len)
+{
+    unsigned char *s;
+
+    /* Haystack too short to bother trying */
+    if (haystack_len < needle_len) {
+        return NULL;
+    }
+
+    /* Needle at start of haystack */
+    if ((strncmp((char *) haystack, (char *) needle, needle_len) == 0) &&
+        (needle_len == haystack_len || haystack[needle_len] == ',')) {
+        return haystack;
+    }
+
+    s = haystack;
+    /* Search until we run out of comas or we run out of haystack,
+       whichever comes first */
+    while ((s = (unsigned char *) strchr((char *) s, ','))
+           && ((haystack_len - (s - haystack)) > needle_len)) {
+        s++;
+        /* Needle at X position */
+        if ((strncmp((char *) s, (char *) needle, needle_len) == 0) &&
+            (((s - haystack) + needle_len) == haystack_len
+             || s[needle_len] == ',')) {
+            return s;
+        }
+    }
+
+    return NULL;
+}
+
+
+
+/* kex_get_method_by_name
+ */
+static const LIBSSH2_COMMON_METHOD *
+kex_get_method_by_name(const char *name, size_t name_len,
+                       const LIBSSH2_COMMON_METHOD ** methodlist)
+{
+    while (*methodlist) {
+        if ((strlen((*methodlist)->name) == name_len) &&
+            (strncmp((*methodlist)->name, name, name_len) == 0)) {
+            return *methodlist;
+        }
+        methodlist++;
+    }
+    return NULL;
+}
+
+
+
+/* kex_agree_hostkey
+ * Agree on a Hostkey which works with this kex
+ */
+static int kex_agree_hostkey(LIBSSH2_SESSION * session,
+                             unsigned long kex_flags,
+                             unsigned char *hostkey, unsigned long hostkey_len)
+{
+    const LIBSSH2_HOSTKEY_METHOD **hostkeyp = libssh2_hostkey_methods();
+    unsigned char *s;
+
+    if (session->hostkey_prefs) {
+        s = (unsigned char *) session->hostkey_prefs;
+
+        while (s && *s) {
+            unsigned char *p = (unsigned char *) strchr((char *) s, ',');
+            size_t method_len = (p ? (size_t)(p - s) : strlen((char *) s));
+            if (kex_agree_instr(hostkey, hostkey_len, s, method_len)) {
+                const LIBSSH2_HOSTKEY_METHOD *method =
+                    (const LIBSSH2_HOSTKEY_METHOD *)
+                    kex_get_method_by_name((char *) s, method_len,
+                                           (const LIBSSH2_COMMON_METHOD **)
+                                           hostkeyp);
+
+                if (!method) {
+                    /* Invalid method -- Should never be reached */
+                    return -1;
+                }
+
+                /* So far so good, but does it suit our purposes? (Encrypting
+                   vs Signing) */
+                if (((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY) ==
+                     0) || (method->encrypt)) {
+                    /* Either this hostkey can do encryption or this kex just
+                       doesn't require it */
+                    if (((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY)
+                         == 0) || (method->sig_verify)) {
+                        /* Either this hostkey can do signing or this kex just
+                           doesn't require it */
+                        session->hostkey = method;
+                        return 0;
+                    }
+                }
+            }
+
+            s = p ? p + 1 : NULL;
+        }
+        return -1;
+    }
+
+    while (hostkeyp && (*hostkeyp) && (*hostkeyp)->name) {
+        s = kex_agree_instr(hostkey, hostkey_len,
+                            (unsigned char *) (*hostkeyp)->name,
+                            strlen((*hostkeyp)->name));
+        if (s) {
+            /* So far so good, but does it suit our purposes? (Encrypting vs
+               Signing) */
+            if (((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY) == 0) ||
+                ((*hostkeyp)->encrypt)) {
+                /* Either this hostkey can do encryption or this kex just
+                   doesn't require it */
+                if (((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY) ==
+                     0) || ((*hostkeyp)->sig_verify)) {
+                    /* Either this hostkey can do signing or this kex just
+                       doesn't require it */
+                    session->hostkey = *hostkeyp;
+                    return 0;
+                }
+            }
+        }
+        hostkeyp++;
+    }
+
+    return -1;
+}
+
+
+
+/* kex_agree_kex_hostkey
+ * Agree on a Key Exchange method and a hostkey encoding type
+ */
+static int kex_agree_kex_hostkey(LIBSSH2_SESSION * session, unsigned char *kex,
+                                 unsigned long kex_len, unsigned char *hostkey,
+                                 unsigned long hostkey_len)
+{
+    const LIBSSH2_KEX_METHOD **kexp = libssh2_kex_methods;
+    unsigned char *s;
+
+    if (session->kex_prefs) {
+        s = (unsigned char *) session->kex_prefs;
+
+        while (s && *s) {
+            unsigned char *q, *p = (unsigned char *) strchr((char *) s, ',');
+            size_t method_len = (p ? (size_t)(p - s) : strlen((char *) s));
+            if ((q = kex_agree_instr(kex, kex_len, s, method_len))) {
+                const LIBSSH2_KEX_METHOD *method = (const LIBSSH2_KEX_METHOD *)
+                    kex_get_method_by_name((char *) s, method_len,
+                                           (const LIBSSH2_COMMON_METHOD **)
+                                           kexp);
+
+                if (!method) {
+                    /* Invalid method -- Should never be reached */
+                    return -1;
+                }
+
+                /* We've agreed on a key exchange method,
+                 * Can we agree on a hostkey that works with this kex?
+                 */
+                if (kex_agree_hostkey(session, method->flags, hostkey,
+                                      hostkey_len) == 0) {
+                    session->kex = method;
+                    if (session->burn_optimistic_kexinit && (kex == q)) {
+                        /* Server sent an optimistic packet,
+                         * and client agrees with preference
+                         * cancel burning the first KEX_INIT packet that comes in */
+                        session->burn_optimistic_kexinit = 0;
+                    }
+                    return 0;
+                }
+            }
+
+            s = p ? p + 1 : NULL;
+        }
+        return -1;
+    }
+
+    while (*kexp && (*kexp)->name) {
+        s = kex_agree_instr(kex, kex_len,
+                            (unsigned char *) (*kexp)->name,
+                            strlen((*kexp)->name));
+        if (s) {
+            /* We've agreed on a key exchange method,
+             * Can we agree on a hostkey that works with this kex?
+             */
+            if (kex_agree_hostkey(session, (*kexp)->flags, hostkey,
+                                  hostkey_len) == 0) {
+                session->kex = *kexp;
+                if (session->burn_optimistic_kexinit && (kex == s)) {
+                    /* Server sent an optimistic packet,
+                     * and client agrees with preference
+                     * cancel burning the first KEX_INIT packet that comes in */
+                    session->burn_optimistic_kexinit = 0;
+                }
+                return 0;
+            }
+        }
+        kexp++;
+    }
+    return -1;
+}
+
+
+
+/* kex_agree_crypt
+ * Agree on a cipher algo
+ */
+static int kex_agree_crypt(LIBSSH2_SESSION * session,
+                           libssh2_endpoint_data *endpoint,
+                           unsigned char *crypt,
+                           unsigned long crypt_len)
+{
+    const LIBSSH2_CRYPT_METHOD **cryptp = libssh2_crypt_methods();
+    unsigned char *s;
+
+    (void) session;
+
+    if (endpoint->crypt_prefs) {
+        s = (unsigned char *) endpoint->crypt_prefs;
+
+        while (s && *s) {
+            unsigned char *p = (unsigned char *) strchr((char *) s, ',');
+            size_t method_len = (p ? (size_t)(p - s) : strlen((char *) s));
+
+            if (kex_agree_instr(crypt, crypt_len, s, method_len)) {
+                const LIBSSH2_CRYPT_METHOD *method =
+                    (const LIBSSH2_CRYPT_METHOD *)
+                    kex_get_method_by_name((char *) s, method_len,
+                                           (const LIBSSH2_COMMON_METHOD **)
+                                           cryptp);
+
+                if (!method) {
+                    /* Invalid method -- Should never be reached */
+                    return -1;
+                }
+
+                endpoint->crypt = method;
+                return 0;
+            }
+
+            s = p ? p + 1 : NULL;
+        }
+        return -1;
+    }
+
+    while (*cryptp && (*cryptp)->name) {
+        s = kex_agree_instr(crypt, crypt_len,
+                            (unsigned char *) (*cryptp)->name,
+                            strlen((*cryptp)->name));
+        if (s) {
+            endpoint->crypt = *cryptp;
+            return 0;
+        }
+        cryptp++;
+    }
+
+    return -1;
+}
+
+
+
+/* kex_agree_mac
+ * Agree on a message authentication hash
+ */
+static int kex_agree_mac(LIBSSH2_SESSION * session,
+                         libssh2_endpoint_data * endpoint, unsigned char *mac,
+                         unsigned long mac_len)
+{
+    const LIBSSH2_MAC_METHOD **macp = _libssh2_mac_methods();
+    unsigned char *s;
+    (void) session;
+
+    if (endpoint->mac_prefs) {
+        s = (unsigned char *) endpoint->mac_prefs;
+
+        while (s && *s) {
+            unsigned char *p = (unsigned char *) strchr((char *) s, ',');
+            size_t method_len = (p ? (size_t)(p - s) : strlen((char *) s));
+
+            if (kex_agree_instr(mac, mac_len, s, method_len)) {
+                const LIBSSH2_MAC_METHOD *method = (const LIBSSH2_MAC_METHOD *)
+                    kex_get_method_by_name((char *) s, method_len,
+                                           (const LIBSSH2_COMMON_METHOD **)
+                                           macp);
+
+                if (!method) {
+                    /* Invalid method -- Should never be reached */
+                    return -1;
+                }
+
+                endpoint->mac = method;
+                return 0;
+            }
+
+            s = p ? p + 1 : NULL;
+        }
+        return -1;
+    }
+
+    while (*macp && (*macp)->name) {
+        s = kex_agree_instr(mac, mac_len, (unsigned char *) (*macp)->name,
+                            strlen((*macp)->name));
+        if (s) {
+            endpoint->mac = *macp;
+            return 0;
+        }
+        macp++;
+    }
+
+    return -1;
+}
+
+
+
+/* kex_agree_comp
+ * Agree on a compression scheme
+ */
+static int kex_agree_comp(LIBSSH2_SESSION *session,
+                          libssh2_endpoint_data *endpoint, unsigned char *comp,
+                          unsigned long comp_len)
+{
+    const LIBSSH2_COMP_METHOD **compp = _libssh2_comp_methods(session);
+    unsigned char *s;
+    (void) session;
+
+    if (endpoint->comp_prefs) {
+        s = (unsigned char *) endpoint->comp_prefs;
+
+        while (s && *s) {
+            unsigned char *p = (unsigned char *) strchr((char *) s, ',');
+            size_t method_len = (p ? (size_t)(p - s) : strlen((char *) s));
+
+            if (kex_agree_instr(comp, comp_len, s, method_len)) {
+                const LIBSSH2_COMP_METHOD *method =
+                    (const LIBSSH2_COMP_METHOD *)
+                    kex_get_method_by_name((char *) s, method_len,
+                                           (const LIBSSH2_COMMON_METHOD **)
+                                           compp);
+
+                if (!method) {
+                    /* Invalid method -- Should never be reached */
+                    return -1;
+                }
+
+                endpoint->comp = method;
+                return 0;
+            }
+
+            s = p ? p + 1 : NULL;
+        }
+        return -1;
+    }
+
+    while (*compp && (*compp)->name) {
+        s = kex_agree_instr(comp, comp_len, (unsigned char *) (*compp)->name,
+                            strlen((*compp)->name));
+        if (s) {
+            endpoint->comp = *compp;
+            return 0;
+        }
+        compp++;
+    }
+
+    return -1;
+}
+
+
+
+/* TODO: When in server mode we need to turn this logic on its head
+ * The Client gets to make the final call on "agreed methods"
+ */
+
+/* kex_agree_methods
+ * Decide which specific method to use of the methods offered by each party
+ */
+static int kex_agree_methods(LIBSSH2_SESSION * session, unsigned char *data,
+                             unsigned data_len)
+{
+    unsigned char *kex, *hostkey, *crypt_cs, *crypt_sc, *comp_cs, *comp_sc,
+        *mac_cs, *mac_sc;
+    size_t kex_len, hostkey_len, crypt_cs_len, crypt_sc_len, comp_cs_len;
+    size_t comp_sc_len, mac_cs_len, mac_sc_len;
+    unsigned char *s = data;
+
+    /* Skip packet_type, we know it already */
+    s++;
+
+    /* Skip cookie, don't worry, it's preserved in the kexinit field */
+    s += 16;
+
+    /* Locate each string */
+    kex_len = _libssh2_ntohu32(s);
+    kex = s + 4;
+    s += 4 + kex_len;
+    hostkey_len = _libssh2_ntohu32(s);
+    hostkey = s + 4;
+    s += 4 + hostkey_len;
+    crypt_cs_len = _libssh2_ntohu32(s);
+    crypt_cs = s + 4;
+    s += 4 + crypt_cs_len;
+    crypt_sc_len = _libssh2_ntohu32(s);
+    crypt_sc = s + 4;
+    s += 4 + crypt_sc_len;
+    mac_cs_len = _libssh2_ntohu32(s);
+    mac_cs = s + 4;
+    s += 4 + mac_cs_len;
+    mac_sc_len = _libssh2_ntohu32(s);
+    mac_sc = s + 4;
+    s += 4 + mac_sc_len;
+    comp_cs_len = _libssh2_ntohu32(s);
+    comp_cs = s + 4;
+    s += 4 + comp_cs_len;
+    comp_sc_len = _libssh2_ntohu32(s);
+    comp_sc = s + 4;
+#if 0
+    s += 4 + comp_sc_len;
+    lang_cs_len = _libssh2_ntohu32(s);
+    lang_cs = s + 4;
+    s += 4 + lang_cs_len;
+    lang_sc_len = _libssh2_ntohu32(s);
+    lang_sc = s + 4;
+    s += 4 + lang_sc_len;
+#endif
+    /* If the server sent an optimistic packet, assume that it guessed wrong.
+     * If the guess is determined to be right (by kex_agree_kex_hostkey)
+     * This flag will be reset to zero so that it's not ignored */
+    session->burn_optimistic_kexinit = *(s++);
+    /* Next uint32 in packet is all zeros (reserved) */
+
+    if (data_len < (unsigned) (s - data))
+        return -1;              /* short packet */
+
+    if (kex_agree_kex_hostkey(session, kex, kex_len, hostkey, hostkey_len)) {
+        return -1;
+    }
+
+    if (kex_agree_crypt(session, &session->local, crypt_cs, crypt_cs_len)
+        || kex_agree_crypt(session, &session->remote, crypt_sc, crypt_sc_len)) {
+        return -1;
+    }
+
+    if (kex_agree_mac(session, &session->local, mac_cs, mac_cs_len) ||
+        kex_agree_mac(session, &session->remote, mac_sc, mac_sc_len)) {
+        return -1;
+    }
+
+    if (kex_agree_comp(session, &session->local, comp_cs, comp_cs_len) ||
+        kex_agree_comp(session, &session->remote, comp_sc, comp_sc_len)) {
+        return -1;
+    }
+
+#if 0
+    if (libssh2_kex_agree_lang(session, &session->local, lang_cs, lang_cs_len)
+        || libssh2_kex_agree_lang(session, &session->remote, lang_sc,
+                                  lang_sc_len)) {
+        return -1;
+    }
+#endif
+
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on KEX method: %s",
+                   session->kex->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on HOSTKEY method: %s",
+                   session->hostkey->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on CRYPT_CS method: %s",
+                   session->local.crypt->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on CRYPT_SC method: %s",
+                   session->remote.crypt->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on MAC_CS method: %s",
+                   session->local.mac->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on MAC_SC method: %s",
+                   session->remote.mac->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on COMP_CS method: %s",
+                   session->local.comp->name);
+    _libssh2_debug(session, LIBSSH2_TRACE_KEX, "Agreed on COMP_SC method: %s",
+                   session->remote.comp->name);
+
+    return 0;
+}
+
+
+
+/* _libssh2_kex_exchange
+ * Exchange keys
+ * Returns 0 on success, non-zero on failure
+ *
+ * Returns some errors without _libssh2_error()
+ */
+int
+_libssh2_kex_exchange(LIBSSH2_SESSION * session, int reexchange,
+                     key_exchange_state_t * key_state)
+{
+    int rc = 0;
+    int retcode;
+
+    session->state |= LIBSSH2_STATE_KEX_ACTIVE;
+
+    if (key_state->state == libssh2_NB_state_idle) {
+        /* Prevent loop in packet_add() */
+        session->state |= LIBSSH2_STATE_EXCHANGING_KEYS;
+
+        if (reexchange) {
+            session->kex = NULL;
+
+            if (session->hostkey && session->hostkey->dtor) {
+                session->hostkey->dtor(session,
+                                       &session->server_hostkey_abstract);
+            }
+            session->hostkey = NULL;
+        }
+
+        key_state->state = libssh2_NB_state_created;
+    }
+
+    if (!session->kex || !session->hostkey) {
+        if (key_state->state == libssh2_NB_state_created) {
+            /* Preserve in case of failure */
+            key_state->oldlocal = session->local.kexinit;
+            key_state->oldlocal_len = session->local.kexinit_len;
+
+            session->local.kexinit = NULL;
+
+            key_state->state = libssh2_NB_state_sent;
+        }
+
+        if (key_state->state == libssh2_NB_state_sent) {
+            retcode = kexinit(session);
+            if (retcode == LIBSSH2_ERROR_EAGAIN) {
+                session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+                return retcode;
+            } else if (retcode) {
+                session->local.kexinit = key_state->oldlocal;
+                session->local.kexinit_len = key_state->oldlocal_len;
+                key_state->state = libssh2_NB_state_idle;
+                session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+                session->state &= ~LIBSSH2_STATE_EXCHANGING_KEYS;
+                return -1;
+            }
+
+            key_state->state = libssh2_NB_state_sent1;
+        }
+
+        if (key_state->state == libssh2_NB_state_sent1) {
+            retcode =
+                _libssh2_packet_require(session, SSH_MSG_KEXINIT,
+                                        &key_state->data,
+                                        &key_state->data_len, 0, NULL, 0,
+                                        &key_state->req_state);
+            if (retcode == LIBSSH2_ERROR_EAGAIN) {
+                session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+                return retcode;
+            }
+            else if (retcode) {
+                if (session->local.kexinit) {
+                    LIBSSH2_FREE(session, session->local.kexinit);
+                }
+                session->local.kexinit = key_state->oldlocal;
+                session->local.kexinit_len = key_state->oldlocal_len;
+                key_state->state = libssh2_NB_state_idle;
+                session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+                session->state &= ~LIBSSH2_STATE_EXCHANGING_KEYS;
+                return -1;
+            }
+
+            if (session->remote.kexinit) {
+                LIBSSH2_FREE(session, session->remote.kexinit);
+            }
+            session->remote.kexinit = key_state->data;
+            session->remote.kexinit_len = key_state->data_len;
+
+            if (kex_agree_methods(session, key_state->data,
+                                  key_state->data_len))
+                rc = LIBSSH2_ERROR_KEX_FAILURE;
+
+            key_state->state = libssh2_NB_state_sent2;
+        }
+    } else {
+        key_state->state = libssh2_NB_state_sent2;
+    }
+
+    if (rc == 0) {
+        if (key_state->state == libssh2_NB_state_sent2) {
+            retcode = session->kex->exchange_keys(session,
+                                                  &key_state->key_state_low);
+            if (retcode == LIBSSH2_ERROR_EAGAIN) {
+                session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+                return retcode;
+            } else if (retcode) {
+                rc = _libssh2_error(session, LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE,
+                                    "Unrecoverable error exchanging keys");
+            }
+        }
+    }
+
+    /* Done with kexinit buffers */
+    if (session->local.kexinit) {
+        LIBSSH2_FREE(session, session->local.kexinit);
+        session->local.kexinit = NULL;
+    }
+    if (session->remote.kexinit) {
+        LIBSSH2_FREE(session, session->remote.kexinit);
+        session->remote.kexinit = NULL;
+    }
+
+    session->state &= ~LIBSSH2_STATE_KEX_ACTIVE;
+    session->state &= ~LIBSSH2_STATE_EXCHANGING_KEYS;
+
+    key_state->state = libssh2_NB_state_idle;
+
+    return rc;
+}
+
+
+
+/* libssh2_session_method_pref
+ * Set preferred method
+ */
+LIBSSH2_API int
+libssh2_session_method_pref(LIBSSH2_SESSION * session, int method_type,
+                            const char *prefs)
+{
+    char **prefvar, *s, *newprefs;
+    int prefs_len = strlen(prefs);
+    const LIBSSH2_COMMON_METHOD **mlist;
+
+    switch (method_type) {
+    case LIBSSH2_METHOD_KEX:
+        prefvar = &session->kex_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_kex_methods;
+        break;
+
+    case LIBSSH2_METHOD_HOSTKEY:
+        prefvar = &session->hostkey_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_hostkey_methods();
+        break;
+
+    case LIBSSH2_METHOD_CRYPT_CS:
+        prefvar = &session->local.crypt_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_crypt_methods();
+        break;
+
+    case LIBSSH2_METHOD_CRYPT_SC:
+        prefvar = &session->remote.crypt_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_crypt_methods();
+        break;
+
+    case LIBSSH2_METHOD_MAC_CS:
+        prefvar = &session->local.mac_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) _libssh2_mac_methods();
+        break;
+
+    case LIBSSH2_METHOD_MAC_SC:
+        prefvar = &session->remote.mac_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **) _libssh2_mac_methods();
+        break;
+
+    case LIBSSH2_METHOD_COMP_CS:
+        prefvar = &session->local.comp_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **)
+            _libssh2_comp_methods(session);
+        break;
+
+    case LIBSSH2_METHOD_COMP_SC:
+        prefvar = &session->remote.comp_prefs;
+        mlist = (const LIBSSH2_COMMON_METHOD **)
+            _libssh2_comp_methods(session);
+        break;
+
+    case LIBSSH2_METHOD_LANG_CS:
+        prefvar = &session->local.lang_prefs;
+        mlist = NULL;
+        break;
+
+    case LIBSSH2_METHOD_LANG_SC:
+        prefvar = &session->remote.lang_prefs;
+        mlist = NULL;
+        break;
+
+    default:
+        return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                              "Invalid parameter specified for method_type");
+    }
+
+    s = newprefs = LIBSSH2_ALLOC(session, prefs_len + 1);
+    if (!newprefs) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Error allocated space for method preferences");
+    }
+    memcpy(s, prefs, prefs_len + 1);
+
+    while (s && *s) {
+        char *p = strchr(s, ',');
+        int method_len = p ? (p - s) : (int) strlen(s);
+
+        if (!kex_get_method_by_name(s, method_len, mlist)) {
+            /* Strip out unsupported method */
+            if (p) {
+                memcpy(s, p + 1, strlen(s) - method_len);
+            } else {
+                if (s > newprefs) {
+                    *(--s) = '\0';
+                } else {
+                    *s = '\0';
+                }
+            }
+        }
+
+        s = p ? (p + 1) : NULL;
+    }
+
+    if (strlen(newprefs) == 0) {
+        LIBSSH2_FREE(session, newprefs);
+        return _libssh2_error(session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "The requested method(s) are not currently "
+                              "supported");
+    }
+
+    if (*prefvar) {
+        LIBSSH2_FREE(session, *prefvar);
+    }
+    *prefvar = newprefs;
+
+    return 0;
+}
+
+/*
+ * libssh2_session_supported_algs()
+ * returns a number of returned algorithms (a positive number) on success,
+ * a negative number on failure
+ */
+
+LIBSSH2_API int libssh2_session_supported_algs(LIBSSH2_SESSION* session,
+                                               int method_type,
+                                               const char*** algs)
+{
+    unsigned int i;
+    unsigned int j;
+    unsigned int ialg;
+    const LIBSSH2_COMMON_METHOD **mlist;
+
+    /* to prevent coredumps due to dereferencing of NULL */
+    if (NULL == algs)
+        return _libssh2_error(session, LIBSSH2_ERROR_BAD_USE,
+                              "algs must not be NULL");
+
+    switch (method_type) {
+    case LIBSSH2_METHOD_KEX:
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_kex_methods;
+        break;
+
+    case LIBSSH2_METHOD_HOSTKEY:
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_hostkey_methods();
+        break;
+
+    case LIBSSH2_METHOD_CRYPT_CS:
+    case LIBSSH2_METHOD_CRYPT_SC:
+        mlist = (const LIBSSH2_COMMON_METHOD **) libssh2_crypt_methods();
+        break;
+
+    case LIBSSH2_METHOD_MAC_CS:
+    case LIBSSH2_METHOD_MAC_SC:
+        mlist = (const LIBSSH2_COMMON_METHOD **) _libssh2_mac_methods();
+        break;
+
+    case LIBSSH2_METHOD_COMP_CS:
+    case LIBSSH2_METHOD_COMP_SC:
+        mlist = (const LIBSSH2_COMMON_METHOD **) _libssh2_comp_methods(session);
+        break;
+
+    default:
+        return _libssh2_error(session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unknown method type");
+    }  /* switch */
+
+    /* weird situation */
+    if (NULL==mlist)
+        return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                              "No algorithm found");
+
+    /*
+      mlist is looped through twice. The first time to find the number od
+      supported algorithms (needed to allocate the proper size of array) and
+      the second time to actually copy the pointers.  Typically this function
+      will not be called often (typically at the beginning of a session) and
+      the number of algorithms (i.e. niumber of iterations in one loop) will
+      not be high (typically it will not exceed 20) for quite a long time.
+
+      So double looping really shouldn't be an issue and it is definitely a
+      better solution than reallocation several times.
+    */
+
+    /* count the number of supported algorithms */
+    for ( i=0, ialg=0; NULL!=mlist[i]; i++) {
+        /* do not count fields with NULL name */
+        if (mlist[i]->name)
+            ialg++;
+    }
+
+    /* weird situation, no algorithm found */
+    if (0==ialg)
+        return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                              "No algorithm found");
+
+    /* allocate buffer */
+    *algs = (const char**) LIBSSH2_ALLOC(session, ialg*sizeof(const char*));
+    if ( NULL==*algs ) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Memory allocation failed");
+    }
+    /* Past this point *algs must be deallocated in case of an error!! */
+
+    /* copy non-NULL pointers only */
+    for ( i=0, j=0; NULL!=mlist[i] && j<ialg; i++ ) {
+        if ( NULL==mlist[i]->name ){
+            /* maybe a weird situation but if it occurs, do not include NULL
+               pointers */
+            continue;
+        }
+
+        /* note that [] has higher priority than * (dereferencing) */
+        (*algs)[j++] = mlist[i]->name;
+    }
+
+    /* correct number of pointers copied? (test the code above) */
+    if ( j!=ialg ) {
+        /* deallocate buffer */
+        LIBSSH2_FREE(session, (void *)*algs);
+        *algs = NULL;
+
+        return _libssh2_error(session, LIBSSH2_ERROR_BAD_USE,
+                              "Internal error");
+    }
+
+    return ialg;
+}
diff --git a/pgadmin/libssh2/knownhost.c b/pgadmin/libssh2/knownhost.c
new file mode 100644
index 0000000..1087bc2
--- /dev/null
+++ b/pgadmin/libssh2/knownhost.c
@@ -0,0 +1,1149 @@
+/*
+ * Copyright (c) 2009-2011 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "misc.h"
+
+struct known_host {
+    struct list_node node;
+    char *name;      /* points to the name or the hash (allocated) */
+    size_t name_len; /* needed for hashed data */
+    int port;        /* if non-zero, a specific port this key is for on this
+                        host */
+    int typemask;    /* plain, sha1, custom, ... */
+    char *salt;      /* points to binary salt (allocated) */
+    size_t salt_len; /* size of salt */
+    char *key;       /* the (allocated) associated key. This is kept base64
+                        encoded in memory. */
+    char *comment;   /* the (allocated) optional comment text, may be NULL */
+
+    /* this is the struct we expose externally */
+    struct libssh2_knownhost external;
+};
+
+struct _LIBSSH2_KNOWNHOSTS
+{
+    LIBSSH2_SESSION *session;  /* the session this "belongs to" */
+    struct list_head head;
+};
+
+static void free_host(LIBSSH2_SESSION *session, struct known_host *entry)
+{
+    if(entry) {
+        if(entry->comment)
+            LIBSSH2_FREE(session, entry->comment);
+        if(entry->key)
+            LIBSSH2_FREE(session, entry->key);
+        if(entry->salt)
+            LIBSSH2_FREE(session, entry->salt);
+        if(entry->name)
+            LIBSSH2_FREE(session, entry->name);
+        LIBSSH2_FREE(session, entry);
+    }
+}
+
+/*
+ * libssh2_knownhost_init
+ *
+ * Init a collection of known hosts. Returns the pointer to a collection.
+ *
+ */
+LIBSSH2_API LIBSSH2_KNOWNHOSTS *
+libssh2_knownhost_init(LIBSSH2_SESSION *session)
+{
+    LIBSSH2_KNOWNHOSTS *knh =
+        LIBSSH2_ALLOC(session, sizeof(struct _LIBSSH2_KNOWNHOSTS));
+
+    if(!knh) {
+        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                       "Unable to allocate memory for known-hosts "
+                       "collection");
+        return NULL;
+    }
+
+    knh->session = session;
+
+    _libssh2_list_init(&knh->head);
+
+    return knh;
+}
+
+#define KNOWNHOST_MAGIC 0xdeadcafe
+/*
+ * knownhost_to_external()
+ *
+ * Copies data from the internal to the external representation struct.
+ *
+ */
+static struct libssh2_knownhost *knownhost_to_external(struct known_host *node)
+{
+    struct libssh2_knownhost *ext = &node->external;
+
+    ext->magic = KNOWNHOST_MAGIC;
+    ext->node = node;
+    ext->name = ((node->typemask & LIBSSH2_KNOWNHOST_TYPE_MASK) ==
+                 LIBSSH2_KNOWNHOST_TYPE_PLAIN)? node->name:NULL;
+    ext->key = node->key;
+    ext->typemask = node->typemask;
+
+    return ext;
+}
+
+static int
+knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
+              const char *host, const char *salt,
+              const char *key, size_t keylen,
+              const char *comment, size_t commentlen,
+              int typemask, struct libssh2_knownhost **store)
+{
+    struct known_host *entry;
+    size_t hostlen = strlen(host);
+    int rc;
+    char *ptr;
+    unsigned int ptrlen;
+
+    /* make sure we have a key type set */
+    if(!(typemask & LIBSSH2_KNOWNHOST_KEY_MASK))
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_INVAL,
+                              "No key type set");
+
+    if(!(entry = LIBSSH2_ALLOC(hosts->session, sizeof(struct known_host))))
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate memory for known host "
+                              "entry");
+
+    memset(entry, 0, sizeof(struct known_host));
+
+    entry->typemask = typemask;
+
+    switch(entry->typemask  & LIBSSH2_KNOWNHOST_TYPE_MASK) {
+    case LIBSSH2_KNOWNHOST_TYPE_PLAIN:
+    case LIBSSH2_KNOWNHOST_TYPE_CUSTOM:
+        entry->name = LIBSSH2_ALLOC(hosts->session, hostlen+1);
+        if(!entry->name) {
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                "Unable to allocate memory for host name");
+            goto error;
+        }
+        memcpy(entry->name, host, hostlen+1);
+        break;
+    case LIBSSH2_KNOWNHOST_TYPE_SHA1:
+        rc = libssh2_base64_decode(hosts->session, &ptr, &ptrlen,
+                                   host, hostlen);
+        if(rc)
+            goto error;
+        entry->name = ptr;
+        entry->name_len = ptrlen;
+
+        rc = libssh2_base64_decode(hosts->session, &ptr, &ptrlen,
+                                   salt, strlen(salt));
+        if(rc)
+            goto error;
+        entry->salt = ptr;
+        entry->salt_len = ptrlen;
+        break;
+    default:
+        rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                            "Unknown host name type");
+        goto error;
+    }
+
+    if(typemask & LIBSSH2_KNOWNHOST_KEYENC_BASE64) {
+        /* the provided key is base64 encoded already */
+        if(!keylen)
+            keylen = strlen(key);
+        entry->key = LIBSSH2_ALLOC(hosts->session, keylen+1);
+        if(!entry->key) {
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                "Unable to allocate memory for key");
+            goto error;
+        }
+        memcpy(entry->key, key, keylen+1);
+        entry->key[keylen]=0; /* force a terminating zero trailer */
+    }
+    else {
+        /* key is raw, we base64 encode it and store it as such */
+        size_t nlen = _libssh2_base64_encode(hosts->session, key, keylen,
+                                             &ptr);
+        if(!nlen) {
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                "Unable to allocate memory for "
+                                "base64-encoded key");
+            goto error;
+        }
+
+        entry->key = ptr;
+    }
+
+    if (comment) {
+        entry->comment = LIBSSH2_ALLOC(hosts->session, commentlen+1);
+        if(!entry->comment) {
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                "Unable to allocate memory for comment");
+            goto error;
+        }
+        memcpy(entry->comment, comment, commentlen+1);
+        entry->comment[commentlen]=0; /* force a terminating zero trailer */
+    }
+    else {
+        entry->comment = NULL;
+    }
+
+    /* add this new host to the big list of known hosts */
+    _libssh2_list_add(&hosts->head, &entry->node);
+
+    if(store)
+        *store = knownhost_to_external(entry);
+
+    return LIBSSH2_ERROR_NONE;
+  error:
+    free_host(hosts->session, entry);
+    return rc;
+}
+
+/*
+ * libssh2_knownhost_add
+ *
+ * Add a host and its associated key to the collection of known hosts.
+ *
+ * The 'type' argument specifies on what format the given host and keys are:
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - SHA1(<salt> <host>) base64-encoded!
+ * custom - another hash
+ *
+ * If 'sha1' is selected as type, the salt must be provided to the salt
+ * argument. This too base64 encoded.
+ *
+ * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files.  If
+ * a custom type is used, salt is ignored and you must provide the host
+ * pre-hashed when checking for it in the libssh2_knownhost_check() function.
+ *
+ * The keylen parameter may be omitted (zero) if the key is provided as a
+ * NULL-terminated base64-encoded string.
+ */
+
+LIBSSH2_API int
+libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
+                      const char *host, const char *salt,
+                      const char *key, size_t keylen,
+                      int typemask, struct libssh2_knownhost **store)
+{
+    return knownhost_add(hosts, host, salt, key, keylen, NULL, 0, typemask,
+                         store);
+}
+
+
+/*
+ * libssh2_knownhost_addc
+ *
+ * Add a host and its associated key to the collection of known hosts.
+ *
+ * Takes a comment argument that may be NULL.  A NULL comment indicates
+ * there is no comment and the entry will end directly after the key
+ * when written out to a file.  An empty string "" comment will indicate an
+ * empty comment which will cause a single space to be written after the key.
+ *
+ * The 'type' argument specifies on what format the given host and keys are:
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - SHA1(<salt> <host>) base64-encoded!
+ * custom - another hash
+ *
+ * If 'sha1' is selected as type, the salt must be provided to the salt
+ * argument. This too base64 encoded.
+ *
+ * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files.  If
+ * a custom type is used, salt is ignored and you must provide the host
+ * pre-hashed when checking for it in the libssh2_knownhost_check() function.
+ *
+ * The keylen parameter may be omitted (zero) if the key is provided as a
+ * NULL-terminated base64-encoded string.
+ */
+
+LIBSSH2_API int
+libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
+                       const char *host, const char *salt,
+                       const char *key, size_t keylen,
+                       const char *comment, size_t commentlen,
+                       int typemask, struct libssh2_knownhost **store)
+{
+    return knownhost_add(hosts, host, salt, key, keylen, comment, commentlen,
+                         typemask, store);
+}
+
+/*
+ * knownhost_check
+ *
+ * Check a host and its associated key against the collection of known hosts.
+ *
+ * The typemask is the type/format of the given host name and key
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - NOT SUPPORTED AS INPUT
+ * custom - prehashed base64 encoded. Note that this cannot use any salts.
+ *
+ * Returns:
+ *
+ * LIBSSH2_KNOWNHOST_CHECK_FAILURE
+ * LIBSSH2_KNOWNHOST_CHECK_NOTFOUND
+ * LIBSSH2_KNOWNHOST_CHECK_MATCH
+ * LIBSSH2_KNOWNHOST_CHECK_MISMATCH
+ */
+static int
+knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
+                const char *hostp, int port,
+                const char *key, size_t keylen,
+                int typemask,
+                struct libssh2_knownhost **ext)
+{
+    struct known_host *node;
+    struct known_host *badkey = NULL;
+    int type = typemask & LIBSSH2_KNOWNHOST_TYPE_MASK;
+    char *keyalloc = NULL;
+    int rc = LIBSSH2_KNOWNHOST_CHECK_NOTFOUND;
+    char hostbuff[270]; /* most host names can't be longer than like 256 */
+    const char *host;
+    int numcheck; /* number of host combos to check */
+    int match = 0;
+
+    if(type == LIBSSH2_KNOWNHOST_TYPE_SHA1)
+        /* we can't work with a sha1 as given input */
+        return LIBSSH2_KNOWNHOST_CHECK_MISMATCH;
+
+    if(!(typemask & LIBSSH2_KNOWNHOST_KEYENC_BASE64)) {
+        /* we got a raw key input, convert it to base64 for the checks below */
+        size_t nlen = _libssh2_base64_encode(hosts->session, key, keylen,
+                                             &keyalloc);
+        if(!nlen) {
+            _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memory for base64-encoded "
+                           "key");
+            return LIBSSH2_KNOWNHOST_CHECK_FAILURE;
+        }
+
+        /* make the key point to this */
+        key = keyalloc;
+    }
+
+    /* if a port number is given, check for a '[host]:port' first before the
+       plain 'host' */
+    if(port >= 0) {
+        snprintf(hostbuff, sizeof(hostbuff), "[%s]:%d", hostp, port);
+        host = hostbuff;
+        numcheck = 2; /* check both combos, start with this */
+    }
+    else {
+        host = hostp;
+        numcheck = 1; /* only check this host version */
+    }
+
+    do {
+        node = _libssh2_list_first(&hosts->head);
+        while (node) {
+            switch(node->typemask & LIBSSH2_KNOWNHOST_TYPE_MASK) {
+            case LIBSSH2_KNOWNHOST_TYPE_PLAIN:
+                if(type == LIBSSH2_KNOWNHOST_TYPE_PLAIN)
+                    match = !strcmp(host, node->name);
+                break;
+            case LIBSSH2_KNOWNHOST_TYPE_CUSTOM:
+                if(type == LIBSSH2_KNOWNHOST_TYPE_CUSTOM)
+                    match = !strcmp(host, node->name);
+                break;
+            case LIBSSH2_KNOWNHOST_TYPE_SHA1:
+                if(type == LIBSSH2_KNOWNHOST_TYPE_PLAIN) {
+                    /* when we have the sha1 version stored, we can use a
+                       plain input to produce a hash to compare with the
+                       stored hash.
+                    */
+                    libssh2_hmac_ctx ctx;
+                    unsigned char hash[SHA_DIGEST_LENGTH];
+
+                    if(SHA_DIGEST_LENGTH != node->name_len) {
+                        /* the name hash length must be the sha1 size or
+                           we can't match it */
+                        break;
+                    }
+                    libssh2_hmac_sha1_init(&ctx, node->salt, node->salt_len);
+                    libssh2_hmac_update(ctx, (unsigned char *)host,
+                                        strlen(host));
+                    libssh2_hmac_final(ctx, hash);
+                    libssh2_hmac_cleanup(&ctx);
+
+                    if(!memcmp(hash, node->name, SHA_DIGEST_LENGTH))
+                        /* this is a node we're interested in */
+                        match = 1;
+                }
+                break;
+            default: /* unsupported type */
+                break;
+            }
+            if(match) {
+                /* host name match, now compare the keys */
+                if(!strcmp(key, node->key)) {
+                    /* they match! */
+                    if (ext)
+                        *ext = knownhost_to_external(node);
+                    badkey = NULL;
+                    rc = LIBSSH2_KNOWNHOST_CHECK_MATCH;
+                    break;
+                }
+                else {
+                    /* remember the first node that had a host match but a
+                       failed key match since we continue our search from
+                       here */
+                    if(!badkey)
+                        badkey = node;
+                    match = 0; /* don't count this as a match anymore */
+                }
+            }
+            node= _libssh2_list_next(&node->node);
+        }
+        host = hostp;
+    } while(!match && --numcheck);
+
+    if(badkey) {
+        /* key mismatch */
+        if (ext)
+            *ext = knownhost_to_external(badkey);
+        rc = LIBSSH2_KNOWNHOST_CHECK_MISMATCH;
+    }
+
+    if(keyalloc)
+        LIBSSH2_FREE(hosts->session, keyalloc);
+
+    return rc;
+}
+
+/*
+ * libssh2_knownhost_check
+ *
+ * Check a host and its associated key against the collection of known hosts.
+ *
+ * The typemask is the type/format of the given host name and key
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - NOT SUPPORTED AS INPUT
+ * custom - prehashed base64 encoded. Note that this cannot use any salts.
+ *
+ * Returns:
+ *
+ * LIBSSH2_KNOWNHOST_CHECK_FAILURE
+ * LIBSSH2_KNOWNHOST_CHECK_NOTFOUND
+ * LIBSSH2_KNOWNHOST_CHECK_MATCH
+ * LIBSSH2_KNOWNHOST_CHECK_MISMATCH
+ */
+LIBSSH2_API int
+libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
+                        const char *hostp, const char *key, size_t keylen,
+                        int typemask,
+                        struct libssh2_knownhost **ext)
+{
+    return knownhost_check(hosts, hostp, -1, key, keylen,
+                           typemask, ext);
+}
+
+/*
+ * libssh2_knownhost_checkp
+ *
+ * Check a host+port and its associated key against the collection of known
+ * hosts.
+ *
+ * Note that if 'port' is specified as greater than zero, the check function
+ * will be able to check for a dedicated key for this particular host+port
+ * combo, and if 'port' is negative it only checks for the generic host key.
+ *
+ * The typemask is the type/format of the given host name and key
+ *
+ * plain  - ascii "hostname.domain.tld"
+ * sha1   - NOT SUPPORTED AS INPUT
+ * custom - prehashed base64 encoded. Note that this cannot use any salts.
+ *
+ * Returns:
+ *
+ * LIBSSH2_KNOWNHOST_CHECK_FAILURE
+ * LIBSSH2_KNOWNHOST_CHECK_NOTFOUND
+ * LIBSSH2_KNOWNHOST_CHECK_MATCH
+ * LIBSSH2_KNOWNHOST_CHECK_MISMATCH
+ */
+LIBSSH2_API int
+libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
+                         const char *hostp, int port,
+                         const char *key, size_t keylen,
+                         int typemask,
+                         struct libssh2_knownhost **ext)
+{
+    return knownhost_check(hosts, hostp, port, key, keylen,
+                           typemask, ext);
+}
+
+
+/*
+ * libssh2_knownhost_del
+ *
+ * Remove a host from the collection of known hosts.
+ *
+ */
+LIBSSH2_API int
+libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts,
+                      struct libssh2_knownhost *entry)
+{
+    struct known_host *node;
+
+    /* check that this was retrieved the right way or get out */
+    if(!entry || (entry->magic != KNOWNHOST_MAGIC))
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_INVAL,
+                              "Invalid host information");
+
+    /* get the internal node pointer */
+    node = entry->node;
+
+    /* unlink from the list of all hosts */
+    _libssh2_list_remove(&node->node);
+
+    /* clear the struct now since the memory in which it is allocated is
+       about to be freed! */
+    memset(entry, 0, sizeof(struct libssh2_knownhost));
+
+    /* free all resources */
+    free_host(hosts->session, node);
+
+    return 0;
+}
+
+/*
+ * libssh2_knownhost_free
+ *
+ * Free an entire collection of known hosts.
+ *
+ */
+LIBSSH2_API void
+libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts)
+{
+    struct known_host *node;
+    struct known_host *next;
+
+    for(node = _libssh2_list_first(&hosts->head); node; node = next) {
+        next = _libssh2_list_next(&node->node);
+        free_host(hosts->session, node);
+    }
+    LIBSSH2_FREE(hosts->session, hosts);
+}
+
+
+/* old style plain text: [name]([,][name])*
+
+   for the sake of simplicity, we add them as separate hosts with the same
+   key
+*/
+static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts,
+                             const char *host, size_t hostlen,
+                             const char *key, size_t keylen, int key_type,
+                             const char *comment, size_t commentlen)
+{
+    int rc = 0;
+    size_t namelen = 0;
+    const char *name = host + hostlen;
+
+    if(hostlen < 1)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Failed to parse known_hosts line "
+                              "(no host names)");
+
+    while(name > host) {
+        --name;
+        ++namelen;
+
+        /* when we get the the start or see a comma coming up, add the host
+           name to the collection */
+        if((name == host) || (*(name-1) == ',')) {
+
+            char hostbuf[256];
+
+            /* make sure we don't overflow the buffer */
+            if(namelen >= sizeof(hostbuf)-1)
+                return _libssh2_error(hosts->session,
+                                      LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                                      "Failed to parse known_hosts line "
+                                      "(unexpected length)");
+
+            /* copy host name to the temp buffer and zero terminate */
+            memcpy(hostbuf, name, namelen);
+            hostbuf[namelen]=0;
+
+            rc = knownhost_add(hosts, hostbuf, NULL, key, keylen,
+                               comment, commentlen,
+                               key_type | LIBSSH2_KNOWNHOST_TYPE_PLAIN |
+                               LIBSSH2_KNOWNHOST_KEYENC_BASE64, NULL);
+            if(rc)
+                return rc;
+
+            if(name > host) {
+                namelen = 0;
+                --name; /* skip comma */
+            }
+        }
+    }
+
+    return rc;
+}
+
+/* |1|[salt]|[hash] */
+static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts,
+                           const char *host, size_t hostlen,
+                           const char *key, size_t keylen, int key_type,
+                           const char *comment, size_t commentlen)
+{
+    const char *p;
+    char saltbuf[32];
+    char hostbuf[256];
+
+    const char *salt = &host[3]; /* skip the magic marker */
+    hostlen -= 3;    /* deduct the marker */
+
+    /* this is where the salt starts, find the end of it */
+    for(p = salt; *p && (*p != '|'); p++)
+        ;
+
+    if(*p=='|') {
+        const char *hash = NULL;
+        size_t saltlen = p - salt;
+        if(saltlen >= (sizeof(saltbuf)-1)) /* weird length */
+            return _libssh2_error(hosts->session,
+                                  LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                                  "Failed to parse known_hosts line "
+                                  "(unexpectedly long salt)");
+
+        memcpy(saltbuf, salt, saltlen);
+        saltbuf[saltlen] = 0; /* zero terminate */
+        salt = saltbuf; /* point to the stack based buffer */
+
+        hash = p+1; /* the host hash is after the separator */
+
+        /* now make the host point to the hash */
+        host = hash;
+        hostlen -= saltlen+1; /* deduct the salt and separator */
+
+        /* check that the lengths seem sensible */
+        if(hostlen >= sizeof(hostbuf)-1)
+            return _libssh2_error(hosts->session,
+                                  LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                                  "Failed to parse known_hosts line "
+                                  "(unexpected length)");
+
+        memcpy(hostbuf, host, hostlen);
+        hostbuf[hostlen]=0;
+
+        return knownhost_add(hosts, hostbuf, salt, key, keylen, comment,
+                             commentlen,
+                             key_type | LIBSSH2_KNOWNHOST_TYPE_SHA1 | 
+                             LIBSSH2_KNOWNHOST_KEYENC_BASE64, NULL);
+    }
+    else
+        return 0; /* XXX: This should be an error, shouldn't it? */
+}
+
+/*
+ * hostline()
+ *
+ * Parse a single known_host line pre-split into host and key.
+ *
+ * The key part may include an optional comment which will be parsed here
+ * for ssh-rsa and ssh-dsa keys.  Comments in other key types aren't handled.
+ *
+ * The function assumes new-lines have already been removed from the arguments.
+ */
+static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
+                    const char *host, size_t hostlen,
+                    const char *key, size_t keylen)
+{
+    const char *comment = NULL;
+    size_t commentlen = 0;
+    int key_type;
+
+    /* make some checks that the lengths seem sensible */
+    if(keylen < 20)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Failed to parse known_hosts line "
+                              "(key too short)");
+    
+    switch(key[0]) {
+    case '0': case '1': case '2': case '3': case '4':
+    case '5': case '6': case '7': case '8': case '9':
+        key_type = LIBSSH2_KNOWNHOST_KEY_RSA1;
+
+        /* Note that the old-style keys (RSA1) aren't truly base64, but we
+         * claim it is for now since we can get away with strcmp()ing the
+         * entire anything anyway! We need to check and fix these to make them
+         * work properly.
+         */
+        break;
+
+    case 's': /* ssh-dss or ssh-rsa */
+        if(!strncmp(key, "ssh-dss", 7))
+            key_type = LIBSSH2_KNOWNHOST_KEY_SSHDSS;
+        else if(!strncmp(key, "ssh-rsa", 7))
+            key_type = LIBSSH2_KNOWNHOST_KEY_SSHRSA;
+        else
+            /* unknown key type */
+            return _libssh2_error(hosts->session,
+                                  LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                                  "Unknown key type");
+
+        key += 7;
+        keylen -= 7;
+
+        /* skip whitespaces */
+        while((*key ==' ') || (*key == '\t')) {
+            key++;
+            keylen--;
+        }
+
+        comment = key;
+        commentlen = keylen;
+
+        /* move over key */
+        while(commentlen && *comment &&
+              (*comment != ' ') && (*comment != '\t')) {
+            comment++;
+            commentlen--;
+        }
+
+        /* reduce key by comment length */
+        keylen -= commentlen;
+
+        /* Distinguish empty comment (a space) from no comment (no space) */
+        if (commentlen == 0)
+            comment = NULL;
+
+        /* skip whitespaces */
+        while(commentlen && *comment &&
+              ((*comment ==' ') || (*comment == '\t'))) {
+            comment++;
+            commentlen--;
+        }
+        break;
+
+    default: /* unknown key format */
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unknown key format");
+    }
+
+    /* Figure out host format */
+    if((hostlen >2) && memcmp(host, "|1|", 3)) {
+        /* old style plain text: [name]([,][name])*
+
+           for the sake of simplicity, we add them as separate hosts with the
+           same key
+        */
+        return oldstyle_hostline(hosts, host, hostlen, key, keylen, key_type,
+                                 comment, commentlen);
+    }
+    else {
+        /* |1|[salt]|[hash] */
+        return hashed_hostline(hosts, host, hostlen, key, keylen, key_type,
+                               comment, commentlen);
+    }
+}
+
+/*
+ * libssh2_knownhost_readline()
+ *
+ * Pass in a line of a file of 'type'.
+ *
+ * LIBSSH2_KNOWNHOST_FILE_OPENSSH is the only supported type.
+ *
+ * OpenSSH line format:
+ *
+ * <host> <key>
+ *
+ * Where the two parts can be created like:
+ *
+ * <host> can be either
+ * <name> or <hash>
+ *
+ * <name> consists of
+ * [name] optionally followed by [,name] one or more times
+ *
+ * <hash> consists of
+ * |1|<salt>|hash
+ *
+ * <key> can be one of:
+ * [RSA bits] [e] [n as a decimal number]
+ * 'ssh-dss' [base64-encoded-key]
+ * 'ssh-rsa' [base64-encoded-key]
+ *
+ */
+LIBSSH2_API int
+libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts,
+                           const char *line, size_t len, int type)
+{
+    const char *cp;
+    const char *hostp;
+    const char *keyp;
+    size_t hostlen;
+    size_t keylen;
+    int rc;
+
+    if(type != LIBSSH2_KNOWNHOST_FILE_OPENSSH)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unsupported type of known-host information "
+                              "store");
+
+    cp = line;
+
+    /* skip leading whitespaces */
+    while(len && ((*cp==' ') || (*cp == '\t'))) {
+        cp++;
+        len--;
+    }
+
+    if(!len || !*cp || (*cp == '#') || (*cp == '\n'))
+        /* comment or empty line */
+        return LIBSSH2_ERROR_NONE;
+
+    /* the host part starts here */
+    hostp = cp;
+
+    /* move over the host to the separator */
+    while(len && *cp && (*cp!=' ') && (*cp != '\t')) {
+        cp++;
+        len--;
+    }
+
+    hostlen = cp - hostp;
+
+    /* the key starts after the whitespaces */
+    while(len && *cp && ((*cp==' ') || (*cp == '\t'))) {
+        cp++;
+        len--;
+    }
+
+    if(!*cp || !len) /* illegal line */
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Failed to parse known_hosts line");
+
+    keyp = cp; /* the key starts here */
+    keylen = len;
+
+    /* check if the line (key) ends with a newline and if so kill it */
+    while(len && *cp && (*cp != '\n')) {
+        cp++;
+        len--;
+    }
+
+    /* zero terminate where the newline is */
+    if(*cp == '\n')
+        keylen--; /* don't include this in the count */
+
+    /* deal with this one host+key line */
+    rc = hostline(hosts, hostp, hostlen, keyp, keylen);
+    if(rc)
+        return rc; /* failed */
+
+    return LIBSSH2_ERROR_NONE; /* success */
+}
+
+/*
+ * libssh2_knownhost_readfile
+ *
+ * Read hosts+key pairs from a given file.
+ *
+ * Returns a negative value for error or number of successfully added hosts.
+ *
+ */
+
+LIBSSH2_API int
+libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts,
+                           const char *filename, int type)
+{
+    FILE *file;
+    int num = 0;
+    char buf[2048];
+
+    if(type != LIBSSH2_KNOWNHOST_FILE_OPENSSH)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unsupported type of known-host information "
+                              "store");
+
+    file = fopen(filename, "r");
+    if(file) {
+        while(fgets(buf, sizeof(buf), file)) {
+            if(libssh2_knownhost_readline(hosts, buf, strlen(buf), type)) {
+                num = _libssh2_error(hosts->session, LIBSSH2_ERROR_KNOWN_HOSTS,
+                                     "Failed to parse known hosts file");
+                break;
+            }
+            num++;
+        }
+        fclose(file);
+    }
+    else
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_FILE,
+                              "Failed to open file");
+
+    return num;
+}
+
+/*
+ * knownhost_writeline()
+ *
+ * Ask libssh2 to convert a known host to an output line for storage.
+ *
+ * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given
+ * output buffer is too small to hold the desired output. The 'outlen' field
+ * will then contain the size libssh2 wanted to store, which then is the
+ * smallest sufficient buffer it would require.
+ *
+ */
+static int
+knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
+                    struct known_host *node,
+                    char *buf, size_t buflen,
+                    size_t *outlen, int type)
+{
+    int rc = LIBSSH2_ERROR_NONE;
+    int tindex;
+    const char *keytypes[4]={
+        "", /* not used */
+        "", /* this type has no name in the file */
+        " ssh-rsa",
+        " ssh-dss"
+    };
+    const char *keytype;
+    size_t nlen;
+    size_t commentlen = 0;
+
+    /* we only support this single file type for now, bail out on all other
+       attempts */
+    if(type != LIBSSH2_KNOWNHOST_FILE_OPENSSH)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unsupported type of known-host information "
+                              "store");
+
+    tindex = (node->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) >>
+        LIBSSH2_KNOWNHOST_KEY_SHIFT;
+
+    /* set the string used in the file */
+    keytype = keytypes[tindex];
+
+    /* calculate extra space needed for comment */
+    if(node->comment)
+        commentlen = strlen(node->comment) + 1;
+
+    if((node->typemask & LIBSSH2_KNOWNHOST_TYPE_MASK) ==
+       LIBSSH2_KNOWNHOST_TYPE_SHA1) {
+        char *namealloc;
+        char *saltalloc;
+        nlen = _libssh2_base64_encode(hosts->session, node->name,
+                                      node->name_len, &namealloc);
+        if(!nlen)
+            return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "base64-encoded host name");
+
+        nlen = _libssh2_base64_encode(hosts->session,
+                                      node->salt, node->salt_len,
+                                      &saltalloc);
+        if(!nlen) {
+            free(namealloc);
+            return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "base64-encoded salt");
+        }
+
+        nlen = strlen(saltalloc) + strlen(namealloc) + strlen(keytype) +
+            strlen(node->key) + commentlen + 7;
+        /* |1| + | + ' ' + \n + \0 = 7 */
+
+        if(nlen <= buflen)
+            if(node->comment)
+                snprintf(buf, buflen, "|1|%s|%s%s %s %s\n", saltalloc, namealloc,
+                        keytype, node->key, node->comment);
+            else
+                snprintf(buf, buflen, "|1|%s|%s%s %s\n", saltalloc, namealloc,
+                        keytype, node->key);
+        else
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_BUFFER_TOO_SMALL,
+                                "Known-host write buffer too small");
+
+        free(namealloc);
+        free(saltalloc);
+    }
+    else {
+        nlen = strlen(node->name) + strlen(keytype) + strlen(node->key) +
+            commentlen + 3;
+        /* ' ' + '\n' + \0 = 3 */
+        if(nlen <= buflen)
+            /* these types have the plain name */
+            if(node->comment)
+                snprintf(buf, buflen, "%s%s %s %s\n", node->name, keytype, node->key,
+                        node->comment);
+            else
+                snprintf(buf, buflen, "%s%s %s\n", node->name, keytype, node->key);
+        else
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_BUFFER_TOO_SMALL,
+                                "Known-host write buffer too small");
+    }
+
+    /* we report the full length of the data with the trailing zero excluded */
+    *outlen = nlen-1;
+
+    return rc;
+}
+
+/*
+ * libssh2_knownhost_writeline()
+ *
+ * Ask libssh2 to convert a known host to an output line for storage.
+ *
+ * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given
+ * output buffer is too small to hold the desired output.
+ */
+LIBSSH2_API int
+libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
+                            struct libssh2_knownhost *known,
+                            char *buffer, size_t buflen,
+                            size_t *outlen, /* the amount of written data */
+                            int type)
+{
+    struct known_host *node;
+
+    if(known->magic != KNOWNHOST_MAGIC)
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_INVAL,
+                              "Invalid host information");
+
+    node = known->node;
+
+    return knownhost_writeline(hosts, node, buffer, buflen, outlen, type);
+}
+
+/*
+ * libssh2_knownhost_writefile()
+ *
+ * Write hosts+key pairs to the given file.
+ */
+LIBSSH2_API int
+libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts,
+                            const char *filename, int type)
+{
+    struct known_host *node;
+    FILE *file;
+    int rc = LIBSSH2_ERROR_NONE;
+    char buffer[2048];
+
+    /* we only support this single file type for now, bail out on all other
+       attempts */
+    if(type != LIBSSH2_KNOWNHOST_FILE_OPENSSH)
+        return _libssh2_error(hosts->session,
+                              LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
+                              "Unsupported type of known-host information "
+                              "store");
+
+    file = fopen(filename, "w");
+    if(!file)
+        return _libssh2_error(hosts->session, LIBSSH2_ERROR_FILE,
+                              "Failed to open file");
+
+    for(node = _libssh2_list_first(&hosts->head);
+        node;
+        node= _libssh2_list_next(&node->node) ) {
+        size_t wrote;
+        size_t nwrote;
+        rc = knownhost_writeline(hosts, node, buffer, sizeof(buffer), &wrote,
+                                 type);
+        if(rc)
+            break;
+
+        nwrote = fwrite(buffer, 1, wrote, file);
+        if(nwrote != wrote) {
+            /* failed to write the whole thing, bail out */
+            rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_FILE,
+                                "Write failed");
+            break;
+        }
+    }
+    fclose(file);
+
+    return rc;
+}
+
+
+/*
+ * libssh2_knownhost_get()
+ *
+ * Traverse the internal list of known hosts. Pass NULL to 'prev' to get
+ * the first one.
+ *
+ * Returns:
+ * 0 if a fine host was stored in 'store'
+ * 1 if end of hosts
+ * [negative] on errors
+ */
+LIBSSH2_API int
+libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts,
+                      struct libssh2_knownhost **ext,
+                      struct libssh2_knownhost *oprev)
+{
+    struct known_host *node;
+    if(oprev && oprev->node) {
+        /* we have a starting point */
+        struct known_host *prev = oprev->node;
+
+        /* get the next node in the list */
+        node = _libssh2_list_next(&prev->node);
+
+    }
+    else
+        node = _libssh2_list_first(&hosts->head);
+
+    if(!node)
+        /* no (more) node */
+        return 1;
+
+    *ext = knownhost_to_external(node);
+
+    return 0;
+}
diff --git a/pgadmin/libssh2/libgcrypt.c b/pgadmin/libssh2/libgcrypt.c
new file mode 100644
index 0000000..29770c7
--- /dev/null
+++ b/pgadmin/libssh2/libgcrypt.c
@@ -0,0 +1,587 @@
+/* Copyright (C) 2008, 2009, Simon Josefsson
+ * Copyright (C) 2006, 2007, The Written Word, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#ifdef LIBSSH2_LIBGCRYPT /* compile only if we build with libgcrypt */
+
+#include <string.h>
+
+int
+_libssh2_rsa_new(libssh2_rsa_ctx ** rsa,
+                 const unsigned char *edata,
+                 unsigned long elen,
+                 const unsigned char *ndata,
+                 unsigned long nlen,
+                 const unsigned char *ddata,
+                 unsigned long dlen,
+                 const unsigned char *pdata,
+                 unsigned long plen,
+                 const unsigned char *qdata,
+                 unsigned long qlen,
+                 const unsigned char *e1data,
+                 unsigned long e1len,
+                 const unsigned char *e2data,
+                 unsigned long e2len,
+                 const unsigned char *coeffdata, unsigned long coefflen)
+{
+    int rc;
+    (void) e1data;
+    (void) e1len;
+    (void) e2data;
+    (void) e2len;
+
+    if (ddata) {
+        rc = gcry_sexp_build
+            (rsa, NULL,
+             "(private-key(rsa(n%b)(e%b)(d%b)(q%b)(p%b)(u%b)))",
+             nlen, ndata, elen, edata, dlen, ddata, plen, pdata,
+             qlen, qdata, coefflen, coeffdata);
+    } else {
+        rc = gcry_sexp_build(rsa, NULL, "(public-key(rsa(n%b)(e%b)))",
+                             nlen, ndata, elen, edata);
+    }
+    if (rc) {
+        *rsa = NULL;
+        return -1;
+    }
+
+    return 0;
+}
+
+int
+_libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa,
+                         const unsigned char *sig,
+                         unsigned long sig_len,
+                         const unsigned char *m, unsigned long m_len)
+{
+    unsigned char hash[SHA_DIGEST_LENGTH];
+    gcry_sexp_t s_sig, s_hash;
+    int rc = -1;
+
+    libssh2_sha1(m, m_len, hash);
+
+    rc = gcry_sexp_build(&s_hash, NULL,
+                         "(data (flags pkcs1) (hash sha1 %b))",
+                         SHA_DIGEST_LENGTH, hash);
+    if (rc != 0) {
+        return -1;
+    }
+
+    rc = gcry_sexp_build(&s_sig, NULL, "(sig-val(rsa(s %b)))", sig_len, sig);
+    if (rc != 0) {
+        gcry_sexp_release(s_hash);
+        return -1;
+    }
+
+    rc = gcry_pk_verify(s_sig, s_hash, rsa);
+    gcry_sexp_release(s_sig);
+    gcry_sexp_release(s_hash);
+
+    return (rc == 0) ? 0 : -1;
+}
+
+int
+_libssh2_dsa_new(libssh2_dsa_ctx ** dsactx,
+                 const unsigned char *p,
+                 unsigned long p_len,
+                 const unsigned char *q,
+                 unsigned long q_len,
+                 const unsigned char *g,
+                 unsigned long g_len,
+                 const unsigned char *y,
+                 unsigned long y_len,
+                 const unsigned char *x, unsigned long x_len)
+{
+    int rc;
+
+    if (x_len) {
+        rc = gcry_sexp_build
+            (dsactx, NULL,
+             "(private-key(dsa(p%b)(q%b)(g%b)(y%b)(x%b)))",
+             p_len, p, q_len, q, g_len, g, y_len, y, x_len, x);
+    } else {
+        rc = gcry_sexp_build(dsactx, NULL,
+                             "(public-key(dsa(p%b)(q%b)(g%b)(y%b)))",
+                             p_len, p, q_len, q, g_len, g, y_len, y);
+    }
+
+    if (rc) {
+        *dsactx = NULL;
+        return -1;
+    }
+
+    return 0;
+}
+
+int
+_libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa,
+                         LIBSSH2_SESSION * session,
+                         const char *filename, unsigned const char *passphrase)
+{
+    FILE *fp;
+    unsigned char *data, *save_data;
+    unsigned int datalen;
+    int ret;
+    unsigned char *n, *e, *d, *p, *q, *e1, *e2, *coeff;
+    unsigned int nlen, elen, dlen, plen, qlen, e1len, e2len, coefflen;
+
+    (void) passphrase;
+
+    fp = fopen(filename, "r");
+    if (!fp) {
+        return -1;
+    }
+
+    ret = _libssh2_pem_parse(session,
+                             "-----BEGIN RSA PRIVATE KEY-----",
+                             "-----END RSA PRIVATE KEY-----",
+                             fp, &data, &datalen);
+    fclose(fp);
+    if (ret) {
+        return -1;
+    }
+
+    save_data = data;
+
+    if (_libssh2_pem_decode_sequence(&data, &datalen)) {
+        ret = -1;
+        goto fail;
+    }
+/* First read Version field (should be 0). */
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &n, &nlen);
+    if (ret != 0 || (nlen != 1 && *n != '\0')) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &n, &nlen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &e, &elen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &d, &dlen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &p, &plen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &q, &qlen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &e1, &e1len);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &e2, &e2len);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &coeff, &coefflen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    if (_libssh2_rsa_new(rsa, e, elen, n, nlen, d, dlen, p, plen,
+                         q, qlen, e1, e1len, e2, e2len, coeff, coefflen)) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = 0;
+
+  fail:
+    LIBSSH2_FREE(session, save_data);
+    return ret;
+}
+
+int
+_libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa,
+                         LIBSSH2_SESSION * session,
+                         const char *filename, unsigned const char *passphrase)
+{
+    FILE *fp;
+    unsigned char *data, *save_data;
+    unsigned int datalen;
+    int ret;
+    unsigned char *p, *q, *g, *y, *x;
+    unsigned int plen, qlen, glen, ylen, xlen;
+
+    (void) passphrase;
+
+    fp = fopen(filename, "r");
+    if (!fp) {
+        return -1;
+    }
+
+    ret = _libssh2_pem_parse(session,
+                             "-----BEGIN DSA PRIVATE KEY-----",
+                             "-----END DSA PRIVATE KEY-----",
+                             fp, &data, &datalen);
+    fclose(fp);
+    if (ret) {
+        return -1;
+    }
+
+    save_data = data;
+
+    if (_libssh2_pem_decode_sequence(&data, &datalen)) {
+        ret = -1;
+        goto fail;
+    }
+
+/* First read Version field (should be 0). */
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &p, &plen);
+    if (ret != 0 || (plen != 1 && *p != '\0')) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &p, &plen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &q, &qlen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &g, &glen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &y, &ylen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = _libssh2_pem_decode_integer(&data, &datalen, &x, &xlen);
+    if (ret != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    if (datalen != 0) {
+        ret = -1;
+        goto fail;
+    }
+
+    if (_libssh2_dsa_new(dsa, p, plen, q, qlen, g, glen, y, ylen, x, xlen)) {
+        ret = -1;
+        goto fail;
+    }
+
+    ret = 0;
+
+  fail:
+    LIBSSH2_FREE(session, save_data);
+    return ret;
+}
+
+int
+_libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session,
+                       libssh2_dsa_ctx * rsactx,
+                       const unsigned char *hash,
+                       size_t hash_len,
+                       unsigned char **signature, size_t *signature_len)
+{
+    gcry_sexp_t sig_sexp;
+    gcry_sexp_t data;
+    int rc;
+    const char *tmp;
+    size_t size;
+
+    if (hash_len != SHA_DIGEST_LENGTH) {
+        return -1;
+    }
+
+    if (gcry_sexp_build(&data, NULL,
+                        "(data (flags pkcs1) (hash sha1 %b))",
+                        hash_len, hash)) {
+        return -1;
+    }
+
+    rc = gcry_pk_sign(&sig_sexp, data, rsactx);
+
+    gcry_sexp_release(data);
+
+    if (rc != 0) {
+        return -1;
+    }
+
+    data = gcry_sexp_find_token(sig_sexp, "s", 0);
+    if (!data) {
+        return -1;
+    }
+
+    tmp = gcry_sexp_nth_data(data, 1, &size);
+    if (!tmp) {
+        return -1;
+    }
+
+    if (tmp[0] == '\0') {
+        tmp++;
+        size--;
+    }
+
+    *signature = LIBSSH2_ALLOC(session, size);
+    memcpy(*signature, tmp, size);
+    *signature_len = size;
+
+    return rc;
+}
+
+int
+_libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx,
+                       const unsigned char *hash,
+                       unsigned long hash_len, unsigned char *sig)
+{
+    unsigned char zhash[SHA_DIGEST_LENGTH + 1];
+    gcry_sexp_t sig_sexp;
+    gcry_sexp_t data;
+    int ret;
+    const char *tmp;
+    size_t size;
+
+    if (hash_len != SHA_DIGEST_LENGTH) {
+        return -1;
+    }
+
+    memcpy(zhash + 1, hash, hash_len);
+    zhash[0] = 0;
+
+    if (gcry_sexp_build(&data, NULL, "(data (value %b))", hash_len + 1, zhash)) {
+        return -1;
+    }
+
+    ret = gcry_pk_sign(&sig_sexp, data, dsactx);
+
+    gcry_sexp_release(data);
+
+    if (ret != 0) {
+        return -1;
+    }
+
+    memset(sig, 0, 40);
+
+/* Extract R. */
+
+    data = gcry_sexp_find_token(sig_sexp, "r", 0);
+    if (!data)
+        goto err;
+
+    tmp = gcry_sexp_nth_data(data, 1, &size);
+    if (!tmp)
+        goto err;
+
+    if (tmp[0] == '\0') {
+        tmp++;
+        size--;
+    }
+
+    if (size < 1 || size > 20)
+        goto err;
+
+    memcpy(sig + (20 - size), tmp, size);
+
+    gcry_sexp_release(data);
+
+/* Extract S. */
+
+    data = gcry_sexp_find_token(sig_sexp, "s", 0);
+    if (!data)
+        goto err;
+
+    tmp = gcry_sexp_nth_data(data, 1, &size);
+    if (!tmp)
+        goto err;
+
+    if (tmp[0] == '\0') {
+        tmp++;
+        size--;
+    }
+
+    if (size < 1 || size > 20)
+        goto err;
+
+    memcpy(sig + 20 + (20 - size), tmp, size);
+    goto out;
+
+  err:
+    ret = -1;
+
+  out:
+    if (sig_sexp) {
+        gcry_sexp_release(sig_sexp);
+    }
+    if (data) {
+        gcry_sexp_release(data);
+    }
+    return ret;
+}
+
+int
+_libssh2_dsa_sha1_verify(libssh2_dsa_ctx * dsactx,
+                         const unsigned char *sig,
+                         const unsigned char *m, unsigned long m_len)
+{
+    unsigned char hash[SHA_DIGEST_LENGTH + 1];
+    gcry_sexp_t s_sig, s_hash;
+    int rc = -1;
+
+    libssh2_sha1(m, m_len, hash + 1);
+    hash[0] = 0;
+
+    if (gcry_sexp_build(&s_hash, NULL, "(data(flags raw)(value %b))",
+                        SHA_DIGEST_LENGTH + 1, hash)) {
+        return -1;
+    }
+
+    if (gcry_sexp_build(&s_sig, NULL, "(sig-val(dsa(r %b)(s %b)))",
+                        20, sig, 20, sig + 20)) {
+        gcry_sexp_release(s_hash);
+        return -1;
+    }
+
+    rc = gcry_pk_verify(s_sig, s_hash, dsactx);
+    gcry_sexp_release(s_sig);
+    gcry_sexp_release(s_hash);
+
+    return (rc == 0) ? 0 : -1;
+}
+
+int
+_libssh2_cipher_init(_libssh2_cipher_ctx * h,
+                     _libssh2_cipher_type(algo),
+                     unsigned char *iv, unsigned char *secret, int encrypt)
+{
+    int ret;
+    int cipher = _libssh2_gcry_cipher (algo);
+    int mode = _libssh2_gcry_mode (algo);
+    int keylen = gcry_cipher_get_algo_keylen(cipher);
+
+    (void) encrypt;
+
+    ret = gcry_cipher_open(h, cipher, mode, 0);
+    if (ret) {
+        return -1;
+    }
+
+    ret = gcry_cipher_setkey(*h, secret, keylen);
+    if (ret) {
+        gcry_cipher_close(*h);
+        return -1;
+    }
+
+    if (mode != GCRY_CIPHER_MODE_STREAM) {
+        int blklen = gcry_cipher_get_algo_blklen(cipher);
+        if (mode == GCRY_CIPHER_MODE_CTR)
+            ret = gcry_cipher_setctr(*h, iv, blklen);
+        else
+            ret = gcry_cipher_setiv(*h, iv, blklen);
+        if (ret) {
+            gcry_cipher_close(*h);
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+int
+_libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx,
+                      _libssh2_cipher_type(algo),
+                      int encrypt, unsigned char *block, size_t blklen)
+{
+    int cipher = _libssh2_gcry_cipher (algo);
+    int ret;
+
+    if (encrypt) {
+        ret = gcry_cipher_encrypt(*ctx, block, blklen, block, blklen);
+    } else {
+        ret = gcry_cipher_decrypt(*ctx, block, blklen, block, blklen);
+    }
+    return ret;
+}
+
+int
+_libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
+                          unsigned char **method,
+                          size_t *method_len,
+                          unsigned char **pubkeydata,
+                          size_t *pubkeydata_len,
+                          const char *privatekey,
+                          const char *passphrase)
+{
+    return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                         "Unable to extract public key from private key file: "
+                         "Method unimplemented in libgcrypt backend");
+}
+
+void _libssh2_init_aes_ctr(void)
+{
+    /* no implementation */
+}
+#endif /* LIBSSH2_LIBGCRYPT */
diff --git a/pgadmin/libssh2/mac.c b/pgadmin/libssh2/mac.c
new file mode 100644
index 0000000..76894fc
--- /dev/null
+++ b/pgadmin/libssh2/mac.c
@@ -0,0 +1,314 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "mac.h"
+
+#ifdef LIBSSH2_MAC_NONE
+/* mac_none_MAC
+ * Minimalist MAC: No MAC
+ */
+static int
+mac_none_MAC(LIBSSH2_SESSION * session, unsigned char *buf,
+             uint32_t seqno, const unsigned char *packet,
+             uint32_t packet_len, const unsigned char *addtl,
+             uint32_t addtl_len, void **abstract)
+{
+    return 0;
+}
+
+
+
+
+static LIBSSH2_MAC_METHOD mac_method_none = {
+    "none",
+    0,
+    0,
+    NULL,
+    mac_none_MAC,
+    NULL
+};
+#endif /* LIBSSH2_MAC_NONE */
+
+/* mac_method_common_init
+ * Initialize simple mac methods
+ */
+static int
+mac_method_common_init(LIBSSH2_SESSION * session, unsigned char *key,
+                       int *free_key, void **abstract)
+{
+    *abstract = key;
+    *free_key = 0;
+    (void) session;
+
+    return 0;
+}
+
+
+
+/* mac_method_common_dtor
+ * Cleanup simple mac methods
+ */
+static int
+mac_method_common_dtor(LIBSSH2_SESSION * session, void **abstract)
+{
+    if (*abstract) {
+        LIBSSH2_FREE(session, *abstract);
+    }
+    *abstract = NULL;
+
+    return 0;
+}
+
+
+
+/* mac_method_hmac_sha1_hash
+ * Calculate hash using full sha1 value
+ */
+static int
+mac_method_hmac_sha1_hash(LIBSSH2_SESSION * session,
+                          unsigned char *buf, uint32_t seqno,
+                          const unsigned char *packet,
+                          uint32_t packet_len,
+                          const unsigned char *addtl,
+                          uint32_t addtl_len, void **abstract)
+{
+    libssh2_hmac_ctx ctx;
+    unsigned char seqno_buf[4];
+    (void) session;
+
+    _libssh2_htonu32(seqno_buf, seqno);
+
+    libssh2_hmac_sha1_init(&ctx, *abstract, 20);
+    libssh2_hmac_update(ctx, seqno_buf, 4);
+    libssh2_hmac_update(ctx, packet, packet_len);
+    if (addtl && addtl_len) {
+        libssh2_hmac_update(ctx, addtl, addtl_len);
+    }
+    libssh2_hmac_final(ctx, buf);
+    libssh2_hmac_cleanup(&ctx);
+
+    return 0;
+}
+
+
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_sha1 = {
+    "hmac-sha1",
+    20,
+    20,
+    mac_method_common_init,
+    mac_method_hmac_sha1_hash,
+    mac_method_common_dtor,
+};
+
+/* mac_method_hmac_sha1_96_hash
+ * Calculate hash using first 96 bits of sha1 value
+ */
+static int
+mac_method_hmac_sha1_96_hash(LIBSSH2_SESSION * session,
+                             unsigned char *buf, uint32_t seqno,
+                             const unsigned char *packet,
+                             uint32_t packet_len,
+                             const unsigned char *addtl,
+                             uint32_t addtl_len, void **abstract)
+{
+    unsigned char temp[SHA_DIGEST_LENGTH];
+
+    mac_method_hmac_sha1_hash(session, temp, seqno, packet, packet_len,
+                              addtl, addtl_len, abstract);
+    memcpy(buf, (char *) temp, 96 / 8);
+
+    return 0;
+}
+
+
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_sha1_96 = {
+    "hmac-sha1-96",
+    12,
+    20,
+    mac_method_common_init,
+    mac_method_hmac_sha1_96_hash,
+    mac_method_common_dtor,
+};
+
+#if LIBSSH2_MD5
+/* mac_method_hmac_md5_hash
+ * Calculate hash using full md5 value
+ */
+static int
+mac_method_hmac_md5_hash(LIBSSH2_SESSION * session, unsigned char *buf,
+                         uint32_t seqno,
+                         const unsigned char *packet,
+                         uint32_t packet_len,
+                         const unsigned char *addtl,
+                         uint32_t addtl_len, void **abstract)
+{
+    libssh2_hmac_ctx ctx;
+    unsigned char seqno_buf[4];
+    (void) session;
+
+    _libssh2_htonu32(seqno_buf, seqno);
+
+    libssh2_hmac_md5_init(&ctx, *abstract, 16);
+    libssh2_hmac_update(ctx, seqno_buf, 4);
+    libssh2_hmac_update(ctx, packet, packet_len);
+    if (addtl && addtl_len) {
+        libssh2_hmac_update(ctx, addtl, addtl_len);
+    }
+    libssh2_hmac_final(ctx, buf);
+    libssh2_hmac_cleanup(&ctx);
+
+    return 0;
+}
+
+
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_md5 = {
+    "hmac-md5",
+    16,
+    16,
+    mac_method_common_init,
+    mac_method_hmac_md5_hash,
+    mac_method_common_dtor,
+};
+
+/* mac_method_hmac_md5_96_hash
+ * Calculate hash using first 96 bits of md5 value
+ */
+static int
+mac_method_hmac_md5_96_hash(LIBSSH2_SESSION * session,
+                            unsigned char *buf, uint32_t seqno,
+                            const unsigned char *packet,
+                            uint32_t packet_len,
+                            const unsigned char *addtl,
+                            uint32_t addtl_len, void **abstract)
+{
+    unsigned char temp[MD5_DIGEST_LENGTH];
+    mac_method_hmac_md5_hash(session, temp, seqno, packet, packet_len,
+                             addtl, addtl_len, abstract);
+    memcpy(buf, (char *) temp, 96 / 8);
+    return 0;
+}
+
+
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_md5_96 = {
+    "hmac-md5-96",
+    12,
+    16,
+    mac_method_common_init,
+    mac_method_hmac_md5_96_hash,
+    mac_method_common_dtor,
+};
+#endif /* LIBSSH2_MD5 */
+
+#if LIBSSH2_HMAC_RIPEMD
+/* mac_method_hmac_ripemd160_hash
+ * Calculate hash using ripemd160 value
+ */
+static int
+mac_method_hmac_ripemd160_hash(LIBSSH2_SESSION * session,
+                               unsigned char *buf, uint32_t seqno,
+                               const unsigned char *packet,
+                               uint32_t packet_len,
+                               const unsigned char *addtl,
+                               uint32_t addtl_len,
+                               void **abstract)
+{
+    libssh2_hmac_ctx ctx;
+    unsigned char seqno_buf[4];
+    (void) session;
+
+    _libssh2_htonu32(seqno_buf, seqno);
+
+    libssh2_hmac_ripemd160_init(&ctx, *abstract, 20);
+    libssh2_hmac_update(ctx, seqno_buf, 4);
+    libssh2_hmac_update(ctx, packet, packet_len);
+    if (addtl && addtl_len) {
+        libssh2_hmac_update(ctx, addtl, addtl_len);
+    }
+    libssh2_hmac_final(ctx, buf);
+    libssh2_hmac_cleanup(&ctx);
+
+    return 0;
+}
+
+
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_ripemd160 = {
+    "hmac-ripemd160",
+    20,
+    20,
+    mac_method_common_init,
+    mac_method_hmac_ripemd160_hash,
+    mac_method_common_dtor,
+};
+
+static const LIBSSH2_MAC_METHOD mac_method_hmac_ripemd160_openssh_com = {
+    "hmac-ripemd160@openssh.com",
+    20,
+    20,
+    mac_method_common_init,
+    mac_method_hmac_ripemd160_hash,
+    mac_method_common_dtor,
+};
+#endif /* LIBSSH2_HMAC_RIPEMD */
+
+static const LIBSSH2_MAC_METHOD *mac_methods[] = {
+    &mac_method_hmac_sha1,
+    &mac_method_hmac_sha1_96,
+#if LIBSSH2_MD5
+    &mac_method_hmac_md5,
+    &mac_method_hmac_md5_96,
+#endif
+#if LIBSSH2_HMAC_RIPEMD
+    &mac_method_hmac_ripemd160,
+    &mac_method_hmac_ripemd160_openssh_com,
+#endif /* LIBSSH2_HMAC_RIPEMD */
+#ifdef LIBSSH2_MAC_NONE
+    &mac_method_none,
+#endif /* LIBSSH2_MAC_NONE */
+    NULL
+};
+
+const LIBSSH2_MAC_METHOD **
+_libssh2_mac_methods(void)
+{
+    return mac_methods;
+}
diff --git a/pgadmin/libssh2/misc.c b/pgadmin/libssh2/misc.c
new file mode 100644
index 0000000..a9f423a
--- /dev/null
+++ b/pgadmin/libssh2/misc.c
@@ -0,0 +1,612 @@
+/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2010 by Daniel Stenberg
+ * Copyright (c) 2010  Simon Josefsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "misc.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+
+int _libssh2_error(LIBSSH2_SESSION* session, int errcode, const char* errmsg)
+{
+    session->err_msg = errmsg;
+    session->err_code = errcode;
+#ifdef LIBSSH2DEBUG
+    if((errcode == LIBSSH2_ERROR_EAGAIN) && !session->api_block_mode)
+        /* if this is EAGAIN and we're in non-blocking mode, don't generate
+           a debug output for this */
+        return errcode;
+    _libssh2_debug(session, LIBSSH2_TRACE_ERROR, "%d - %s", session->err_code,
+                   session->err_msg);
+#endif
+
+    return errcode;
+}
+
+#ifdef WIN32
+static int wsa2errno(void)
+{
+    switch (WSAGetLastError()) {
+    case WSAEWOULDBLOCK:
+        return EAGAIN;
+
+    case WSAENOTSOCK:
+        return EBADF;
+
+    case WSAEINTR:
+        return EINTR;
+
+    default:
+        /* It is most important to ensure errno does not stay at EAGAIN
+         * when a different error occurs so just set errno to a generic
+         * error */
+        return EIO;
+    }
+}
+#endif
+
+/* _libssh2_recv
+ *
+ * Replacement for the standard recv, return -errno on failure.
+ */
+ssize_t
+_libssh2_recv(libssh2_socket_t sock, void *buffer, size_t length, int flags, void **abstract)
+{
+    ssize_t rc = recv(sock, buffer, length, flags);
+#ifdef WIN32
+    if (rc < 0 )
+        return -wsa2errno();
+#elif defined(__VMS)
+    if (rc < 0 ){
+        if ( errno == EWOULDBLOCK )
+            return -EAGAIN;
+        else
+            return -errno;
+    }
+#else
+    if (rc < 0 ){
+        /* Sometimes the first recv() function call sets errno to ENOENT on
+           Solaris and HP-UX */
+        if ( errno == ENOENT )
+            return -EAGAIN;
+        else
+            return -errno;
+    }
+#endif
+    return rc;
+}
+
+/* _libssh2_send
+ *
+ * Replacement for the standard send, return -errno on failure.
+ */
+ssize_t
+_libssh2_send(libssh2_socket_t sock, const void *buffer, size_t length,
+              int flags, void **abstract)
+{
+    ssize_t rc = send(sock, buffer, length, flags);
+#ifdef WIN32
+    if (rc < 0 )
+        return -wsa2errno();
+#elif defined(__VMS)
+    if (rc < 0 ) {
+        if ( errno == EWOULDBLOCK )
+            return -EAGAIN;
+        else
+            return -errno;
+    }
+#else
+    if (rc < 0 )
+        return -errno;
+#endif
+    return rc;
+}
+
+/* libssh2_ntohu32
+ */
+unsigned int
+_libssh2_ntohu32(const unsigned char *buf)
+{
+    return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+}
+
+
+/* _libssh2_ntohu64
+ */
+libssh2_uint64_t
+_libssh2_ntohu64(const unsigned char *buf)
+{
+    unsigned long msl, lsl;
+
+    msl = ((libssh2_uint64_t)buf[0] << 24) | ((libssh2_uint64_t)buf[1] << 16)
+        | ((libssh2_uint64_t)buf[2] << 8) | (libssh2_uint64_t)buf[3];
+    lsl = ((libssh2_uint64_t)buf[4] << 24) | ((libssh2_uint64_t)buf[5] << 16)
+        | ((libssh2_uint64_t)buf[6] << 8) | (libssh2_uint64_t)buf[7];
+
+    return ((libssh2_uint64_t)msl <<32) | lsl;
+}
+
+/* _libssh2_htonu32
+ */
+void
+_libssh2_htonu32(unsigned char *buf, uint32_t value)
+{
+    buf[0] = (value >> 24) & 0xFF;
+    buf[1] = (value >> 16) & 0xFF;
+    buf[2] = (value >> 8) & 0xFF;
+    buf[3] = value & 0xFF;
+}
+
+/* _libssh2_store_u32
+ */
+void _libssh2_store_u32(unsigned char **buf, uint32_t value)
+{
+    _libssh2_htonu32(*buf, value);
+    *buf += sizeof(uint32_t);
+}
+
+/* _libssh2_store_str
+ */
+void _libssh2_store_str(unsigned char **buf, const char *str, size_t len)
+{
+    _libssh2_store_u32(buf, (uint32_t)len);
+    if(len) {
+        memcpy(*buf, str, len);
+        *buf += len;
+    }
+}
+
+/* Base64 Conversion */
+
+static const char base64_table[] =
+{
+    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+    'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+    'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0'
+};
+
+static const char base64_pad = '=';
+
+static const short base64_reverse_table[256] = {
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
+    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
+    -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
+    -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+/* libssh2_base64_decode
+ *
+ * Decode a base64 chunk and store it into a newly alloc'd buffer
+ */
+LIBSSH2_API int
+libssh2_base64_decode(LIBSSH2_SESSION *session, char **data,
+                      unsigned int *datalen, const char *src,
+                      unsigned int src_len)
+{
+    unsigned char *s, *d;
+    short v;
+    int i = 0, len = 0;
+
+    *data = LIBSSH2_ALLOC(session, (3 * src_len / 4) + 1);
+    d = (unsigned char *) *data;
+    if (!d) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate memory for base64 decoding");
+    }
+
+    for(s = (unsigned char *) src; ((char *) s) < (src + src_len); s++) {
+        if ((v = base64_reverse_table[*s]) < 0)
+            continue;
+        switch (i % 4) {
+        case 0:
+            d[len] = v << 2;
+            break;
+        case 1:
+            d[len++] |= v >> 4;
+            d[len] = v << 4;
+            break;
+        case 2:
+            d[len++] |= v >> 2;
+            d[len] = v << 6;
+            break;
+        case 3:
+            d[len++] |= v;
+            break;
+        }
+        i++;
+    }
+    if ((i % 4) == 1) {
+        /* Invalid -- We have a byte which belongs exclusively to a partial
+           octet */
+        LIBSSH2_FREE(session, *data);
+        return _libssh2_error(session, LIBSSH2_ERROR_INVAL, "Invalid base64");
+    }
+
+    *datalen = len;
+    return 0;
+}
+
+/* ---- Base64 Encoding/Decoding Table --- */
+static const char table64[]=
+  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/*
+ * _libssh2_base64_encode()
+ *
+ * Returns the length of the newly created base64 string. The third argument
+ * is a pointer to an allocated area holding the base64 data. If something
+ * went wrong, 0 is returned.
+ *
+ */
+size_t _libssh2_base64_encode(LIBSSH2_SESSION *session,
+                              const char *inp, size_t insize, char **outptr)
+{
+  unsigned char ibuf[3];
+  unsigned char obuf[4];
+  int i;
+  int inputparts;
+  char *output;
+  char *base64data;
+  const char *indata = inp;
+
+  *outptr = NULL; /* set to NULL in case of failure before we reach the end */
+
+  if(0 == insize)
+    insize = strlen(indata);
+
+  base64data = output = LIBSSH2_ALLOC(session, insize*4/3+4);
+  if(NULL == output)
+    return 0;
+
+  while(insize > 0) {
+    for (i = inputparts = 0; i < 3; i++) {
+      if(insize > 0) {
+        inputparts++;
+        ibuf[i] = *indata;
+        indata++;
+        insize--;
+      }
+      else
+        ibuf[i] = 0;
+    }
+
+    obuf[0] = (unsigned char)  ((ibuf[0] & 0xFC) >> 2);
+    obuf[1] = (unsigned char) (((ibuf[0] & 0x03) << 4) | \
+                               ((ibuf[1] & 0xF0) >> 4));
+    obuf[2] = (unsigned char) (((ibuf[1] & 0x0F) << 2) | \
+                               ((ibuf[2] & 0xC0) >> 6));
+    obuf[3] = (unsigned char)   (ibuf[2] & 0x3F);
+
+    switch(inputparts) {
+    case 1: /* only one byte read */
+      snprintf(output, 5, "%c%c==",
+               table64[obuf[0]],
+               table64[obuf[1]]);
+      break;
+    case 2: /* two bytes read */
+      snprintf(output, 5, "%c%c%c=",
+               table64[obuf[0]],
+               table64[obuf[1]],
+               table64[obuf[2]]);
+      break;
+    default:
+      snprintf(output, 5, "%c%c%c%c",
+               table64[obuf[0]],
+               table64[obuf[1]],
+               table64[obuf[2]],
+               table64[obuf[3]] );
+      break;
+    }
+    output += 4;
+  }
+  *output=0;
+  *outptr = base64data; /* make it return the actual data memory */
+
+  return strlen(base64data); /* return the length of the new data */
+}
+/* ---- End of Base64 Encoding ---- */
+
+LIBSSH2_API void
+libssh2_free(LIBSSH2_SESSION *session, void *ptr)
+{
+    LIBSSH2_FREE(session, ptr);
+}
+
+#ifdef LIBSSH2DEBUG
+LIBSSH2_API int
+libssh2_trace(LIBSSH2_SESSION * session, int bitmask)
+{
+    session->showmask = bitmask;
+    return 0;
+}
+
+LIBSSH2_API int
+libssh2_trace_sethandler(LIBSSH2_SESSION *session, void* handler_context,
+                         libssh2_trace_handler_func callback)
+{
+    session->tracehandler = callback;
+    session->tracehandler_context = handler_context;
+    return 0;
+}
+
+void
+_libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
+{
+    char buffer[1536];
+    int len, msglen, buflen = sizeof(buffer);
+    va_list vargs;
+    struct timeval now;
+    static int firstsec;
+    static const char *const contexts[] = {
+        "Unknown",
+        "Transport",
+        "Key Ex",
+        "Userauth",
+        "Conn",
+        "SCP",
+        "SFTP",
+        "Failure Event",
+        "Publickey",
+        "Socket",
+    };
+    const char* contexttext = contexts[0];
+    unsigned int contextindex;
+
+    if (!(session->showmask & context)) {
+        /* no such output asked for */
+        return;
+    }
+
+    /* Find the first matching context string for this message */
+    for (contextindex = 0; contextindex < ARRAY_SIZE(contexts);
+         contextindex++) {
+        if ((context & (1 << contextindex)) != 0) {
+            contexttext = contexts[contextindex];
+            break;
+        }
+    }
+
+    _libssh2_gettimeofday(&now, NULL);
+    if(!firstsec) {
+        firstsec = now.tv_sec;
+    }
+    now.tv_sec -= firstsec;
+
+    len = snprintf(buffer, buflen, "[libssh2] %d.%06d %s: ",
+                   (int)now.tv_sec, (int)now.tv_usec, contexttext);
+
+    if (len >= buflen)
+        msglen = buflen - 1;
+    else {
+        buflen -= len;
+        msglen = len;
+        va_start(vargs, format);
+        len = vsnprintf(buffer + msglen, buflen, format, vargs);
+        va_end(vargs);
+        msglen += len < buflen ? len : buflen - 1;
+    }
+
+    if (session->tracehandler)
+        (session->tracehandler)(session, session->tracehandler_context, buffer,
+                                msglen);
+    else
+        fprintf(stderr, "%s\n", buffer);
+}
+
+#else
+LIBSSH2_API int
+libssh2_trace(LIBSSH2_SESSION * session, int bitmask)
+{
+    (void) session;
+    (void) bitmask;
+    return 0;
+}
+
+LIBSSH2_API int
+libssh2_trace_sethandler(LIBSSH2_SESSION *session, void* handler_context,
+                         libssh2_trace_handler_func callback)
+{
+    (void) session;
+    (void) handler_context;
+    (void) callback;
+    return 0;
+}
+#endif
+
+/* init the list head */
+void _libssh2_list_init(struct list_head *head)
+{
+    head->first = head->last = NULL;
+}
+
+/* add a node to the list */
+void _libssh2_list_add(struct list_head *head,
+                       struct list_node *entry)
+{
+    /* store a pointer to the head */
+    entry->head = head;
+
+    /* we add this entry at the "top" so it has no next */
+    entry->next = NULL;
+
+    /* make our prev point to what the head thinks is last */
+    entry->prev = head->last;
+
+    /* and make head's last be us now */
+    head->last = entry;
+
+    /* make sure our 'prev' node points to us next */
+    if(entry->prev)
+        entry->prev->next = entry;
+    else
+        head->first = entry;
+}
+
+/* return the "first" node in the list this head points to */
+void *_libssh2_list_first(struct list_head *head)
+{
+    return head->first;
+}
+
+/* return the next node in the list */
+void *_libssh2_list_next(struct list_node *node)
+{
+    return node->next;
+}
+
+/* return the prev node in the list */
+void *_libssh2_list_prev(struct list_node *node)
+{
+    return node->prev;
+}
+
+/* remove this node from the list */
+void _libssh2_list_remove(struct list_node *entry)
+{
+    if(entry->prev)
+        entry->prev->next = entry->next;
+    else
+        entry->head->first = entry->next;
+
+    if(entry->next)
+        entry->next->prev = entry->prev;
+    else
+        entry->head->last = entry->prev;
+}
+
+#if 0
+/* insert a node before the given 'after' entry */
+void _libssh2_list_insert(struct list_node *after, /* insert before this */
+                          struct list_node *entry)
+{
+    /* 'after' is next to 'entry' */
+    bentry->next = after;
+
+    /* entry's prev is then made to be the prev after current has */
+    entry->prev = after->prev;
+
+    /* the node that is now before 'entry' was previously before 'after'
+       and must be made to point to 'entry' correctly */
+    if(entry->prev)
+        entry->prev->next = entry;
+    else
+      /* there was no node before this, so we make sure we point the head
+         pointer to this node */
+      after->head->first = entry;
+
+    /* after's prev entry points back to entry */
+    after->prev = entry;
+
+    /* after's next entry is still the same as before */
+
+    /* entry's head is the same as after's */
+    entry->head = after->head;
+}
+
+#endif
+
+/* this define is defined in misc.h for the correct platforms */
+#ifdef LIBSSH2_GETTIMEOFDAY_WIN32
+/*
+ * gettimeofday
+ * Implementation according to:
+ * The Open Group Base Specifications Issue 6
+ * IEEE Std 1003.1, 2004 Edition
+ */
+
+/*
+ *  THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ *  This source code is offered for use in the public domain. You may
+ *  use, modify or distribute it freely.
+ *
+ *  This code is distributed in the hope that it will be useful but
+ *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ *  DISCLAIMED. This includes but is not limited to warranties of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *  Contributed by:
+ *  Danny Smith <dannysmith@users.sourceforge.net>
+ */
+
+/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
+#define _W32_FT_OFFSET (116444736000000000)
+
+int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp)
+ {
+  union {
+    unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
+    FILETIME ft;
+  }  _now;
+
+  if(tp)
+    {
+      GetSystemTimeAsFileTime (&_now.ft);
+      tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
+      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
+    }
+  /* Always return 0 as per Open Group Base Specifications Issue 6.
+     Do not set errno on error.  */
+  return 0;
+}
+
+
+#endif
diff --git a/pgadmin/libssh2/module.mk b/pgadmin/libssh2/module.mk
new file mode 100644
index 0000000..6053edc
--- /dev/null
+++ b/pgadmin/libssh2/module.mk
@@ -0,0 +1,40 @@
+#######################################################################
+#
+# pgAdmin III - PostgreSQL Tools
+# 
+# Copyright (C) 2002 - 2012, The pgAdmin Development Team
+# This software is released under the PostgreSQL Licence
+#
+# module.mk - pgadmin/libssh2 Makefile fragment
+#
+#######################################################################
+
+if BUILD_SSH_TUNNEL
+
+pgadmin3_SOURCES += \
+	libssh2/agent.c \
+	libssh2/channel.c \
+    libssh2/comp.c \
+    libssh2/crypt.c \
+    libssh2/global.c \
+    libssh2/hostkey.c \
+    libssh2/keepalive.c \
+    libssh2/kex.c \
+    libssh2/knownhost.c \
+    libssh2/libgcrypt.c \
+    libssh2/mac.c \
+    libssh2/misc.c \
+    libssh2/openssl.c \
+    libssh2/packet.c \
+    libssh2/pem.c \
+    libssh2/publickey.c \
+    libssh2/scp.c \
+    libssh2/session.c \
+    libssh2/sftp.c \
+    libssh2/transport.c \
+    libssh2/userauth.c \
+    libssh2/version.c
+
+EXTRA_DIST += \
+	libssh2/module.mk
+endif
diff --git a/pgadmin/libssh2/openssl.c b/pgadmin/libssh2/openssl.c
new file mode 100644
index 0000000..29c8f47
--- /dev/null
+++ b/pgadmin/libssh2/openssl.c
@@ -0,0 +1,804 @@
+/* Copyright (C) 2009, 2010 Simon Josefsson
+ * Copyright (C) 2006, 2007 The Written Word, Inc.  All rights reserved.
+ * Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org>
+ *
+ * Author: Simon Josefsson
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#ifndef LIBSSH2_LIBGCRYPT /* compile only if we build with OpenSSL */
+
+#include <string.h>
+
+#ifndef EVP_MAX_BLOCK_LENGTH
+#define EVP_MAX_BLOCK_LENGTH 32
+#endif
+
+int
+_libssh2_rsa_new(libssh2_rsa_ctx ** rsa,
+                 const unsigned char *edata,
+                 unsigned long elen,
+                 const unsigned char *ndata,
+                 unsigned long nlen,
+                 const unsigned char *ddata,
+                 unsigned long dlen,
+                 const unsigned char *pdata,
+                 unsigned long plen,
+                 const unsigned char *qdata,
+                 unsigned long qlen,
+                 const unsigned char *e1data,
+                 unsigned long e1len,
+                 const unsigned char *e2data,
+                 unsigned long e2len,
+                 const unsigned char *coeffdata, unsigned long coefflen)
+{
+    *rsa = RSA_new();
+
+    (*rsa)->e = BN_new();
+    BN_bin2bn(edata, elen, (*rsa)->e);
+
+    (*rsa)->n = BN_new();
+    BN_bin2bn(ndata, nlen, (*rsa)->n);
+
+    if (ddata) {
+        (*rsa)->d = BN_new();
+        BN_bin2bn(ddata, dlen, (*rsa)->d);
+
+        (*rsa)->p = BN_new();
+        BN_bin2bn(pdata, plen, (*rsa)->p);
+
+        (*rsa)->q = BN_new();
+        BN_bin2bn(qdata, qlen, (*rsa)->q);
+
+        (*rsa)->dmp1 = BN_new();
+        BN_bin2bn(e1data, e1len, (*rsa)->dmp1);
+
+        (*rsa)->dmq1 = BN_new();
+        BN_bin2bn(e2data, e2len, (*rsa)->dmq1);
+
+        (*rsa)->iqmp = BN_new();
+        BN_bin2bn(coeffdata, coefflen, (*rsa)->iqmp);
+    }
+    return 0;
+}
+
+int
+_libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsactx,
+                         const unsigned char *sig,
+                         unsigned long sig_len,
+                         const unsigned char *m, unsigned long m_len)
+{
+    unsigned char hash[SHA_DIGEST_LENGTH];
+    int ret;
+
+    libssh2_sha1(m, m_len, hash);
+    ret = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH,
+                     (unsigned char *) sig, sig_len, rsactx);
+    return (ret == 1) ? 0 : -1;
+}
+
+#if LIBSSH2_DSA
+int
+_libssh2_dsa_new(libssh2_dsa_ctx ** dsactx,
+                 const unsigned char *p,
+                 unsigned long p_len,
+                 const unsigned char *q,
+                 unsigned long q_len,
+                 const unsigned char *g,
+                 unsigned long g_len,
+                 const unsigned char *y,
+                 unsigned long y_len,
+                 const unsigned char *x, unsigned long x_len)
+{
+    *dsactx = DSA_new();
+
+    (*dsactx)->p = BN_new();
+    BN_bin2bn(p, p_len, (*dsactx)->p);
+
+    (*dsactx)->q = BN_new();
+    BN_bin2bn(q, q_len, (*dsactx)->q);
+
+    (*dsactx)->g = BN_new();
+    BN_bin2bn(g, g_len, (*dsactx)->g);
+
+    (*dsactx)->pub_key = BN_new();
+    BN_bin2bn(y, y_len, (*dsactx)->pub_key);
+
+    if (x_len) {
+        (*dsactx)->priv_key = BN_new();
+        BN_bin2bn(x, x_len, (*dsactx)->priv_key);
+    }
+
+    return 0;
+}
+
+int
+_libssh2_dsa_sha1_verify(libssh2_dsa_ctx * dsactx,
+                         const unsigned char *sig,
+                         const unsigned char *m, unsigned long m_len)
+{
+    unsigned char hash[SHA_DIGEST_LENGTH];
+    DSA_SIG dsasig;
+    int ret;
+
+    dsasig.r = BN_new();
+    BN_bin2bn(sig, 20, dsasig.r);
+    dsasig.s = BN_new();
+    BN_bin2bn(sig + 20, 20, dsasig.s);
+
+    libssh2_sha1(m, m_len, hash);
+    ret = DSA_do_verify(hash, SHA_DIGEST_LENGTH, &dsasig, dsactx);
+    BN_clear_free(dsasig.s);
+    BN_clear_free(dsasig.r);
+
+    return (ret == 1) ? 0 : -1;
+}
+#endif /* LIBSSH_DSA */
+
+int
+_libssh2_cipher_init(_libssh2_cipher_ctx * h,
+                     _libssh2_cipher_type(algo),
+                     unsigned char *iv, unsigned char *secret, int encrypt)
+{
+    EVP_CIPHER_CTX_init(h);
+    return !EVP_CipherInit(h, algo(), secret, iv, encrypt);
+}
+
+int
+_libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx,
+                      _libssh2_cipher_type(algo),
+                      int encrypt, unsigned char *block, size_t blocksize)
+{
+    unsigned char buf[EVP_MAX_BLOCK_LENGTH];
+    int ret;
+    (void) algo;
+    (void) encrypt;
+
+    ret = EVP_Cipher(ctx, buf, block, blocksize);
+    if (ret == 1) {
+        memcpy(block, buf, blocksize);
+    }
+    return ret == 1 ? 0 : 1;
+}
+
+#if LIBSSH2_AES_CTR
+
+#include <openssl/aes.h>
+#include <openssl/evp.h>
+
+typedef struct
+{
+    AES_KEY       key;
+    EVP_CIPHER_CTX *aes_ctx;
+    unsigned char ctr[AES_BLOCK_SIZE];
+} aes_ctr_ctx;
+
+static int
+aes_ctr_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+             const unsigned char *iv, int enc) /* init key */
+{
+    /*
+     * variable "c" is leaked from this scope, but is later freed
+     * in aes_ctr_cleanup
+     */
+    aes_ctr_ctx *c;
+    const EVP_CIPHER *aes_cipher;
+    (void) enc;
+
+    switch (ctx->key_len) {
+    case 16:
+        aes_cipher = EVP_aes_128_ecb();
+        break;
+    case 24:
+        aes_cipher = EVP_aes_192_ecb();
+        break;
+    case 32:
+        aes_cipher = EVP_aes_256_ecb();
+        break;
+    default:
+        return 0;
+    }
+
+    c = malloc(sizeof(*c));
+    if (c == NULL)
+        return 0;
+
+    c->aes_ctx = malloc(sizeof(EVP_CIPHER_CTX));
+    if (c->aes_ctx == NULL) {
+        free(c);
+        return 0;
+    }
+
+    if (EVP_EncryptInit(c->aes_ctx, aes_cipher, key, NULL) != 1) {
+        free(c->aes_ctx);
+        free(c);
+        return 0;
+    }
+
+    EVP_CIPHER_CTX_set_padding(c->aes_ctx, 0);
+
+    memcpy(c->ctr, iv, AES_BLOCK_SIZE);
+
+    EVP_CIPHER_CTX_set_app_data(ctx, c);
+
+    return 1;
+}
+
+static int
+aes_ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+                  const unsigned char *in,
+                  size_t inl) /* encrypt/decrypt data */
+{
+    aes_ctr_ctx *c = EVP_CIPHER_CTX_get_app_data(ctx);
+    unsigned char b1[AES_BLOCK_SIZE];
+    size_t i = 0;
+    int outlen = 0;
+
+    if (inl != 16) /* libssh2 only ever encrypt one block */
+        return 0;
+
+    if (c == NULL) {
+        return 0;
+    }
+
+/*
+  To encrypt a packet P=P1||P2||...||Pn (where P1, P2, ..., Pn are each
+  blocks of length L), the encryptor first encrypts <X> with <cipher>
+  to obtain a block B1.  The block B1 is then XORed with P1 to generate
+  the ciphertext block C1.  The counter X is then incremented
+*/
+
+    if (EVP_EncryptUpdate(c->aes_ctx, b1, &outlen, c->ctr, AES_BLOCK_SIZE) != 1) {
+        return 0;
+    }
+
+    for (i = 0; i < 16; i++)
+        *out++ = *in++ ^ b1[i];
+
+    i = 15;
+    while (c->ctr[i]++ == 0xFF) {
+        if (i == 0)
+            break;
+        i--;
+    }
+
+    return 1;
+}
+
+static int
+aes_ctr_cleanup(EVP_CIPHER_CTX *ctx) /* cleanup ctx */
+{
+    aes_ctr_ctx *c = EVP_CIPHER_CTX_get_app_data(ctx);
+
+    if (c == NULL) {
+        return 1;
+    }
+
+    if (c->aes_ctx != NULL) {
+        _libssh2_cipher_dtor(c->aes_ctx);
+        free(c->aes_ctx);
+    }
+
+    free(c);
+
+    return 1;
+}
+
+static const EVP_CIPHER *
+make_ctr_evp (size_t keylen, EVP_CIPHER *aes_ctr_cipher)
+{
+    aes_ctr_cipher->block_size = 16;
+    aes_ctr_cipher->key_len = keylen;
+    aes_ctr_cipher->iv_len = 16;
+    aes_ctr_cipher->init = aes_ctr_init;
+    aes_ctr_cipher->do_cipher = aes_ctr_do_cipher;
+    aes_ctr_cipher->cleanup = aes_ctr_cleanup;
+
+    return aes_ctr_cipher;
+}
+
+const EVP_CIPHER *
+_libssh2_EVP_aes_128_ctr(void)
+{
+    static EVP_CIPHER aes_ctr_cipher;
+    return !aes_ctr_cipher.key_len?
+        make_ctr_evp (16, &aes_ctr_cipher) : &aes_ctr_cipher;
+}
+
+const EVP_CIPHER *
+_libssh2_EVP_aes_192_ctr(void)
+{
+    static EVP_CIPHER aes_ctr_cipher;
+    return !aes_ctr_cipher.key_len?
+        make_ctr_evp (24, &aes_ctr_cipher) : &aes_ctr_cipher;
+}
+
+const EVP_CIPHER *
+_libssh2_EVP_aes_256_ctr(void)
+{
+    static EVP_CIPHER aes_ctr_cipher;
+    return !aes_ctr_cipher.key_len?
+        make_ctr_evp (32, &aes_ctr_cipher) : &aes_ctr_cipher;
+}
+
+void _libssh2_init_aes_ctr(void)
+{
+    _libssh2_EVP_aes_128_ctr();
+    _libssh2_EVP_aes_192_ctr();
+    _libssh2_EVP_aes_256_ctr();
+}
+
+#else
+void _libssh2_init_aes_ctr(void) {}
+#endif /* LIBSSH2_AES_CTR */
+
+/* TODO: Optionally call a passphrase callback specified by the
+ * calling program
+ */
+static int
+passphrase_cb(char *buf, int size, int rwflag, char *passphrase)
+{
+    int passphrase_len = strlen(passphrase);
+    (void) rwflag;
+
+    if (passphrase_len > (size - 1)) {
+        passphrase_len = size - 1;
+    }
+    memcpy(buf, passphrase, passphrase_len);
+    buf[passphrase_len] = '\0';
+
+    return passphrase_len;
+}
+
+typedef void * (*pem_read_bio_func)(BIO *, void **, pem_password_cb *,
+                                    void * u);
+
+static int
+read_private_key_from_file(void ** key_ctx,
+                           pem_read_bio_func read_private_key,
+                           const char * filename,
+                           unsigned const char *passphrase)
+{
+    BIO * bp;
+
+    *key_ctx = NULL;
+
+    bp = BIO_new_file(filename, "r");
+    if (!bp) {
+        return -1;
+    }
+
+    *key_ctx = read_private_key(bp, NULL, (pem_password_cb *) passphrase_cb,
+                                (void *) passphrase);
+
+    BIO_free(bp);
+    return (*key_ctx) ? 0 : -1;
+}
+
+int
+_libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa,
+                         LIBSSH2_SESSION * session,
+                         const char *filename, unsigned const char *passphrase)
+{
+    pem_read_bio_func read_rsa =
+        (pem_read_bio_func) &PEM_read_bio_RSAPrivateKey;
+    (void) session;
+
+    _libssh2_init_if_needed ();
+
+    return read_private_key_from_file((void **) rsa, read_rsa,
+                                      filename, passphrase);
+}
+
+#if LIBSSH2_DSA
+int
+_libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa,
+                         LIBSSH2_SESSION * session,
+                         const char *filename, unsigned const char *passphrase)
+{
+    pem_read_bio_func read_dsa =
+        (pem_read_bio_func) &PEM_read_bio_DSAPrivateKey;
+    (void) session;
+
+    _libssh2_init_if_needed ();
+
+    return read_private_key_from_file((void **) dsa, read_dsa,
+                                      filename, passphrase);
+}
+#endif /* LIBSSH_DSA */
+
+int
+_libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session,
+                       libssh2_rsa_ctx * rsactx,
+                       const unsigned char *hash,
+                       size_t hash_len,
+                       unsigned char **signature, size_t *signature_len)
+{
+    int ret;
+    unsigned char *sig;
+    unsigned int sig_len;
+
+    sig_len = RSA_size(rsactx);
+    sig = LIBSSH2_ALLOC(session, sig_len);
+
+    if (!sig) {
+        return -1;
+    }
+
+    ret = RSA_sign(NID_sha1, hash, hash_len, sig, &sig_len, rsactx);
+
+    if (!ret) {
+        LIBSSH2_FREE(session, sig);
+        return -1;
+    }
+
+    *signature = sig;
+    *signature_len = sig_len;
+
+    return 0;
+}
+
+#if LIBSSH2_DSA
+int
+_libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx,
+                       const unsigned char *hash,
+                       unsigned long hash_len, unsigned char *signature)
+{
+    DSA_SIG *sig;
+    int r_len, s_len;
+    (void) hash_len;
+
+    sig = DSA_do_sign(hash, SHA_DIGEST_LENGTH, dsactx);
+    if (!sig) {
+        return -1;
+    }
+
+    r_len = BN_num_bytes(sig->r);
+    if (r_len < 1 || r_len > 20) {
+        DSA_SIG_free(sig);
+        return -1;
+    }
+    s_len = BN_num_bytes(sig->s);
+    if (s_len < 1 || s_len > 20) {
+        DSA_SIG_free(sig);
+        return -1;
+    }
+
+    memset(signature, 0, 40);
+
+    BN_bn2bin(sig->r, signature + (20 - r_len));
+    BN_bn2bin(sig->s, signature + 20 + (20 - s_len));
+
+    DSA_SIG_free(sig);
+
+    return 0;
+}
+#endif /* LIBSSH_DSA */
+
+void
+libssh2_sha1(const unsigned char *message, unsigned long len,
+             unsigned char *out)
+{
+    EVP_MD_CTX ctx;
+
+    EVP_DigestInit(&ctx, EVP_get_digestbyname("sha1"));
+    EVP_DigestUpdate(&ctx, message, len);
+    EVP_DigestFinal(&ctx, out, NULL);
+}
+
+void
+libssh2_md5(const unsigned char *message, unsigned long len,
+            unsigned char *out)
+{
+    EVP_MD_CTX ctx;
+
+    EVP_DigestInit(&ctx, EVP_get_digestbyname("md5"));
+    EVP_DigestUpdate(&ctx, message, len);
+    EVP_DigestFinal(&ctx, out, NULL);
+}
+
+static unsigned char *
+write_bn(unsigned char *buf, const BIGNUM *bn, int bn_bytes)
+{
+    unsigned char *p = buf;
+
+    /* Left space for bn size which will be written below. */
+    p += 4;
+
+    *p = 0;
+    BN_bn2bin(bn, p + 1);
+    if (!(*(p + 1) & 0x80)) {
+        memmove(p, p + 1, --bn_bytes);
+    }
+    _libssh2_htonu32(p - 4, bn_bytes);  /* Post write bn size. */
+
+    return p + bn_bytes;
+}
+
+static unsigned char *
+gen_publickey_from_rsa(LIBSSH2_SESSION *session, RSA *rsa,
+                       size_t *key_len)
+{
+    int            e_bytes, n_bytes;
+    unsigned long  len;
+    unsigned char* key;
+    unsigned char* p;
+
+    e_bytes = BN_num_bytes(rsa->e) + 1;
+    n_bytes = BN_num_bytes(rsa->n) + 1;
+
+    /* Key form is "ssh-rsa" + e + n. */
+    len = 4 + 7 + 4 + e_bytes + 4 + n_bytes;
+
+    key = LIBSSH2_ALLOC(session, len);
+    if (key == NULL) {
+        return NULL;
+    }
+
+    /* Process key encoding. */
+    p = key;
+
+    _libssh2_htonu32(p, 7);  /* Key type. */
+    p += 4;
+    memcpy(p, "ssh-rsa", 7);
+    p += 7;
+
+    p = write_bn(p, rsa->e, e_bytes);
+    p = write_bn(p, rsa->n, n_bytes);
+
+    *key_len = (size_t)(p - key);
+    return key;
+}
+
+static unsigned char *
+gen_publickey_from_dsa(LIBSSH2_SESSION* session, DSA *dsa,
+                       size_t *key_len)
+{
+    int            p_bytes, q_bytes, g_bytes, k_bytes;
+    unsigned long  len;
+    unsigned char* key;
+    unsigned char* p;
+
+    p_bytes = BN_num_bytes(dsa->p) + 1;
+    q_bytes = BN_num_bytes(dsa->q) + 1;
+    g_bytes = BN_num_bytes(dsa->g) + 1;
+    k_bytes = BN_num_bytes(dsa->pub_key) + 1;
+
+    /* Key form is "ssh-dss" + p + q + g + pub_key. */
+    len = 4 + 7 + 4 + p_bytes + 4 + q_bytes + 4 + g_bytes + 4 + k_bytes;
+
+    key = LIBSSH2_ALLOC(session, len);
+    if (key == NULL) {
+        return NULL;
+    }
+
+    /* Process key encoding. */
+    p = key;
+
+    _libssh2_htonu32(p, 7);  /* Key type. */
+    p += 4;
+    memcpy(p, "ssh-dss", 7);
+    p += 7;
+
+    p = write_bn(p, dsa->p, p_bytes);
+    p = write_bn(p, dsa->q, q_bytes);
+    p = write_bn(p, dsa->g, g_bytes);
+    p = write_bn(p, dsa->pub_key, k_bytes);
+
+    *key_len = (size_t)(p - key);
+    return key;
+}
+
+static int
+gen_publickey_from_rsa_evp(LIBSSH2_SESSION *session,
+                           unsigned char **method,
+                           size_t *method_len,
+                           unsigned char **pubkeydata,
+                           size_t *pubkeydata_len,
+                           EVP_PKEY *pk)
+{
+    RSA*           rsa = NULL;
+    unsigned char* key;
+    unsigned char* method_buf = NULL;
+    size_t  key_len;
+
+    _libssh2_debug(session,
+                   LIBSSH2_TRACE_AUTH,
+                   "Computing public key from RSA private key envelop");
+
+    rsa = EVP_PKEY_get1_RSA(pk);
+    if (rsa == NULL) {
+        /* Assume memory allocation error... what else could it be ? */
+        goto __alloc_error;
+    }
+
+    method_buf = LIBSSH2_ALLOC(session, 7);  /* ssh-rsa. */
+    if (method_buf == NULL) {
+        goto __alloc_error;
+    }
+
+    key = gen_publickey_from_rsa(session, rsa, &key_len);
+    if (key == NULL) {
+        goto __alloc_error;
+    }
+    RSA_free(rsa);
+
+    memcpy(method_buf, "ssh-rsa", 7);
+    *method         = method_buf;
+    *method_len     = 7;
+    *pubkeydata     = key;
+    *pubkeydata_len = key_len;
+    return 0;
+
+  __alloc_error:
+    if (rsa != NULL) {
+        RSA_free(rsa);
+    }
+    if (method_buf != NULL) {
+        LIBSSH2_FREE(session, method_buf);
+    }
+
+    return _libssh2_error(session,
+                          LIBSSH2_ERROR_ALLOC,
+                          "Unable to allocate memory for private key data");
+}
+
+static int
+gen_publickey_from_dsa_evp(LIBSSH2_SESSION *session,
+                           unsigned char **method,
+                           size_t *method_len,
+                           unsigned char **pubkeydata,
+                           size_t *pubkeydata_len,
+                           EVP_PKEY *pk)
+{
+    DSA*           dsa = NULL;
+    unsigned char* key;
+    unsigned char* method_buf = NULL;
+    size_t  key_len;
+
+    _libssh2_debug(session,
+                   LIBSSH2_TRACE_AUTH,
+                   "Computing public key from DSA private key envelop");
+
+    dsa = EVP_PKEY_get1_DSA(pk);
+    if (dsa == NULL) {
+        /* Assume memory allocation error... what else could it be ? */
+        goto __alloc_error;
+    }
+
+    method_buf = LIBSSH2_ALLOC(session, 7);  /* ssh-dss. */
+    if (method_buf == NULL) {
+        goto __alloc_error;
+    }
+
+    key = gen_publickey_from_dsa(session, dsa, &key_len);
+    if (key == NULL) {
+        goto __alloc_error;
+    }
+    DSA_free(dsa);
+
+    memcpy(method_buf, "ssh-dss", 7);
+    *method         = method_buf;
+    *method_len     = 7;
+    *pubkeydata     = key;
+    *pubkeydata_len = key_len;
+    return 0;
+
+  __alloc_error:
+    if (dsa != NULL) {
+        DSA_free(dsa);
+    }
+    if (method_buf != NULL) {
+        LIBSSH2_FREE(session, method_buf);
+    }
+
+    return _libssh2_error(session,
+                          LIBSSH2_ERROR_ALLOC,
+                          "Unable to allocate memory for private key data");
+}
+
+int
+_libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
+                          unsigned char **method,
+                          size_t *method_len,
+                          unsigned char **pubkeydata,
+                          size_t *pubkeydata_len,
+                          const char *privatekey,
+                          const char *passphrase)
+{
+    int       st;
+    BIO*      bp;
+    EVP_PKEY* pk;
+
+    _libssh2_debug(session,
+                   LIBSSH2_TRACE_AUTH,
+                   "Computing public key from private key file: %s",
+                   privatekey);
+
+    bp = BIO_new_file(privatekey, "r");
+    if (bp == NULL) {
+        return _libssh2_error(session,
+                              LIBSSH2_ERROR_FILE,
+                              "Unable to extract public key from private key "
+                              "file: Unable to open private key file");
+    }
+    if (!EVP_get_cipherbyname("des")) {
+        /* If this cipher isn't loaded it's a pretty good indication that none
+         * are.  I have *NO DOUBT* that there's a better way to deal with this
+         * ($#&%#$(%$#( Someone buy me an OpenSSL manual and I'll read up on
+         * it.
+         */
+        OpenSSL_add_all_ciphers();
+    }
+    BIO_reset(bp);
+    pk = PEM_read_bio_PrivateKey(bp, NULL, NULL, (void*)passphrase);
+    BIO_free(bp);
+
+    if (pk == NULL) {
+        return _libssh2_error(session,
+                              LIBSSH2_ERROR_FILE,
+                              "Unable to extract public key "
+                              "from private key file: "
+                              "Wrong passphrase or invalid/unrecognized "
+                              "private key file format");
+    }
+
+    switch (pk->type) {
+    case EVP_PKEY_RSA :
+        st = gen_publickey_from_rsa_evp(
+            session, method, method_len, pubkeydata, pubkeydata_len, pk);
+        break;
+
+    case EVP_PKEY_DSA :
+        st = gen_publickey_from_dsa_evp(
+            session, method, method_len, pubkeydata, pubkeydata_len, pk);
+        break;
+
+    default :
+        st = _libssh2_error(session,
+                            LIBSSH2_ERROR_FILE,
+                            "Unable to extract public key "
+                            "from private key file: "
+                            "Unsupported private key file format");
+        break;
+    }
+
+    EVP_PKEY_free(pk);
+    return st;
+}
+
+#endif /* !LIBSSH2_LIBGCRYPT */
diff --git a/pgadmin/libssh2/packet.c b/pgadmin/libssh2/packet.c
new file mode 100644
index 0000000..bfbd56a
--- /dev/null
+++ b/pgadmin/libssh2/packet.c
@@ -0,0 +1,1243 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2005,2006 Mikhail Gusarov
+ * Copyright (c) 2009-2010 by Daniel Stenberg
+ * Copyright (c) 2010 Simon Josefsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+/* Needed for struct iovec on some platforms */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#include <sys/types.h>
+
+#include "transport.h"
+#include "channel.h"
+#include "packet.h"
+
+/*
+ * libssh2_packet_queue_listener
+ *
+ * Queue a connection request for a listener
+ */
+static inline int
+packet_queue_listener(LIBSSH2_SESSION * session, unsigned char *data,
+                      unsigned long datalen,
+                      packet_queue_listener_state_t *listen_state)
+{
+    /*
+     * Look for a matching listener
+     */
+    /* 17 = packet_type(1) + channel(4) + reason(4) + descr(4) + lang(4) */
+    unsigned long packet_len = 17 + (sizeof(FwdNotReq) - 1);
+    unsigned char *p;
+    LIBSSH2_LISTENER *listn = _libssh2_list_first(&session->listeners);
+    char failure_code = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED;
+    int rc;
+
+    (void) datalen;
+
+    if (listen_state->state == libssh2_NB_state_idle) {
+        unsigned char *s = data + (sizeof("forwarded-tcpip") - 1) + 5;
+        listen_state->sender_channel = _libssh2_ntohu32(s);
+        s += 4;
+
+        listen_state->initial_window_size = _libssh2_ntohu32(s);
+        s += 4;
+        listen_state->packet_size = _libssh2_ntohu32(s);
+        s += 4;
+
+        listen_state->host_len = _libssh2_ntohu32(s);
+        s += 4;
+        listen_state->host = s;
+        s += listen_state->host_len;
+        listen_state->port = _libssh2_ntohu32(s);
+        s += 4;
+
+        listen_state->shost_len = _libssh2_ntohu32(s);
+        s += 4;
+        listen_state->shost = s;
+        s += listen_state->shost_len;
+        listen_state->sport = _libssh2_ntohu32(s);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "Remote received connection from %s:%ld to %s:%ld",
+                       listen_state->shost, listen_state->sport,
+                       listen_state->host, listen_state->port);
+
+        listen_state->state = libssh2_NB_state_allocated;
+    }
+
+    if (listen_state->state != libssh2_NB_state_sent) {
+        while (listn) {
+            if ((listn->port == (int) listen_state->port) &&
+                (strlen(listn->host) == listen_state->host_len) &&
+                (memcmp (listn->host, listen_state->host,
+                         listen_state->host_len) == 0)) {
+                /* This is our listener */
+                LIBSSH2_CHANNEL *channel = NULL;
+                listen_state->channel = NULL;
+
+                if (listen_state->state == libssh2_NB_state_allocated) {
+                    if (listn->queue_maxsize &&
+                        (listn->queue_maxsize <= listn->queue_size)) {
+                        /* Queue is full */
+                        failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+                        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                       "Listener queue full, ignoring");
+                        listen_state->state = libssh2_NB_state_sent;
+                        break;
+                    }
+
+                    channel = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_CHANNEL));
+                    if (!channel) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Unable to allocate a channel for "
+                                       "new connection");
+                        failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+                        listen_state->state = libssh2_NB_state_sent;
+                        break;
+                    }
+                    listen_state->channel = channel;
+
+                    memset(channel, 0, sizeof(LIBSSH2_CHANNEL));
+
+                    channel->session = session;
+                    channel->channel_type_len = sizeof("forwarded-tcpip") - 1;
+                    channel->channel_type = LIBSSH2_ALLOC(session,
+                                                          channel->
+                                                          channel_type_len +
+                                                          1);
+                    if (!channel->channel_type) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Unable to allocate a channel for new"
+                                       " connection");
+                        LIBSSH2_FREE(session, channel);
+                        failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+                        listen_state->state = libssh2_NB_state_sent;
+                        break;
+                    }
+                    memcpy(channel->channel_type, "forwarded-tcpip",
+                           channel->channel_type_len + 1);
+
+                    channel->remote.id = listen_state->sender_channel;
+                    channel->remote.window_size_initial =
+                        LIBSSH2_CHANNEL_WINDOW_DEFAULT;
+                    channel->remote.window_size =
+                        LIBSSH2_CHANNEL_WINDOW_DEFAULT;
+                    channel->remote.packet_size =
+                        LIBSSH2_CHANNEL_PACKET_DEFAULT;
+
+                    channel->local.id = _libssh2_channel_nextid(session);
+                    channel->local.window_size_initial =
+                        listen_state->initial_window_size;
+                    channel->local.window_size =
+                        listen_state->initial_window_size;
+                    channel->local.packet_size = listen_state->packet_size;
+
+                    _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                   "Connection queued: channel %lu/%lu "
+                                   "win %lu/%lu packet %lu/%lu",
+                                   channel->local.id, channel->remote.id,
+                                   channel->local.window_size,
+                                   channel->remote.window_size,
+                                   channel->local.packet_size,
+                                   channel->remote.packet_size);
+
+                    p = listen_state->packet;
+                    *(p++) = SSH_MSG_CHANNEL_OPEN_CONFIRMATION;
+                    _libssh2_store_u32(&p, channel->remote.id);
+                    _libssh2_store_u32(&p, channel->local.id);
+                    _libssh2_store_u32(&p,
+                                       channel->remote.window_size_initial);
+                    _libssh2_store_u32(&p, channel->remote.packet_size);
+
+                    listen_state->state = libssh2_NB_state_created;
+                }
+
+                if (listen_state->state == libssh2_NB_state_created) {
+                    rc = _libssh2_transport_send(session, listen_state->packet,
+                                                 17, NULL, 0);
+                    if (rc == LIBSSH2_ERROR_EAGAIN)
+                        return rc;
+                    else if (rc) {
+                        listen_state->state = libssh2_NB_state_idle;
+                        return _libssh2_error(session, rc,
+                                              "Unable to send channel "
+                                              "open confirmation");
+                    }
+
+                    /* Link the channel into the end of the queue list */
+                    _libssh2_list_add(&listn->queue,
+                                      &listen_state->channel->node);
+                    listn->queue_size++;
+
+                    listen_state->state = libssh2_NB_state_idle;
+                    return 0;
+                }
+            }
+
+            listn = _libssh2_list_next(&listn->node);
+        }
+
+        listen_state->state = libssh2_NB_state_sent;
+    }
+
+    /* We're not listening to you */
+    p = listen_state->packet;
+    *(p++) = SSH_MSG_CHANNEL_OPEN_FAILURE;
+    _libssh2_store_u32(&p, listen_state->sender_channel);
+    _libssh2_store_u32(&p, failure_code);
+    _libssh2_store_str(&p, FwdNotReq, sizeof(FwdNotReq) - 1);
+    _libssh2_htonu32(p, 0);
+
+    rc = _libssh2_transport_send(session, listen_state->packet,
+                                 packet_len, NULL, 0);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        listen_state->state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc, "Unable to send open failure");
+
+    }
+    listen_state->state = libssh2_NB_state_idle;
+    return 0;
+}
+
+/*
+ * packet_x11_open
+ *
+ * Accept a forwarded X11 connection
+ */
+static inline int
+packet_x11_open(LIBSSH2_SESSION * session, unsigned char *data,
+                unsigned long datalen,
+                packet_x11_open_state_t *x11open_state)
+{
+    int failure_code = SSH_OPEN_CONNECT_FAILED;
+    /* 17 = packet_type(1) + channel(4) + reason(4) + descr(4) + lang(4) */
+    unsigned long packet_len = 17 + (sizeof(X11FwdUnAvil) - 1);
+    unsigned char *p;
+    LIBSSH2_CHANNEL *channel = x11open_state->channel;
+    int rc;
+
+    (void) datalen;
+
+    if (x11open_state->state == libssh2_NB_state_idle) {
+        unsigned char *s = data + (sizeof("x11") - 1) + 5;
+        x11open_state->sender_channel = _libssh2_ntohu32(s);
+        s += 4;
+        x11open_state->initial_window_size = _libssh2_ntohu32(s);
+        s += 4;
+        x11open_state->packet_size = _libssh2_ntohu32(s);
+        s += 4;
+        x11open_state->shost_len = _libssh2_ntohu32(s);
+        s += 4;
+        x11open_state->shost = s;
+        s += x11open_state->shost_len;
+        x11open_state->sport = _libssh2_ntohu32(s);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "X11 Connection Received from %s:%ld on channel %lu",
+                       x11open_state->shost, x11open_state->sport,
+                       x11open_state->sender_channel);
+
+        x11open_state->state = libssh2_NB_state_allocated;
+    }
+
+    if (session->x11) {
+        if (x11open_state->state == libssh2_NB_state_allocated) {
+            channel = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_CHANNEL));
+            if (!channel) {
+                _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                               "allocate a channel for new connection");
+                failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+                goto x11_exit;
+            }
+            memset(channel, 0, sizeof(LIBSSH2_CHANNEL));
+
+            channel->session = session;
+            channel->channel_type_len = sizeof("x11") - 1;
+            channel->channel_type = LIBSSH2_ALLOC(session,
+                                                  channel->channel_type_len +
+                                                  1);
+            if (!channel->channel_type) {
+                _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                               "allocate a channel for new connection");
+                LIBSSH2_FREE(session, channel);
+                failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+                goto x11_exit;
+            }
+            memcpy(channel->channel_type, "x11",
+                   channel->channel_type_len + 1);
+
+            channel->remote.id = x11open_state->sender_channel;
+            channel->remote.window_size_initial =
+                LIBSSH2_CHANNEL_WINDOW_DEFAULT;
+            channel->remote.window_size = LIBSSH2_CHANNEL_WINDOW_DEFAULT;
+            channel->remote.packet_size = LIBSSH2_CHANNEL_PACKET_DEFAULT;
+
+            channel->local.id = _libssh2_channel_nextid(session);
+            channel->local.window_size_initial =
+                x11open_state->initial_window_size;
+            channel->local.window_size = x11open_state->initial_window_size;
+            channel->local.packet_size = x11open_state->packet_size;
+
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "X11 Connection established: channel %lu/%lu "
+                           "win %lu/%lu packet %lu/%lu",
+                           channel->local.id, channel->remote.id,
+                           channel->local.window_size,
+                           channel->remote.window_size,
+                           channel->local.packet_size,
+                           channel->remote.packet_size);
+            p = x11open_state->packet;
+            *(p++) = SSH_MSG_CHANNEL_OPEN_CONFIRMATION;
+            _libssh2_store_u32(&p, channel->remote.id);
+            _libssh2_store_u32(&p, channel->local.id);
+            _libssh2_store_u32(&p, channel->remote.window_size_initial);
+            _libssh2_store_u32(&p, channel->remote.packet_size);
+
+            x11open_state->state = libssh2_NB_state_created;
+        }
+
+        if (x11open_state->state == libssh2_NB_state_created) {
+            rc = _libssh2_transport_send(session, x11open_state->packet, 17,
+                                         NULL, 0);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                return rc;
+            } else if (rc) {
+                x11open_state->state = libssh2_NB_state_idle;
+                return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                      "Unable to send channel open "
+                                      "confirmation");
+            }
+
+            /* Link the channel into the session */
+            _libssh2_list_add(&session->channels, &channel->node);
+
+            /*
+             * Pass control to the callback, they may turn right around and
+             * free the channel, or actually use it
+             */
+            LIBSSH2_X11_OPEN(channel, (char *)x11open_state->shost,
+                             x11open_state->sport);
+
+            x11open_state->state = libssh2_NB_state_idle;
+            return 0;
+        }
+    }
+    else
+        failure_code = SSH_OPEN_RESOURCE_SHORTAGE;
+    /* fall-trough */
+  x11_exit:
+    p = x11open_state->packet;
+    *(p++) = SSH_MSG_CHANNEL_OPEN_FAILURE;
+    _libssh2_store_u32(&p, x11open_state->sender_channel);
+    _libssh2_store_u32(&p, failure_code);
+    _libssh2_store_str(&p, X11FwdUnAvil, sizeof(X11FwdUnAvil) - 1);
+    _libssh2_htonu32(p, 0);
+
+    rc = _libssh2_transport_send(session, x11open_state->packet, packet_len,
+                                 NULL, 0);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        x11open_state->state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc, "Unable to send open failure");
+    }
+    x11open_state->state = libssh2_NB_state_idle;
+    return 0;
+}
+
+/*
+ * _libssh2_packet_add
+ *
+ * Create a new packet and attach it to the brigade. Called from the transport
+ * layer when it has received a packet.
+ *
+ * The input pointer 'data' is pointing to allocated data that this function
+ * is asked to deal with so on failure OR success, it must be freed fine.
+ *
+ * This function will always be called with 'datalen' greater than zero.
+ */
+int
+_libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
+                    size_t datalen, int macstate)
+{
+    int rc = 0;
+    char *message=NULL;
+    char *language=NULL;
+    size_t message_len=0;
+    size_t language_len=0;
+    LIBSSH2_CHANNEL *channelp = NULL;
+    size_t data_head = 0;
+    unsigned char msg = data[0];
+
+    switch(session->packAdd_state) {
+    case libssh2_NB_state_idle:
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "Packet type %d received, length=%d",
+                       (int) msg, (int) datalen);
+
+        if ((macstate == LIBSSH2_MAC_INVALID) &&
+            (!session->macerror ||
+             LIBSSH2_MACERROR(session, (char *) data, datalen))) {
+            /* Bad MAC input, but no callback set or non-zero return from the
+               callback */
+
+            LIBSSH2_FREE(session, data);
+            return _libssh2_error(session, LIBSSH2_ERROR_INVALID_MAC,
+                                  "Invalid MAC received");
+        }
+        session->packAdd_state = libssh2_NB_state_allocated;
+        break;
+    case libssh2_NB_state_jump1:
+        goto libssh2_packet_add_jump_point1;
+    case libssh2_NB_state_jump2:
+        goto libssh2_packet_add_jump_point2;
+    case libssh2_NB_state_jump3:
+        goto libssh2_packet_add_jump_point3;
+    case libssh2_NB_state_jump4:
+        goto libssh2_packet_add_jump_point4;
+    case libssh2_NB_state_jump5:
+        goto libssh2_packet_add_jump_point5;
+    default: /* nothing to do */
+        break;
+    }
+
+    if (session->packAdd_state == libssh2_NB_state_allocated) {
+        /* A couple exceptions to the packet adding rule: */
+        switch (msg) {
+
+            /*
+              byte      SSH_MSG_DISCONNECT
+              uint32    reason code
+              string    description in ISO-10646 UTF-8 encoding [RFC3629]
+              string    language tag [RFC3066]
+            */
+
+        case SSH_MSG_DISCONNECT:
+            if(datalen >= 5) {
+                size_t reason = _libssh2_ntohu32(data + 1);
+
+                if(datalen >= 9) {
+                    message_len = _libssh2_ntohu32(data + 5);
+
+                    if(message_len < datalen-13) {
+                        /* 9 = packet_type(1) + reason(4) + message_len(4) */
+                        message = (char *) data + 9;
+
+                        language_len = _libssh2_ntohu32(data + 9 + message_len);
+                        language = (char *) data + 9 + message_len + 4;
+
+                        if(language_len > (datalen-13-message_len)) {
+                            /* bad input, clear info */
+                            language = message = NULL;
+                            language_len = message_len = 0;
+                        }
+                    }
+                    else
+                        /* bad size, clear it */
+                        message_len=0;
+                }
+                if (session->ssh_msg_disconnect) {
+                    LIBSSH2_DISCONNECT(session, reason, message,
+                                       message_len, language, language_len);
+                }
+                _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                               "Disconnect(%d): %s(%s)", reason,
+                               message, language);
+            }
+
+            LIBSSH2_FREE(session, data);
+            session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
+            session->packAdd_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_DISCONNECT,
+                                  "socket disconnect");
+            /*
+              byte      SSH_MSG_IGNORE
+              string    data
+            */
+
+        case SSH_MSG_IGNORE:
+            if (datalen >= 2) {
+                if (session->ssh_msg_ignore) {
+                    LIBSSH2_IGNORE(session, (char *) data + 1, datalen - 1);
+                }
+            } else if (session->ssh_msg_ignore) {
+                LIBSSH2_IGNORE(session, "", 0);
+            }
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+
+            /*
+              byte      SSH_MSG_DEBUG
+              boolean   always_display
+              string    message in ISO-10646 UTF-8 encoding [RFC3629]
+              string    language tag [RFC3066]
+            */
+
+        case SSH_MSG_DEBUG:
+            if(datalen >= 2) {
+                int always_display= data[1];
+
+                if(datalen >= 6) {
+                    message_len = _libssh2_ntohu32(data + 2);
+
+                    if(message_len <= (datalen - 10)) {
+                        /* 6 = packet_type(1) + display(1) + message_len(4) */
+                        message = (char *) data + 6;
+                        language_len = _libssh2_ntohu32(data + 6 + message_len);
+
+                        if(language_len <= (datalen - 10 - message_len))
+                            language = (char *) data + 10 + message_len;
+                    }
+                }
+
+                if (session->ssh_msg_debug) {
+                    LIBSSH2_DEBUG(session, always_display, message,
+                                  message_len, language, language_len);
+                }
+            }
+            /*
+             * _libssh2_debug will actually truncate this for us so
+             * that it's not an inordinate about of data
+             */
+            _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                           "Debug Packet: %s", message);
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+
+            /*
+              byte      SSH_MSG_GLOBAL_REQUEST
+              string    request name in US-ASCII only
+              boolean   want reply
+              ....      request-specific data follows
+            */
+
+        case SSH_MSG_GLOBAL_REQUEST:
+            if(datalen >= 5) {
+                uint32_t len =0;
+                unsigned char want_reply=0;
+                len = _libssh2_ntohu32(data + 1);
+                if(datalen >= (6 + len)) {
+                    want_reply = data[5 + len];
+                    _libssh2_debug(session,
+                                   LIBSSH2_TRACE_CONN,
+                                   "Received global request type %.*s (wr %X)",
+                                   len, data + 5, want_reply);
+                }
+
+
+                if (want_reply) {
+                    unsigned char packet = SSH_MSG_REQUEST_FAILURE;
+                  libssh2_packet_add_jump_point5:
+                    session->packAdd_state = libssh2_NB_state_jump5;
+                    rc = _libssh2_transport_send(session, &packet, 1, NULL, 0);
+                    if (rc == LIBSSH2_ERROR_EAGAIN)
+                        return rc;
+                }
+            }
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+
+            /*
+              byte      SSH_MSG_CHANNEL_EXTENDED_DATA
+              uint32    recipient channel
+              uint32    data_type_code
+              string    data
+            */
+
+        case SSH_MSG_CHANNEL_EXTENDED_DATA:
+            /* streamid(4) */
+            data_head += 4;
+
+            /* fall-through */
+
+            /*
+              byte      SSH_MSG_CHANNEL_DATA
+              uint32    recipient channel
+              string    data
+            */
+
+        case SSH_MSG_CHANNEL_DATA:
+            /* packet_type(1) + channelno(4) + datalen(4) */
+            data_head += 9;
+
+            if(datalen >= data_head)
+                channelp =
+                    _libssh2_channel_locate(session,
+                                            _libssh2_ntohu32(data + 1));
+
+            if (!channelp) {
+                _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_UNKNOWN,
+                               "Packet received for unknown channel");
+                LIBSSH2_FREE(session, data);
+                session->packAdd_state = libssh2_NB_state_idle;
+                return 0;
+            }
+#ifdef LIBSSH2DEBUG
+            {
+                uint32_t stream_id = 0;
+                if (msg == SSH_MSG_CHANNEL_EXTENDED_DATA)
+                    stream_id = _libssh2_ntohu32(data + 5);
+
+                _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                               "%d bytes packet_add() for %lu/%lu/%lu",
+                               (int) (datalen - data_head),
+                               channelp->local.id,
+                               channelp->remote.id,
+                               stream_id);
+            }
+#endif
+            if ((channelp->remote.extended_data_ignore_mode ==
+                 LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE) &&
+                (msg == SSH_MSG_CHANNEL_EXTENDED_DATA)) {
+                /* Pretend we didn't receive this */
+                LIBSSH2_FREE(session, data);
+
+                _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                               "Ignoring extended data and refunding %d bytes",
+                               (int) (datalen - 13));
+                session->packAdd_channelp = channelp;
+
+                /* Adjust the window based on the block we just freed */
+              libssh2_packet_add_jump_point1:
+                session->packAdd_state = libssh2_NB_state_jump1;
+                rc = _libssh2_channel_receive_window_adjust(session->
+                                                            packAdd_channelp,
+                                                            datalen - 13,
+                                                            1, NULL);
+                if (rc == LIBSSH2_ERROR_EAGAIN)
+                    return rc;
+
+                session->packAdd_state = libssh2_NB_state_idle;
+                return 0;
+            }
+
+            /*
+             * REMEMBER! remote means remote as source of data,
+             * NOT remote window!
+             */
+            if (channelp->remote.packet_size < (datalen - data_head)) {
+                /*
+                 * Spec says we MAY ignore bytes sent beyond
+                 * packet_size
+                 */
+                _libssh2_error(session,
+                               LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED,
+                               "Packet contains more data than we offered"
+                               " to receive, truncating");
+                datalen = channelp->remote.packet_size + data_head;
+            }
+            if (channelp->remote.window_size <= 0) {
+                /*
+                 * Spec says we MAY ignore bytes sent beyond
+                 * window_size
+                 */
+                _libssh2_error(session,
+                               LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED,
+                               "The current receive window is full,"
+                               " data ignored");
+                LIBSSH2_FREE(session, data);
+                session->packAdd_state = libssh2_NB_state_idle;
+                return 0;
+            }
+            /* Reset EOF status */
+            channelp->remote.eof = 0;
+
+            if ((datalen - data_head) > channelp->remote.window_size) {
+                _libssh2_error(session,
+                               LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED,
+                               "Remote sent more data than current "
+                               "window allows, truncating");
+                datalen = channelp->remote.window_size + data_head;
+                channelp->remote.window_size = 0;
+            }
+            else
+                /* Now that we've received it, shrink our window */
+                channelp->remote.window_size -= datalen - data_head;
+
+            break;
+
+            /*
+              byte      SSH_MSG_CHANNEL_EOF
+              uint32    recipient channel
+            */
+
+        case SSH_MSG_CHANNEL_EOF:
+            if(datalen >= 5)
+                channelp =
+                    _libssh2_channel_locate(session,
+                                            _libssh2_ntohu32(data + 1));
+            if (!channelp)
+                /* We may have freed already, just quietly ignore this... */
+                ;
+            else {
+                _libssh2_debug(session,
+                               LIBSSH2_TRACE_CONN,
+                               "EOF received for channel %lu/%lu",
+                               channelp->local.id,
+                               channelp->remote.id);
+                channelp->remote.eof = 1;
+            }
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+
+            /*
+              byte      SSH_MSG_CHANNEL_REQUEST
+              uint32    recipient channel
+              string    request type in US-ASCII characters only
+              boolean   want reply
+              ....      type-specific data follows
+            */
+
+        case SSH_MSG_CHANNEL_REQUEST:
+            if(datalen >= 9) {
+                uint32_t channel = _libssh2_ntohu32(data + 1);
+                uint32_t len = _libssh2_ntohu32(data + 5);
+                unsigned char want_reply = 1;
+
+                if(len < (datalen - 10))
+                    want_reply = data[9 + len];
+
+                _libssh2_debug(session,
+                               LIBSSH2_TRACE_CONN,
+                               "Channel %d received request type %.*s (wr %X)",
+                               channel, len, data + 9, want_reply);
+
+                if (len == sizeof("exit-status") - 1
+                    && !memcmp("exit-status", data + 9,
+                               sizeof("exit-status") - 1)) {
+
+                    /* we've got "exit-status" packet. Set the session value */
+                    if(datalen >= 20)
+                        channelp =
+                            _libssh2_channel_locate(session, channel);
+
+                    if (channelp) {
+                        channelp->exit_status =
+                            _libssh2_ntohu32(data + 9 + sizeof("exit-status"));
+                        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                       "Exit status %lu received for "
+                                       "channel %lu/%lu",
+                                       channelp->exit_status,
+                                       channelp->local.id,
+                                       channelp->remote.id);
+                    }
+
+                }
+                else if (len == sizeof("exit-signal") - 1
+                         && !memcmp("exit-signal", data + 9,
+                                    sizeof("exit-signal") - 1)) {
+                    /* command terminated due to signal */
+                    if(datalen >= 20)
+                        channelp = _libssh2_channel_locate(session, channel);
+
+                    if (channelp) {
+                        /* set signal name (without SIG prefix) */
+                        uint32_t namelen =
+                            _libssh2_ntohu32(data + 9 + sizeof("exit-signal"));
+                        channelp->exit_signal =
+                            LIBSSH2_ALLOC(session, namelen + 1);
+                        if (!channelp->exit_signal)
+                            rc = _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                                "memory for signal name");
+                        else {
+                            memcpy(channelp->exit_signal,
+                                   data + 13 + sizeof("exit_signal"), namelen);
+                            channelp->exit_signal[namelen] = '\0';
+                            /* TODO: save error message and language tag */
+                            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                           "Exit signal %s received for "
+                                           "channel %lu/%lu",
+                                           channelp->exit_signal,
+                                           channelp->local.id,
+                                           channelp->remote.id);
+                        }
+                    }
+                }
+
+
+                if (want_reply) {
+                    unsigned char packet[5];
+                  libssh2_packet_add_jump_point4:
+                    session->packAdd_state = libssh2_NB_state_jump4;
+                    packet[0] = SSH_MSG_CHANNEL_FAILURE;
+                    memcpy(&packet[1], data+1, 4);
+                    rc = _libssh2_transport_send(session, packet, 5, NULL, 0);
+                    if (rc == LIBSSH2_ERROR_EAGAIN)
+                        return rc;
+                }
+            }
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return rc;
+
+            /*
+              byte      SSH_MSG_CHANNEL_CLOSE
+              uint32    recipient channel
+            */
+
+        case SSH_MSG_CHANNEL_CLOSE:
+            if(datalen >= 5)
+                channelp =
+                    _libssh2_channel_locate(session,
+                                            _libssh2_ntohu32(data + 1));
+            if (!channelp) {
+                /* We may have freed already, just quietly ignore this... */
+                LIBSSH2_FREE(session, data);
+                session->packAdd_state = libssh2_NB_state_idle;
+                return 0;
+            }
+            _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                           "Close received for channel %lu/%lu",
+                           channelp->local.id,
+                           channelp->remote.id);
+
+            channelp->remote.close = 1;
+            channelp->remote.eof = 1;
+
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+
+            /*
+              byte      SSH_MSG_CHANNEL_OPEN
+              string    "session"
+              uint32    sender channel
+              uint32    initial window size
+              uint32    maximum packet size
+            */
+
+        case SSH_MSG_CHANNEL_OPEN:
+            if(datalen < 17)
+                ;
+            else if ((datalen >= (sizeof("forwarded-tcpip") + 4)) &&
+                     ((sizeof("forwarded-tcpip") - 1) ==
+                      _libssh2_ntohu32(data + 1))
+                     &&
+                     (memcmp(data + 5, "forwarded-tcpip",
+                             sizeof("forwarded-tcpip") - 1) == 0)) {
+
+                /* init the state struct */
+                memset(&session->packAdd_Qlstn_state, 0,
+                       sizeof(session->packAdd_Qlstn_state));
+
+              libssh2_packet_add_jump_point2:
+                session->packAdd_state = libssh2_NB_state_jump2;
+                rc = packet_queue_listener(session, data, datalen,
+                                           &session->packAdd_Qlstn_state);
+            }
+            else if ((datalen >= (sizeof("x11") + 4)) &&
+                     ((sizeof("x11") - 1) == _libssh2_ntohu32(data + 1)) &&
+                     (memcmp(data + 5, "x11", sizeof("x11") - 1) == 0)) {
+
+                /* init the state struct */
+                memset(&session->packAdd_x11open_state, 0,
+                       sizeof(session->packAdd_x11open_state));
+
+              libssh2_packet_add_jump_point3:
+                session->packAdd_state = libssh2_NB_state_jump3;
+                rc = packet_x11_open(session, data, datalen,
+                                     &session->packAdd_x11open_state);
+            }
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+                return rc;
+
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return rc;
+
+            /*
+              byte      SSH_MSG_CHANNEL_WINDOW_ADJUST
+              uint32    recipient channel
+              uint32    bytes to add
+            */
+        case SSH_MSG_CHANNEL_WINDOW_ADJUST:
+            if(datalen < 9)
+                ;
+            else {
+                uint32_t bytestoadd = _libssh2_ntohu32(data + 5);
+                channelp =
+                    _libssh2_channel_locate(session,
+                                            _libssh2_ntohu32(data + 1));
+                if(channelp) {
+                    channelp->local.window_size += bytestoadd;
+
+                    _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                                   "Window adjust for channel %lu/%lu, "
+                                   "adding %lu bytes, new window_size=%lu",
+                                   channelp->local.id,
+                                   channelp->remote.id,
+                                   bytestoadd,
+                                   channelp->local.window_size);
+                }
+            }
+            LIBSSH2_FREE(session, data);
+            session->packAdd_state = libssh2_NB_state_idle;
+            return 0;
+        default:
+            break;
+        }
+
+        session->packAdd_state = libssh2_NB_state_sent;
+    }
+
+    if (session->packAdd_state == libssh2_NB_state_sent) {
+        LIBSSH2_PACKET *packetp =
+            LIBSSH2_ALLOC(session, sizeof(LIBSSH2_PACKET));
+        if (!packetp) {
+            _libssh2_debug(session, LIBSSH2_ERROR_ALLOC,
+                           "memory for packet");
+            session->packAdd_state = libssh2_NB_state_idle;
+            return LIBSSH2_ERROR_ALLOC;
+        }
+        packetp->data = data;
+        packetp->data_len = datalen;
+        packetp->data_head = data_head;
+
+        _libssh2_list_add(&session->packets, &packetp->node);
+
+        session->packAdd_state = libssh2_NB_state_sent1;
+    }
+
+    if ((msg == SSH_MSG_KEXINIT &&
+         !(session->state & LIBSSH2_STATE_EXCHANGING_KEYS)) ||
+        (session->packAdd_state == libssh2_NB_state_sent2)) {
+        if (session->packAdd_state == libssh2_NB_state_sent1) {
+            /*
+             * Remote wants new keys
+             * Well, it's already in the brigade,
+             * let's just call back into ourselves
+             */
+            _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Renegotiating Keys");
+
+            session->packAdd_state = libssh2_NB_state_sent2;
+        }
+
+        /*
+         * The KEXINIT message has been added to the queue.  The packAdd and
+         * readPack states need to be reset because _libssh2_kex_exchange
+         * (eventually) calls upon _libssh2_transport_read to read the rest of
+         * the key exchange conversation.
+         */
+        session->readPack_state = libssh2_NB_state_idle;
+        session->packet.total_num = 0;
+        session->packAdd_state = libssh2_NB_state_idle;
+        session->fullpacket_state = libssh2_NB_state_idle;
+
+        memset(&session->startup_key_state, 0, sizeof(key_exchange_state_t));
+
+        /*
+         * If there was a key reexchange failure, let's just hope we didn't
+         * send NEWKEYS yet, otherwise remote will drop us like a rock
+         */
+        rc = _libssh2_kex_exchange(session, 1, &session->startup_key_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+            return rc;
+    }
+
+    session->packAdd_state = libssh2_NB_state_idle;
+    return 0;
+}
+
+/*
+ * _libssh2_packet_ask
+ *
+ * Scan the brigade for a matching packet type, optionally poll the socket for
+ * a packet first
+ */
+int
+_libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type,
+                    unsigned char **data, size_t *data_len,
+                    int match_ofs, const unsigned char *match_buf,
+                    size_t match_len)
+{
+    LIBSSH2_PACKET *packet = _libssh2_list_first(&session->packets);
+
+    _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                   "Looking for packet of type: %d", (int) packet_type);
+
+    while (packet) {
+        if (packet->data[0] == packet_type
+            && (packet->data_len >= (match_ofs + match_len))
+            && (!match_buf ||
+                (memcmp(packet->data + match_ofs, match_buf,
+                        match_len) == 0))) {
+            *data = packet->data;
+            *data_len = packet->data_len;
+
+            /* unlink struct from session->packets */
+            _libssh2_list_remove(&packet->node);
+
+            LIBSSH2_FREE(session, packet);
+
+            return 0;
+        }
+        packet = _libssh2_list_next(&packet->node);
+    }
+    return -1;
+}
+
+/*
+ * libssh2_packet_askv
+ *
+ * Scan for any of a list of packet types in the brigade, optionally poll the
+ * socket for a packet first
+ */
+int
+_libssh2_packet_askv(LIBSSH2_SESSION * session,
+                     const unsigned char *packet_types,
+                     unsigned char **data, size_t *data_len,
+                     int match_ofs,
+                     const unsigned char *match_buf,
+                     size_t match_len)
+{
+    int i, packet_types_len = strlen((char *) packet_types);
+
+    for(i = 0; i < packet_types_len; i++) {
+        if (0 == _libssh2_packet_ask(session, packet_types[i], data,
+                                     data_len, match_ofs,
+                                     match_buf, match_len)) {
+            return 0;
+        }
+    }
+
+    return -1;
+}
+
+/*
+ * _libssh2_packet_require
+ *
+ * Loops _libssh2_transport_read() until the packet requested is available
+ * SSH_DISCONNECT or a SOCKET_DISCONNECTED will cause a bailout
+ *
+ * Returns negative on error
+ * Returns 0 when it has taken care of the requested packet.
+ */
+int
+_libssh2_packet_require(LIBSSH2_SESSION * session, unsigned char packet_type,
+                        unsigned char **data, size_t *data_len,
+                        int match_ofs,
+                        const unsigned char *match_buf,
+                        size_t match_len,
+                        packet_require_state_t *state)
+{
+    if (state->start == 0) {
+        if (_libssh2_packet_ask(session, packet_type, data, data_len,
+                                match_ofs, match_buf,
+                                match_len) == 0) {
+            /* A packet was available in the packet brigade */
+            return 0;
+        }
+
+        state->start = time(NULL);
+    }
+
+    while (session->socket_state == LIBSSH2_SOCKET_CONNECTED) {
+        int ret = _libssh2_transport_read(session);
+        if (ret == LIBSSH2_ERROR_EAGAIN)
+            return ret;
+        else if (ret < 0) {
+            state->start = 0;
+            /* an error which is not just because of blocking */
+            return ret;
+        } else if (ret == packet_type) {
+            /* Be lazy, let packet_ask pull it out of the brigade */
+            ret = _libssh2_packet_ask(session, packet_type, data, data_len,
+                                      match_ofs, match_buf, match_len);
+            state->start = 0;
+            return ret;
+        } else if (ret == 0) {
+            /* nothing available, wait until data arrives or we time out */
+            long left = LIBSSH2_READ_TIMEOUT - (long)(time(NULL) -
+                                                      state->start);
+
+            if (left <= 0) {
+                state->start = 0;
+                return LIBSSH2_ERROR_TIMEOUT;
+            }
+            return -1; /* no packet available yet */
+        }
+    }
+
+    /* Only reached if the socket died */
+    return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+}
+
+/*
+ * _libssh2_packet_burn
+ *
+ * Loops _libssh2_transport_read() until any packet is available and promptly
+ * discards it.
+ * Used during KEX exchange to discard badly guessed KEX_INIT packets
+ */
+int
+_libssh2_packet_burn(LIBSSH2_SESSION * session,
+                     libssh2_nonblocking_states * state)
+{
+    unsigned char *data;
+    size_t data_len;
+    unsigned char all_packets[255];
+    int i;
+    int ret;
+
+    if (*state == libssh2_NB_state_idle) {
+        for(i = 1; i < 256; i++) {
+            all_packets[i - 1] = i;
+        }
+
+        if (_libssh2_packet_askv(session, all_packets, &data, &data_len, 0,
+                                 NULL, 0) == 0) {
+            i = data[0];
+            /* A packet was available in the packet brigade, burn it */
+            LIBSSH2_FREE(session, data);
+            return i;
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "Blocking until packet becomes available to burn");
+        *state = libssh2_NB_state_created;
+    }
+
+    while (session->socket_state == LIBSSH2_SOCKET_CONNECTED) {
+        ret = _libssh2_transport_read(session);
+        if (ret == LIBSSH2_ERROR_EAGAIN) {
+            return ret;
+        } else if (ret < 0) {
+            *state = libssh2_NB_state_idle;
+            return ret;
+        } else if (ret == 0) {
+            /* FIXME: this might busyloop */
+            continue;
+        }
+
+        /* Be lazy, let packet_ask pull it out of the brigade */
+        if (0 ==
+            _libssh2_packet_ask(session, ret, &data, &data_len, 0, NULL, 0)) {
+            /* Smoke 'em if you got 'em */
+            LIBSSH2_FREE(session, data);
+            *state = libssh2_NB_state_idle;
+            return ret;
+        }
+    }
+
+    /* Only reached if the socket died */
+    return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+}
+
+/*
+ * _libssh2_packet_requirev
+ *
+ * Loops _libssh2_transport_read() until one of a list of packet types
+ * requested is available. SSH_DISCONNECT or a SOCKET_DISCONNECTED will cause
+ * a bailout. packet_types is a null terminated list of packet_type numbers
+ */
+
+int
+_libssh2_packet_requirev(LIBSSH2_SESSION *session,
+                         const unsigned char *packet_types,
+                         unsigned char **data, size_t *data_len,
+                         int match_ofs,
+                         const unsigned char *match_buf, size_t match_len,
+                         packet_requirev_state_t * state)
+{
+    if (_libssh2_packet_askv(session, packet_types, data, data_len, match_ofs,
+                             match_buf, match_len) == 0) {
+        /* One of the packets listed was available in the packet brigade */
+        state->start = 0;
+        return 0;
+    }
+
+    if (state->start == 0) {
+        state->start = time(NULL);
+    }
+
+    while (session->socket_state != LIBSSH2_SOCKET_DISCONNECTED) {
+        int ret = _libssh2_transport_read(session);
+        if ((ret < 0) && (ret != LIBSSH2_ERROR_EAGAIN)) {
+            state->start = 0;
+            return ret;
+        }
+        if (ret <= 0) {
+            long left = LIBSSH2_READ_TIMEOUT -
+                (long)(time(NULL) - state->start);
+
+            if (left <= 0) {
+                state->start = 0;
+                return LIBSSH2_ERROR_TIMEOUT;
+            }
+            else if (ret == LIBSSH2_ERROR_EAGAIN) {
+                return ret;
+            }
+        }
+
+        if (strchr((char *) packet_types, ret)) {
+            /* Be lazy, let packet_ask pull it out of the brigade */
+            return _libssh2_packet_askv(session, packet_types, data,
+                                        data_len, match_ofs, match_buf,
+                                        match_len);
+        }
+    }
+
+    /* Only reached if the socket died */
+    state->start = 0;
+    return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+}
+
diff --git a/pgadmin/libssh2/pem.c b/pgadmin/libssh2/pem.c
new file mode 100644
index 0000000..5749bc8
--- /dev/null
+++ b/pgadmin/libssh2/pem.c
@@ -0,0 +1,213 @@
+/* Copyright (C) 2007 The Written Word, Inc.
+ * Copyright (C) 2008, Simon Josefsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#ifdef LIBSSH2_LIBGCRYPT /* compile only if we build with libgcrypt */
+
+static int
+readline(char *line, int line_size, FILE * fp)
+{
+    if (!fgets(line, line_size, fp)) {
+        return -1;
+    }
+    if (*line && line[strlen(line) - 1] == '\n') {
+        line[strlen(line) - 1] = '\0';
+    }
+    if (*line && line[strlen(line) - 1] == '\r') {
+        line[strlen(line) - 1] = '\0';
+    }
+    return 0;
+}
+
+#define LINE_SIZE 128
+
+int
+_libssh2_pem_parse(LIBSSH2_SESSION * session,
+                   const char *headerbegin,
+                   const char *headerend,
+                   FILE * fp, unsigned char **data, unsigned int *datalen)
+{
+    char line[LINE_SIZE];
+    char *b64data = NULL;
+    unsigned int b64datalen = 0;
+    int ret;
+
+    do {
+        if (readline(line, LINE_SIZE, fp)) {
+            return -1;
+        }
+    }
+    while (strcmp(line, headerbegin) != 0);
+
+    *line = '\0';
+
+    do {
+        if (*line) {
+            char *tmp;
+            size_t linelen;
+
+            linelen = strlen(line);
+            tmp = LIBSSH2_REALLOC(session, b64data, b64datalen + linelen);
+            if (!tmp) {
+                ret = -1;
+                goto out;
+            }
+            memcpy(tmp + b64datalen, line, linelen);
+            b64data = tmp;
+            b64datalen += linelen;
+        }
+
+        if (readline(line, LINE_SIZE, fp)) {
+            ret = -1;
+            goto out;
+        }
+    } while (strcmp(line, headerend) != 0);
+
+    if (libssh2_base64_decode(session, (char**) data, datalen,
+                              b64data, b64datalen)) {
+        ret = -1;
+        goto out;
+    }
+
+    ret = 0;
+  out:
+    if (b64data) {
+        LIBSSH2_FREE(session, b64data);
+    }
+    return ret;
+}
+
+static int
+read_asn1_length(const unsigned char *data,
+                 unsigned int datalen, unsigned int *len)
+{
+    unsigned int lenlen;
+    int nextpos;
+
+    if (datalen < 1) {
+        return -1;
+    }
+    *len = data[0];
+
+    if (*len >= 0x80) {
+        lenlen = *len & 0x7F;
+        *len = data[1];
+        if (1 + lenlen > datalen) {
+            return -1;
+        }
+        if (lenlen > 1) {
+            *len <<= 8;
+            *len |= data[2];
+        }
+    } else {
+        lenlen = 0;
+    }
+
+    nextpos = 1 + lenlen;
+    if (lenlen > 2 || 1 + lenlen + *len > datalen) {
+        return -1;
+    }
+
+    return nextpos;
+}
+
+int
+_libssh2_pem_decode_sequence(unsigned char **data, unsigned int *datalen)
+{
+    unsigned int len;
+    int lenlen;
+
+    if (*datalen < 1) {
+        return -1;
+    }
+
+    if ((*data)[0] != '\x30') {
+        return -1;
+    }
+
+    (*data)++;
+    (*datalen)--;
+
+    lenlen = read_asn1_length(*data, *datalen, &len);
+    if (lenlen < 0 || lenlen + len != *datalen) {
+        return -1;
+    }
+
+    *data += lenlen;
+    *datalen -= lenlen;
+
+    return 0;
+}
+
+int
+_libssh2_pem_decode_integer(unsigned char **data, unsigned int *datalen,
+                            unsigned char **i, unsigned int *ilen)
+{
+    unsigned int len;
+    int lenlen;
+
+    if (*datalen < 1) {
+        return -1;
+    }
+
+    if ((*data)[0] != '\x02') {
+        return -1;
+    }
+
+    (*data)++;
+    (*datalen)--;
+
+    lenlen = read_asn1_length(*data, *datalen, &len);
+    if (lenlen < 0 || lenlen + len > *datalen) {
+        return -1;
+    }
+
+    *data += lenlen;
+    *datalen -= lenlen;
+
+    *i = *data;
+    *ilen = len;
+
+    *data += len;
+    *datalen -= len;
+
+    return 0;
+}
+
+#endif /* LIBSSH2_LIBGCRYPT */
diff --git a/pgadmin/libssh2/publickey.c b/pgadmin/libssh2/publickey.c
new file mode 100644
index 0000000..282fffe
--- /dev/null
+++ b/pgadmin/libssh2/publickey.c
@@ -0,0 +1,1058 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2010-2012 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include "libssh2_publickey.h"
+#include "channel.h"
+#include "session.h"
+
+#define LIBSSH2_PUBLICKEY_VERSION               2
+
+/* Numericised response codes -- Not IETF, just local representation */
+#define LIBSSH2_PUBLICKEY_RESPONSE_STATUS       0
+#define LIBSSH2_PUBLICKEY_RESPONSE_VERSION      1
+#define LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY    2
+
+typedef struct _LIBSSH2_PUBLICKEY_CODE_LIST
+{
+    int code;
+    const char *name;
+    int name_len;
+} LIBSSH2_PUBLICKEY_CODE_LIST;
+
+static const LIBSSH2_PUBLICKEY_CODE_LIST publickey_response_codes[] =
+{
+    {LIBSSH2_PUBLICKEY_RESPONSE_STATUS, "status", sizeof("status") - 1},
+    {LIBSSH2_PUBLICKEY_RESPONSE_VERSION, "version", sizeof("version") - 1},
+    {LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY, "publickey",
+     sizeof("publickey") - 1} ,
+    {0, NULL, 0}
+};
+
+/* PUBLICKEY status codes -- IETF defined */
+#define LIBSSH2_PUBLICKEY_SUCCESS               0
+#define LIBSSH2_PUBLICKEY_ACCESS_DENIED         1
+#define LIBSSH2_PUBLICKEY_STORAGE_EXCEEDED      2
+#define LIBSSH2_PUBLICKEY_VERSION_NOT_SUPPORTED 3
+#define LIBSSH2_PUBLICKEY_KEY_NOT_FOUND         4
+#define LIBSSH2_PUBLICKEY_KEY_NOT_SUPPORTED     5
+#define LIBSSH2_PUBLICKEY_KEY_ALREADY_PRESENT   6
+#define LIBSSH2_PUBLICKEY_GENERAL_FAILURE       7
+#define LIBSSH2_PUBLICKEY_REQUEST_NOT_SUPPORTED 8
+
+#define LIBSSH2_PUBLICKEY_STATUS_CODE_MAX       8
+
+static const LIBSSH2_PUBLICKEY_CODE_LIST publickey_status_codes[] = {
+    {LIBSSH2_PUBLICKEY_SUCCESS, "success", sizeof("success") - 1} ,
+    {LIBSSH2_PUBLICKEY_ACCESS_DENIED, "access denied",
+     sizeof("access denied") - 1},
+    {LIBSSH2_PUBLICKEY_STORAGE_EXCEEDED, "storage exceeded",
+     sizeof("storage exceeded") - 1} ,
+    {LIBSSH2_PUBLICKEY_VERSION_NOT_SUPPORTED, "version not supported",
+     sizeof("version not supported") - 1} ,
+    {LIBSSH2_PUBLICKEY_KEY_NOT_FOUND, "key not found",
+     sizeof("key not found") - 1},
+    {LIBSSH2_PUBLICKEY_KEY_NOT_SUPPORTED, "key not supported",
+     sizeof("key not supported") - 1},
+    {LIBSSH2_PUBLICKEY_KEY_ALREADY_PRESENT, "key already present",
+     sizeof("key already present") - 1},
+    {LIBSSH2_PUBLICKEY_GENERAL_FAILURE, "general failure",
+     sizeof("general failure") - 1},
+    {LIBSSH2_PUBLICKEY_REQUEST_NOT_SUPPORTED, "request not supported",
+     sizeof("request not supported") - 1},
+    {0, NULL, 0}
+};
+
+/*
+ * publickey_status_error
+ *
+ * Format an error message from a status code
+ */
+static void
+publickey_status_error(const LIBSSH2_PUBLICKEY *pkey,
+                       LIBSSH2_SESSION *session, int status)
+{
+    const char *msg;
+
+    /* GENERAL_FAILURE got remapped between version 1 and 2 */
+    if (status == 6 && pkey && pkey->version == 1) {
+        status = 7;
+    }
+
+    if (status < 0 || status > LIBSSH2_PUBLICKEY_STATUS_CODE_MAX) {
+        msg = "unknown";
+    } else {
+        msg = publickey_status_codes[status].name;
+    }
+
+    _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL, msg);
+}
+
+/*
+ * publickey_packet_receive
+ *
+ * Read a packet from the subsystem
+ */
+static int
+publickey_packet_receive(LIBSSH2_PUBLICKEY * pkey,
+                         unsigned char **data, size_t *data_len)
+{
+    LIBSSH2_CHANNEL *channel = pkey->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char buffer[4];
+    int rc;
+
+    if (pkey->receive_state == libssh2_NB_state_idle) {
+        rc = _libssh2_channel_read(channel, 0, (char *) buffer, 4);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc != 4) {
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                                  "Invalid response from publickey subsystem");
+        }
+
+        pkey->receive_packet_len = _libssh2_ntohu32(buffer);
+        pkey->receive_packet =
+            LIBSSH2_ALLOC(session, pkey->receive_packet_len);
+        if (!pkey->receive_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate publickey response "
+                                  "buffer");
+        }
+
+        pkey->receive_state = libssh2_NB_state_sent;
+    }
+
+    if (pkey->receive_state == libssh2_NB_state_sent) {
+        rc = _libssh2_channel_read(channel, 0, (char *) pkey->receive_packet,
+                                   pkey->receive_packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc != (int)pkey->receive_packet_len) {
+            LIBSSH2_FREE(session, pkey->receive_packet);
+            pkey->receive_packet = NULL;
+            pkey->receive_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_TIMEOUT,
+                                  "Timeout waiting for publickey subsystem "
+                                  "response packet");
+        }
+
+        *data = pkey->receive_packet;
+        *data_len = pkey->receive_packet_len;
+    }
+
+    pkey->receive_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/* publickey_response_id
+ *
+ * Translate a string response name to a numeric code
+ * Data will be incremented by 4 + response_len on success only
+ */
+static int
+publickey_response_id(unsigned char **pdata, size_t data_len)
+{
+    size_t response_len;
+    unsigned char *data = *pdata;
+    const LIBSSH2_PUBLICKEY_CODE_LIST *codes = publickey_response_codes;
+
+    if (data_len < 4) {
+        /* Malformed response */
+        return -1;
+    }
+    response_len = _libssh2_ntohu32(data);
+    data += 4;
+    data_len -= 4;
+    if (data_len < response_len) {
+        /* Malformed response */
+        return -1;
+    }
+
+    while (codes->name) {
+        if ((unsigned long)codes->name_len == response_len &&
+            strncmp(codes->name, (char *) data, response_len) == 0) {
+            *pdata = data + response_len;
+            return codes->code;
+        }
+        codes++;
+    }
+
+    return -1;
+}
+
+/* publickey_response_success
+ *
+ * Generic helper routine to wait for success response and nothing else
+ */
+static int
+publickey_response_success(LIBSSH2_PUBLICKEY * pkey)
+{
+    LIBSSH2_SESSION *session = pkey->channel->session;
+    unsigned char *data, *s;
+    size_t data_len;
+    int response;
+
+    while (1) {
+        int rc = publickey_packet_receive(pkey, &data, &data_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_TIMEOUT,
+                                  "Timeout waiting for response from "
+                                  "publickey subsystem");
+        }
+
+        s = data;
+        response = publickey_response_id(&s, data_len);
+
+        switch (response) {
+        case LIBSSH2_PUBLICKEY_RESPONSE_STATUS:
+            /* Error, or processing complete */
+        {
+            unsigned long status = _libssh2_ntohu32(s);
+
+            LIBSSH2_FREE(session, data);
+
+            if (status == LIBSSH2_PUBLICKEY_SUCCESS)
+                return 0;
+
+            publickey_status_error(pkey, session, status);
+            return -1;
+        }
+        default:
+            LIBSSH2_FREE(session, data);
+            if (response < 0) {
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                                      "Invalid publickey subsystem response");
+            }
+            /* Unknown/Unexpected */
+            _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                           "Unexpected publickey subsystem response");
+            data = NULL;
+        }
+    }
+    /* never reached, but include `return` to silence compiler warnings */
+    return -1;
+}
+
+/* *****************
+ * Publickey API *
+ ***************** */
+
+/*
+ * publickey_init
+ *
+ * Startup the publickey subsystem
+ */
+static LIBSSH2_PUBLICKEY *publickey_init(LIBSSH2_SESSION *session)
+{
+    int response;
+    int rc;
+
+    if (session->pkeyInit_state == libssh2_NB_state_idle) {
+        session->pkeyInit_data = NULL;
+        session->pkeyInit_pkey = NULL;
+        session->pkeyInit_channel = NULL;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                       "Initializing publickey subsystem");
+
+        session->pkeyInit_state = libssh2_NB_state_allocated;
+    }
+
+    if (session->pkeyInit_state == libssh2_NB_state_allocated) {
+
+        session->pkeyInit_channel =
+            _libssh2_channel_open(session, "session",
+                                  sizeof("session") - 1,
+                                  LIBSSH2_CHANNEL_WINDOW_DEFAULT,
+                                  LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL,
+                                  0);
+        if (!session->pkeyInit_channel) {
+            if (libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN)
+                /* The error state is already set, so leave it */
+                return NULL;
+            _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE,
+                           "Unable to startup channel");
+            goto err_exit;
+        }
+
+        session->pkeyInit_state = libssh2_NB_state_sent;
+    }
+
+    if (session->pkeyInit_state == libssh2_NB_state_sent) {
+        rc = _libssh2_channel_process_startup(session->pkeyInit_channel,
+                                              "subsystem",
+                                              sizeof("subsystem") - 1,
+                                              "publickey",
+                                              sizeof("publickey") - 1);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block starting publickey subsystem");
+            return NULL;
+        } else if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE,
+                           "Unable to request publickey subsystem");
+            goto err_exit;
+        }
+
+        session->pkeyInit_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->pkeyInit_state == libssh2_NB_state_sent1) {
+        unsigned char *s;
+        rc = _libssh2_channel_extended_data(session->pkeyInit_channel,
+                                            LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block starting publickey subsystem");
+            return NULL;
+        }
+
+        session->pkeyInit_pkey =
+            LIBSSH2_ALLOC(session, sizeof(LIBSSH2_PUBLICKEY));
+        if (!session->pkeyInit_pkey) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate a new publickey structure");
+            goto err_exit;
+        }
+        memset(session->pkeyInit_pkey, 0, sizeof(LIBSSH2_PUBLICKEY));
+        session->pkeyInit_pkey->channel = session->pkeyInit_channel;
+        session->pkeyInit_pkey->version = 0;
+
+        s = session->pkeyInit_buffer;
+        _libssh2_htonu32(s, 4 + (sizeof("version") - 1) + 4);
+        s += 4;
+        _libssh2_htonu32(s, sizeof("version") - 1);
+        s += 4;
+        memcpy(s, "version", sizeof("version") - 1);
+        s += sizeof("version") - 1;
+        _libssh2_htonu32(s, LIBSSH2_PUBLICKEY_VERSION);
+
+        session->pkeyInit_buffer_sent = 0;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                       "Sending publickey advertising version %d support",
+                       (int) LIBSSH2_PUBLICKEY_VERSION);
+
+        session->pkeyInit_state = libssh2_NB_state_sent2;
+    }
+
+    if (session->pkeyInit_state == libssh2_NB_state_sent2) {
+        rc = _libssh2_channel_write(session->pkeyInit_channel, 0,
+                                    session->pkeyInit_buffer,
+                                    19 - session->pkeyInit_buffer_sent);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block sending publickey version packet");
+            return NULL;
+        } else if (rc < 0) {
+            _libssh2_error(session, rc,
+                           "Unable to send publickey version packet");
+            goto err_exit;
+        }
+        session->pkeyInit_buffer_sent += rc;
+        if(session->pkeyInit_buffer_sent < 19) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Need to be called again to complete this");
+            return NULL;
+        }
+
+        session->pkeyInit_state = libssh2_NB_state_sent3;
+    }
+
+    if (session->pkeyInit_state == libssh2_NB_state_sent3) {
+        while (1) {
+            unsigned char *s;
+            rc = publickey_packet_receive(session->pkeyInit_pkey,
+                                          &session->pkeyInit_data,
+                                          &session->pkeyInit_data_len);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block waiting for response from "
+                               "publickey subsystem");
+                return NULL;
+            } else if (rc) {
+                _libssh2_error(session, LIBSSH2_ERROR_SOCKET_TIMEOUT,
+                               "Timeout waiting for response from "
+                               "publickey subsystem");
+                goto err_exit;
+            }
+
+            s = session->pkeyInit_data;
+            if ((response =
+                 publickey_response_id(&s, session->pkeyInit_data_len)) < 0) {
+                _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                               "Invalid publickey subsystem response code");
+                goto err_exit;
+            }
+
+            switch (response) {
+            case LIBSSH2_PUBLICKEY_RESPONSE_STATUS:
+                /* Error */
+            {
+                unsigned long status, descr_len, lang_len;
+
+                status = _libssh2_ntohu32(s);
+                s += 4;
+                descr_len = _libssh2_ntohu32(s);
+                s += 4;
+                /* description starts here */
+                s += descr_len;
+                lang_len = _libssh2_ntohu32(s);
+                s += 4;
+                /* lang starts here */
+                s += lang_len;
+
+                if (s >
+                    session->pkeyInit_data + session->pkeyInit_data_len) {
+                    _libssh2_error(session,
+                                   LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                                   "Malformed publickey subsystem packet");
+                    goto err_exit;
+                }
+
+                publickey_status_error(NULL, session, status);
+
+                goto err_exit;
+            }
+
+            case LIBSSH2_PUBLICKEY_RESPONSE_VERSION:
+                /* What we want */
+                session->pkeyInit_pkey->version = _libssh2_ntohu32(s);
+                if (session->pkeyInit_pkey->version >
+                    LIBSSH2_PUBLICKEY_VERSION) {
+                    _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                                   "Truncate remote publickey version from %lu",
+                                   session->pkeyInit_pkey->version);
+                    session->pkeyInit_pkey->version =
+                        LIBSSH2_PUBLICKEY_VERSION;
+                }
+                _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                               "Enabling publickey subsystem version %lu",
+                               session->pkeyInit_pkey->version);
+                LIBSSH2_FREE(session, session->pkeyInit_data);
+                session->pkeyInit_data = NULL;
+                session->pkeyInit_state = libssh2_NB_state_idle;
+                return session->pkeyInit_pkey;
+
+            default:
+                /* Unknown/Unexpected */
+                _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                               "Unexpected publickey subsystem response, "
+                               "ignoring");
+                LIBSSH2_FREE(session, session->pkeyInit_data);
+                session->pkeyInit_data = NULL;
+            }
+        }
+    }
+
+    /* Never reached except by direct goto */
+  err_exit:
+    session->pkeyInit_state = libssh2_NB_state_sent4;
+    if (session->pkeyInit_channel) {
+        rc = _libssh2_channel_close(session->pkeyInit_channel);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block closing channel");
+            return NULL;
+        }
+    }
+    if (session->pkeyInit_pkey) {
+        LIBSSH2_FREE(session, session->pkeyInit_pkey);
+        session->pkeyInit_pkey = NULL;
+    }
+    if (session->pkeyInit_data) {
+        LIBSSH2_FREE(session, session->pkeyInit_data);
+        session->pkeyInit_data = NULL;
+    }
+    session->pkeyInit_state = libssh2_NB_state_idle;
+    return NULL;
+}
+
+/*
+ * libssh2_publickey_init
+ *
+ * Startup the publickey subsystem
+ */
+LIBSSH2_API LIBSSH2_PUBLICKEY *
+libssh2_publickey_init(LIBSSH2_SESSION *session)
+{
+    LIBSSH2_PUBLICKEY *ptr;
+
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       publickey_init(session));
+    return ptr;
+}
+
+
+
+/*
+ * libssh2_publickey_add_ex
+ *
+ * Add a new public key entry
+ */
+LIBSSH2_API int
+libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name,
+                         unsigned long name_len, const unsigned char *blob,
+                         unsigned long blob_len, char overwrite,
+                         unsigned long num_attrs,
+                         const libssh2_publickey_attribute attrs[])
+{
+    LIBSSH2_CHANNEL *channel;
+    LIBSSH2_SESSION *session;
+    /*  19 = packet_len(4) + add_len(4) + "add"(3) + name_len(4) + {name}
+        blob_len(4) + {blob} */
+    unsigned long i, packet_len = 19 + name_len + blob_len;
+    unsigned char *comment = NULL;
+    unsigned long comment_len = 0;
+    int rc;
+
+    if(!pkey)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    channel = pkey->channel;
+    session = channel->session;
+
+    if (pkey->add_state == libssh2_NB_state_idle) {
+        pkey->add_packet = NULL;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY, "Adding %s publickey",
+                       name);
+
+        if (pkey->version == 1) {
+            for(i = 0; i < num_attrs; i++) {
+                /* Search for a comment attribute */
+                if (attrs[i].name_len == (sizeof("comment") - 1) &&
+                    strncmp(attrs[i].name, "comment",
+                            sizeof("comment") - 1) == 0) {
+                    comment = (unsigned char *) attrs[i].value;
+                    comment_len = attrs[i].value_len;
+                    break;
+                }
+            }
+            packet_len += 4 + comment_len;
+        } else {
+            packet_len += 5;    /* overwrite(1) + attribute_count(4) */
+            for(i = 0; i < num_attrs; i++) {
+                packet_len += 9 + attrs[i].name_len + attrs[i].value_len;
+                /* name_len(4) + value_len(4) + mandatory(1) */
+            }
+        }
+
+        pkey->add_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!pkey->add_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "publickey \"add\" packet");
+        }
+
+        pkey->add_s = pkey->add_packet;
+        _libssh2_htonu32(pkey->add_s, packet_len - 4);
+        pkey->add_s += 4;
+        _libssh2_htonu32(pkey->add_s, sizeof("add") - 1);
+        pkey->add_s += 4;
+        memcpy(pkey->add_s, "add", sizeof("add") - 1);
+        pkey->add_s += sizeof("add") - 1;
+        if (pkey->version == 1) {
+            _libssh2_htonu32(pkey->add_s, comment_len);
+            pkey->add_s += 4;
+            if (comment) {
+                memcpy(pkey->add_s, comment, comment_len);
+                pkey->add_s += comment_len;
+            }
+
+            _libssh2_htonu32(pkey->add_s, name_len);
+            pkey->add_s += 4;
+            memcpy(pkey->add_s, name, name_len);
+            pkey->add_s += name_len;
+            _libssh2_htonu32(pkey->add_s, blob_len);
+            pkey->add_s += 4;
+            memcpy(pkey->add_s, blob, blob_len);
+            pkey->add_s += blob_len;
+        } else {
+            /* Version == 2 */
+
+            _libssh2_htonu32(pkey->add_s, name_len);
+            pkey->add_s += 4;
+            memcpy(pkey->add_s, name, name_len);
+            pkey->add_s += name_len;
+            _libssh2_htonu32(pkey->add_s, blob_len);
+            pkey->add_s += 4;
+            memcpy(pkey->add_s, blob, blob_len);
+            pkey->add_s += blob_len;
+            *(pkey->add_s++) = overwrite ? 0x01 : 0;
+            _libssh2_htonu32(pkey->add_s, num_attrs);
+            pkey->add_s += 4;
+            for(i = 0; i < num_attrs; i++) {
+                _libssh2_htonu32(pkey->add_s, attrs[i].name_len);
+                pkey->add_s += 4;
+                memcpy(pkey->add_s, attrs[i].name, attrs[i].name_len);
+                pkey->add_s += attrs[i].name_len;
+                _libssh2_htonu32(pkey->add_s, attrs[i].value_len);
+                pkey->add_s += 4;
+                memcpy(pkey->add_s, attrs[i].value, attrs[i].value_len);
+                pkey->add_s += attrs[i].value_len;
+                *(pkey->add_s++) = attrs[i].mandatory ? 0x01 : 0;
+            }
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                       "Sending publickey \"add\" packet: "
+                       "type=%s blob_len=%ld num_attrs=%ld",
+                       name, blob_len, num_attrs);
+
+        pkey->add_state = libssh2_NB_state_created;
+    }
+
+    if (pkey->add_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, pkey->add_packet,
+                                    (pkey->add_s - pkey->add_packet));
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((pkey->add_s - pkey->add_packet) != rc) {
+            LIBSSH2_FREE(session, pkey->add_packet);
+            pkey->add_packet = NULL;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send publickey add packet");
+        }
+        LIBSSH2_FREE(session, pkey->add_packet);
+        pkey->add_packet = NULL;
+
+        pkey->add_state = libssh2_NB_state_sent;
+    }
+
+    rc = publickey_response_success(pkey);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    }
+
+    pkey->add_state = libssh2_NB_state_idle;
+
+    return rc;
+}
+
+/* libssh2_publickey_remove_ex
+ * Remove an existing publickey so that authentication can no longer be
+ * performed using it
+ */
+LIBSSH2_API int
+libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY * pkey,
+                            const unsigned char *name, unsigned long name_len,
+                            const unsigned char *blob, unsigned long blob_len)
+{
+    LIBSSH2_CHANNEL *channel;
+    LIBSSH2_SESSION *session;
+    /* 22 = packet_len(4) + remove_len(4) + "remove"(6) + name_len(4) + {name}
+       + blob_len(4) + {blob} */
+    unsigned long packet_len = 22 + name_len + blob_len;
+    int rc;
+
+    if(!pkey)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    channel = pkey->channel;
+    session = channel->session;
+
+    if (pkey->remove_state == libssh2_NB_state_idle) {
+        pkey->remove_packet = NULL;
+
+        pkey->remove_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!pkey->remove_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "publickey \"remove\" packet");
+        }
+
+        pkey->remove_s = pkey->remove_packet;
+        _libssh2_htonu32(pkey->remove_s, packet_len - 4);
+        pkey->remove_s += 4;
+        _libssh2_htonu32(pkey->remove_s, sizeof("remove") - 1);
+        pkey->remove_s += 4;
+        memcpy(pkey->remove_s, "remove", sizeof("remove") - 1);
+        pkey->remove_s += sizeof("remove") - 1;
+        _libssh2_htonu32(pkey->remove_s, name_len);
+        pkey->remove_s += 4;
+        memcpy(pkey->remove_s, name, name_len);
+        pkey->remove_s += name_len;
+        _libssh2_htonu32(pkey->remove_s, blob_len);
+        pkey->remove_s += 4;
+        memcpy(pkey->remove_s, blob, blob_len);
+        pkey->remove_s += blob_len;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                       "Sending publickey \"remove\" packet: "
+                       "type=%s blob_len=%ld",
+                       name, blob_len);
+
+        pkey->remove_state = libssh2_NB_state_created;
+    }
+
+    if (pkey->remove_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, pkey->remove_packet,
+                                    (pkey->remove_s - pkey->remove_packet));
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((pkey->remove_s - pkey->remove_packet) != rc) {
+            LIBSSH2_FREE(session, pkey->remove_packet);
+            pkey->remove_packet = NULL;
+            pkey->remove_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send publickey remove packet");
+        }
+        LIBSSH2_FREE(session, pkey->remove_packet);
+        pkey->remove_packet = NULL;
+
+        pkey->remove_state = libssh2_NB_state_sent;
+    }
+
+    rc = publickey_response_success(pkey);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    }
+
+    pkey->remove_state = libssh2_NB_state_idle;
+
+    return rc;
+}
+
+/* libssh2_publickey_list_fetch
+ * Fetch a list of supported public key from a server
+ */
+LIBSSH2_API int
+libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY * pkey, unsigned long *num_keys,
+                             libssh2_publickey_list ** pkey_list)
+{
+    LIBSSH2_CHANNEL *channel;
+    LIBSSH2_SESSION *session;
+    libssh2_publickey_list *list = NULL;
+    unsigned long buffer_len = 12, keys = 0, max_keys = 0, i;
+    /* 12 = packet_len(4) + list_len(4) + "list"(4) */
+    int response;
+    int rc;
+
+    if(!pkey)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    channel = pkey->channel;
+    session = channel->session;
+
+    if (pkey->listFetch_state == libssh2_NB_state_idle) {
+        pkey->listFetch_data = NULL;
+
+        pkey->listFetch_s = pkey->listFetch_buffer;
+        _libssh2_htonu32(pkey->listFetch_s, buffer_len - 4);
+        pkey->listFetch_s += 4;
+        _libssh2_htonu32(pkey->listFetch_s, sizeof("list") - 1);
+        pkey->listFetch_s += 4;
+        memcpy(pkey->listFetch_s, "list", sizeof("list") - 1);
+        pkey->listFetch_s += sizeof("list") - 1;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_PUBLICKEY,
+                       "Sending publickey \"list\" packet");
+
+        pkey->listFetch_state = libssh2_NB_state_created;
+    }
+
+    if (pkey->listFetch_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0,
+                                    pkey->listFetch_buffer,
+                                    (pkey->listFetch_s -
+                                     pkey->listFetch_buffer));
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((pkey->listFetch_s - pkey->listFetch_buffer) != rc) {
+            pkey->listFetch_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send publickey list packet");
+        }
+
+        pkey->listFetch_state = libssh2_NB_state_sent;
+    }
+
+    while (1) {
+        rc = publickey_packet_receive(pkey, &pkey->listFetch_data,
+                                      &pkey->listFetch_data_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_TIMEOUT,
+                           "Timeout waiting for response from "
+                           "publickey subsystem");
+            goto err_exit;
+        }
+
+        pkey->listFetch_s = pkey->listFetch_data;
+        if ((response =
+             publickey_response_id(&pkey->listFetch_s,
+                                   pkey->listFetch_data_len)) < 0) {
+            _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                           "Invalid publickey subsystem response code");
+            goto err_exit;
+        }
+
+        switch (response) {
+        case LIBSSH2_PUBLICKEY_RESPONSE_STATUS:
+            /* Error, or processing complete */
+        {
+            unsigned long status, descr_len, lang_len;
+
+            status = _libssh2_ntohu32(pkey->listFetch_s);
+            pkey->listFetch_s += 4;
+            descr_len = _libssh2_ntohu32(pkey->listFetch_s);
+            pkey->listFetch_s += 4;
+            /* description starts at pkey->listFetch_s */
+            pkey->listFetch_s += descr_len;
+            lang_len = _libssh2_ntohu32(pkey->listFetch_s);
+            pkey->listFetch_s += 4;
+            /* lang starts at pkey->listFetch_s */
+            pkey->listFetch_s += lang_len;
+
+            if (pkey->listFetch_s >
+                pkey->listFetch_data + pkey->listFetch_data_len) {
+                _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                               "Malformed publickey subsystem packet");
+                goto err_exit;
+            }
+
+            if (status == LIBSSH2_PUBLICKEY_SUCCESS) {
+                LIBSSH2_FREE(session, pkey->listFetch_data);
+                pkey->listFetch_data = NULL;
+                *pkey_list = list;
+                *num_keys = keys;
+                pkey->listFetch_state = libssh2_NB_state_idle;
+                return 0;
+            }
+
+            publickey_status_error(pkey, session, status);
+            goto err_exit;
+        }
+        case LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY:
+            /* What we want */
+            if (keys >= max_keys) {
+                libssh2_publickey_list *newlist;
+                /* Grow the key list if necessary */
+                max_keys += 8;
+                newlist =
+                    LIBSSH2_REALLOC(session, list,
+                                    (max_keys +
+                                     1) * sizeof(libssh2_publickey_list));
+                if (!newlist) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for "
+                                   "publickey list");
+                    goto err_exit;
+                }
+                list = newlist;
+            }
+            if (pkey->version == 1) {
+                unsigned long comment_len;
+
+                comment_len = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                if (comment_len) {
+                    list[keys].num_attrs = 1;
+                    list[keys].attrs =
+                        LIBSSH2_ALLOC(session,
+                                      sizeof(libssh2_publickey_attribute));
+                    if (!list[keys].attrs) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Unable to allocate memory for "
+                                       "publickey attributes");
+                        goto err_exit;
+                    }
+                    list[keys].attrs[0].name = "comment";
+                    list[keys].attrs[0].name_len = sizeof("comment") - 1;
+                    list[keys].attrs[0].value = (char *) pkey->listFetch_s;
+                    list[keys].attrs[0].value_len = comment_len;
+                    list[keys].attrs[0].mandatory = 0;
+
+                    pkey->listFetch_s += comment_len;
+                } else {
+                    list[keys].num_attrs = 0;
+                    list[keys].attrs = NULL;
+                }
+                list[keys].name_len = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                list[keys].name = pkey->listFetch_s;
+                pkey->listFetch_s += list[keys].name_len;
+                list[keys].blob_len = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                list[keys].blob = pkey->listFetch_s;
+                pkey->listFetch_s += list[keys].blob_len;
+            } else {
+                /* Version == 2 */
+                list[keys].name_len = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                list[keys].name = pkey->listFetch_s;
+                pkey->listFetch_s += list[keys].name_len;
+                list[keys].blob_len = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                list[keys].blob = pkey->listFetch_s;
+                pkey->listFetch_s += list[keys].blob_len;
+                list[keys].num_attrs = _libssh2_ntohu32(pkey->listFetch_s);
+                pkey->listFetch_s += 4;
+                if (list[keys].num_attrs) {
+                    list[keys].attrs =
+                        LIBSSH2_ALLOC(session,
+                                      list[keys].num_attrs *
+                                      sizeof(libssh2_publickey_attribute));
+                    if (!list[keys].attrs) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Unable to allocate memory for "
+                                       "publickey attributes");
+                        goto err_exit;
+                    }
+                    for(i = 0; i < list[keys].num_attrs; i++) {
+                        list[keys].attrs[i].name_len =
+                            _libssh2_ntohu32(pkey->listFetch_s);
+                        pkey->listFetch_s += 4;
+                        list[keys].attrs[i].name = (char *) pkey->listFetch_s;
+                        pkey->listFetch_s += list[keys].attrs[i].name_len;
+                        list[keys].attrs[i].value_len =
+                            _libssh2_ntohu32(pkey->listFetch_s);
+                        pkey->listFetch_s += 4;
+                        list[keys].attrs[i].value = (char *) pkey->listFetch_s;
+                        pkey->listFetch_s += list[keys].attrs[i].value_len;
+
+                        /* actually an ignored value */
+                        list[keys].attrs[i].mandatory = 0;
+                    }
+                } else {
+                    list[keys].attrs = NULL;
+                }
+            }
+            /* To be FREEd in libssh2_publickey_list_free() */
+            list[keys].packet = pkey->listFetch_data;
+            keys++;
+
+            list[keys].packet = NULL;   /* Terminate the list */
+            pkey->listFetch_data = NULL;
+            break;
+        default:
+            /* Unknown/Unexpected */
+            _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
+                           "Unexpected publickey subsystem response");
+            LIBSSH2_FREE(session, pkey->listFetch_data);
+            pkey->listFetch_data = NULL;
+        }
+    }
+
+    /* Only reached via explicit goto */
+  err_exit:
+    if (pkey->listFetch_data) {
+        LIBSSH2_FREE(session, pkey->listFetch_data);
+        pkey->listFetch_data = NULL;
+    }
+    if (list) {
+        libssh2_publickey_list_free(pkey, list);
+    }
+    pkey->listFetch_state = libssh2_NB_state_idle;
+    return -1;
+}
+
+/* libssh2_publickey_list_free
+ * Free a previously fetched list of public keys
+ */
+LIBSSH2_API void
+libssh2_publickey_list_free(LIBSSH2_PUBLICKEY * pkey,
+                            libssh2_publickey_list * pkey_list)
+{
+    LIBSSH2_SESSION *session;
+    libssh2_publickey_list *p = pkey_list;
+
+    if(!pkey || !p)
+        return;
+
+    session = pkey->channel->session;
+
+    while (p->packet) {
+        if (p->attrs) {
+            LIBSSH2_FREE(session, p->attrs);
+        }
+        LIBSSH2_FREE(session, p->packet);
+        p++;
+    }
+
+    LIBSSH2_FREE(session, pkey_list);
+}
+
+/* libssh2_publickey_shutdown
+ * Shutdown the publickey subsystem
+ */
+LIBSSH2_API int
+libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey)
+{
+    LIBSSH2_SESSION *session;
+    int rc;
+
+    if(!pkey)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    session = pkey->channel->session;
+
+    /*
+     * Make sure all memory used in the state variables are free
+     */
+    if (pkey->receive_packet) {
+        LIBSSH2_FREE(session, pkey->receive_packet);
+        pkey->receive_packet = NULL;
+    }
+    if (pkey->add_packet) {
+        LIBSSH2_FREE(session, pkey->add_packet);
+        pkey->add_packet = NULL;
+    }
+    if (pkey->remove_packet) {
+        LIBSSH2_FREE(session, pkey->remove_packet);
+        pkey->remove_packet = NULL;
+    }
+    if (pkey->listFetch_data) {
+        LIBSSH2_FREE(session, pkey->listFetch_data);
+        pkey->listFetch_data = NULL;
+    }
+
+    rc = _libssh2_channel_free(pkey->channel);
+    if (rc == LIBSSH2_ERROR_EAGAIN)
+        return rc;
+
+    LIBSSH2_FREE(session, pkey);
+    return 0;
+}
diff --git a/pgadmin/libssh2/scp.c b/pgadmin/libssh2/scp.c
new file mode 100644
index 0000000..63d181e
--- /dev/null
+++ b/pgadmin/libssh2/scp.c
@@ -0,0 +1,1085 @@
+/* Copyright (c) 2009-2010 by Daniel Stenberg
+ * Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include <errno.h>
+#include <stdlib.h>
+
+#include "channel.h"
+#include "session.h"
+
+
+/* Max. length of a quoted string after libssh2_shell_quotearg() processing */
+#define _libssh2_shell_quotedsize(s)     (3 * strlen(s) + 2)
+
+/*
+  This function quotes a string in a way suitable to be used with a
+  shell, e.g. the file name
+  one two
+  becomes
+  'one two'
+
+  The resulting output string is crafted in a way that makes it usable
+  with the two most common shell types: Bourne Shell derived shells
+  (sh, ksh, ksh93, bash, zsh) and C-Shell derivates (csh, tcsh).
+
+  The following special cases are handled:
+  o  If the string contains an apostrophy itself, the apostrophy
+  character is written in quotation marks, e.g. "'".
+  The shell cannot handle the syntax 'doesn\'t', so we close the
+  current argument word, add the apostrophe in quotation marks "",
+  and open a new argument word instead (_ indicate the input
+  string characters):
+  _____   _   _
+  'doesn' "'" 't'
+
+  Sequences of apostrophes are combined in one pair of quotation marks:
+  a'''b
+  becomes
+  _  ___  _
+  'a'"'''"'b'
+
+  o  If the string contains an exclamation mark (!), the C-Shell
+  interprets it as an event number. Using \! (not within quotation
+  marks or single quotation marks) is a mechanism understood by
+  both Bourne Shell and C-Shell.
+
+  If a quotation was already started, the argument word is closed
+  first:
+  a!b
+
+  become
+  _  _ _
+  'a'\!'b'
+
+  The result buffer must be large enough for the expanded result. A
+  bad case regarding expansion is alternating characters and
+  apostrophes:
+
+  a'b'c'd'                   (length 8) gets converted to
+  'a'"'"'b'"'"'c'"'"'d'"'"   (length 24)
+
+  This is the worst case.
+
+  Maximum length of the result:
+  1 + 6 * (length(input) + 1) / 2) + 1
+
+  => 3 * length(input) + 2
+
+  Explanation:
+  o  leading apostrophe
+  o  one character / apostrophe pair (two characters) can get
+  represented as 6 characters: a' -> a'"'"'
+  o  String terminator (+1)
+
+  A result buffer three times the size of the input buffer + 2
+  characters should be safe.
+
+  References:
+  o  csh-compatible quotation (special handling for '!' etc.), see
+  http://www.grymoire.com/Unix/Csh.html#toc-uh-10
+
+  Return value:
+  Length of the resulting string (not counting the terminating '\0'),
+  or 0 in case of errors, e.g. result buffer too small
+
+  Note: this function could possible be used elsewhere within libssh2, but
+  until then it is kept static and in this source file.
+*/
+
+static unsigned
+shell_quotearg(const char *path, unsigned char *buf,
+               unsigned bufsize)
+{
+    const char *src;
+    unsigned char *dst, *endp;
+
+    /*
+     * Processing States:
+     *  UQSTRING:       unquoted string: ... -- used for quoting exclamation
+     *                  marks. This is the initial state
+     *  SQSTRING:       single-qouted-string: '... -- any character may follow
+     *  QSTRING:        quoted string: "... -- only apostrophes may follow
+     */
+    enum { UQSTRING, SQSTRING, QSTRING } state = UQSTRING;
+
+    endp = &buf[bufsize];
+    src = path;
+    dst = buf;
+    while (*src && dst < endp - 1) {
+
+        switch (*src) {
+            /*
+             * Special handling for apostrophe.
+             * An apostrophe is always written in quotation marks, e.g.
+             * ' -> "'".
+             */
+
+        case '\'':
+            switch (state) {
+            case UQSTRING:      /* Unquoted string */
+                if (dst+1 >= endp)
+                    return 0;
+                *dst++ = '"';
+                break;
+            case QSTRING:       /* Continue quoted string */
+                break;
+            case SQSTRING:      /* Close single quoted string */
+                if (dst+2 >= endp)
+                    return 0;
+                *dst++ = '\'';
+                *dst++ = '"';
+                break;
+            default:
+                break;
+            }
+            state = QSTRING;
+            break;
+
+            /*
+             * Special handling for exclamation marks. CSH interprets
+             * exclamation marks even when quoted with apostrophes. We convert
+             * it to the plain string \!, because both Bourne Shell and CSH
+             * interpret that as a verbatim exclamation mark.
+             */
+
+        case '!':
+            switch (state) {
+            case UQSTRING:
+                if (dst+1 >= endp)
+                    return 0;
+                *dst++ = '\\';
+                break;
+            case QSTRING:
+                if (dst+2 >= endp)
+                    return 0;
+                *dst++ = '"';           /* Closing quotation mark */
+                *dst++ = '\\';
+                break;
+            case SQSTRING:              /* Close single quoted string */
+                if (dst+2 >= endp)
+                    return 0;
+                *dst++ = '\'';
+                *dst++ = '\\';
+                break;
+            default:
+                break;
+            }
+            state = UQSTRING;
+            break;
+
+            /*
+             * Ordinary character: prefer single-quoted string
+             */
+
+        default:
+            switch (state) {
+            case UQSTRING:
+                if (dst+1 >= endp)
+                    return 0;
+                *dst++ = '\'';
+                break;
+            case QSTRING:
+                if (dst+2 >= endp)
+                    return 0;
+                *dst++ = '"';           /* Closing quotation mark */
+                *dst++ = '\'';
+                break;
+            case SQSTRING:      /* Continue single quoted string */
+                break;
+            default:
+                break;
+            }
+            state = SQSTRING;   /* Start single-quoted string */
+            break;
+        }
+
+        if (dst+1 >= endp)
+            return 0;
+        *dst++ = *src++;
+    }
+
+    switch (state) {
+    case UQSTRING:
+        break;
+    case QSTRING:           /* Close quoted string */
+        if (dst+1 >= endp)
+            return 0;
+        *dst++ = '"';
+        break;
+    case SQSTRING:          /* Close single quoted string */
+        if (dst+1 >= endp)
+            return 0;
+        *dst++ = '\'';
+        break;
+    default:
+        break;
+    }
+
+    if (dst+1 >= endp)
+        return 0;
+    *dst = '\0';
+
+    /* The result cannot be larger than 3 * strlen(path) + 2 */
+    /* assert((dst - buf) <= (3 * (src - path) + 2)); */
+
+    return dst - buf;
+}
+
+/*
+ * scp_recv
+ *
+ * Open a channel and request a remote file via SCP
+ *
+ */
+static LIBSSH2_CHANNEL *
+scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb)
+{
+    int cmd_len;
+    int rc;
+    int tmp_err_code;
+    const char *tmp_err_msg;
+
+    if (session->scpRecv_state == libssh2_NB_state_idle) {
+        session->scpRecv_mode = 0;
+        session->scpRecv_size = 0;
+        session->scpRecv_mtime = 0;
+        session->scpRecv_atime = 0;
+
+        session->scpRecv_command_len =
+            _libssh2_shell_quotedsize(path) + sizeof("scp -f ") + (sb?1:0);
+
+        session->scpRecv_command =
+            LIBSSH2_ALLOC(session, session->scpRecv_command_len);
+
+        if (!session->scpRecv_command) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate a command buffer for "
+                           "SCP session");
+            return NULL;
+        }
+
+        snprintf((char *)session->scpRecv_command,
+                 session->scpRecv_command_len, "scp -%sf ", sb?"p":"");
+
+        cmd_len = strlen((char *)session->scpRecv_command);
+
+        (void) shell_quotearg(path,
+                              &session->scpRecv_command[cmd_len],
+                              session->scpRecv_command_len - cmd_len);
+
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                       "Opening channel for SCP receive");
+
+        session->scpRecv_state = libssh2_NB_state_created;
+    }
+
+    if (session->scpRecv_state == libssh2_NB_state_created) {
+        /* Allocate a channel */
+        session->scpRecv_channel =
+            _libssh2_channel_open(session, "session",
+                                  sizeof("session") - 1,
+                                  LIBSSH2_CHANNEL_WINDOW_DEFAULT,
+                                  LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL,
+                                  0);
+        if (!session->scpRecv_channel) {
+            if (libssh2_session_last_errno(session) !=
+                LIBSSH2_ERROR_EAGAIN) {
+                LIBSSH2_FREE(session, session->scpRecv_command);
+                session->scpRecv_command = NULL;
+                session->scpRecv_state = libssh2_NB_state_idle;
+            }
+            else {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block starting up channel");
+            }
+            return NULL;
+        }
+
+        session->scpRecv_state = libssh2_NB_state_sent;
+    }
+
+    if (session->scpRecv_state == libssh2_NB_state_sent) {
+        /* Request SCP for the desired file */
+        rc = _libssh2_channel_process_startup(session->scpRecv_channel, "exec",
+                                              sizeof("exec") - 1,
+                                              (char *) session->scpRecv_command,
+                                              session->scpRecv_command_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block requesting SCP startup");
+            return NULL;
+        } else if (rc) {
+            LIBSSH2_FREE(session, session->scpRecv_command);
+            session->scpRecv_command = NULL;
+            goto scp_recv_error;
+        }
+        LIBSSH2_FREE(session, session->scpRecv_command);
+        session->scpRecv_command = NULL;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SCP, "Sending initial wakeup");
+        /* SCP ACK */
+        session->scpRecv_response[0] = '\0';
+
+        session->scpRecv_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->scpRecv_state == libssh2_NB_state_sent1) {
+        rc = _libssh2_channel_write(session->scpRecv_channel, 0,
+                                    session->scpRecv_response, 1);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block sending initial wakeup");
+            return NULL;
+        } else if (rc != 1) {
+            goto scp_recv_error;
+        }
+
+        /* Parse SCP response */
+        session->scpRecv_response_len = 0;
+
+        session->scpRecv_state = libssh2_NB_state_sent2;
+    }
+
+    if ((session->scpRecv_state == libssh2_NB_state_sent2)
+        || (session->scpRecv_state == libssh2_NB_state_sent3)) {
+        while (sb && (session->scpRecv_response_len <
+                      LIBSSH2_SCP_RESPONSE_BUFLEN)) {
+            unsigned char *s, *p;
+
+            if (session->scpRecv_state == libssh2_NB_state_sent2) {
+                rc = _libssh2_channel_read(session->scpRecv_channel, 0,
+                                           (char *) session->
+                                           scpRecv_response +
+                                           session->scpRecv_response_len, 1);
+                if (rc == LIBSSH2_ERROR_EAGAIN) {
+                    _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                   "Would block waiting for SCP response");
+                    return NULL;
+                }
+                else if (rc < 0) {
+                    /* error, give up */
+                    _libssh2_error(session, rc, "Failed reading SCP response");
+                    goto scp_recv_error;
+                }
+                else if(rc == 0)
+                    goto scp_recv_empty_channel;
+
+                session->scpRecv_response_len++;
+
+                if (session->scpRecv_response[0] != 'T') {
+                    size_t err_len;
+                    char *err_msg;
+
+                    /* there can be
+                       01 for warnings
+                       02 for errors
+
+                       The following string MUST be newline terminated
+                    */
+                    err_len =
+                        _libssh2_channel_packet_data_len(session->
+                                                         scpRecv_channel, 0);
+                    err_msg = LIBSSH2_ALLOC(session, err_len + 1);
+                    if (!err_msg) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Failed to get memory ");
+                        goto scp_recv_error;
+                    }
+
+                    /* Read the remote error message */
+                    (void)_libssh2_channel_read(session->scpRecv_channel, 0,
+                                                err_msg, err_len);
+                    /* If it failed for any reason, we ignore it anyway. */
+
+                    /* zero terminate the error */
+                    err_msg[err_len]=0;
+
+                    _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                                   "got %02x %s", session->scpRecv_response[0],
+                                   err_msg);
+
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Failed to recv file");
+
+                    LIBSSH2_FREE(session, err_msg);
+                    goto scp_recv_error;
+                }
+
+                if ((session->scpRecv_response_len > 1) &&
+                    ((session->
+                      scpRecv_response[session->scpRecv_response_len - 1] <
+                      '0')
+                     || (session->
+                         scpRecv_response[session->scpRecv_response_len - 1] >
+                         '9'))
+                    && (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        ' ')
+                    && (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        '\r')
+                    && (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        '\n')) {
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid data in SCP response");
+                    goto scp_recv_error;
+                }
+
+                if ((session->scpRecv_response_len < 9)
+                    || (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        '\n')) {
+                    if (session->scpRecv_response_len ==
+                        LIBSSH2_SCP_RESPONSE_BUFLEN) {
+                        /* You had your chance */
+                        _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                       "Unterminated response from SCP server");
+                        goto scp_recv_error;
+                    }
+                    /* Way too short to be an SCP response, or not done yet,
+                       short circuit */
+                    continue;
+                }
+
+                /* We're guaranteed not to go under response_len == 0 by the
+                   logic above */
+                while ((session->
+                        scpRecv_response[session->scpRecv_response_len - 1] ==
+                        '\r')
+                       || (session->
+                           scpRecv_response[session->scpRecv_response_len -
+                                            1] == '\n'))
+                    session->scpRecv_response_len--;
+                session->scpRecv_response[session->scpRecv_response_len] =
+                    '\0';
+
+                if (session->scpRecv_response_len < 8) {
+                    /* EOL came too soon */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, "
+                                   "too short" );
+                    goto scp_recv_error;
+                }
+
+                s = session->scpRecv_response + 1;
+
+                p = (unsigned char *) strchr((char *) s, ' ');
+                if (!p || ((p - s) <= 0)) {
+                    /* No spaces or space in the wrong spot */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, "
+                                   "malformed mtime");
+                    goto scp_recv_error;
+                }
+
+                *(p++) = '\0';
+                /* Make sure we don't get fooled by leftover values */
+                session->scpRecv_mtime = strtol((char *) s, NULL, 10);
+
+                s = (unsigned char *) strchr((char *) p, ' ');
+                if (!s || ((s - p) <= 0)) {
+                    /* No spaces or space in the wrong spot */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, malformed mtime.usec");
+                    goto scp_recv_error;
+                }
+
+                /* Ignore mtime.usec */
+                s++;
+                p = (unsigned char *) strchr((char *) s, ' ');
+                if (!p || ((p - s) <= 0)) {
+                    /* No spaces or space in the wrong spot */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, too short or malformed");
+                    goto scp_recv_error;
+                }
+
+                *p = '\0';
+                /* Make sure we don't get fooled by leftover values */
+                session->scpRecv_atime = strtol((char *) s, NULL, 10);
+
+                /* SCP ACK */
+                session->scpRecv_response[0] = '\0';
+
+                session->scpRecv_state = libssh2_NB_state_sent3;
+            }
+
+            if (session->scpRecv_state == libssh2_NB_state_sent3) {
+                rc = _libssh2_channel_write(session->scpRecv_channel, 0,
+                                            session->scpRecv_response, 1);
+                if (rc == LIBSSH2_ERROR_EAGAIN) {
+                    _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                   "Would block waiting to send SCP ACK");
+                    return NULL;
+                } else if (rc != 1) {
+                    goto scp_recv_error;
+                }
+
+                _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                               "mtime = %ld, atime = %ld",
+                               session->scpRecv_mtime, session->scpRecv_atime);
+
+                /* We *should* check that atime.usec is valid, but why let
+                   that stop use? */
+                break;
+            }
+        }
+
+        session->scpRecv_state = libssh2_NB_state_sent4;
+    }
+
+    if (session->scpRecv_state == libssh2_NB_state_sent4) {
+        session->scpRecv_response_len = 0;
+
+        session->scpRecv_state = libssh2_NB_state_sent5;
+    }
+
+    if ((session->scpRecv_state == libssh2_NB_state_sent5)
+        || (session->scpRecv_state == libssh2_NB_state_sent6)) {
+        while (session->scpRecv_response_len < LIBSSH2_SCP_RESPONSE_BUFLEN) {
+            char *s, *p, *e = NULL;
+
+            if (session->scpRecv_state == libssh2_NB_state_sent5) {
+                rc = _libssh2_channel_read(session->scpRecv_channel, 0,
+                                           (char *) session->
+                                           scpRecv_response +
+                                           session->scpRecv_response_len, 1);
+                if (rc == LIBSSH2_ERROR_EAGAIN) {
+                    _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                   "Would block waiting for SCP response");
+                    return NULL;
+                }
+                else if (rc < 0) {
+                    /* error, bail out*/
+                    _libssh2_error(session, rc, "Failed reading SCP response");
+                    goto scp_recv_error;
+                }
+                else if(rc == 0)
+                    goto scp_recv_empty_channel;
+
+                session->scpRecv_response_len++;
+
+                if (session->scpRecv_response[0] != 'C') {
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server");
+                    goto scp_recv_error;
+                }
+
+                if ((session->scpRecv_response_len > 1) &&
+                    (session->
+                     scpRecv_response[session->scpRecv_response_len - 1] !=
+                     '\r')
+                    && (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        '\n')
+                    &&
+                    (session->
+                     scpRecv_response[session->scpRecv_response_len - 1]
+                     < 32)) {
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid data in SCP response");
+                    goto scp_recv_error;
+                }
+
+                if ((session->scpRecv_response_len < 7)
+                    || (session->
+                        scpRecv_response[session->scpRecv_response_len - 1] !=
+                        '\n')) {
+                    if (session->scpRecv_response_len ==
+                        LIBSSH2_SCP_RESPONSE_BUFLEN) {
+                        /* You had your chance */
+                        _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                       "Unterminated response from SCP server");
+                        goto scp_recv_error;
+                    }
+                    /* Way too short to be an SCP response, or not done yet,
+                       short circuit */
+                    continue;
+                }
+
+                /* We're guaranteed not to go under response_len == 0 by the
+                   logic above */
+                while ((session->
+                        scpRecv_response[session->scpRecv_response_len - 1] ==
+                        '\r')
+                       || (session->
+                           scpRecv_response[session->scpRecv_response_len -
+                                            1] == '\n')) {
+                    session->scpRecv_response_len--;
+                }
+                session->scpRecv_response[session->scpRecv_response_len] =
+                    '\0';
+
+                if (session->scpRecv_response_len < 6) {
+                    /* EOL came too soon */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, too short");
+                    goto scp_recv_error;
+                }
+
+                s = (char *) session->scpRecv_response + 1;
+
+                p = strchr(s, ' ');
+                if (!p || ((p - s) <= 0)) {
+                    /* No spaces or space in the wrong spot */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, malformed mode");
+                    goto scp_recv_error;
+                }
+
+                *(p++) = '\0';
+                /* Make sure we don't get fooled by leftover values */
+
+                session->scpRecv_mode = strtol(s, &e, 8);
+                if (e && *e) {
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, invalid mode");
+                    goto scp_recv_error;
+                }
+
+                s = strchr(p, ' ');
+                if (!s || ((s - p) <= 0)) {
+                    /* No spaces or space in the wrong spot */
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, too short or malformed");
+                    goto scp_recv_error;
+                }
+
+                *s = '\0';
+                /* Make sure we don't get fooled by leftover values */
+                session->scpRecv_size = scpsize_strtol(p, &e, 10);
+                if (e && *e) {
+                    _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                                   "Invalid response from SCP server, invalid size");
+                    goto scp_recv_error;
+                }
+
+                /* SCP ACK */
+                session->scpRecv_response[0] = '\0';
+
+                session->scpRecv_state = libssh2_NB_state_sent6;
+            }
+
+            if (session->scpRecv_state == libssh2_NB_state_sent6) {
+                rc = _libssh2_channel_write(session->scpRecv_channel, 0,
+                                            session->scpRecv_response, 1);
+                if (rc == LIBSSH2_ERROR_EAGAIN) {
+                    _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                   "Would block sending SCP ACK");
+                    return NULL;
+                } else if (rc != 1) {
+                    goto scp_recv_error;
+                }
+                _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                               "mode = 0%lo size = %ld", session->scpRecv_mode,
+                               session->scpRecv_size);
+
+                /* We *should* check that basename is valid, but why let that
+                   stop us? */
+                break;
+            }
+        }
+
+        session->scpRecv_state = libssh2_NB_state_sent7;
+    }
+
+    if (sb) {
+        memset(sb, 0, sizeof(struct stat));
+
+        sb->st_mtime = session->scpRecv_mtime;
+        sb->st_atime = session->scpRecv_atime;
+        sb->st_size = session->scpRecv_size;
+        sb->st_mode = session->scpRecv_mode;
+    }
+
+    session->scpRecv_state = libssh2_NB_state_idle;
+    return session->scpRecv_channel;
+
+  scp_recv_empty_channel:
+    /* the code only jumps here as a result of a zero read from channel_read()
+       so we check EOF status to avoid getting stuck in a loop */
+    if(libssh2_channel_eof(session->scpRecv_channel))
+        _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                       "Unexpected channel close");
+    else
+        return session->scpRecv_channel;
+    /* fall-through */
+  scp_recv_error:
+    tmp_err_code = session->err_code;
+    tmp_err_msg = session->err_msg;
+    while (libssh2_channel_free(session->scpRecv_channel) ==
+           LIBSSH2_ERROR_EAGAIN);
+    session->err_code = tmp_err_code;
+    session->err_msg = tmp_err_msg;
+    session->scpRecv_channel = NULL;
+    session->scpRecv_state = libssh2_NB_state_idle;
+    return NULL;
+}
+
+/*
+ * libssh2_scp_recv
+ *
+ * Open a channel and request a remote file via SCP
+ *
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat * sb)
+{
+    LIBSSH2_CHANNEL *ptr;
+    BLOCK_ADJUST_ERRNO(ptr, session, scp_recv(session, path, sb));
+    return ptr;
+}
+
+/*
+ * scp_send()
+ *
+ * Send a file using SCP
+ *
+ */
+static LIBSSH2_CHANNEL *
+scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
+         libssh2_int64_t size, time_t mtime, time_t atime)
+{
+    int cmd_len;
+    int rc;
+    int tmp_err_code;
+    const char *tmp_err_msg;
+
+    if (session->scpSend_state == libssh2_NB_state_idle) {
+        session->scpSend_command_len =
+            _libssh2_shell_quotedsize(path) + sizeof("scp -t ") +
+            ((mtime || atime)?1:0);
+
+        session->scpSend_command =
+            LIBSSH2_ALLOC(session, session->scpSend_command_len);
+        if (!session->scpSend_command) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate a command buffer for scp session");
+            return NULL;
+        }
+
+        snprintf((char *)session->scpSend_command, session->scpSend_command_len,
+                 "scp -%st ", (mtime || atime)?"p":"");
+
+        cmd_len = strlen((char *)session->scpSend_command);
+
+        (void)shell_quotearg(path,
+                             &session->scpSend_command[cmd_len],
+                             session->scpSend_command_len - cmd_len);
+
+        session->scpSend_command[session->scpSend_command_len - 1] = '\0';
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                       "Opening channel for SCP send");
+        /* Allocate a channel */
+
+        session->scpSend_state = libssh2_NB_state_created;
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_created) {
+        session->scpSend_channel =
+            _libssh2_channel_open(session, "session", sizeof("session") - 1,
+                                  LIBSSH2_CHANNEL_WINDOW_DEFAULT,
+                                  LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0);
+        if (!session->scpSend_channel) {
+            if (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
+                /* previous call set libssh2_session_last_error(), pass it
+                   through */
+                LIBSSH2_FREE(session, session->scpSend_command);
+                session->scpSend_command = NULL;
+                session->scpSend_state = libssh2_NB_state_idle;
+            }
+            else {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block starting up channel");
+            }
+            return NULL;
+        }
+
+        session->scpSend_state = libssh2_NB_state_sent;
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_sent) {
+        /* Request SCP for the desired file */
+        rc = _libssh2_channel_process_startup(session->scpSend_channel, "exec",
+                                              sizeof("exec") - 1,
+                                              (char *) session->scpSend_command,
+                                              session->scpSend_command_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block requesting SCP startup");
+            return NULL;
+        }
+        else if (rc) {
+            /* previous call set libssh2_session_last_error(), pass it
+               through */
+            LIBSSH2_FREE(session, session->scpSend_command);
+            session->scpSend_command = NULL;
+            _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                           "Unknown error while getting error string");
+            goto scp_send_error;
+        }
+        LIBSSH2_FREE(session, session->scpSend_command);
+        session->scpSend_command = NULL;
+
+        session->scpSend_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_sent1) {
+        /* Wait for ACK */
+        rc = _libssh2_channel_read(session->scpSend_channel, 0,
+                                   (char *) session->scpSend_response, 1);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block waiting for response from remote");
+            return NULL;
+        }
+        else if (rc < 0) {
+            _libssh2_error(session, rc, "SCP failure");
+            goto scp_send_error;
+        }
+        else if(!rc)
+            /* remain in the same state */
+            goto scp_send_empty_channel;
+        else if (session->scpSend_response[0] != 0) {
+            _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                           "Invalid ACK response from remote");
+            goto scp_send_error;
+        }
+        if (mtime || atime) {
+            /* Send mtime and atime to be used for file */
+            session->scpSend_response_len =
+                snprintf((char *) session->scpSend_response,
+                         LIBSSH2_SCP_RESPONSE_BUFLEN, "T%ld 0 %ld 0\n",
+                         (long)mtime, (long)atime);
+            _libssh2_debug(session, LIBSSH2_TRACE_SCP, "Sent %s",
+                           session->scpSend_response);
+        }
+
+        session->scpSend_state = libssh2_NB_state_sent2;
+    }
+
+    /* Send mtime and atime to be used for file */
+    if (mtime || atime) {
+        if (session->scpSend_state == libssh2_NB_state_sent2) {
+            rc = _libssh2_channel_write(session->scpSend_channel, 0,
+                                        session->scpSend_response,
+                                        session->scpSend_response_len);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block sending time data for SCP file");
+                return NULL;
+            } else if (rc != (int)session->scpSend_response_len) {
+                _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                               "Unable to send time data for SCP file");
+                goto scp_send_error;
+            }
+
+            session->scpSend_state = libssh2_NB_state_sent3;
+        }
+
+        if (session->scpSend_state == libssh2_NB_state_sent3) {
+            /* Wait for ACK */
+            rc = _libssh2_channel_read(session->scpSend_channel, 0,
+                                       (char *) session->scpSend_response, 1);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block waiting for response");
+                return NULL;
+            }
+            else if (rc < 0) {
+                _libssh2_error(session, rc, "SCP failure");
+                goto scp_send_error;
+            }
+            else if(!rc)
+                /* remain in the same state */
+                goto scp_send_empty_channel;
+            else if (session->scpSend_response[0] != 0) {
+                _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                               "Invalid SCP ACK response");
+                goto scp_send_error;
+            }
+
+            session->scpSend_state = libssh2_NB_state_sent4;
+        }
+    } else {
+        if (session->scpSend_state == libssh2_NB_state_sent2) {
+            session->scpSend_state = libssh2_NB_state_sent4;
+        }
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_sent4) {
+        /* Send mode, size, and basename */
+        const char *base = strrchr(path, '/');
+        if (base)
+            base++;
+        else
+            base = path;
+
+        session->scpSend_response_len =
+            snprintf((char *) session->scpSend_response,
+                     LIBSSH2_SCP_RESPONSE_BUFLEN, "C0%o %"
+                     LIBSSH2_INT64_T_FORMAT " %s\n", mode,
+                     size, base);
+        _libssh2_debug(session, LIBSSH2_TRACE_SCP, "Sent %s",
+                       session->scpSend_response);
+
+        session->scpSend_state = libssh2_NB_state_sent5;
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_sent5) {
+        rc = _libssh2_channel_write(session->scpSend_channel, 0,
+                                    session->scpSend_response,
+                                    session->scpSend_response_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block send core file data for SCP file");
+            return NULL;
+        } else if (rc != (int)session->scpSend_response_len) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send core file data for SCP file");
+            goto scp_send_error;
+        }
+
+        session->scpSend_state = libssh2_NB_state_sent6;
+    }
+
+    if (session->scpSend_state == libssh2_NB_state_sent6) {
+        /* Wait for ACK */
+        rc = _libssh2_channel_read(session->scpSend_channel, 0,
+                                   (char *) session->scpSend_response, 1);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block waiting for response");
+            return NULL;
+        }
+        else if (rc < 0) {
+            _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                           "Invalid ACK response from remote");
+            goto scp_send_error;
+        }
+        else if (rc == 0)
+            goto scp_send_empty_channel;
+
+        else if (session->scpSend_response[0] != 0) {
+            size_t err_len;
+            char *err_msg;
+
+            err_len =
+                _libssh2_channel_packet_data_len(session->scpSend_channel, 0);
+            err_msg = LIBSSH2_ALLOC(session, err_len + 1);
+            if (!err_msg) {
+                _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                               "failed to get memory");
+                goto scp_send_error;
+            }
+
+            /* Read the remote error message */
+            rc = _libssh2_channel_read(session->scpSend_channel, 0,
+                                       err_msg, err_len);
+            if (rc > 0) {
+                err_msg[err_len]=0;
+                _libssh2_debug(session, LIBSSH2_TRACE_SCP,
+                               "got %02x %s", session->scpSend_response[0],
+                               err_msg);
+            }
+            LIBSSH2_FREE(session, err_msg);
+            _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                           "failed to send file");
+            goto scp_send_error;
+        }
+    }
+
+    session->scpSend_state = libssh2_NB_state_idle;
+    return session->scpSend_channel;
+
+  scp_send_empty_channel:
+    /* the code only jumps here as a result of a zero read from channel_read()
+       so we check EOF status to avoid getting stuck in a loop */
+    if(libssh2_channel_eof(session->scpSend_channel)) {
+        _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
+                       "Unexpected channel close");
+    }
+    else
+        return session->scpSend_channel;
+    /* fall-through */
+  scp_send_error:
+    tmp_err_code = session->err_code;
+    tmp_err_msg = session->err_msg;
+    while (libssh2_channel_free(session->scpSend_channel) ==
+           LIBSSH2_ERROR_EAGAIN);
+    session->err_code = tmp_err_code;
+    session->err_msg = tmp_err_msg;
+    session->scpSend_channel = NULL;
+    session->scpSend_state = libssh2_NB_state_idle;
+    return NULL;
+}
+
+/*
+ * libssh2_scp_send_ex
+ *
+ * Send a file using SCP. Old API.
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode,
+                    size_t size, long mtime, long atime)
+{
+    LIBSSH2_CHANNEL *ptr;
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       scp_send(session, path, mode, size,
+                                (time_t)mtime, (time_t)atime));
+    return ptr;
+}
+
+/*
+ * libssh2_scp_send64
+ *
+ * Send a file using SCP
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
+                   libssh2_int64_t size, time_t mtime, time_t atime)
+{
+    LIBSSH2_CHANNEL *ptr;
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       scp_send(session, path, mode, size, mtime, atime));
+    return ptr;
+}
diff --git a/pgadmin/libssh2/session.c b/pgadmin/libssh2/session.c
new file mode 100644
index 0000000..9838d2b
--- /dev/null
+++ b/pgadmin/libssh2/session.c
@@ -0,0 +1,1751 @@
+/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2009-2011 by Daniel Stenberg
+ * Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+#include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <fcntl.h>
+
+#ifdef HAVE_GETTIMEOFDAY
+#include <sys/time.h>
+#endif
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#include "transport.h"
+#include "session.h"
+#include "channel.h"
+#include "mac.h"
+#include "misc.h"
+
+/* libssh2_default_alloc
+ */
+static
+LIBSSH2_ALLOC_FUNC(libssh2_default_alloc)
+{
+    (void) abstract;
+    return malloc(count);
+}
+
+/* libssh2_default_free
+ */
+static
+LIBSSH2_FREE_FUNC(libssh2_default_free)
+{
+    (void) abstract;
+    free(ptr);
+}
+
+/* libssh2_default_realloc
+ */
+static
+LIBSSH2_REALLOC_FUNC(libssh2_default_realloc)
+{
+    (void) abstract;
+    return realloc(ptr, count);
+}
+
+/*
+ * banner_receive
+ *
+ * Wait for a hello from the remote host
+ * Allocate a buffer and store the banner in session->remote.banner
+ * Returns: 0 on success, LIBSSH2_ERROR_EAGAIN if read would block, negative
+ * on failure
+ */
+static int
+banner_receive(LIBSSH2_SESSION * session)
+{
+    int ret;
+    int banner_len;
+
+    if (session->banner_TxRx_state == libssh2_NB_state_idle) {
+        banner_len = 0;
+
+        session->banner_TxRx_state = libssh2_NB_state_created;
+    } else {
+        banner_len = session->banner_TxRx_total_send;
+    }
+
+    while ((banner_len < (int) sizeof(session->banner_TxRx_banner)) &&
+           ((banner_len == 0)
+            || (session->banner_TxRx_banner[banner_len - 1] != '\n'))) {
+        char c = '\0';
+
+        /* no incoming block yet! */
+        session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_INBOUND;
+
+        ret = LIBSSH2_RECV(session, &c, 1,
+                            LIBSSH2_SOCKET_RECV_FLAGS(session));
+        if (ret < 0) {
+            if(session->api_block_mode || (ret != -EAGAIN))
+                /* ignore EAGAIN when non-blocking */
+                _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                               "Error recving %d bytes: %d", 1, -ret);
+        }
+        else
+            _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                           "Recved %d bytes banner", ret);
+
+        if (ret < 0) {
+            if (ret == -EAGAIN) {
+                session->socket_block_directions =
+                    LIBSSH2_SESSION_BLOCK_INBOUND;
+                session->banner_TxRx_total_send = banner_len;
+                return LIBSSH2_ERROR_EAGAIN;
+            }
+
+            /* Some kinda error */
+            session->banner_TxRx_state = libssh2_NB_state_idle;
+            session->banner_TxRx_total_send = 0;
+            return LIBSSH2_ERROR_SOCKET_RECV;
+        }
+
+        if (ret == 0) {
+            session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
+            return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+        }
+
+        if (c == '\0') {
+            /* NULLs are not allowed in SSH banners */
+            session->banner_TxRx_state = libssh2_NB_state_idle;
+            session->banner_TxRx_total_send = 0;
+            return LIBSSH2_ERROR_BANNER_RECV;
+        }
+
+        session->banner_TxRx_banner[banner_len++] = c;
+    }
+
+    while (banner_len &&
+           ((session->banner_TxRx_banner[banner_len - 1] == '\n') ||
+            (session->banner_TxRx_banner[banner_len - 1] == '\r'))) {
+        banner_len--;
+    }
+
+    /* From this point on, we are done here */
+    session->banner_TxRx_state = libssh2_NB_state_idle;
+    session->banner_TxRx_total_send = 0;
+
+    if (!banner_len)
+        return LIBSSH2_ERROR_BANNER_RECV;
+
+    session->remote.banner = LIBSSH2_ALLOC(session, banner_len + 1);
+    if (!session->remote.banner) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Error allocating space for remote banner");
+    }
+    memcpy(session->remote.banner, session->banner_TxRx_banner, banner_len);
+    session->remote.banner[banner_len] = '\0';
+    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Received Banner: %s",
+                   session->remote.banner);
+    return LIBSSH2_ERROR_NONE;
+}
+
+/*
+ * banner_send
+ *
+ * Send the default banner, or the one set via libssh2_setopt_string
+ *
+ * Returns LIBSSH2_ERROR_EAGAIN if it would block - and if it does so, you
+ * should call this function again as soon as it is likely that more data can
+ * be sent, and this function should then be called with the same argument set
+ * (same data pointer and same data_len) until zero or failure is returned.
+ */
+static int
+banner_send(LIBSSH2_SESSION * session)
+{
+    char *banner = (char *) LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF;
+    int banner_len = sizeof(LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF) - 1;
+    ssize_t ret;
+#ifdef LIBSSH2DEBUG
+    char banner_dup[256];
+#endif
+
+    if (session->banner_TxRx_state == libssh2_NB_state_idle) {
+        if (session->local.banner) {
+            /* setopt_string will have given us our \r\n characters */
+            banner_len = strlen((char *) session->local.banner);
+            banner = (char *) session->local.banner;
+        }
+#ifdef LIBSSH2DEBUG
+        /* Hack and slash to avoid sending CRLF in debug output */
+        if (banner_len < 256) {
+            memcpy(banner_dup, banner, banner_len - 2);
+            banner_dup[banner_len - 2] = '\0';
+        } else {
+            memcpy(banner_dup, banner, 255);
+            banner[255] = '\0';
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Sending Banner: %s",
+                       banner_dup);
+#endif
+
+        session->banner_TxRx_state = libssh2_NB_state_created;
+    }
+
+    /* no outgoing block yet! */
+    session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND;
+
+    ret = LIBSSH2_SEND(session,
+                        banner + session->banner_TxRx_total_send,
+                        banner_len - session->banner_TxRx_total_send,
+                        LIBSSH2_SOCKET_SEND_FLAGS(session));
+    if (ret < 0)
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Error sending %d bytes: %d",
+                       banner_len - session->banner_TxRx_total_send, -ret);
+    else
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Sent %d/%d bytes at %p+%d", ret,
+                       banner_len - session->banner_TxRx_total_send,
+                       banner, session->banner_TxRx_total_send);
+
+    if (ret != (banner_len - session->banner_TxRx_total_send)) {
+        if (ret >= 0 || ret == -EAGAIN) {
+            /* the whole packet could not be sent, save the what was */
+            session->socket_block_directions =
+                LIBSSH2_SESSION_BLOCK_OUTBOUND;
+            if (ret > 0)
+                session->banner_TxRx_total_send += ret;
+            return LIBSSH2_ERROR_EAGAIN;
+        }
+        session->banner_TxRx_state = libssh2_NB_state_idle;
+        session->banner_TxRx_total_send = 0;
+        return LIBSSH2_ERROR_SOCKET_RECV;
+    }
+
+    /* Set the state back to idle */
+    session->banner_TxRx_state = libssh2_NB_state_idle;
+    session->banner_TxRx_total_send = 0;
+
+    return 0;
+}
+
+/*
+ * session_nonblock() sets the given socket to either blocking or
+ * non-blocking mode based on the 'nonblock' boolean argument. This function
+ * is copied from the libcurl sources with permission.
+ */
+static int
+session_nonblock(libssh2_socket_t sockfd,   /* operate on this */
+                 int nonblock /* TRUE or FALSE */ )
+{
+#undef SETBLOCK
+#define SETBLOCK 0
+#ifdef HAVE_O_NONBLOCK
+    /* most recent unix versions */
+    int flags;
+
+    flags = fcntl(sockfd, F_GETFL, 0);
+    if (nonblock)
+        return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
+    else
+        return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
+#undef SETBLOCK
+#define SETBLOCK 1
+#endif
+
+#if defined(HAVE_FIONBIO) && (SETBLOCK == 0)
+    /* older unix versions and VMS*/
+    int flags;
+
+    flags = nonblock;
+    return ioctl(sockfd, FIONBIO, &flags);
+#undef SETBLOCK
+#define SETBLOCK 2
+#endif
+
+#if defined(HAVE_IOCTLSOCKET) && (SETBLOCK == 0)
+    /* Windows? */
+    unsigned long flags;
+    flags = nonblock;
+
+    return ioctlsocket(sockfd, FIONBIO, &flags);
+#undef SETBLOCK
+#define SETBLOCK 3
+#endif
+
+#if defined(HAVE_IOCTLSOCKET_CASE) && (SETBLOCK == 0)
+    /* presumably for Amiga */
+    return IoctlSocket(sockfd, FIONBIO, (long) nonblock);
+#undef SETBLOCK
+#define SETBLOCK 4
+#endif
+
+#if defined(HAVE_SO_NONBLOCK) && (SETBLOCK == 0)
+    /* BeOS */
+    long b = nonblock ? 1 : 0;
+    return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
+#undef SETBLOCK
+#define SETBLOCK 5
+#endif
+
+#ifdef HAVE_DISABLED_NONBLOCKING
+    return 0;                   /* returns success */
+#undef SETBLOCK
+#define SETBLOCK 6
+#endif
+
+#if (SETBLOCK == 0)
+#error "no non-blocking method was found/used/set"
+#endif
+}
+
+/*
+ * get_socket_nonblocking()
+ *
+ * gets the given blocking or non-blocking state of the socket.
+ */
+static int
+get_socket_nonblocking(int sockfd)
+{                               /* operate on this */
+#undef GETBLOCK
+#define GETBLOCK 0
+#ifdef HAVE_O_NONBLOCK
+    /* most recent unix versions */
+    int flags;
+
+    if ((flags = fcntl(sockfd, F_GETFL, 0)) == -1) {
+        /* Assume blocking on error */
+        return 1;
+    }
+    return (flags & O_NONBLOCK);
+#undef GETBLOCK
+#define GETBLOCK 1
+#endif
+
+#if defined(WSAEWOULDBLOCK) && (GETBLOCK == 0)
+    /* Windows? */
+    unsigned int option_value;
+    socklen_t option_len = sizeof(option_value);
+
+    if (getsockopt
+        (sockfd, SOL_SOCKET, SO_ERROR, (void *) &option_value, &option_len)) {
+        /* Assume blocking on error */
+        return 1;
+    }
+    return (int) option_value;
+#undef GETBLOCK
+#define GETBLOCK 2
+#endif
+
+#if defined(HAVE_SO_NONBLOCK) && (GETBLOCK == 0)
+    /* BeOS */
+    long b;
+    if (getsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b))) {
+        /* Assume blocking on error */
+        return 1;
+    }
+    return (int) b;
+#undef GETBLOCK
+#define GETBLOCK 5
+#endif
+
+#if defined(SO_STATE) && defined( __VMS ) && (GETBLOCK == 0)
+
+    /* VMS TCP/IP Services */
+
+    size_t sockstat = 0;
+    int    callstat = 0;
+    size_t size = sizeof( int );
+
+    callstat = getsockopt(sockfd, SOL_SOCKET, SO_STATE,
+                                  (char *)&sockstat, &size);
+    if ( callstat == -1 ) return(0);
+    if ( (sockstat&SS_NBIO) )return(1);
+    return(0);
+
+#undef GETBLOCK
+#define GETBLOCK 6
+#endif
+
+#ifdef HAVE_DISABLED_NONBLOCKING
+    return 1;                   /* returns blocking */
+#undef GETBLOCK
+#define GETBLOCK 7
+#endif
+
+#if (GETBLOCK == 0)
+#error "no non-blocking method was found/used/get"
+#endif
+}
+
+/* libssh2_session_banner_set
+ * Set the local banner to use in the server handshake.
+ */
+LIBSSH2_API int
+libssh2_session_banner_set(LIBSSH2_SESSION * session, const char *banner)
+{
+    size_t banner_len = banner ? strlen(banner) : 0;
+
+    if (session->local.banner) {
+        LIBSSH2_FREE(session, session->local.banner);
+        session->local.banner = NULL;
+    }
+
+    if (!banner_len)
+        return 0;
+
+    session->local.banner = LIBSSH2_ALLOC(session, banner_len + 3);
+    if (!session->local.banner) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate memory for local banner");
+    }
+
+    memcpy(session->local.banner, banner, banner_len);
+
+    /* first zero terminate like this so that the debug output is nice */
+    session->local.banner[banner_len] = '\0';
+    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Setting local Banner: %s",
+                   session->local.banner);
+    session->local.banner[banner_len++] = '\r';
+    session->local.banner[banner_len++] = '\n';
+    session->local.banner[banner_len] = '\0';
+
+    return 0;
+}
+
+/* libssh2_banner_set
+ * Set the local banner. DEPRECATED VERSION
+ */
+LIBSSH2_API int
+libssh2_banner_set(LIBSSH2_SESSION * session, const char *banner)
+{
+    return libssh2_session_banner_set(session, banner);
+}
+
+/*
+ * libssh2_session_init_ex
+ *
+ * Allocate and initialize a libssh2 session structure. Allows for malloc
+ * callbacks in case the calling program has its own memory manager It's
+ * allowable (but unadvisable) to define some but not all of the malloc
+ * callbacks An additional pointer value may be optionally passed to be sent
+ * to the callbacks (so they know who's asking)
+ */
+LIBSSH2_API LIBSSH2_SESSION *
+libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
+                        LIBSSH2_FREE_FUNC((*my_free)),
+                        LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract)
+{
+    LIBSSH2_ALLOC_FUNC((*local_alloc)) = libssh2_default_alloc;
+    LIBSSH2_FREE_FUNC((*local_free)) = libssh2_default_free;
+    LIBSSH2_REALLOC_FUNC((*local_realloc)) = libssh2_default_realloc;
+    LIBSSH2_SESSION *session;
+
+    if (my_alloc) {
+        local_alloc = my_alloc;
+    }
+    if (my_free) {
+        local_free = my_free;
+    }
+    if (my_realloc) {
+        local_realloc = my_realloc;
+    }
+
+    session = local_alloc(sizeof(LIBSSH2_SESSION), &abstract);
+    if (session) {
+        memset(session, 0, sizeof(LIBSSH2_SESSION));
+        session->alloc = local_alloc;
+        session->free = local_free;
+        session->realloc = local_realloc;
+        session->send = _libssh2_send;
+        session->recv = _libssh2_recv;
+        session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
+        session->api_block_mode = 1; /* blocking API by default */
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "New session resource allocated");
+        _libssh2_init_if_needed ();
+    }
+    return session;
+}
+
+/*
+ * libssh2_session_callback_set
+ *
+ * Set (or reset) a callback function
+ * Returns the prior address
+ *
+ * FIXME: this function relies on that we can typecast function pointers
+ * to void pointers, which isn't allowed in ISO C!
+ */
+LIBSSH2_API void *
+libssh2_session_callback_set(LIBSSH2_SESSION * session,
+                             int cbtype, void *callback)
+{
+    void *oldcb;
+
+    switch (cbtype) {
+    case LIBSSH2_CALLBACK_IGNORE:
+        oldcb = session->ssh_msg_ignore;
+        session->ssh_msg_ignore = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_DEBUG:
+        oldcb = session->ssh_msg_debug;
+        session->ssh_msg_debug = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_DISCONNECT:
+        oldcb = session->ssh_msg_disconnect;
+        session->ssh_msg_disconnect = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_MACERROR:
+        oldcb = session->macerror;
+        session->macerror = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_X11:
+        oldcb = session->x11;
+        session->x11 = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_SEND:
+        oldcb = session->send;
+        session->send = callback;
+        return oldcb;
+
+    case LIBSSH2_CALLBACK_RECV:
+        oldcb = session->recv;
+        session->recv = callback;
+        return oldcb;
+    }
+    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Setting Callback %d", cbtype);
+
+    return NULL;
+}
+
+/*
+ * _libssh2_wait_socket()
+ *
+ * Utility function that waits for action on the socket. Returns 0 when ready
+ * to run again or error on timeout.
+ */
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
+{
+    int rc;
+    int seconds_to_next;
+    int dir;
+    int has_timeout;
+    long ms_to_next = 0;
+    long elapsed_ms;
+
+    /* since libssh2 often sets EAGAIN internally before this function is
+       called, we can decrease some amount of confusion in user programs by
+       resetting the error code in this function to reduce the risk of EAGAIN
+       being stored as error when a blocking function has returned */
+    session->err_code = LIBSSH2_ERROR_NONE;
+
+    rc = libssh2_keepalive_send (session, &seconds_to_next);
+    if (rc < 0)
+        return rc;
+
+    ms_to_next = seconds_to_next * 1000;
+
+    /* figure out what to wait for */
+    dir = libssh2_session_block_directions(session);
+
+    if(!dir) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Nothing to wait for in wait_socket");
+        /* To avoid that we hang below just because there's nothing set to
+           wait for, we timeout on 1 second to also avoid busy-looping
+           during this condition */
+        ms_to_next = 1000;
+    }
+
+    if (session->api_timeout > 0 &&
+        (seconds_to_next == 0 ||
+         seconds_to_next > session->api_timeout)) {
+        time_t now = time (NULL);
+        elapsed_ms = (long)(1000*difftime(start_time, now));
+        if (elapsed_ms > session->api_timeout) {
+            session->err_code = LIBSSH2_ERROR_TIMEOUT;
+            return LIBSSH2_ERROR_TIMEOUT;
+        }
+        ms_to_next = (session->api_timeout - elapsed_ms);
+        has_timeout = 1;
+    }
+    else if (ms_to_next > 0) {
+        has_timeout = 1;
+    }
+    else
+        has_timeout = 0;
+
+#ifdef HAVE_POLL
+    {
+        struct pollfd sockets[1];
+
+        sockets[0].fd = session->socket_fd;
+        sockets[0].events = 0;
+        sockets[0].revents = 0;
+
+        if(dir & LIBSSH2_SESSION_BLOCK_INBOUND)
+            sockets[0].events |= POLLIN;
+
+        if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
+            sockets[0].events |= POLLOUT;
+
+        rc = poll(sockets, 1, has_timeout?ms_to_next: -1);
+    }
+#else
+    {
+        fd_set rfd;
+        fd_set wfd;
+        fd_set *writefd = NULL;
+        fd_set *readfd = NULL;
+        struct timeval tv;
+
+        tv.tv_sec = ms_to_next / 1000;
+        tv.tv_usec = (ms_to_next - tv.tv_sec*1000) * 1000;
+
+        if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
+            FD_ZERO(&rfd);
+            FD_SET(session->socket_fd, &rfd);
+            readfd = &rfd;
+        }
+
+        if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND) {
+            FD_ZERO(&wfd);
+            FD_SET(session->socket_fd, &wfd);
+            writefd = &wfd;
+        }
+
+        rc = select(session->socket_fd + 1, readfd, writefd, NULL,
+                    has_timeout ? &tv : NULL);
+    }
+#endif
+    if(rc <= 0) {
+        /* timeout (or error), bail out with a timeout error */
+        session->err_code = LIBSSH2_ERROR_TIMEOUT;
+        return LIBSSH2_ERROR_TIMEOUT;
+    }
+
+    return 0; /* ready to try again */
+}
+
+static int
+session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
+{
+    int rc;
+
+    if (session->startup_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "session_startup for socket %d", sock);
+        if (LIBSSH2_INVALID_SOCKET == sock) {
+            /* Did we forget something? */
+            return _libssh2_error(session, LIBSSH2_ERROR_BAD_SOCKET,
+                                  "Bad socket provided");
+        }
+        session->socket_fd = sock;
+
+        session->socket_prev_blockstate =
+            !get_socket_nonblocking(session->socket_fd);
+
+        if (session->socket_prev_blockstate) {
+            /* If in blocking state chang to non-blocking */
+            session_nonblock(session->socket_fd, 1);
+        }
+
+        session->startup_state = libssh2_NB_state_created;
+    }
+
+    if (session->startup_state == libssh2_NB_state_created) {
+        rc = banner_send(session);
+        if (rc) {
+            return _libssh2_error(session, rc,
+                                  "Failed sending banner");
+        }
+        session->startup_state = libssh2_NB_state_sent;
+        session->banner_TxRx_state = libssh2_NB_state_idle;
+    }
+
+    if (session->startup_state == libssh2_NB_state_sent) {
+        do {
+            rc = banner_receive(session);
+            if (rc)
+                return _libssh2_error(session, rc,
+                                      "Failed getting banner");
+        } while(strncmp("SSH-", (char *)session->remote.banner, 4));
+
+        session->startup_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->startup_state == libssh2_NB_state_sent1) {
+        rc = _libssh2_kex_exchange(session, 0, &session->startup_key_state);
+        if (rc)
+            return _libssh2_error(session, rc,
+                                  "Unable to exchange encryption keys");
+
+        session->startup_state = libssh2_NB_state_sent2;
+    }
+
+    if (session->startup_state == libssh2_NB_state_sent2) {
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "Requesting userauth service");
+
+        /* Request the userauth service */
+        session->startup_service[0] = SSH_MSG_SERVICE_REQUEST;
+        _libssh2_htonu32(session->startup_service + 1,
+                         sizeof("ssh-userauth") - 1);
+        memcpy(session->startup_service + 5, "ssh-userauth",
+               sizeof("ssh-userauth") - 1);
+
+        session->startup_state = libssh2_NB_state_sent3;
+    }
+
+    if (session->startup_state == libssh2_NB_state_sent3) {
+        rc = _libssh2_transport_send(session, session->startup_service,
+                                     sizeof("ssh-userauth") + 5 - 1,
+                                     NULL, 0);
+        if (rc) {
+            return _libssh2_error(session, rc,
+                                  "Unable to ask for ssh-userauth service");
+        }
+
+        session->startup_state = libssh2_NB_state_sent4;
+    }
+
+    if (session->startup_state == libssh2_NB_state_sent4) {
+        rc = _libssh2_packet_require(session, SSH_MSG_SERVICE_ACCEPT,
+                                     &session->startup_data,
+                                     &session->startup_data_len, 0, NULL, 0,
+                                     &session->startup_req_state);
+        if (rc)
+            return rc;
+
+        session->startup_service_length =
+            _libssh2_ntohu32(session->startup_data + 1);
+
+        if ((session->startup_service_length != (sizeof("ssh-userauth") - 1))
+            || strncmp("ssh-userauth", (char *) session->startup_data + 5,
+                       session->startup_service_length)) {
+            LIBSSH2_FREE(session, session->startup_data);
+            session->startup_data = NULL;
+            return _libssh2_error(session, LIBSSH2_ERROR_PROTO,
+                                  "Invalid response received from server");
+        }
+        LIBSSH2_FREE(session, session->startup_data);
+        session->startup_data = NULL;
+
+        session->startup_state = libssh2_NB_state_idle;
+
+        return 0;
+    }
+
+    /* just for safety return some error */
+    return LIBSSH2_ERROR_INVAL;
+}
+
+/*
+ * libssh2_session_handshake()
+ *
+ * session: LIBSSH2_SESSION struct allocated and owned by the calling program
+ * sock:    *must* be populated with an opened and connected socket.
+ *
+ * Returns: 0 on success, or non-zero on failure
+ */
+LIBSSH2_API int
+libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t sock)
+{
+    int rc;
+
+    BLOCK_ADJUST(rc, session, session_startup(session, sock) );
+
+    return rc;
+}
+
+/*
+ * libssh2_session_startup()
+ *
+ * DEPRECATED. Use libssh2_session_handshake() instead! This function is not
+ * portable enough.
+ *
+ * session: LIBSSH2_SESSION struct allocated and owned by the calling program
+ * sock:    *must* be populated with an opened and connected socket.
+ *
+ * Returns: 0 on success, or non-zero on failure
+ */
+LIBSSH2_API int
+libssh2_session_startup(LIBSSH2_SESSION *session, int sock)
+{
+    return libssh2_session_handshake(session, (libssh2_socket_t) sock);
+}
+
+/*
+ * libssh2_session_free
+ *
+ * Frees the memory allocated to the session
+ * Also closes and frees any channels attached to this session
+ */
+static int
+session_free(LIBSSH2_SESSION *session)
+{
+    int rc;
+    LIBSSH2_PACKET *pkg;
+    LIBSSH2_CHANNEL *ch;
+    LIBSSH2_LISTENER *l;
+    int packets_left = 0;
+
+    if (session->free_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Freeing session resource",
+                       session->remote.banner);
+
+        session->free_state = libssh2_NB_state_created;
+    }
+
+    if (session->free_state == libssh2_NB_state_created) {
+        while ((ch = _libssh2_list_first(&session->channels))) {
+
+            rc = _libssh2_channel_free(ch);
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+                return rc;
+        }
+
+        session->free_state = libssh2_NB_state_sent;
+    }
+
+    if (session->free_state == libssh2_NB_state_sent) {
+        while ((l = _libssh2_list_first(&session->listeners))) {
+            rc = _libssh2_channel_forward_cancel(l);
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+                return rc;
+        }
+
+        session->free_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->state & LIBSSH2_STATE_NEWKEYS) {
+        /* hostkey */
+        if (session->hostkey && session->hostkey->dtor) {
+            session->hostkey->dtor(session, &session->server_hostkey_abstract);
+        }
+
+        /* Client to Server */
+        /* crypt */
+        if (session->local.crypt && session->local.crypt->dtor) {
+            session->local.crypt->dtor(session,
+                                       &session->local.crypt_abstract);
+        }
+        /* comp */
+        if (session->local.comp && session->local.comp->dtor) {
+            session->local.comp->dtor(session, 1,
+                                      &session->local.comp_abstract);
+        }
+        /* mac */
+        if (session->local.mac && session->local.mac->dtor) {
+            session->local.mac->dtor(session, &session->local.mac_abstract);
+        }
+
+        /* Server to Client */
+        /* crypt */
+        if (session->remote.crypt && session->remote.crypt->dtor) {
+            session->remote.crypt->dtor(session,
+                                        &session->remote.crypt_abstract);
+        }
+        /* comp */
+        if (session->remote.comp && session->remote.comp->dtor) {
+            session->remote.comp->dtor(session, 0,
+                                       &session->remote.comp_abstract);
+        }
+        /* mac */
+        if (session->remote.mac && session->remote.mac->dtor) {
+            session->remote.mac->dtor(session, &session->remote.mac_abstract);
+        }
+
+        /* session_id */
+        if (session->session_id) {
+            LIBSSH2_FREE(session, session->session_id);
+        }
+    }
+
+    /* Free banner(s) */
+    if (session->remote.banner) {
+        LIBSSH2_FREE(session, session->remote.banner);
+    }
+    if (session->local.banner) {
+        LIBSSH2_FREE(session, session->local.banner);
+    }
+
+    /* Free preference(s) */
+    if (session->kex_prefs) {
+        LIBSSH2_FREE(session, session->kex_prefs);
+    }
+    if (session->hostkey_prefs) {
+        LIBSSH2_FREE(session, session->hostkey_prefs);
+    }
+
+    if (session->local.kexinit) {
+        LIBSSH2_FREE(session, session->local.kexinit);
+    }
+    if (session->local.crypt_prefs) {
+        LIBSSH2_FREE(session, session->local.crypt_prefs);
+    }
+    if (session->local.mac_prefs) {
+        LIBSSH2_FREE(session, session->local.mac_prefs);
+    }
+    if (session->local.comp_prefs) {
+        LIBSSH2_FREE(session, session->local.comp_prefs);
+    }
+    if (session->local.lang_prefs) {
+        LIBSSH2_FREE(session, session->local.lang_prefs);
+    }
+
+    if (session->remote.kexinit) {
+        LIBSSH2_FREE(session, session->remote.kexinit);
+    }
+    if (session->remote.crypt_prefs) {
+        LIBSSH2_FREE(session, session->remote.crypt_prefs);
+    }
+    if (session->remote.mac_prefs) {
+        LIBSSH2_FREE(session, session->remote.mac_prefs);
+    }
+    if (session->remote.comp_prefs) {
+        LIBSSH2_FREE(session, session->remote.comp_prefs);
+    }
+    if (session->remote.lang_prefs) {
+        LIBSSH2_FREE(session, session->remote.lang_prefs);
+    }
+
+    /*
+     * Make sure all memory used in the state variables are free
+     */
+    if (session->kexinit_data) {
+        LIBSSH2_FREE(session, session->kexinit_data);
+    }
+    if (session->startup_data) {
+        LIBSSH2_FREE(session, session->startup_data);
+    }
+    if (session->userauth_list_data) {
+        LIBSSH2_FREE(session, session->userauth_list_data);
+    }
+    if (session->userauth_pswd_data) {
+        LIBSSH2_FREE(session, session->userauth_pswd_data);
+    }
+    if (session->userauth_pswd_newpw) {
+        LIBSSH2_FREE(session, session->userauth_pswd_newpw);
+    }
+    if (session->userauth_host_packet) {
+        LIBSSH2_FREE(session, session->userauth_host_packet);
+    }
+    if (session->userauth_host_method) {
+        LIBSSH2_FREE(session, session->userauth_host_method);
+    }
+    if (session->userauth_host_data) {
+        LIBSSH2_FREE(session, session->userauth_host_data);
+    }
+    if (session->userauth_pblc_data) {
+        LIBSSH2_FREE(session, session->userauth_pblc_data);
+    }
+    if (session->userauth_pblc_packet) {
+        LIBSSH2_FREE(session, session->userauth_pblc_packet);
+    }
+    if (session->userauth_pblc_method) {
+        LIBSSH2_FREE(session, session->userauth_pblc_method);
+    }
+    if (session->userauth_kybd_data) {
+        LIBSSH2_FREE(session, session->userauth_kybd_data);
+    }
+    if (session->userauth_kybd_packet) {
+        LIBSSH2_FREE(session, session->userauth_kybd_packet);
+    }
+    if (session->userauth_kybd_auth_instruction) {
+        LIBSSH2_FREE(session, session->userauth_kybd_auth_instruction);
+    }
+    if (session->open_packet) {
+        LIBSSH2_FREE(session, session->open_packet);
+    }
+    if (session->open_data) {
+        LIBSSH2_FREE(session, session->open_data);
+    }
+    if (session->direct_message) {
+        LIBSSH2_FREE(session, session->direct_message);
+    }
+    if (session->fwdLstn_packet) {
+        LIBSSH2_FREE(session, session->fwdLstn_packet);
+    }
+    if (session->pkeyInit_data) {
+        LIBSSH2_FREE(session, session->pkeyInit_data);
+    }
+    if (session->scpRecv_command) {
+        LIBSSH2_FREE(session, session->scpRecv_command);
+    }
+    if (session->scpSend_command) {
+        LIBSSH2_FREE(session, session->scpSend_command);
+    }
+
+    /* Cleanup all remaining packets */
+    while ((pkg = _libssh2_list_first(&session->packets))) {
+        packets_left++;
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+            "packet left with id %d", pkg->data[0]);
+        /* unlink the node */
+        _libssh2_list_remove(&pkg->node);
+
+        /* free */
+        LIBSSH2_FREE(session, pkg->data);
+        LIBSSH2_FREE(session, pkg);
+    }
+    _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+         "Extra packets left %d", packets_left);
+
+    if(session->socket_prev_blockstate)
+        /* if the socket was previously blocking, put it back so */
+        session_nonblock(session->socket_fd, 0);
+
+    if (session->server_hostkey) {
+        LIBSSH2_FREE(session, session->server_hostkey);
+    }
+
+    LIBSSH2_FREE(session, session);
+
+    return 0;
+}
+
+/*
+ * libssh2_session_free
+ *
+ * Frees the memory allocated to the session
+ * Also closes and frees any channels attached to this session
+ */
+LIBSSH2_API int
+libssh2_session_free(LIBSSH2_SESSION * session)
+{
+    int rc;
+
+    BLOCK_ADJUST(rc, session, session_free(session) );
+
+    return rc;
+}
+
+/*
+ * libssh2_session_disconnect_ex
+ */
+static int
+session_disconnect(LIBSSH2_SESSION *session, int reason,
+                   const char *description,
+                   const char *lang)
+{
+    unsigned char *s;
+    unsigned long descr_len = 0, lang_len = 0;
+    int rc;
+
+    if (session->disconnect_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+                       "Disconnecting: reason=%d, desc=%s, lang=%s", reason,
+                       description, lang);
+        if (description)
+            descr_len = strlen(description);
+
+        if (lang)
+            lang_len = strlen(lang);
+
+        if(descr_len > 256)
+            return _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                                  "too long description");
+
+        /* 13 = packet_type(1) + reason code(4) + descr_len(4) + lang_len(4) */
+        session->disconnect_data_len = descr_len + lang_len + 13;
+
+        s = session->disconnect_data;
+
+        *(s++) = SSH_MSG_DISCONNECT;
+        _libssh2_store_u32(&s, reason);
+        _libssh2_store_str(&s, description, descr_len);
+        /* store length only, lang is sent separately */
+        _libssh2_store_u32(&s, lang_len);
+
+        session->disconnect_state = libssh2_NB_state_created;
+    }
+
+    rc = _libssh2_transport_send(session, session->disconnect_data,
+                                 session->disconnect_data_len,
+                                 (unsigned char *)lang, lang_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN)
+        return rc;
+
+    session->disconnect_state = libssh2_NB_state_idle;
+
+    return 0;
+}
+
+/*
+ * libssh2_session_disconnect_ex
+ */
+LIBSSH2_API int
+libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason,
+                              const char *desc, const char *lang)
+{
+    int rc;
+
+    BLOCK_ADJUST(rc, session,
+                 session_disconnect(session, reason, desc, lang));
+
+    return rc;
+}
+
+/* libssh2_session_methods
+ *
+ * Return the currently active methods for method_type
+ *
+ * NOTE: Currently lang_cs and lang_sc are ALWAYS set to empty string
+ * regardless of actual negotiation Strings should NOT be freed
+ */
+LIBSSH2_API const char *
+libssh2_session_methods(LIBSSH2_SESSION * session, int method_type)
+{
+    /* All methods have char *name as their first element */
+    const LIBSSH2_KEX_METHOD *method = NULL;
+
+    switch (method_type) {
+    case LIBSSH2_METHOD_KEX:
+        method = session->kex;
+        break;
+
+    case LIBSSH2_METHOD_HOSTKEY:
+        method = (LIBSSH2_KEX_METHOD *) session->hostkey;
+        break;
+
+    case LIBSSH2_METHOD_CRYPT_CS:
+        method = (LIBSSH2_KEX_METHOD *) session->local.crypt;
+        break;
+
+    case LIBSSH2_METHOD_CRYPT_SC:
+        method = (LIBSSH2_KEX_METHOD *) session->remote.crypt;
+        break;
+
+    case LIBSSH2_METHOD_MAC_CS:
+        method = (LIBSSH2_KEX_METHOD *) session->local.mac;
+        break;
+
+    case LIBSSH2_METHOD_MAC_SC:
+        method = (LIBSSH2_KEX_METHOD *) session->remote.mac;
+        break;
+
+    case LIBSSH2_METHOD_COMP_CS:
+        method = (LIBSSH2_KEX_METHOD *) session->local.comp;
+        break;
+
+    case LIBSSH2_METHOD_COMP_SC:
+        method = (LIBSSH2_KEX_METHOD *) session->remote.comp;
+        break;
+
+    case LIBSSH2_METHOD_LANG_CS:
+        return "";
+
+    case LIBSSH2_METHOD_LANG_SC:
+        return "";
+
+    default:
+        _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                       "Invalid parameter specified for method_type");
+        return NULL;
+    }
+
+    if (!method) {
+        _libssh2_error(session, LIBSSH2_ERROR_METHOD_NONE,
+                       "No method negotiated");
+        return NULL;
+    }
+
+    return method->name;
+}
+
+/* libssh2_session_abstract
+ * Retrieve a pointer to the abstract property
+ */
+LIBSSH2_API void **
+libssh2_session_abstract(LIBSSH2_SESSION * session)
+{
+    return &session->abstract;
+}
+
+/* libssh2_session_last_error
+ *
+ * Returns error code and populates an error string into errmsg If want_buf is
+ * non-zero then the string placed into errmsg must be freed by the calling
+ * program. Otherwise it is assumed to be owned by libssh2
+ */
+LIBSSH2_API int
+libssh2_session_last_error(LIBSSH2_SESSION * session, char **errmsg,
+                           int *errmsg_len, int want_buf)
+{
+    size_t msglen = 0;
+
+    /* No error to report */
+    if (!session->err_code) {
+        if (errmsg) {
+            if (want_buf) {
+                *errmsg = LIBSSH2_ALLOC(session, 1);
+                if (*errmsg) {
+                    **errmsg = 0;
+                }
+            } else {
+                *errmsg = (char *) "";
+            }
+        }
+        if (errmsg_len) {
+            *errmsg_len = 0;
+        }
+        return 0;
+    }
+
+    if (errmsg) {
+        const char *error = session->err_msg ? session->err_msg : "";
+
+        msglen = strlen(error);
+
+        if (want_buf) {
+            /* Make a copy so the calling program can own it */
+            *errmsg = LIBSSH2_ALLOC(session, msglen + 1);
+            if (*errmsg) {
+                memcpy(*errmsg, error, msglen);
+                (*errmsg)[msglen] = 0;
+            }
+        }
+        else
+            *errmsg = (char *)error;
+    }
+
+    if (errmsg_len) {
+        *errmsg_len = msglen;
+    }
+
+    return session->err_code;
+}
+
+/* libssh2_session_last_errno
+ *
+ * Returns error code
+ */
+LIBSSH2_API int
+libssh2_session_last_errno(LIBSSH2_SESSION * session)
+{
+    return session->err_code;
+}
+
+/* libssh2_session_flag
+ *
+ * Set/Get session flags
+ *
+ * Return error code.
+ */
+LIBSSH2_API int
+libssh2_session_flag(LIBSSH2_SESSION * session, int flag, int value)
+{
+    switch(flag) {
+    case LIBSSH2_FLAG_SIGPIPE:
+        session->flag.sigpipe = value;
+        break;
+    case LIBSSH2_FLAG_COMPRESS:
+        session->flag.compress = value;
+        break;
+    default:
+        /* unknown flag */
+        return LIBSSH2_ERROR_INVAL;
+    }
+
+    return LIBSSH2_ERROR_NONE;
+}
+
+/* _libssh2_session_set_blocking
+ *
+ * Set a session's blocking mode on or off, return the previous status when
+ * this function is called. Note this function does not alter the state of the
+ * actual socket involved.
+ */
+int
+_libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking)
+{
+    int bl = session->api_block_mode;
+    _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                   "Setting blocking mode %s", blocking?"ON":"OFF");
+    session->api_block_mode = blocking;
+
+    return bl;
+}
+
+/* libssh2_session_set_blocking
+ *
+ * Set a channel's blocking mode on or off, similar to a socket's
+ * fcntl(fd, F_SETFL, O_NONBLOCK); type command
+ */
+LIBSSH2_API void
+libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking)
+{
+    (void) _libssh2_session_set_blocking(session, blocking);
+}
+
+/* libssh2_session_get_blocking
+ *
+ * Returns a session's blocking mode on or off
+ */
+LIBSSH2_API int
+libssh2_session_get_blocking(LIBSSH2_SESSION * session)
+{
+    return session->api_block_mode;
+}
+
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode,
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
+/*
+ * libssh2_poll_channel_read
+ *
+ * Returns 0 if no data is waiting on channel,
+ * non-0 if data is available
+ */
+LIBSSH2_API int
+libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended)
+{
+    LIBSSH2_SESSION *session;
+    LIBSSH2_PACKET *packet;
+
+    if(!channel)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    session = channel->session;
+    packet = _libssh2_list_first(&session->packets);
+
+    while (packet) {
+        if ( channel->local.id == _libssh2_ntohu32(packet->data + 1)) {
+            if ( extended == 1 &&
+                 (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA
+                  || packet->data[0] == SSH_MSG_CHANNEL_DATA )) {
+                return 1;
+            } else if ( extended == 0 &&
+                        packet->data[0] == SSH_MSG_CHANNEL_DATA) {
+                return 1;
+            }
+            /* else - no data of any type is ready to be read */
+        }
+        packet = _libssh2_list_next(&packet->node);
+    }
+
+    return 0;
+}
+
+/*
+ * poll_channel_write
+ *
+ * Returns 0 if writing to channel would block,
+ * non-0 if data can be written without blocking
+ */
+static inline int
+poll_channel_write(LIBSSH2_CHANNEL * channel)
+{
+    return channel->local.window_size ? 1 : 0;
+}
+
+/* poll_listener_queued
+ *
+ * Returns 0 if no connections are waiting to be accepted
+ * non-0 if one or more connections are available
+ */
+static inline int
+poll_listener_queued(LIBSSH2_LISTENER * listener)
+{
+    return _libssh2_list_first(&listener->queue) ? 1 : 0;
+}
+
+/*
+ * libssh2_poll
+ *
+ * Poll sockets, channels, and listeners for activity
+ */
+LIBSSH2_API int
+libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout)
+{
+    long timeout_remaining;
+    unsigned int i, active_fds;
+#ifdef HAVE_POLL
+    LIBSSH2_SESSION *session = NULL;
+#ifdef HAVE_ALLOCA
+    struct pollfd *sockets = alloca(sizeof(struct pollfd) * nfds);
+#else
+    struct pollfd sockets[256];
+
+    if (nfds > 256)
+        /* systems without alloca use a fixed-size array, this can be fixed if
+           we really want to, at least if the compiler is a C99 capable one */
+        return -1;
+#endif
+    /* Setup sockets for polling */
+    for(i = 0; i < nfds; i++) {
+        fds[i].revents = 0;
+        switch (fds[i].type) {
+        case LIBSSH2_POLLFD_SOCKET:
+            sockets[i].fd = fds[i].fd.socket;
+            sockets[i].events = fds[i].events;
+            sockets[i].revents = 0;
+            break;
+
+        case LIBSSH2_POLLFD_CHANNEL:
+            sockets[i].fd = fds[i].fd.channel->session->socket_fd;
+            sockets[i].events = POLLIN;
+            sockets[i].revents = 0;
+            if (!session)
+                session = fds[i].fd.channel->session;
+            break;
+
+        case LIBSSH2_POLLFD_LISTENER:
+            sockets[i].fd = fds[i].fd.listener->session->socket_fd;
+            sockets[i].events = POLLIN;
+            sockets[i].revents = 0;
+            if (!session)
+                session = fds[i].fd.listener->session;
+            break;
+
+        default:
+            if (session)
+                _libssh2_error(session, LIBSSH2_ERROR_INVALID_POLL_TYPE,
+                               "Invalid descriptor passed to libssh2_poll()");
+            return -1;
+        }
+    }
+#elif defined(HAVE_SELECT)
+    LIBSSH2_SESSION *session = NULL;
+    libssh2_socket_t maxfd = 0;
+    fd_set rfds, wfds;
+    struct timeval tv;
+
+    FD_ZERO(&rfds);
+    FD_ZERO(&wfds);
+    for(i = 0; i < nfds; i++) {
+        fds[i].revents = 0;
+        switch (fds[i].type) {
+        case LIBSSH2_POLLFD_SOCKET:
+            if (fds[i].events & LIBSSH2_POLLFD_POLLIN) {
+                FD_SET(fds[i].fd.socket, &rfds);
+                if (fds[i].fd.socket > maxfd)
+                    maxfd = fds[i].fd.socket;
+            }
+            if (fds[i].events & LIBSSH2_POLLFD_POLLOUT) {
+                FD_SET(fds[i].fd.socket, &wfds);
+                if (fds[i].fd.socket > maxfd)
+                    maxfd = fds[i].fd.socket;
+            }
+            break;
+
+        case LIBSSH2_POLLFD_CHANNEL:
+            FD_SET(fds[i].fd.channel->session->socket_fd, &rfds);
+            if (fds[i].fd.channel->session->socket_fd > maxfd)
+                maxfd = fds[i].fd.channel->session->socket_fd;
+            if (!session)
+                session = fds[i].fd.channel->session;
+            break;
+
+        case LIBSSH2_POLLFD_LISTENER:
+            FD_SET(fds[i].fd.listener->session->socket_fd, &rfds);
+            if (fds[i].fd.listener->session->socket_fd > maxfd)
+                maxfd = fds[i].fd.listener->session->socket_fd;
+            if (!session)
+                session = fds[i].fd.listener->session;
+            break;
+
+        default:
+            if (session)
+                _libssh2_error(session, LIBSSH2_ERROR_INVALID_POLL_TYPE,
+                               "Invalid descriptor passed to libssh2_poll()");
+            return -1;
+        }
+    }
+#else
+    /* No select() or poll()
+     * no sockets sturcture to setup
+     */
+
+    timeout = 0;
+#endif /* HAVE_POLL or HAVE_SELECT */
+
+    timeout_remaining = timeout;
+    do {
+#if defined(HAVE_POLL) || defined(HAVE_SELECT)
+        int sysret;
+#endif
+
+        active_fds = 0;
+
+        for(i = 0; i < nfds; i++) {
+            if (fds[i].events != fds[i].revents) {
+                switch (fds[i].type) {
+                case LIBSSH2_POLLFD_CHANNEL:
+                    if ((fds[i].events & LIBSSH2_POLLFD_POLLIN) &&
+                        /* Want to be ready for read */
+                        ((fds[i].revents & LIBSSH2_POLLFD_POLLIN) == 0)) {
+                        /* Not yet known to be ready for read */
+                        fds[i].revents |=
+                            libssh2_poll_channel_read(fds[i].fd.channel,
+                                                      0) ?
+                            LIBSSH2_POLLFD_POLLIN : 0;
+                    }
+                    if ((fds[i].events & LIBSSH2_POLLFD_POLLEXT) &&
+                        /* Want to be ready for extended read */
+                        ((fds[i].revents & LIBSSH2_POLLFD_POLLEXT) == 0)) {
+                        /* Not yet known to be ready for extended read */
+                        fds[i].revents |=
+                            libssh2_poll_channel_read(fds[i].fd.channel,
+                                                      1) ?
+                            LIBSSH2_POLLFD_POLLEXT : 0;
+                    }
+                    if ((fds[i].events & LIBSSH2_POLLFD_POLLOUT) &&
+                        /* Want to be ready for write */
+                        ((fds[i].revents & LIBSSH2_POLLFD_POLLOUT) == 0)) {
+                        /* Not yet known to be ready for write */
+                        fds[i].revents |=
+                            poll_channel_write(fds[i].fd. channel) ?
+                            LIBSSH2_POLLFD_POLLOUT : 0;
+                    }
+                    if (fds[i].fd.channel->remote.close
+                        || fds[i].fd.channel->local.close) {
+                        fds[i].revents |= LIBSSH2_POLLFD_CHANNEL_CLOSED;
+                    }
+                    if (fds[i].fd.channel->session->socket_state ==
+                        LIBSSH2_SOCKET_DISCONNECTED) {
+                        fds[i].revents |=
+                            LIBSSH2_POLLFD_CHANNEL_CLOSED |
+                            LIBSSH2_POLLFD_SESSION_CLOSED;
+                    }
+                    break;
+
+                case LIBSSH2_POLLFD_LISTENER:
+                    if ((fds[i].events & LIBSSH2_POLLFD_POLLIN) &&
+                        /* Want a connection */
+                        ((fds[i].revents & LIBSSH2_POLLFD_POLLIN) == 0)) {
+                        /* No connections known of yet */
+                        fds[i].revents |=
+                            poll_listener_queued(fds[i].fd. listener) ?
+                            LIBSSH2_POLLFD_POLLIN : 0;
+                    }
+                    if (fds[i].fd.listener->session->socket_state ==
+                        LIBSSH2_SOCKET_DISCONNECTED) {
+                        fds[i].revents |=
+                            LIBSSH2_POLLFD_LISTENER_CLOSED |
+                            LIBSSH2_POLLFD_SESSION_CLOSED;
+                    }
+                    break;
+                }
+            }
+            if (fds[i].revents) {
+                active_fds++;
+            }
+        }
+
+        if (active_fds) {
+            /* Don't block on the sockets if we have channels/listeners which
+               are ready */
+            timeout_remaining = 0;
+        }
+#ifdef HAVE_POLL
+
+#ifdef HAVE_LIBSSH2_GETTIMEOFDAY
+        {
+            struct timeval tv_begin, tv_end;
+
+            _libssh2_gettimeofday((struct timeval *) &tv_begin, NULL);
+            sysret = poll(sockets, nfds, timeout_remaining);
+            _libssh2_gettimeofday((struct timeval *) &tv_end, NULL);
+            timeout_remaining -= (tv_end.tv_sec - tv_begin.tv_sec) * 1000;
+            timeout_remaining -= (tv_end.tv_usec - tv_begin.tv_usec) / 1000;
+        }
+#else
+        /* If the platform doesn't support gettimeofday,
+         * then just make the call non-blocking and walk away
+         */
+        sysret = poll(sockets, nfds, timeout_remaining);
+        timeout_remaining = 0;
+#endif /* HAVE_GETTIMEOFDAY */
+
+        if (sysret > 0) {
+            for(i = 0; i < nfds; i++) {
+                switch (fds[i].type) {
+                case LIBSSH2_POLLFD_SOCKET:
+                    fds[i].revents = sockets[i].revents;
+                    sockets[i].revents = 0; /* In case we loop again, be nice */
+                    if (fds[i].revents) {
+                        active_fds++;
+                    }
+                    break;
+                case LIBSSH2_POLLFD_CHANNEL:
+                    if (sockets[i].events & POLLIN) {
+                        /* Spin session until no data available */
+                        while (_libssh2_transport_read(fds[i].fd.channel->session)
+                               > 0);
+                    }
+                    if (sockets[i].revents & POLLHUP) {
+                        fds[i].revents |=
+                            LIBSSH2_POLLFD_CHANNEL_CLOSED |
+                            LIBSSH2_POLLFD_SESSION_CLOSED;
+                    }
+                    sockets[i].revents = 0;
+                    break;
+                case LIBSSH2_POLLFD_LISTENER:
+                    if (sockets[i].events & POLLIN) {
+                        /* Spin session until no data available */
+                        while (_libssh2_transport_read(fds[i].fd.listener->session)
+                               > 0);
+                    }
+                    if (sockets[i].revents & POLLHUP) {
+                        fds[i].revents |=
+                            LIBSSH2_POLLFD_LISTENER_CLOSED |
+                            LIBSSH2_POLLFD_SESSION_CLOSED;
+                    }
+                    sockets[i].revents = 0;
+                    break;
+                }
+            }
+        }
+#elif defined(HAVE_SELECT)
+        tv.tv_sec = timeout_remaining / 1000;
+        tv.tv_usec = (timeout_remaining % 1000) * 1000;
+#ifdef HAVE_LIBSSH2_GETTIMEOFDAY
+        {
+            struct timeval tv_begin, tv_end;
+
+            _libssh2_gettimeofday((struct timeval *) &tv_begin, NULL);
+            sysret = select(maxfd+1, &rfds, &wfds, NULL, &tv);
+            _libssh2_gettimeofday((struct timeval *) &tv_end, NULL);
+
+            timeout_remaining -= (tv_end.tv_sec - tv_begin.tv_sec) * 1000;
+            timeout_remaining -= (tv_end.tv_usec - tv_begin.tv_usec) / 1000;
+        }
+#else
+        /* If the platform doesn't support gettimeofday,
+         * then just make the call non-blocking and walk away
+         */
+        sysret = select(maxfd+1, &rfds, &wfds, NULL, &tv);
+        timeout_remaining = 0;
+#endif
+
+        if (sysret > 0) {
+            for(i = 0; i < nfds; i++) {
+                switch (fds[i].type) {
+                case LIBSSH2_POLLFD_SOCKET:
+                    if (FD_ISSET(fds[i].fd.socket, &rfds)) {
+                        fds[i].revents |= LIBSSH2_POLLFD_POLLIN;
+                    }
+                    if (FD_ISSET(fds[i].fd.socket, &wfds)) {
+                        fds[i].revents |= LIBSSH2_POLLFD_POLLOUT;
+                    }
+                    if (fds[i].revents) {
+                        active_fds++;
+                    }
+                    break;
+
+                case LIBSSH2_POLLFD_CHANNEL:
+                    if (FD_ISSET(fds[i].fd.channel->session->socket_fd, &rfds)) {
+                        /* Spin session until no data available */
+                        while (_libssh2_transport_read(fds[i].fd.channel->session)
+                               > 0);
+                    }
+                    break;
+
+                case LIBSSH2_POLLFD_LISTENER:
+                    if (FD_ISSET
+                        (fds[i].fd.listener->session->socket_fd, &rfds)) {
+                        /* Spin session until no data available */
+                        while (_libssh2_transport_read(fds[i].fd.listener->session)
+                               > 0);
+                    }
+                    break;
+                }
+            }
+        }
+#endif /* else no select() or poll() -- timeout (and by extension
+        * timeout_remaining) will be equal to 0 */
+    } while ((timeout_remaining > 0) && !active_fds);
+
+    return active_fds;
+}
+
+/*
+ * libssh2_session_block_directions
+ *
+ * Get blocked direction when a function returns LIBSSH2_ERROR_EAGAIN
+ * Returns LIBSSH2_SOCKET_BLOCK_INBOUND if recv() blocked
+ * or LIBSSH2_SOCKET_BLOCK_OUTBOUND if send() blocked
+ */
+LIBSSH2_API int
+libssh2_session_block_directions(LIBSSH2_SESSION *session)
+{
+    return session->socket_block_directions;
+}
+
+/* libssh2_session_banner_get
+ * Get the remote banner (server ID string)
+ */
+
+LIBSSH2_API const char *
+libssh2_session_banner_get(LIBSSH2_SESSION *session)
+{
+    /* to avoid a coredump when session is NULL */
+    if (NULL == session)
+        return NULL;
+
+    if (NULL==session->remote.banner)
+        return NULL;
+
+    return (const char *) session->remote.banner;
+}
diff --git a/pgadmin/libssh2/sftp.c b/pgadmin/libssh2/sftp.c
new file mode 100644
index 0000000..d0536dd
--- /dev/null
+++ b/pgadmin/libssh2/sftp.c
@@ -0,0 +1,3285 @@
+/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
+ * Copyright (c) 2009-2012 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include <assert.h>
+
+#include "libssh2_priv.h"
+#include "libssh2_sftp.h"
+#include "channel.h"
+#include "session.h"
+#include "sftp.h"
+
+/* Note: Version 6 was documented at the time of writing
+ * However it was marked as "DO NOT IMPLEMENT" due to pending changes
+ *
+ * This release of libssh2 implements Version 5 with automatic downgrade
+ * based on server's declaration
+ */
+
+/* SFTP packet types */
+#define SSH_FXP_INIT                            1
+#define SSH_FXP_VERSION                         2
+#define SSH_FXP_OPEN                            3
+#define SSH_FXP_CLOSE                           4
+#define SSH_FXP_READ                            5
+#define SSH_FXP_WRITE                           6
+#define SSH_FXP_LSTAT                           7
+#define SSH_FXP_FSTAT                           8
+#define SSH_FXP_SETSTAT                         9
+#define SSH_FXP_FSETSTAT                        10
+#define SSH_FXP_OPENDIR                         11
+#define SSH_FXP_READDIR                         12
+#define SSH_FXP_REMOVE                          13
+#define SSH_FXP_MKDIR                           14
+#define SSH_FXP_RMDIR                           15
+#define SSH_FXP_REALPATH                        16
+#define SSH_FXP_STAT                            17
+#define SSH_FXP_RENAME                          18
+#define SSH_FXP_READLINK                        19
+#define SSH_FXP_SYMLINK                         20
+#define SSH_FXP_STATUS                          101
+#define SSH_FXP_HANDLE                          102
+#define SSH_FXP_DATA                            103
+#define SSH_FXP_NAME                            104
+#define SSH_FXP_ATTRS                           105
+#define SSH_FXP_EXTENDED                        200
+#define SSH_FXP_EXTENDED_REPLY                  201
+
+/* S_IFREG */
+#define LIBSSH2_SFTP_ATTR_PFILETYPE_FILE        0100000
+/* S_IFDIR */
+#define LIBSSH2_SFTP_ATTR_PFILETYPE_DIR         0040000
+
+#define SSH_FXE_STATVFS_ST_RDONLY               0x00000001
+#define SSH_FXE_STATVFS_ST_NOSUID               0x00000002
+
+/* This is the maximum packet length to accept, as larger than this indicate
+   some kind of server problem. */
+#define LIBSSH2_SFTP_PACKET_MAXLEN  80000
+
+static int sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle);
+static int sftp_packet_ask(LIBSSH2_SFTP *sftp, unsigned char packet_type,
+                           uint32_t request_id, unsigned char **data,
+                           size_t *data_len);
+static void sftp_packet_flush(LIBSSH2_SFTP *sftp);
+
+/* sftp_attrsize
+ * Size that attr with this flagset will occupy when turned into a bin struct
+ */
+static int sftp_attrsize(unsigned long flags)
+{
+    return (4 +                                 /* flags(4) */
+            ((flags & LIBSSH2_SFTP_ATTR_SIZE) ? 8 : 0) +
+            ((flags & LIBSSH2_SFTP_ATTR_UIDGID) ? 8 : 0) +
+            ((flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) ? 4 : 0) +
+            ((flags & LIBSSH2_SFTP_ATTR_ACMODTIME) ? 8 : 0));
+                                                /* atime + mtime as u32 */
+}
+
+/* _libssh2_store_u64
+ */
+static void _libssh2_store_u64(unsigned char **ptr, libssh2_uint64_t value)
+{
+    uint32_t msl = (uint32_t)(value >> 32);
+    unsigned char *buf = *ptr;
+
+    buf[0] = (unsigned char)((msl >> 24) & 0xFF);
+    buf[1] = (unsigned char)((msl >> 16) & 0xFF);
+    buf[2] = (unsigned char)((msl >> 8)  & 0xFF);
+    buf[3] = (unsigned char)( msl        & 0xFF);
+
+    buf[4] = (unsigned char)((value >> 24) & 0xFF);
+    buf[5] = (unsigned char)((value >> 16) & 0xFF);
+    buf[6] = (unsigned char)((value >> 8)  & 0xFF);
+    buf[7] = (unsigned char)( value        & 0xFF);
+
+    *ptr += 8;
+}
+
+/*
+ * Search list of zombied FXP_READ request IDs.
+ *
+ * Returns NULL if ID not in list.
+ */
+static struct sftp_zombie_requests *
+find_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
+{
+    struct sftp_zombie_requests *zombie =
+        _libssh2_list_first(&sftp->zombie_requests);
+
+    while(zombie) {
+        if(zombie->request_id == request_id)
+            break;
+        else
+            zombie = _libssh2_list_next(&zombie->node);
+    }
+
+    return zombie;
+}
+
+static void
+remove_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
+{
+    LIBSSH2_SESSION *session = sftp->channel->session;
+
+    struct sftp_zombie_requests *zombie = find_zombie_request(sftp,
+                                                              request_id);
+    if(zombie) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+            "Removing request ID %ld from the list of zombie requests",
+            request_id);
+
+        _libssh2_list_remove(&zombie->node);
+        LIBSSH2_FREE(session, zombie);
+    }
+}
+
+static int
+add_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
+{
+    LIBSSH2_SESSION *session = sftp->channel->session;
+
+    struct sftp_zombie_requests *zombie;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                   "Marking request ID %ld as a zombie request", request_id);
+
+    zombie = LIBSSH2_ALLOC(sftp->channel->session,
+                           sizeof(struct sftp_zombie_requests));
+    if (!zombie)
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "malloc fail for zombie request  ID");
+    else {
+        zombie->request_id = request_id;
+        _libssh2_list_add(&sftp->zombie_requests, &zombie->node);
+        return LIBSSH2_ERROR_NONE;
+    }
+}
+
+/*
+ * sftp_packet_add
+ *
+ * Add a packet to the SFTP packet brigade
+ */
+static int
+sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
+                size_t data_len)
+{
+    LIBSSH2_SESSION *session = sftp->channel->session;
+    LIBSSH2_SFTP_PACKET *packet;
+    uint32_t request_id;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Received packet %d (len %d)",
+                   (int) data[0], data_len);
+
+    /*
+     * Experience shows that if we mess up EAGAIN handling somewhere or
+     * otherwise get out of sync with the channel, this is where we first get
+     * a wrong byte and if so we need to bail out at once to aid tracking the
+     * problem better.
+     */
+
+    switch(data[0]) {
+    case SSH_FXP_INIT:
+    case SSH_FXP_VERSION:
+    case SSH_FXP_OPEN:
+    case SSH_FXP_CLOSE:
+    case SSH_FXP_READ:
+    case SSH_FXP_WRITE:
+    case SSH_FXP_LSTAT:
+    case SSH_FXP_FSTAT:
+    case SSH_FXP_SETSTAT:
+    case SSH_FXP_FSETSTAT:
+    case SSH_FXP_OPENDIR:
+    case SSH_FXP_READDIR:
+    case SSH_FXP_REMOVE:
+    case SSH_FXP_MKDIR:
+    case SSH_FXP_RMDIR:
+    case SSH_FXP_REALPATH:
+    case SSH_FXP_STAT:
+    case SSH_FXP_RENAME:
+    case SSH_FXP_READLINK:
+    case SSH_FXP_SYMLINK:
+    case SSH_FXP_STATUS:
+    case SSH_FXP_HANDLE:
+    case SSH_FXP_DATA:
+    case SSH_FXP_NAME:
+    case SSH_FXP_ATTRS:
+    case SSH_FXP_EXTENDED:
+    case SSH_FXP_EXTENDED_REPLY:
+        break;
+    default:
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "Out of sync with the world");
+    }
+
+    request_id = _libssh2_ntohu32(&data[1]);
+
+    /* Don't add the packet if it answers a request we've given up on. */
+    if((data[0] == SSH_FXP_STATUS || data[0] == SSH_FXP_DATA)
+        && find_zombie_request(sftp, request_id)) {
+
+        /* If we get here, the file ended before the response arrived. We
+        are no longer interested in the request so we discard it */
+
+        LIBSSH2_FREE(session, data);
+
+        remove_zombie_request(sftp, request_id);
+        return LIBSSH2_ERROR_NONE;
+    }
+
+    packet = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_SFTP_PACKET));
+    if (!packet) {
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate datablock for SFTP packet");
+    }
+
+    packet->data = data;
+    packet->data_len = data_len;
+    packet->request_id = request_id;
+
+    _libssh2_list_add(&sftp->packets, &packet->node);
+
+    return LIBSSH2_ERROR_NONE;
+}
+
+/*
+ * sftp_packet_read
+ *
+ * Frame an SFTP packet off the channel
+ */
+static int
+sftp_packet_read(LIBSSH2_SFTP *sftp)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    unsigned char *packet = NULL;
+    ssize_t rc;
+    unsigned long recv_window;
+    int packet_type;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "recv packet");
+
+    switch(sftp->packet_state) {
+    case libssh2_NB_state_sent: /* EAGAIN from window adjusting */
+        sftp->packet_state = libssh2_NB_state_idle;
+
+        packet = sftp->partial_packet;
+        goto window_adjust;
+
+    case libssh2_NB_state_sent1: /* EAGAIN from channel read */
+        sftp->packet_state = libssh2_NB_state_idle;
+
+        packet = sftp->partial_packet;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "partial read cont, len: %lu", sftp->partial_len);
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "partial read cont, already recvd: %lu",
+                       sftp->partial_received);
+        /* fall-through */
+    default:
+        if(!packet) {
+            /* only do this if there's not already a packet buffer allocated
+               to use */
+
+            /* each packet starts with a 32 bit length field */
+            rc = _libssh2_channel_read(channel, 0,
+                                       (char *)&sftp->partial_size[
+                                           sftp->partial_size_len],
+                                       4 - sftp->partial_size_len);
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+                return rc;
+            else if (rc < 0)
+                return _libssh2_error(session, rc, "channel read");
+
+            sftp->partial_size_len += rc;
+
+            if(4 != sftp->partial_size_len)
+                /* we got a short read for the length part */
+                return LIBSSH2_ERROR_EAGAIN;
+
+            sftp->partial_len = _libssh2_ntohu32(sftp->partial_size);
+            /* make sure we don't proceed if the packet size is unreasonably
+               large */
+            if (sftp->partial_len > LIBSSH2_SFTP_PACKET_MAXLEN)
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED,
+                                      "SFTP packet too large");
+
+            _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                           "Data begin - Packet Length: %lu",
+                           sftp->partial_len);
+            packet = LIBSSH2_ALLOC(session, sftp->partial_len);
+            if (!packet)
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate SFTP packet");
+            sftp->partial_size_len = 0;
+            sftp->partial_received = 0; /* how much of the packet already
+                                           received */
+            sftp->partial_packet = packet;
+
+    window_adjust:
+            recv_window = libssh2_channel_window_read_ex(channel, NULL, NULL);
+
+            if(sftp->partial_len > recv_window) {
+                /* ask for twice the data amount we need at once */
+                rc = _libssh2_channel_receive_window_adjust(channel,
+                                                            sftp->partial_len*2,
+                                                            1, NULL);
+                /* store the state so that we continue with the correct
+                   operation at next invoke */
+                sftp->packet_state = (rc == LIBSSH2_ERROR_EAGAIN)?
+                    libssh2_NB_state_sent:
+                    libssh2_NB_state_idle;
+
+                if(rc == LIBSSH2_ERROR_EAGAIN)
+                    return rc;
+            }
+        }
+
+        /* Read as much of the packet as we can */
+        while (sftp->partial_len > sftp->partial_received) {
+            rc = _libssh2_channel_read(channel, 0,
+                                       (char *)&packet[sftp->partial_received],
+                                       sftp->partial_len -
+                                       sftp->partial_received);
+
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                /*
+                 * We received EAGAIN, save what we have and return EAGAIN to
+                 * the caller. Set 'partial_packet' so that this function
+                 * knows how to continue on the next invoke.
+                 */
+                sftp->packet_state = libssh2_NB_state_sent1;
+                return rc;
+            }
+            else if (rc < 0) {
+                LIBSSH2_FREE(session, packet);
+                sftp->partial_packet = NULL;
+                return _libssh2_error(session, rc,
+                                      "Error waiting for SFTP packet");
+            }
+            sftp->partial_received += rc;
+        }
+
+        sftp->partial_packet = NULL;
+
+        /* sftp_packet_add takes ownership of the packet and might free it
+           so we take a copy of the packet type before we call it. */
+        packet_type = packet[0];
+        rc = sftp_packet_add(sftp, packet, sftp->partial_len);
+        if (rc) {
+            LIBSSH2_FREE(session, packet);
+            return rc;
+        }
+        else {
+            return packet_type;
+        }
+    }
+    /* WON'T REACH */
+}
+/*
+ * sftp_packetlist_flush
+ *
+ * Remove all pending packets in the packet_list and the corresponding one(s)
+ * in the SFTP packet brigade.
+ */
+static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
+{
+    struct sftp_pipeline_chunk *chunk;
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_SESSION *session = sftp->channel->session;
+
+    /* remove pending packets, if any */
+    chunk = _libssh2_list_first(&handle->packet_list);
+    while(chunk) {
+        unsigned char *data;
+        size_t data_len;
+        int rc;
+        struct sftp_pipeline_chunk *next = _libssh2_list_next(&chunk->node);
+
+        rc = sftp_packet_ask(sftp, SSH_FXP_STATUS,
+                             chunk->request_id, &data, &data_len);
+        if(rc)
+            rc = sftp_packet_ask(sftp, SSH_FXP_DATA,
+                                 chunk->request_id, &data, &data_len);
+
+        if(!rc)
+            /* we found a packet, free it */
+            LIBSSH2_FREE(session, data);
+        else if(chunk->sent)
+            /* there was no incoming packet for this request, mark this
+               request as a zombie if it ever sent the request */
+            add_zombie_request(sftp, chunk->request_id);
+
+        _libssh2_list_remove(&chunk->node);
+        LIBSSH2_FREE(session, chunk);
+        chunk = next;
+    }
+}
+
+
+/*
+ * sftp_packet_ask()
+ *
+ * Checks if there's a matching SFTP packet available.
+ */
+static int
+sftp_packet_ask(LIBSSH2_SFTP *sftp, unsigned char packet_type,
+                uint32_t request_id, unsigned char **data,
+                size_t *data_len)
+{
+    LIBSSH2_SESSION *session = sftp->channel->session;
+    LIBSSH2_SFTP_PACKET *packet = _libssh2_list_first(&sftp->packets);
+
+    if(!packet)
+        return -1;
+
+    /* Special consideration when getting VERSION packet */
+
+    while (packet) {
+        if((packet->data[0] == packet_type) &&
+           ((packet_type == SSH_FXP_VERSION) ||
+            (packet->request_id == request_id))) {
+
+            /* Match! Fetch the data */
+            *data = packet->data;
+            *data_len = packet->data_len;
+
+            /* unlink and free this struct */
+            _libssh2_list_remove(&packet->node);
+            LIBSSH2_FREE(session, packet);
+
+            return 0;
+        }
+        /* check next struct in the list */
+        packet = _libssh2_list_next(&packet->node);
+    }
+    return -1;
+}
+
+/* sftp_packet_require
+ * A la libssh2_packet_require
+ */
+static int
+sftp_packet_require(LIBSSH2_SFTP *sftp, unsigned char packet_type,
+                    uint32_t request_id, unsigned char **data,
+                    size_t *data_len)
+{
+    LIBSSH2_SESSION *session = sftp->channel->session;
+    int rc;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Requiring packet %d id %ld",
+                   (int) packet_type, request_id);
+
+    if (sftp_packet_ask(sftp, packet_type, request_id, data, data_len) == 0) {
+        /* The right packet was available in the packet brigade */
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Got %d",
+                       (int) packet_type);
+        return LIBSSH2_ERROR_NONE;
+    }
+
+    while (session->socket_state == LIBSSH2_SOCKET_CONNECTED) {
+        rc = sftp_packet_read(sftp);
+        if (rc < 0)
+            return rc;
+
+        /* data was read, check the queue again */
+        if (!sftp_packet_ask(sftp, packet_type, request_id, data, data_len)) {
+            /* The right packet was available in the packet brigade */
+            _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Got %d",
+                           (int) packet_type);
+            return LIBSSH2_ERROR_NONE;
+        }
+    }
+
+    /* Only reached if the socket died */
+    return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+}
+
+/* sftp_packet_requirev
+ * Require one of N possible reponses
+ */
+static int
+sftp_packet_requirev(LIBSSH2_SFTP *sftp, int num_valid_responses,
+                     const unsigned char *valid_responses,
+                     uint32_t request_id, unsigned char **data,
+                     size_t *data_len)
+{
+    int i;
+    int rc;
+
+    /* If no timeout is active, start a new one */
+    if (sftp->requirev_start == 0)
+        sftp->requirev_start = time(NULL);
+
+    while (sftp->channel->session->socket_state == LIBSSH2_SOCKET_CONNECTED) {
+        for(i = 0; i < num_valid_responses; i++) {
+            if (sftp_packet_ask(sftp, valid_responses[i], request_id,
+                                data, data_len) == 0) {
+                /*
+                 * Set to zero before all returns to say
+                 * the timeout is not active
+                 */
+                sftp->requirev_start = 0;
+                return LIBSSH2_ERROR_NONE;
+            }
+        }
+
+        rc = sftp_packet_read(sftp);
+        if ((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN)) {
+            sftp->requirev_start = 0;
+            return rc;
+        } else if (rc <= 0) {
+            /* prevent busy-looping */
+            long left =
+                LIBSSH2_READ_TIMEOUT - (long)(time(NULL) - sftp->requirev_start);
+
+            if (left <= 0) {
+                sftp->requirev_start = 0;
+                return LIBSSH2_ERROR_TIMEOUT;
+            }
+            else if (rc == LIBSSH2_ERROR_EAGAIN) {
+                return rc;
+            }
+        }
+    }
+
+    sftp->requirev_start = 0;
+
+    /* Only reached if the socket died */
+    return LIBSSH2_ERROR_SOCKET_DISCONNECT;
+}
+
+/* sftp_attr2bin
+ * Populate attributes into an SFTP block
+ */
+static ssize_t
+sftp_attr2bin(unsigned char *p, const LIBSSH2_SFTP_ATTRIBUTES * attrs)
+{
+    unsigned char *s = p;
+    uint32_t flag_mask =
+        LIBSSH2_SFTP_ATTR_SIZE | LIBSSH2_SFTP_ATTR_UIDGID |
+        LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME;
+
+    /* TODO: When we add SFTP4+ functionality flag_mask can get additional
+       bits */
+
+    if (!attrs) {
+        _libssh2_htonu32(s, 0);
+        return 4;
+    }
+
+    _libssh2_store_u32(&s, attrs->flags & flag_mask);
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_SIZE) {
+        _libssh2_store_u64(&s, attrs->filesize);
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_UIDGID) {
+        _libssh2_store_u32(&s, attrs->uid);
+        _libssh2_store_u32(&s, attrs->gid);
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) {
+        _libssh2_store_u32(&s, attrs->permissions);
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_ACMODTIME) {
+        _libssh2_store_u32(&s, attrs->atime);
+        _libssh2_store_u32(&s, attrs->mtime);
+    }
+
+    return (s - p);
+}
+
+/* sftp_bin2attr
+ */
+static int
+sftp_bin2attr(LIBSSH2_SFTP_ATTRIBUTES * attrs, const unsigned char *p)
+{
+    const unsigned char *s = p;
+
+    memset(attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
+    attrs->flags = _libssh2_ntohu32(s);
+    s += 4;
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_SIZE) {
+        attrs->filesize = _libssh2_ntohu64(s);
+        s += 8;
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_UIDGID) {
+        attrs->uid = _libssh2_ntohu32(s);
+        s += 4;
+        attrs->gid = _libssh2_ntohu32(s);
+        s += 4;
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) {
+        attrs->permissions = _libssh2_ntohu32(s);
+        s += 4;
+    }
+
+    if (attrs->flags & LIBSSH2_SFTP_ATTR_ACMODTIME) {
+        attrs->atime = _libssh2_ntohu32(s);
+        s += 4;
+        attrs->mtime = _libssh2_ntohu32(s);
+        s += 4;
+    }
+
+    return (s - p);
+}
+
+/* ************
+ * SFTP API *
+ ************ */
+
+LIBSSH2_CHANNEL_CLOSE_FUNC(libssh2_sftp_dtor);
+
+/* libssh2_sftp_dtor
+ * Shutdown an SFTP stream when the channel closes
+ */
+LIBSSH2_CHANNEL_CLOSE_FUNC(libssh2_sftp_dtor)
+{
+    LIBSSH2_SFTP *sftp = (LIBSSH2_SFTP *) (*channel_abstract);
+
+    (void) session_abstract;
+    (void) channel;
+
+    /* Free the partial packet storage for sftp_packet_read */
+    if (sftp->partial_packet) {
+        LIBSSH2_FREE(session, sftp->partial_packet);
+    }
+
+    /* Free the packet storage for _libssh2_sftp_packet_readdir */
+    if (sftp->readdir_packet) {
+        LIBSSH2_FREE(session, sftp->readdir_packet);
+    }
+
+    LIBSSH2_FREE(session, sftp);
+}
+
+/*
+ * sftp_init
+ *
+ * Startup an SFTP session
+ */
+static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session)
+{
+    unsigned char *data, *s;
+    size_t data_len;
+    ssize_t rc;
+    LIBSSH2_SFTP *sftp_handle;
+
+    if (session->sftpInit_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Initializing SFTP subsystem");
+
+        /*
+         * The 'sftpInit_sftp' and 'sftpInit_channel' struct fields within the
+         * session struct are only to be used during the setup phase. As soon
+         * as the SFTP session is created they are cleared and can thus be
+         * re-used again to allow any amount of SFTP handles per sessions.
+         *
+         * Note that you MUST NOT try to call libssh2_sftp_init() again to get
+         * another handle until the previous call has finished and either
+         * succesffully made a handle or failed and returned error (not
+         * including *EAGAIN).
+         */
+
+        assert(session->sftpInit_sftp == NULL);
+        session->sftpInit_sftp = NULL;
+        session->sftpInit_state = libssh2_NB_state_created;
+    }
+
+    sftp_handle = session->sftpInit_sftp;
+
+    if (session->sftpInit_state == libssh2_NB_state_created) {
+        session->sftpInit_channel =
+            _libssh2_channel_open(session, "session", sizeof("session") - 1,
+                                  LIBSSH2_CHANNEL_WINDOW_DEFAULT,
+                                  LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0);
+        if (!session->sftpInit_channel) {
+            if (libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN) {
+                _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                               "Would block starting up channel");
+            }
+            else {
+                _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE,
+                               "Unable to startup channel");
+                session->sftpInit_state = libssh2_NB_state_idle;
+            }
+            return NULL;
+        }
+
+        session->sftpInit_state = libssh2_NB_state_sent;
+    }
+
+    if (session->sftpInit_state == libssh2_NB_state_sent) {
+        int ret = _libssh2_channel_process_startup(session->sftpInit_channel,
+                                                   "subsystem",
+                                                   sizeof("subsystem") - 1, "sftp",
+                                                   strlen("sftp"));
+        if (ret == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block to request SFTP subsystem");
+            return NULL;
+        } else if (ret) {
+            _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE,
+                           "Unable to request SFTP subsystem");
+            goto sftp_init_error;
+        }
+
+        session->sftpInit_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->sftpInit_state == libssh2_NB_state_sent1) {
+        rc = _libssh2_channel_extended_data(session->sftpInit_channel,
+                                            LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block requesting handle extended data");
+            return NULL;
+        }
+
+        sftp_handle =
+            session->sftpInit_sftp =
+            LIBSSH2_ALLOC(session, sizeof(LIBSSH2_SFTP));
+        if (!sftp_handle) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate a new SFTP structure");
+            goto sftp_init_error;
+        }
+        memset(sftp_handle, 0, sizeof(LIBSSH2_SFTP));
+        sftp_handle->channel = session->sftpInit_channel;
+        sftp_handle->request_id = 0;
+
+        _libssh2_htonu32(session->sftpInit_buffer, 5);
+        session->sftpInit_buffer[4] = SSH_FXP_INIT;
+        _libssh2_htonu32(session->sftpInit_buffer + 5, LIBSSH2_SFTP_VERSION);
+        session->sftpInit_sent = 0; /* nothing's sent yet */
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Sending FXP_INIT packet advertising version %d support",
+                       (int) LIBSSH2_SFTP_VERSION);
+
+        session->sftpInit_state = libssh2_NB_state_sent2;
+    }
+
+    if (session->sftpInit_state == libssh2_NB_state_sent2) {
+        /* sent off what's left of the init buffer to send */
+        rc = _libssh2_channel_write(session->sftpInit_channel, 0,
+                                    session->sftpInit_buffer +
+                                    session->sftpInit_sent,
+                                    9 - session->sftpInit_sent);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block sending SSH_FXP_INIT");
+            return NULL;
+        }
+        else if(rc < 0) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send SSH_FXP_INIT");
+            goto sftp_init_error;
+        }
+        else {
+            /* add up the number of bytes sent */
+            session->sftpInit_sent += rc;
+
+            if(session->sftpInit_sent == 9)
+                /* move on */
+                session->sftpInit_state = libssh2_NB_state_sent3;
+
+            /* if less than 9, we remain in this state to send more later on */
+        }
+    }
+
+    rc = sftp_packet_require(sftp_handle, SSH_FXP_VERSION,
+                             0, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN)
+        return NULL;
+    else if (rc) {
+        _libssh2_error(session, rc,
+                       "Timeout waiting for response from SFTP subsystem");
+        goto sftp_init_error;
+    }
+    if (data_len < 5) {
+        _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                       "Invalid SSH_FXP_VERSION response");
+        goto sftp_init_error;
+    }
+
+    s = data + 1;
+    sftp_handle->version = _libssh2_ntohu32(s);
+    s += 4;
+    if (sftp_handle->version > LIBSSH2_SFTP_VERSION) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Truncating remote SFTP version from %lu",
+                       sftp_handle->version);
+        sftp_handle->version = LIBSSH2_SFTP_VERSION;
+    }
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                   "Enabling SFTP version %lu compatability",
+                   sftp_handle->version);
+    while (s < (data + data_len)) {
+        size_t extname_len, extdata_len;
+
+        extname_len = _libssh2_ntohu32(s);
+        s += 4;
+        /* the extension name starts here */
+        s += extname_len;
+
+        extdata_len = _libssh2_ntohu32(s);
+        s += 4;
+
+        /* TODO: Actually process extensions */
+        s += extdata_len;
+
+    }
+    LIBSSH2_FREE(session, data);
+
+    /* Make sure that when the channel gets closed, the SFTP service is shut
+       down too */
+    sftp_handle->channel->abstract = sftp_handle;
+    sftp_handle->channel->close_cb = libssh2_sftp_dtor;
+
+    session->sftpInit_state = libssh2_NB_state_idle;
+
+    /* clear the sftp and channel pointers in this session struct now */
+    session->sftpInit_sftp = NULL;
+    session->sftpInit_channel = NULL;
+
+    _libssh2_list_init(&sftp_handle->sftp_handles);
+
+    return sftp_handle;
+
+  sftp_init_error:
+    while (_libssh2_channel_free(session->sftpInit_channel) ==
+           LIBSSH2_ERROR_EAGAIN);
+    session->sftpInit_channel = NULL;
+    if (session->sftpInit_sftp) {
+        LIBSSH2_FREE(session, session->sftpInit_sftp);
+        session->sftpInit_sftp = NULL;
+    }
+    session->sftpInit_state = libssh2_NB_state_idle;
+    return NULL;
+}
+
+/*
+ * libssh2_sftp_init
+ *
+ * Startup an SFTP session
+ */
+LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session)
+{
+    LIBSSH2_SFTP *ptr;
+
+    if(!session)
+        return NULL;
+
+    if(!(session->state & LIBSSH2_STATE_AUTHENTICATED)) {
+        _libssh2_error(session, LIBSSH2_ERROR_INVAL,
+                       "session not authenticated yet");
+        return NULL;
+    }
+
+    BLOCK_ADJUST_ERRNO(ptr, session, sftp_init(session));
+    return ptr;
+}
+
+/*
+ * sftp_shutdown
+ *
+ * Shutsdown the SFTP subsystem
+ */
+static int
+sftp_shutdown(LIBSSH2_SFTP *sftp)
+{
+    int rc;
+    LIBSSH2_SESSION *session = sftp->channel->session;
+    /*
+     * Make sure all memory used in the state variables are free
+     */
+    if (sftp->partial_packet) {
+        LIBSSH2_FREE(session, sftp->partial_packet);
+        sftp->partial_packet = NULL;
+    }
+    if (sftp->open_packet) {
+        LIBSSH2_FREE(session, sftp->open_packet);
+        sftp->open_packet = NULL;
+    }
+    if (sftp->readdir_packet) {
+        LIBSSH2_FREE(session, sftp->readdir_packet);
+        sftp->readdir_packet = NULL;
+    }
+    if (sftp->fstat_packet) {
+        LIBSSH2_FREE(session, sftp->fstat_packet);
+        sftp->fstat_packet = NULL;
+    }
+    if (sftp->unlink_packet) {
+        LIBSSH2_FREE(session, sftp->unlink_packet);
+        sftp->unlink_packet = NULL;
+    }
+    if (sftp->rename_packet) {
+        LIBSSH2_FREE(session, sftp->rename_packet);
+        sftp->rename_packet = NULL;
+    }
+    if (sftp->fstatvfs_packet) {
+        LIBSSH2_FREE(session, sftp->fstatvfs_packet);
+        sftp->fstatvfs_packet = NULL;
+    }
+    if (sftp->statvfs_packet) {
+        LIBSSH2_FREE(session, sftp->statvfs_packet);
+        sftp->statvfs_packet = NULL;
+    }
+    if (sftp->mkdir_packet) {
+        LIBSSH2_FREE(session, sftp->mkdir_packet);
+        sftp->mkdir_packet = NULL;
+    }
+    if (sftp->rmdir_packet) {
+        LIBSSH2_FREE(session, sftp->rmdir_packet);
+        sftp->rmdir_packet = NULL;
+    }
+    if (sftp->stat_packet) {
+        LIBSSH2_FREE(session, sftp->stat_packet);
+        sftp->stat_packet = NULL;
+    }
+    if (sftp->symlink_packet) {
+        LIBSSH2_FREE(session, sftp->symlink_packet);
+        sftp->symlink_packet = NULL;
+    }
+
+    sftp_packet_flush(sftp);
+
+    /* TODO: We should consider walking over the sftp_handles list and kill
+     * any remaining sftp handles ... */
+
+    rc = _libssh2_channel_free(sftp->channel);
+
+    return rc;
+}
+
+/* libssh2_sftp_shutdown
+ * Shutsdown the SFTP subsystem
+ */
+LIBSSH2_API int
+libssh2_sftp_shutdown(LIBSSH2_SFTP *sftp)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session, sftp_shutdown(sftp));
+    return rc;
+}
+
+/* *******************************
+ * SFTP File and Directory Ops *
+ ******************************* */
+
+/* sftp_open
+ */
+static LIBSSH2_SFTP_HANDLE *
+sftp_open(LIBSSH2_SFTP *sftp, const char *filename,
+          size_t filename_len, uint32_t flags, long mode,
+          int open_type)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    LIBSSH2_SFTP_HANDLE *fp;
+    LIBSSH2_SFTP_ATTRIBUTES attrs = {
+        LIBSSH2_SFTP_ATTR_PERMISSIONS, 0, 0, 0, 0, 0, 0
+    };
+    unsigned char *s;
+    ssize_t rc;
+    int open_file = (open_type == LIBSSH2_SFTP_OPENFILE)?1:0;
+
+    if (sftp->open_state == libssh2_NB_state_idle) {
+        /* packet_len(4) + packet_type(1) + request_id(4) + filename_len(4) +
+           flags(4) */
+        sftp->open_packet_len = filename_len + 13 +
+            (open_file? (4 + sftp_attrsize(LIBSSH2_SFTP_ATTR_PERMISSIONS)) : 0);
+
+        /* surprise! this starts out with nothing sent */
+        sftp->open_packet_sent = 0;
+        s = sftp->open_packet = LIBSSH2_ALLOC(session, sftp->open_packet_len);
+        if (!sftp->open_packet) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memory for FXP_OPEN or "
+                           "FXP_OPENDIR packet");
+            return NULL;
+        }
+        /* Filetype in SFTP 3 and earlier */
+        attrs.permissions = mode |
+            (open_file ? LIBSSH2_SFTP_ATTR_PFILETYPE_FILE :
+             LIBSSH2_SFTP_ATTR_PFILETYPE_DIR);
+
+        _libssh2_store_u32(&s, sftp->open_packet_len - 4);
+        *(s++) = open_file? SSH_FXP_OPEN : SSH_FXP_OPENDIR;
+        sftp->open_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->open_request_id);
+        _libssh2_store_str(&s, filename, filename_len);
+
+        if (open_file) {
+            _libssh2_store_u32(&s, flags);
+            s += sftp_attr2bin(s, &attrs);
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Sending %s open request",
+                       open_file? "file" : "directory");
+
+        sftp->open_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->open_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->open_packet+
+                                    sftp->open_packet_sent,
+                                    sftp->open_packet_len -
+                                    sftp->open_packet_sent);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block sending FXP_OPEN or FXP_OPENDIR command");
+            return NULL;
+        }
+        else if(rc < 0) {
+            _libssh2_error(session, rc, "Unable to send FXP_OPEN*");
+            LIBSSH2_FREE(session, sftp->open_packet);
+            sftp->open_packet = NULL;
+            sftp->open_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+
+        /* bump the sent counter and remain in this state until the whole
+           data is off */
+        sftp->open_packet_sent += rc;
+
+        if(sftp->open_packet_len == sftp->open_packet_sent) {
+            LIBSSH2_FREE(session, sftp->open_packet);
+            sftp->open_packet = NULL;
+
+            sftp->open_state = libssh2_NB_state_sent;
+        }
+    }
+
+    if (sftp->open_state == libssh2_NB_state_sent) {
+        size_t data_len;
+        unsigned char *data;
+        static const unsigned char fopen_responses[2] =
+            { SSH_FXP_HANDLE, SSH_FXP_STATUS };
+        rc = sftp_packet_requirev(sftp, 2, fopen_responses,
+                                  sftp->open_request_id, &data,
+                                  &data_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block waiting for status message");
+            return NULL;
+        }
+        sftp->open_state = libssh2_NB_state_idle;
+        if (rc) {
+            _libssh2_error(session, rc, "Timeout waiting for status message");
+            return NULL;
+        }
+
+        /* OPEN can basically get STATUS or HANDLE back, where HANDLE implies
+           a fine response while STATUS means error. It seems though that at
+           times we get an SSH_FX_OK back in a STATUS, followed the "real"
+           HANDLE so we need to properly deal with that. */
+        if (data[0] == SSH_FXP_STATUS) {
+            int badness = 1;
+
+            if(data_len < 9) {
+                _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                               "Too small FXP_STATUS");
+                LIBSSH2_FREE(session, data);
+                return NULL;
+            }
+
+            sftp->last_errno = _libssh2_ntohu32(data + 5);
+
+            if(LIBSSH2_FX_OK == sftp->last_errno) {
+                _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "got HANDLE FXOK!");
+
+                LIBSSH2_FREE(session, data);
+
+                /* silly situation, but check for a HANDLE */
+                rc = sftp_packet_require(sftp, SSH_FXP_HANDLE,
+                                         sftp->open_request_id, &data,
+                                         &data_len);
+                if(rc == LIBSSH2_ERROR_EAGAIN) {
+                    /* go back to sent state and wait for something else */
+                    sftp->open_state = libssh2_NB_state_sent;
+                    return NULL;
+                }
+                else if(!rc)
+                    /* we got the handle so this is not a bad situation */
+                    badness = 0;
+            }
+
+            if(badness) {
+                _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                               "Failed opening remote file");
+                _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "got FXP_STATUS %d",
+                               sftp->last_errno);
+                LIBSSH2_FREE(session, data);
+                return NULL;
+            }
+        }
+
+        if(data_len < 10) {
+            _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                           "Too small FXP_HANDLE");
+            LIBSSH2_FREE(session, data);
+            return NULL;
+        }
+
+        fp = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_SFTP_HANDLE));
+        if (!fp) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate new SFTP handle structure");
+            LIBSSH2_FREE(session, data);
+            return NULL;
+        }
+        memset(fp, 0, sizeof(LIBSSH2_SFTP_HANDLE));
+        fp->handle_type = open_file ? LIBSSH2_SFTP_HANDLE_FILE :
+            LIBSSH2_SFTP_HANDLE_DIR;
+
+        fp->handle_len = _libssh2_ntohu32(data + 5);
+        if (fp->handle_len > SFTP_HANDLE_MAXLEN)
+            /* SFTP doesn't allow handles longer than 256 characters */
+            fp->handle_len = SFTP_HANDLE_MAXLEN;
+
+        if(fp->handle_len > (data_len - 9))
+            /* do not reach beyond the end of the data we got */
+            fp->handle_len = data_len - 9;
+
+        memcpy(fp->handle, data + 9, fp->handle_len);
+
+        LIBSSH2_FREE(session, data);
+
+        /* add this file handle to the list kept in the sftp session */
+        _libssh2_list_add(&sftp->sftp_handles, &fp->node);
+
+        fp->sftp = sftp; /* point to the parent struct */
+
+        fp->u.file.offset = 0;
+        fp->u.file.offset_sent = 0;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Open command successful");
+        return fp;
+    }
+    return NULL;
+}
+
+/* libssh2_sftp_open_ex
+ */
+LIBSSH2_API LIBSSH2_SFTP_HANDLE *
+libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename,
+                     unsigned int filename_len, unsigned long flags, long mode,
+                     int open_type)
+{
+    LIBSSH2_SFTP_HANDLE *hnd;
+
+    if(!sftp)
+        return NULL;
+
+    BLOCK_ADJUST_ERRNO(hnd, sftp->channel->session,
+                       sftp_open(sftp, filename, filename_len, flags, mode,
+                                 open_type));
+    return hnd;
+}
+
+/*
+ * sftp_read
+ *
+ * Read from an SFTP file handle
+ *
+ */
+static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer,
+                         size_t buffer_size)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t count = 0;
+    struct sftp_pipeline_chunk *chunk;
+    struct sftp_pipeline_chunk *next;
+    ssize_t rc;
+    struct _libssh2_sftp_handle_file_data *filep =
+        &handle->u.file;
+
+    /* This function can be interrupted in three different places where it
+       might need to wait for data from the network.  It returns EAGAIN to
+       allow non-blocking clients to do other work but these client are
+       expected to call this function again (possibly many times) to finish
+       the operation.
+
+       The tricky part is that if we previously aborted a sftp_read due to
+       EAGAIN, we must continue at the same spot to continue the previously
+       interrupted operation.  This is done using a state machine to record
+       what phase of execution we were at.  The state is stored in
+       sftp->read_state.
+
+       libssh2_NB_state_idle: The first phase is where we prepare multiple
+       FXP_READ packets to do optimistic read-ahead.  We send off as many as
+       possible in the second phase without waiting for a response to each
+       one; this is the key to fast reads. But we may have to adjust the
+       channel window size to do this which may interrupt this function while
+       waiting.  The state machine saves the phase as libssh2_NB_state_idle so
+       it returns here on the next call.
+
+       libssh2_NB_state_sent: The second phase is where we send the FXP_READ
+       packets.  Writing them to the channel can be interrupted with EAGAIN
+       but the state machine ensures we skip the first phase on the next call
+       and resume sending.
+
+       libssh2_NB_state_sent2: In the third phase (indicated by ) we read the
+       data from the responses that have arrived so far.  Reading can be
+       interrupted with EAGAIN but the state machine ensures we skip the first
+       and second phases on the next call and resume sending.
+    */
+
+    switch (sftp->read_state) {
+    case libssh2_NB_state_idle:
+
+        /* Some data may already have been read from the server in the
+           previous call but didn't fit in the buffer at the time.  If so, we
+           return that now as we can't risk being interrupted later with data
+           partially written to the buffer. */
+        if(filep->data_left) {
+            size_t copy = MIN(buffer_size, filep->data_left);
+
+            memcpy(buffer, &filep->data[ filep->data_len - filep->data_left],
+                   copy);
+
+            filep->data_left -= copy;
+            filep->offset += copy;
+
+            if(!filep->data_left) {
+                LIBSSH2_FREE(session, filep->data);
+                filep->data = NULL;
+            }
+
+            return copy;
+        }
+
+        /* We allow a number of bytes being requested at any given time
+           without having been acked - until we reach EOF. */
+        if(!filep->eof) {
+            /* Number of bytes asked for that haven't been acked yet */
+            size_t already = (filep->offset_sent - filep->offset);
+
+            size_t max_read_ahead = buffer_size*4;
+            unsigned long recv_window;
+
+            if(max_read_ahead > LIBSSH2_CHANNEL_WINDOW_DEFAULT*4)
+                max_read_ahead = LIBSSH2_CHANNEL_WINDOW_DEFAULT*4;
+
+            /* if the buffer_size passed in now is smaller than what has
+               already been sent, we risk getting count become a very large
+               number */
+            if(max_read_ahead > already)
+                count = max_read_ahead - already;
+
+            /* 'count' is how much more data to ask for, and 'already' is how
+               much data that already has been asked for but not yet returned.
+               Specificly, 'count' means how much data that have or will be
+               asked for by the nodes that are already added to the linked
+               list. Some of those read requests may not actually have been
+               sent off successfully yet.
+
+               If 'already' is very large it should be perfectly fine to have
+               count set to 0 as then we don't have to ask for more data
+               (right now).
+
+               buffer_size*4 is just picked more or less out of the air. The
+               idea is that when reading SFTP from a remote server, we send
+               away multiple read requests guessing that the client will read
+               more than only this 'buffer_size' amount of memory. So we ask
+               for maximum buffer_size*4 amount of data so that we can return
+               them very fast in subsequent calls.
+            */
+
+            recv_window = libssh2_channel_window_read_ex(sftp->channel,
+                                                         NULL, NULL);
+            if(max_read_ahead > recv_window) {
+                /* more data will be asked for than what the window currently
+                   allows, expand it! */
+
+                rc = _libssh2_channel_receive_window_adjust(sftp->channel,
+                                                            max_read_ahead*8,
+                                                            1, NULL);
+                /* if this returns EAGAIN, we will get back to this function
+                   at next call */
+                assert(rc != LIBSSH2_ERROR_EAGAIN || !filep->data_left);
+                assert(rc != LIBSSH2_ERROR_EAGAIN || !filep->eof);
+                if (rc)
+                    return rc;
+            }
+        }
+
+        while(count > 0) {
+            unsigned char *s;
+            uint32_t size = MIN(MAX_SFTP_READ_SIZE, count);
+
+            /* 25 = packet_len(4) + packet_type(1) + request_id(4) +
+               handle_len(4) + offset(8) + count(4) */
+            uint32_t packet_len = (uint32_t)handle->handle_len + 25;
+            uint32_t request_id;
+
+            chunk = LIBSSH2_ALLOC(session, packet_len +
+                                  sizeof(struct sftp_pipeline_chunk));
+            if (!chunk)
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                      "malloc fail for FXP_WRITE");
+
+            chunk->len = size;
+            chunk->lefttosend = packet_len;
+            chunk->sent = 0;
+
+            s = chunk->packet;
+
+            _libssh2_store_u32(&s, packet_len - 4);
+            *s++ = SSH_FXP_READ;
+            request_id = sftp->request_id++;
+            chunk->request_id = request_id;
+            _libssh2_store_u32(&s, request_id);
+            _libssh2_store_str(&s, handle->handle, handle->handle_len);
+            _libssh2_store_u64(&s, filep->offset_sent);
+            filep->offset_sent += size; /* advance offset at once */
+            _libssh2_store_u32(&s, size);
+
+            /* add this new entry LAST in the list */
+            _libssh2_list_add(&handle->packet_list, &chunk->node);
+            count -= size; /* deduct the size we used, as we might have
+                              to create more packets */
+        }
+
+    case libssh2_NB_state_sent:
+
+        sftp->read_state = libssh2_NB_state_idle;
+
+        /* move through the READ packets that haven't been sent and send as
+           many as possible - remember that we don't block */
+        chunk = _libssh2_list_first(&handle->packet_list);
+
+        while(chunk) {
+            if(chunk->lefttosend) {
+
+                rc = _libssh2_channel_write(channel, 0,
+                                            &chunk->packet[chunk->sent],
+                                            chunk->lefttosend);
+                if(rc < 0) {
+                    sftp->read_state = libssh2_NB_state_sent;
+                    return rc;
+                }
+
+                /* remember where to continue sending the next time */
+                chunk->lefttosend -= rc;
+                chunk->sent += rc;
+
+                if(chunk->lefttosend)
+                    /* data left to send, get out of loop */
+                    break;
+            }
+
+            /* move on to the next chunk with data to send */
+            chunk = _libssh2_list_next(&chunk->node);
+        }
+
+    case libssh2_NB_state_sent2:
+
+        sftp->read_state = libssh2_NB_state_idle;
+
+        /*
+         * Count all ACKed packets and act on the contents of them.
+         */
+        chunk = _libssh2_list_first(&handle->packet_list);
+
+        while(chunk) {
+            unsigned char *data;
+            size_t data_len;
+            uint32_t rc32;
+            static const unsigned char read_responses[2] = {
+                SSH_FXP_DATA, SSH_FXP_STATUS
+            };
+
+            if(chunk->lefttosend)
+                /* if the chunk still has data left to send, we shouldn't wait
+                   for an ACK for it just yet */
+                break;
+
+            rc = sftp_packet_requirev(sftp, 2, read_responses,
+                                      chunk->request_id, &data, &data_len);
+            if (rc < 0) {
+                sftp->read_state = libssh2_NB_state_sent2;
+                return rc;
+            }
+
+            /*
+             * We get DATA or STATUS back. STATUS can be error, or it is
+             * FX_EOF when we reach the end of the file.
+             */
+
+            switch (data[0]) {
+            case SSH_FXP_STATUS:
+                /* remove the chunk we just processed */
+
+                _libssh2_list_remove(&chunk->node);
+                LIBSSH2_FREE(session, chunk);
+
+                /* we must remove all outstanding READ requests, as either we
+                   got an error or we're at end of file */
+                sftp_packetlist_flush(handle);
+
+                rc32 = _libssh2_ntohu32(data + 5);
+                LIBSSH2_FREE(session, data);
+
+                if (rc32 == LIBSSH2_FX_EOF) {
+                    filep->eof = TRUE;
+                    return 0;
+                }
+                else {
+                    sftp->last_errno = rc32;
+                    return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                          "SFTP READ error");
+                }
+                break;
+
+            case SSH_FXP_DATA:
+                rc32 = _libssh2_ntohu32(data + 5);
+                if (rc32 > (data_len - 9))
+                    return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                          "SFTP Protocol badness");
+
+                if(rc32 > chunk->len) {
+                    /* A chunk larger than we requested was returned to us.
+                       This is a protocol violation and we don't know how to
+                       deal with it. Bail out! */
+                    return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                          "FXP_READ response too big");
+                }
+
+                if(rc32 != chunk->len) {
+                    /* a short read does not imply end of file, but we must
+                       adjust the offset_sent since it was advanced with a
+                       full chunk->len before */
+                    filep->offset_sent -= (chunk->len - rc32);
+                }
+
+                if(rc32 > buffer_size) {
+                    /* figure out the overlap amount */
+                    filep->data_left = rc32 - buffer_size;
+
+                    /* getting the full packet would overflow the buffer, so
+                       only get the correct amount and keep the remainder */
+                    rc32 = (uint32_t)buffer_size;
+
+                    /* store data to keep for next call */
+                    filep->data = data;
+                    filep->data_len = data_len;
+                }
+                else
+                    filep->data_len = 0;
+
+                /* copy the received data from the received FXP_DATA packet to
+                   the buffer at the correct index */
+                memcpy(buffer, data + 9, rc32);
+                filep->offset += rc32;
+
+                if(filep->data_len == 0)
+                    /* free the allocated data if not stored to keep */
+                    LIBSSH2_FREE(session, data);
+
+
+                /* remove the chunk we just processed keeping track of the
+                 * next one in case we need it */
+                next = _libssh2_list_next(&chunk->node);
+                _libssh2_list_remove(&chunk->node);
+                LIBSSH2_FREE(session, chunk);
+                chunk = NULL;
+
+                if(rc32 > 0) {
+                    /* we must return as we wrote some data to the buffer */
+                    return rc32;
+                } else {
+                    /* A zero-byte read is not necessarily EOF so we must not
+                     * return 0 (that would signal EOF to the caller) so
+                     * instead we carry on to the next chunk */
+                    chunk = next;
+                }
+
+                break;
+            default:
+                return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                      "SFTP Protocol badness: unrecognised "
+                                      "read request response");
+            }
+        }
+
+        break;
+
+    default:
+        assert(!"State machine error; unrecognised read state");
+    }
+
+    return 0;
+}
+
+/* libssh2_sftp_read
+ * Read from an SFTP file handle
+ */
+LIBSSH2_API ssize_t
+libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *hnd, char *buffer,
+                  size_t buffer_maxlen)
+{
+    ssize_t rc;
+    if(!hnd)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session,
+                 sftp_read(hnd, buffer, buffer_maxlen));
+    return rc;
+}
+
+/* sftp_readdir
+ * Read from an SFTP directory handle
+ */
+static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
+                            size_t buffer_maxlen, char *longentry,
+                            size_t longentry_maxlen,
+                            LIBSSH2_SFTP_ATTRIBUTES *attrs)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    uint32_t num_names;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
+    uint32_t packet_len = handle->handle_len + 13;
+    unsigned char *s, *data;
+    static const unsigned char read_responses[2] = {
+        SSH_FXP_NAME, SSH_FXP_STATUS };
+    ssize_t retcode;
+
+    if (sftp->readdir_state == libssh2_NB_state_idle) {
+        if (handle->u.dir.names_left) {
+            /*
+             * A prior request returned more than one directory entry,
+             * feed it back from the buffer
+             */
+            LIBSSH2_SFTP_ATTRIBUTES attrs_dummy;
+            size_t real_longentry_len;
+            size_t real_filename_len;
+            size_t filename_len;
+            size_t longentry_len;
+
+            s = (unsigned char *) handle->u.dir.next_name;
+            real_filename_len = _libssh2_ntohu32(s);
+
+            s += 4;
+
+            filename_len = real_filename_len;
+            if (filename_len >= buffer_maxlen) {
+                filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL;
+                goto end;
+            }
+
+            memcpy(buffer, s, filename_len);
+            buffer[filename_len] = '\0';           /* zero terminate */
+            s += real_filename_len;
+
+            real_longentry_len = _libssh2_ntohu32(s);
+            s += 4;
+
+            if (longentry && (longentry_maxlen>1)) {
+                longentry_len = real_longentry_len;
+
+                if (longentry_len >= longentry_maxlen) {
+                    filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL;
+                    goto end;
+                }
+
+                memcpy(longentry, s, longentry_len);
+                longentry[longentry_len] = '\0'; /* zero terminate */
+            }
+            s += real_longentry_len;
+
+            if (attrs)
+                memset(attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
+
+            s += sftp_bin2attr(attrs ? attrs : &attrs_dummy, s);
+
+            handle->u.dir.next_name = (char *) s;
+          end:
+
+            if ((--handle->u.dir.names_left) == 0)
+                LIBSSH2_FREE(session, handle->u.dir.names_packet);
+
+            _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                           "libssh2_sftp_readdir_ex() return %d",
+                           filename_len);
+            return (ssize_t)filename_len;
+        }
+
+        /* Request another entry(entries?) */
+
+        s = sftp->readdir_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->readdir_packet)
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "FXP_READDIR packet");
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_READDIR;
+        sftp->readdir_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->readdir_request_id);
+        _libssh2_store_str(&s, handle->handle, handle->handle_len);
+
+        sftp->readdir_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->readdir_state == libssh2_NB_state_created) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Reading entries from directory handle");
+        retcode = _libssh2_channel_write(channel, 0, sftp->readdir_packet,
+                                         packet_len);
+        if (retcode == LIBSSH2_ERROR_EAGAIN) {
+            return retcode;
+        }
+        else if ((ssize_t)packet_len != retcode) {
+            LIBSSH2_FREE(session, sftp->readdir_packet);
+            sftp->readdir_packet = NULL;
+            sftp->readdir_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "_libssh2_channel_write() failed");
+        }
+
+        LIBSSH2_FREE(session, sftp->readdir_packet);
+        sftp->readdir_packet = NULL;
+
+        sftp->readdir_state = libssh2_NB_state_sent;
+    }
+
+    retcode = sftp_packet_requirev(sftp, 2, read_responses,
+                                   sftp->readdir_request_id, &data,
+                                   &data_len);
+    if (retcode == LIBSSH2_ERROR_EAGAIN)
+        return retcode;
+    else if (retcode) {
+        sftp->readdir_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, retcode,
+                              "Timeout waiting for status message");
+    }
+
+    if (data[0] == SSH_FXP_STATUS) {
+        retcode = _libssh2_ntohu32(data + 5);
+        LIBSSH2_FREE(session, data);
+        if (retcode == LIBSSH2_FX_EOF) {
+            sftp->readdir_state = libssh2_NB_state_idle;
+            return 0;
+        }
+        else {
+            sftp->last_errno = retcode;
+            sftp->readdir_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                  "SFTP Protocol Error");
+        }
+    }
+
+    sftp->readdir_state = libssh2_NB_state_idle;
+
+    num_names = _libssh2_ntohu32(data + 5);
+    _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "%lu entries returned",
+                   num_names);
+    if (!num_names) {
+        LIBSSH2_FREE(session, data);
+        return 0;
+    }
+
+    handle->u.dir.names_left = num_names;
+    handle->u.dir.names_packet = data;
+    handle->u.dir.next_name = (char *) data + 9;
+
+    /* use the name popping mechanism from the start of the function */
+    return sftp_readdir(handle, buffer, buffer_maxlen, longentry,
+                        longentry_maxlen, attrs);
+}
+
+/* libssh2_sftp_readdir_ex
+ * Read from an SFTP directory handle
+ */
+LIBSSH2_API int
+libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *hnd, char *buffer,
+                        size_t buffer_maxlen, char *longentry,
+                        size_t longentry_maxlen,
+                        LIBSSH2_SFTP_ATTRIBUTES *attrs)
+{
+    int rc;
+    if(!hnd)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session,
+                 sftp_readdir(hnd, buffer, buffer_maxlen, longentry,
+                              longentry_maxlen, attrs));
+    return rc;
+}
+
+/*
+ * sftp_write
+ *
+ * Write data to an SFTP handle. Returns the number of bytes written, or
+ * a negative error code.
+ *
+ * We recommend sending very large data buffers to this function!
+ *
+ * Concept:
+ *
+ * - Detect how much of the given buffer that was already sent in a previous
+ *   call by inspecting the linked list of outgoing chunks. Make sure to skip
+ *   passed the data that has already been taken care of.
+ *
+ * - Split all (new) outgoing data in chunks no larger than N.
+ *
+ * - Each N bytes chunk gets created as a separate SFTP packet.
+ *
+ * - Add all created outgoing packets to the linked list.
+ *
+ * - Walk through the list and send the chunks that haven't been sent,
+ *   as many as possible until EAGAIN. Some of the chunks may have been put
+ *   in the list in a previous invoke.
+ *
+ * - For all the chunks in the list that have been completely sent off, check
+ *   for ACKs. If a chunk has been ACKed, it is removed from the linked
+ *   list and the "acked" counter gets increased with that data amount.
+ *
+ * - Return TOTAL bytes acked so far.
+ *
+ * Caveats:
+ * -  be careful: we must not return a higher number than what was given!
+ *
+ * TODO:
+ *   Introduce an option that disables this sort of "speculative" ahead writing
+ *   as there's a risk that it will do harm to some app.
+ */
+
+static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer,
+                          size_t count)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    uint32_t retcode;
+    uint32_t packet_len;
+    unsigned char *s, *data;
+    ssize_t rc;
+    struct sftp_pipeline_chunk *chunk;
+    struct sftp_pipeline_chunk *next;
+    size_t acked = 0;
+    size_t org_count = count;
+    size_t already;
+
+    switch(sftp->write_state) {
+    default:
+    case libssh2_NB_state_idle:
+
+        /* Number of bytes sent off that haven't been acked and therefor we
+           will get passed in here again.
+
+           Also, add up the number of bytes that actually already have been
+           acked but we haven't been able to return as such yet, so we will
+           get that data as well passed in here again.
+        */
+        already = (handle->u.file.offset_sent - handle->u.file.offset)+
+            handle->u.file.acked;
+
+        if(count >= already) {
+            /* skip the part already made into packets */
+            buffer += already;
+            count -= already;
+        }
+        else
+            /* there is more data already fine than what we got in this call */
+            count = 0;
+
+        sftp->write_state = libssh2_NB_state_idle;
+        while(count) {
+            /* TODO: Possibly this should have some logic to prevent a very
+               very small fraction to be left but lets ignore that for now */
+            uint32_t size = MIN(MAX_SFTP_OUTGOING_SIZE, count);
+            uint32_t request_id;
+
+            /* 25 = packet_len(4) + packet_type(1) + request_id(4) +
+               handle_len(4) + offset(8) + count(4) */
+            packet_len = handle->handle_len + size + 25;
+
+            chunk = LIBSSH2_ALLOC(session, packet_len +
+                                  sizeof(struct sftp_pipeline_chunk));
+            if (!chunk)
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                      "malloc fail for FXP_WRITE");
+
+            chunk->len = size;
+            chunk->sent = 0;
+            chunk->lefttosend = packet_len;
+
+            s = chunk->packet;
+            _libssh2_store_u32(&s, packet_len - 4);
+
+            *(s++) = SSH_FXP_WRITE;
+            request_id = sftp->request_id++;
+            chunk->request_id = request_id;
+            _libssh2_store_u32(&s, request_id);
+            _libssh2_store_str(&s, handle->handle, handle->handle_len);
+            _libssh2_store_u64(&s, handle->u.file.offset_sent);
+            handle->u.file.offset_sent += size; /* advance offset at once */
+            _libssh2_store_str(&s, buffer, size);
+
+            /* add this new entry LAST in the list */
+            _libssh2_list_add(&handle->packet_list, &chunk->node);
+
+            buffer += size;
+            count -= size; /* deduct the size we used, as we might have
+                              to create more packets */
+        }
+
+        /* move through the WRITE packets that haven't been sent and send as many
+           as possible - remember that we don't block */
+        chunk = _libssh2_list_first(&handle->packet_list);
+
+        while(chunk) {
+            if(chunk->lefttosend) {
+                rc = _libssh2_channel_write(channel, 0,
+                                            &chunk->packet[chunk->sent],
+                                            chunk->lefttosend);
+                if(rc < 0)
+                    /* remain in idle state */
+                    return rc;
+
+                /* remember where to continue sending the next time */
+                chunk->lefttosend -= rc;
+                chunk->sent += rc;
+
+                if(chunk->lefttosend)
+                    /* data left to send, get out of loop */
+                    break;
+            }
+
+            /* move on to the next chunk with data to send */
+            chunk = _libssh2_list_next(&chunk->node);
+        }
+
+        /* fall-through */
+    case libssh2_NB_state_sent:
+
+        sftp->write_state = libssh2_NB_state_idle;
+        /*
+         * Count all ACKed packets
+         */
+        chunk = _libssh2_list_first(&handle->packet_list);
+
+        while(chunk) {
+            if(chunk->lefttosend)
+                /* if the chunk still has data left to send, we shouldn't wait
+                   for an ACK for it just yet */
+                break;
+
+            else if(acked)
+                /* if we have sent data that is acked, we must return that
+                   info before we call a function that might return EAGAIN */
+                break;
+
+            /* we check the packets in order */
+            rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                                     chunk->request_id, &data, &data_len);
+            if (rc < 0) {
+                if (rc == LIBSSH2_ERROR_EAGAIN)
+                    sftp->write_state = libssh2_NB_state_sent;
+                return rc;
+            }
+
+            retcode = _libssh2_ntohu32(data + 5);
+            LIBSSH2_FREE(session, data);
+
+            sftp->last_errno = retcode;
+            if (retcode == LIBSSH2_FX_OK) {
+                acked += chunk->len; /* number of payload data that was acked
+                                        here */
+
+                /* we increase the offset value for all acks */
+                handle->u.file.offset += chunk->len;
+
+                next = _libssh2_list_next(&chunk->node);
+
+                _libssh2_list_remove(&chunk->node); /* remove from list */
+                LIBSSH2_FREE(session, chunk); /* free memory */
+
+                chunk = next;
+            }
+            else {
+                /* flush all pending packets from the outgoing list */
+                sftp_packetlist_flush(handle);
+
+                /* since we return error now, the applicaton will not get any
+                   outstanding data acked, so we need to rewind the offset to
+                   where the application knows it has reached with acked data */
+                handle->u.file.offset -= handle->u.file.acked;
+
+                /* then reset the offset_sent to be the same as the offset */
+                handle->u.file.offset_sent = handle->u.file.offset;
+
+                /* clear the acked counter since we can have no pending data to
+                   ack after an error */
+                handle->u.file.acked = 0;
+
+                /* the server returned an error for that written chunk, propagate
+                   this back to our parent function */
+                return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                      "FXP write failed");
+            }
+        }
+        break;
+    }
+
+    /* if there were acked data in a previous call that wasn't returned then,
+       add that up and try to return it all now. This can happen if the app
+       first sends a huge buffer of data, and then in a second call it sends a
+       smaller one. */
+    acked += handle->u.file.acked;
+
+    if(acked) {
+        ssize_t ret = MIN(acked, org_count);
+        /* we got data acked so return that amount, but no more than what
+           was asked to get sent! */
+
+        /* store the remainder. 'ret' is always equal to or less than 'acked'
+           here */
+        handle->u.file.acked = acked - ret;
+
+        return ret;
+    }
+
+    else
+        return 0; /* nothing was acked, and no EAGAIN was received! */
+}
+
+/* libssh2_sftp_write
+ * Write data to a file handle
+ */
+LIBSSH2_API ssize_t
+libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *hnd, const char *buffer,
+                   size_t count)
+{
+    ssize_t rc;
+    if(!hnd)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session,
+                 sftp_write(hnd, buffer, count));
+    return rc;
+
+}
+
+/*
+ * sftp_fstat
+ *
+ * Get or Set stat on a file
+ */
+static int sftp_fstat(LIBSSH2_SFTP_HANDLE *handle,
+                      LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
+    uint32_t packet_len =
+        handle->handle_len + 13 + (setstat ? sftp_attrsize(attrs->flags) : 0);
+    unsigned char *s, *data;
+    static const unsigned char fstat_responses[2] =
+        { SSH_FXP_ATTRS, SSH_FXP_STATUS };
+    ssize_t rc;
+
+    if (sftp->fstat_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Issuing %s command",
+                       setstat ? "set-stat" : "stat");
+        s = sftp->fstat_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->fstat_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "FSTAT/FSETSTAT packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = setstat ? SSH_FXP_FSETSTAT : SSH_FXP_FSTAT;
+        sftp->fstat_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->fstat_request_id);
+        _libssh2_store_str(&s, handle->handle, handle->handle_len);
+
+        if (setstat) {
+            s += sftp_attr2bin(s, attrs);
+        }
+
+        sftp->fstat_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->fstat_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->fstat_packet,
+                                    packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        }
+        else if ((ssize_t)packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->fstat_packet);
+            sftp->fstat_packet = NULL;
+            sftp->fstat_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  (setstat ? "Unable to send FXP_FSETSTAT"
+                                   : "Unable to send FXP_FSTAT command"));
+        }
+        LIBSSH2_FREE(session, sftp->fstat_packet);
+        sftp->fstat_packet = NULL;
+
+        sftp->fstat_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_requirev(sftp, 2, fstat_responses,
+                              sftp->fstat_request_id, &data,
+                              &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN)
+        return rc;
+    else if (rc) {
+        sftp->fstat_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Timeout waiting for status message");
+    }
+
+    sftp->fstat_state = libssh2_NB_state_idle;
+
+    if (data[0] == SSH_FXP_STATUS) {
+        uint32_t retcode;
+
+        retcode = _libssh2_ntohu32(data + 5);
+        LIBSSH2_FREE(session, data);
+        if (retcode == LIBSSH2_FX_OK) {
+            return 0;
+        } else {
+            sftp->last_errno = retcode;
+            return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                  "SFTP Protocol Error");
+        }
+    }
+
+    sftp_bin2attr(attrs, data + 5);
+    LIBSSH2_FREE(session, data);
+
+    return 0;
+}
+
+/* libssh2_sftp_fstat_ex
+ * Get or Set stat on a file
+ */
+LIBSSH2_API int
+libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *hnd,
+                      LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
+{
+    int rc;
+    if(!hnd || !attrs)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session,
+                 sftp_fstat(hnd, attrs, setstat));
+    return rc;
+}
+
+
+/* libssh2_sftp_seek64
+ * Set the read/write pointer to an arbitrary position within the file
+ */
+LIBSSH2_API void
+libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset)
+{
+    if(handle) {
+        handle->u.file.offset = handle->u.file.offset_sent = offset;
+        /* discard all pending requests and currently read data */
+        sftp_packetlist_flush(handle);
+
+        /* free the left received buffered data */
+        if (handle->u.file.data_left) {
+            LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data);
+            handle->u.file.data_left = handle->u.file.data_len = 0;
+            handle->u.file.data = NULL;
+        }
+
+        /* reset EOF to False */
+        handle->u.file.eof = FALSE;
+    }
+}
+
+/* libssh2_sftp_seek
+ * Set the read/write pointer to an arbitrary position within the file
+ */
+LIBSSH2_API void
+libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle, size_t offset)
+{
+    libssh2_sftp_seek64(handle, (libssh2_uint64_t)offset);
+}
+
+/* libssh2_sftp_tell
+ * Return the current read/write pointer's offset
+ */
+LIBSSH2_API size_t
+libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle)
+{
+    if(!handle)
+        return 0; /* no handle, no size */
+
+    /* NOTE: this may very well truncate the size if it is larger than what
+       size_t can hold, so libssh2_sftp_tell64() is really the function you
+       should use */
+    return (size_t)(handle->u.file.offset);
+}
+
+/* libssh2_sftp_tell64
+ * Return the current read/write pointer's offset
+ */
+LIBSSH2_API libssh2_uint64_t
+libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle)
+{
+    if(!handle)
+        return 0; /* no handle, no size */
+
+    return handle->u.file.offset;
+}
+
+/*
+ * Flush all remaining incoming SFTP packets and zombies.
+ */
+static void sftp_packet_flush(LIBSSH2_SFTP *sftp)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    LIBSSH2_SFTP_PACKET *packet = _libssh2_list_first(&sftp->packets);
+    struct sftp_zombie_requests *zombie =
+        _libssh2_list_first(&sftp->zombie_requests);
+
+    while(packet) {
+        LIBSSH2_SFTP_PACKET *next;
+
+        /* check next struct in the list */
+        next =  _libssh2_list_next(&packet->node);
+        _libssh2_list_remove(&packet->node);
+        LIBSSH2_FREE(session, packet->data);
+        LIBSSH2_FREE(session, packet);
+
+        packet = next;
+    }
+
+    while(zombie) {
+        /* figure out the next node */
+        struct sftp_zombie_requests *next = _libssh2_list_next(&zombie->node);
+        /* unlink the current one */
+        _libssh2_list_remove(&zombie->node);
+        /* free the memory */
+        LIBSSH2_FREE(session, zombie);
+        zombie = next;
+    }
+
+}
+
+/* sftp_close_handle
+ *
+ * Close a file or directory handle
+ * Also frees handle resource and unlinks it from the SFTP structure
+ */
+static int
+sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    int retcode;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
+    uint32_t packet_len = handle->handle_len + 13;
+    unsigned char *s, *data = NULL;
+    int rc;
+
+    if (handle->close_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Closing handle");
+        s = handle->close_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!handle->close_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_CLOSE "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_CLOSE;
+        handle->close_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, handle->close_request_id);
+        _libssh2_store_str(&s, handle->handle, handle->handle_len);
+        handle->close_state = libssh2_NB_state_created;
+    }
+
+    if (handle->close_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, handle->close_packet,
+                                    packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((ssize_t)packet_len != rc) {
+            LIBSSH2_FREE(session, handle->close_packet);
+            handle->close_packet = NULL;
+            handle->close_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send FXP_CLOSE command");
+        }
+        LIBSSH2_FREE(session, handle->close_packet);
+        handle->close_packet = NULL;
+
+        handle->close_state = libssh2_NB_state_sent;
+    }
+
+    if (handle->close_state == libssh2_NB_state_sent) {
+        rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                                 handle->close_request_id, &data,
+                                 &data_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (rc) {
+            handle->close_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, rc,
+                                  "Error waiting for status message");
+        }
+
+        handle->close_state = libssh2_NB_state_sent1;
+    }
+
+    if(!data)
+        /* if it reaches this point with data unset, something unwanted
+           happened (like this function is called again when in
+           libssh2_NB_state_sent1 state) and we just bail out */
+        return LIBSSH2_ERROR_INVAL;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    if (retcode != LIBSSH2_FX_OK) {
+        sftp->last_errno = retcode;
+        handle->close_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error");
+    }
+
+    /* remove this handle from the parent's list */
+    _libssh2_list_remove(&handle->node);
+
+    if ((handle->handle_type == LIBSSH2_SFTP_HANDLE_DIR)
+        && handle->u.dir.names_left) {
+        LIBSSH2_FREE(session, handle->u.dir.names_packet);
+    }
+    else {
+        if(handle->u.file.data)
+            LIBSSH2_FREE(session, handle->u.file.data);
+    }
+
+    sftp_packetlist_flush(handle);
+    sftp->read_state = libssh2_NB_state_idle;
+
+    handle->close_state = libssh2_NB_state_idle;
+
+    LIBSSH2_FREE(session, handle);
+
+    return 0;
+}
+
+/* libssh2_sftp_close_handle
+ *
+ * Close a file or directory handle
+ * Also frees handle resource and unlinks it from the SFTP structure
+ */
+LIBSSH2_API int
+libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *hnd)
+{
+    int rc;
+    if(!hnd)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, hnd->sftp->channel->session, sftp_close_handle(hnd));
+    return rc;
+}
+
+/* sftp_unlink
+ * Delete a file from the remote server
+ */
+static int sftp_unlink(LIBSSH2_SFTP *sftp, const char *filename,
+                       size_t filename_len)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    int retcode;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + filename_len(4) */
+    uint32_t packet_len = filename_len + 13;
+    unsigned char *s, *data;
+    int rc;
+
+    if (sftp->unlink_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Unlinking %s", filename);
+        s = sftp->unlink_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->unlink_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_REMOVE "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_REMOVE;
+        sftp->unlink_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->unlink_request_id);
+        _libssh2_store_str(&s, filename, filename_len);
+        sftp->unlink_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->unlink_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->unlink_packet,
+                                    packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((ssize_t)packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->unlink_packet);
+            sftp->unlink_packet = NULL;
+            sftp->unlink_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send FXP_REMOVE command");
+        }
+        LIBSSH2_FREE(session, sftp->unlink_packet);
+        sftp->unlink_packet = NULL;
+
+        sftp->unlink_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                             sftp->unlink_request_id, &data,
+                             &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    }
+    else if (rc) {
+        sftp->unlink_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP STATUS");
+    }
+
+    sftp->unlink_state = libssh2_NB_state_idle;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    if (retcode == LIBSSH2_FX_OK) {
+        return 0;
+    } else {
+        sftp->last_errno = retcode;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error");
+    }
+}
+
+/* libssh2_sftp_unlink_ex
+ * Delete a file from the remote server
+ */
+LIBSSH2_API int
+libssh2_sftp_unlink_ex(LIBSSH2_SFTP *sftp, const char *filename,
+                       unsigned int filename_len)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_unlink(sftp, filename, filename_len));
+    return rc;
+}
+
+/*
+ * sftp_rename
+ *
+ * Rename a file on the remote server
+ */
+static int sftp_rename(LIBSSH2_SFTP *sftp, const char *source_filename,
+                       unsigned int source_filename_len,
+                       const char *dest_filename,
+                       unsigned int dest_filename_len, long flags)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    int retcode;
+    uint32_t packet_len =
+        source_filename_len + dest_filename_len + 17 + (sftp->version >=
+                                                        5 ? 4 : 0);
+    /* packet_len(4) + packet_type(1) + request_id(4) +
+       source_filename_len(4) + dest_filename_len(4) + flags(4){SFTP5+) */
+    unsigned char *data;
+    ssize_t rc;
+
+    if (sftp->version < 2) {
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "Server does not support RENAME");
+    }
+
+    if (sftp->rename_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Renaming %s to %s",
+                       source_filename, dest_filename);
+        sftp->rename_s = sftp->rename_packet =
+            LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->rename_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_RENAME "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&sftp->rename_s, packet_len - 4);
+        *(sftp->rename_s++) = SSH_FXP_RENAME;
+        sftp->rename_request_id = sftp->request_id++;
+        _libssh2_store_u32(&sftp->rename_s, sftp->rename_request_id);
+        _libssh2_store_str(&sftp->rename_s, source_filename,
+                           source_filename_len);
+        _libssh2_store_str(&sftp->rename_s, dest_filename, dest_filename_len);
+
+        if (sftp->version >= 5)
+            _libssh2_store_u32(&sftp->rename_s, flags);
+
+        sftp->rename_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->rename_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->rename_packet,
+                                    sftp->rename_s - sftp->rename_packet);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if ((ssize_t)packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->rename_packet);
+            sftp->rename_packet = NULL;
+            sftp->rename_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send FXP_RENAME command");
+        }
+        LIBSSH2_FREE(session, sftp->rename_packet);
+        sftp->rename_packet = NULL;
+
+        sftp->rename_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                             sftp->rename_request_id, &data,
+                             &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->rename_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP STATUS");
+    }
+
+    sftp->rename_state = libssh2_NB_state_idle;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    sftp->last_errno = retcode;
+
+    /* now convert the SFTP error code to libssh2 return code or error
+       message */
+    switch (retcode) {
+    case LIBSSH2_FX_OK:
+        retcode = LIBSSH2_ERROR_NONE;
+        break;
+
+    case LIBSSH2_FX_FILE_ALREADY_EXISTS:
+        retcode = _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                 "File already exists and "
+                                 "SSH_FXP_RENAME_OVERWRITE not specified");
+        break;
+
+    case LIBSSH2_FX_OP_UNSUPPORTED:
+        retcode = _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                 "Operation Not Supported");
+        break;
+
+    default:
+        retcode = _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                 "SFTP Protocol Error");
+        break;
+    }
+
+    return retcode;
+}
+
+/* libssh2_sftp_rename_ex
+ * Rename a file on the remote server
+ */
+LIBSSH2_API int
+libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp, const char *source_filename,
+                       unsigned int source_filename_len,
+                       const char *dest_filename,
+                       unsigned int dest_filename_len, long flags)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_rename(sftp, source_filename, source_filename_len,
+                             dest_filename, dest_filename_len, flags));
+    return rc;
+}
+
+/*
+ * sftp_fstatvfs
+ *
+ * Get file system statistics
+ */
+static int sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_STATVFS *st)
+{
+    LIBSSH2_SFTP *sftp = handle->sftp;
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    /* 17 = packet_len(4) + packet_type(1) + request_id(4) + ext_len(4)
+          + handle_len (4) */
+    /* 20 = strlen ("fstatvfs@openssh.com") */
+    uint32_t packet_len = handle->handle_len + 20 + 17;
+    unsigned char *packet, *s, *data;
+    ssize_t rc;
+    unsigned int flag;
+
+    if (sftp->fstatvfs_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Getting file system statistics");
+        s = packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_EXTENDED "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_EXTENDED;
+        sftp->fstatvfs_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->fstatvfs_request_id);
+        _libssh2_store_str(&s, "fstatvfs@openssh.com", 20);
+        _libssh2_store_str(&s, handle->handle, handle->handle_len);
+
+        sftp->fstatvfs_state = libssh2_NB_state_created;
+    }
+    else {
+        packet = sftp->fstatvfs_packet;
+    }
+
+    if (sftp->fstatvfs_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, packet, packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN ||
+            (0 <= rc && rc < (ssize_t)packet_len)) {
+            sftp->fstatvfs_packet = packet;
+            return LIBSSH2_ERROR_EAGAIN;
+        }
+
+        LIBSSH2_FREE(session, packet);
+        sftp->fstatvfs_packet = NULL;
+
+        if (rc < 0) {
+            sftp->fstatvfs_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "_libssh2_channel_write() failed");
+        }
+        sftp->fstatvfs_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_EXTENDED_REPLY,
+                             sftp->fstatvfs_request_id, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->fstatvfs_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP EXTENDED REPLY");
+    } else if (data_len < 93) {
+        LIBSSH2_FREE(session, data);
+        sftp->fstatvfs_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error: short response");
+    }
+
+    sftp->fstatvfs_state = libssh2_NB_state_idle;
+
+    st->f_bsize = _libssh2_ntohu64(data + 5);
+    st->f_frsize = _libssh2_ntohu64(data + 13);
+    st->f_blocks = _libssh2_ntohu64(data + 21);
+    st->f_bfree = _libssh2_ntohu64(data + 29);
+    st->f_bavail = _libssh2_ntohu64(data + 37);
+    st->f_files = _libssh2_ntohu64(data + 45);
+    st->f_ffree = _libssh2_ntohu64(data + 53);
+    st->f_favail = _libssh2_ntohu64(data + 61);
+    st->f_fsid = _libssh2_ntohu64(data + 69);
+    flag = _libssh2_ntohu64(data + 77);
+    st->f_namemax = _libssh2_ntohu64(data + 85);
+
+    st->f_flag = (flag & SSH_FXE_STATVFS_ST_RDONLY)
+                  ? LIBSSH2_SFTP_ST_RDONLY : 0;
+    st->f_flag |= (flag & SSH_FXE_STATVFS_ST_NOSUID)
+                  ? LIBSSH2_SFTP_ST_NOSUID : 0;
+
+    LIBSSH2_FREE(session, data);
+    return 0;
+}
+
+/* libssh2_sftp_fstatvfs
+ * Get filesystem space and inode utilization (requires fstatvfs@openssh.com
+ * support on the server)
+ */
+LIBSSH2_API int
+libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_STATVFS *st)
+{
+    int rc;
+    if(!handle || !st)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, handle->sftp->channel->session, sftp_fstatvfs(handle, st));
+    return rc;
+}
+
+/*
+ * sftp_statvfs
+ *
+ * Get file system statistics
+ */
+static int sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
+                        unsigned int path_len, LIBSSH2_SFTP_STATVFS *st)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    /* 17 = packet_len(4) + packet_type(1) + request_id(4) + ext_len(4)
+          + path_len (4) */
+    /* 19 = strlen ("statvfs@openssh.com") */
+    uint32_t packet_len = path_len + 19 + 17;
+    unsigned char *packet, *s, *data;
+    ssize_t rc;
+    unsigned int flag;
+
+    if (sftp->statvfs_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Getting file system statistics of %s", path);
+        s = packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_EXTENDED "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_EXTENDED;
+        sftp->statvfs_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->statvfs_request_id);
+        _libssh2_store_str(&s, "statvfs@openssh.com", 19);
+        _libssh2_store_str(&s, path, path_len);
+
+        sftp->statvfs_state = libssh2_NB_state_created;
+    }
+    else {
+        packet = sftp->statvfs_packet;
+    }
+
+    if (sftp->statvfs_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, packet, packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN ||
+            (0 <= rc && rc < (ssize_t)packet_len)) {
+            sftp->statvfs_packet = packet;
+            return LIBSSH2_ERROR_EAGAIN;
+        }
+
+        LIBSSH2_FREE(session, packet);
+        sftp->statvfs_packet = NULL;
+
+        if (rc < 0) {
+            sftp->statvfs_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "_libssh2_channel_write() failed");
+        }
+        sftp->statvfs_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_EXTENDED_REPLY,
+                             sftp->statvfs_request_id, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->statvfs_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP EXTENDED REPLY");
+    } else if (data_len < 93) {
+        LIBSSH2_FREE(session, data);
+        sftp->fstatvfs_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error: short response");
+    }
+
+    sftp->statvfs_state = libssh2_NB_state_idle;
+
+    st->f_bsize = _libssh2_ntohu64(data + 5);
+    st->f_frsize = _libssh2_ntohu64(data + 13);
+    st->f_blocks = _libssh2_ntohu64(data + 21);
+    st->f_bfree = _libssh2_ntohu64(data + 29);
+    st->f_bavail = _libssh2_ntohu64(data + 37);
+    st->f_files = _libssh2_ntohu64(data + 45);
+    st->f_ffree = _libssh2_ntohu64(data + 53);
+    st->f_favail = _libssh2_ntohu64(data + 61);
+    st->f_fsid = _libssh2_ntohu64(data + 69);
+    flag = _libssh2_ntohu64(data + 77);
+    st->f_namemax = _libssh2_ntohu64(data + 85);
+
+    st->f_flag = (flag & SSH_FXE_STATVFS_ST_RDONLY)
+                  ? LIBSSH2_SFTP_ST_RDONLY : 0;
+    st->f_flag |= (flag & SSH_FXE_STATVFS_ST_NOSUID)
+                  ? LIBSSH2_SFTP_ST_NOSUID : 0;
+
+    LIBSSH2_FREE(session, data);
+    return 0;
+}
+
+/* libssh2_sftp_statvfs_ex
+ * Get filesystem space and inode utilization (requires statvfs@openssh.com
+ * support on the server)
+ */
+LIBSSH2_API int
+libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
+                     size_t path_len, LIBSSH2_SFTP_STATVFS *st)
+{
+    int rc;
+    if(!sftp || !st)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session, sftp_statvfs(sftp, path, path_len,
+                                                          st));
+    return rc;
+}
+
+
+/*
+ * sftp_mkdir
+ *
+ * Create an SFTP directory
+ */
+static int sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path,
+                      unsigned int path_len, long mode)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    LIBSSH2_SFTP_ATTRIBUTES attrs = {
+        LIBSSH2_SFTP_ATTR_PERMISSIONS, 0, 0, 0, 0, 0, 0
+    };
+    size_t data_len;
+    int retcode;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + path_len(4) */
+    ssize_t packet_len = path_len + 13 +
+        sftp_attrsize(LIBSSH2_SFTP_ATTR_PERMISSIONS);
+    unsigned char *packet, *s, *data;
+    int rc;
+
+    if (sftp->mkdir_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP,
+                       "Creating directory %s with mode 0%lo", path, mode);
+        s = packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_MKDIR "
+                                  "packet");
+        }
+        /* Filetype in SFTP 3 and earlier */
+        attrs.permissions = mode | LIBSSH2_SFTP_ATTR_PFILETYPE_DIR;
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_MKDIR;
+        sftp->mkdir_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->mkdir_request_id);
+        _libssh2_store_str(&s, path, path_len);
+
+        s += sftp_attr2bin(s, &attrs);
+
+        sftp->mkdir_state = libssh2_NB_state_created;
+    }
+    else {
+        packet = sftp->mkdir_packet;
+    }
+
+    if (sftp->mkdir_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, packet, packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            sftp->mkdir_packet = packet;
+            return rc;
+        }
+        if (packet_len != rc) {
+            LIBSSH2_FREE(session, packet);
+            sftp->mkdir_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "_libssh2_channel_write() failed");
+        }
+        LIBSSH2_FREE(session, packet);
+        sftp->mkdir_state = libssh2_NB_state_sent;
+        sftp->mkdir_packet = NULL;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_STATUS, sftp->mkdir_request_id,
+                             &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->mkdir_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP STATUS");
+    }
+
+    sftp->mkdir_state = libssh2_NB_state_idle;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    if (retcode == LIBSSH2_FX_OK) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "OK!");
+        return 0;
+    } else {
+        sftp->last_errno = retcode;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error");
+    }
+}
+
+/*
+ * libssh2_sftp_mkdir_ex
+ *
+ * Create an SFTP directory
+ */
+LIBSSH2_API int
+libssh2_sftp_mkdir_ex(LIBSSH2_SFTP *sftp, const char *path,
+                      unsigned int path_len, long mode)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_mkdir(sftp, path, path_len, mode));
+    return rc;
+}
+
+/* sftp_rmdir
+ * Remove a directory
+ */
+static int sftp_rmdir(LIBSSH2_SFTP *sftp, const char *path,
+                      unsigned int path_len)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    int retcode;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + path_len(4) */
+    ssize_t packet_len = path_len + 13;
+    unsigned char *s, *data;
+    int rc;
+
+    if (sftp->rmdir_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Removing directory: %s",
+                       path);
+        s = sftp->rmdir_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->rmdir_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_RMDIR "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+        *(s++) = SSH_FXP_RMDIR;
+        sftp->rmdir_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->rmdir_request_id);
+        _libssh2_store_str(&s, path, path_len);
+
+        sftp->rmdir_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->rmdir_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->rmdir_packet,
+                                    packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->rmdir_packet);
+            sftp->rmdir_packet = NULL;
+            sftp->rmdir_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send FXP_RMDIR command");
+        }
+        LIBSSH2_FREE(session, sftp->rmdir_packet);
+        sftp->rmdir_packet = NULL;
+
+        sftp->rmdir_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_require(sftp, SSH_FXP_STATUS,
+                             sftp->rmdir_request_id, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return rc;
+    } else if (rc) {
+        sftp->rmdir_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Error waiting for FXP STATUS");
+    }
+
+    sftp->rmdir_state = libssh2_NB_state_idle;
+
+    retcode = _libssh2_ntohu32(data + 5);
+    LIBSSH2_FREE(session, data);
+
+    if (retcode == LIBSSH2_FX_OK) {
+        return 0;
+    } else {
+        sftp->last_errno = retcode;
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "SFTP Protocol Error");
+    }
+}
+
+/* libssh2_sftp_rmdir_ex
+ * Remove a directory
+ */
+LIBSSH2_API int
+libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path,
+                      unsigned int path_len)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_rmdir(sftp, path, path_len));
+    return rc;
+}
+
+/* sftp_stat
+ * Stat a file or symbolic link
+ */
+static int sftp_stat(LIBSSH2_SFTP *sftp, const char *path,
+                     unsigned int path_len, int stat_type,
+                     LIBSSH2_SFTP_ATTRIBUTES * attrs)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + path_len(4) */
+    ssize_t packet_len =
+        path_len + 13 +
+        ((stat_type ==
+          LIBSSH2_SFTP_SETSTAT) ? sftp_attrsize(attrs->flags) : 0);
+    unsigned char *s, *data;
+    static const unsigned char stat_responses[2] =
+        { SSH_FXP_ATTRS, SSH_FXP_STATUS };
+    int rc;
+
+    if (sftp->stat_state == libssh2_NB_state_idle) {
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "%s %s",
+                       (stat_type == LIBSSH2_SFTP_SETSTAT) ? "Set-statting" :
+                       (stat_type ==
+                        LIBSSH2_SFTP_LSTAT ? "LStatting" : "Statting"), path);
+        s = sftp->stat_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->stat_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for FXP_*STAT "
+                                  "packet");
+        }
+
+        _libssh2_store_u32(&s, packet_len - 4);
+
+        switch (stat_type) {
+        case LIBSSH2_SFTP_SETSTAT:
+            *(s++) = SSH_FXP_SETSTAT;
+            break;
+
+        case LIBSSH2_SFTP_LSTAT:
+            *(s++) = SSH_FXP_LSTAT;
+            break;
+
+        case LIBSSH2_SFTP_STAT:
+        default:
+            *(s++) = SSH_FXP_STAT;
+        }
+        sftp->stat_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->stat_request_id);
+        _libssh2_store_str(&s, path, path_len);
+
+        if (stat_type == LIBSSH2_SFTP_SETSTAT)
+            s += sftp_attr2bin(s, attrs);
+
+        sftp->stat_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->stat_state == libssh2_NB_state_created) {
+        rc = _libssh2_channel_write(channel, 0, sftp->stat_packet, packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return rc;
+        } else if (packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->stat_packet);
+            sftp->stat_packet = NULL;
+            sftp->stat_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send STAT/LSTAT/SETSTAT command");
+        }
+        LIBSSH2_FREE(session, sftp->stat_packet);
+        sftp->stat_packet = NULL;
+
+        sftp->stat_state = libssh2_NB_state_sent;
+    }
+
+    rc = sftp_packet_requirev(sftp, 2, stat_responses,
+                              sftp->stat_request_id, &data, &data_len);
+    if (rc == LIBSSH2_ERROR_EAGAIN)
+        return rc;
+    else if (rc) {
+        sftp->stat_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, rc,
+                              "Timeout waiting for status message");
+    }
+
+    sftp->stat_state = libssh2_NB_state_idle;
+
+    if (data[0] == SSH_FXP_STATUS) {
+        int retcode;
+
+        retcode = _libssh2_ntohu32(data + 5);
+        LIBSSH2_FREE(session, data);
+        if (retcode == LIBSSH2_FX_OK) {
+            return 0;
+        } else {
+            sftp->last_errno = retcode;
+            return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                  "SFTP Protocol Error");
+        }
+    }
+
+    memset(attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
+    sftp_bin2attr(attrs, data + 5);
+    LIBSSH2_FREE(session, data);
+
+    return 0;
+}
+
+/* libssh2_sftp_stat_ex
+ * Stat a file or symbolic link
+ */
+LIBSSH2_API int
+libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path,
+                     unsigned int path_len, int stat_type,
+                     LIBSSH2_SFTP_ATTRIBUTES *attrs)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_stat(sftp, path, path_len, stat_type, attrs));
+    return rc;
+}
+
+/* sftp_symlink
+ * Read or set a symlink
+ */
+static int sftp_symlink(LIBSSH2_SFTP *sftp, const char *path,
+                        unsigned int path_len, char *target,
+                        unsigned int target_len, int link_type)
+{
+    LIBSSH2_CHANNEL *channel = sftp->channel;
+    LIBSSH2_SESSION *session = channel->session;
+    size_t data_len, link_len;
+    /* 13 = packet_len(4) + packet_type(1) + request_id(4) + path_len(4) */
+    ssize_t packet_len =
+        path_len + 13 +
+        ((link_type == LIBSSH2_SFTP_SYMLINK) ? (4 + target_len) : 0);
+    unsigned char *s, *data;
+    static const unsigned char link_responses[2] =
+        { SSH_FXP_NAME, SSH_FXP_STATUS };
+    int retcode;
+
+    if ((sftp->version < 3) && (link_type != LIBSSH2_SFTP_REALPATH)) {
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "Server does not support SYMLINK or READLINK");
+    }
+
+    if (sftp->symlink_state == libssh2_NB_state_idle) {
+        s = sftp->symlink_packet = LIBSSH2_ALLOC(session, packet_len);
+        if (!sftp->symlink_packet) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "SYMLINK/READLINK/REALPATH packet");
+        }
+
+        _libssh2_debug(session, LIBSSH2_TRACE_SFTP, "%s %s on %s",
+                       (link_type ==
+                        LIBSSH2_SFTP_SYMLINK) ? "Creating" : "Reading",
+                       (link_type ==
+                        LIBSSH2_SFTP_REALPATH) ? "realpath" : "symlink", path);
+
+        _libssh2_store_u32(&s, packet_len - 4);
+
+        switch (link_type) {
+        case LIBSSH2_SFTP_REALPATH:
+            *(s++) = SSH_FXP_REALPATH;
+            break;
+
+        case LIBSSH2_SFTP_SYMLINK:
+            *(s++) = SSH_FXP_SYMLINK;
+            break;
+
+        case LIBSSH2_SFTP_READLINK:
+        default:
+            *(s++) = SSH_FXP_READLINK;
+        }
+        sftp->symlink_request_id = sftp->request_id++;
+        _libssh2_store_u32(&s, sftp->symlink_request_id);
+        _libssh2_store_str(&s, path, path_len);
+
+        if (link_type == LIBSSH2_SFTP_SYMLINK)
+            _libssh2_store_str(&s, target, target_len);
+
+        sftp->symlink_state = libssh2_NB_state_created;
+    }
+
+    if (sftp->symlink_state == libssh2_NB_state_created) {
+        ssize_t rc = _libssh2_channel_write(channel, 0, sftp->symlink_packet,
+                                            packet_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+            return rc;
+        else if (packet_len != rc) {
+            LIBSSH2_FREE(session, sftp->symlink_packet);
+            sftp->symlink_packet = NULL;
+            sftp->symlink_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send SYMLINK/READLINK command");
+        }
+        LIBSSH2_FREE(session, sftp->symlink_packet);
+        sftp->symlink_packet = NULL;
+
+        sftp->symlink_state = libssh2_NB_state_sent;
+    }
+
+    retcode = sftp_packet_requirev(sftp, 2, link_responses,
+                                   sftp->symlink_request_id, &data,
+                                   &data_len);
+    if (retcode == LIBSSH2_ERROR_EAGAIN)
+        return retcode;
+    else if (retcode) {
+        sftp->symlink_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, retcode,
+                              "Error waiting for status message");
+    }
+
+    sftp->symlink_state = libssh2_NB_state_idle;
+
+    if (data[0] == SSH_FXP_STATUS) {
+        int retcode;
+
+        retcode = _libssh2_ntohu32(data + 5);
+        LIBSSH2_FREE(session, data);
+        if (retcode == LIBSSH2_FX_OK)
+            return LIBSSH2_ERROR_NONE;
+        else {
+            sftp->last_errno = retcode;
+            return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                                  "SFTP Protocol Error");
+        }
+    }
+
+    if (_libssh2_ntohu32(data + 5) < 1) {
+        LIBSSH2_FREE(session, data);
+        return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
+                              "Invalid READLINK/REALPATH response, "
+                              "no name entries");
+    }
+
+    /* this reads a u32 and stores it into a signed 32bit value */
+    link_len = _libssh2_ntohu32(data + 9);
+    if (link_len < target_len) {
+        memcpy(target, data + 13, link_len);
+        target[link_len] = 0;
+        retcode = (int)link_len;
+    }
+    else
+        retcode = LIBSSH2_ERROR_BUFFER_TOO_SMALL;
+    LIBSSH2_FREE(session, data);
+
+    return retcode;
+}
+
+/* libssh2_sftp_symlink_ex
+ * Read or set a symlink
+ */
+LIBSSH2_API int
+libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path,
+                        unsigned int path_len, char *target,
+                        unsigned int target_len, int link_type)
+{
+    int rc;
+    if(!sftp)
+        return LIBSSH2_ERROR_BAD_USE;
+    BLOCK_ADJUST(rc, sftp->channel->session,
+                 sftp_symlink(sftp, path, path_len, target, target_len,
+                              link_type));
+    return rc;
+}
+
+/* libssh2_sftp_last_error
+ * Returns the last error code reported by SFTP
+ */
+LIBSSH2_API unsigned long
+libssh2_sftp_last_error(LIBSSH2_SFTP *sftp)
+{
+    if(!sftp)
+       return 0;
+
+    return sftp->last_errno;
+}
+
+/* libssh2_sftp_get_channel
+ * Return the channel of sftp, then caller can control the channel's behavior.
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp)
+{
+    if (!sftp)
+        return NULL;
+
+    return sftp->channel;
+}
diff --git a/pgadmin/libssh2/transport.c b/pgadmin/libssh2/transport.c
new file mode 100644
index 0000000..b4ec037
--- /dev/null
+++ b/pgadmin/libssh2/transport.c
@@ -0,0 +1,886 @@
+/* Copyright (C) 2007 The Written Word, Inc.  All rights reserved.
+ * Copyright (C) 2009-2010 by Daniel Stenberg
+ * Author: Daniel Stenberg <daniel@haxx.se>
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file handles reading and writing to the SECSH transport layer. RFC4253.
+ */
+
+#include "libssh2_priv.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#ifdef LIBSSH2DEBUG
+#include <stdio.h>
+#endif
+
+#include <assert.h>
+
+#include "transport.h"
+#include "mac.h"
+
+#define MAX_BLOCKSIZE 32    /* MUST fit biggest crypto block size we use/get */
+#define MAX_MACSIZE 20      /* MUST fit biggest MAC length we support */
+
+#ifdef LIBSSH2DEBUG
+#define UNPRINTABLE_CHAR '.'
+static void
+debugdump(LIBSSH2_SESSION * session,
+          const char *desc, const unsigned char *ptr, size_t size)
+{
+    size_t i;
+    size_t c;
+    unsigned int width = 0x10;
+    char buffer[256];  /* Must be enough for width*4 + about 30 or so */
+    size_t used;
+    static const char* hex_chars = "0123456789ABCDEF";
+
+    if (!(session->showmask & LIBSSH2_TRACE_TRANS)) {
+        /* not asked for, bail out */
+        return;
+    }
+
+    used = snprintf(buffer, sizeof(buffer), "=> %s (%d bytes)\n",
+                    desc, (int) size);
+    if (session->tracehandler)
+        (session->tracehandler)(session, session->tracehandler_context,
+                                buffer, used);
+    else
+        fprintf(stderr, "%s", buffer);
+
+    for(i = 0; i < size; i += width) {
+
+        used = snprintf(buffer, sizeof(buffer), "%04lx: ", (long)i);
+
+        /* hex not disabled, show it */
+        for(c = 0; c < width; c++) {
+            if (i + c < size) {
+                buffer[used++] = hex_chars[(ptr[i+c] >> 4) & 0xF];
+                buffer[used++] = hex_chars[ptr[i+c] & 0xF];
+            }
+            else {
+                buffer[used++] = ' ';
+                buffer[used++] = ' ';
+            }
+
+            buffer[used++] = ' ';
+            if ((width/2) - 1 == c)
+                buffer[used++] = ' ';
+        }
+
+        buffer[used++] = ':';
+        buffer[used++] = ' ';
+
+        for(c = 0; (c < width) && (i + c < size); c++) {
+            buffer[used++] = isprint(ptr[i + c]) ?
+                ptr[i + c] : UNPRINTABLE_CHAR;
+        }
+        buffer[used++] = '\n';
+        buffer[used] = 0;
+
+        if (session->tracehandler)
+            (session->tracehandler)(session, session->tracehandler_context,
+                                    buffer, used);
+        else
+            fprintf(stderr, "%s", buffer);
+    }
+}
+#else
+#define debugdump(a,x,y,z)
+#endif
+
+
+/* decrypt() decrypts 'len' bytes from 'source' to 'dest'.
+ *
+ * returns 0 on success and negative on failure
+ */
+
+static int
+decrypt(LIBSSH2_SESSION * session, unsigned char *source,
+        unsigned char *dest, int len)
+{
+    struct transportpacket *p = &session->packet;
+    int blocksize = session->remote.crypt->blocksize;
+
+    /* if we get called with a len that isn't an even number of blocksizes
+       we risk losing those extra bytes */
+    assert((len % blocksize) == 0);
+
+    while (len >= blocksize) {
+        if (session->remote.crypt->crypt(session, source, blocksize,
+                                         &session->remote.crypt_abstract)) {
+            LIBSSH2_FREE(session, p->payload);
+            return LIBSSH2_ERROR_DECRYPT;
+        }
+
+        /* if the crypt() function would write to a given address it
+           wouldn't have to memcpy() and we could avoid this memcpy()
+           too */
+        memcpy(dest, source, blocksize);
+
+        len -= blocksize;       /* less bytes left */
+        dest += blocksize;      /* advance write pointer */
+        source += blocksize;    /* advance read pointer */
+    }
+    return LIBSSH2_ERROR_NONE;         /* all is fine */
+}
+
+/*
+ * fullpacket() gets called when a full packet has been received and properly
+ * collected.
+ */
+static int
+fullpacket(LIBSSH2_SESSION * session, int encrypted /* 1 or 0 */ )
+{
+    unsigned char macbuf[MAX_MACSIZE];
+    struct transportpacket *p = &session->packet;
+    int rc;
+    int compressed;
+
+    if (session->fullpacket_state == libssh2_NB_state_idle) {
+        session->fullpacket_macstate = LIBSSH2_MAC_CONFIRMED;
+        session->fullpacket_payload_len = p->packet_length - 1;
+
+        if (encrypted) {
+
+            /* Calculate MAC hash */
+            session->remote.mac->hash(session, macbuf,  /* store hash here */
+                                      session->remote.seqno,
+                                      p->init, 5,
+                                      p->payload,
+                                      session->fullpacket_payload_len,
+                                      &session->remote.mac_abstract);
+
+            /* Compare the calculated hash with the MAC we just read from
+             * the network. The read one is at the very end of the payload
+             * buffer. Note that 'payload_len' here is the packet_length
+             * field which includes the padding but not the MAC.
+             */
+            if (memcmp(macbuf, p->payload + session->fullpacket_payload_len,
+                       session->remote.mac->mac_len)) {
+                session->fullpacket_macstate = LIBSSH2_MAC_INVALID;
+            }
+        }
+
+        session->remote.seqno++;
+
+        /* ignore the padding */
+        session->fullpacket_payload_len -= p->padding_length;
+
+        /* Check for and deal with decompression */
+        compressed =
+            session->local.comp != NULL &&
+            session->local.comp->compress &&
+            ((session->state & LIBSSH2_STATE_AUTHENTICATED) ||
+             session->local.comp->use_in_auth);
+
+        if (compressed && session->remote.comp_abstract) {
+            /*
+             * The buffer for the decompression (remote.comp_abstract) is
+             * initialised in time when it is needed so as long it is NULL we
+             * cannot decompress.
+             */
+
+            unsigned char *data;
+            size_t data_len;
+            rc = session->remote.comp->decomp(session,
+                                              &data, &data_len,
+                                              LIBSSH2_PACKET_MAXDECOMP,
+                                              p->payload,
+                                              session->fullpacket_payload_len,
+                                              &session->remote.comp_abstract);
+            LIBSSH2_FREE(session, p->payload);
+            if(rc)
+                return rc;
+
+            p->payload = data;
+            session->fullpacket_payload_len = data_len;
+        }
+
+        session->fullpacket_packet_type = p->payload[0];
+
+        debugdump(session, "libssh2_transport_read() plain",
+                  p->payload, session->fullpacket_payload_len);
+
+        session->fullpacket_state = libssh2_NB_state_created;
+    }
+
+    if (session->fullpacket_state == libssh2_NB_state_created) {
+        rc = _libssh2_packet_add(session, p->payload,
+                                 session->fullpacket_payload_len,
+                                 session->fullpacket_macstate);
+        if (rc)
+            return rc;
+    }
+
+    session->fullpacket_state = libssh2_NB_state_idle;
+
+    return session->fullpacket_packet_type;
+}
+
+
+/*
+ * _libssh2_transport_read
+ *
+ * Collect a packet into the input queue.
+ *
+ * Returns packet type added to input queue (0 if nothing added), or a
+ * negative error number.
+ */
+
+/*
+ * This function reads the binary stream as specified in chapter 6 of RFC4253
+ * "The Secure Shell (SSH) Transport Layer Protocol"
+ *
+ * DOES NOT call _libssh2_error() for ANY error case.
+ */
+int _libssh2_transport_read(LIBSSH2_SESSION * session)
+{
+    int rc;
+    struct transportpacket *p = &session->packet;
+    int remainbuf;
+    int remainpack;
+    int numbytes;
+    int numdecrypt;
+    unsigned char block[MAX_BLOCKSIZE];
+    int blocksize;
+    int encrypted = 1;
+    size_t total_num;
+
+    /* default clear the bit */
+    session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_INBOUND;
+
+    /*
+     * All channels, systems, subsystems, etc eventually make it down here
+     * when looking for more incoming data. If a key exchange is going on
+     * (LIBSSH2_STATE_EXCHANGING_KEYS bit is set) then the remote end will
+     * ONLY send key exchange related traffic. In non-blocking mode, there is
+     * a chance to break out of the kex_exchange function with an EAGAIN
+     * status, and never come back to it. If LIBSSH2_STATE_EXCHANGING_KEYS is
+     * active, then we must redirect to the key exchange. However, if
+     * kex_exchange is active (as in it is the one that calls this execution
+     * of packet_read, then don't redirect, as that would be an infinite loop!
+     */
+
+    if (session->state & LIBSSH2_STATE_EXCHANGING_KEYS &&
+        !(session->state & LIBSSH2_STATE_KEX_ACTIVE)) {
+
+        /* Whoever wants a packet won't get anything until the key re-exchange
+         * is done!
+         */
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Redirecting into the"
+                       " key re-exchange from _libssh2_transport_read");
+        rc = _libssh2_kex_exchange(session, 1, &session->startup_key_state);
+        if (rc)
+            return rc;
+    }
+
+    /*
+     * =============================== NOTE ===============================
+     * I know this is very ugly and not a really good use of "goto", but
+     * this case statement would be even uglier to do it any other way
+     */
+    if (session->readPack_state == libssh2_NB_state_jump1) {
+        session->readPack_state = libssh2_NB_state_idle;
+        encrypted = session->readPack_encrypted;
+        goto libssh2_transport_read_point1;
+    }
+
+    do {
+        if (session->socket_state == LIBSSH2_SOCKET_DISCONNECTED) {
+            return LIBSSH2_ERROR_NONE;
+        }
+
+        if (session->state & LIBSSH2_STATE_NEWKEYS) {
+            blocksize = session->remote.crypt->blocksize;
+        } else {
+            encrypted = 0;      /* not encrypted */
+            blocksize = 5;      /* not strictly true, but we can use 5 here to
+                                   make the checks below work fine still */
+        }
+
+        /* read/use a whole big chunk into a temporary area stored in
+           the LIBSSH2_SESSION struct. We will decrypt data from that
+           buffer into the packet buffer so this temp one doesn't have
+           to be able to keep a whole SSH packet, just be large enough
+           so that we can read big chunks from the network layer. */
+
+        /* how much data there is remaining in the buffer to deal with
+           before we should read more from the network */
+        remainbuf = p->writeidx - p->readidx;
+
+        /* if remainbuf turns negative we have a bad internal error */
+        assert(remainbuf >= 0);
+
+        if (remainbuf < blocksize) {
+            /* If we have less than a blocksize left, it is too
+               little data to deal with, read more */
+            ssize_t nread;
+
+            /* move any remainder to the start of the buffer so
+               that we can do a full refill */
+            if (remainbuf) {
+                memmove(p->buf, &p->buf[p->readidx], remainbuf);
+                p->readidx = 0;
+                p->writeidx = remainbuf;
+            } else {
+                /* nothing to move, just zero the indexes */
+                p->readidx = p->writeidx = 0;
+            }
+
+            /* now read a big chunk from the network into the temp buffer */
+            nread =
+                LIBSSH2_RECV(session, &p->buf[remainbuf],
+                              PACKETBUFSIZE - remainbuf,
+                              LIBSSH2_SOCKET_RECV_FLAGS(session));
+            if (nread <= 0) {
+                /* check if this is due to EAGAIN and return the special
+                   return code if so, error out normally otherwise */
+                if ((nread < 0) && (nread == -EAGAIN)) {
+                    session->socket_block_directions |=
+                        LIBSSH2_SESSION_BLOCK_INBOUND;
+                    return LIBSSH2_ERROR_EAGAIN;
+                }
+                _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                               "Error recving %d bytes (got %d)",
+                               PACKETBUFSIZE - remainbuf, -nread);
+                return LIBSSH2_ERROR_SOCKET_RECV;
+            }
+            _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                           "Recved %d/%d bytes to %p+%d", nread,
+                           PACKETBUFSIZE - remainbuf, p->buf, remainbuf);
+
+            debugdump(session, "libssh2_transport_read() raw",
+                      &p->buf[remainbuf], nread);
+            /* advance write pointer */
+            p->writeidx += nread;
+
+            /* update remainbuf counter */
+            remainbuf = p->writeidx - p->readidx;
+        }
+
+        /* how much data to deal with from the buffer */
+        numbytes = remainbuf;
+
+        if (!p->total_num) {
+            /* No payload package area allocated yet. To know the
+               size of this payload, we need to decrypt the first
+               blocksize data. */
+
+            if (numbytes < blocksize) {
+                /* we can't act on anything less than blocksize, but this
+                   check is only done for the initial block since once we have
+                   got the start of a block we can in fact deal with fractions
+                */
+                session->socket_block_directions |=
+                    LIBSSH2_SESSION_BLOCK_INBOUND;
+                return LIBSSH2_ERROR_EAGAIN;
+            }
+
+            if (encrypted) {
+                rc = decrypt(session, &p->buf[p->readidx], block, blocksize);
+                if (rc != LIBSSH2_ERROR_NONE) {
+                    return rc;
+                }
+                /* save the first 5 bytes of the decrypted package, to be
+                   used in the hash calculation later down. */
+                memcpy(p->init, &p->buf[p->readidx], 5);
+            } else {
+                /* the data is plain, just copy it verbatim to
+                   the working block buffer */
+                memcpy(block, &p->buf[p->readidx], blocksize);
+            }
+
+            /* advance the read pointer */
+            p->readidx += blocksize;
+
+            /* we now have the initial blocksize bytes decrypted,
+             * and we can extract packet and padding length from it
+             */
+            p->packet_length = _libssh2_ntohu32(block);
+            if (p->packet_length < 1)
+                return LIBSSH2_ERROR_DECRYPT;
+
+            p->padding_length = block[4];
+
+            /* total_num is the number of bytes following the initial
+               (5 bytes) packet length and padding length fields */
+            total_num =
+                p->packet_length - 1 +
+                (encrypted ? session->remote.mac->mac_len : 0);
+
+            /* RFC4253 section 6.1 Maximum Packet Length says:
+             *
+             * "All implementations MUST be able to process
+             * packets with uncompressed payload length of 32768
+             * bytes or less and total packet size of 35000 bytes
+             * or less (including length, padding length, payload,
+             * padding, and MAC.)."
+             */
+            if (total_num > LIBSSH2_PACKET_MAXPAYLOAD) {
+                return LIBSSH2_ERROR_OUT_OF_BOUNDARY;
+            }
+
+            /* Get a packet handle put data into. We get one to
+               hold all data, including padding and MAC. */
+            p->payload = LIBSSH2_ALLOC(session, total_num);
+            if (!p->payload) {
+                return LIBSSH2_ERROR_ALLOC;
+            }
+            p->total_num = total_num;
+            /* init write pointer to start of payload buffer */
+            p->wptr = p->payload;
+
+            if (blocksize > 5) {
+                /* copy the data from index 5 to the end of
+                   the blocksize from the temporary buffer to
+                   the start of the decrypted buffer */
+                memcpy(p->wptr, &block[5], blocksize - 5);
+                p->wptr += blocksize - 5;       /* advance write pointer */
+            }
+
+            /* init the data_num field to the number of bytes of
+               the package read so far */
+            p->data_num = p->wptr - p->payload;
+
+            /* we already dealt with a blocksize worth of data */
+            numbytes -= blocksize;
+        }
+
+        /* how much there is left to add to the current payload
+           package */
+        remainpack = p->total_num - p->data_num;
+
+        if (numbytes > remainpack) {
+            /* if we have more data in the buffer than what is going into this
+               particular packet, we limit this round to this packet only */
+            numbytes = remainpack;
+        }
+
+        if (encrypted) {
+            /* At the end of the incoming stream, there is a MAC,
+               and we don't want to decrypt that since we need it
+               "raw". We MUST however decrypt the padding data
+               since it is used for the hash later on. */
+            int skip = session->remote.mac->mac_len;
+
+            /* if what we have plus numbytes is bigger than the
+               total minus the skip margin, we should lower the
+               amount to decrypt even more */
+            if ((p->data_num + numbytes) > (p->total_num - skip)) {
+                numdecrypt = (p->total_num - skip) - p->data_num;
+            } else {
+                int frac;
+                numdecrypt = numbytes;
+                frac = numdecrypt % blocksize;
+                if (frac) {
+                    /* not an aligned amount of blocks,
+                       align it */
+                    numdecrypt -= frac;
+                    /* and make it no unencrypted data
+                       after it */
+                    numbytes = 0;
+                }
+            }
+        } else {
+            /* unencrypted data should not be decrypted at all */
+            numdecrypt = 0;
+        }
+
+        /* if there are bytes to decrypt, do that */
+        if (numdecrypt > 0) {
+            /* now decrypt the lot */
+            rc = decrypt(session, &p->buf[p->readidx], p->wptr, numdecrypt);
+            if (rc != LIBSSH2_ERROR_NONE) {
+                return rc;
+            }
+
+            /* advance the read pointer */
+            p->readidx += numdecrypt;
+            /* advance write pointer */
+            p->wptr += numdecrypt;
+            /* increse data_num */
+            p->data_num += numdecrypt;
+
+            /* bytes left to take care of without decryption */
+            numbytes -= numdecrypt;
+        }
+
+        /* if there are bytes to copy that aren't decrypted, simply
+           copy them as-is to the target buffer */
+        if (numbytes > 0) {
+            memcpy(p->wptr, &p->buf[p->readidx], numbytes);
+
+            /* advance the read pointer */
+            p->readidx += numbytes;
+            /* advance write pointer */
+            p->wptr += numbytes;
+            /* increse data_num */
+            p->data_num += numbytes;
+        }
+
+        /* now check how much data there's left to read to finish the
+           current packet */
+        remainpack = p->total_num - p->data_num;
+
+        if (!remainpack) {
+            /* we have a full packet */
+          libssh2_transport_read_point1:
+            rc = fullpacket(session, encrypted);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+
+                if (session->packAdd_state != libssh2_NB_state_idle)
+                {
+                    /* fullpacket only returns LIBSSH2_ERROR_EAGAIN if
+                     * libssh2_packet_add returns LIBSSH2_ERROR_EAGAIN. If that
+                     * returns LIBSSH2_ERROR_EAGAIN but the packAdd_state is idle,
+                     * then the packet has been added to the brigade, but some
+                     * immediate action that was taken based on the packet
+                     * type (such as key re-exchange) is not yet complete.
+                     * Clear the way for a new packet to be read in.
+                     */
+                    session->readPack_encrypted = encrypted;
+                    session->readPack_state = libssh2_NB_state_jump1;
+                }
+
+                return rc;
+            }
+
+            p->total_num = 0;   /* no packet buffer available */
+
+            return rc;
+        }
+    } while (1);                /* loop */
+
+    return LIBSSH2_ERROR_SOCKET_RECV; /* we never reach this point */
+}
+
+static int
+send_existing(LIBSSH2_SESSION *session, const unsigned char *data,
+              size_t data_len, ssize_t *ret)
+{
+    ssize_t rc;
+    ssize_t length;
+    struct transportpacket *p = &session->packet;
+
+    if (!p->olen) {
+        *ret = 0;
+        return LIBSSH2_ERROR_NONE;
+    }
+
+    /* send as much as possible of the existing packet */
+    if ((data != p->odata) || (data_len != p->olen)) {
+        /* When we are about to complete the sending of a packet, it is vital
+           that the caller doesn't try to send a new/different packet since
+           we don't add this one up until the previous one has been sent. To
+           make the caller really notice his/hers flaw, we return error for
+           this case */
+        return LIBSSH2_ERROR_BAD_USE;
+    }
+
+    *ret = 1;                   /* set to make our parent return */
+
+    /* number of bytes left to send */
+    length = p->ototal_num - p->osent;
+
+    rc = LIBSSH2_SEND(session, &p->outbuf[p->osent], length,
+                       LIBSSH2_SOCKET_SEND_FLAGS(session));
+    if (rc < 0)
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Error sending %d bytes: %d", length, -rc);
+    else {
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Sent %d/%d bytes at %p+%d", rc, length, p->outbuf,
+                       p->osent);
+        debugdump(session, "libssh2_transport_write send()",
+                  &p->outbuf[p->osent], rc);
+    }
+
+    if (rc == length) {
+        /* the remainder of the package was sent */
+        p->ototal_num = 0;
+        p->olen = 0;
+        /* we leave *ret set so that the parent returns as we MUST return back
+           a send success now, so that we don't risk sending EAGAIN later
+           which then would confuse the parent function */
+        return LIBSSH2_ERROR_NONE;
+
+    }
+    else if (rc < 0) {
+        /* nothing was sent */
+        if (rc != -EAGAIN)
+            /* send failure! */
+            return LIBSSH2_ERROR_SOCKET_SEND;
+
+        session->socket_block_directions |= LIBSSH2_SESSION_BLOCK_OUTBOUND;
+        return LIBSSH2_ERROR_EAGAIN;
+    }
+
+    p->osent += rc;         /* we sent away this much data */
+
+    return rc < length ? LIBSSH2_ERROR_EAGAIN : LIBSSH2_ERROR_NONE;
+}
+
+/*
+ * libssh2_transport_send
+ *
+ * Send a packet, encrypting it and adding a MAC code if necessary
+ * Returns 0 on success, non-zero on failure.
+ *
+ * The data is provided as _two_ data areas that are combined by this
+ * function.  The 'data' part is sent immediately before 'data2'. 'data2' may
+ * be set to NULL to only use a single part.
+ *
+ * Returns LIBSSH2_ERROR_EAGAIN if it would block or if the whole packet was
+ * not sent yet. If it does so, the caller should call this function again as
+ * soon as it is likely that more data can be sent, and this function MUST
+ * then be called with the same argument set (same data pointer and same
+ * data_len) until ERROR_NONE or failure is returned.
+ *
+ * This function DOES NOT call _libssh2_error() on any errors.
+ */
+int _libssh2_transport_send(LIBSSH2_SESSION *session,
+                            const unsigned char *data, size_t data_len,
+                            const unsigned char *data2, size_t data2_len)
+{
+    int blocksize =
+        (session->state & LIBSSH2_STATE_NEWKEYS) ?
+        session->local.crypt->blocksize : 8;
+    int padding_length;
+    size_t packet_length;
+    int total_length;
+#ifdef RANDOM_PADDING
+    int rand_max;
+    int seed = data[0];         /* FIXME: make this random */
+#endif
+    struct transportpacket *p = &session->packet;
+    int encrypted;
+    int compressed;
+    ssize_t ret;
+    int rc;
+    const unsigned char *orgdata = data;
+    size_t orgdata_len = data_len;
+
+    /*
+     * If the last read operation was interrupted in the middle of a key
+     * exchange, we must complete that key exchange before continuing to write
+     * further data.
+     *
+     * See the similar block in _libssh2_transport_read for more details.
+     */
+    if (session->state & LIBSSH2_STATE_EXCHANGING_KEYS &&
+        !(session->state & LIBSSH2_STATE_KEX_ACTIVE)) {
+        /* Don't write any new packets if we're still in the middle of a key
+         * exchange. */
+        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Redirecting into the"
+                       " key re-exchange from _libssh2_transport_send");
+        rc = _libssh2_kex_exchange(session, 1, &session->startup_key_state);
+        if (rc)
+            return rc;
+    }
+
+    debugdump(session, "libssh2_transport_write plain", data, data_len);
+    if(data2)
+        debugdump(session, "libssh2_transport_write plain2", data2, data2_len);
+
+    /* FIRST, check if we have a pending write to complete. send_existing
+       only sanity-check data and data_len and not data2 and data2_len!! */
+    rc = send_existing(session, data, data_len, &ret);
+    if (rc)
+        return rc;
+
+    session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND;
+
+    if (ret)
+        /* set by send_existing if data was sent */
+        return rc;
+
+    encrypted = (session->state & LIBSSH2_STATE_NEWKEYS) ? 1 : 0;
+
+    compressed =
+        session->local.comp != NULL &&
+        session->local.comp->compress &&
+        ((session->state & LIBSSH2_STATE_AUTHENTICATED) ||
+         session->local.comp->use_in_auth);
+
+    if (encrypted && compressed) {
+        /* the idea here is that these function must fail if the output gets
+           larger than what fits in the assigned buffer so thus they don't
+           check the input size as we don't know how much it compresses */
+        size_t dest_len = MAX_SSH_PACKET_LEN-5-256;
+        size_t dest2_len = dest_len;
+
+        /* compress directly to the target buffer */
+        rc = session->local.comp->comp(session,
+                                       &p->outbuf[5], &dest_len,
+                                       data, data_len,
+                                       &session->local.comp_abstract);
+        if(rc)
+            return rc;     /* compression failure */
+
+        if(data2 && data2_len) {
+            /* compress directly to the target buffer right after where the
+               previous call put data */
+            dest2_len -= dest_len;
+
+            rc = session->local.comp->comp(session,
+                                           &p->outbuf[5+dest_len], &dest2_len,
+                                           data2, data2_len,
+                                           &session->local.comp_abstract);
+        }
+        else
+            dest2_len = 0;
+        if(rc)
+            return rc;     /* compression failure */
+
+        data_len = dest_len + dest2_len; /* use the combined length */
+    }
+    else {
+        if((data_len + data2_len) >= (MAX_SSH_PACKET_LEN-0x100))
+            /* too large packet, return error for this until we make this
+               function split it up and send multiple SSH packets */
+            return LIBSSH2_ERROR_INVAL;
+
+        /* copy the payload data */
+        memcpy(&p->outbuf[5], data, data_len);
+        if(data2 && data2_len)
+            memcpy(&p->outbuf[5+data_len], data2, data2_len);
+        data_len += data2_len; /* use the combined length */
+    }
+
+
+    /* RFC4253 says: Note that the length of the concatenation of
+       'packet_length', 'padding_length', 'payload', and 'random padding'
+       MUST be a multiple of the cipher block size or 8, whichever is
+       larger. */
+
+    /* Plain math: (4 + 1 + packet_length + padding_length) % blocksize == 0 */
+
+    packet_length = data_len + 1 + 4;   /* 1 is for padding_length field
+                                           4 for the packet_length field */
+
+    /* at this point we have it all except the padding */
+
+    /* first figure out our minimum padding amount to make it an even
+       block size */
+    padding_length = blocksize - (packet_length % blocksize);
+
+    /* if the padding becomes too small we add another blocksize worth
+       of it (taken from the original libssh2 where it didn't have any
+       real explanation) */
+    if (padding_length < 4) {
+        padding_length += blocksize;
+    }
+#ifdef RANDOM_PADDING
+    /* FIXME: we can add padding here, but that also makes the packets
+       bigger etc */
+
+    /* now we can add 'blocksize' to the padding_length N number of times
+       (to "help thwart traffic analysis") but it must be less than 255 in
+       total */
+    rand_max = (255 - padding_length) / blocksize + 1;
+    padding_length += blocksize * (seed % rand_max);
+#endif
+
+    packet_length += padding_length;
+
+    /* append the MAC length to the total_length size */
+    total_length =
+        packet_length + (encrypted ? session->local.mac->mac_len : 0);
+
+    /* store packet_length, which is the size of the whole packet except
+       the MAC and the packet_length field itself */
+    _libssh2_htonu32(p->outbuf, packet_length - 4);
+    /* store padding_length */
+    p->outbuf[4] = padding_length;
+
+    /* fill the padding area with random junk */
+    _libssh2_random(p->outbuf + 5 + data_len, padding_length);
+
+    if (encrypted) {
+        size_t i;
+
+        /* Calculate MAC hash. Put the output at index packet_length,
+           since that size includes the whole packet. The MAC is
+           calculated on the entire unencrypted packet, including all
+           fields except the MAC field itself. */
+        session->local.mac->hash(session, p->outbuf + packet_length,
+                                 session->local.seqno, p->outbuf,
+                                 packet_length, NULL, 0,
+                                 &session->local.mac_abstract);
+
+        /* Encrypt the whole packet data, one block size at a time.
+           The MAC field is not encrypted. */
+        for(i = 0; i < packet_length; i += session->local.crypt->blocksize) {
+            unsigned char *ptr = &p->outbuf[i];
+            if (session->local.crypt->crypt(session, ptr,
+                                            session->local.crypt->blocksize,
+                                            &session->local.crypt_abstract))
+                return LIBSSH2_ERROR_ENCRYPT;     /* encryption failure */
+        }
+    }
+
+    session->local.seqno++;
+
+    ret = LIBSSH2_SEND(session, p->outbuf, total_length,
+                        LIBSSH2_SOCKET_SEND_FLAGS(session));
+    if (ret < 0)
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
+                       "Error sending %d bytes: %d", total_length, -ret);
+    else {
+        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET, "Sent %d/%d bytes at %p",
+                       ret, total_length, p->outbuf);
+        debugdump(session, "libssh2_transport_write send()", p->outbuf, ret);
+    }
+
+    if (ret != total_length) {
+        if (ret >= 0 || ret == -EAGAIN) {
+            /* the whole packet could not be sent, save the rest */
+            session->socket_block_directions |= LIBSSH2_SESSION_BLOCK_OUTBOUND;
+            p->odata = orgdata;
+            p->olen = orgdata_len;
+            p->osent = ret <= 0 ? 0 : ret;
+            p->ototal_num = total_length;
+            return LIBSSH2_ERROR_EAGAIN;
+        }
+        return LIBSSH2_ERROR_SOCKET_SEND;
+    }
+
+    /* the whole thing got sent away */
+    p->odata = NULL;
+    p->olen = 0;
+
+    return LIBSSH2_ERROR_NONE;         /* all is good */
+}
diff --git a/pgadmin/libssh2/userauth.c b/pgadmin/libssh2/userauth.c
new file mode 100644
index 0000000..a0733d5
--- /dev/null
+++ b/pgadmin/libssh2/userauth.c
@@ -0,0 +1,1687 @@
+/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2005 Mikhail Gusarov <dottedmag@dottedmag.net>
+ * Copyright (c) 2009-2011 by Daniel Stenberg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include "libssh2_priv.h"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <assert.h>
+
+/* Needed for struct iovec on some platforms */
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#include "transport.h"
+#include "session.h"
+#include "userauth.h"
+
+/* libssh2_userauth_list
+ *
+ * List authentication methods
+ * Will yield successful login if "none" happens to be allowable for this user
+ * Not a common configuration for any SSH server though
+ * username should be NULL, or a null terminated string
+ */
+static char *userauth_list(LIBSSH2_SESSION *session, const char *username,
+                           unsigned int username_len)
+{
+    static const unsigned char reply_codes[3] =
+        { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, 0 };
+    /* packet_type(1) + username_len(4) + service_len(4) +
+       service(14)"ssh-connection" + method_len(4) = 27 */
+    unsigned long methods_len;
+    unsigned char *s;
+    int rc;
+
+    if (session->userauth_list_state == libssh2_NB_state_idle) {
+        /* Zero the whole thing out */
+        memset(&session->userauth_list_packet_requirev_state, 0,
+               sizeof(session->userauth_list_packet_requirev_state));
+
+        session->userauth_list_data_len = username_len + 27;
+
+        s = session->userauth_list_data =
+            LIBSSH2_ALLOC(session, session->userauth_list_data_len);
+        if (!session->userauth_list_data) {
+            _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                           "Unable to allocate memory for userauth_list");
+            return NULL;
+        }
+
+        *(s++) = SSH_MSG_USERAUTH_REQUEST;
+        _libssh2_store_str(&s, username, username_len);
+        _libssh2_store_str(&s, "ssh-connection", 14);
+        _libssh2_store_u32(&s, 4); /* send "none" separately */
+
+        session->userauth_list_state = libssh2_NB_state_created;
+    }
+
+    if (session->userauth_list_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, session->userauth_list_data,
+                                     session->userauth_list_data_len,
+                                     (unsigned char *)"none", 4);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block requesting userauth list");
+            return NULL;
+        }
+        /* now free the packet that was sent */
+        LIBSSH2_FREE(session, session->userauth_list_data);
+        session->userauth_list_data = NULL;
+
+        if (rc) {
+            _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                           "Unable to send userauth-none request");
+            session->userauth_list_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+
+        session->userauth_list_state = libssh2_NB_state_sent;
+    }
+
+    if (session->userauth_list_state == libssh2_NB_state_sent) {
+        rc = _libssh2_packet_requirev(session, reply_codes,
+                                      &session->userauth_list_data,
+                                      &session->userauth_list_data_len, 0,
+                                      NULL, 0,
+                                      &session->userauth_list_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                           "Would block requesting userauth list");
+            return NULL;
+        } else if (rc) {
+            _libssh2_error(session, rc, "Failed getting response");
+            session->userauth_list_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+
+        if (session->userauth_list_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+            /* Wow, who'dve thought... */
+            _libssh2_error(session, LIBSSH2_ERROR_NONE, "No error");
+            LIBSSH2_FREE(session, session->userauth_list_data);
+            session->userauth_list_data = NULL;
+            session->state |= LIBSSH2_STATE_AUTHENTICATED;
+            session->userauth_list_state = libssh2_NB_state_idle;
+            return NULL;
+        }
+
+        methods_len = _libssh2_ntohu32(session->userauth_list_data + 1);
+
+        /* Do note that the memory areas overlap! */
+        memmove(session->userauth_list_data, session->userauth_list_data + 5,
+                methods_len);
+        session->userauth_list_data[methods_len] = '\0';
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Permitted auth methods: %s",
+                       session->userauth_list_data);
+    }
+
+    session->userauth_list_state = libssh2_NB_state_idle;
+    return (char *) session->userauth_list_data;
+}
+
+/* libssh2_userauth_list
+ *
+ * List authentication methods
+ * Will yield successful login if "none" happens to be allowable for this user
+ * Not a common configuration for any SSH server though
+ * username should be NULL, or a null terminated string
+ */
+LIBSSH2_API char *
+libssh2_userauth_list(LIBSSH2_SESSION * session, const char *user,
+                      unsigned int user_len)
+{
+    char *ptr;
+    BLOCK_ADJUST_ERRNO(ptr, session,
+                       userauth_list(session, user, user_len));
+    return ptr;
+}
+
+/*
+ * libssh2_userauth_authenticated
+ *
+ * Returns: 0 if not yet authenticated
+ *          1 if already authenticated
+ */
+LIBSSH2_API int
+libssh2_userauth_authenticated(LIBSSH2_SESSION * session)
+{
+    return (session->state & LIBSSH2_STATE_AUTHENTICATED)?1:0;
+}
+
+
+
+/* userauth_password
+ * Plain ol' login
+ */
+static int
+userauth_password(LIBSSH2_SESSION *session,
+                  const char *username, unsigned int username_len,
+                  const unsigned char *password, unsigned int password_len,
+                  LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)))
+{
+    unsigned char *s;
+    static const unsigned char reply_codes[4] =
+        { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE,
+          SSH_MSG_USERAUTH_PASSWD_CHANGEREQ, 0
+        };
+    int rc;
+
+    if (session->userauth_pswd_state == libssh2_NB_state_idle) {
+        /* Zero the whole thing out */
+        memset(&session->userauth_pswd_packet_requirev_state, 0,
+               sizeof(session->userauth_pswd_packet_requirev_state));
+
+        /*
+         * 40 = acket_type(1) + username_len(4) + service_len(4) +
+         * service(14)"ssh-connection" + method_len(4) + method(8)"password" +
+         * chgpwdbool(1) + password_len(4) */
+        session->userauth_pswd_data_len = username_len + 40;
+
+        session->userauth_pswd_data0 = ~SSH_MSG_USERAUTH_PASSWD_CHANGEREQ;
+
+        /* TODO: remove this alloc with a fixed buffer in the session
+           struct */
+        s = session->userauth_pswd_data =
+            LIBSSH2_ALLOC(session, session->userauth_pswd_data_len);
+        if (!session->userauth_pswd_data) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "userauth-password request");
+        }
+
+        *(s++) = SSH_MSG_USERAUTH_REQUEST;
+        _libssh2_store_str(&s, username, username_len);
+        _libssh2_store_str(&s, "ssh-connection", sizeof("ssh-connection") - 1);
+        _libssh2_store_str(&s, "password", sizeof("password") - 1);
+        *s++ = '\0';
+        _libssh2_store_u32(&s, password_len);
+        /* 'password' is sent separately */
+
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Attempting to login using password authentication");
+
+        session->userauth_pswd_state = libssh2_NB_state_created;
+    }
+
+    if (session->userauth_pswd_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, session->userauth_pswd_data,
+                                     session->userauth_pswd_data_len,
+                                     password, password_len);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                  "Would block writing password request");
+        }
+
+        /* now free the sent packet */
+        LIBSSH2_FREE(session, session->userauth_pswd_data);
+        session->userauth_pswd_data = NULL;
+
+        if (rc) {
+            session->userauth_pswd_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send userauth-password request");
+        }
+
+        session->userauth_pswd_state = libssh2_NB_state_sent;
+    }
+
+  password_response:
+
+    if ((session->userauth_pswd_state == libssh2_NB_state_sent)
+        || (session->userauth_pswd_state == libssh2_NB_state_sent1)
+        || (session->userauth_pswd_state == libssh2_NB_state_sent2)) {
+        if (session->userauth_pswd_state == libssh2_NB_state_sent) {
+            rc = _libssh2_packet_requirev(session, reply_codes,
+                                          &session->userauth_pswd_data,
+                                          &session->userauth_pswd_data_len,
+                                          0, NULL, 0,
+                                          &session->
+                                          userauth_pswd_packet_requirev_state);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                      "Would block waiting");
+            } else if (rc) {
+                session->userauth_pswd_state = libssh2_NB_state_idle;
+                return _libssh2_error(session, LIBSSH2_ERROR_TIMEOUT,
+                                      "Would block waiting");
+            }
+
+            if (session->userauth_pswd_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+                _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                               "Password authentication successful");
+                LIBSSH2_FREE(session, session->userauth_pswd_data);
+                session->userauth_pswd_data = NULL;
+                session->state |= LIBSSH2_STATE_AUTHENTICATED;
+                session->userauth_pswd_state = libssh2_NB_state_idle;
+                return 0;
+            } else if (session->userauth_pswd_data[0] == SSH_MSG_USERAUTH_FAILURE) {
+                _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                               "Password authentication failed");
+                LIBSSH2_FREE(session, session->userauth_pswd_data);
+                session->userauth_pswd_data = NULL;
+                session->userauth_pswd_state = libssh2_NB_state_idle;
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_AUTHENTICATION_FAILED,
+                                      "Authentication failed "
+                                      "(username/password)");
+            }
+
+            session->userauth_pswd_newpw = NULL;
+            session->userauth_pswd_newpw_len = 0;
+
+            session->userauth_pswd_state = libssh2_NB_state_sent1;
+        }
+
+        if ((session->userauth_pswd_data[0] ==
+             SSH_MSG_USERAUTH_PASSWD_CHANGEREQ)
+            || (session->userauth_pswd_data0 ==
+                SSH_MSG_USERAUTH_PASSWD_CHANGEREQ)) {
+            session->userauth_pswd_data0 = SSH_MSG_USERAUTH_PASSWD_CHANGEREQ;
+
+            if ((session->userauth_pswd_state == libssh2_NB_state_sent1) ||
+                (session->userauth_pswd_state == libssh2_NB_state_sent2)) {
+                if (session->userauth_pswd_state == libssh2_NB_state_sent1) {
+                    _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                                   "Password change required");
+                    LIBSSH2_FREE(session, session->userauth_pswd_data);
+                    session->userauth_pswd_data = NULL;
+                }
+                if (passwd_change_cb) {
+                    if (session->userauth_pswd_state == libssh2_NB_state_sent1) {
+                        passwd_change_cb(session,
+                                         &session->userauth_pswd_newpw,
+                                         &session->userauth_pswd_newpw_len,
+                                         &session->abstract);
+                        if (!session->userauth_pswd_newpw) {
+                            return _libssh2_error(session,
+                                                  LIBSSH2_ERROR_PASSWORD_EXPIRED,
+                                                  "Password expired, and "
+                                                  "callback failed");
+                        }
+
+                        /* basic data_len + newpw_len(4) */
+                        session->userauth_pswd_data_len =
+                            username_len + password_len + 44;
+
+                        s = session->userauth_pswd_data =
+                            LIBSSH2_ALLOC(session,
+                                          session->userauth_pswd_data_len);
+                        if (!session->userauth_pswd_data) {
+                            LIBSSH2_FREE(session,
+                                         session->userauth_pswd_newpw);
+                            session->userauth_pswd_newpw = NULL;
+                            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                                  "Unable to allocate memory "
+                                                  "for userauth password "
+                                                  "change request");
+                        }
+
+                        *(s++) = SSH_MSG_USERAUTH_REQUEST;
+                        _libssh2_store_str(&s, username, username_len);
+                        _libssh2_store_str(&s, "ssh-connection",
+                                           sizeof("ssh-connection") - 1);
+                        _libssh2_store_str(&s, "password",
+                                           sizeof("password") - 1);
+                        *s++ = 0x01;
+                        _libssh2_store_str(&s, (char *)password, password_len);
+                        _libssh2_store_u32(&s,
+                                           session->userauth_pswd_newpw_len);
+                        /* send session->userauth_pswd_newpw separately */
+
+                        session->userauth_pswd_state = libssh2_NB_state_sent2;
+                    }
+
+                    if (session->userauth_pswd_state == libssh2_NB_state_sent2) {
+                        rc = _libssh2_transport_send(session,
+                                                     session->userauth_pswd_data,
+                                                     session->userauth_pswd_data_len,
+                                                     (unsigned char *)
+                                                     session->userauth_pswd_newpw,
+                                                     session->userauth_pswd_newpw_len);
+                        if (rc == LIBSSH2_ERROR_EAGAIN) {
+                            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                                  "Would block waiting");
+                        }
+
+                        /* free the allocated packets again */
+                        LIBSSH2_FREE(session, session->userauth_pswd_data);
+                        session->userauth_pswd_data = NULL;
+                        LIBSSH2_FREE(session, session->userauth_pswd_newpw);
+                        session->userauth_pswd_newpw = NULL;
+
+                        if (rc) {
+                            return _libssh2_error(session,
+                                                  LIBSSH2_ERROR_SOCKET_SEND,
+                                                  "Unable to send userauth "
+                                                  "password-change request");
+                        }
+
+                        /*
+                         * Ugliest use of goto ever.  Blame it on the
+                         * askN => requirev migration.
+                         */
+                        session->userauth_pswd_state = libssh2_NB_state_sent;
+                        goto password_response;
+                    }
+                }
+            } else {
+                session->userauth_pswd_state = libssh2_NB_state_idle;
+                return _libssh2_error(session, LIBSSH2_ERROR_PASSWORD_EXPIRED,
+                                      "Password Expired, and no callback "
+                                      "specified");
+            }
+        }
+    }
+
+    /* FAILURE */
+    LIBSSH2_FREE(session, session->userauth_pswd_data);
+    session->userauth_pswd_data = NULL;
+    session->userauth_pswd_state = libssh2_NB_state_idle;
+
+    return _libssh2_error(session, LIBSSH2_ERROR_AUTHENTICATION_FAILED,
+                          "Authentication failed");
+}
+
+/*
+ * libssh2_userauth_password_ex
+ *
+ * Plain ol' login
+ */
+
+LIBSSH2_API int
+libssh2_userauth_password_ex(LIBSSH2_SESSION *session, const char *username,
+                             unsigned int username_len, const char *password,
+                             unsigned int password_len,
+                             LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)))
+{
+    int rc;
+    BLOCK_ADJUST(rc, session,
+                 userauth_password(session, username, username_len,
+                                   (unsigned char *)password, password_len,
+                                   passwd_change_cb));
+    return rc;
+}
+
+/*
+ * file_read_publickey
+ *
+ * Read a public key from an id_???.pub style file
+ *
+ * Returns an allocated string containing the decoded key in *pubkeydata
+ * on success.
+ * Returns an allocated string containing the key method (e.g. "ssh-dss")
+ * in method on success.
+ */
+static int
+file_read_publickey(LIBSSH2_SESSION * session, unsigned char **method,
+                    size_t *method_len,
+                    unsigned char **pubkeydata,
+                    size_t *pubkeydata_len,
+                    const char *pubkeyfile)
+{
+    FILE *fd;
+    char c;
+    unsigned char *pubkey = NULL, *sp1, *sp2, *tmp;
+    size_t pubkey_len = 0;
+    unsigned int tmp_len;
+
+    _libssh2_debug(session, LIBSSH2_TRACE_AUTH, "Loading public key file: %s",
+                   pubkeyfile);
+    /* Read Public Key */
+    fd = fopen(pubkeyfile, "r");
+    if (!fd) {
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Unable to open public key file");
+    }
+    while (!feof(fd) && 1 == fread(&c, 1, 1, fd) && c != '\r' && c != '\n')
+        pubkey_len++;
+    if (feof(fd)) {
+        /* the last character was EOF */
+        pubkey_len--;
+    }
+    rewind(fd);
+
+    if (pubkey_len <= 1) {
+        fclose(fd);
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Invalid data in public key file");
+    }
+
+    pubkey = LIBSSH2_ALLOC(session, pubkey_len);
+    if (!pubkey) {
+        fclose(fd);
+        return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                              "Unable to allocate memory for public key data");
+    }
+    if (fread(pubkey, 1, pubkey_len, fd) != pubkey_len) {
+        LIBSSH2_FREE(session, pubkey);
+        fclose(fd);
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Unable to read public key from file");
+    }
+    fclose(fd);
+    /*
+     * Remove trailing whitespace
+     */
+    while (pubkey_len && isspace(pubkey[pubkey_len - 1]))
+        pubkey_len--;
+
+    if (!pubkey_len) {
+        LIBSSH2_FREE(session, pubkey);
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Missing public key data");
+    }
+
+    if ((sp1 = memchr(pubkey, ' ', pubkey_len)) == NULL) {
+        LIBSSH2_FREE(session, pubkey);
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Invalid public key data");
+    }
+
+    sp1++;
+
+    if ((sp2 = memchr(sp1, ' ', pubkey_len - (sp1 - pubkey - 1))) == NULL) {
+        /* Assume that the id string is missing, but that it's okay */
+        sp2 = pubkey + pubkey_len;
+    }
+
+    if (libssh2_base64_decode(session, (char **) &tmp, &tmp_len,
+                              (char *) sp1, sp2 - sp1)) {
+        LIBSSH2_FREE(session, pubkey);
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Invalid key data, not base64 encoded");
+    }
+
+    /* Wasting some bytes here (okay, more than some), but since it's likely
+     * to be freed soon anyway, we'll just avoid the extra free/alloc and call
+     * it a wash */
+    *method = pubkey;
+    *method_len = sp1 - pubkey - 1;
+
+    *pubkeydata = tmp;
+    *pubkeydata_len = tmp_len;
+
+    return 0;
+}
+
+
+
+/* libssh2_file_read_privatekey
+ * Read a PEM encoded private key from an id_??? style file
+ */
+static int
+file_read_privatekey(LIBSSH2_SESSION * session,
+                     const LIBSSH2_HOSTKEY_METHOD ** hostkey_method,
+                     void **hostkey_abstract,
+                     const unsigned char *method, int method_len,
+                     const char *privkeyfile, const char *passphrase)
+{
+    const LIBSSH2_HOSTKEY_METHOD **hostkey_methods_avail =
+        libssh2_hostkey_methods();
+
+    _libssh2_debug(session, LIBSSH2_TRACE_AUTH, "Loading private key file: %s",
+                   privkeyfile);
+    *hostkey_method = NULL;
+    *hostkey_abstract = NULL;
+    while (*hostkey_methods_avail && (*hostkey_methods_avail)->name) {
+        if ((*hostkey_methods_avail)->initPEM
+            && strncmp((*hostkey_methods_avail)->name, (const char *) method,
+                       method_len) == 0) {
+            *hostkey_method = *hostkey_methods_avail;
+            break;
+        }
+        hostkey_methods_avail++;
+    }
+    if (!*hostkey_method) {
+        return _libssh2_error(session, LIBSSH2_ERROR_METHOD_NONE,
+                              "No handler for specified private key");
+    }
+
+    if ((*hostkey_method)->
+        initPEM(session, privkeyfile, (unsigned char *) passphrase,
+                hostkey_abstract)) {
+        return _libssh2_error(session, LIBSSH2_ERROR_FILE,
+                              "Unable to initialize private key from file");
+    }
+
+    return 0;
+}
+
+struct privkey_file {
+    const char *filename;
+    const char *passphrase;
+};
+
+static int
+sign_fromfile(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
+              const unsigned char *data, size_t data_len, void **abstract)
+{
+    struct privkey_file *privkey_file = (struct privkey_file *) (*abstract);
+    const LIBSSH2_HOSTKEY_METHOD *privkeyobj;
+    void *hostkey_abstract;
+    struct iovec datavec;
+    int rc;
+
+    rc = file_read_privatekey(session, &privkeyobj, &hostkey_abstract,
+                              session->userauth_pblc_method,
+                              session->userauth_pblc_method_len,
+                              privkey_file->filename,
+                              privkey_file->passphrase);
+    if(rc)
+        return rc;
+
+    datavec.iov_base = (void *)data;
+    datavec.iov_len  = data_len;
+
+    if (privkeyobj->signv(session, sig, sig_len, 1, &datavec,
+                          &hostkey_abstract)) {
+        if (privkeyobj->dtor) {
+            privkeyobj->dtor(session, abstract);
+        }
+        return -1;
+    }
+
+    if (privkeyobj->dtor) {
+        privkeyobj->dtor(session, &hostkey_abstract);
+    }
+    return 0;
+}
+
+
+
+/* userauth_hostbased_fromfile
+ * Authenticate using a keypair found in the named files
+ */
+static int
+userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
+                            const char *username, size_t username_len,
+                            const char *publickey, const char *privatekey,
+                            const char *passphrase, const char *hostname,
+                            size_t hostname_len,
+                            const char *local_username,
+                            size_t local_username_len)
+{
+    int rc;
+
+    if (session->userauth_host_state == libssh2_NB_state_idle) {
+        const LIBSSH2_HOSTKEY_METHOD *privkeyobj;
+        unsigned char *pubkeydata, *sig;
+        size_t pubkeydata_len;
+        size_t sig_len;
+        void *abstract;
+        unsigned char buf[5];
+        struct iovec datavec[4];
+
+        /* Zero the whole thing out */
+        memset(&session->userauth_host_packet_requirev_state, 0,
+               sizeof(session->userauth_host_packet_requirev_state));
+
+        if (publickey) {
+            rc = file_read_publickey(session, &session->userauth_host_method,
+                                     &session->userauth_host_method_len,
+                                     &pubkeydata, &pubkeydata_len, publickey);
+            if(rc)
+                /* Note: file_read_publickey() calls _libssh2_error() */
+                return rc;
+        }
+        else {
+            /* Compute public key from private key. */
+            rc = _libssh2_pub_priv_keyfile(session,
+                                           &session->userauth_host_method,
+                                           &session->userauth_host_method_len,
+                                           &pubkeydata, &pubkeydata_len,
+                                           privatekey, passphrase);
+            if (rc)
+                /* libssh2_pub_priv_keyfile calls _libssh2_error() */
+                return rc;
+        }
+
+        /*
+         * 52 = packet_type(1) + username_len(4) + servicename_len(4) +
+         * service_name(14)"ssh-connection" + authmethod_len(4) +
+         * authmethod(9)"hostbased" + method_len(4) + pubkeydata_len(4) +
+         * hostname_len(4) + local_username_len(4)
+         */
+        session->userauth_host_packet_len =
+            username_len + session->userauth_host_method_len + hostname_len +
+            local_username_len + pubkeydata_len + 52;
+
+        /*
+         * Preallocate space for an overall length,  method name again,
+         * and the signature, which won't be any larger than the size of
+         * the publickeydata itself
+         */
+        session->userauth_host_s = session->userauth_host_packet =
+            LIBSSH2_ALLOC(session,
+                          session->userauth_host_packet_len + 4 +
+                          (4 + session->userauth_host_method_len) +
+                          (4 + pubkeydata_len));
+        if (!session->userauth_host_packet) {
+            LIBSSH2_FREE(session, session->userauth_host_method);
+            session->userauth_host_method = NULL;
+            LIBSSH2_FREE(session, pubkeydata);
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Out of memory");
+        }
+
+        *(session->userauth_host_s++) = SSH_MSG_USERAUTH_REQUEST;
+        _libssh2_store_str(&session->userauth_host_s, username, username_len);
+        _libssh2_store_str(&session->userauth_host_s, "ssh-connection", 14);
+        _libssh2_store_str(&session->userauth_host_s, "hostbased", 9);
+        _libssh2_store_str(&session->userauth_host_s,
+                           (const char *)session->userauth_host_method,
+                           session->userauth_host_method_len);
+        _libssh2_store_str(&session->userauth_host_s, (const char *)pubkeydata,
+                           pubkeydata_len);
+        LIBSSH2_FREE(session, pubkeydata);
+        _libssh2_store_str(&session->userauth_host_s, hostname, hostname_len);
+        _libssh2_store_str(&session->userauth_host_s, local_username,
+                           local_username_len);
+
+        rc = file_read_privatekey(session, &privkeyobj, &abstract,
+                                  session->userauth_host_method,
+                                  session->userauth_host_method_len,
+                                  privatekey, passphrase);
+        if(rc) {
+            /* Note: file_read_privatekey() calls _libssh2_error() */
+            LIBSSH2_FREE(session, session->userauth_host_method);
+            session->userauth_host_method = NULL;
+            LIBSSH2_FREE(session, session->userauth_host_packet);
+            session->userauth_host_packet = NULL;
+            return rc;
+        }
+
+        _libssh2_htonu32(buf, session->session_id_len);
+        datavec[0].iov_base = (void *)buf;
+        datavec[0].iov_len = 4;
+        datavec[1].iov_base = (void *)session->session_id;
+        datavec[1].iov_len = session->session_id_len;
+        datavec[2].iov_base = (void *)session->userauth_host_packet;
+        datavec[2].iov_len = session->userauth_host_packet_len;
+
+        if (privkeyobj->signv(session, &sig, &sig_len, 3, datavec, &abstract)) {
+            LIBSSH2_FREE(session, session->userauth_host_method);
+            session->userauth_host_method = NULL;
+            LIBSSH2_FREE(session, session->userauth_host_packet);
+            session->userauth_host_packet = NULL;
+            if (privkeyobj->dtor) {
+                privkeyobj->dtor(session, &abstract);
+            }
+            return -1;
+        }
+
+        if (privkeyobj->dtor) {
+            privkeyobj->dtor(session, &abstract);
+        }
+
+        if (sig_len > pubkeydata_len) {
+            unsigned char *newpacket;
+            /* Should *NEVER* happen, but...well.. better safe than sorry */
+            newpacket = LIBSSH2_REALLOC(session, session->userauth_host_packet,
+                                        session->userauth_host_packet_len + 4 +
+                                        (4 + session->userauth_host_method_len)
+                                        + (4 + sig_len)); /* PK sigblob */
+            if (!newpacket) {
+                LIBSSH2_FREE(session, sig);
+                LIBSSH2_FREE(session, session->userauth_host_packet);
+                session->userauth_host_packet = NULL;
+                LIBSSH2_FREE(session, session->userauth_host_method);
+                session->userauth_host_method = NULL;
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                      "Failed allocating additional space for "
+                                      "userauth-hostbased packet");
+            }
+            session->userauth_host_packet = newpacket;
+        }
+
+        session->userauth_host_s =
+            session->userauth_host_packet + session->userauth_host_packet_len;
+
+        _libssh2_store_u32(&session->userauth_host_s,
+                           4 + session->userauth_host_method_len + 4 + sig_len);
+        _libssh2_store_str(&session->userauth_host_s,
+                           (const char *)session->userauth_host_method,
+                           session->userauth_host_method_len);
+        LIBSSH2_FREE(session, session->userauth_host_method);
+        session->userauth_host_method = NULL;
+
+        _libssh2_store_str(&session->userauth_host_s, (const char *)sig,
+                           sig_len);
+        LIBSSH2_FREE(session, sig);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Attempting hostbased authentication");
+
+        session->userauth_host_state = libssh2_NB_state_created;
+    }
+
+    if (session->userauth_host_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, session->userauth_host_packet,
+                                     session->userauth_host_s -
+                                     session->userauth_host_packet,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        }
+        else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_host_packet);
+            session->userauth_host_packet = NULL;
+            session->userauth_host_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send userauth-hostbased request");
+        }
+        LIBSSH2_FREE(session, session->userauth_host_packet);
+        session->userauth_host_packet = NULL;
+
+        session->userauth_host_state = libssh2_NB_state_sent;
+    }
+
+    if (session->userauth_host_state == libssh2_NB_state_sent) {
+        static const unsigned char reply_codes[3] =
+            { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, 0 };
+        size_t data_len;
+        rc = _libssh2_packet_requirev(session, reply_codes,
+                                      &session->userauth_host_data,
+                                      &data_len, 0, NULL, 0,
+                                      &session->
+                                      userauth_host_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        }
+
+        session->userauth_host_state = libssh2_NB_state_idle;
+        if (rc) {
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                  "Auth failed");
+        }
+
+        if (session->userauth_host_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+            _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                           "Hostbased authentication successful");
+            /* We are us and we've proved it. */
+            LIBSSH2_FREE(session, session->userauth_host_data);
+            session->userauth_host_data = NULL;
+            session->state |= LIBSSH2_STATE_AUTHENTICATED;
+            return 0;
+        }
+    }
+
+    /* This public key is not allowed for this user on this server */
+    LIBSSH2_FREE(session, session->userauth_host_data);
+    session->userauth_host_data = NULL;
+    return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                          "Invalid signature for supplied public key, or bad "
+                          "username/public key combination");
+}
+
+/* libssh2_userauth_hostbased_fromfile_ex
+ * Authenticate using a keypair found in the named files
+ */
+LIBSSH2_API int
+libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session,
+                                       const char *user,
+                                       unsigned int user_len,
+                                       const char *publickey,
+                                       const char *privatekey,
+                                       const char *passphrase,
+                                       const char *host,
+                                       unsigned int host_len,
+                                       const char *localuser,
+                                       unsigned int localuser_len)
+{
+    int rc;
+    BLOCK_ADJUST(rc, session,
+                 userauth_hostbased_fromfile(session, user, user_len,
+                                             publickey, privatekey,
+                                             passphrase, host, host_len,
+                                             localuser, localuser_len));
+    return rc;
+}
+
+
+
+int
+_libssh2_userauth_publickey(LIBSSH2_SESSION *session,
+                            const char *username,
+                            unsigned int username_len,
+                            const unsigned char *pubkeydata,
+                            unsigned long pubkeydata_len,
+                            LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)),
+                            void *abstract)
+{
+    unsigned char reply_codes[4] =
+        { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE,
+          SSH_MSG_USERAUTH_PK_OK, 0
+        };
+    int rc;
+    unsigned char *s;
+
+    if (session->userauth_pblc_state == libssh2_NB_state_idle) {
+
+        /*
+         * The call to _libssh2_ntohu32 later relies on pubkeydata having at
+         * least 4 valid bytes containing the length of the method name.
+         */
+        if (pubkeydata_len < 4)
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                  "Invalid public key, too short");
+
+        /* Zero the whole thing out */
+        memset(&session->userauth_pblc_packet_requirev_state, 0,
+               sizeof(session->userauth_pblc_packet_requirev_state));
+
+        /*
+         * As an optimisation, userauth_publickey_fromfile reuses a
+         * previously allocated copy of the method name to avoid an extra
+         * allocation/free.
+         * For other uses, we allocate and populate it here.
+         */
+        if (!session->userauth_pblc_method) {
+            session->userauth_pblc_method_len = _libssh2_ntohu32(pubkeydata);
+
+            if(session->userauth_pblc_method_len > pubkeydata_len)
+                /* the method length simply cannot be longer than the entire
+                   passed in data, so we use this to detect crazy input
+                   data */
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                      "Invalid public key");
+
+            session->userauth_pblc_method =
+                LIBSSH2_ALLOC(session, session->userauth_pblc_method_len);
+            if (!session->userauth_pblc_method) {
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                      "Unable to allocate memory for public key "
+                                      "data");
+            }
+            memcpy(session->userauth_pblc_method, pubkeydata + 4,
+                   session->userauth_pblc_method_len);
+        }
+        /*
+         * The length of the method name read from plaintext prefix in the
+         * file must match length embedded in the key.
+         * TODO: The data should match too but we don't check that. Should we?
+         */
+        else if (session->userauth_pblc_method_len !=
+                 _libssh2_ntohu32(pubkeydata))
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                  "Invalid public key");
+
+        /*
+         * 45 = packet_type(1) + username_len(4) + servicename_len(4) +
+         * service_name(14)"ssh-connection" + authmethod_len(4) +
+         * authmethod(9)"publickey" + sig_included(1)'\0' + algmethod_len(4) +
+         * publickey_len(4)
+         */
+        session->userauth_pblc_packet_len =
+            username_len + session->userauth_pblc_method_len + pubkeydata_len +
+            45;
+
+        /*
+         * Preallocate space for an overall length, method name again, and the
+         * signature, which won't be any larger than the size of the
+         * publickeydata itself.
+         *
+         * Note that the 'pubkeydata_len' extra bytes allocated here will not
+         * be used in this first send, but will be used in the later one where
+         * this same allocation is re-used.
+         */
+        s = session->userauth_pblc_packet =
+            LIBSSH2_ALLOC(session,
+                          session->userauth_pblc_packet_len + 4 +
+                          (4 + session->userauth_pblc_method_len)
+                          + (4 + pubkeydata_len));
+        if (!session->userauth_pblc_packet) {
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Out of memory");
+        }
+
+        *s++ = SSH_MSG_USERAUTH_REQUEST;
+        _libssh2_store_str(&s, username, username_len);
+        _libssh2_store_str(&s, "ssh-connection", 14);
+        _libssh2_store_str(&s, "publickey", 9);
+
+        session->userauth_pblc_b = s;
+        /* Not sending signature with *this* packet */
+        *s++ = 0;
+
+        _libssh2_store_str(&s, (const char *)session->userauth_pblc_method,
+                           session->userauth_pblc_method_len);
+        _libssh2_store_str(&s, (const char *)pubkeydata, pubkeydata_len);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Attempting publickey authentication");
+
+        session->userauth_pblc_state = libssh2_NB_state_created;
+    }
+
+    if (session->userauth_pblc_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, session->userauth_pblc_packet,
+                                     session->userauth_pblc_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN)
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send userauth-publickey request");
+        }
+
+        session->userauth_pblc_state = libssh2_NB_state_sent;
+    }
+
+    if (session->userauth_pblc_state == libssh2_NB_state_sent) {
+        rc = _libssh2_packet_requirev(session, reply_codes,
+                                      &session->userauth_pblc_data,
+                                      &session->userauth_pblc_data_len, 0,
+                                      NULL, 0,
+                                      &session->
+                                      userauth_pblc_packet_requirev_state);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        }
+        else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                  "Waiting for USERAUTH response");
+        }
+
+        if (session->userauth_pblc_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+            _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                           "Pubkey authentication prematurely successful");
+            /*
+             * God help any SSH server that allows an UNVERIFIED
+             * public key to validate the user
+             */
+            LIBSSH2_FREE(session, session->userauth_pblc_data);
+            session->userauth_pblc_data = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            session->state |= LIBSSH2_STATE_AUTHENTICATED;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return 0;
+        }
+
+        if (session->userauth_pblc_data[0] == SSH_MSG_USERAUTH_FAILURE) {
+            /* This public key is not allowed for this user on this server */
+            LIBSSH2_FREE(session, session->userauth_pblc_data);
+            session->userauth_pblc_data = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_AUTHENTICATION_FAILED,
+                                  "Username/PublicKey combination invalid");
+        }
+
+        /* Semi-Success! */
+        LIBSSH2_FREE(session, session->userauth_pblc_data);
+        session->userauth_pblc_data = NULL;
+
+        *session->userauth_pblc_b = 0x01;
+        session->userauth_pblc_state = libssh2_NB_state_sent1;
+    }
+
+    if (session->userauth_pblc_state == libssh2_NB_state_sent1) {
+        unsigned char *buf;
+        unsigned char *sig;
+        size_t sig_len;
+
+        s = buf = LIBSSH2_ALLOC(session, 4 + session->session_id_len
+                                + session->userauth_pblc_packet_len);
+        if (!buf) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "userauth-publickey signed data");
+        }
+
+        _libssh2_store_str(&s, (const char *)session->session_id,
+                           session->session_id_len);
+
+        memcpy (s, session->userauth_pblc_packet,
+                session->userauth_pblc_packet_len);
+        s += session->userauth_pblc_packet_len;
+
+        rc = sign_callback(session, &sig, &sig_len, buf, s - buf, abstract);
+        LIBSSH2_FREE(session, buf);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        } else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_pblc_method);
+            session->userauth_pblc_method = NULL;
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                                  "Callback returned error");
+        }
+
+        /*
+         * If this function was restarted, pubkeydata_len might still be 0
+         * which will cause an unnecessary but harmless realloc here.
+         */
+        if (sig_len > pubkeydata_len) {
+            unsigned char *newpacket;
+            /* Should *NEVER* happen, but...well.. better safe than sorry */
+            newpacket = LIBSSH2_REALLOC(session,
+                                        session->userauth_pblc_packet,
+                                        session->userauth_pblc_packet_len + 4 +
+                                        (4 + session->userauth_pblc_method_len)
+                                        + (4 + sig_len)); /* PK sigblob */
+            if (!newpacket) {
+                LIBSSH2_FREE(session, sig);
+                LIBSSH2_FREE(session, session->userauth_pblc_packet);
+                session->userauth_pblc_packet = NULL;
+                LIBSSH2_FREE(session, session->userauth_pblc_method);
+                session->userauth_pblc_method = NULL;
+                session->userauth_pblc_state = libssh2_NB_state_idle;
+                return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                      "Failed allocating additional space for "
+                                      "userauth-publickey packet");
+            }
+            session->userauth_pblc_packet = newpacket;
+        }
+
+        s = session->userauth_pblc_packet + session->userauth_pblc_packet_len;
+        session->userauth_pblc_b = NULL;
+
+        _libssh2_store_u32(&s,
+                           4 + session->userauth_pblc_method_len + 4 + sig_len);
+        _libssh2_store_str(&s, (const char *)session->userauth_pblc_method,
+                           session->userauth_pblc_method_len);
+
+        LIBSSH2_FREE(session, session->userauth_pblc_method);
+        session->userauth_pblc_method = NULL;
+
+        _libssh2_store_str(&s, (const char *)sig, sig_len);
+        LIBSSH2_FREE(session, sig);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Attempting publickey authentication -- phase 2");
+
+        session->userauth_pblc_s = s;
+        session->userauth_pblc_state = libssh2_NB_state_sent2;
+    }
+
+    if (session->userauth_pblc_state == libssh2_NB_state_sent2) {
+        rc = _libssh2_transport_send(session, session->userauth_pblc_packet,
+                                     session->userauth_pblc_s -
+                                     session->userauth_pblc_packet,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        } else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_pblc_packet);
+            session->userauth_pblc_packet = NULL;
+            session->userauth_pblc_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send userauth-publickey request");
+        }
+        LIBSSH2_FREE(session, session->userauth_pblc_packet);
+        session->userauth_pblc_packet = NULL;
+
+        session->userauth_pblc_state = libssh2_NB_state_sent3;
+    }
+
+    /* PK_OK is no longer valid */
+    reply_codes[2] = 0;
+
+    rc = _libssh2_packet_requirev(session, reply_codes,
+                                  &session->userauth_pblc_data,
+                                  &session->userauth_pblc_data_len, 0, NULL, 0,
+                                  &session->userauth_pblc_packet_requirev_state);
+    if (rc == LIBSSH2_ERROR_EAGAIN) {
+        return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                              "Would block requesting userauth list");
+    } else if (rc) {
+        session->userauth_pblc_state = libssh2_NB_state_idle;
+        return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                              "Waiting for publickey USERAUTH response");
+    }
+
+    if (session->userauth_pblc_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Publickey authentication successful");
+        /* We are us and we've proved it. */
+        LIBSSH2_FREE(session, session->userauth_pblc_data);
+        session->userauth_pblc_data = NULL;
+        session->state |= LIBSSH2_STATE_AUTHENTICATED;
+        session->userauth_pblc_state = libssh2_NB_state_idle;
+        return 0;
+    }
+
+    /* This public key is not allowed for this user on this server */
+    LIBSSH2_FREE(session, session->userauth_pblc_data);
+    session->userauth_pblc_data = NULL;
+    session->userauth_pblc_state = libssh2_NB_state_idle;
+    return _libssh2_error(session, LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED,
+                          "Invalid signature for supplied public key, or bad "
+                          "username/public key combination");
+}
+
+/*
+ * userauth_publickey_fromfile
+ * Authenticate using a keypair found in the named files
+ */
+static int
+userauth_publickey_fromfile(LIBSSH2_SESSION *session,
+                            const char *username,
+                            size_t username_len,
+                            const char *publickey,
+                            const char *privatekey,
+                            const char *passphrase)
+{
+    unsigned char *pubkeydata = NULL;
+    size_t pubkeydata_len = 0;
+    struct privkey_file privkey_file;
+    void *abstract = &privkey_file;
+    int rc;
+
+    privkey_file.filename = privatekey;
+    privkey_file.passphrase = passphrase;
+
+    if (session->userauth_pblc_state == libssh2_NB_state_idle) {
+        if (publickey) {
+            rc = file_read_publickey(session, &session->userauth_pblc_method,
+                                     &session->userauth_pblc_method_len,
+                                     &pubkeydata, &pubkeydata_len,publickey);
+            if (rc)
+                return rc;
+        }
+        else {
+            /* Compute public key from private key. */
+            rc = _libssh2_pub_priv_keyfile(session,
+                                           &session->userauth_pblc_method,
+                                           &session->userauth_pblc_method_len,
+                                           &pubkeydata, &pubkeydata_len,
+                                           privatekey, passphrase);
+
+            /* _libssh2_pub_priv_keyfile calls _libssh2_error() */
+            if (rc)
+                return rc;
+        }
+    }
+
+    rc = _libssh2_userauth_publickey(session, username, username_len,
+                                     pubkeydata, pubkeydata_len,
+                                     sign_fromfile, &abstract);
+    if(pubkeydata)
+        LIBSSH2_FREE(session, pubkeydata);
+
+    return rc;
+}
+
+/* libssh2_userauth_publickey_fromfile_ex
+ * Authenticate using a keypair found in the named files
+ */
+LIBSSH2_API int
+libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
+                                       const char *user,
+                                       unsigned int user_len,
+                                       const char *publickey,
+                                       const char *privatekey,
+                                       const char *passphrase)
+{
+    int rc;
+
+    if(NULL == passphrase)
+        /* if given a NULL pointer, make it point to a zero-length
+           string to save us from having to check this all over */
+        passphrase="";
+
+    BLOCK_ADJUST(rc, session,
+                 userauth_publickey_fromfile(session, user, user_len,
+                                             publickey, privatekey,
+                                             passphrase));
+    return rc;
+}
+
+/* libssh2_userauth_publickey_ex
+ * Authenticate using an external callback function
+ */
+LIBSSH2_API int
+libssh2_userauth_publickey(LIBSSH2_SESSION *session,
+                           const char *user,
+                           const unsigned char *pubkeydata,
+                           size_t pubkeydata_len,
+                           LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)),
+                           void **abstract)
+{
+    int rc;
+
+    if(!session)
+        return LIBSSH2_ERROR_BAD_USE;
+
+    BLOCK_ADJUST(rc, session,
+                 _libssh2_userauth_publickey(session, user, strlen(user),
+                                             pubkeydata, pubkeydata_len,
+                                             sign_callback, abstract));
+    return rc;
+}
+
+
+
+/*
+ * userauth_keyboard_interactive
+ *
+ * Authenticate using a challenge-response authentication
+ */
+static int
+userauth_keyboard_interactive(LIBSSH2_SESSION * session,
+                              const char *username,
+                              unsigned int username_len,
+                              LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)))
+{
+    unsigned char *s;
+    int rc;
+
+    static const unsigned char reply_codes[4] = {
+        SSH_MSG_USERAUTH_SUCCESS,
+        SSH_MSG_USERAUTH_FAILURE, SSH_MSG_USERAUTH_INFO_REQUEST, 0
+    };
+    unsigned int language_tag_len;
+    unsigned int i;
+
+    if (session->userauth_kybd_state == libssh2_NB_state_idle) {
+        session->userauth_kybd_auth_name = NULL;
+        session->userauth_kybd_auth_instruction = NULL;
+        session->userauth_kybd_num_prompts = 0;
+        session->userauth_kybd_auth_failure = 1;
+        session->userauth_kybd_prompts = NULL;
+        session->userauth_kybd_responses = NULL;
+
+        /* Zero the whole thing out */
+        memset(&session->userauth_kybd_packet_requirev_state, 0,
+               sizeof(session->userauth_kybd_packet_requirev_state));
+
+        session->userauth_kybd_packet_len =
+            1                   /* byte    SSH_MSG_USERAUTH_REQUEST */
+            + 4 + username_len  /* string  user name (ISO-10646 UTF-8, as
+                                   defined in [RFC-3629]) */
+            + 4 + 14            /* string  service name (US-ASCII) */
+            + 4 + 20            /* string  "keyboard-interactive" (US-ASCII) */
+            + 4 + 0             /* string  language tag (as defined in
+                                   [RFC-3066]) */
+            + 4 + 0             /* string  submethods (ISO-10646 UTF-8) */
+            ;
+
+        session->userauth_kybd_data = s =
+            LIBSSH2_ALLOC(session, session->userauth_kybd_packet_len);
+        if (!s) {
+            return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                  "Unable to allocate memory for "
+                                  "keyboard-interactive authentication");
+        }
+
+        *s++ = SSH_MSG_USERAUTH_REQUEST;
+
+        /* user name */
+        _libssh2_store_str(&s, username, username_len);
+
+        /* service name */
+        _libssh2_store_str(&s, "ssh-connection", sizeof("ssh-connection") - 1);
+
+        /* "keyboard-interactive" */
+        _libssh2_store_str(&s, "keyboard-interactive",
+                           sizeof("keyboard-interactive") - 1);
+        /* language tag */
+        _libssh2_store_u32(&s, 0);
+
+        /* submethods */
+        _libssh2_store_u32(&s, 0);
+
+        _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                       "Attempting keyboard-interactive authentication");
+
+        session->userauth_kybd_state = libssh2_NB_state_created;
+    }
+
+    if (session->userauth_kybd_state == libssh2_NB_state_created) {
+        rc = _libssh2_transport_send(session, session->userauth_kybd_data,
+                                     session->userauth_kybd_packet_len,
+                                     NULL, 0);
+        if (rc == LIBSSH2_ERROR_EAGAIN) {
+            return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block");
+        } else if (rc) {
+            LIBSSH2_FREE(session, session->userauth_kybd_data);
+            session->userauth_kybd_data = NULL;
+            session->userauth_kybd_state = libssh2_NB_state_idle;
+            return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                                  "Unable to send keyboard-interactive request");
+        }
+        LIBSSH2_FREE(session, session->userauth_kybd_data);
+        session->userauth_kybd_data = NULL;
+
+        session->userauth_kybd_state = libssh2_NB_state_sent;
+    }
+
+    for(;;) {
+        if (session->userauth_kybd_state == libssh2_NB_state_sent) {
+            rc = _libssh2_packet_requirev(session, reply_codes,
+                                          &session->userauth_kybd_data,
+                                          &session->userauth_kybd_data_len,
+                                          0, NULL, 0,
+                                          &session->
+                                          userauth_kybd_packet_requirev_state);
+            if (rc == LIBSSH2_ERROR_EAGAIN) {
+                return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                      "Would block");
+            } else if (rc) {
+                session->userauth_kybd_state = libssh2_NB_state_idle;
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_AUTHENTICATION_FAILED,
+                                      "Waiting for keyboard USERAUTH response");
+            }
+
+            if (session->userauth_kybd_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
+                _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                               "Keyboard-interactive authentication successful");
+                LIBSSH2_FREE(session, session->userauth_kybd_data);
+                session->userauth_kybd_data = NULL;
+                session->state |= LIBSSH2_STATE_AUTHENTICATED;
+                session->userauth_kybd_state = libssh2_NB_state_idle;
+                return 0;
+            }
+
+            if (session->userauth_kybd_data[0] == SSH_MSG_USERAUTH_FAILURE) {
+                _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                               "Keyboard-interactive authentication failed");
+                LIBSSH2_FREE(session, session->userauth_kybd_data);
+                session->userauth_kybd_data = NULL;
+                session->userauth_kybd_state = libssh2_NB_state_idle;
+                return _libssh2_error(session,
+                                      LIBSSH2_ERROR_AUTHENTICATION_FAILED,
+                                      "Authentication failed "
+                                      "(keyboard-interactive)");
+            }
+
+            /* server requested PAM-like conversation */
+            s = session->userauth_kybd_data + 1;
+
+            /* string    name (ISO-10646 UTF-8) */
+            session->userauth_kybd_auth_name_len = _libssh2_ntohu32(s);
+            s += 4;
+            if(session->userauth_kybd_auth_name_len) {
+                session->userauth_kybd_auth_name =
+                    LIBSSH2_ALLOC(session,
+                                  session->userauth_kybd_auth_name_len);
+                if (!session->userauth_kybd_auth_name) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for "
+                                   "keyboard-interactive 'name' "
+                                   "request field");
+                    goto cleanup;
+                }
+                memcpy(session->userauth_kybd_auth_name, s,
+                       session->userauth_kybd_auth_name_len);
+                s += session->userauth_kybd_auth_name_len;
+            }
+
+            /* string    instruction (ISO-10646 UTF-8) */
+            session->userauth_kybd_auth_instruction_len = _libssh2_ntohu32(s);
+            s += 4;
+            if(session->userauth_kybd_auth_instruction_len) {
+                session->userauth_kybd_auth_instruction =
+                    LIBSSH2_ALLOC(session,
+                                  session->userauth_kybd_auth_instruction_len);
+                if (!session->userauth_kybd_auth_instruction) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for "
+                                   "keyboard-interactive 'instruction' "
+                                   "request field");
+                    goto cleanup;
+                }
+                memcpy(session->userauth_kybd_auth_instruction, s,
+                       session->userauth_kybd_auth_instruction_len);
+                s += session->userauth_kybd_auth_instruction_len;
+            }
+
+            /* string    language tag (as defined in [RFC-3066]) */
+            language_tag_len = _libssh2_ntohu32(s);
+            s += 4;
+
+            /* ignoring this field as deprecated */
+            s += language_tag_len;
+
+            /* int       num-prompts */
+            session->userauth_kybd_num_prompts = _libssh2_ntohu32(s);
+            s += 4;
+
+            if(session->userauth_kybd_num_prompts) {
+                session->userauth_kybd_prompts =
+                    LIBSSH2_ALLOC(session,
+                                  sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
+                                  session->userauth_kybd_num_prompts);
+                if (!session->userauth_kybd_prompts) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for "
+                                   "keyboard-interactive prompts array");
+                    goto cleanup;
+                }
+                memset(session->userauth_kybd_prompts, 0,
+                       sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
+                       session->userauth_kybd_num_prompts);
+
+                session->userauth_kybd_responses =
+                    LIBSSH2_ALLOC(session,
+                                  sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
+                                  session->userauth_kybd_num_prompts);
+                if (!session->userauth_kybd_responses) {
+                    _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                   "Unable to allocate memory for "
+                                   "keyboard-interactive responses array");
+                    goto cleanup;
+                }
+                memset(session->userauth_kybd_responses, 0,
+                       sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
+                       session->userauth_kybd_num_prompts);
+
+                for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
+                    /* string    prompt[1] (ISO-10646 UTF-8) */
+                    session->userauth_kybd_prompts[i].length =
+                        _libssh2_ntohu32(s);
+                    s += 4;
+                    session->userauth_kybd_prompts[i].text =
+                        LIBSSH2_ALLOC(session,
+                                      session->userauth_kybd_prompts[i].length);
+                    if (!session->userauth_kybd_prompts[i].text) {
+                        _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                                       "Unable to allocate memory for "
+                                       "keyboard-interactive prompt message");
+                        goto cleanup;
+                    }
+                    memcpy(session->userauth_kybd_prompts[i].text, s,
+                           session->userauth_kybd_prompts[i].length);
+                    s += session->userauth_kybd_prompts[i].length;
+
+                    /* boolean   echo[1] */
+                    session->userauth_kybd_prompts[i].echo = *s++;
+                }
+            }
+
+            response_callback(session->userauth_kybd_auth_name,
+                              session->userauth_kybd_auth_name_len,
+                              session->userauth_kybd_auth_instruction,
+                              session->userauth_kybd_auth_instruction_len,
+                              session->userauth_kybd_num_prompts,
+                              session->userauth_kybd_prompts,
+                              session->userauth_kybd_responses,
+                              &session->abstract);
+
+            _libssh2_debug(session, LIBSSH2_TRACE_AUTH,
+                           "Keyboard-interactive response callback function"
+                           " invoked");
+
+            session->userauth_kybd_packet_len =
+                1 /* byte      SSH_MSG_USERAUTH_INFO_RESPONSE */
+                + 4             /* int       num-responses */
+                ;
+
+            for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
+                /* string    response[1] (ISO-10646 UTF-8) */
+                session->userauth_kybd_packet_len +=
+                    4 + session->userauth_kybd_responses[i].length;
+            }
+
+            /* A new userauth_kybd_data area is to be allocated, free the
+               former one. */
+            LIBSSH2_FREE(session, session->userauth_kybd_data);
+
+            session->userauth_kybd_data = s =
+                LIBSSH2_ALLOC(session, session->userauth_kybd_packet_len);
+            if (!s) {
+                _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
+                               "Unable to allocate memory for keyboard-"
+                               "interactive response packet");
+                goto cleanup;
+            }
+
+            *s = SSH_MSG_USERAUTH_INFO_RESPONSE;
+            s++;
+            _libssh2_store_u32(&s, session->userauth_kybd_num_prompts);
+
+            for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
+                _libssh2_store_str(&s,
+                                   session->userauth_kybd_responses[i].text,
+                                   session->userauth_kybd_responses[i].length);
+            }
+
+            session->userauth_kybd_state = libssh2_NB_state_sent1;
+        }
+
+        if (session->userauth_kybd_state == libssh2_NB_state_sent1) {
+            rc = _libssh2_transport_send(session, session->userauth_kybd_data,
+                                         session->userauth_kybd_packet_len,
+                                         NULL, 0);
+            if (rc == LIBSSH2_ERROR_EAGAIN)
+                return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
+                                      "Would block");
+            if (rc) {
+                _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
+                               "Unable to send userauth-keyboard-interactive"
+                               " request");
+                goto cleanup;
+            }
+
+            session->userauth_kybd_auth_failure = 0;
+        }
+
+      cleanup:
+        /*
+         * It's safe to clean all the data here, because unallocated pointers
+         * are filled by zeroes
+         */
+
+        LIBSSH2_FREE(session, session->userauth_kybd_data);
+        session->userauth_kybd_data = NULL;
+
+        if (session->userauth_kybd_prompts) {
+            for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
+                LIBSSH2_FREE(session, session->userauth_kybd_prompts[i].text);
+                session->userauth_kybd_prompts[i].text = NULL;
+            }
+        }
+
+        if (session->userauth_kybd_responses) {
+            for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
+                LIBSSH2_FREE(session,
+                             session->userauth_kybd_responses[i].text);
+                session->userauth_kybd_responses[i].text = NULL;
+            }
+        }
+
+        if(session->userauth_kybd_prompts) {
+            LIBSSH2_FREE(session, session->userauth_kybd_prompts);
+            session->userauth_kybd_prompts = NULL;
+        }
+        if(session->userauth_kybd_responses) {
+            LIBSSH2_FREE(session, session->userauth_kybd_responses);
+            session->userauth_kybd_responses = NULL;
+        }
+        if(session->userauth_kybd_auth_name) {
+            LIBSSH2_FREE(session, session->userauth_kybd_auth_name);
+            session->userauth_kybd_auth_name = NULL;
+        }
+        if(session->userauth_kybd_auth_instruction) {
+            LIBSSH2_FREE(session, session->userauth_kybd_auth_instruction);
+            session->userauth_kybd_auth_instruction = NULL;
+        }
+
+        if (session->userauth_kybd_auth_failure) {
+            session->userauth_kybd_state = libssh2_NB_state_idle;
+            return -1;
+        }
+
+        session->userauth_kybd_state = libssh2_NB_state_sent;
+    }
+}
+
+/*
+ * libssh2_userauth_keyboard_interactive_ex
+ *
+ * Authenticate using a challenge-response authentication
+ */
+LIBSSH2_API int
+libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session,
+                                         const char *user,
+                                         unsigned int user_len,
+                                         LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)))
+{
+    int rc;
+    BLOCK_ADJUST(rc, session,
+                 userauth_keyboard_interactive(session, user, user_len,
+                                               response_callback));
+    return rc;
+}
diff --git a/pgadmin/libssh2/version.c b/pgadmin/libssh2/version.c
new file mode 100644
index 0000000..408f83a
--- /dev/null
+++ b/pgadmin/libssh2/version.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2009 Daniel Stenberg.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *   Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the
+ *   following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials
+ *   provided with the distribution.
+ *
+ *   Neither the name of the copyright holder nor the names
+ *   of any other contributors may be used to endorse or
+ *   promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ */
+
+#include "libssh2_priv.h"
+
+/*
+  libssh2_version() can be used like this:
+
+  if (!libssh2_version(LIBSSH2_VERSION_NUM)) {
+    fprintf (stderr, "Runtime libssh2 version too old!\n");
+    exit(1);
+  }
+*/
+LIBSSH2_API
+const char *libssh2_version(int req_version_num)
+{
+    if(req_version_num <= LIBSSH2_VERSION_NUM)
+        return LIBSSH2_VERSION;
+    return NULL; /* this is not a suitable library! */
+}
diff --git a/pgadmin/pgAdmin3.cpp b/pgadmin/pgAdmin3.cpp
index 6921abb..b9613c9 100644
--- a/pgadmin/pgAdmin3.cpp
+++ b/pgadmin/pgAdmin3.cpp
@@ -84,6 +84,11 @@
 frmMain *winMain = 0;
 wxThread *updateThread = 0;
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+#include "utils/sshTunnel.h"
+CSSHTunnelThread *pgadminTunnelThread = 0;
+#endif
+
 sysSettings *settings;
 wxArrayInt existingLangs;
 wxArrayString existingLangNames;
@@ -364,7 +369,7 @@ bool pgAdmin3::OnInit()
 	wxLogInfo(wxT("%s"), msg.c_str());
 	wxLogInfo(wxT("##############################################################"));
 
-#ifdef SSL
+#ifdef PG_SSL
 	wxLogInfo(wxT("Compiled with dynamically linked SSL support"));
 #endif
 
diff --git a/pgadmin/pgAdmin3.vcxproj b/pgadmin/pgAdmin3.vcxproj
index 3f6c0d4..e3c34ec 100644
--- a/pgadmin/pgAdmin3.vcxproj
+++ b/pgadmin/pgAdmin3.vcxproj
@@ -1,2237 +1,3534 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug (2.9)|Win32">
-      <Configuration>Debug (2.9)</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug (2.9)|x64">
-      <Configuration>Debug (2.9)</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release (2.9)|Win32">
-      <Configuration>Release (2.9)</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release (2.9)|x64">
-      <Configuration>Release (2.9)</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{5C2D73BA-1F24-48F8-8233-85F5D672AA6A}</ProjectGuid>
-    <RootNamespace>pgAdmin3</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-    <Import Project="..\pgAdmin3.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(Platform)\$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(Platform)\$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">true</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <PreBuildEvent>
-      <Message>Extracting source code repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase28u.lib;wxbase28u_xml.lib;wxbase28u_net.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxmsw28u_html.lib;wxmsw28u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw28u_stc.lib;wxmsw28u_xrc.lib;wxexpat.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase28u.lib;wxbase28u_xml.lib;wxbase28u_net.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxmsw28u_html.lib;wxmsw28u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw28u_stc.lib;wxmsw28u_xrc.lib;wxexpat.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <PreBuildEvent>
-      <Message>Extracting source code repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase28ud.lib;wxbase28ud_xml.lib;wxbase28ud_net.lib;wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxmsw28ud_html.lib;wxmsw28ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw28ud_stc.lib;wxmsw28ud_xrc.lib;wxexpatd.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <NoEntryPoint>false</NoEntryPoint>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <PreBuildEvent>
-      <Message>Extracting subversion repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase28ud.lib;wxbase28ud_xml.lib;wxbase28ud_net.lib;wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxmsw28ud_html.lib;wxmsw28ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw28ud_stc.lib;wxmsw28ud_xrc.lib;wxexpatd.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <NoEntryPoint>false</NoEntryPoint>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
-    <PreBuildEvent>
-      <Message>Extracting source code repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase29ud.lib;wxbase29ud_xml.lib;wxbase29ud_net.lib;wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxmsw29ud_html.lib;wxmsw29ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw29ud_stc.lib;wxmsw29ud_xrc.lib;wxexpatd.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <NoEntryPoint>false</NoEntryPoint>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
-    <PreBuildEvent>
-      <Message>Extracting subversion repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase29ud.lib;wxbase29ud_xml.lib;wxbase29ud_net.lib;wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxmsw29ud_html.lib;wxmsw29ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw29ud_stc.lib;wxmsw29ud_xrc.lib;wxexpatd.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <NoEntryPoint>false</NoEntryPoint>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
-    <PreBuildEvent>
-      <Message>Extracting source code repository version</Message>
-      <Command>ver_svn.bat</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase29u.lib;wxbase29u_xml.lib;wxbase29u_net.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxmsw29u_html.lib;wxmsw29u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw29u_stc.lib;wxmsw29u_xrc.lib;wxexpat.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;include/;$(PGDIR)/include/server;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
-      <AssemblerOutput>All</AssemblerOutput>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0809</Culture>
-      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>wxbase29u.lib;wxbase29u_xml.lib;wxbase29u_net.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxmsw29u_html.lib;wxmsw29u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw29u_stc.lib;wxmsw29u_xrc.lib;wxexpat.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
-      <GenerateMapFile>true</GenerateMapFile>
-      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="agent\dlgJob.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="agent\dlgSchedule.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="agent\dlgStep.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="agent\pgaJob.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="agent\pgaSchedule.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="agent\pgaStep.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="ctl\calbox.cpp" />
-    <ClCompile Include="ctl\ctlAuiNotebook.cpp" />
-    <ClCompile Include="ctl\ctlCheckTreeView.cpp" />
-    <ClCompile Include="ctl\ctlColourPicker.cpp" />
-    <ClCompile Include="ctl\ctlComboBox.cpp" />
-    <ClCompile Include="ctl\ctlDefaultSecurityPanel.cpp" />
-    <ClCompile Include="ctl\ctlListView.cpp" />
-    <ClCompile Include="ctl\ctlMenuToolbar.cpp" />
-    <ClCompile Include="ctl\ctlSeclabelPanel.cpp" />
-    <ClCompile Include="ctl\ctlSecurityPanel.cpp" />
-    <ClCompile Include="ctl\ctlSQLBox.cpp" />
-    <ClCompile Include="ctl\ctlSQLGrid.cpp" />
-    <ClCompile Include="ctl\ctlSQLResult.cpp" />
-    <ClCompile Include="ctl\ctlTree.cpp" />
-    <ClCompile Include="ctl\explainCanvas.cpp" />
-    <ClCompile Include="ctl\explainShape.cpp" />
-    <ClCompile Include="ctl\timespin.cpp" />
-    <ClCompile Include="ctl\xh_calb.cpp" />
-    <ClCompile Include="ctl\xh_ctlchecktreeview.cpp" />
-    <ClCompile Include="ctl\xh_ctlcolourpicker.cpp" />
-    <ClCompile Include="ctl\xh_ctlcombo.cpp" />
-    <ClCompile Include="ctl\xh_ctltree.cpp" />
-    <ClCompile Include="ctl\xh_sqlbox.cpp" />
-    <ClCompile Include="ctl\xh_timespin.cpp" />
-    <ClCompile Include="db\keywords.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="db\pgConn.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="db\pgQueryThread.cpp" />
-    <ClCompile Include="db\pgSet.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgAddFavourite.cpp" />
-    <ClCompile Include="dlg\dlgAggregate.cpp" />
-    <ClCompile Include="dlg\dlgCast.cpp" />
-    <ClCompile Include="dlg\dlgCheck.cpp" />
-    <ClCompile Include="dlg\dlgClasses.cpp" />
-    <ClCompile Include="dlg\dlgCollation.cpp" />
-    <ClCompile Include="dlg\dlgColumn.cpp" />
-    <ClCompile Include="dlg\dlgConnect.cpp" />
-    <ClCompile Include="dlg\dlgConversion.cpp" />
-    <ClCompile Include="dlg\dlgDatabase.cpp" />
-    <ClCompile Include="dlg\dlgDomain.cpp" />
-    <ClCompile Include="dlg\dlgEditGridOptions.cpp" />
-    <ClCompile Include="dlg\dlgExtension.cpp" />
-    <ClCompile Include="dlg\dlgExtTable.cpp" />
-    <ClCompile Include="dlg\dlgFindReplace.cpp" />
-    <ClCompile Include="dlg\dlgForeignDataWrapper.cpp" />
-    <ClCompile Include="dlg\dlgForeignKey.cpp" />
-    <ClCompile Include="dlg\dlgForeignServer.cpp" />
-    <ClCompile Include="dlg\dlgForeignTable.cpp" />
-    <ClCompile Include="dlg\dlgFunction.cpp" />
-    <ClCompile Include="dlg\dlgGroup.cpp" />
-    <ClCompile Include="dlg\dlgHbaConfig.cpp" />
-    <ClCompile Include="dlg\dlgIndex.cpp" />
-    <ClCompile Include="dlg\dlgIndexConstraint.cpp" />
-    <ClCompile Include="dlg\dlgLanguage.cpp" />
-    <ClCompile Include="dlg\dlgMainConfig.cpp" />
-    <ClCompile Include="dlg\dlgManageFavourites.cpp" />
-    <ClCompile Include="dlg\dlgManageMacros.cpp" />
-    <ClCompile Include="dlg\dlgOperator.cpp" />
-    <ClCompile Include="dlg\dlgPackage.cpp" />
-    <ClCompile Include="dlg\dlgPgpassConfig.cpp" />
-    <ClCompile Include="dlg\dlgProperty.cpp" />
-    <ClCompile Include="dlg\dlgReassignDropOwned.cpp" />
-    <ClCompile Include="dlg\dlgRole.cpp" />
-    <ClCompile Include="dlg\dlgRule.cpp" />
-    <ClCompile Include="dlg\dlgSchema.cpp" />
-    <ClCompile Include="dlg\dlgSearchObject.cpp" />
-    <ClCompile Include="dlg\dlgSelectConnection.cpp" />
-    <ClCompile Include="dlg\dlgSelectDatabase.cpp" />
-    <ClCompile Include="dlg\dlgSequence.cpp" />
-    <ClCompile Include="dlg\dlgServer.cpp" />
-    <ClCompile Include="dlg\dlgSynonym.cpp" />
-    <ClCompile Include="dlg\dlgTable.cpp" />
-    <ClCompile Include="dlg\dlgTablespace.cpp" />
-    <ClCompile Include="dlg\dlgTextSearchConfiguration.cpp" />
-    <ClCompile Include="dlg\dlgTextSearchDictionary.cpp" />
-    <ClCompile Include="dlg\dlgTextSearchParser.cpp" />
-    <ClCompile Include="dlg\dlgTextSearchTemplate.cpp" />
-    <ClCompile Include="dlg\dlgTrigger.cpp" />
-    <ClCompile Include="dlg\dlgType.cpp" />
-    <ClCompile Include="dlg\dlgUser.cpp" />
-    <ClCompile Include="dlg\dlgUserMapping.cpp" />
-    <ClCompile Include="dlg\dlgView.cpp" />
-    <ClCompile Include="frm\events.cpp" />
-    <ClCompile Include="frm\frmAbout.cpp" />
-    <ClCompile Include="frm\frmBackup.cpp" />
-    <ClCompile Include="frm\frmBackupGlobals.cpp" />
-    <ClCompile Include="frm\frmBackupServer.cpp" />
-    <ClCompile Include="frm\frmConfig.cpp" />
-    <ClCompile Include="frm\frmDatabaseDesigner.cpp" />
-    <ClCompile Include="frm\frmEditGrid.cpp" />
-    <ClCompile Include="frm\frmExport.cpp" />
-    <ClCompile Include="frm\frmGrantWizard.cpp" />
-    <ClCompile Include="frm\frmHbaConfig.cpp" />
-    <ClCompile Include="frm\frmHint.cpp" />
-    <ClCompile Include="frm\frmImport.cpp" />
-    <ClCompile Include="frm\frmMain.cpp" />
-    <ClCompile Include="frm\frmMainConfig.cpp" />
-    <ClCompile Include="frm\frmMaintenance.cpp" />
-    <ClCompile Include="frm\frmOptions.cpp" />
-    <ClCompile Include="frm\frmPassword.cpp" />
-    <ClCompile Include="frm\frmPgpassConfig.cpp" />
-    <ClCompile Include="frm\frmQuery.cpp" />
-    <ClCompile Include="frm\frmReport.cpp" />
-    <ClCompile Include="frm\frmRestore.cpp" />
-    <ClCompile Include="frm\frmSplash.cpp" />
-    <ClCompile Include="frm\frmStatus.cpp" />
-    <ClCompile Include="frm\plugins.cpp" />
-    <ClCompile Include="schema\edbPackage.cpp" />
-    <ClCompile Include="schema\edbPackageFunction.cpp" />
-    <ClCompile Include="schema\edbPackageVariable.cpp" />
-    <ClCompile Include="schema\edbPrivateSynonym.cpp" />
-    <ClCompile Include="schema\edbSynonym.cpp" />
-    <ClCompile Include="schema\gpExtTable.cpp" />
-    <ClCompile Include="schema\gpPartition.cpp" />
-    <ClCompile Include="schema\gpResQueue.cpp" />
-    <ClCompile Include="schema\pgAggregate.cpp" />
-    <ClCompile Include="schema\pgCast.cpp" />
-    <ClCompile Include="schema\pgCatalogObject.cpp" />
-    <ClCompile Include="schema\pgCheck.cpp" />
-    <ClCompile Include="schema\pgCollation.cpp" />
-    <ClCompile Include="schema\pgCollection.cpp" />
-    <ClCompile Include="schema\pgColumn.cpp" />
-    <ClCompile Include="schema\pgConstraints.cpp" />
-    <ClCompile Include="schema\pgConversion.cpp" />
-    <ClCompile Include="schema\pgDatabase.cpp" />
-    <ClCompile Include="schema\pgDatatype.cpp" />
-    <ClCompile Include="schema\pgDomain.cpp" />
-    <ClCompile Include="schema\pgExtension.cpp" />
-    <ClCompile Include="schema\pgForeignDataWrapper.cpp" />
-    <ClCompile Include="schema\pgForeignKey.cpp" />
-    <ClCompile Include="schema\pgForeignServer.cpp" />
-    <ClCompile Include="schema\pgForeignTable.cpp" />
-    <ClCompile Include="schema\pgFunction.cpp" />
-    <ClCompile Include="schema\pgGroup.cpp" />
-    <ClCompile Include="schema\pgIndex.cpp" />
-    <ClCompile Include="schema\pgIndexConstraint.cpp" />
-    <ClCompile Include="schema\pgLanguage.cpp" />
-    <ClCompile Include="schema\pgObject.cpp" />
-    <ClCompile Include="schema\pgOperator.cpp" />
-    <ClCompile Include="schema\pgOperatorClass.cpp" />
-    <ClCompile Include="schema\pgOperatorFamily.cpp" />
-    <ClCompile Include="schema\pgRole.cpp" />
-    <ClCompile Include="schema\pgRule.cpp" />
-    <ClCompile Include="schema\pgSchema.cpp" />
-    <ClCompile Include="schema\pgSequence.cpp" />
-    <ClCompile Include="schema\pgServer.cpp" />
-    <ClCompile Include="schema\pgTable.cpp" />
-    <ClCompile Include="schema\pgTablespace.cpp" />
-    <ClCompile Include="schema\pgTextSearchConfiguration.cpp" />
-    <ClCompile Include="schema\pgTextSearchDictionary.cpp" />
-    <ClCompile Include="schema\pgTextSearchParser.cpp" />
-    <ClCompile Include="schema\pgTextSearchTemplate.cpp" />
-    <ClCompile Include="schema\pgTrigger.cpp" />
-    <ClCompile Include="schema\pgType.cpp" />
-    <ClCompile Include="schema\pgUser.cpp" />
-    <ClCompile Include="schema\pgUserMapping.cpp" />
-    <ClCompile Include="schema\pgView.cpp" />
-    <ClCompile Include="slony\dlgRepCluster.cpp" />
-    <ClCompile Include="slony\dlgRepListen.cpp" />
-    <ClCompile Include="slony\dlgRepNode.cpp" />
-    <ClCompile Include="slony\dlgRepPath.cpp" />
-    <ClCompile Include="slony\dlgRepProperty.cpp" />
-    <ClCompile Include="slony\dlgRepSequence.cpp" />
-    <ClCompile Include="slony\dlgRepSet.cpp" />
-    <ClCompile Include="slony\dlgRepSubscription.cpp" />
-    <ClCompile Include="slony\dlgRepTable.cpp" />
-    <ClCompile Include="slony\slCluster.cpp" />
-    <ClCompile Include="slony\slListen.cpp" />
-    <ClCompile Include="slony\slNode.cpp" />
-    <ClCompile Include="slony\slPath.cpp" />
-    <ClCompile Include="slony\slSequence.cpp" />
-    <ClCompile Include="slony\slSet.cpp" />
-    <ClCompile Include="slony\slSubscription.cpp" />
-    <ClCompile Include="slony\slTable.cpp" />
-    <ClCompile Include="ui\xrcDialogs.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="utils\csvfiles.cpp" />
-    <ClCompile Include="utils\factory.cpp" />
-    <ClCompile Include="utils\favourites.cpp" />
-    <ClCompile Include="utils\macros.cpp" />
-    <ClCompile Include="utils\misc.cpp" />
-    <ClCompile Include="utils\pgconfig.cpp" />
-    <ClCompile Include="utils\registry.cpp" />
-    <ClCompile Include="utils\sysLogger.cpp" />
-    <ClCompile Include="utils\sysProcess.cpp" />
-    <ClCompile Include="utils\sysSettings.cpp" />
-    <ClCompile Include="utils\tabcomplete.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="utils\utffile.cpp" />
-    <ClCompile Include="debugger\ctlMessageWindow.cpp" />
-    <ClCompile Include="debugger\ctlResultGrid.cpp" />
-    <ClCompile Include="debugger\ctlStackWindow.cpp" />
-    <ClCompile Include="debugger\ctlTabWindow.cpp" />
-    <ClCompile Include="debugger\ctlVarWindow.cpp" />
-    <ClCompile Include="debugger\dbgBreakPoint.cpp" />
-    <ClCompile Include="debugger\dbgController.cpp"/>
-    <ClCompile Include="debugger\dbgEvents.cpp"/>
-    <ClCompile Include="debugger\dbgModel.cpp"/>
-    <ClCompile Include="debugger\dbgTargetInfo.cpp" />
-    <ClCompile Include="debugger\debugger.cpp" />
-    <ClCompile Include="debugger\dlgDirectDbg.cpp" />
-    <ClCompile Include="debugger\frmDebugger.cpp" />
-    <ClCompile Include="gqb\gqbArrayCollection.cpp" />
-    <ClCompile Include="gqb\gqbBrowser.cpp" />
-    <ClCompile Include="gqb\gqbCollection.cpp" />
-    <ClCompile Include="gqb\gqbColumn.cpp" />
-    <ClCompile Include="gqb\gqbController.cpp" />
-    <ClCompile Include="gqb\gqbDatabase.cpp" />
-    <ClCompile Include="gqb\gqbGraphSimple.cpp" />
-    <ClCompile Include="gqb\gqbGridJoinTable.cpp" />
-    <ClCompile Include="gqb\gqbGridOrderTable.cpp" />
-    <ClCompile Include="gqb\gqbGridProjTable.cpp" />
-    <ClCompile Include="gqb\gqbGridRestTable.cpp" />
-    <ClCompile Include="gqb\gqbModel.cpp" />
-    <ClCompile Include="gqb\gqbObject.cpp" />
-    <ClCompile Include="gqb\gqbObjectCollection.cpp" />
-    <ClCompile Include="gqb\gqbQueryObjs.cpp" />
-    <ClCompile Include="gqb\gqbSchema.cpp" />
-    <ClCompile Include="gqb\gqbTable.cpp" />
-    <ClCompile Include="gqb\gqbView.cpp" />
-    <ClCompile Include="gqb\gqbViewPanels.cpp" />
-    <ClCompile Include="pgscript\lex.pgs.cc" />
-    <ClCompile Include="pgscript\parser.tab.cc" />
-    <ClCompile Include="pgscript\pgsApplication.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsArithmeticException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsAssertException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsBreakException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsCastException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsContinueException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsInterruptException.cpp" />
-    <ClCompile Include="pgscript\exceptions\pgsParameterException.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsAnd.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsAssign.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsAssignToRecord.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsCast.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsColumns.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsDifferent.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsEqual.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsExecute.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsExpression.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenDate.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenDateTime.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenDictionary.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenInt.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenReal.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenReference.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenRegex.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenString.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGenTime.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGreater.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsGreaterEqual.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsIdent.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsIdentRecord.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsLines.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsLower.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsLowerEqual.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsMinus.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsModulo.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsNegate.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsNot.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsOperation.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsOr.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsOver.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsParenthesis.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsPlus.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsRemoveLine.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsTimes.cpp" />
-    <ClCompile Include="pgscript\expressions\pgsTrim.cpp" />
-    <ClCompile Include="pgscript\generators\pgsDateGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsDateTimeGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsDictionaryGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsIntegerGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsNumberGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsObjectGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsRealGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsReferenceGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsRegexGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsStringGen.cpp" />
-    <ClCompile Include="pgscript\generators\pgsTimeGen.cpp" />
-    <ClCompile Include="pgscript\objects\pgsGenerator.cpp" />
-    <ClCompile Include="pgscript\objects\pgsNumber.cpp" />
-    <ClCompile Include="pgscript\objects\pgsRecord.cpp" />
-    <ClCompile Include="pgscript\objects\pgsString.cpp" />
-    <ClCompile Include="pgscript\objects\pgsVariable.cpp" />
-    <ClCompile Include="pgscript\statements\pgsAssertStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsBreakStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsContinueStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsDeclareRecordStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsExpressionStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsIfStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsPrintStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsProgram.cpp" />
-    <ClCompile Include="pgscript\statements\pgsStmt.cpp" />
-    <ClCompile Include="pgscript\statements\pgsStmtList.cpp" />
-    <ClCompile Include="pgscript\statements\pgsWhileStmt.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsAlloc.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsContext.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsDriver.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsMapm.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsThread.cpp" />
-    <ClCompile Include="pgscript\utilities\pgsUtilities.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm5sin.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_add.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_cpi.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_div.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_exp.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fam.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fft.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_flr.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fpf.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_gcd.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg2.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg3.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg4.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_log.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_mul.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_pow.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_rcp.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_rnd.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_set.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_sin.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmasin.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmasn0.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmcbrt.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmcnst.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmfact.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmfmul.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmgues.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmhasn.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmhsin.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmipwr.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmistr.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmpwr2.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmrsin.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmsqrt.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmstck.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutil.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutl1.cpp" />
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutl2.cpp" />
-    <ClCompile Include="ogl\basic.cpp" />
-    <ClCompile Include="ogl\basic2.cpp" />
-    <ClCompile Include="ogl\bmpshape.cpp" />
-    <ClCompile Include="ogl\canvas.cpp" />
-    <ClCompile Include="ogl\composit.cpp" />
-    <ClCompile Include="ogl\constrnt.cpp" />
-    <ClCompile Include="ogl\divided.cpp" />
-    <ClCompile Include="ogl\drawn.cpp" />
-    <ClCompile Include="ogl\lines.cpp" />
-    <ClCompile Include="ogl\mfutils.cpp" />
-    <ClCompile Include="ogl\ogldiag.cpp" />
-    <ClCompile Include="ogl\oglmisc.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddColumnFigure.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddColumnKindIcon.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddColumnOptionIcon.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddRelationshipFigure.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddRelationshipItem.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddRelationshipTerminal.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddTableFigure.cpp" />
-    <ClCompile Include="dd\dditems\figures\ddTextTableItemFigure.cpp" />
-    <ClCompile Include="dd\dditems\figures\xml\ddXmlStorage.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddAddColButtonHandle.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddAddFkButtonHandle.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddMinMaxTableButtonHandle.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddRemoveTableButtonHandle.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddScrollBarHandle.cpp" />
-    <ClCompile Include="dd\dditems\handles\ddSouthTableSizeHandle.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddAddColLocator.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddAddFkLocator.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddMinMaxTableLocator.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddRemoveTableLocator.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddScrollBarTableLocator.cpp" />
-    <ClCompile Include="dd\dditems\locators\ddTableBottomLocator.cpp" />
-    <ClCompile Include="dd\dditems\tools\ddColumnFigureTool.cpp" />
-    <ClCompile Include="dd\dditems\tools\ddColumnTextTool.cpp" />
-    <ClCompile Include="dd\dditems\utilities\ddPrecisionScaleDialog.cpp" />
-    <ClCompile Include="dd\dditems\utilities\ddSelectKindFksDialog.cpp" />
-    <ClCompile Include="dd\dditems\utilities\ddTableNameDialog.cpp" />
-    <ClCompile Include="dd\ddmodel\ddBrowserDataContainer.cpp" />
-    <ClCompile Include="dd\ddmodel\ddDatabaseDesign.cpp" />
-    <ClCompile Include="dd\ddmodel\ddDBReverseEnginering.cpp" />
-    <ClCompile Include="dd\ddmodel\ddDrawingEditor.cpp" />
-    <ClCompile Include="dd\ddmodel\ddDrawingView.cpp" />
-    <ClCompile Include="dd\ddmodel\ddGenerationWizard.cpp" />
-    <ClCompile Include="dd\ddmodel\ddModelBrowser.cpp" />
-    <ClCompile Include="hotdraw\connectors\hdChopBoxConnector.cpp" />
-    <ClCompile Include="hotdraw\connectors\hdIConnector.cpp" />
-    <ClCompile Include="hotdraw\connectors\hdLocatorConnector.cpp" />
-    <ClCompile Include="hotdraw\connectors\hdStickyRectangleConnector.cpp" />
-    <ClCompile Include="hotdraw\figures\hdAbstractFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdAbstractMenuFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdAttribute.cpp" />
-    <ClCompile Include="hotdraw\figures\hdAttributeFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdBitmapFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdCompositeFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdIConnectionFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdIFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdLineConnection.cpp" />
-    <ClCompile Include="hotdraw\figures\hdLineTerminal.cpp" />
-    <ClCompile Include="hotdraw\figures\hdPolyLineFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdRectangleFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\hdSimpleTextFigure.cpp" />
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFillAttribute.cpp" />
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontAttribute.cpp" />
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontColorAttribute.cpp" />
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdLineAttribute.cpp" />
-    <ClCompile Include="hotdraw\figures\xml\hdStorage.cpp" />
-    <ClCompile Include="hotdraw\handles\hdButtonHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionEndHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionStartHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdIHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdLineConnectionHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdLocatorHandle.cpp" />
-    <ClCompile Include="hotdraw\handles\hdPolyLineHandle.cpp" />
-    <ClCompile Include="hotdraw\locators\hdILocator.cpp" />
-    <ClCompile Include="hotdraw\locators\hdPolyLineLocator.cpp" />
-    <ClCompile Include="hotdraw\main\hdDrawing.cpp" />
-    <ClCompile Include="hotdraw\main\hdDrawingEditor.cpp" />
-    <ClCompile Include="hotdraw\main\hdDrawingView.cpp" />
-    <ClCompile Include="hotdraw\tools\hdAbstractTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdCanvasMenuTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdCompositeFigureTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdConnectionCreationTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdCreationTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdDragCreationTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdDragTrackerTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdFigureTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdHandleTrackerTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdITool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdMenuTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdPolyLineFigureTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdSelectAreaTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdSelectionTool.cpp" />
-    <ClCompile Include="hotdraw\tools\hdSimpleTextTool.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdArrayCollection.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdCollection.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdGeometry.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdKeyEvent.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdMouseEvent.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdMultiPosRect.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdPoint.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdRect.cpp" />
-    <ClCompile Include="hotdraw\utilities\hdRemoveDeleteDialog.cpp" />
-    <ClCompile Include="pgAdmin3.cpp">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="precomp.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
-      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
-      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="agent\module.mk" />
-    <None Include="ctl\module.mk" />
-    <None Include="db\module.mk" />
-    <None Include="dlg\module.mk" />
-    <None Include="frm\module.mk" />
-    <None Include="include\module.mk" />
-    <None Include="include\utils\module.mk" />
-    <None Include="include\ctl\module.mk" />
-    <None Include="include\images\module.mk" />
-    <None Include="include\images\pgAdmin3.ico" />
-    <None Include="include\images\sql.ico" />
-    <None Include="include\parser\module.mk" />
-    <None Include="include\agent\module.mk" />
-    <None Include="include\slony\module.mk" />
-    <None Include="include\dlg\module.mk" />
-    <None Include="include\frm\module.mk" />
-    <None Include="include\schema\module.mk" />
-    <None Include="include\db\module.mk" />
-    <None Include="include\gqb\module.mk" />
-    <None Include="include\pgscript\location.hh" />
-    <None Include="include\pgscript\parser.tab.hh" />
-    <None Include="include\pgscript\position.hh" />
-    <None Include="include\pgscript\stack.hh" />
-    <None Include="include\pgscript\exceptions\module.mk" />
-    <None Include="include\pgscript\expressions\module.mk" />
-    <None Include="include\pgscript\generators\module.mk" />
-    <None Include="include\pgscript\objects\module.mk" />
-    <None Include="include\pgscript\statements\module.mk" />
-    <None Include="include\pgscript\utilities\module.mk" />
-    <None Include="include\pgscript\utilities\mapm-lib\license.txt" />
-    <None Include="include\pgscript\utilities\mapm-lib\module.mk" />
-    <None Include="include\ogl\module.mk" />
-    <None Include="include\ogl\README" />
-    <None Include="include\dd\module.mk" />
-    <None Include="include\dd\dditems\module.mk" />
-    <None Include="include\dd\dditems\figures\module.mk" />
-    <None Include="include\dd\dditems\figures\xml\module.mk" />
-    <None Include="include\dd\dditems\handles\module.mk" />
-    <None Include="include\dd\dditems\locators\module.mk" />
-    <None Include="include\dd\dditems\tools\module.mk" />
-    <None Include="include\dd\dditems\utilities\module.mk" />
-    <None Include="include\dd\ddmodel\module.mk" />
-    <None Include="include\hotdraw\module.mk" />
-    <None Include="include\hotdraw\connectors\module.mk" />
-    <None Include="include\hotdraw\figures\module.mk" />
-    <None Include="include\hotdraw\figures\defaultAttributes\module.mk" />
-    <None Include="include\hotdraw\handles\module.mk" />
-    <None Include="include\hotdraw\locators\module.mk" />
-    <None Include="include\hotdraw\main\module.mk" />
-    <None Include="include\hotdraw\tools\module.mk" />
-    <None Include="include\hotdraw\utilities\module.mk" />
-    <None Include="schema\module.mk" />
-    <None Include="slony\module.mk" />
-    <None Include="ui\dlgAddFavourite.xrc" />
-    <None Include="ui\dlgAggregate.xrc" />
-    <None Include="ui\dlgCast.xrc" />
-    <None Include="ui\dlgCheck.xrc" />
-    <None Include="ui\dlgCollation.xrc" />
-    <None Include="ui\dlgColumn.xrc" />
-    <None Include="ui\dlgConnect.xrc" />
-    <None Include="ui\dlgConversion.xrc" />
-    <None Include="ui\dlgDatabase.xrc" />
-    <None Include="ui\dlgDirectDbg.xrc" />
-    <None Include="ui\dlgDomain.xrc" />
-    <None Include="ui\dlgEditGridOptions.xrc" />
-    <None Include="ui\dlgExtension.xrc" />
-    <None Include="ui\dlgExtTable.xrc" />
-    <None Include="ui\dlgFindReplace.xrc" />
-    <None Include="ui\dlgForeignDataWrapper.xrc" />
-    <None Include="ui\dlgForeignKey.xrc" />
-    <None Include="ui\dlgForeignServer.xrc" />
-    <None Include="ui\dlgForeignTable.xrc" />
-    <None Include="ui\dlgFunction.xrc" />
-    <None Include="ui\dlgGroup.xrc" />
-    <None Include="ui\dlgHbaConfig.xrc" />
-    <None Include="ui\dlgIndex.xrc" />
-    <None Include="ui\dlgIndexConstraint.xrc" />
-    <None Include="ui\dlgJob.xrc" />
-    <None Include="ui\dlgLanguage.xrc" />
-    <None Include="ui\dlgMainConfig.xrc" />
-    <None Include="ui\dlgManageFavourites.xrc" />
-    <None Include="ui\dlgManageMacros.xrc" />
-    <None Include="ui\dlgOperator.xrc" />
-    <None Include="ui\dlgPackage.xrc" />
-    <None Include="ui\dlgPgpassConfig.xrc" />
-    <None Include="ui\dlgReassignDropOwned.xrc" />
-    <None Include="ui\dlgRepCluster.xrc" />
-    <None Include="ui\dlgRepClusterUpgrade.xrc" />
-    <None Include="ui\dlgRepListen.xrc" />
-    <None Include="ui\dlgRepNode.xrc" />
-    <None Include="ui\dlgRepPath.xrc" />
-    <None Include="ui\dlgRepSequence.xrc" />
-    <None Include="ui\dlgRepSet.xrc" />
-    <None Include="ui\dlgRepSetMerge.xrc" />
-    <None Include="ui\dlgRepSetMove.xrc" />
-    <None Include="ui\dlgRepSubscription.xrc" />
-    <None Include="ui\dlgRepTable.xrc" />
-    <None Include="ui\dlgRole.xrc" />
-    <None Include="ui\dlgRule.xrc" />
-    <None Include="ui\dlgSchedule.xrc" />
-    <None Include="ui\dlgSchema.xrc" />
-    <None Include="ui\dlgSearchObject.xrc" />
-    <None Include="ui\dlgSelectConnection.xrc" />
-    <None Include="ui\dlgSequence.xrc" />
-    <None Include="ui\dlgServer.xrc" />
-    <None Include="ui\dlgStep.xrc" />
-    <None Include="ui\dlgSynonym.xrc" />
-    <None Include="ui\dlgTable.xrc" />
-    <None Include="ui\dlgTablespace.xrc" />
-    <None Include="ui\dlgTextSearchConfiguration.xrc" />
-    <None Include="ui\dlgTextSearchDictionary.xrc" />
-    <None Include="ui\dlgTextSearchParser.xrc" />
-    <None Include="ui\dlgTextSearchTemplate.xrc" />
-    <None Include="ui\dlgTrigger.xrc" />
-    <None Include="ui\dlgType.xrc" />
-    <None Include="ui\dlgUser.xrc" />
-    <None Include="ui\dlgUserMapping.xrc" />
-    <None Include="ui\dlgView.xrc" />
-    <None Include="ui\embed-xrc" />
-    <None Include="ui\embed-xrc.bat" />
-    <None Include="ui\frmBackup.xrc" />
-    <None Include="ui\frmBackupGlobals.xrc" />
-    <None Include="ui\frmBackupServer.xrc" />
-    <None Include="ui\frmExport.xrc" />
-    <None Include="ui\frmGrantWizard.xrc" />
-    <None Include="ui\frmHint.xrc" />
-    <None Include="ui\frmMaintenance.xrc" />
-    <None Include="ui\frmOptions.xrc" />
-    <None Include="ui\frmPassword.xrc" />
-    <None Include="ui\frmReport.xrc" />
-    <None Include="ui\frmRestore.xrc" />
-    <None Include="ui\module.mk" />
-    <None Include="utils\module.mk" />
-    <None Include="utils\tab-complete.inc" />
-    <None Include="utils\tabcomplete.pl" />
-    <None Include="gqb\module.mk" />
-    <None Include="pgscript\module.mk" />
-    <None Include="pgscript\parser.sh" />
-    <None Include="pgscript\pgsParser.yy" />
-    <None Include="pgscript\pgsScanner.ll" />
-    <None Include="pgscript\README" />
-    <None Include="pgscript\exceptions\module.mk" />
-    <None Include="pgscript\expressions\module.mk" />
-    <None Include="pgscript\generators\module.mk" />
-    <None Include="pgscript\objects\module.mk" />
-    <None Include="pgscript\statements\module.mk" />
-    <None Include="pgscript\utilities\module.mk" />
-    <None Include="pgscript\utilities\m_apm\module.mk" />
-    <None Include="ogl\module.mk" />
-    <None Include="ogl\README" />
-    <None Include="dd\module.mk" />
-    <None Include="dd\dditems\module.mk" />
-    <None Include="dd\dditems\figures\module.mk" />
-    <None Include="dd\dditems\handles\module.mk" />
-    <None Include="dd\dditems\locators\module.mk" />
-    <None Include="dd\dditems\tools\module.mk" />
-    <None Include="dd\dditems\utilities\module.mk" />
-    <None Include="dd\ddmodel\module.mk" />
-    <None Include="hotdraw\module.mk" />
-    <None Include="hotdraw\connectors\module.mk" />
-    <None Include="hotdraw\figures\module.mk" />
-    <None Include="hotdraw\figures\defaultAttributes\module.mk" />
-    <None Include="hotdraw\figures\xml\module.mk" />
-    <None Include="hotdraw\handles\module.mk" />
-    <None Include="hotdraw\locators\module.mk" />
-    <None Include="hotdraw\main\module.mk" />
-    <None Include="hotdraw\tools\module.mk" />
-    <None Include="hotdraw\utilities\module.mk" />
-    <None Include="Makefile.am" />
-    <None Include="plugins.ini" />
-    <None Include="settings.ini" />
-    <None Include="ver_svn.bat" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="include\copyright.h" />
-    <ClInclude Include="include\pgAdmin3.h" />
-    <ClInclude Include="include\postgres.h" />
-    <ClInclude Include="include\precomp.h" />
-    <ClInclude Include="include\svnversion.h" />
-    <ClInclude Include="include\version.h" />
-    <ClInclude Include="include\utils\csvfiles.h" />
-    <ClInclude Include="include\utils\factory.h" />
-    <ClInclude Include="include\utils\favourites.h" />
-    <ClInclude Include="include\utils\macros.h" />
-    <ClInclude Include="include\utils\misc.h" />
-    <ClInclude Include="include\utils\pgconfig.h" />
-    <ClInclude Include="include\utils\pgDefs.h" />
-    <ClInclude Include="include\utils\pgfeatures.h" />
-    <ClInclude Include="include\utils\registr.h" />
-    <ClInclude Include="include\utils\registry.h" />
-    <ClInclude Include="include\utils\sysLogger.h" />
-    <ClInclude Include="include\utils\sysProcess.h" />
-    <ClInclude Include="include\utils\sysSettings.h" />
-    <ClInclude Include="include\utils\utffile.h" />
-    <ClInclude Include="include\ctl\calbox.h" />
-    <ClInclude Include="include\ctl\ctlAuiNotebook.h" />
-    <ClInclude Include="include\ctl\ctlCheckTreeView.h" />
-    <ClInclude Include="include\ctl\ctlColourPicker.h" />
-    <ClInclude Include="include\ctl\ctlComboBox.h" />
-    <ClInclude Include="include\ctl\ctlDefaultSecurityPanel.h" />
-    <ClInclude Include="include\ctl\ctlListView.h" />
-    <ClInclude Include="include\ctl\ctlMenuToolbar.h" />
-    <ClInclude Include="include\ctl\ctlSeclabelPanel.h" />
-    <ClInclude Include="include\ctl\ctlSecurityPanel.h" />
-    <ClInclude Include="include\ctl\ctlSQLBox.h" />
-    <ClInclude Include="include\ctl\ctlSQLGrid.h" />
-    <ClInclude Include="include\ctl\ctlSQLResult.h" />
-    <ClInclude Include="include\ctl\ctlTree.h" />
-    <ClInclude Include="include\ctl\explainCanvas.h" />
-    <ClInclude Include="include\ctl\timespin.h" />
-    <ClInclude Include="include\ctl\wxgridsel.h" />
-    <ClInclude Include="include\ctl\xh_calb.h" />
-    <ClInclude Include="include\ctl\xh_ctlchecktreeview.h" />
-    <ClInclude Include="include\ctl\xh_ctlcolourpicker.h" />
-    <ClInclude Include="include\ctl\xh_ctlcombo.h" />
-    <ClInclude Include="include\ctl\xh_ctltree.h" />
-    <ClInclude Include="include\ctl\xh_sqlbox.h" />
-    <ClInclude Include="include\ctl\xh_timespin.h" />
-    <ClInclude Include="include\parser\keywords.h" />
-    <ClInclude Include="include\agent\dlgJob.h" />
-    <ClInclude Include="include\agent\dlgSchedule.h" />
-    <ClInclude Include="include\agent\dlgStep.h" />
-    <ClInclude Include="include\agent\pgaJob.h" />
-    <ClInclude Include="include\agent\pgaSchedule.h" />
-    <ClInclude Include="include\agent\pgaStep.h" />
-    <ClInclude Include="include\slony\dlgRepCluster.h" />
-    <ClInclude Include="include\slony\dlgRepListen.h" />
-    <ClInclude Include="include\slony\dlgRepNode.h" />
-    <ClInclude Include="include\slony\dlgRepPath.h" />
-    <ClInclude Include="include\slony\dlgRepProperty.h" />
-    <ClInclude Include="include\slony\dlgRepSequence.h" />
-    <ClInclude Include="include\slony\dlgRepSet.h" />
-    <ClInclude Include="include\slony\dlgRepSubscription.h" />
-    <ClInclude Include="include\slony\dlgRepTable.h" />
-    <ClInclude Include="include\slony\slCluster.h" />
-    <ClInclude Include="include\slony\slListen.h" />
-    <ClInclude Include="include\slony\slNode.h" />
-    <ClInclude Include="include\slony\slPath.h" />
-    <ClInclude Include="include\slony\slSequence.h" />
-    <ClInclude Include="include\slony\slSet.h" />
-    <ClInclude Include="include\slony\slSubscription.h" />
-    <ClInclude Include="include\slony\slTable.h" />
-    <ClInclude Include="include\dlg\dlgAddFavourite.h" />
-    <ClInclude Include="include\dlg\dlgAggregate.h" />
-    <ClInclude Include="include\dlg\dlgCast.h" />
-    <ClInclude Include="include\dlg\dlgCheck.h" />
-    <ClInclude Include="include\dlg\dlgClasses.h" />
-    <ClInclude Include="include\dlg\dlgCollation.h" />
-    <ClInclude Include="include\dlg\dlgColumn.h" />
-    <ClInclude Include="include\dlg\dlgConnect.h" />
-    <ClInclude Include="include\dlg\dlgConversion.h" />
-    <ClInclude Include="include\dlg\dlgDatabase.h" />
-    <ClInclude Include="include\dlg\dlgDomain.h" />
-    <ClInclude Include="include\dlg\dlgEditGridOptions.h" />
-    <ClInclude Include="include\dlg\dlgExtension.h" />
-    <ClInclude Include="include\dlg\dlgExtTable.h" />
-    <ClInclude Include="include\dlg\dlgFindReplace.h" />
-    <ClInclude Include="include\dlg\dlgForeignDataWrapper.h" />
-    <ClInclude Include="include\dlg\dlgForeignKey.h" />
-    <ClInclude Include="include\dlg\dlgForeignServer.h" />
-    <ClInclude Include="include\dlg\dlgForeignTable.h" />
-    <ClInclude Include="include\dlg\dlgFunction.h" />
-    <ClInclude Include="include\dlg\dlgGroup.h" />
-    <ClInclude Include="include\dlg\dlgHbaConfig.h" />
-    <ClInclude Include="include\dlg\dlgIndex.h" />
-    <ClInclude Include="include\dlg\dlgIndexConstraint.h" />
-    <ClInclude Include="include\dlg\dlgLanguage.h" />
-    <ClInclude Include="include\dlg\dlgMainConfig.h" />
-    <ClInclude Include="include\dlg\dlgManageFavourites.h" />
-    <ClInclude Include="include\dlg\dlgManageMacros.h" />
-    <ClInclude Include="include\dlg\dlgOperator.h" />
-    <ClInclude Include="include\dlg\dlgPackage.h" />
-    <ClInclude Include="include\dlg\dlgPgpassConfig.h" />
-    <ClInclude Include="include\dlg\dlgProperty.h" />
-    <ClInclude Include="include\dlg\dlgReassignDropOwned.h" />
-    <ClInclude Include="include\dlg\dlgRole.h" />
-    <ClInclude Include="include\dlg\dlgRule.h" />
-    <ClInclude Include="include\dlg\dlgSchema.h" />
-    <ClInclude Include="include\dlg\dlgSearchObject.h" />
-    <ClInclude Include="include\dlg\dlgSelectConnection.h" />
-    <ClInclude Include="include\dlg\dlgSelectDatabase.h" />
-    <ClInclude Include="include\dlg\dlgSequence.h" />
-    <ClInclude Include="include\dlg\dlgServer.h" />
-    <ClInclude Include="include\dlg\dlgSynonym.h" />
-    <ClInclude Include="include\dlg\dlgTable.h" />
-    <ClInclude Include="include\dlg\dlgTablespace.h" />
-    <ClInclude Include="include\dlg\dlgTextSearchConfiguration.h" />
-    <ClInclude Include="include\dlg\dlgTextSearchDictionary.h" />
-    <ClInclude Include="include\dlg\dlgTextSearchParser.h" />
-    <ClInclude Include="include\dlg\dlgTextSearchTemplate.h" />
-    <ClInclude Include="include\dlg\dlgTrigger.h" />
-    <ClInclude Include="include\dlg\dlgType.h" />
-    <ClInclude Include="include\dlg\dlgUser.h" />
-    <ClInclude Include="include\dlg\dlgUserMapping.h" />
-    <ClInclude Include="include\dlg\dlgView.h" />
-    <ClInclude Include="include\frm\frmAbout.h" />
-    <ClInclude Include="include\frm\frmBackup.h" />
-    <ClInclude Include="include\frm\frmBackupGlobals.h" />
-    <ClInclude Include="include\frm\frmBackupServer.h" />
-    <ClInclude Include="include\frm\frmConfig.h" />
-    <ClInclude Include="include\frm\frmDatabaseDesigner.h" />
-    <ClInclude Include="include\frm\frmEditGrid.h" />
-    <ClInclude Include="include\frm\frmExport.h" />
-    <ClInclude Include="include\frm\frmGrantWizard.h" />
-    <ClInclude Include="include\frm\frmHbaConfig.h" />
-    <ClInclude Include="include\frm\frmHint.h" />
-    <ClInclude Include="include\frm\frmImport.h" />
-    <ClInclude Include="include\frm\frmMain.h" />
-    <ClInclude Include="include\frm\frmMainConfig.h" />
-    <ClInclude Include="include\frm\frmMaintenance.h" />
-    <ClInclude Include="include\frm\frmOptions.h" />
-    <ClInclude Include="include\frm\frmPassword.h" />
-    <ClInclude Include="include\frm\frmPgpassConfig.h" />
-    <ClInclude Include="include\frm\frmQuery.h" />
-    <ClInclude Include="include\frm\frmReport.h" />
-    <ClInclude Include="include\frm\frmRestore.h" />
-    <ClInclude Include="include\frm\frmSplash.h" />
-    <ClInclude Include="include\frm\frmStatus.h" />
-    <ClInclude Include="include\frm\menu.h" />
-    <ClInclude Include="include\schema\edbPackage.h" />
-    <ClInclude Include="include\schema\edbPackageFunction.h" />
-    <ClInclude Include="include\schema\edbPackageVariable.h" />
-    <ClInclude Include="include\schema\edbPrivateSynonym.h" />
-    <ClInclude Include="include\schema\edbSynonym.h" />
-    <ClInclude Include="include\schema\gpExtTable.h" />
-    <ClInclude Include="include\schema\gpPartition.h" />
-    <ClInclude Include="include\schema\gpResQueue.h" />
-    <ClInclude Include="include\schema\pgAggregate.h" />
-    <ClInclude Include="include\schema\pgCast.h" />
-    <ClInclude Include="include\schema\pgCatalogObject.h" />
-    <ClInclude Include="include\schema\pgCheck.h" />
-    <ClInclude Include="include\schema\pgCollation.h" />
-    <ClInclude Include="include\schema\pgCollection.h" />
-    <ClInclude Include="include\schema\pgColumn.h" />
-    <ClInclude Include="include\schema\pgConstraints.h" />
-    <ClInclude Include="include\schema\pgConversion.h" />
-    <ClInclude Include="include\schema\pgDatabase.h" />
-    <ClInclude Include="include\schema\pgDatatype.h" />
-    <ClInclude Include="include\schema\pgDomain.h" />
-    <ClInclude Include="include\schema\pgExtension.h" />
-    <ClInclude Include="include\schema\pgForeignDataWrapper.h" />
-    <ClInclude Include="include\schema\pgForeignKey.h" />
-    <ClInclude Include="include\schema\pgForeignServer.h" />
-    <ClInclude Include="include\schema\pgForeignTable.h" />
-    <ClInclude Include="include\schema\pgFunction.h" />
-    <ClInclude Include="include\schema\pgGroup.h" />
-    <ClInclude Include="include\schema\pgIndex.h" />
-    <ClInclude Include="include\schema\pgIndexConstraint.h" />
-    <ClInclude Include="include\schema\pgLanguage.h" />
-    <ClInclude Include="include\schema\pgObject.h" />
-    <ClInclude Include="include\schema\pgOperator.h" />
-    <ClInclude Include="include\schema\pgOperatorClass.h" />
-    <ClInclude Include="include\schema\pgOperatorFamily.h" />
-    <ClInclude Include="include\schema\pgRole.h" />
-    <ClInclude Include="include\schema\pgRule.h" />
-    <ClInclude Include="include\schema\pgSchema.h" />
-    <ClInclude Include="include\schema\pgSequence.h" />
-    <ClInclude Include="include\schema\pgServer.h" />
-    <ClInclude Include="include\schema\pgTable.h" />
-    <ClInclude Include="include\schema\pgTablespace.h" />
-    <ClInclude Include="include\schema\pgTextSearchConfiguration.h" />
-    <ClInclude Include="include\schema\pgTextSearchDictionary.h" />
-    <ClInclude Include="include\schema\pgTextSearchParser.h" />
-    <ClInclude Include="include\schema\pgTextSearchTemplate.h" />
-    <ClInclude Include="include\schema\pgTrigger.h" />
-    <ClInclude Include="include\schema\pgType.h" />
-    <ClInclude Include="include\schema\pgUser.h" />
-    <ClInclude Include="include\schema\pgUserMapping.h" />
-    <ClInclude Include="include\schema\pgView.h" />
-    <ClInclude Include="include\db\pgConn.h" />
-    <ClInclude Include="include\db\pgQueryThread.h" />
-    <ClInclude Include="include\db\pgQueryResultEvent.h"/>
-    <ClInclude Include="include\db\pgSet.h" />
-    <ClInclude Include="include\debugger\ctlMessageWindow.h" />
-    <ClInclude Include="include\debugger\ctlResultGrid.h" />
-    <ClInclude Include="include\debugger\ctlStackWindow.h" />
-    <ClInclude Include="include\debugger\ctlTabWindow.h" />
-    <ClInclude Include="include\debugger\ctlVarWindow.h" />
-    <ClInclude Include="include\debugger\dbgBreakPoint.h" />
-    <ClInclude Include="include\debugger\dbgConst.h" />
-    <ClInclude Include="include\debugger\dbgController.h"/>
-    <ClInclude Include="include\debugger\dbgModel.h"/>
-    <ClInclude Include="include\debugger\dbgTargetInfo.h" />
-    <ClInclude Include="include\debugger\debugger.h" />
-    <ClInclude Include="include\debugger\dlgDirectDbg.h" />
-    <ClInclude Include="include\debugger\frmDebugger.h" />
-    <ClInclude Include="include\gqb\gqbArrayCollection.h" />
-    <ClInclude Include="include\gqb\gqbBrowser.h" />
-    <ClInclude Include="include\gqb\gqbCollection.h" />
-    <ClInclude Include="include\gqb\gqbCollectionBase.h" />
-    <ClInclude Include="include\gqb\gqbColumn.h" />
-    <ClInclude Include="include\gqb\gqbDatabase.h" />
-    <ClInclude Include="include\gqb\gqbEvents.h" />
-    <ClInclude Include="include\gqb\gqbGraphBehavior.h" />
-    <ClInclude Include="include\gqb\gqbGraphSimple.h" />
-    <ClInclude Include="include\gqb\gqbGridJoinTable.h" />
-    <ClInclude Include="include\gqb\gqbGridOrderTable.h" />
-    <ClInclude Include="include\gqb\gqbGridProjTable.h" />
-    <ClInclude Include="include\gqb\gqbGridRestTable.h" />
-    <ClInclude Include="include\gqb\gqbModel.h" />
-    <ClInclude Include="include\gqb\gqbObject.h" />
-    <ClInclude Include="include\gqb\gqbObjectCollection.h" />
-    <ClInclude Include="include\gqb\gqbQueryObjs.h" />
-    <ClInclude Include="include\gqb\gqbSchema.h" />
-    <ClInclude Include="include\gqb\gqbTable.h" />
-    <ClInclude Include="include\gqb\gqbViewController.h" />
-    <ClInclude Include="include\gqb\gqbViewPanels.h" />
-    <ClInclude Include="include\pgscript\FlexLexer.h" />
-    <ClInclude Include="include\pgscript\pgsApplication.h" />
-    <ClInclude Include="include\pgscript\pgScript.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsArithmeticException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsAssertException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsBreakException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsCastException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsContinueException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsInterruptException.h" />
-    <ClInclude Include="include\pgscript\exceptions\pgsParameterException.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsAnd.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsAssign.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsAssignToRecord.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsCast.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsColumns.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsDifferent.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsEqual.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsExecute.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsExpression.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsExpressions.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenDate.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenDateTime.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenDictionary.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenInt.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenReal.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenReference.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenRegex.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenString.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGenTime.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGreater.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsGreaterEqual.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsIdent.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsIdentRecord.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsLines.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsLower.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsLowerEqual.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsMinus.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsModulo.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsNegate.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsNot.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsOperation.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsOr.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsOver.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsParenthesis.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsPlus.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsRemoveLine.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsTimes.h" />
-    <ClInclude Include="include\pgscript\expressions\pgsTrim.h" />
-    <ClInclude Include="include\pgscript\generators\pgsDateGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsDateTimeGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsDictionaryGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsIntegerGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsNumberGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsObjectGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsRealGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsReferenceGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsRegexGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsStringGen.h" />
-    <ClInclude Include="include\pgscript\generators\pgsTimeGen.h" />
-    <ClInclude Include="include\pgscript\objects\pgsGenerator.h" />
-    <ClInclude Include="include\pgscript\objects\pgsNumber.h" />
-    <ClInclude Include="include\pgscript\objects\pgsObjects.h" />
-    <ClInclude Include="include\pgscript\objects\pgsRecord.h" />
-    <ClInclude Include="include\pgscript\objects\pgsString.h" />
-    <ClInclude Include="include\pgscript\objects\pgsVariable.h" />
-    <ClInclude Include="include\pgscript\statements\pgsAssertStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsBreakStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsContinueStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsDeclareRecordStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsExpressionStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsIfStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsPrintStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsProgram.h" />
-    <ClInclude Include="include\pgscript\statements\pgsStatements.h" />
-    <ClInclude Include="include\pgscript\statements\pgsStmt.h" />
-    <ClInclude Include="include\pgscript\statements\pgsStmtList.h" />
-    <ClInclude Include="include\pgscript\statements\pgsWhileStmt.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsAlloc.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsContext.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsCopiedPtr.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsDriver.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsMapm.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsScanner.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsSharedPtr.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsThread.h" />
-    <ClInclude Include="include\pgscript\utilities\pgsUtilities.h" />
-    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm.h" />
-    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm_lc.h" />
-    <ClInclude Include="include\ogl\basic.h" />
-    <ClInclude Include="include\ogl\basicp.h" />
-    <ClInclude Include="include\ogl\bmpshape.h" />
-    <ClInclude Include="include\ogl\canvas.h" />
-    <ClInclude Include="include\ogl\composit.h" />
-    <ClInclude Include="include\ogl\constrnt.h" />
-    <ClInclude Include="include\ogl\divided.h" />
-    <ClInclude Include="include\ogl\drawn.h" />
-    <ClInclude Include="include\ogl\drawnp.h" />
-    <ClInclude Include="include\ogl\lines.h" />
-    <ClInclude Include="include\ogl\linesp.h" />
-    <ClInclude Include="include\ogl\mfutils.h" />
-    <ClInclude Include="include\ogl\misc.h" />
-    <ClInclude Include="include\ogl\ogl.h" />
-    <ClInclude Include="include\ogl\ogldiag.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddColumnFigure.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddColumnKindIcon.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddColumnOptionIcon.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipFigure.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipItem.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipTerminal.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddTableFigure.h" />
-    <ClInclude Include="include\dd\dditems\figures\ddTextTableItemFigure.h" />
-    <ClInclude Include="include\dd\dditems\figures\xml\ddXmlStorage.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddAddColButtonHandle.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddAddFkButtonHandle.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddMinMaxTableButtonHandle.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddRemoveTableButtonHandle.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddScrollBarHandle.h" />
-    <ClInclude Include="include\dd\dditems\handles\ddSouthTableSizeHandle.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddAddColLocator.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddAddFkLocator.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddMinMaxTableLocator.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddRemoveTableLocator.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddScrollBarTableLocator.h" />
-    <ClInclude Include="include\dd\dditems\locators\ddTableBottomLocator.h" />
-    <ClInclude Include="include\dd\dditems\tools\ddColumnFigureTool.h" />
-    <ClInclude Include="include\dd\dditems\tools\ddColumnTextTool.h" />
-    <ClInclude Include="include\dd\dditems\utilities\ddDataType.h" />
-    <ClInclude Include="include\dd\dditems\utilities\ddPrecisionScaleDialog.h" />
-    <ClInclude Include="include\dd\dditems\utilities\ddSelectKindFksDialog.h" />
-    <ClInclude Include="include\dd\dditems\utilities\ddTableNameDialog.h" />
-    <ClInclude Include="include\dd\ddmodel\ddBrowserDataContainer.h" />
-    <ClInclude Include="include\dd\ddmodel\ddDatabaseDesign.h" />
-    <ClInclude Include="include\dd\ddmodel\ddDBReverseEngineering.h" />
-    <ClInclude Include="include\dd\ddmodel\ddDrawingEditor.h" />
-    <ClInclude Include="include\dd\ddmodel\ddDrawingView.h" />
-    <ClInclude Include="include\dd\ddmodel\ddGenerationWizard.h" />
-    <ClInclude Include="include\dd\ddmodel\ddModelBrowser.h" />
-    <ClInclude Include="include\hotdraw\connectors\hdChopBoxConnector.h" />
-    <ClInclude Include="include\hotdraw\connectors\hdIConnector.h" />
-    <ClInclude Include="include\hotdraw\connectors\hdLocatorConnector.h" />
-    <ClInclude Include="include\hotdraw\connectors\hdStickyRectangleConnector.h" />
-    <ClInclude Include="include\hotdraw\figures\hdAbstractFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdAbstractMenuFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdAttribute.h" />
-    <ClInclude Include="include\hotdraw\figures\hdAttributeFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdBitmapFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdCompositeFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdIConnectionFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdIFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdLineConnection.h" />
-    <ClInclude Include="include\hotdraw\figures\hdLineTerminal.h" />
-    <ClInclude Include="include\hotdraw\figures\hdPolyLineFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdRectangleFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\hdSimpleTextFigure.h" />
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFillAttribute.h" />
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontAttribute.h" />
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontColorAttribute.h" />
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdLineAttribute.h" />
-    <ClInclude Include="include\hotdraw\figures\xml\hdStorage.h" />
-    <ClInclude Include="include\hotdraw\handles\hdButtonHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionEndHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionStartHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdIHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdLineConnectionHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdLocatorHandle.h" />
-    <ClInclude Include="include\hotdraw\handles\hdPolyLineHandle.h" />
-    <ClInclude Include="include\hotdraw\locators\hdILocator.h" />
-    <ClInclude Include="include\hotdraw\locators\hdPolyLineLocator.h" />
-    <ClInclude Include="include\hotdraw\main\hdDrawing.h" />
-    <ClInclude Include="include\hotdraw\main\hdDrawingEditor.h" />
-    <ClInclude Include="include\hotdraw\main\hdDrawingView.h" />
-    <ClInclude Include="include\hotdraw\main\hdObject.h" />
-    <ClInclude Include="include\hotdraw\tools\hdAbstractTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdCanvasMenuTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdCompositeFigureTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdConnectionCreationTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdCreationTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdDragCreationTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdDragTrackerTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdFigureTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdHandleTrackerTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdITool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdMenuTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdPolyLineFigureTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdSelectAreaTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdSelectionTool.h" />
-    <ClInclude Include="include\hotdraw\tools\hdSimpleTextTool.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdArrayCollection.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdCollection.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdCollectionBase.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdGeometry.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdKeyEvent.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdMouseEvent.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdMultiPosRect.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdPoint.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdRect.h" />
-    <ClInclude Include="include\hotdraw\utilities\hdRemoveDeleteDialog.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <png2c Include="include\images\aggregate-sm.png" />
-    <png2c Include="include\images\aggregate.png" />
-    <png2c Include="include\images\aggregates.png" />
-    <png2c Include="include\images\back.png" />
-    <png2c Include="include\images\backup.png" />
-    <png2c Include="include\images\baddatabase.png" />
-    <png2c Include="include\images\cast-sm.png" />
-    <png2c Include="include\images\cast.png" />
-    <png2c Include="include\images\casts.png" />
-    <png2c Include="include\images\catalog-sm.png" />
-    <png2c Include="include\images\catalog.png" />
-    <png2c Include="include\images\catalogobject-sm.png" />
-    <png2c Include="include\images\catalogobject.png" />
-    <png2c Include="include\images\catalogobjects.png" />
-    <png2c Include="include\images\catalogs.png" />
-    <png2c Include="include\images\check.png" />
-    <png2c Include="include\images\checkbad.png" />
-    <png2c Include="include\images\checked.png" />
-    <png2c Include="include\images\clearAll.png" />
-    <png2c Include="include\images\clip_copy.png" />
-    <png2c Include="include\images\clip_cut.png" />
-    <png2c Include="include\images\clip_paste.png" />
-    <png2c Include="include\images\closeddatabase-sm.png" />
-    <png2c Include="include\images\closeddatabase.png" />
-    <png2c Include="include\images\collation-sm.png" />
-    <png2c Include="include\images\collation.png" />
-    <png2c Include="include\images\collations.png" />
-    <png2c Include="include\images\column-sm.png" />
-    <png2c Include="include\images\column.png" />
-    <png2c Include="include\images\columns.png" />
-    <png2c Include="include\images\configuration.png" />
-    <png2c Include="include\images\configurations.png" />
-    <png2c Include="include\images\connect.png" />
-    <png2c Include="include\images\constraints.png" />
-    <png2c Include="include\images\continue.png" />
-    <png2c Include="include\images\conversion.png" />
-    <png2c Include="include\images\conversions.png" />
-    <png2c Include="include\images\create.png" />
-    <png2c Include="include\images\database-sm.png" />
-    <png2c Include="include\images\database.png" />
-    <png2c Include="include\images\databases.png" />
-    <png2c Include="include\images\ddAddColumn.png" />
-    <png2c Include="include\images\ddAddColumnCursor.png" />
-    <png2c Include="include\images\ddAddForeignKey.png" />
-    <png2c Include="include\images\ddcancel.png" />
-    <png2c Include="include\images\ddDeleteTableCursor.png" />
-    <png2c Include="include\images\ddDown.png" />
-    <png2c Include="include\images\ddforeignkey.png" />
-    <png2c Include="include\images\ddforeignkeyfromuk.png" />
-    <png2c Include="include\images\ddforeignkeyuniquekey.png" />
-    <png2c Include="include\images\ddforeignkeyuniquekeyfromuk.png" />
-    <png2c Include="include\images\ddgendiagram.png" />
-    <png2c Include="include\images\ddMaximizeTable.png" />
-    <png2c Include="include\images\ddMinimizeTable.png" />
-    <png2c Include="include\images\ddMinMaxCursor.png" />
-    <png2c Include="include\images\ddmodel-32.png" />
-    <png2c Include="include\images\ddnewdiagram.png" />
-    <png2c Include="include\images\ddnotnull.png" />
-    <png2c Include="include\images\ddnull.png" />
-    <png2c Include="include\images\ddprimaryforeignkey.png" />
-    <png2c Include="include\images\ddprimaryforeignkeyfromuk.png" />
-    <png2c Include="include\images\ddprimarykey.png" />
-    <png2c Include="include\images\ddprimarykeyuniquekey.png" />
-    <png2c Include="include\images\ddRelationshipCursor.png" />
-    <png2c Include="include\images\ddRemoveColumn.png" />
-    <png2c Include="include\images\ddRemoveColumnCursor.png" />
-    <png2c Include="include\images\ddRemoveTable.png" />
-    <png2c Include="include\images\ddRemoveTable2.png" />
-    <png2c Include="include\images\ddunique.png" />
-    <png2c Include="include\images\ddUp.png" />
-    <png2c Include="include\images\debugger.png" />
-    <png2c Include="include\images\delete.png" />
-    <png2c Include="include\images\dictionaries.png" />
-    <png2c Include="include\images\dictionary.png" />
-    <png2c Include="include\images\disabled.png" />
-    <png2c Include="include\images\dnd_copy.png" />
-    <png2c Include="include\images\dnd_move.png" />
-    <png2c Include="include\images\dnd_none.png" />
-    <png2c Include="include\images\domain-sm.png" />
-    <png2c Include="include\images\domain.png" />
-    <png2c Include="include\images\domains.png" />
-    <png2c Include="include\images\down.png" />
-    <png2c Include="include\images\drop.png" />
-    <png2c Include="include\images\edit_clear.png" />
-    <png2c Include="include\images\edit_find.png" />
-    <png2c Include="include\images\edit_redo.png" />
-    <png2c Include="include\images\edit_undo.png" />
-    <png2c Include="include\images\enumeration.png" />
-    <png2c Include="include\images\enumerations.png" />
-    <png2c Include="include\images\ex_aggregate.png" />
-    <png2c Include="include\images\ex_append.png" />
-    <png2c Include="include\images\ex_bmp_heap.png" />
-    <png2c Include="include\images\ex_bmp_index.png" />
-    <png2c Include="include\images\ex_broadcast_motion.png" />
-    <png2c Include="include\images\ex_cte_scan.png" />
-    <png2c Include="include\images\ex_gather_motion.png" />
-    <png2c Include="include\images\ex_group.png" />
-    <png2c Include="include\images\ex_hash.png" />
-    <png2c Include="include\images\ex_hash_anti_join.png" />
-    <png2c Include="include\images\ex_hash_semi_join.png" />
-    <png2c Include="include\images\ex_hash_setop_except.png" />
-    <png2c Include="include\images\ex_hash_setop_except_all.png" />
-    <png2c Include="include\images\ex_hash_setop_intersect.png" />
-    <png2c Include="include\images\ex_hash_setop_intersect_all.png" />
-    <png2c Include="include\images\ex_hash_setop_unknown.png" />
-    <png2c Include="include\images\ex_index_scan.png" />
-    <png2c Include="include\images\ex_join.png" />
-    <png2c Include="include\images\ex_limit.png" />
-    <png2c Include="include\images\ex_materialize.png" />
-    <png2c Include="include\images\ex_merge.png" />
-    <png2c Include="include\images\ex_merge_anti_join.png" />
-    <png2c Include="include\images\ex_merge_semi_join.png" />
-    <png2c Include="include\images\ex_nested.png" />
-    <png2c Include="include\images\ex_nested_loop_anti_join.png" />
-    <png2c Include="include\images\ex_nested_loop_semi_join.png" />
-    <png2c Include="include\images\ex_recursive_union.png" />
-    <png2c Include="include\images\ex_redistribute_motion.png" />
-    <png2c Include="include\images\ex_result.png" />
-    <png2c Include="include\images\ex_scan.png" />
-    <png2c Include="include\images\ex_seek.png" />
-    <png2c Include="include\images\ex_setop.png" />
-    <png2c Include="include\images\ex_sort.png" />
-    <png2c Include="include\images\ex_subplan.png" />
-    <png2c Include="include\images\ex_tid_scan.png" />
-    <png2c Include="include\images\ex_unique.png" />
-    <png2c Include="include\images\ex_unknown.png" />
-    <png2c Include="include\images\ex_window_aggregate.png" />
-    <png2c Include="include\images\ex_worktable_scan.png" />
-    <png2c Include="include\images\exclude.png" />
-    <png2c Include="include\images\extension-sm.png" />
-    <png2c Include="include\images\extension.png" />
-    <png2c Include="include\images\extensions.png" />
-    <png2c Include="include\images\exttable-sm.png" />
-    <png2c Include="include\images\exttable.png" />
-    <png2c Include="include\images\exttables.png" />
-    <png2c Include="include\images\favourite.png" />
-    <png2c Include="include\images\file_new.png" />
-    <png2c Include="include\images\file_open.png" />
-    <png2c Include="include\images\file_save.png" />
-    <png2c Include="include\images\folder.png" />
-    <png2c Include="include\images\foreigndatawrapper-sm.png" />
-    <png2c Include="include\images\foreigndatawrapper.png" />
-    <png2c Include="include\images\foreigndatawrappers.png" />
-    <png2c Include="include\images\foreignkey.png" />
-    <png2c Include="include\images\foreignkeybad.png" />
-    <png2c Include="include\images\foreignserver-sm.png" />
-    <png2c Include="include\images\foreignserver.png" />
-    <png2c Include="include\images\foreignservers.png" />
-    <png2c Include="include\images\foreigntable.png" />
-    <png2c Include="include\images\foreigntables.png" />
-    <png2c Include="include\images\forward.png" />
-    <png2c Include="include\images\function.png" />
-    <png2c Include="include\images\functions.png" />
-    <png2c Include="include\images\gqbAdd.png" />
-    <png2c Include="include\images\gqbAddRest.png" />
-    <png2c Include="include\images\gqbColNotSel.png" />
-    <png2c Include="include\images\gqbColSel.png" />
-    <png2c Include="include\images\gqbDown.png" />
-    <png2c Include="include\images\gqbDownBottom.png" />
-    <png2c Include="include\images\gqbJoin.png" />
-    <png2c Include="include\images\gqbJoinCursor.png" />
-    <png2c Include="include\images\gqbOrderAdd.png" />
-    <png2c Include="include\images\gqbOrderAddAll.png" />
-    <png2c Include="include\images\gqbOrderRemove.png" />
-    <png2c Include="include\images\gqbOrderRemoveAll.png" />
-    <png2c Include="include\images\gqbRemove.png" />
-    <png2c Include="include\images\gqbRemoveRest.png" />
-    <png2c Include="include\images\gqbUp.png" />
-    <png2c Include="include\images\gqbUpTop.png" />
-    <png2c Include="include\images\group.png" />
-    <png2c Include="include\images\groups.png" />
-    <png2c Include="include\images\help.png" />
-    <png2c Include="include\images\help2.png" />
-    <png2c Include="include\images\hint.png" />
-    <png2c Include="include\images\hint2.png" />
-    <png2c Include="include\images\index.png" />
-    <png2c Include="include\images\indexes.png" />
-    <png2c Include="include\images\job.png" />
-    <png2c Include="include\images\jobdisabled.png" />
-    <png2c Include="include\images\jobs.png" />
-    <png2c Include="include\images\key.png" />
-    <png2c Include="include\images\language-sm.png" />
-    <png2c Include="include\images\language.png" />
-    <png2c Include="include\images\languages.png" />
-    <png2c Include="include\images\loginroles.png" />
-    <png2c Include="include\images\namespace-sm.png" />
-    <png2c Include="include\images\namespace.png" />
-    <png2c Include="include\images\namespaces.png" />
-    <png2c Include="include\images\operator.png" />
-    <png2c Include="include\images\operatorclass.png" />
-    <png2c Include="include\images\operatorclasses.png" />
-    <png2c Include="include\images\operatorfamilies.png" />
-    <png2c Include="include\images\operatorfamily.png" />
-    <png2c Include="include\images\operators.png" />
-    <png2c Include="include\images\package.png" />
-    <png2c Include="include\images\packages.png" />
-    <png2c Include="include\images\parser.png" />
-    <png2c Include="include\images\parsers.png" />
-    <png2c Include="include\images\pgAdmin3-16.png" />
-    <png2c Include="include\images\pgAdmin3-32.png" />
-    <png2c Include="include\images\pgAdmin3.png" />
-    <png2c Include="include\images\plugins.png" />
-    <png2c Include="include\images\primarykey.png" />
-    <png2c Include="include\images\procedure.png" />
-    <png2c Include="include\images\procedures.png" />
-    <png2c Include="include\images\properties.png" />
-    <png2c Include="include\images\property.png" />
-    <png2c Include="include\images\query_cancel.png" />
-    <png2c Include="include\images\query_execfile.png" />
-    <png2c Include="include\images\query_execute.png" />
-    <png2c Include="include\images\query_explain.png" />
-    <png2c Include="include\images\query_pgscript.png" />
-    <png2c Include="include\images\readdata.png" />
-    <png2c Include="include\images\refresh.png" />
-    <png2c Include="include\images\reload.png" />
-    <png2c Include="include\images\restore.png" />
-    <png2c Include="include\images\roles.png" />
-    <png2c Include="include\images\rule.png" />
-    <png2c Include="include\images\rulebad.png" />
-    <png2c Include="include\images\rules.png" />
-    <png2c Include="include\images\schedule.png" />
-    <png2c Include="include\images\schedules.png" />
-    <png2c Include="include\images\sequence-repl.png" />
-    <png2c Include="include\images\sequence.png" />
-    <png2c Include="include\images\sequences.png" />
-    <png2c Include="include\images\server-sm.png" />
-    <png2c Include="include\images\server.png" />
-    <png2c Include="include\images\serverbad-sm.png" />
-    <png2c Include="include\images\serverbad.png" />
-    <png2c Include="include\images\servers.png" />
-    <png2c Include="include\images\setBreak.png" />
-    <png2c Include="include\images\slcluster.png" />
-    <png2c Include="include\images\slclusters.png" />
-    <png2c Include="include\images\sllisten.png" />
-    <png2c Include="include\images\sllistens.png" />
-    <png2c Include="include\images\slnode-disabled.png" />
-    <png2c Include="include\images\slnode-local.png" />
-    <png2c Include="include\images\slnode.png" />
-    <png2c Include="include\images\slnodes.png" />
-    <png2c Include="include\images\slpath.png" />
-    <png2c Include="include\images\slpaths.png" />
-    <png2c Include="include\images\slset.png" />
-    <png2c Include="include\images\slset2.png" />
-    <png2c Include="include\images\slsets.png" />
-    <png2c Include="include\images\slsubscription.png" />
-    <png2c Include="include\images\slsubscription2.png" />
-    <png2c Include="include\images\slsubscriptions.png" />
-    <png2c Include="include\images\sortfilter.png" />
-    <png2c Include="include\images\splash.png" />
-    <png2c Include="include\images\sql-16.png" />
-    <png2c Include="include\images\sql-32.png" />
-    <png2c Include="include\images\sql.png" />
-    <png2c Include="include\images\statistics.png" />
-    <png2c Include="include\images\step.png" />
-    <png2c Include="include\images\stepInto.png" />
-    <png2c Include="include\images\stepOver.png" />
-    <png2c Include="include\images\steps.png" />
-    <png2c Include="include\images\stop.png" />
-    <png2c Include="include\images\storedata.png" />
-    <png2c Include="include\images\synonym.png" />
-    <png2c Include="include\images\synonyms.png" />
-    <png2c Include="include\images\table-repl-sm.png" />
-    <png2c Include="include\images\table-repl.png" />
-    <png2c Include="include\images\table-sm.png" />
-    <png2c Include="include\images\table.png" />
-    <png2c Include="include\images\tables.png" />
-    <png2c Include="include\images\tablespace.png" />
-    <png2c Include="include\images\tablespaces.png" />
-    <png2c Include="include\images\template.png" />
-    <png2c Include="include\images\templates.png" />
-    <png2c Include="include\images\terminate_backend.png" />
-    <png2c Include="include\images\textsearch.png" />
-    <png2c Include="include\images\trigger.png" />
-    <png2c Include="include\images\triggerbad.png" />
-    <png2c Include="include\images\triggerfunction.png" />
-    <png2c Include="include\images\triggerfunctions.png" />
-    <png2c Include="include\images\triggers.png" />
-    <png2c Include="include\images\type.png" />
-    <png2c Include="include\images\types.png" />
-    <png2c Include="include\images\uncheck.png" />
-    <png2c Include="include\images\unchecked.png" />
-    <png2c Include="include\images\unique.png" />
-    <png2c Include="include\images\up.png" />
-    <png2c Include="include\images\user.png" />
-    <png2c Include="include\images\usermapping-sm.png" />
-    <png2c Include="include\images\usermapping.png" />
-    <png2c Include="include\images\usermappings.png" />
-    <png2c Include="include\images\users.png" />
-    <png2c Include="include\images\vacuum.png" />
-    <png2c Include="include\images\variable.png" />
-    <png2c Include="include\images\variables.png" />
-    <png2c Include="include\images\view-sm.png" />
-    <png2c Include="include\images\view.png" />
-    <png2c Include="include\images\viewdata.png" />
-    <png2c Include="include\images\viewfiltereddata.png" />
-    <png2c Include="include\images\views.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="pgAdmin3.rc" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\xtra\png2c\png2c.vcxproj">
-      <Project>{01191fb5-0037-4e36-ba56-07ce9d9d8cc0}</Project>
-      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-    <Import Project="..\pgAdmin3.targets" />
-  </ImportGroup>
-</Project>
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug (2.9)|Win32">
+      <Configuration>Debug (2.9)</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug (2.9)|x64">
+      <Configuration>Debug (2.9)</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release (2.9)|Win32">
+      <Configuration>Release (2.9)</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release (2.9)|x64">
+      <Configuration>Release (2.9)</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{5C2D73BA-1F24-48F8-8233-85F5D672AA6A}</ProjectGuid>
+    <RootNamespace>pgAdmin3</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+    <Import Project="..\pgAdmin3.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">true</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <PreBuildEvent>
+      <Message>Extracting source code repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;PG_SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase28u.lib;wxbase28u_xml.lib;wxbase28u_net.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxmsw28u_html.lib;wxmsw28u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw28u_stc.lib;wxmsw28u_xrc.lib;wxexpat.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase28u.lib;wxbase28u_xml.lib;wxbase28u_net.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxmsw28u_html.lib;wxmsw28u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw28u_stc.lib;wxmsw28u_xrc.lib;wxexpat.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <PreBuildEvent>
+      <Message>Extracting source code repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;PG_SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase28ud.lib;wxbase28ud_xml.lib;wxbase28ud_net.lib;wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxmsw28ud_html.lib;wxmsw28ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw28ud_stc.lib;wxmsw28ud_xrc.lib;wxexpatd.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <NoEntryPoint>false</NoEntryPoint>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <PreBuildEvent>
+      <Message>Extracting subversion repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase28ud.lib;wxbase28ud_xml.lib;wxbase28ud_net.lib;wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxmsw28ud_html.lib;wxmsw28ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw28ud_stc.lib;wxmsw28ud_xrc.lib;wxexpatd.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <NoEntryPoint>false</NoEntryPoint>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+    <PreBuildEvent>
+      <Message>Extracting source code repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;PG_SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase29ud.lib;wxbase29ud_xml.lib;wxbase29ud_net.lib;wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxmsw29ud_html.lib;wxmsw29ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw29ud_stc.lib;wxmsw29ud_xrc.lib;wxexpatd.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <NoEntryPoint>false</NoEntryPoint>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+    <PreBuildEvent>
+      <Message>Extracting subversion repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\Debug/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswud/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;WIN32;_DEBUG;_WINDOWS;__WINDOWS__;__WXMSW__;WXUSINGDLL;DEBUG=1;__WXDEBUG__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;wxUSE_UNICODE=1;UNICODE;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Debug/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <BrowseInformationFile>.\Debug/</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase29ud.lib;wxbase29ud_xml.lib;wxbase29ud_net.lib;wxmsw29ud_adv.lib;wxmsw29ud_core.lib;wxmsw29ud_html.lib;wxmsw29ud_aui.lib;wxregexud.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;wxmsw29ud_stc.lib;wxmsw29ud_xrc.lib;wxexpatd.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;ole32.lib;shell32.lib;odbc32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Debug/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <NoEntryPoint>false</NoEntryPoint>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+    <PreBuildEvent>
+      <Message>Extracting source code repository version</Message>
+      <Command>ver_svn.bat</Command>
+    </PreBuildEvent>
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;PG_SSL;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase29u.lib;wxbase29u_xml.lib;wxbase29u_net.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxmsw29u_html.lib;wxmsw29u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw29u_stc.lib;wxmsw29u_xrc.lib;wxexpat.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\Release/pgAdmin3.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>$(OPENSSL)/include;$(WXWIN)/lib/vc_dll/mswu/;$(WXWIN)/include;$(WXWIN)/contrib/include;$(PGDIR)/include;$(PGBUILD)/include/;$(PGBUILD)/libxml2/include/;$(PGBUILD)/libxslt/include/;$(PGBUILD)/iconv/include/;$(PROJECTDIR)/include;$(PGDIR)/include/server;$(PROJECTDIR)/include/libssh2;$(PROJECTDIR)/include/libssh2/Win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;HAVE_OPENSSL_CRYPTO;NDEBUG;WIN32;_WINDOWS;__WINDOWS__;__WIN95__;__WIN32__;WINVER=0x0400;STRICT;__WXMSW__;WXUSINGDLL;wxUSE_UNICODE=1;UNICODE;EMBED_XRC;HAVE_CONNINFO_PARSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>pgadmin3.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Release/pgAdmin3.pch</PrecompiledHeaderOutputFile>
+      <AssemblerOutput>All</AssemblerOutput>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+      <AdditionalIncludeDirectories>$(WXWIN)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>wxbase29u.lib;wxbase29u_xml.lib;wxbase29u_net.lib;wxmsw29u_adv.lib;wxmsw29u_core.lib;wxmsw29u_html.lib;wxmsw29u_aui.lib;wxregexu.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;wxmsw29u_stc.lib;wxmsw29u_xrc.lib;wxexpat.lib;libeay32MD.lib;libpq.lib;libxml2.lib;libxslt.lib;iconv.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Release/pgAdmin3.exe</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>$(OPENSSL)/lib/VC;$(WXWIN)/lib/vc_dll;$(PGDIR)/lib;$(PGBUILD)/lib;$(PGBUILD)/libxml2/lib;$(PGBUILD)/libxslt/lib;$(PGBUILD)/iconv/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcd.lib;libcid.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Release/pgAdmin3.pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release/pgAdmin3.map</MapFileName>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/pgAdmin3.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="agent\dlgJob.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="agent\dlgSchedule.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="agent\dlgStep.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="agent\pgaJob.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="agent\pgaSchedule.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="agent\pgaStep.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="ctl\calbox.cpp" />
+    <ClCompile Include="ctl\ctlAuiNotebook.cpp" />
+    <ClCompile Include="ctl\ctlCheckTreeView.cpp" />
+    <ClCompile Include="ctl\ctlColourPicker.cpp" />
+    <ClCompile Include="ctl\ctlComboBox.cpp" />
+    <ClCompile Include="ctl\ctlDefaultSecurityPanel.cpp" />
+    <ClCompile Include="ctl\ctlListView.cpp" />
+    <ClCompile Include="ctl\ctlMenuToolbar.cpp" />
+    <ClCompile Include="ctl\ctlSeclabelPanel.cpp" />
+    <ClCompile Include="ctl\ctlSecurityPanel.cpp" />
+    <ClCompile Include="ctl\ctlSQLBox.cpp" />
+    <ClCompile Include="ctl\ctlSQLGrid.cpp" />
+    <ClCompile Include="ctl\ctlSQLResult.cpp" />
+    <ClCompile Include="ctl\ctlTree.cpp" />
+    <ClCompile Include="ctl\explainCanvas.cpp" />
+    <ClCompile Include="ctl\explainShape.cpp" />
+    <ClCompile Include="ctl\timespin.cpp" />
+    <ClCompile Include="ctl\xh_calb.cpp" />
+    <ClCompile Include="ctl\xh_ctlchecktreeview.cpp" />
+    <ClCompile Include="ctl\xh_ctlcolourpicker.cpp" />
+    <ClCompile Include="ctl\xh_ctlcombo.cpp" />
+    <ClCompile Include="ctl\xh_ctltree.cpp" />
+    <ClCompile Include="ctl\xh_sqlbox.cpp" />
+    <ClCompile Include="ctl\xh_timespin.cpp" />
+    <ClCompile Include="db\keywords.c">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="db\pgConn.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="db\pgQueryThread.cpp" />
+    <ClCompile Include="db\pgSet.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgAddFavourite.cpp" />
+    <ClCompile Include="dlg\dlgAggregate.cpp" />
+    <ClCompile Include="dlg\dlgCast.cpp" />
+    <ClCompile Include="dlg\dlgCheck.cpp" />
+    <ClCompile Include="dlg\dlgClasses.cpp" />
+    <ClCompile Include="dlg\dlgCollation.cpp" />
+    <ClCompile Include="dlg\dlgColumn.cpp" />
+    <ClCompile Include="dlg\dlgConnect.cpp" />
+    <ClCompile Include="dlg\dlgConversion.cpp" />
+    <ClCompile Include="dlg\dlgDatabase.cpp" />
+    <ClCompile Include="dlg\dlgDomain.cpp" />
+    <ClCompile Include="dlg\dlgEditGridOptions.cpp" />
+    <ClCompile Include="dlg\dlgExtension.cpp" />
+    <ClCompile Include="dlg\dlgExtTable.cpp" />
+    <ClCompile Include="dlg\dlgFindReplace.cpp" />
+    <ClCompile Include="dlg\dlgForeignDataWrapper.cpp" />
+    <ClCompile Include="dlg\dlgForeignKey.cpp" />
+    <ClCompile Include="dlg\dlgForeignServer.cpp" />
+    <ClCompile Include="dlg\dlgForeignTable.cpp" />
+    <ClCompile Include="dlg\dlgFunction.cpp" />
+    <ClCompile Include="dlg\dlgGroup.cpp" />
+    <ClCompile Include="dlg\dlgHbaConfig.cpp" />
+    <ClCompile Include="dlg\dlgIndex.cpp" />
+    <ClCompile Include="dlg\dlgIndexConstraint.cpp" />
+    <ClCompile Include="dlg\dlgLanguage.cpp" />
+    <ClCompile Include="dlg\dlgMainConfig.cpp" />
+    <ClCompile Include="dlg\dlgManageFavourites.cpp" />
+    <ClCompile Include="dlg\dlgManageMacros.cpp" />
+    <ClCompile Include="dlg\dlgOperator.cpp" />
+    <ClCompile Include="dlg\dlgPackage.cpp" />
+    <ClCompile Include="dlg\dlgPgpassConfig.cpp" />
+    <ClCompile Include="dlg\dlgProperty.cpp" />
+    <ClCompile Include="dlg\dlgReassignDropOwned.cpp" />
+    <ClCompile Include="dlg\dlgRole.cpp" />
+    <ClCompile Include="dlg\dlgRule.cpp" />
+    <ClCompile Include="dlg\dlgSchema.cpp" />
+    <ClCompile Include="dlg\dlgSearchObject.cpp" />
+    <ClCompile Include="dlg\dlgSelectConnection.cpp" />
+    <ClCompile Include="dlg\dlgSelectDatabase.cpp" />
+    <ClCompile Include="dlg\dlgSequence.cpp" />
+    <ClCompile Include="dlg\dlgServer.cpp" />
+    <ClCompile Include="dlg\dlgSynonym.cpp" />
+    <ClCompile Include="dlg\dlgTable.cpp" />
+    <ClCompile Include="dlg\dlgTablespace.cpp" />
+    <ClCompile Include="dlg\dlgTextSearchConfiguration.cpp" />
+    <ClCompile Include="dlg\dlgTextSearchDictionary.cpp" />
+    <ClCompile Include="dlg\dlgTextSearchParser.cpp" />
+    <ClCompile Include="dlg\dlgTextSearchTemplate.cpp" />
+    <ClCompile Include="dlg\dlgTrigger.cpp" />
+    <ClCompile Include="dlg\dlgType.cpp" />
+    <ClCompile Include="dlg\dlgUser.cpp" />
+    <ClCompile Include="dlg\dlgUserMapping.cpp" />
+    <ClCompile Include="dlg\dlgView.cpp" />
+    <ClCompile Include="frm\events.cpp" />
+    <ClCompile Include="frm\frmAbout.cpp" />
+    <ClCompile Include="frm\frmBackup.cpp" />
+    <ClCompile Include="frm\frmBackupGlobals.cpp" />
+    <ClCompile Include="frm\frmBackupServer.cpp" />
+    <ClCompile Include="frm\frmConfig.cpp" />
+    <ClCompile Include="frm\frmDatabaseDesigner.cpp" />
+    <ClCompile Include="frm\frmEditGrid.cpp" />
+    <ClCompile Include="frm\frmExport.cpp" />
+    <ClCompile Include="frm\frmGrantWizard.cpp" />
+    <ClCompile Include="frm\frmHbaConfig.cpp" />
+    <ClCompile Include="frm\frmHint.cpp" />
+    <ClCompile Include="frm\frmImport.cpp" />
+    <ClCompile Include="frm\frmMain.cpp" />
+    <ClCompile Include="frm\frmMainConfig.cpp" />
+    <ClCompile Include="frm\frmMaintenance.cpp" />
+    <ClCompile Include="frm\frmOptions.cpp" />
+    <ClCompile Include="frm\frmPassword.cpp" />
+    <ClCompile Include="frm\frmPgpassConfig.cpp" />
+    <ClCompile Include="frm\frmQuery.cpp" />
+    <ClCompile Include="frm\frmReport.cpp" />
+    <ClCompile Include="frm\frmRestore.cpp" />
+    <ClCompile Include="frm\frmSplash.cpp" />
+    <ClCompile Include="frm\frmStatus.cpp" />
+    <ClCompile Include="frm\plugins.cpp" />
+    <ClCompile Include="libssh2\agent.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\channel.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\comp.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\crypt.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\global.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\hostkey.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\keepalive.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\kex.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\knownhost.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\libgcrypt.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\mac.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\misc.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\openssl.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\packet.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\pem.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\publickey.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\scp.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\session.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\sftp.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\transport.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\userauth.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="libssh2\version.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeaderFile>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeaderFile>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+      <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</AssemblerListingLocation>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ObjectFileName>
+      <ProgramDataBaseFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./$(Configuration)/$(Platform)/libssh2/</ProgramDataBaseFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/libssh2</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="schema\edbPackage.cpp" />
+    <ClCompile Include="schema\edbPackageFunction.cpp" />
+    <ClCompile Include="schema\edbPackageVariable.cpp" />
+    <ClCompile Include="schema\edbPrivateSynonym.cpp" />
+    <ClCompile Include="schema\edbSynonym.cpp" />
+    <ClCompile Include="schema\gpExtTable.cpp" />
+    <ClCompile Include="schema\gpPartition.cpp" />
+    <ClCompile Include="schema\gpResQueue.cpp" />
+    <ClCompile Include="schema\pgAggregate.cpp" />
+    <ClCompile Include="schema\pgCast.cpp" />
+    <ClCompile Include="schema\pgCatalogObject.cpp" />
+    <ClCompile Include="schema\pgCheck.cpp" />
+    <ClCompile Include="schema\pgCollation.cpp" />
+    <ClCompile Include="schema\pgCollection.cpp" />
+    <ClCompile Include="schema\pgColumn.cpp" />
+    <ClCompile Include="schema\pgConstraints.cpp" />
+    <ClCompile Include="schema\pgConversion.cpp" />
+    <ClCompile Include="schema\pgDatabase.cpp" />
+    <ClCompile Include="schema\pgDatatype.cpp" />
+    <ClCompile Include="schema\pgDomain.cpp" />
+    <ClCompile Include="schema\pgExtension.cpp" />
+    <ClCompile Include="schema\pgForeignDataWrapper.cpp" />
+    <ClCompile Include="schema\pgForeignKey.cpp" />
+    <ClCompile Include="schema\pgForeignServer.cpp" />
+    <ClCompile Include="schema\pgForeignTable.cpp" />
+    <ClCompile Include="schema\pgFunction.cpp" />
+    <ClCompile Include="schema\pgGroup.cpp" />
+    <ClCompile Include="schema\pgIndex.cpp" />
+    <ClCompile Include="schema\pgIndexConstraint.cpp" />
+    <ClCompile Include="schema\pgLanguage.cpp" />
+    <ClCompile Include="schema\pgObject.cpp" />
+    <ClCompile Include="schema\pgOperator.cpp" />
+    <ClCompile Include="schema\pgOperatorClass.cpp" />
+    <ClCompile Include="schema\pgOperatorFamily.cpp" />
+    <ClCompile Include="schema\pgRole.cpp" />
+    <ClCompile Include="schema\pgRule.cpp" />
+    <ClCompile Include="schema\pgSchema.cpp" />
+    <ClCompile Include="schema\pgSequence.cpp" />
+    <ClCompile Include="schema\pgServer.cpp" />
+    <ClCompile Include="schema\pgTable.cpp" />
+    <ClCompile Include="schema\pgTablespace.cpp" />
+    <ClCompile Include="schema\pgTextSearchConfiguration.cpp" />
+    <ClCompile Include="schema\pgTextSearchDictionary.cpp" />
+    <ClCompile Include="schema\pgTextSearchParser.cpp" />
+    <ClCompile Include="schema\pgTextSearchTemplate.cpp" />
+    <ClCompile Include="schema\pgTrigger.cpp" />
+    <ClCompile Include="schema\pgType.cpp" />
+    <ClCompile Include="schema\pgUser.cpp" />
+    <ClCompile Include="schema\pgUserMapping.cpp" />
+    <ClCompile Include="schema\pgView.cpp" />
+    <ClCompile Include="slony\dlgRepCluster.cpp" />
+    <ClCompile Include="slony\dlgRepListen.cpp" />
+    <ClCompile Include="slony\dlgRepNode.cpp" />
+    <ClCompile Include="slony\dlgRepPath.cpp" />
+    <ClCompile Include="slony\dlgRepProperty.cpp" />
+    <ClCompile Include="slony\dlgRepSequence.cpp" />
+    <ClCompile Include="slony\dlgRepSet.cpp" />
+    <ClCompile Include="slony\dlgRepSubscription.cpp" />
+    <ClCompile Include="slony\dlgRepTable.cpp" />
+    <ClCompile Include="slony\slCluster.cpp" />
+    <ClCompile Include="slony\slListen.cpp" />
+    <ClCompile Include="slony\slNode.cpp" />
+    <ClCompile Include="slony\slPath.cpp" />
+    <ClCompile Include="slony\slSequence.cpp" />
+    <ClCompile Include="slony\slSet.cpp" />
+    <ClCompile Include="slony\slSubscription.cpp" />
+    <ClCompile Include="slony\slTable.cpp" />
+    <ClCompile Include="ui\xrcDialogs.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="utils\csvfiles.cpp" />
+    <ClCompile Include="utils\factory.cpp" />
+    <ClCompile Include="utils\favourites.cpp" />
+    <ClCompile Include="utils\macros.cpp" />
+    <ClCompile Include="utils\misc.cpp" />
+    <ClCompile Include="utils\pgconfig.cpp" />
+    <ClCompile Include="utils\registry.cpp" />
+    <ClCompile Include="utils\sshTunnel.cpp" />
+    <ClCompile Include="utils\sysLogger.cpp" />
+    <ClCompile Include="utils\sysProcess.cpp" />
+    <ClCompile Include="utils\sysSettings.cpp" />
+    <ClCompile Include="utils\tabcomplete.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="utils\utffile.cpp" />
+    <ClCompile Include="debugger\ctlMessageWindow.cpp" />
+    <ClCompile Include="debugger\ctlResultGrid.cpp" />
+    <ClCompile Include="debugger\ctlStackWindow.cpp" />
+    <ClCompile Include="debugger\ctlTabWindow.cpp" />
+    <ClCompile Include="debugger\ctlVarWindow.cpp" />
+    <ClCompile Include="debugger\dbgBreakPoint.cpp" />
+    <ClCompile Include="debugger\dbgController.cpp" />
+    <ClCompile Include="debugger\dbgEvents.cpp" />
+    <ClCompile Include="debugger\dbgModel.cpp" />
+    <ClCompile Include="debugger\dbgTargetInfo.cpp" />
+    <ClCompile Include="debugger\debugger.cpp" />
+    <ClCompile Include="debugger\dlgDirectDbg.cpp" />
+    <ClCompile Include="debugger\frmDebugger.cpp" />
+    <ClCompile Include="gqb\gqbArrayCollection.cpp" />
+    <ClCompile Include="gqb\gqbBrowser.cpp" />
+    <ClCompile Include="gqb\gqbCollection.cpp" />
+    <ClCompile Include="gqb\gqbColumn.cpp" />
+    <ClCompile Include="gqb\gqbController.cpp" />
+    <ClCompile Include="gqb\gqbDatabase.cpp" />
+    <ClCompile Include="gqb\gqbGraphSimple.cpp" />
+    <ClCompile Include="gqb\gqbGridJoinTable.cpp" />
+    <ClCompile Include="gqb\gqbGridOrderTable.cpp" />
+    <ClCompile Include="gqb\gqbGridProjTable.cpp" />
+    <ClCompile Include="gqb\gqbGridRestTable.cpp" />
+    <ClCompile Include="gqb\gqbModel.cpp" />
+    <ClCompile Include="gqb\gqbObject.cpp" />
+    <ClCompile Include="gqb\gqbObjectCollection.cpp" />
+    <ClCompile Include="gqb\gqbQueryObjs.cpp" />
+    <ClCompile Include="gqb\gqbSchema.cpp" />
+    <ClCompile Include="gqb\gqbTable.cpp" />
+    <ClCompile Include="gqb\gqbView.cpp" />
+    <ClCompile Include="gqb\gqbViewPanels.cpp" />
+    <ClCompile Include="pgscript\lex.pgs.cc" />
+    <ClCompile Include="pgscript\parser.tab.cc" />
+    <ClCompile Include="pgscript\pgsApplication.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsArithmeticException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsAssertException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsBreakException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsCastException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsContinueException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsInterruptException.cpp" />
+    <ClCompile Include="pgscript\exceptions\pgsParameterException.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsAnd.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsAssign.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsAssignToRecord.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsCast.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsColumns.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsDifferent.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsEqual.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsExecute.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsExpression.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenDate.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenDateTime.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenDictionary.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenInt.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenReal.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenReference.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenRegex.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenString.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGenTime.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGreater.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsGreaterEqual.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsIdent.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsIdentRecord.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsLines.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsLower.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsLowerEqual.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsMinus.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsModulo.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsNegate.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsNot.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsOperation.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsOr.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsOver.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsParenthesis.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsPlus.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsRemoveLine.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsTimes.cpp" />
+    <ClCompile Include="pgscript\expressions\pgsTrim.cpp" />
+    <ClCompile Include="pgscript\generators\pgsDateGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsDateTimeGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsDictionaryGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsIntegerGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsNumberGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsObjectGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsRealGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsReferenceGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsRegexGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsStringGen.cpp" />
+    <ClCompile Include="pgscript\generators\pgsTimeGen.cpp" />
+    <ClCompile Include="pgscript\objects\pgsGenerator.cpp" />
+    <ClCompile Include="pgscript\objects\pgsNumber.cpp" />
+    <ClCompile Include="pgscript\objects\pgsRecord.cpp" />
+    <ClCompile Include="pgscript\objects\pgsString.cpp" />
+    <ClCompile Include="pgscript\objects\pgsVariable.cpp" />
+    <ClCompile Include="pgscript\statements\pgsAssertStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsBreakStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsContinueStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsDeclareRecordStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsExpressionStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsIfStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsPrintStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsProgram.cpp" />
+    <ClCompile Include="pgscript\statements\pgsStmt.cpp" />
+    <ClCompile Include="pgscript\statements\pgsStmtList.cpp" />
+    <ClCompile Include="pgscript\statements\pgsWhileStmt.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsAlloc.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsContext.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsDriver.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsMapm.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsThread.cpp" />
+    <ClCompile Include="pgscript\utilities\pgsUtilities.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm5sin.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_add.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_cpi.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_div.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_exp.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fam.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fft.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_flr.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fpf.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_gcd.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg2.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg3.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg4.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_log.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_mul.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_pow.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_rcp.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_rnd.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_set.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_sin.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmasin.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmasn0.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmcbrt.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmcnst.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmfact.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmfmul.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmgues.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmhasn.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmhsin.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmipwr.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmistr.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmpwr2.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmrsin.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmsqrt.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmstck.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutil.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutl1.cpp" />
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutl2.cpp" />
+    <ClCompile Include="ogl\basic.cpp" />
+    <ClCompile Include="ogl\basic2.cpp" />
+    <ClCompile Include="ogl\bmpshape.cpp" />
+    <ClCompile Include="ogl\canvas.cpp" />
+    <ClCompile Include="ogl\composit.cpp" />
+    <ClCompile Include="ogl\constrnt.cpp" />
+    <ClCompile Include="ogl\divided.cpp" />
+    <ClCompile Include="ogl\drawn.cpp" />
+    <ClCompile Include="ogl\lines.cpp" />
+    <ClCompile Include="ogl\mfutils.cpp" />
+    <ClCompile Include="ogl\ogldiag.cpp" />
+    <ClCompile Include="ogl\oglmisc.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddColumnFigure.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddColumnKindIcon.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddColumnOptionIcon.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddRelationshipFigure.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddRelationshipItem.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddRelationshipTerminal.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddTableFigure.cpp" />
+    <ClCompile Include="dd\dditems\figures\ddTextTableItemFigure.cpp" />
+    <ClCompile Include="dd\dditems\figures\xml\ddXmlStorage.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddAddColButtonHandle.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddAddFkButtonHandle.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddMinMaxTableButtonHandle.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddRemoveTableButtonHandle.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddScrollBarHandle.cpp" />
+    <ClCompile Include="dd\dditems\handles\ddSouthTableSizeHandle.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddAddColLocator.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddAddFkLocator.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddMinMaxTableLocator.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddRemoveTableLocator.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddScrollBarTableLocator.cpp" />
+    <ClCompile Include="dd\dditems\locators\ddTableBottomLocator.cpp" />
+    <ClCompile Include="dd\dditems\tools\ddColumnFigureTool.cpp" />
+    <ClCompile Include="dd\dditems\tools\ddColumnTextTool.cpp" />
+    <ClCompile Include="dd\dditems\utilities\ddPrecisionScaleDialog.cpp" />
+    <ClCompile Include="dd\dditems\utilities\ddSelectKindFksDialog.cpp" />
+    <ClCompile Include="dd\dditems\utilities\ddTableNameDialog.cpp" />
+    <ClCompile Include="dd\ddmodel\ddBrowserDataContainer.cpp" />
+    <ClCompile Include="dd\ddmodel\ddDatabaseDesign.cpp" />
+    <ClCompile Include="dd\ddmodel\ddDBReverseEnginering.cpp" />
+    <ClCompile Include="dd\ddmodel\ddDrawingEditor.cpp" />
+    <ClCompile Include="dd\ddmodel\ddDrawingView.cpp" />
+    <ClCompile Include="dd\ddmodel\ddGenerationWizard.cpp" />
+    <ClCompile Include="dd\ddmodel\ddModelBrowser.cpp" />
+    <ClCompile Include="hotdraw\connectors\hdChopBoxConnector.cpp" />
+    <ClCompile Include="hotdraw\connectors\hdIConnector.cpp" />
+    <ClCompile Include="hotdraw\connectors\hdLocatorConnector.cpp" />
+    <ClCompile Include="hotdraw\connectors\hdStickyRectangleConnector.cpp" />
+    <ClCompile Include="hotdraw\figures\hdAbstractFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdAbstractMenuFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdAttribute.cpp" />
+    <ClCompile Include="hotdraw\figures\hdAttributeFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdBitmapFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdCompositeFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdIConnectionFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdIFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdLineConnection.cpp" />
+    <ClCompile Include="hotdraw\figures\hdLineTerminal.cpp" />
+    <ClCompile Include="hotdraw\figures\hdPolyLineFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdRectangleFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\hdSimpleTextFigure.cpp" />
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFillAttribute.cpp" />
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontAttribute.cpp" />
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontColorAttribute.cpp" />
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdLineAttribute.cpp" />
+    <ClCompile Include="hotdraw\figures\xml\hdStorage.cpp" />
+    <ClCompile Include="hotdraw\handles\hdButtonHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionEndHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionStartHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdIHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdLineConnectionHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdLocatorHandle.cpp" />
+    <ClCompile Include="hotdraw\handles\hdPolyLineHandle.cpp" />
+    <ClCompile Include="hotdraw\locators\hdILocator.cpp" />
+    <ClCompile Include="hotdraw\locators\hdPolyLineLocator.cpp" />
+    <ClCompile Include="hotdraw\main\hdDrawing.cpp" />
+    <ClCompile Include="hotdraw\main\hdDrawingEditor.cpp" />
+    <ClCompile Include="hotdraw\main\hdDrawingView.cpp" />
+    <ClCompile Include="hotdraw\tools\hdAbstractTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdCanvasMenuTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdCompositeFigureTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdConnectionCreationTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdCreationTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdDragCreationTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdDragTrackerTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdFigureTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdHandleTrackerTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdITool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdMenuTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdPolyLineFigureTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdSelectAreaTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdSelectionTool.cpp" />
+    <ClCompile Include="hotdraw\tools\hdSimpleTextTool.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdArrayCollection.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdCollection.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdGeometry.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdKeyEvent.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdMouseEvent.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdMultiPosRect.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdPoint.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdRect.cpp" />
+    <ClCompile Include="hotdraw\utilities\hdRemoveDeleteDialog.cpp" />
+    <ClCompile Include="pgAdmin3.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="precomp.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug (2.9)|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release (2.9)|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="agent\module.mk" />
+    <None Include="ctl\module.mk" />
+    <None Include="db\module.mk" />
+    <None Include="dlg\module.mk" />
+    <None Include="frm\module.mk" />
+    <None Include="include\libssh2\module.mk" />
+    <None Include="include\module.mk" />
+    <None Include="include\utils\module.mk" />
+    <None Include="include\ctl\module.mk" />
+    <None Include="include\images\module.mk" />
+    <None Include="include\images\pgAdmin3.ico" />
+    <None Include="include\images\sql.ico" />
+    <None Include="include\parser\module.mk" />
+    <None Include="include\agent\module.mk" />
+    <None Include="include\slony\module.mk" />
+    <None Include="include\dlg\module.mk" />
+    <None Include="include\frm\module.mk" />
+    <None Include="include\schema\module.mk" />
+    <None Include="include\db\module.mk" />
+    <None Include="include\gqb\module.mk" />
+    <None Include="include\pgscript\location.hh" />
+    <None Include="include\pgscript\parser.tab.hh" />
+    <None Include="include\pgscript\position.hh" />
+    <None Include="include\pgscript\stack.hh" />
+    <None Include="include\pgscript\exceptions\module.mk" />
+    <None Include="include\pgscript\expressions\module.mk" />
+    <None Include="include\pgscript\generators\module.mk" />
+    <None Include="include\pgscript\objects\module.mk" />
+    <None Include="include\pgscript\statements\module.mk" />
+    <None Include="include\pgscript\utilities\module.mk" />
+    <None Include="include\pgscript\utilities\mapm-lib\license.txt" />
+    <None Include="include\pgscript\utilities\mapm-lib\module.mk" />
+    <None Include="include\ogl\module.mk" />
+    <None Include="include\ogl\README" />
+    <None Include="include\dd\module.mk" />
+    <None Include="include\dd\dditems\module.mk" />
+    <None Include="include\dd\dditems\figures\module.mk" />
+    <None Include="include\dd\dditems\figures\xml\module.mk" />
+    <None Include="include\dd\dditems\handles\module.mk" />
+    <None Include="include\dd\dditems\locators\module.mk" />
+    <None Include="include\dd\dditems\tools\module.mk" />
+    <None Include="include\dd\dditems\utilities\module.mk" />
+    <None Include="include\dd\ddmodel\module.mk" />
+    <None Include="include\hotdraw\module.mk" />
+    <None Include="include\hotdraw\connectors\module.mk" />
+    <None Include="include\hotdraw\figures\module.mk" />
+    <None Include="include\hotdraw\figures\defaultAttributes\module.mk" />
+    <None Include="include\hotdraw\handles\module.mk" />
+    <None Include="include\hotdraw\locators\module.mk" />
+    <None Include="include\hotdraw\main\module.mk" />
+    <None Include="include\hotdraw\tools\module.mk" />
+    <None Include="include\hotdraw\utilities\module.mk" />
+    <None Include="libssh2\module.mk" />
+    <None Include="schema\module.mk" />
+    <None Include="slony\module.mk" />
+    <None Include="ui\dlgAddFavourite.xrc" />
+    <None Include="ui\dlgAggregate.xrc" />
+    <None Include="ui\dlgCast.xrc" />
+    <None Include="ui\dlgCheck.xrc" />
+    <None Include="ui\dlgCollation.xrc" />
+    <None Include="ui\dlgColumn.xrc" />
+    <None Include="ui\dlgConnect.xrc" />
+    <None Include="ui\dlgConversion.xrc" />
+    <None Include="ui\dlgDatabase.xrc" />
+    <None Include="ui\dlgDirectDbg.xrc" />
+    <None Include="ui\dlgDomain.xrc" />
+    <None Include="ui\dlgEditGridOptions.xrc" />
+    <None Include="ui\dlgExtension.xrc" />
+    <None Include="ui\dlgExtTable.xrc" />
+    <None Include="ui\dlgFindReplace.xrc" />
+    <None Include="ui\dlgForeignDataWrapper.xrc" />
+    <None Include="ui\dlgForeignKey.xrc" />
+    <None Include="ui\dlgForeignServer.xrc" />
+    <None Include="ui\dlgForeignTable.xrc" />
+    <None Include="ui\dlgFunction.xrc" />
+    <None Include="ui\dlgGroup.xrc" />
+    <None Include="ui\dlgHbaConfig.xrc" />
+    <None Include="ui\dlgIndex.xrc" />
+    <None Include="ui\dlgIndexConstraint.xrc" />
+    <None Include="ui\dlgJob.xrc" />
+    <None Include="ui\dlgLanguage.xrc" />
+    <None Include="ui\dlgMainConfig.xrc" />
+    <None Include="ui\dlgManageFavourites.xrc" />
+    <None Include="ui\dlgManageMacros.xrc" />
+    <None Include="ui\dlgOperator.xrc" />
+    <None Include="ui\dlgPackage.xrc" />
+    <None Include="ui\dlgPgpassConfig.xrc" />
+    <None Include="ui\dlgReassignDropOwned.xrc" />
+    <None Include="ui\dlgRepCluster.xrc" />
+    <None Include="ui\dlgRepClusterUpgrade.xrc" />
+    <None Include="ui\dlgRepListen.xrc" />
+    <None Include="ui\dlgRepNode.xrc" />
+    <None Include="ui\dlgRepPath.xrc" />
+    <None Include="ui\dlgRepSequence.xrc" />
+    <None Include="ui\dlgRepSet.xrc" />
+    <None Include="ui\dlgRepSetMerge.xrc" />
+    <None Include="ui\dlgRepSetMove.xrc" />
+    <None Include="ui\dlgRepSubscription.xrc" />
+    <None Include="ui\dlgRepTable.xrc" />
+    <None Include="ui\dlgRole.xrc" />
+    <None Include="ui\dlgRule.xrc" />
+    <None Include="ui\dlgSchedule.xrc" />
+    <None Include="ui\dlgSchema.xrc" />
+    <None Include="ui\dlgSearchObject.xrc" />
+    <None Include="ui\dlgSelectConnection.xrc" />
+    <None Include="ui\dlgSequence.xrc" />
+    <None Include="ui\dlgServer.xrc" />
+    <None Include="ui\dlgStep.xrc" />
+    <None Include="ui\dlgSynonym.xrc" />
+    <None Include="ui\dlgTable.xrc" />
+    <None Include="ui\dlgTablespace.xrc" />
+    <None Include="ui\dlgTextSearchConfiguration.xrc" />
+    <None Include="ui\dlgTextSearchDictionary.xrc" />
+    <None Include="ui\dlgTextSearchParser.xrc" />
+    <None Include="ui\dlgTextSearchTemplate.xrc" />
+    <None Include="ui\dlgTrigger.xrc" />
+    <None Include="ui\dlgType.xrc" />
+    <None Include="ui\dlgUser.xrc" />
+    <None Include="ui\dlgUserMapping.xrc" />
+    <None Include="ui\dlgView.xrc" />
+    <None Include="ui\embed-xrc" />
+    <None Include="ui\embed-xrc.bat" />
+    <None Include="ui\frmBackup.xrc" />
+    <None Include="ui\frmBackupGlobals.xrc" />
+    <None Include="ui\frmBackupServer.xrc" />
+    <None Include="ui\frmExport.xrc" />
+    <None Include="ui\frmGrantWizard.xrc" />
+    <None Include="ui\frmHint.xrc" />
+    <None Include="ui\frmMaintenance.xrc" />
+    <None Include="ui\frmOptions.xrc" />
+    <None Include="ui\frmPassword.xrc" />
+    <None Include="ui\frmReport.xrc" />
+    <None Include="ui\frmRestore.xrc" />
+    <None Include="ui\module.mk" />
+    <None Include="utils\module.mk" />
+    <None Include="utils\tab-complete.inc" />
+    <None Include="utils\tabcomplete.pl" />
+    <None Include="gqb\module.mk" />
+    <None Include="pgscript\module.mk" />
+    <None Include="pgscript\parser.sh" />
+    <None Include="pgscript\pgsParser.yy" />
+    <None Include="pgscript\pgsScanner.ll" />
+    <None Include="pgscript\README" />
+    <None Include="pgscript\exceptions\module.mk" />
+    <None Include="pgscript\expressions\module.mk" />
+    <None Include="pgscript\generators\module.mk" />
+    <None Include="pgscript\objects\module.mk" />
+    <None Include="pgscript\statements\module.mk" />
+    <None Include="pgscript\utilities\module.mk" />
+    <None Include="pgscript\utilities\m_apm\module.mk" />
+    <None Include="ogl\module.mk" />
+    <None Include="ogl\README" />
+    <None Include="dd\module.mk" />
+    <None Include="dd\dditems\module.mk" />
+    <None Include="dd\dditems\figures\module.mk" />
+    <None Include="dd\dditems\handles\module.mk" />
+    <None Include="dd\dditems\locators\module.mk" />
+    <None Include="dd\dditems\tools\module.mk" />
+    <None Include="dd\dditems\utilities\module.mk" />
+    <None Include="dd\ddmodel\module.mk" />
+    <None Include="hotdraw\module.mk" />
+    <None Include="hotdraw\connectors\module.mk" />
+    <None Include="hotdraw\figures\module.mk" />
+    <None Include="hotdraw\figures\defaultAttributes\module.mk" />
+    <None Include="hotdraw\figures\xml\module.mk" />
+    <None Include="hotdraw\handles\module.mk" />
+    <None Include="hotdraw\locators\module.mk" />
+    <None Include="hotdraw\main\module.mk" />
+    <None Include="hotdraw\tools\module.mk" />
+    <None Include="hotdraw\utilities\module.mk" />
+    <None Include="Makefile.am" />
+    <None Include="plugins.ini" />
+    <None Include="settings.ini" />
+    <None Include="ver_svn.bat" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="include\copyright.h" />
+    <ClInclude Include="include\libssh2\channel.h" />
+    <ClInclude Include="include\libssh2\comp.h" />
+    <ClInclude Include="include\libssh2\crypto.h" />
+    <ClInclude Include="include\libssh2\libgcrypt.h" />
+    <ClInclude Include="include\libssh2\libssh2.h" />
+    <ClInclude Include="include\libssh2\libssh2_priv.h" />
+    <ClInclude Include="include\libssh2\libssh2_publickey.h" />
+    <ClInclude Include="include\libssh2\libssh2_sftp.h" />
+    <ClInclude Include="include\libssh2\mac.h" />
+    <ClInclude Include="include\libssh2\misc.h" />
+    <ClInclude Include="include\libssh2\openssl.h" />
+    <ClInclude Include="include\libssh2\packet.h" />
+    <ClInclude Include="include\libssh2\session.h" />
+    <ClInclude Include="include\libssh2\sftp.h" />
+    <ClInclude Include="include\libssh2\transport.h" />
+    <ClInclude Include="include\libssh2\userauth.h" />
+    <ClInclude Include="include\libssh2\Win32\libssh2_config.h" />
+    <ClInclude Include="include\pgAdmin3.h" />
+    <ClInclude Include="include\postgres.h" />
+    <ClInclude Include="include\precomp.h" />
+    <ClInclude Include="include\svnversion.h" />
+    <ClInclude Include="include\utils\sshTunnel.h" />
+    <ClInclude Include="include\version.h" />
+    <ClInclude Include="include\utils\csvfiles.h" />
+    <ClInclude Include="include\utils\factory.h" />
+    <ClInclude Include="include\utils\favourites.h" />
+    <ClInclude Include="include\utils\macros.h" />
+    <ClInclude Include="include\utils\misc.h" />
+    <ClInclude Include="include\utils\pgconfig.h" />
+    <ClInclude Include="include\utils\pgDefs.h" />
+    <ClInclude Include="include\utils\pgfeatures.h" />
+    <ClInclude Include="include\utils\registr.h" />
+    <ClInclude Include="include\utils\registry.h" />
+    <ClInclude Include="include\utils\sysLogger.h" />
+    <ClInclude Include="include\utils\sysProcess.h" />
+    <ClInclude Include="include\utils\sysSettings.h" />
+    <ClInclude Include="include\utils\utffile.h" />
+    <ClInclude Include="include\ctl\calbox.h" />
+    <ClInclude Include="include\ctl\ctlAuiNotebook.h" />
+    <ClInclude Include="include\ctl\ctlCheckTreeView.h" />
+    <ClInclude Include="include\ctl\ctlColourPicker.h" />
+    <ClInclude Include="include\ctl\ctlComboBox.h" />
+    <ClInclude Include="include\ctl\ctlDefaultSecurityPanel.h" />
+    <ClInclude Include="include\ctl\ctlListView.h" />
+    <ClInclude Include="include\ctl\ctlMenuToolbar.h" />
+    <ClInclude Include="include\ctl\ctlSeclabelPanel.h" />
+    <ClInclude Include="include\ctl\ctlSecurityPanel.h" />
+    <ClInclude Include="include\ctl\ctlSQLBox.h" />
+    <ClInclude Include="include\ctl\ctlSQLGrid.h" />
+    <ClInclude Include="include\ctl\ctlSQLResult.h" />
+    <ClInclude Include="include\ctl\ctlTree.h" />
+    <ClInclude Include="include\ctl\explainCanvas.h" />
+    <ClInclude Include="include\ctl\timespin.h" />
+    <ClInclude Include="include\ctl\wxgridsel.h" />
+    <ClInclude Include="include\ctl\xh_calb.h" />
+    <ClInclude Include="include\ctl\xh_ctlchecktreeview.h" />
+    <ClInclude Include="include\ctl\xh_ctlcolourpicker.h" />
+    <ClInclude Include="include\ctl\xh_ctlcombo.h" />
+    <ClInclude Include="include\ctl\xh_ctltree.h" />
+    <ClInclude Include="include\ctl\xh_sqlbox.h" />
+    <ClInclude Include="include\ctl\xh_timespin.h" />
+    <ClInclude Include="include\parser\keywords.h" />
+    <ClInclude Include="include\agent\dlgJob.h" />
+    <ClInclude Include="include\agent\dlgSchedule.h" />
+    <ClInclude Include="include\agent\dlgStep.h" />
+    <ClInclude Include="include\agent\pgaJob.h" />
+    <ClInclude Include="include\agent\pgaSchedule.h" />
+    <ClInclude Include="include\agent\pgaStep.h" />
+    <ClInclude Include="include\slony\dlgRepCluster.h" />
+    <ClInclude Include="include\slony\dlgRepListen.h" />
+    <ClInclude Include="include\slony\dlgRepNode.h" />
+    <ClInclude Include="include\slony\dlgRepPath.h" />
+    <ClInclude Include="include\slony\dlgRepProperty.h" />
+    <ClInclude Include="include\slony\dlgRepSequence.h" />
+    <ClInclude Include="include\slony\dlgRepSet.h" />
+    <ClInclude Include="include\slony\dlgRepSubscription.h" />
+    <ClInclude Include="include\slony\dlgRepTable.h" />
+    <ClInclude Include="include\slony\slCluster.h" />
+    <ClInclude Include="include\slony\slListen.h" />
+    <ClInclude Include="include\slony\slNode.h" />
+    <ClInclude Include="include\slony\slPath.h" />
+    <ClInclude Include="include\slony\slSequence.h" />
+    <ClInclude Include="include\slony\slSet.h" />
+    <ClInclude Include="include\slony\slSubscription.h" />
+    <ClInclude Include="include\slony\slTable.h" />
+    <ClInclude Include="include\dlg\dlgAddFavourite.h" />
+    <ClInclude Include="include\dlg\dlgAggregate.h" />
+    <ClInclude Include="include\dlg\dlgCast.h" />
+    <ClInclude Include="include\dlg\dlgCheck.h" />
+    <ClInclude Include="include\dlg\dlgClasses.h" />
+    <ClInclude Include="include\dlg\dlgCollation.h" />
+    <ClInclude Include="include\dlg\dlgColumn.h" />
+    <ClInclude Include="include\dlg\dlgConnect.h" />
+    <ClInclude Include="include\dlg\dlgConversion.h" />
+    <ClInclude Include="include\dlg\dlgDatabase.h" />
+    <ClInclude Include="include\dlg\dlgDomain.h" />
+    <ClInclude Include="include\dlg\dlgEditGridOptions.h" />
+    <ClInclude Include="include\dlg\dlgExtension.h" />
+    <ClInclude Include="include\dlg\dlgExtTable.h" />
+    <ClInclude Include="include\dlg\dlgFindReplace.h" />
+    <ClInclude Include="include\dlg\dlgForeignDataWrapper.h" />
+    <ClInclude Include="include\dlg\dlgForeignKey.h" />
+    <ClInclude Include="include\dlg\dlgForeignServer.h" />
+    <ClInclude Include="include\dlg\dlgForeignTable.h" />
+    <ClInclude Include="include\dlg\dlgFunction.h" />
+    <ClInclude Include="include\dlg\dlgGroup.h" />
+    <ClInclude Include="include\dlg\dlgHbaConfig.h" />
+    <ClInclude Include="include\dlg\dlgIndex.h" />
+    <ClInclude Include="include\dlg\dlgIndexConstraint.h" />
+    <ClInclude Include="include\dlg\dlgLanguage.h" />
+    <ClInclude Include="include\dlg\dlgMainConfig.h" />
+    <ClInclude Include="include\dlg\dlgManageFavourites.h" />
+    <ClInclude Include="include\dlg\dlgManageMacros.h" />
+    <ClInclude Include="include\dlg\dlgOperator.h" />
+    <ClInclude Include="include\dlg\dlgPackage.h" />
+    <ClInclude Include="include\dlg\dlgPgpassConfig.h" />
+    <ClInclude Include="include\dlg\dlgProperty.h" />
+    <ClInclude Include="include\dlg\dlgReassignDropOwned.h" />
+    <ClInclude Include="include\dlg\dlgRole.h" />
+    <ClInclude Include="include\dlg\dlgRule.h" />
+    <ClInclude Include="include\dlg\dlgSchema.h" />
+    <ClInclude Include="include\dlg\dlgSearchObject.h" />
+    <ClInclude Include="include\dlg\dlgSelectConnection.h" />
+    <ClInclude Include="include\dlg\dlgSelectDatabase.h" />
+    <ClInclude Include="include\dlg\dlgSequence.h" />
+    <ClInclude Include="include\dlg\dlgServer.h" />
+    <ClInclude Include="include\dlg\dlgSynonym.h" />
+    <ClInclude Include="include\dlg\dlgTable.h" />
+    <ClInclude Include="include\dlg\dlgTablespace.h" />
+    <ClInclude Include="include\dlg\dlgTextSearchConfiguration.h" />
+    <ClInclude Include="include\dlg\dlgTextSearchDictionary.h" />
+    <ClInclude Include="include\dlg\dlgTextSearchParser.h" />
+    <ClInclude Include="include\dlg\dlgTextSearchTemplate.h" />
+    <ClInclude Include="include\dlg\dlgTrigger.h" />
+    <ClInclude Include="include\dlg\dlgType.h" />
+    <ClInclude Include="include\dlg\dlgUser.h" />
+    <ClInclude Include="include\dlg\dlgUserMapping.h" />
+    <ClInclude Include="include\dlg\dlgView.h" />
+    <ClInclude Include="include\frm\frmAbout.h" />
+    <ClInclude Include="include\frm\frmBackup.h" />
+    <ClInclude Include="include\frm\frmBackupGlobals.h" />
+    <ClInclude Include="include\frm\frmBackupServer.h" />
+    <ClInclude Include="include\frm\frmConfig.h" />
+    <ClInclude Include="include\frm\frmDatabaseDesigner.h" />
+    <ClInclude Include="include\frm\frmEditGrid.h" />
+    <ClInclude Include="include\frm\frmExport.h" />
+    <ClInclude Include="include\frm\frmGrantWizard.h" />
+    <ClInclude Include="include\frm\frmHbaConfig.h" />
+    <ClInclude Include="include\frm\frmHint.h" />
+    <ClInclude Include="include\frm\frmImport.h" />
+    <ClInclude Include="include\frm\frmMain.h" />
+    <ClInclude Include="include\frm\frmMainConfig.h" />
+    <ClInclude Include="include\frm\frmMaintenance.h" />
+    <ClInclude Include="include\frm\frmOptions.h" />
+    <ClInclude Include="include\frm\frmPassword.h" />
+    <ClInclude Include="include\frm\frmPgpassConfig.h" />
+    <ClInclude Include="include\frm\frmQuery.h" />
+    <ClInclude Include="include\frm\frmReport.h" />
+    <ClInclude Include="include\frm\frmRestore.h" />
+    <ClInclude Include="include\frm\frmSplash.h" />
+    <ClInclude Include="include\frm\frmStatus.h" />
+    <ClInclude Include="include\frm\menu.h" />
+    <ClInclude Include="include\schema\edbPackage.h" />
+    <ClInclude Include="include\schema\edbPackageFunction.h" />
+    <ClInclude Include="include\schema\edbPackageVariable.h" />
+    <ClInclude Include="include\schema\edbPrivateSynonym.h" />
+    <ClInclude Include="include\schema\edbSynonym.h" />
+    <ClInclude Include="include\schema\gpExtTable.h" />
+    <ClInclude Include="include\schema\gpPartition.h" />
+    <ClInclude Include="include\schema\gpResQueue.h" />
+    <ClInclude Include="include\schema\pgAggregate.h" />
+    <ClInclude Include="include\schema\pgCast.h" />
+    <ClInclude Include="include\schema\pgCatalogObject.h" />
+    <ClInclude Include="include\schema\pgCheck.h" />
+    <ClInclude Include="include\schema\pgCollation.h" />
+    <ClInclude Include="include\schema\pgCollection.h" />
+    <ClInclude Include="include\schema\pgColumn.h" />
+    <ClInclude Include="include\schema\pgConstraints.h" />
+    <ClInclude Include="include\schema\pgConversion.h" />
+    <ClInclude Include="include\schema\pgDatabase.h" />
+    <ClInclude Include="include\schema\pgDatatype.h" />
+    <ClInclude Include="include\schema\pgDomain.h" />
+    <ClInclude Include="include\schema\pgExtension.h" />
+    <ClInclude Include="include\schema\pgForeignDataWrapper.h" />
+    <ClInclude Include="include\schema\pgForeignKey.h" />
+    <ClInclude Include="include\schema\pgForeignServer.h" />
+    <ClInclude Include="include\schema\pgForeignTable.h" />
+    <ClInclude Include="include\schema\pgFunction.h" />
+    <ClInclude Include="include\schema\pgGroup.h" />
+    <ClInclude Include="include\schema\pgIndex.h" />
+    <ClInclude Include="include\schema\pgIndexConstraint.h" />
+    <ClInclude Include="include\schema\pgLanguage.h" />
+    <ClInclude Include="include\schema\pgObject.h" />
+    <ClInclude Include="include\schema\pgOperator.h" />
+    <ClInclude Include="include\schema\pgOperatorClass.h" />
+    <ClInclude Include="include\schema\pgOperatorFamily.h" />
+    <ClInclude Include="include\schema\pgRole.h" />
+    <ClInclude Include="include\schema\pgRule.h" />
+    <ClInclude Include="include\schema\pgSchema.h" />
+    <ClInclude Include="include\schema\pgSequence.h" />
+    <ClInclude Include="include\schema\pgServer.h" />
+    <ClInclude Include="include\schema\pgTable.h" />
+    <ClInclude Include="include\schema\pgTablespace.h" />
+    <ClInclude Include="include\schema\pgTextSearchConfiguration.h" />
+    <ClInclude Include="include\schema\pgTextSearchDictionary.h" />
+    <ClInclude Include="include\schema\pgTextSearchParser.h" />
+    <ClInclude Include="include\schema\pgTextSearchTemplate.h" />
+    <ClInclude Include="include\schema\pgTrigger.h" />
+    <ClInclude Include="include\schema\pgType.h" />
+    <ClInclude Include="include\schema\pgUser.h" />
+    <ClInclude Include="include\schema\pgUserMapping.h" />
+    <ClInclude Include="include\schema\pgView.h" />
+    <ClInclude Include="include\db\pgConn.h" />
+    <ClInclude Include="include\db\pgQueryThread.h" />
+    <ClInclude Include="include\db\pgQueryResultEvent.h" />
+    <ClInclude Include="include\db\pgSet.h" />
+    <ClInclude Include="include\debugger\ctlMessageWindow.h" />
+    <ClInclude Include="include\debugger\ctlResultGrid.h" />
+    <ClInclude Include="include\debugger\ctlStackWindow.h" />
+    <ClInclude Include="include\debugger\ctlTabWindow.h" />
+    <ClInclude Include="include\debugger\ctlVarWindow.h" />
+    <ClInclude Include="include\debugger\dbgBreakPoint.h" />
+    <ClInclude Include="include\debugger\dbgConst.h" />
+    <ClInclude Include="include\debugger\dbgController.h" />
+    <ClInclude Include="include\debugger\dbgModel.h" />
+    <ClInclude Include="include\debugger\dbgTargetInfo.h" />
+    <ClInclude Include="include\debugger\debugger.h" />
+    <ClInclude Include="include\debugger\dlgDirectDbg.h" />
+    <ClInclude Include="include\debugger\frmDebugger.h" />
+    <ClInclude Include="include\gqb\gqbArrayCollection.h" />
+    <ClInclude Include="include\gqb\gqbBrowser.h" />
+    <ClInclude Include="include\gqb\gqbCollection.h" />
+    <ClInclude Include="include\gqb\gqbCollectionBase.h" />
+    <ClInclude Include="include\gqb\gqbColumn.h" />
+    <ClInclude Include="include\gqb\gqbDatabase.h" />
+    <ClInclude Include="include\gqb\gqbEvents.h" />
+    <ClInclude Include="include\gqb\gqbGraphBehavior.h" />
+    <ClInclude Include="include\gqb\gqbGraphSimple.h" />
+    <ClInclude Include="include\gqb\gqbGridJoinTable.h" />
+    <ClInclude Include="include\gqb\gqbGridOrderTable.h" />
+    <ClInclude Include="include\gqb\gqbGridProjTable.h" />
+    <ClInclude Include="include\gqb\gqbGridRestTable.h" />
+    <ClInclude Include="include\gqb\gqbModel.h" />
+    <ClInclude Include="include\gqb\gqbObject.h" />
+    <ClInclude Include="include\gqb\gqbObjectCollection.h" />
+    <ClInclude Include="include\gqb\gqbQueryObjs.h" />
+    <ClInclude Include="include\gqb\gqbSchema.h" />
+    <ClInclude Include="include\gqb\gqbTable.h" />
+    <ClInclude Include="include\gqb\gqbViewController.h" />
+    <ClInclude Include="include\gqb\gqbViewPanels.h" />
+    <ClInclude Include="include\pgscript\FlexLexer.h" />
+    <ClInclude Include="include\pgscript\pgsApplication.h" />
+    <ClInclude Include="include\pgscript\pgScript.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsArithmeticException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsAssertException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsBreakException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsCastException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsContinueException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsInterruptException.h" />
+    <ClInclude Include="include\pgscript\exceptions\pgsParameterException.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsAnd.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsAssign.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsAssignToRecord.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsCast.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsColumns.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsDifferent.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsEqual.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsExecute.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsExpression.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsExpressions.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenDate.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenDateTime.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenDictionary.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenInt.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenReal.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenReference.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenRegex.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenString.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGenTime.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGreater.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsGreaterEqual.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsIdent.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsIdentRecord.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsLines.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsLower.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsLowerEqual.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsMinus.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsModulo.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsNegate.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsNot.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsOperation.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsOr.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsOver.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsParenthesis.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsPlus.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsRemoveLine.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsTimes.h" />
+    <ClInclude Include="include\pgscript\expressions\pgsTrim.h" />
+    <ClInclude Include="include\pgscript\generators\pgsDateGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsDateTimeGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsDictionaryGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsIntegerGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsNumberGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsObjectGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsRealGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsReferenceGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsRegexGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsStringGen.h" />
+    <ClInclude Include="include\pgscript\generators\pgsTimeGen.h" />
+    <ClInclude Include="include\pgscript\objects\pgsGenerator.h" />
+    <ClInclude Include="include\pgscript\objects\pgsNumber.h" />
+    <ClInclude Include="include\pgscript\objects\pgsObjects.h" />
+    <ClInclude Include="include\pgscript\objects\pgsRecord.h" />
+    <ClInclude Include="include\pgscript\objects\pgsString.h" />
+    <ClInclude Include="include\pgscript\objects\pgsVariable.h" />
+    <ClInclude Include="include\pgscript\statements\pgsAssertStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsBreakStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsContinueStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsDeclareRecordStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsExpressionStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsIfStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsPrintStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsProgram.h" />
+    <ClInclude Include="include\pgscript\statements\pgsStatements.h" />
+    <ClInclude Include="include\pgscript\statements\pgsStmt.h" />
+    <ClInclude Include="include\pgscript\statements\pgsStmtList.h" />
+    <ClInclude Include="include\pgscript\statements\pgsWhileStmt.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsAlloc.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsContext.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsCopiedPtr.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsDriver.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsMapm.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsScanner.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsSharedPtr.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsThread.h" />
+    <ClInclude Include="include\pgscript\utilities\pgsUtilities.h" />
+    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm.h" />
+    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm_lc.h" />
+    <ClInclude Include="include\ogl\basic.h" />
+    <ClInclude Include="include\ogl\basicp.h" />
+    <ClInclude Include="include\ogl\bmpshape.h" />
+    <ClInclude Include="include\ogl\canvas.h" />
+    <ClInclude Include="include\ogl\composit.h" />
+    <ClInclude Include="include\ogl\constrnt.h" />
+    <ClInclude Include="include\ogl\divided.h" />
+    <ClInclude Include="include\ogl\drawn.h" />
+    <ClInclude Include="include\ogl\drawnp.h" />
+    <ClInclude Include="include\ogl\lines.h" />
+    <ClInclude Include="include\ogl\linesp.h" />
+    <ClInclude Include="include\ogl\mfutils.h" />
+    <ClInclude Include="include\ogl\misc.h" />
+    <ClInclude Include="include\ogl\ogl.h" />
+    <ClInclude Include="include\ogl\ogldiag.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddColumnFigure.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddColumnKindIcon.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddColumnOptionIcon.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipFigure.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipItem.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipTerminal.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddTableFigure.h" />
+    <ClInclude Include="include\dd\dditems\figures\ddTextTableItemFigure.h" />
+    <ClInclude Include="include\dd\dditems\figures\xml\ddXmlStorage.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddAddColButtonHandle.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddAddFkButtonHandle.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddMinMaxTableButtonHandle.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddRemoveTableButtonHandle.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddScrollBarHandle.h" />
+    <ClInclude Include="include\dd\dditems\handles\ddSouthTableSizeHandle.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddAddColLocator.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddAddFkLocator.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddMinMaxTableLocator.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddRemoveTableLocator.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddScrollBarTableLocator.h" />
+    <ClInclude Include="include\dd\dditems\locators\ddTableBottomLocator.h" />
+    <ClInclude Include="include\dd\dditems\tools\ddColumnFigureTool.h" />
+    <ClInclude Include="include\dd\dditems\tools\ddColumnTextTool.h" />
+    <ClInclude Include="include\dd\dditems\utilities\ddDataType.h" />
+    <ClInclude Include="include\dd\dditems\utilities\ddPrecisionScaleDialog.h" />
+    <ClInclude Include="include\dd\dditems\utilities\ddSelectKindFksDialog.h" />
+    <ClInclude Include="include\dd\dditems\utilities\ddTableNameDialog.h" />
+    <ClInclude Include="include\dd\ddmodel\ddBrowserDataContainer.h" />
+    <ClInclude Include="include\dd\ddmodel\ddDatabaseDesign.h" />
+    <ClInclude Include="include\dd\ddmodel\ddDBReverseEngineering.h" />
+    <ClInclude Include="include\dd\ddmodel\ddDrawingEditor.h" />
+    <ClInclude Include="include\dd\ddmodel\ddDrawingView.h" />
+    <ClInclude Include="include\dd\ddmodel\ddGenerationWizard.h" />
+    <ClInclude Include="include\dd\ddmodel\ddModelBrowser.h" />
+    <ClInclude Include="include\hotdraw\connectors\hdChopBoxConnector.h" />
+    <ClInclude Include="include\hotdraw\connectors\hdIConnector.h" />
+    <ClInclude Include="include\hotdraw\connectors\hdLocatorConnector.h" />
+    <ClInclude Include="include\hotdraw\connectors\hdStickyRectangleConnector.h" />
+    <ClInclude Include="include\hotdraw\figures\hdAbstractFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdAbstractMenuFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdAttribute.h" />
+    <ClInclude Include="include\hotdraw\figures\hdAttributeFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdBitmapFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdCompositeFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdIConnectionFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdIFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdLineConnection.h" />
+    <ClInclude Include="include\hotdraw\figures\hdLineTerminal.h" />
+    <ClInclude Include="include\hotdraw\figures\hdPolyLineFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdRectangleFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\hdSimpleTextFigure.h" />
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFillAttribute.h" />
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontAttribute.h" />
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontColorAttribute.h" />
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdLineAttribute.h" />
+    <ClInclude Include="include\hotdraw\figures\xml\hdStorage.h" />
+    <ClInclude Include="include\hotdraw\handles\hdButtonHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionEndHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionStartHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdIHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdLineConnectionHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdLocatorHandle.h" />
+    <ClInclude Include="include\hotdraw\handles\hdPolyLineHandle.h" />
+    <ClInclude Include="include\hotdraw\locators\hdILocator.h" />
+    <ClInclude Include="include\hotdraw\locators\hdPolyLineLocator.h" />
+    <ClInclude Include="include\hotdraw\main\hdDrawing.h" />
+    <ClInclude Include="include\hotdraw\main\hdDrawingEditor.h" />
+    <ClInclude Include="include\hotdraw\main\hdDrawingView.h" />
+    <ClInclude Include="include\hotdraw\main\hdObject.h" />
+    <ClInclude Include="include\hotdraw\tools\hdAbstractTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdCanvasMenuTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdCompositeFigureTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdConnectionCreationTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdCreationTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdDragCreationTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdDragTrackerTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdFigureTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdHandleTrackerTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdITool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdMenuTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdPolyLineFigureTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdSelectAreaTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdSelectionTool.h" />
+    <ClInclude Include="include\hotdraw\tools\hdSimpleTextTool.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdArrayCollection.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdCollection.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdCollectionBase.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdGeometry.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdKeyEvent.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdMouseEvent.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdMultiPosRect.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdPoint.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdRect.h" />
+    <ClInclude Include="include\hotdraw\utilities\hdRemoveDeleteDialog.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <png2c Include="include\images\aggregate-sm.png" />
+    <png2c Include="include\images\aggregate.png" />
+    <png2c Include="include\images\aggregates.png" />
+    <png2c Include="include\images\back.png" />
+    <png2c Include="include\images\backup.png" />
+    <png2c Include="include\images\baddatabase.png" />
+    <png2c Include="include\images\cast-sm.png" />
+    <png2c Include="include\images\cast.png" />
+    <png2c Include="include\images\casts.png" />
+    <png2c Include="include\images\catalog-sm.png" />
+    <png2c Include="include\images\catalog.png" />
+    <png2c Include="include\images\catalogobject-sm.png" />
+    <png2c Include="include\images\catalogobject.png" />
+    <png2c Include="include\images\catalogobjects.png" />
+    <png2c Include="include\images\catalogs.png" />
+    <png2c Include="include\images\check.png" />
+    <png2c Include="include\images\checkbad.png" />
+    <png2c Include="include\images\checked.png" />
+    <png2c Include="include\images\clearAll.png" />
+    <png2c Include="include\images\clip_copy.png" />
+    <png2c Include="include\images\clip_cut.png" />
+    <png2c Include="include\images\clip_paste.png" />
+    <png2c Include="include\images\closeddatabase-sm.png" />
+    <png2c Include="include\images\closeddatabase.png" />
+    <png2c Include="include\images\collation-sm.png" />
+    <png2c Include="include\images\collation.png" />
+    <png2c Include="include\images\collations.png" />
+    <png2c Include="include\images\column-sm.png" />
+    <png2c Include="include\images\column.png" />
+    <png2c Include="include\images\columns.png" />
+    <png2c Include="include\images\configuration.png" />
+    <png2c Include="include\images\configurations.png" />
+    <png2c Include="include\images\connect.png" />
+    <png2c Include="include\images\constraints.png" />
+    <png2c Include="include\images\continue.png" />
+    <png2c Include="include\images\conversion.png" />
+    <png2c Include="include\images\conversions.png" />
+    <png2c Include="include\images\create.png" />
+    <png2c Include="include\images\database-sm.png" />
+    <png2c Include="include\images\database.png" />
+    <png2c Include="include\images\databases.png" />
+    <png2c Include="include\images\ddAddColumn.png" />
+    <png2c Include="include\images\ddAddColumnCursor.png" />
+    <png2c Include="include\images\ddAddForeignKey.png" />
+    <png2c Include="include\images\ddcancel.png" />
+    <png2c Include="include\images\ddDeleteTableCursor.png" />
+    <png2c Include="include\images\ddDown.png" />
+    <png2c Include="include\images\ddforeignkey.png" />
+    <png2c Include="include\images\ddforeignkeyfromuk.png" />
+    <png2c Include="include\images\ddforeignkeyuniquekey.png" />
+    <png2c Include="include\images\ddforeignkeyuniquekeyfromuk.png" />
+    <png2c Include="include\images\ddgendiagram.png" />
+    <png2c Include="include\images\ddMaximizeTable.png" />
+    <png2c Include="include\images\ddMinimizeTable.png" />
+    <png2c Include="include\images\ddMinMaxCursor.png" />
+    <png2c Include="include\images\ddmodel-32.png" />
+    <png2c Include="include\images\ddnewdiagram.png" />
+    <png2c Include="include\images\ddnotnull.png" />
+    <png2c Include="include\images\ddnull.png" />
+    <png2c Include="include\images\ddprimaryforeignkey.png" />
+    <png2c Include="include\images\ddprimaryforeignkeyfromuk.png" />
+    <png2c Include="include\images\ddprimarykey.png" />
+    <png2c Include="include\images\ddprimarykeyuniquekey.png" />
+    <png2c Include="include\images\ddRelationshipCursor.png" />
+    <png2c Include="include\images\ddRemoveColumn.png" />
+    <png2c Include="include\images\ddRemoveColumnCursor.png" />
+    <png2c Include="include\images\ddRemoveTable.png" />
+    <png2c Include="include\images\ddRemoveTable2.png" />
+    <png2c Include="include\images\ddunique.png" />
+    <png2c Include="include\images\ddUp.png" />
+    <png2c Include="include\images\debugger.png" />
+    <png2c Include="include\images\delete.png" />
+    <png2c Include="include\images\dictionaries.png" />
+    <png2c Include="include\images\dictionary.png" />
+    <png2c Include="include\images\disabled.png" />
+    <png2c Include="include\images\dnd_copy.png" />
+    <png2c Include="include\images\dnd_move.png" />
+    <png2c Include="include\images\dnd_none.png" />
+    <png2c Include="include\images\domain-sm.png" />
+    <png2c Include="include\images\domain.png" />
+    <png2c Include="include\images\domains.png" />
+    <png2c Include="include\images\down.png" />
+    <png2c Include="include\images\drop.png" />
+    <png2c Include="include\images\edit_clear.png" />
+    <png2c Include="include\images\edit_find.png" />
+    <png2c Include="include\images\edit_redo.png" />
+    <png2c Include="include\images\edit_undo.png" />
+    <png2c Include="include\images\enumeration.png" />
+    <png2c Include="include\images\enumerations.png" />
+    <png2c Include="include\images\ex_aggregate.png" />
+    <png2c Include="include\images\ex_append.png" />
+    <png2c Include="include\images\ex_bmp_heap.png" />
+    <png2c Include="include\images\ex_bmp_index.png" />
+    <png2c Include="include\images\ex_broadcast_motion.png" />
+    <png2c Include="include\images\ex_cte_scan.png" />
+    <png2c Include="include\images\ex_gather_motion.png" />
+    <png2c Include="include\images\ex_group.png" />
+    <png2c Include="include\images\ex_hash.png" />
+    <png2c Include="include\images\ex_hash_anti_join.png" />
+    <png2c Include="include\images\ex_hash_semi_join.png" />
+    <png2c Include="include\images\ex_hash_setop_except.png" />
+    <png2c Include="include\images\ex_hash_setop_except_all.png" />
+    <png2c Include="include\images\ex_hash_setop_intersect.png" />
+    <png2c Include="include\images\ex_hash_setop_intersect_all.png" />
+    <png2c Include="include\images\ex_hash_setop_unknown.png" />
+    <png2c Include="include\images\ex_index_scan.png" />
+    <png2c Include="include\images\ex_join.png" />
+    <png2c Include="include\images\ex_limit.png" />
+    <png2c Include="include\images\ex_materialize.png" />
+    <png2c Include="include\images\ex_merge.png" />
+    <png2c Include="include\images\ex_merge_anti_join.png" />
+    <png2c Include="include\images\ex_merge_semi_join.png" />
+    <png2c Include="include\images\ex_nested.png" />
+    <png2c Include="include\images\ex_nested_loop_anti_join.png" />
+    <png2c Include="include\images\ex_nested_loop_semi_join.png" />
+    <png2c Include="include\images\ex_recursive_union.png" />
+    <png2c Include="include\images\ex_redistribute_motion.png" />
+    <png2c Include="include\images\ex_result.png" />
+    <png2c Include="include\images\ex_scan.png" />
+    <png2c Include="include\images\ex_seek.png" />
+    <png2c Include="include\images\ex_setop.png" />
+    <png2c Include="include\images\ex_sort.png" />
+    <png2c Include="include\images\ex_subplan.png" />
+    <png2c Include="include\images\ex_tid_scan.png" />
+    <png2c Include="include\images\ex_unique.png" />
+    <png2c Include="include\images\ex_unknown.png" />
+    <png2c Include="include\images\ex_window_aggregate.png" />
+    <png2c Include="include\images\ex_worktable_scan.png" />
+    <png2c Include="include\images\exclude.png" />
+    <png2c Include="include\images\extension-sm.png" />
+    <png2c Include="include\images\extension.png" />
+    <png2c Include="include\images\extensions.png" />
+    <png2c Include="include\images\exttable-sm.png" />
+    <png2c Include="include\images\exttable.png" />
+    <png2c Include="include\images\exttables.png" />
+    <png2c Include="include\images\favourite.png" />
+    <png2c Include="include\images\file_new.png" />
+    <png2c Include="include\images\file_open.png" />
+    <png2c Include="include\images\file_save.png" />
+    <png2c Include="include\images\folder.png" />
+    <png2c Include="include\images\foreigndatawrapper-sm.png" />
+    <png2c Include="include\images\foreigndatawrapper.png" />
+    <png2c Include="include\images\foreigndatawrappers.png" />
+    <png2c Include="include\images\foreignkey.png" />
+    <png2c Include="include\images\foreignkeybad.png" />
+    <png2c Include="include\images\foreignserver-sm.png" />
+    <png2c Include="include\images\foreignserver.png" />
+    <png2c Include="include\images\foreignservers.png" />
+    <png2c Include="include\images\foreigntable.png" />
+    <png2c Include="include\images\foreigntables.png" />
+    <png2c Include="include\images\forward.png" />
+    <png2c Include="include\images\function.png" />
+    <png2c Include="include\images\functions.png" />
+    <png2c Include="include\images\gqbAdd.png" />
+    <png2c Include="include\images\gqbAddRest.png" />
+    <png2c Include="include\images\gqbColNotSel.png" />
+    <png2c Include="include\images\gqbColSel.png" />
+    <png2c Include="include\images\gqbDown.png" />
+    <png2c Include="include\images\gqbDownBottom.png" />
+    <png2c Include="include\images\gqbJoin.png" />
+    <png2c Include="include\images\gqbJoinCursor.png" />
+    <png2c Include="include\images\gqbOrderAdd.png" />
+    <png2c Include="include\images\gqbOrderAddAll.png" />
+    <png2c Include="include\images\gqbOrderRemove.png" />
+    <png2c Include="include\images\gqbOrderRemoveAll.png" />
+    <png2c Include="include\images\gqbRemove.png" />
+    <png2c Include="include\images\gqbRemoveRest.png" />
+    <png2c Include="include\images\gqbUp.png" />
+    <png2c Include="include\images\gqbUpTop.png" />
+    <png2c Include="include\images\group.png" />
+    <png2c Include="include\images\groups.png" />
+    <png2c Include="include\images\help.png" />
+    <png2c Include="include\images\help2.png" />
+    <png2c Include="include\images\hint.png" />
+    <png2c Include="include\images\hint2.png" />
+    <png2c Include="include\images\index.png" />
+    <png2c Include="include\images\indexes.png" />
+    <png2c Include="include\images\job.png" />
+    <png2c Include="include\images\jobdisabled.png" />
+    <png2c Include="include\images\jobs.png" />
+    <png2c Include="include\images\key.png" />
+    <png2c Include="include\images\language-sm.png" />
+    <png2c Include="include\images\language.png" />
+    <png2c Include="include\images\languages.png" />
+    <png2c Include="include\images\loginroles.png" />
+    <png2c Include="include\images\namespace-sm.png" />
+    <png2c Include="include\images\namespace.png" />
+    <png2c Include="include\images\namespaces.png" />
+    <png2c Include="include\images\operator.png" />
+    <png2c Include="include\images\operatorclass.png" />
+    <png2c Include="include\images\operatorclasses.png" />
+    <png2c Include="include\images\operatorfamilies.png" />
+    <png2c Include="include\images\operatorfamily.png" />
+    <png2c Include="include\images\operators.png" />
+    <png2c Include="include\images\package.png" />
+    <png2c Include="include\images\packages.png" />
+    <png2c Include="include\images\parser.png" />
+    <png2c Include="include\images\parsers.png" />
+    <png2c Include="include\images\pgAdmin3-16.png" />
+    <png2c Include="include\images\pgAdmin3-32.png" />
+    <png2c Include="include\images\pgAdmin3.png" />
+    <png2c Include="include\images\plugins.png" />
+    <png2c Include="include\images\primarykey.png" />
+    <png2c Include="include\images\procedure.png" />
+    <png2c Include="include\images\procedures.png" />
+    <png2c Include="include\images\properties.png" />
+    <png2c Include="include\images\property.png" />
+    <png2c Include="include\images\query_cancel.png" />
+    <png2c Include="include\images\query_execfile.png" />
+    <png2c Include="include\images\query_execute.png" />
+    <png2c Include="include\images\query_explain.png" />
+    <png2c Include="include\images\query_pgscript.png" />
+    <png2c Include="include\images\readdata.png" />
+    <png2c Include="include\images\refresh.png" />
+    <png2c Include="include\images\reload.png" />
+    <png2c Include="include\images\restore.png" />
+    <png2c Include="include\images\roles.png" />
+    <png2c Include="include\images\rule.png" />
+    <png2c Include="include\images\rulebad.png" />
+    <png2c Include="include\images\rules.png" />
+    <png2c Include="include\images\schedule.png" />
+    <png2c Include="include\images\schedules.png" />
+    <png2c Include="include\images\sequence-repl.png" />
+    <png2c Include="include\images\sequence.png" />
+    <png2c Include="include\images\sequences.png" />
+    <png2c Include="include\images\server-sm.png" />
+    <png2c Include="include\images\server.png" />
+    <png2c Include="include\images\serverbad-sm.png" />
+    <png2c Include="include\images\serverbad.png" />
+    <png2c Include="include\images\servers.png" />
+    <png2c Include="include\images\setBreak.png" />
+    <png2c Include="include\images\slcluster.png" />
+    <png2c Include="include\images\slclusters.png" />
+    <png2c Include="include\images\sllisten.png" />
+    <png2c Include="include\images\sllistens.png" />
+    <png2c Include="include\images\slnode-disabled.png" />
+    <png2c Include="include\images\slnode-local.png" />
+    <png2c Include="include\images\slnode.png" />
+    <png2c Include="include\images\slnodes.png" />
+    <png2c Include="include\images\slpath.png" />
+    <png2c Include="include\images\slpaths.png" />
+    <png2c Include="include\images\slset.png" />
+    <png2c Include="include\images\slset2.png" />
+    <png2c Include="include\images\slsets.png" />
+    <png2c Include="include\images\slsubscription.png" />
+    <png2c Include="include\images\slsubscription2.png" />
+    <png2c Include="include\images\slsubscriptions.png" />
+    <png2c Include="include\images\sortfilter.png" />
+    <png2c Include="include\images\splash.png" />
+    <png2c Include="include\images\sql-16.png" />
+    <png2c Include="include\images\sql-32.png" />
+    <png2c Include="include\images\sql.png" />
+    <png2c Include="include\images\statistics.png" />
+    <png2c Include="include\images\step.png" />
+    <png2c Include="include\images\stepInto.png" />
+    <png2c Include="include\images\stepOver.png" />
+    <png2c Include="include\images\steps.png" />
+    <png2c Include="include\images\stop.png" />
+    <png2c Include="include\images\storedata.png" />
+    <png2c Include="include\images\synonym.png" />
+    <png2c Include="include\images\synonyms.png" />
+    <png2c Include="include\images\table-repl-sm.png" />
+    <png2c Include="include\images\table-repl.png" />
+    <png2c Include="include\images\table-sm.png" />
+    <png2c Include="include\images\table.png" />
+    <png2c Include="include\images\tables.png" />
+    <png2c Include="include\images\tablespace.png" />
+    <png2c Include="include\images\tablespaces.png" />
+    <png2c Include="include\images\template.png" />
+    <png2c Include="include\images\templates.png" />
+    <png2c Include="include\images\terminate_backend.png" />
+    <png2c Include="include\images\textsearch.png" />
+    <png2c Include="include\images\trigger.png" />
+    <png2c Include="include\images\triggerbad.png" />
+    <png2c Include="include\images\triggerfunction.png" />
+    <png2c Include="include\images\triggerfunctions.png" />
+    <png2c Include="include\images\triggers.png" />
+    <png2c Include="include\images\type.png" />
+    <png2c Include="include\images\types.png" />
+    <png2c Include="include\images\uncheck.png" />
+    <png2c Include="include\images\unchecked.png" />
+    <png2c Include="include\images\unique.png" />
+    <png2c Include="include\images\up.png" />
+    <png2c Include="include\images\user.png" />
+    <png2c Include="include\images\usermapping-sm.png" />
+    <png2c Include="include\images\usermapping.png" />
+    <png2c Include="include\images\usermappings.png" />
+    <png2c Include="include\images\users.png" />
+    <png2c Include="include\images\vacuum.png" />
+    <png2c Include="include\images\variable.png" />
+    <png2c Include="include\images\variables.png" />
+    <png2c Include="include\images\view-sm.png" />
+    <png2c Include="include\images\view.png" />
+    <png2c Include="include\images\viewdata.png" />
+    <png2c Include="include\images\viewfiltereddata.png" />
+    <png2c Include="include\images\views.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="pgAdmin3.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\xtra\png2c\png2c.vcxproj">
+      <Project>{01191fb5-0037-4e36-ba56-07ce9d9d8cc0}</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+    <Import Project="..\pgAdmin3.targets" />
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/pgadmin/pgAdmin3.vcxproj.filters b/pgadmin/pgAdmin3.vcxproj.filters
index d663cd7..96aa377 100644
--- a/pgadmin/pgAdmin3.vcxproj.filters
+++ b/pgadmin/pgAdmin3.vcxproj.filters
@@ -1,828 +1,837 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="agent">
-      <UniqueIdentifier>{29d12a68-5623-40b8-b480-224efa6720ce}</UniqueIdentifier>
-      <Extensions>*.cpp</Extensions>
-    </Filter>
-    <Filter Include="ctl">
-      <UniqueIdentifier>{722af890-61ca-44cf-af1b-b17487f78f7c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="db">
-      <UniqueIdentifier>{b4711a6d-480f-4a6a-8f8a-cbc41a802336}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dlg">
-      <UniqueIdentifier>{a3d5e8ea-cb43-448c-a51a-18fd4d223dd9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="frm">
-      <UniqueIdentifier>{ff19d9e8-f67b-4fe0-be02-69589832a941}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include">
-      <UniqueIdentifier>{9744a466-c06d-4fef-85e0-be4a27630deb}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\utils">
-      <UniqueIdentifier>{d8a57bb3-01aa-4ef3-94b6-1f2e5c3f07fc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\ctl">
-      <UniqueIdentifier>{efe4d829-5e1e-40ae-8413-85400cf8aff3}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\images">
-      <UniqueIdentifier>{931b2f66-4823-4d4b-a328-6975433316d9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\parser">
-      <UniqueIdentifier>{1d98451c-d3b1-40a4-abd3-0592146ff0fa}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\agent">
-      <UniqueIdentifier>{3feb5747-6682-4dbf-b082-abb2c794f70e}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\slony">
-      <UniqueIdentifier>{2c3cdfd8-8827-4ac7-8dc6-ee3f72f057e8}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dlg">
-      <UniqueIdentifier>{1d95fb56-f4c0-4205-b804-318d60bf8558}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\frm">
-      <UniqueIdentifier>{3b1b313d-6070-4d95-97fe-046a49b624ad}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\schema">
-      <UniqueIdentifier>{bede4cef-3b80-46aa-90ea-76ec261f03d5}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\db">
-      <UniqueIdentifier>{f9761488-73e8-4f6b-b9e3-55b8cbb6a3a2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\debugger">
-      <UniqueIdentifier>{8c168e54-f1c4-44ee-85d0-4daec103d4f3}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\gqb">
-      <UniqueIdentifier>{df42f3fa-0ac8-4d56-b9c4-1913d5a2c2f0}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript">
-      <UniqueIdentifier>{9cc76601-f308-4f0b-82be-71f838b858ea}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\exceptions">
-      <UniqueIdentifier>{9ee05a7a-1c91-43e2-a6cf-65837ad81162}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\expressions">
-      <UniqueIdentifier>{685491dc-ad16-4121-94df-ba1ae331c95a}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\generators">
-      <UniqueIdentifier>{3c9dc817-cc28-4bc1-aa75-a9b5ff563a60}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\objects">
-      <UniqueIdentifier>{ec385f56-5a98-47d9-834a-23ddee4662d3}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\statements">
-      <UniqueIdentifier>{e6836e8e-e9b4-4d31-bf2d-53bec570bb0a}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\utilities">
-      <UniqueIdentifier>{5a6cbaf8-e21d-4721-a511-f348f06d5b43}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\pgscript\utilities\m_apm">
-      <UniqueIdentifier>{14d6562a-41a3-4626-943f-2312193634cb}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\ogl">
-      <UniqueIdentifier>{0e4a3fb0-dd45-4c7b-813c-b4ceaf66280f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd">
-      <UniqueIdentifier>{7d6c4241-1d80-4d6d-bb74-77eb1f97a5bc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems">
-      <UniqueIdentifier>{8303ba8b-33ee-46ba-9ea6-55408815381d}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\figures">
-      <UniqueIdentifier>{9d006cc1-5afd-4497-8237-26e619952c47}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\figures\xml">
-      <UniqueIdentifier>{287ed0c1-9708-46eb-96a7-7fb9f31013b6}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\handles">
-      <UniqueIdentifier>{e6be15c5-878e-4919-8cbb-e5fb0cbbf6a9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\locators">
-      <UniqueIdentifier>{6f6ac2df-13ba-4b4d-8380-1a82a4a3e0b2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\tools">
-      <UniqueIdentifier>{7b58f0d3-eaa9-4f43-80d4-0962a35e45f2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\dditems\utilities">
-      <UniqueIdentifier>{4c63ed7e-71d0-436a-b3fd-c7241f69369c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\dd\ddmodel">
-      <UniqueIdentifier>{731ece13-da12-4792-868a-454029f103d9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw">
-      <UniqueIdentifier>{31655133-e359-4e58-8486-8b6a509d7801}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\connectors">
-      <UniqueIdentifier>{a5ffb000-00dd-47a1-906c-491faff00c2e}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\figures">
-      <UniqueIdentifier>{42c50033-eebe-4dee-b2ef-6ade6560a444}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\figures\defaultAttributes">
-      <UniqueIdentifier>{cd2ecb72-ced4-492e-8196-b855bb03939d}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\figures\xml">
-      <UniqueIdentifier>{e1243dab-46ce-46ad-b949-18a040ae84cc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\handles">
-      <UniqueIdentifier>{978d5148-e038-457c-b332-7db2ff0979fc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\locators">
-      <UniqueIdentifier>{50055ec9-0424-4d82-9ce8-5e77b0dbfa8c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\main">
-      <UniqueIdentifier>{73c21a26-f48b-4333-b321-c31a2b161e89}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\tools">
-      <UniqueIdentifier>{df9631db-f808-4c98-acc0-cce1b9d4ac5f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="include\hotdraw\utilities">
-      <UniqueIdentifier>{c0a6ed32-2b3e-4f8a-aa48-5d12472536ec}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="ui">
-      <UniqueIdentifier>{e5220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="utils">
-      <UniqueIdentifier>{d8a57bb3-01aa-4ef3-94b6-1f2e5c3f07fc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="slony">
-      <UniqueIdentifier>{2c3cdfd8-8827-4fef-8dc6-ee3f72f057e8}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="debugger">
-      <UniqueIdentifier>{8c168e54-f1c4-8dc6-85d0-4daec103d4f3}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="gqb">
-      <UniqueIdentifier>{df42f3fa-0ac8-4d56-b9c4-1913d5a2c2f0}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript">
-      <UniqueIdentifier>{9cc76601-f308-4f0b-82be-1913d5a2c2f0}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\exceptions">
-      <UniqueIdentifier>{9ee05a7a-1c91-43e2-c06d-65837ad81162}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\expressions">
-      <UniqueIdentifier>{685491dc-ad16-4121-4bc1-ba1ae331c95a}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\generators">
-      <UniqueIdentifier>{3c9dc817-cc28-4bc1-4121-a9b5ff563a60}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\objects">
-      <UniqueIdentifier>{ec385f56-5a98-cc28-834a-23ddee4662d3}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\statements">
-      <UniqueIdentifier>{e6836e8e-e9b4-834a-bf2d-53bec570bb0a}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\utilities">
-      <UniqueIdentifier>{5a6cbaf8-e51d-4721-a511-f348f06d5b43}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="pgscript\utilities\m_apm">
-      <UniqueIdentifier>{14d6562a-41a3-4346-943f-2312193634cb}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="ogl">
-      <UniqueIdentifier>{0e4d3fb0-dd45-4c7b-813c-b4ceaf66280f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd">
-      <UniqueIdentifier>{7d6c4241-1d80-4d6d-ee74-77eb1f97a5bc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems">
-      <UniqueIdentifier>{8303ba8b-33bb-46ba-9ea6-55408815381d}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\figures">
-      <UniqueIdentifier>{9d006cc1-5abd-4497-8237-26e619952c47}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\figures\xml">
-      <UniqueIdentifier>{287ed0c1-2508-46eb-96a7-7fb9f31013b6}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\handles">
-      <UniqueIdentifier>{e6be15c5-873a-4919-8cbb-e5fb0cbbf6a9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\locators">
-      <UniqueIdentifier>{6f6ac2df-13ba-4b4d-8321-1a82a4a3e0b2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\tools">
-      <UniqueIdentifier>{7b58f0d3-eaa9-4f23-40d4-0962a35e45f2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\dditems\utilities">
-      <UniqueIdentifier>{4c63ed7e-71d0-562a-b3fd-c7241f69369c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="dd\ddmodel">
-      <UniqueIdentifier>{731ece13-cb12-4792-868a-454029f103d9}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw">
-      <UniqueIdentifier>{31655331-e359-4e58-8486-8b6a509d7801}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\connectors">
-      <UniqueIdentifier>{a5ffb112-00dd-47a1-906c-491faff00c2e}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\figures">
-      <UniqueIdentifier>{42c54433-eebe-4dee-b2ef-6ade6560a444}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\figures\defaultAttributes">
-      <UniqueIdentifier>{cd2ecb72-ced4-492e-8196-b855bb03429d}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\figures\xml">
-      <UniqueIdentifier>{e1243dab-46ce-46ad-b949-18a181ae84cc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\handles">
-      <UniqueIdentifier>{978d5153-e038-457c-b332-7db2ff0979fc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\locators">
-      <UniqueIdentifier>{50123ec9-0424-4d82-9ce8-5e77b0dbfa8c}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\main">
-      <UniqueIdentifier>{73c56a26-f48b-4333-b321-c31a2b161e89}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\tools">
-      <UniqueIdentifier>{df9631db-f808-4c98-acc0-aab1b9d4ac5f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hotdraw\utilities">
-      <UniqueIdentifier>{c0a6ed25-2b3e-4f8a-aa48-5d12472536ec}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="ui">
-      <UniqueIdentifier>{e5220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="schema">
-      <UniqueIdentifier>{d4220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="agent\dlgJob.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="agent\dlgSchedule.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="agent\dlgStep.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="agent\pgaJob.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="agent\pgaSchedule.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="agent\pgaStep.cpp">
-      <Filter>agent</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\calbox.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlAuiNotebook.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlCheckTreeView.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlColourPicker.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlComboBox.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlDefaultSecurityPanel.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlListView.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlMenuToolbar.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlSeclabelPanel.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlSecurityPanel.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlSQLBox.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlSQLGrid.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlSQLResult.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\ctlTree.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\explainCanvas.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\explainShape.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\timespin.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_calb.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_ctlchecktreeview.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_ctlcolourpicker.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_ctlcombo.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_ctltree.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_sqlbox.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="ctl\xh_timespin.cpp">
-      <Filter>ctl</Filter>
-    </ClCompile>
-    <ClCompile Include="db\keywords.c">
-      <Filter>db</Filter>
-    </ClCompile>
-    <ClCompile Include="db\pgConn.cpp">
-      <Filter>db</Filter>
-    </ClCompile>
-    <ClCompile Include="db\pgQueryThread.cpp">
-      <Filter>db</Filter>
-    </ClCompile>
-    <ClCompile Include="db\pgSet.cpp">
-      <Filter>db</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgAddFavourite.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgAggregate.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgCast.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgCheck.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgClasses.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgCollation.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgColumn.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgConnect.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgConversion.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgDatabase.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgDomain.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgEditGridOptions.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgExtension.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgExtTable.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgFindReplace.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgForeignDataWrapper.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgForeignKey.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgForeignServer.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgForeignTable.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgFunction.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgGroup.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgHbaConfig.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgIndex.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgIndexConstraint.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgLanguage.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgMainConfig.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgManageFavourites.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgManageMacros.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgOperator.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgPackage.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgPgpassConfig.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgProperty.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgReassignDropOwned.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgRole.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgRule.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSchema.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSearchObject.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSelectConnection.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSelectDatabase.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSequence.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgServer.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgSynonym.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTable.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTablespace.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTextSearchConfiguration.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTextSearchDictionary.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTextSearchParser.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTextSearchTemplate.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgTrigger.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgType.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgUser.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgUserMapping.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="dlg\dlgView.cpp">
-      <Filter>dlg</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\events.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmAbout.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmBackup.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmBackupGlobals.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmBackupServer.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmConfig.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmDatabaseDesigner.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmEditGrid.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmExport.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmGrantWizard.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmHbaConfig.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmHint.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmImport.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmMain.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmMainConfig.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmMaintenance.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmOptions.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmPassword.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmPgpassConfig.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmQuery.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmReport.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmRestore.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmSplash.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\frmStatus.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="frm\plugins.cpp">
-      <Filter>frm</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\edbPackage.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\edbPackageFunction.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\edbPackageVariable.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\edbPrivateSynonym.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\edbSynonym.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\gpExtTable.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\gpPartition.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\gpResQueue.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgAggregate.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgCast.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgCatalogObject.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgCheck.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgCollation.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgCollection.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgColumn.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgConstraints.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgConversion.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgDatabase.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgDatatype.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgDomain.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgExtension.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgForeignDataWrapper.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgForeignKey.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgForeignServer.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgForeignTable.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgFunction.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgGroup.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgIndex.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgIndexConstraint.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgLanguage.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgObject.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgOperator.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgOperatorClass.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgOperatorFamily.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgRole.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgRule.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgSchema.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgSequence.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgServer.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTable.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTablespace.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTextSearchConfiguration.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTextSearchDictionary.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTextSearchParser.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTextSearchTemplate.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgTrigger.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgType.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgUser.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgUserMapping.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="schema\pgView.cpp">
-      <Filter>schema</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepCluster.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepListen.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepNode.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepPath.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepProperty.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepSequence.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepSet.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepSubscription.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\dlgRepTable.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slCluster.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slListen.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slNode.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slPath.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slSequence.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slSet.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slSubscription.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="slony\slTable.cpp">
-      <Filter>slony</Filter>
-    </ClCompile>
-    <ClCompile Include="ui\xrcDialogs.cpp">
-      <Filter>ui</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\csvfiles.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\factory.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\favourites.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\macros.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\misc.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\pgconfig.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\registry.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\sysLogger.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\sysProcess.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\sysSettings.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\tabcomplete.c">
-      <Filter>utils</Filter>
-    </ClCompile>
-    <ClCompile Include="utils\utffile.cpp">
-      <Filter>utils</Filter>
-    </ClCompile>
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="agent">
+      <UniqueIdentifier>{29d12a68-5623-40b8-b480-224efa6720ce}</UniqueIdentifier>
+      <Extensions>*.cpp</Extensions>
+    </Filter>
+    <Filter Include="ctl">
+      <UniqueIdentifier>{722af890-61ca-44cf-af1b-b17487f78f7c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="db">
+      <UniqueIdentifier>{b4711a6d-480f-4a6a-8f8a-cbc41a802336}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dlg">
+      <UniqueIdentifier>{a3d5e8ea-cb43-448c-a51a-18fd4d223dd9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="frm">
+      <UniqueIdentifier>{ff19d9e8-f67b-4fe0-be02-69589832a941}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include">
+      <UniqueIdentifier>{9744a466-c06d-4fef-85e0-be4a27630deb}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\utils">
+      <UniqueIdentifier>{d8a57bb3-01aa-4ef3-94b6-1f2e5c3f07fc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\ctl">
+      <UniqueIdentifier>{efe4d829-5e1e-40ae-8413-85400cf8aff3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\images">
+      <UniqueIdentifier>{931b2f66-4823-4d4b-a328-6975433316d9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\parser">
+      <UniqueIdentifier>{1d98451c-d3b1-40a4-abd3-0592146ff0fa}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\agent">
+      <UniqueIdentifier>{3feb5747-6682-4dbf-b082-abb2c794f70e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\slony">
+      <UniqueIdentifier>{2c3cdfd8-8827-4ac7-8dc6-ee3f72f057e8}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dlg">
+      <UniqueIdentifier>{1d95fb56-f4c0-4205-b804-318d60bf8558}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\frm">
+      <UniqueIdentifier>{3b1b313d-6070-4d95-97fe-046a49b624ad}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\schema">
+      <UniqueIdentifier>{bede4cef-3b80-46aa-90ea-76ec261f03d5}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\db">
+      <UniqueIdentifier>{f9761488-73e8-4f6b-b9e3-55b8cbb6a3a2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\debugger">
+      <UniqueIdentifier>{8c168e54-f1c4-44ee-85d0-4daec103d4f3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\gqb">
+      <UniqueIdentifier>{df42f3fa-0ac8-4d56-b9c4-1913d5a2c2f0}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript">
+      <UniqueIdentifier>{9cc76601-f308-4f0b-82be-71f838b858ea}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\exceptions">
+      <UniqueIdentifier>{9ee05a7a-1c91-43e2-a6cf-65837ad81162}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\expressions">
+      <UniqueIdentifier>{685491dc-ad16-4121-94df-ba1ae331c95a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\generators">
+      <UniqueIdentifier>{3c9dc817-cc28-4bc1-aa75-a9b5ff563a60}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\objects">
+      <UniqueIdentifier>{ec385f56-5a98-47d9-834a-23ddee4662d3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\statements">
+      <UniqueIdentifier>{e6836e8e-e9b4-4d31-bf2d-53bec570bb0a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\utilities">
+      <UniqueIdentifier>{5a6cbaf8-e21d-4721-a511-f348f06d5b43}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\pgscript\utilities\m_apm">
+      <UniqueIdentifier>{14d6562a-41a3-4626-943f-2312193634cb}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\ogl">
+      <UniqueIdentifier>{0e4a3fb0-dd45-4c7b-813c-b4ceaf66280f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd">
+      <UniqueIdentifier>{7d6c4241-1d80-4d6d-bb74-77eb1f97a5bc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems">
+      <UniqueIdentifier>{8303ba8b-33ee-46ba-9ea6-55408815381d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\figures">
+      <UniqueIdentifier>{9d006cc1-5afd-4497-8237-26e619952c47}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\figures\xml">
+      <UniqueIdentifier>{287ed0c1-9708-46eb-96a7-7fb9f31013b6}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\handles">
+      <UniqueIdentifier>{e6be15c5-878e-4919-8cbb-e5fb0cbbf6a9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\locators">
+      <UniqueIdentifier>{6f6ac2df-13ba-4b4d-8380-1a82a4a3e0b2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\tools">
+      <UniqueIdentifier>{7b58f0d3-eaa9-4f43-80d4-0962a35e45f2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\dditems\utilities">
+      <UniqueIdentifier>{4c63ed7e-71d0-436a-b3fd-c7241f69369c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\dd\ddmodel">
+      <UniqueIdentifier>{731ece13-da12-4792-868a-454029f103d9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw">
+      <UniqueIdentifier>{31655133-e359-4e58-8486-8b6a509d7801}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\connectors">
+      <UniqueIdentifier>{a5ffb000-00dd-47a1-906c-491faff00c2e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\figures">
+      <UniqueIdentifier>{42c50033-eebe-4dee-b2ef-6ade6560a444}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\figures\defaultAttributes">
+      <UniqueIdentifier>{cd2ecb72-ced4-492e-8196-b855bb03939d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\figures\xml">
+      <UniqueIdentifier>{e1243dab-46ce-46ad-b949-18a040ae84cc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\handles">
+      <UniqueIdentifier>{978d5148-e038-457c-b332-7db2ff0979fc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\locators">
+      <UniqueIdentifier>{50055ec9-0424-4d82-9ce8-5e77b0dbfa8c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\main">
+      <UniqueIdentifier>{73c21a26-f48b-4333-b321-c31a2b161e89}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\tools">
+      <UniqueIdentifier>{df9631db-f808-4c98-acc0-cce1b9d4ac5f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\hotdraw\utilities">
+      <UniqueIdentifier>{c0a6ed32-2b3e-4f8a-aa48-5d12472536ec}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="ui">
+      <UniqueIdentifier>{e5220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="utils">
+      <UniqueIdentifier>{d8a57bb3-01aa-4ef3-94b6-1f2e5c3f07fc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="slony">
+      <UniqueIdentifier>{2c3cdfd8-8827-4fef-8dc6-ee3f72f057e8}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="debugger">
+      <UniqueIdentifier>{8c168e54-f1c4-8dc6-85d0-4daec103d4f3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="gqb">
+      <UniqueIdentifier>{df42f3fa-0ac8-4d56-b9c4-1913d5a2c2f0}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript">
+      <UniqueIdentifier>{9cc76601-f308-4f0b-82be-1913d5a2c2f0}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\exceptions">
+      <UniqueIdentifier>{9ee05a7a-1c91-43e2-c06d-65837ad81162}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\expressions">
+      <UniqueIdentifier>{685491dc-ad16-4121-4bc1-ba1ae331c95a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\generators">
+      <UniqueIdentifier>{3c9dc817-cc28-4bc1-4121-a9b5ff563a60}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\objects">
+      <UniqueIdentifier>{ec385f56-5a98-cc28-834a-23ddee4662d3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\statements">
+      <UniqueIdentifier>{e6836e8e-e9b4-834a-bf2d-53bec570bb0a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\utilities">
+      <UniqueIdentifier>{5a6cbaf8-e51d-4721-a511-f348f06d5b43}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="pgscript\utilities\m_apm">
+      <UniqueIdentifier>{14d6562a-41a3-4346-943f-2312193634cb}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="ogl">
+      <UniqueIdentifier>{0e4d3fb0-dd45-4c7b-813c-b4ceaf66280f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd">
+      <UniqueIdentifier>{7d6c4241-1d80-4d6d-ee74-77eb1f97a5bc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems">
+      <UniqueIdentifier>{8303ba8b-33bb-46ba-9ea6-55408815381d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\figures">
+      <UniqueIdentifier>{9d006cc1-5abd-4497-8237-26e619952c47}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\figures\xml">
+      <UniqueIdentifier>{287ed0c1-2508-46eb-96a7-7fb9f31013b6}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\handles">
+      <UniqueIdentifier>{e6be15c5-873a-4919-8cbb-e5fb0cbbf6a9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\locators">
+      <UniqueIdentifier>{6f6ac2df-13ba-4b4d-8321-1a82a4a3e0b2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\tools">
+      <UniqueIdentifier>{7b58f0d3-eaa9-4f23-40d4-0962a35e45f2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\dditems\utilities">
+      <UniqueIdentifier>{4c63ed7e-71d0-562a-b3fd-c7241f69369c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="dd\ddmodel">
+      <UniqueIdentifier>{731ece13-cb12-4792-868a-454029f103d9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw">
+      <UniqueIdentifier>{31655331-e359-4e58-8486-8b6a509d7801}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\connectors">
+      <UniqueIdentifier>{a5ffb112-00dd-47a1-906c-491faff00c2e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\figures">
+      <UniqueIdentifier>{42c54433-eebe-4dee-b2ef-6ade6560a444}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\figures\defaultAttributes">
+      <UniqueIdentifier>{cd2ecb72-ced4-492e-8196-b855bb03429d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\figures\xml">
+      <UniqueIdentifier>{e1243dab-46ce-46ad-b949-18a181ae84cc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\handles">
+      <UniqueIdentifier>{978d5153-e038-457c-b332-7db2ff0979fc}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\locators">
+      <UniqueIdentifier>{50123ec9-0424-4d82-9ce8-5e77b0dbfa8c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\main">
+      <UniqueIdentifier>{73c56a26-f48b-4333-b321-c31a2b161e89}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\tools">
+      <UniqueIdentifier>{df9631db-f808-4c98-acc0-aab1b9d4ac5f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="hotdraw\utilities">
+      <UniqueIdentifier>{c0a6ed25-2b3e-4f8a-aa48-5d12472536ec}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="ui">
+      <UniqueIdentifier>{e5220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="schema">
+      <UniqueIdentifier>{d4220fd8-f837-4fbe-ac01-ef346e8b2d22}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\libssh2">
+      <UniqueIdentifier>{b057b5d3-8fbf-44c2-b2b0-cfd4afc2b58b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="include\libssh2\win32">
+      <UniqueIdentifier>{0dccfd9c-9aa4-4f50-921e-f48acf61fece}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libssh2">
+      <UniqueIdentifier>{d434a141-e593-43e9-9578-e36f86ac9ab3}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="agent\dlgJob.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="agent\dlgSchedule.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="agent\dlgStep.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="agent\pgaJob.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="agent\pgaSchedule.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="agent\pgaStep.cpp">
+      <Filter>agent</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\calbox.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlAuiNotebook.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlCheckTreeView.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlColourPicker.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlComboBox.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlDefaultSecurityPanel.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlListView.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlMenuToolbar.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlSeclabelPanel.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlSecurityPanel.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlSQLBox.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlSQLGrid.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlSQLResult.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\ctlTree.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\explainCanvas.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\explainShape.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\timespin.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_calb.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_ctlchecktreeview.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_ctlcolourpicker.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_ctlcombo.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_ctltree.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_sqlbox.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="ctl\xh_timespin.cpp">
+      <Filter>ctl</Filter>
+    </ClCompile>
+    <ClCompile Include="db\keywords.c">
+      <Filter>db</Filter>
+    </ClCompile>
+    <ClCompile Include="db\pgConn.cpp">
+      <Filter>db</Filter>
+    </ClCompile>
+    <ClCompile Include="db\pgQueryThread.cpp">
+      <Filter>db</Filter>
+    </ClCompile>
+    <ClCompile Include="db\pgSet.cpp">
+      <Filter>db</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgAddFavourite.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgAggregate.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgCast.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgCheck.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgClasses.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgCollation.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgColumn.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgConnect.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgConversion.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgDatabase.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgDomain.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgEditGridOptions.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgExtension.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgExtTable.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgFindReplace.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgForeignDataWrapper.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgForeignKey.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgForeignServer.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgForeignTable.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgFunction.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgGroup.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgHbaConfig.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgIndex.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgIndexConstraint.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgLanguage.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgMainConfig.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgManageFavourites.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgManageMacros.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgOperator.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgPackage.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgPgpassConfig.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgProperty.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgReassignDropOwned.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgRole.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgRule.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSchema.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSearchObject.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSelectConnection.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSelectDatabase.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSequence.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgServer.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgSynonym.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTable.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTablespace.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTextSearchConfiguration.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTextSearchDictionary.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTextSearchParser.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTextSearchTemplate.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgTrigger.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgType.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgUser.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgUserMapping.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="dlg\dlgView.cpp">
+      <Filter>dlg</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\events.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmAbout.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmBackup.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmBackupGlobals.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmBackupServer.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmConfig.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmDatabaseDesigner.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmEditGrid.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmExport.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmGrantWizard.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmHbaConfig.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmHint.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmImport.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmMain.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmMainConfig.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmMaintenance.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmOptions.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmPassword.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmPgpassConfig.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmQuery.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmReport.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmRestore.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmSplash.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\frmStatus.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="frm\plugins.cpp">
+      <Filter>frm</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\edbPackage.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\edbPackageFunction.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\edbPackageVariable.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\edbPrivateSynonym.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\edbSynonym.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\gpExtTable.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\gpPartition.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\gpResQueue.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgAggregate.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgCast.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgCatalogObject.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgCheck.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgCollation.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgCollection.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgColumn.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgConstraints.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgConversion.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgDatabase.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgDatatype.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgDomain.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgExtension.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgForeignDataWrapper.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgForeignKey.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgForeignServer.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgForeignTable.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgFunction.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgGroup.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgIndex.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgIndexConstraint.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgLanguage.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgObject.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgOperator.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgOperatorClass.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgOperatorFamily.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgRole.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgRule.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgSchema.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgSequence.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgServer.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTable.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTablespace.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTextSearchConfiguration.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTextSearchDictionary.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTextSearchParser.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTextSearchTemplate.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgTrigger.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgType.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgUser.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgUserMapping.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="schema\pgView.cpp">
+      <Filter>schema</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepCluster.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepListen.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepNode.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepPath.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepProperty.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepSequence.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepSet.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepSubscription.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\dlgRepTable.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slCluster.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slListen.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slNode.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slPath.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slSequence.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slSet.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slSubscription.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="slony\slTable.cpp">
+      <Filter>slony</Filter>
+    </ClCompile>
+    <ClCompile Include="ui\xrcDialogs.cpp">
+      <Filter>ui</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\csvfiles.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\factory.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\favourites.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\macros.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\misc.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\pgconfig.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\registry.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\sysLogger.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\sysProcess.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\sysSettings.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\tabcomplete.c">
+      <Filter>utils</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\utffile.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
     <ClCompile Include="debugger\dbgController.cpp">
       <Filter>debugger</Filter>
     </ClCompile>
@@ -830,3463 +839,3593 @@
       <Filter>debugger</Filter>
     </ClCompile>
     <ClCompile Include="debugger\dbgModel.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\ctlMessageWindow.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\ctlResultGrid.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\ctlStackWindow.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\ctlTabWindow.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\ctlVarWindow.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\dbgBreakPoint.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\dbgTargetInfo.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\debugger.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\dlgDirectDbg.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="debugger\frmDebugger.cpp">
-      <Filter>debugger</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbArrayCollection.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbBrowser.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbCollection.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbColumn.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbController.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbDatabase.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbGraphSimple.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbGridJoinTable.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbGridOrderTable.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbGridProjTable.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbGridRestTable.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbModel.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbObject.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbObjectCollection.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbQueryObjs.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbSchema.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbTable.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbView.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="gqb\gqbViewPanels.cpp">
-      <Filter>gqb</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\lex.pgs.cc">
-      <Filter>pgscript</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\parser.tab.cc">
-      <Filter>pgscript</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\pgsApplication.cpp">
-      <Filter>pgscript</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsArithmeticException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsAssertException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsBreakException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsCastException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsContinueException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsInterruptException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\exceptions\pgsParameterException.cpp">
-      <Filter>pgscript\exceptions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsAnd.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsAssign.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsAssignToRecord.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsCast.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsColumns.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsDifferent.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsEqual.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsExecute.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsExpression.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenDate.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenDateTime.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenDictionary.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenInt.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenReal.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenReference.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenRegex.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenString.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGenTime.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGreater.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsGreaterEqual.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsIdent.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsIdentRecord.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsLines.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsLower.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsLowerEqual.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsMinus.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsModulo.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsNegate.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsNot.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsOperation.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsOr.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsOver.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsParenthesis.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsPlus.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsRemoveLine.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsTimes.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\expressions\pgsTrim.cpp">
-      <Filter>pgscript\expressions</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsDateGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsDateTimeGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsDictionaryGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsIntegerGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsNumberGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsObjectGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsRealGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsReferenceGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsRegexGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsStringGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\generators\pgsTimeGen.cpp">
-      <Filter>pgscript\generators</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\objects\pgsGenerator.cpp">
-      <Filter>pgscript\objects</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\objects\pgsNumber.cpp">
-      <Filter>pgscript\objects</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\objects\pgsRecord.cpp">
-      <Filter>pgscript\objects</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\objects\pgsString.cpp">
-      <Filter>pgscript\objects</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\objects\pgsVariable.cpp">
-      <Filter>pgscript\objects</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsAssertStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsBreakStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsContinueStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsDeclareRecordStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsExpressionStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsIfStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsPrintStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsProgram.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsStmtList.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\statements\pgsWhileStmt.cpp">
-      <Filter>pgscript\statements</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsAlloc.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsContext.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsDriver.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsMapm.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsThread.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\pgsUtilities.cpp">
-      <Filter>pgscript\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm5sin.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_add.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_cpi.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_div.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_exp.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fam.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fft.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_flr.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_fpf.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_gcd.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg2.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg3.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg4.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_log.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_mul.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_pow.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_rcp.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_rnd.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_set.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapm_sin.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmasin.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmasn0.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmcbrt.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmcnst.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmfact.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmfmul.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmgues.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmhasn.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmhsin.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmipwr.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmistr.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmpwr2.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmrsin.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmsqrt.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmstck.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutil.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutl1.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="pgscript\utilities\m_apm\mapmutl2.cpp">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\basic.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\basic2.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\bmpshape.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\canvas.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\composit.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\constrnt.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\divided.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\drawn.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\lines.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\mfutils.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\ogldiag.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="ogl\oglmisc.cpp">
-      <Filter>ogl</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddColumnFigure.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddColumnKindIcon.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddColumnOptionIcon.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddRelationshipFigure.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddRelationshipItem.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddRelationshipTerminal.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddTableFigure.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\ddTextTableItemFigure.cpp">
-      <Filter>dd\dditems\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\figures\xml\ddXmlStorage.cpp">
-      <Filter>dd\dditems\figures\xml</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddAddColButtonHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddAddFkButtonHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddMinMaxTableButtonHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddRemoveTableButtonHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddScrollBarHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\handles\ddSouthTableSizeHandle.cpp">
-      <Filter>dd\dditems\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddAddColLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddAddFkLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddMinMaxTableLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddRemoveTableLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddScrollBarTableLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\locators\ddTableBottomLocator.cpp">
-      <Filter>dd\dditems\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\tools\ddColumnFigureTool.cpp">
-      <Filter>dd\dditems\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\tools\ddColumnTextTool.cpp">
-      <Filter>dd\dditems\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\utilities\ddPrecisionScaleDialog.cpp">
-      <Filter>dd\dditems\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\utilities\ddSelectKindFksDialog.cpp">
-      <Filter>dd\dditems\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\dditems\utilities\ddTableNameDialog.cpp">
-      <Filter>dd\dditems\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddBrowserDataContainer.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddDatabaseDesign.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddDBReverseEnginering.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddDrawingEditor.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddDrawingView.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddGenerationWizard.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="dd\ddmodel\ddModelBrowser.cpp">
-      <Filter>dd\ddmodel</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\connectors\hdChopBoxConnector.cpp">
-      <Filter>hotdraw\connectors</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\connectors\hdIConnector.cpp">
-      <Filter>hotdraw\connectors</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\connectors\hdLocatorConnector.cpp">
-      <Filter>hotdraw\connectors</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\connectors\hdStickyRectangleConnector.cpp">
-      <Filter>hotdraw\connectors</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdAbstractFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdAbstractMenuFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdAttribute.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdAttributeFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdBitmapFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdCompositeFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdIConnectionFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdIFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdLineConnection.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdLineTerminal.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdPolyLineFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdRectangleFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\hdSimpleTextFigure.cpp">
-      <Filter>hotdraw\figures</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFillAttribute.cpp">
-      <Filter>hotdraw\figures\defaultAttributes</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontAttribute.cpp">
-      <Filter>hotdraw\figures\defaultAttributes</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontColorAttribute.cpp">
-      <Filter>hotdraw\figures\defaultAttributes</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\defaultAttributes\hdLineAttribute.cpp">
-      <Filter>hotdraw\figures\defaultAttributes</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\figures\xml\hdStorage.cpp">
-      <Filter>hotdraw\figures\xml</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdButtonHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionEndHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdChangeConnectionStartHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdIHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdLineConnectionHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdLocatorHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\handles\hdPolyLineHandle.cpp">
-      <Filter>hotdraw\handles</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\locators\hdILocator.cpp">
-      <Filter>hotdraw\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\locators\hdPolyLineLocator.cpp">
-      <Filter>hotdraw\locators</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\main\hdDrawing.cpp">
-      <Filter>hotdraw\main</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\main\hdDrawingEditor.cpp">
-      <Filter>hotdraw\main</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\main\hdDrawingView.cpp">
-      <Filter>hotdraw\main</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdAbstractTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdCanvasMenuTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdCompositeFigureTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdConnectionCreationTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdCreationTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdDragCreationTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdDragTrackerTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdFigureTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdHandleTrackerTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdITool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdMenuTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdPolyLineFigureTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdSelectAreaTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdSelectionTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\tools\hdSimpleTextTool.cpp">
-      <Filter>hotdraw\tools</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdArrayCollection.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdCollection.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdGeometry.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdKeyEvent.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdMouseEvent.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdMultiPosRect.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdPoint.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdRect.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="hotdraw\utilities\hdRemoveDeleteDialog.cpp">
-      <Filter>hotdraw\utilities</Filter>
-    </ClCompile>
-    <ClCompile Include="pgAdmin3.cpp" />
-    <ClCompile Include="precomp.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="agent\module.mk">
-      <Filter>agent</Filter>
-    </None>
-    <None Include="ctl\module.mk">
-      <Filter>ctl</Filter>
-    </None>
-    <None Include="db\module.mk">
-      <Filter>db</Filter>
-    </None>
-    <None Include="dlg\module.mk">
-      <Filter>dlg</Filter>
-    </None>
-    <None Include="frm\module.mk">
-      <Filter>frm</Filter>
-    </None>
-    <None Include="include\module.mk">
-      <Filter>include</Filter>
-    </None>
-    <None Include="include\utils\module.mk">
-      <Filter>include\utils</Filter>
-    </None>
-    <None Include="include\ctl\module.mk">
-      <Filter>include\ctl</Filter>
-    </None>
-    <None Include="include\images\module.mk">
-      <Filter>include\images</Filter>
-    </None>
-    <None Include="include\images\pgAdmin3.ico">
-      <Filter>include\images</Filter>
-    </None>
-    <None Include="include\images\sql.ico">
-      <Filter>include\images</Filter>
-    </None>
-    <None Include="include\parser\module.mk">
-      <Filter>include\parser</Filter>
-    </None>
-    <None Include="include\agent\module.mk">
-      <Filter>include\agent</Filter>
-    </None>
-    <None Include="include\slony\module.mk">
-      <Filter>include\slony</Filter>
-    </None>
-    <None Include="include\dlg\module.mk">
-      <Filter>include\dlg</Filter>
-    </None>
-    <None Include="include\frm\module.mk">
-      <Filter>include\frm</Filter>
-    </None>
-    <None Include="include\schema\module.mk">
-      <Filter>include\schema</Filter>
-    </None>
-    <None Include="include\db\module.mk">
-      <Filter>include\db</Filter>
-    </None>
-    <None Include="include\gqb\module.mk">
-      <Filter>include\gqb</Filter>
-    </None>
-    <None Include="include\pgscript\location.hh">
-      <Filter>include\pgscript</Filter>
-    </None>
-    <None Include="include\pgscript\parser.tab.hh">
-      <Filter>include\pgscript</Filter>
-    </None>
-    <None Include="include\pgscript\position.hh">
-      <Filter>include\pgscript</Filter>
-    </None>
-    <None Include="include\pgscript\stack.hh">
-      <Filter>include\pgscript</Filter>
-    </None>
-    <None Include="include\pgscript\exceptions\module.mk">
-      <Filter>include\pgscript\exceptions</Filter>
-    </None>
-    <None Include="include\pgscript\expressions\module.mk">
-      <Filter>include\pgscript\expressions</Filter>
-    </None>
-    <None Include="include\pgscript\generators\module.mk">
-      <Filter>include\pgscript\generators</Filter>
-    </None>
-    <None Include="include\pgscript\objects\module.mk">
-      <Filter>include\pgscript\objects</Filter>
-    </None>
-    <None Include="include\pgscript\statements\module.mk">
-      <Filter>include\pgscript\statements</Filter>
-    </None>
-    <None Include="include\pgscript\utilities\module.mk">
-      <Filter>include\pgscript\utilities</Filter>
-    </None>
-    <None Include="include\pgscript\utilities\mapm-lib\license.txt">
-      <Filter>include\pgscript\utilities\m_apm</Filter>
-    </None>
-    <None Include="include\pgscript\utilities\mapm-lib\module.mk">
-      <Filter>include\pgscript\utilities\m_apm</Filter>
-    </None>
-    <None Include="include\ogl\module.mk">
-      <Filter>include\ogl</Filter>
-    </None>
-    <None Include="include\ogl\README">
-      <Filter>include\ogl</Filter>
-    </None>
-    <None Include="include\dd\module.mk">
-      <Filter>include\dd</Filter>
-    </None>
-    <None Include="include\dd\dditems\module.mk">
-      <Filter>include\dd\dditems</Filter>
-    </None>
-    <None Include="include\dd\dditems\figures\module.mk">
-      <Filter>include\dd\dditems\figures</Filter>
-    </None>
-    <None Include="include\dd\dditems\figures\xml\module.mk">
-      <Filter>include\dd\dditems\figures\xml</Filter>
-    </None>
-    <None Include="include\dd\dditems\handles\module.mk">
-      <Filter>include\dd\dditems\handles</Filter>
-    </None>
-    <None Include="include\dd\dditems\locators\module.mk">
-      <Filter>include\dd\dditems\locators</Filter>
-    </None>
-    <None Include="include\dd\dditems\tools\module.mk">
-      <Filter>include\dd\dditems\tools</Filter>
-    </None>
-    <None Include="include\dd\dditems\utilities\module.mk">
-      <Filter>include\dd\dditems\utilities</Filter>
-    </None>
-    <None Include="include\dd\ddmodel\module.mk">
-      <Filter>include\dd\ddmodel</Filter>
-    </None>
-    <None Include="include\hotdraw\module.mk">
-      <Filter>include\hotdraw</Filter>
-    </None>
-    <None Include="include\hotdraw\connectors\module.mk">
-      <Filter>include\hotdraw\connectors</Filter>
-    </None>
-    <None Include="include\hotdraw\figures\module.mk">
-      <Filter>include\hotdraw\figures</Filter>
-    </None>
-    <None Include="include\hotdraw\figures\defaultAttributes\module.mk">
-      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
-    </None>
-    <None Include="include\hotdraw\handles\module.mk">
-      <Filter>include\hotdraw\handles</Filter>
-    </None>
-    <None Include="include\hotdraw\locators\module.mk">
-      <Filter>include\hotdraw\locators</Filter>
-    </None>
-    <None Include="include\hotdraw\main\module.mk">
-      <Filter>include\hotdraw\main</Filter>
-    </None>
-    <None Include="include\hotdraw\tools\module.mk">
-      <Filter>include\hotdraw\tools</Filter>
-    </None>
-    <None Include="include\hotdraw\utilities\module.mk">
-      <Filter>include\hotdraw\utilities</Filter>
-    </None>
-    <None Include="schema\module.mk">
-      <Filter>schema</Filter>
-    </None>
-    <None Include="slony\module.mk">
-      <Filter>slony</Filter>
-    </None>
-    <None Include="ui\dlgAddFavourite.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgAggregate.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgCast.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgCheck.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgCollation.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgColumn.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgConnect.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgConversion.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgDatabase.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgDirectDbg.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgDomain.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgEditGridOptions.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgExtension.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgExtTable.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgFindReplace.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgForeignDataWrapper.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgForeignKey.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgForeignServer.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgForeignTable.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgFunction.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgGroup.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgHbaConfig.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgIndex.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgIndexConstraint.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgJob.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgLanguage.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgMainConfig.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgManageFavourites.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgManageMacros.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgOperator.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgPackage.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgPgpassConfig.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgReassignDropOwned.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepCluster.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepClusterUpgrade.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepListen.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepNode.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepPath.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepSequence.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepSet.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepSetMerge.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepSetMove.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepSubscription.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRepTable.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRole.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgRule.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSchedule.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSchema.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSearchObject.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSelectConnection.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSequence.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgServer.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgStep.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgSynonym.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTable.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTablespace.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTextSearchConfiguration.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTextSearchDictionary.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTextSearchParser.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTextSearchTemplate.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgTrigger.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgType.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgUser.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgUserMapping.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\dlgView.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\embed-xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\embed-xrc.bat">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmBackup.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmBackupGlobals.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmBackupServer.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmExport.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmGrantWizard.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmHint.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmMaintenance.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmOptions.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmPassword.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmReport.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\frmRestore.xrc">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="ui\module.mk">
-      <Filter>ui</Filter>
-    </None>
-    <None Include="utils\module.mk">
-      <Filter>utils</Filter>
-    </None>
-    <None Include="utils\tab-complete.inc">
-      <Filter>utils</Filter>
-    </None>
-    <None Include="utils\tabcomplete.pl">
-      <Filter>utils</Filter>
-    </None>
-    <None Include="gqb\module.mk">
-      <Filter>gqb</Filter>
-    </None>
-    <None Include="pgscript\module.mk">
-      <Filter>pgscript</Filter>
-    </None>
-    <None Include="pgscript\parser.sh">
-      <Filter>pgscript</Filter>
-    </None>
-    <None Include="pgscript\pgsParser.yy">
-      <Filter>pgscript</Filter>
-    </None>
-    <None Include="pgscript\pgsScanner.ll">
-      <Filter>pgscript</Filter>
-    </None>
-    <None Include="pgscript\README">
-      <Filter>pgscript</Filter>
-    </None>
-    <None Include="pgscript\exceptions\module.mk">
-      <Filter>pgscript\exceptions</Filter>
-    </None>
-    <None Include="pgscript\expressions\module.mk">
-      <Filter>pgscript\expressions</Filter>
-    </None>
-    <None Include="pgscript\generators\module.mk">
-      <Filter>pgscript\generators</Filter>
-    </None>
-    <None Include="pgscript\objects\module.mk">
-      <Filter>pgscript\objects</Filter>
-    </None>
-    <None Include="pgscript\statements\module.mk">
-      <Filter>pgscript\statements</Filter>
-    </None>
-    <None Include="pgscript\utilities\module.mk">
-      <Filter>pgscript\utilities</Filter>
-    </None>
-    <None Include="pgscript\utilities\m_apm\module.mk">
-      <Filter>pgscript\utilities\m_apm</Filter>
-    </None>
-    <None Include="ogl\module.mk">
-      <Filter>ogl</Filter>
-    </None>
-    <None Include="ogl\README">
-      <Filter>ogl</Filter>
-    </None>
-    <None Include="dd\module.mk">
-      <Filter>dd</Filter>
-    </None>
-    <None Include="dd\dditems\module.mk">
-      <Filter>dd\dditems</Filter>
-    </None>
-    <None Include="dd\dditems\figures\module.mk">
-      <Filter>dd\dditems\figures</Filter>
-    </None>
-    <None Include="dd\dditems\handles\module.mk">
-      <Filter>dd\dditems\handles</Filter>
-    </None>
-    <None Include="dd\dditems\locators\module.mk">
-      <Filter>dd\dditems\locators</Filter>
-    </None>
-    <None Include="dd\dditems\tools\module.mk">
-      <Filter>dd\dditems\tools</Filter>
-    </None>
-    <None Include="dd\dditems\utilities\module.mk">
-      <Filter>dd\dditems\utilities</Filter>
-    </None>
-    <None Include="dd\ddmodel\module.mk">
-      <Filter>dd\ddmodel</Filter>
-    </None>
-    <None Include="hotdraw\module.mk">
-      <Filter>hotdraw</Filter>
-    </None>
-    <None Include="hotdraw\connectors\module.mk">
-      <Filter>hotdraw\connectors</Filter>
-    </None>
-    <None Include="hotdraw\figures\module.mk">
-      <Filter>hotdraw\figures</Filter>
-    </None>
-    <None Include="hotdraw\figures\defaultAttributes\module.mk">
-      <Filter>hotdraw\figures\defaultAttributes</Filter>
-    </None>
-    <None Include="hotdraw\figures\xml\module.mk">
-      <Filter>hotdraw\figures\xml</Filter>
-    </None>
-    <None Include="hotdraw\handles\module.mk">
-      <Filter>hotdraw\handles</Filter>
-    </None>
-    <None Include="hotdraw\locators\module.mk">
-      <Filter>hotdraw\locators</Filter>
-    </None>
-    <None Include="hotdraw\main\module.mk">
-      <Filter>hotdraw\main</Filter>
-    </None>
-    <None Include="hotdraw\tools\module.mk">
-      <Filter>hotdraw\tools</Filter>
-    </None>
-    <None Include="hotdraw\utilities\module.mk">
-      <Filter>hotdraw\utilities</Filter>
-    </None>
-    <None Include="Makefile.am" />
-    <None Include="plugins.ini" />
-    <None Include="settings.ini" />
-    <None Include="ver_svn.bat" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="include\copyright.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgAdmin3.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\postgres.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\precomp.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\svnversion.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\version.h">
-      <Filter>include</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\csvfiles.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\factory.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\favourites.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\macros.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\misc.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\pgconfig.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\pgDefs.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\pgfeatures.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\registr.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\registry.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\sysLogger.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\sysProcess.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\sysSettings.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\utils\utffile.h">
-      <Filter>include\utils</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\calbox.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlAuiNotebook.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlCheckTreeView.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlColourPicker.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlComboBox.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlDefaultSecurityPanel.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlListView.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlMenuToolbar.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlSeclabelPanel.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlSecurityPanel.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlSQLBox.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlSQLGrid.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlSQLResult.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\ctlTree.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\explainCanvas.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\timespin.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\wxgridsel.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_calb.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_ctlchecktreeview.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_ctlcolourpicker.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_ctlcombo.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_ctltree.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_sqlbox.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ctl\xh_timespin.h">
-      <Filter>include\ctl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\parser\keywords.h">
-      <Filter>include\parser</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\dlgJob.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\dlgSchedule.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\dlgStep.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\pgaJob.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\pgaSchedule.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\agent\pgaStep.h">
-      <Filter>include\agent</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepCluster.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepListen.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepNode.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepPath.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepProperty.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepSequence.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepSet.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepSubscription.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\dlgRepTable.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slCluster.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slListen.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slNode.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slPath.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slSequence.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slSet.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slSubscription.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\slony\slTable.h">
-      <Filter>include\slony</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgAddFavourite.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgAggregate.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgCast.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgCheck.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgClasses.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgCollation.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgColumn.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgConnect.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgConversion.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgDatabase.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgDomain.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgEditGridOptions.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgExtension.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgExtTable.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgFindReplace.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgForeignDataWrapper.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgForeignKey.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgForeignServer.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgForeignTable.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgFunction.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgGroup.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgHbaConfig.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgIndex.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgIndexConstraint.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgLanguage.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgMainConfig.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgManageFavourites.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgManageMacros.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgOperator.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgPackage.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgPgpassConfig.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgProperty.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgReassignDropOwned.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgRole.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgRule.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSchema.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSearchObject.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSelectConnection.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSelectDatabase.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSequence.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgServer.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgSynonym.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTable.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTablespace.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTextSearchConfiguration.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTextSearchDictionary.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTextSearchParser.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTextSearchTemplate.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgTrigger.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgType.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgUser.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgUserMapping.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dlg\dlgView.h">
-      <Filter>include\dlg</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmAbout.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmBackup.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmBackupGlobals.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmBackupServer.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmConfig.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmDatabaseDesigner.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmEditGrid.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmExport.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmGrantWizard.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmHbaConfig.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmHint.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmImport.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmMain.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmMainConfig.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmMaintenance.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmOptions.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmPassword.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmPgpassConfig.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmQuery.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmReport.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmRestore.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmSplash.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\frmStatus.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\frm\menu.h">
-      <Filter>include\frm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\edbPackage.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\edbPackageFunction.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\edbPackageVariable.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\edbPrivateSynonym.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\edbSynonym.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\gpExtTable.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\gpPartition.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\gpResQueue.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgAggregate.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgCast.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgCatalogObject.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgCheck.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgCollation.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgCollection.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgColumn.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgConstraints.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgConversion.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgDatabase.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgDatatype.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgDomain.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgExtension.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgForeignDataWrapper.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgForeignKey.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgForeignServer.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgForeignTable.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgFunction.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgGroup.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgIndex.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgIndexConstraint.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgLanguage.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgObject.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgOperator.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgOperatorClass.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgOperatorFamily.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgRole.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgRule.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgSchema.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgSequence.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgServer.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTable.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTablespace.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTextSearchConfiguration.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTextSearchDictionary.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTextSearchParser.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTextSearchTemplate.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgTrigger.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgType.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgUser.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgUserMapping.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\schema\pgView.h">
-      <Filter>include\schema</Filter>
-    </ClInclude>
-    <ClInclude Include="include\db\pgConn.h">
-      <Filter>include\db</Filter>
-    </ClInclude>
-    <ClInclude Include="include\db\pgQueryThread.h">
-      <Filter>include\db</Filter>
-    </ClInclude>
-    <ClInclude Include="include\db\pgSet.h">
-      <Filter>include\db</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\ctlMessageWindow.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\ctlResultGrid.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\ctlStackWindow.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\ctlTabWindow.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\ctlVarWindow.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\dbgBreakPoint.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\dbgConst.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\ctlMessageWindow.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\ctlResultGrid.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\ctlStackWindow.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\ctlTabWindow.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\ctlVarWindow.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\dbgBreakPoint.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\dbgTargetInfo.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\debugger.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\dlgDirectDbg.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="debugger\frmDebugger.cpp">
+      <Filter>debugger</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbArrayCollection.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbBrowser.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbCollection.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbColumn.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbController.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbDatabase.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbGraphSimple.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbGridJoinTable.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbGridOrderTable.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbGridProjTable.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbGridRestTable.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbModel.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbObject.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbObjectCollection.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbQueryObjs.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbSchema.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbTable.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbView.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="gqb\gqbViewPanels.cpp">
+      <Filter>gqb</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\lex.pgs.cc">
+      <Filter>pgscript</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\parser.tab.cc">
+      <Filter>pgscript</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\pgsApplication.cpp">
+      <Filter>pgscript</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsArithmeticException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsAssertException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsBreakException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsCastException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsContinueException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsInterruptException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\exceptions\pgsParameterException.cpp">
+      <Filter>pgscript\exceptions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsAnd.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsAssign.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsAssignToRecord.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsCast.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsColumns.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsDifferent.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsEqual.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsExecute.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsExpression.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenDate.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenDateTime.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenDictionary.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenInt.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenReal.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenReference.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenRegex.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenString.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGenTime.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGreater.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsGreaterEqual.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsIdent.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsIdentRecord.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsLines.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsLower.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsLowerEqual.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsMinus.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsModulo.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsNegate.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsNot.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsOperation.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsOr.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsOver.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsParenthesis.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsPlus.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsRemoveLine.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsTimes.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\expressions\pgsTrim.cpp">
+      <Filter>pgscript\expressions</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsDateGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsDateTimeGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsDictionaryGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsIntegerGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsNumberGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsObjectGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsRealGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsReferenceGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsRegexGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsStringGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\generators\pgsTimeGen.cpp">
+      <Filter>pgscript\generators</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\objects\pgsGenerator.cpp">
+      <Filter>pgscript\objects</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\objects\pgsNumber.cpp">
+      <Filter>pgscript\objects</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\objects\pgsRecord.cpp">
+      <Filter>pgscript\objects</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\objects\pgsString.cpp">
+      <Filter>pgscript\objects</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\objects\pgsVariable.cpp">
+      <Filter>pgscript\objects</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsAssertStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsBreakStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsContinueStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsDeclareRecordStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsExpressionStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsIfStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsPrintStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsProgram.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsStmtList.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\statements\pgsWhileStmt.cpp">
+      <Filter>pgscript\statements</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsAlloc.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsContext.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsDriver.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsMapm.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsThread.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\pgsUtilities.cpp">
+      <Filter>pgscript\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm5sin.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_add.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_cpi.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_div.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_exp.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fam.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fft.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_flr.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_fpf.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_gcd.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg2.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg3.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_lg4.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_log.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_mul.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_pow.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_rcp.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_rnd.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_set.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapm_sin.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmasin.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmasn0.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmcbrt.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmcnst.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmfact.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmfmul.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmgues.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmhasn.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmhsin.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmipwr.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmistr.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmpwr2.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmrsin.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmsqrt.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmstck.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutil.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutl1.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="pgscript\utilities\m_apm\mapmutl2.cpp">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\basic.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\basic2.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\bmpshape.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\canvas.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\composit.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\constrnt.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\divided.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\drawn.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\lines.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\mfutils.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\ogldiag.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="ogl\oglmisc.cpp">
+      <Filter>ogl</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddColumnFigure.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddColumnKindIcon.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddColumnOptionIcon.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddRelationshipFigure.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddRelationshipItem.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddRelationshipTerminal.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddTableFigure.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\ddTextTableItemFigure.cpp">
+      <Filter>dd\dditems\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\figures\xml\ddXmlStorage.cpp">
+      <Filter>dd\dditems\figures\xml</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddAddColButtonHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddAddFkButtonHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddMinMaxTableButtonHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddRemoveTableButtonHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddScrollBarHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\handles\ddSouthTableSizeHandle.cpp">
+      <Filter>dd\dditems\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddAddColLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddAddFkLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddMinMaxTableLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddRemoveTableLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddScrollBarTableLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\locators\ddTableBottomLocator.cpp">
+      <Filter>dd\dditems\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\tools\ddColumnFigureTool.cpp">
+      <Filter>dd\dditems\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\tools\ddColumnTextTool.cpp">
+      <Filter>dd\dditems\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\utilities\ddPrecisionScaleDialog.cpp">
+      <Filter>dd\dditems\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\utilities\ddSelectKindFksDialog.cpp">
+      <Filter>dd\dditems\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\dditems\utilities\ddTableNameDialog.cpp">
+      <Filter>dd\dditems\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddBrowserDataContainer.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddDatabaseDesign.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddDBReverseEnginering.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddDrawingEditor.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddDrawingView.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddGenerationWizard.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="dd\ddmodel\ddModelBrowser.cpp">
+      <Filter>dd\ddmodel</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\connectors\hdChopBoxConnector.cpp">
+      <Filter>hotdraw\connectors</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\connectors\hdIConnector.cpp">
+      <Filter>hotdraw\connectors</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\connectors\hdLocatorConnector.cpp">
+      <Filter>hotdraw\connectors</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\connectors\hdStickyRectangleConnector.cpp">
+      <Filter>hotdraw\connectors</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdAbstractFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdAbstractMenuFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdAttribute.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdAttributeFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdBitmapFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdCompositeFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdIConnectionFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdIFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdLineConnection.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdLineTerminal.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdPolyLineFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdRectangleFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\hdSimpleTextFigure.cpp">
+      <Filter>hotdraw\figures</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFillAttribute.cpp">
+      <Filter>hotdraw\figures\defaultAttributes</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontAttribute.cpp">
+      <Filter>hotdraw\figures\defaultAttributes</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdFontColorAttribute.cpp">
+      <Filter>hotdraw\figures\defaultAttributes</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\defaultAttributes\hdLineAttribute.cpp">
+      <Filter>hotdraw\figures\defaultAttributes</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\figures\xml\hdStorage.cpp">
+      <Filter>hotdraw\figures\xml</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdButtonHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionEndHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdChangeConnectionStartHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdIHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdLineConnectionHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdLocatorHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\handles\hdPolyLineHandle.cpp">
+      <Filter>hotdraw\handles</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\locators\hdILocator.cpp">
+      <Filter>hotdraw\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\locators\hdPolyLineLocator.cpp">
+      <Filter>hotdraw\locators</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\main\hdDrawing.cpp">
+      <Filter>hotdraw\main</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\main\hdDrawingEditor.cpp">
+      <Filter>hotdraw\main</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\main\hdDrawingView.cpp">
+      <Filter>hotdraw\main</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdAbstractTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdCanvasMenuTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdCompositeFigureTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdConnectionCreationTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdCreationTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdDragCreationTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdDragTrackerTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdFigureTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdHandleTrackerTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdITool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdMenuTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdPolyLineFigureTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdSelectAreaTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdSelectionTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\tools\hdSimpleTextTool.cpp">
+      <Filter>hotdraw\tools</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdArrayCollection.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdCollection.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdGeometry.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdKeyEvent.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdMouseEvent.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdMultiPosRect.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdPoint.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdRect.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="hotdraw\utilities\hdRemoveDeleteDialog.cpp">
+      <Filter>hotdraw\utilities</Filter>
+    </ClCompile>
+    <ClCompile Include="pgAdmin3.cpp" />
+    <ClCompile Include="precomp.cpp" />
+    <ClCompile Include="libssh2\agent.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\channel.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\comp.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\crypt.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\global.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\hostkey.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\keepalive.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\kex.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\knownhost.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\libgcrypt.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\mac.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\misc.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\openssl.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\packet.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\pem.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\publickey.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\scp.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\session.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\sftp.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\transport.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\userauth.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="libssh2\version.c">
+      <Filter>libssh2</Filter>
+    </ClCompile>
+    <ClCompile Include="utils\sshTunnel.cpp">
+      <Filter>utils</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="agent\module.mk">
+      <Filter>agent</Filter>
+    </None>
+    <None Include="ctl\module.mk">
+      <Filter>ctl</Filter>
+    </None>
+    <None Include="db\module.mk">
+      <Filter>db</Filter>
+    </None>
+    <None Include="dlg\module.mk">
+      <Filter>dlg</Filter>
+    </None>
+    <None Include="frm\module.mk">
+      <Filter>frm</Filter>
+    </None>
+    <None Include="include\module.mk">
+      <Filter>include</Filter>
+    </None>
+    <None Include="include\utils\module.mk">
+      <Filter>include\utils</Filter>
+    </None>
+    <None Include="include\ctl\module.mk">
+      <Filter>include\ctl</Filter>
+    </None>
+    <None Include="include\images\module.mk">
+      <Filter>include\images</Filter>
+    </None>
+    <None Include="include\images\pgAdmin3.ico">
+      <Filter>include\images</Filter>
+    </None>
+    <None Include="include\images\sql.ico">
+      <Filter>include\images</Filter>
+    </None>
+    <None Include="include\parser\module.mk">
+      <Filter>include\parser</Filter>
+    </None>
+    <None Include="include\agent\module.mk">
+      <Filter>include\agent</Filter>
+    </None>
+    <None Include="include\slony\module.mk">
+      <Filter>include\slony</Filter>
+    </None>
+    <None Include="include\dlg\module.mk">
+      <Filter>include\dlg</Filter>
+    </None>
+    <None Include="include\frm\module.mk">
+      <Filter>include\frm</Filter>
+    </None>
+    <None Include="include\schema\module.mk">
+      <Filter>include\schema</Filter>
+    </None>
+    <None Include="include\db\module.mk">
+      <Filter>include\db</Filter>
+    </None>
+    <None Include="include\gqb\module.mk">
+      <Filter>include\gqb</Filter>
+    </None>
+    <None Include="include\pgscript\location.hh">
+      <Filter>include\pgscript</Filter>
+    </None>
+    <None Include="include\pgscript\parser.tab.hh">
+      <Filter>include\pgscript</Filter>
+    </None>
+    <None Include="include\pgscript\position.hh">
+      <Filter>include\pgscript</Filter>
+    </None>
+    <None Include="include\pgscript\stack.hh">
+      <Filter>include\pgscript</Filter>
+    </None>
+    <None Include="include\pgscript\exceptions\module.mk">
+      <Filter>include\pgscript\exceptions</Filter>
+    </None>
+    <None Include="include\pgscript\expressions\module.mk">
+      <Filter>include\pgscript\expressions</Filter>
+    </None>
+    <None Include="include\pgscript\generators\module.mk">
+      <Filter>include\pgscript\generators</Filter>
+    </None>
+    <None Include="include\pgscript\objects\module.mk">
+      <Filter>include\pgscript\objects</Filter>
+    </None>
+    <None Include="include\pgscript\statements\module.mk">
+      <Filter>include\pgscript\statements</Filter>
+    </None>
+    <None Include="include\pgscript\utilities\module.mk">
+      <Filter>include\pgscript\utilities</Filter>
+    </None>
+    <None Include="include\pgscript\utilities\mapm-lib\license.txt">
+      <Filter>include\pgscript\utilities\m_apm</Filter>
+    </None>
+    <None Include="include\pgscript\utilities\mapm-lib\module.mk">
+      <Filter>include\pgscript\utilities\m_apm</Filter>
+    </None>
+    <None Include="include\ogl\module.mk">
+      <Filter>include\ogl</Filter>
+    </None>
+    <None Include="include\ogl\README">
+      <Filter>include\ogl</Filter>
+    </None>
+    <None Include="include\dd\module.mk">
+      <Filter>include\dd</Filter>
+    </None>
+    <None Include="include\dd\dditems\module.mk">
+      <Filter>include\dd\dditems</Filter>
+    </None>
+    <None Include="include\dd\dditems\figures\module.mk">
+      <Filter>include\dd\dditems\figures</Filter>
+    </None>
+    <None Include="include\dd\dditems\figures\xml\module.mk">
+      <Filter>include\dd\dditems\figures\xml</Filter>
+    </None>
+    <None Include="include\dd\dditems\handles\module.mk">
+      <Filter>include\dd\dditems\handles</Filter>
+    </None>
+    <None Include="include\dd\dditems\locators\module.mk">
+      <Filter>include\dd\dditems\locators</Filter>
+    </None>
+    <None Include="include\dd\dditems\tools\module.mk">
+      <Filter>include\dd\dditems\tools</Filter>
+    </None>
+    <None Include="include\dd\dditems\utilities\module.mk">
+      <Filter>include\dd\dditems\utilities</Filter>
+    </None>
+    <None Include="include\dd\ddmodel\module.mk">
+      <Filter>include\dd\ddmodel</Filter>
+    </None>
+    <None Include="include\hotdraw\module.mk">
+      <Filter>include\hotdraw</Filter>
+    </None>
+    <None Include="include\hotdraw\connectors\module.mk">
+      <Filter>include\hotdraw\connectors</Filter>
+    </None>
+    <None Include="include\hotdraw\figures\module.mk">
+      <Filter>include\hotdraw\figures</Filter>
+    </None>
+    <None Include="include\hotdraw\figures\defaultAttributes\module.mk">
+      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
+    </None>
+    <None Include="include\hotdraw\handles\module.mk">
+      <Filter>include\hotdraw\handles</Filter>
+    </None>
+    <None Include="include\hotdraw\locators\module.mk">
+      <Filter>include\hotdraw\locators</Filter>
+    </None>
+    <None Include="include\hotdraw\main\module.mk">
+      <Filter>include\hotdraw\main</Filter>
+    </None>
+    <None Include="include\hotdraw\tools\module.mk">
+      <Filter>include\hotdraw\tools</Filter>
+    </None>
+    <None Include="include\hotdraw\utilities\module.mk">
+      <Filter>include\hotdraw\utilities</Filter>
+    </None>
+    <None Include="schema\module.mk">
+      <Filter>schema</Filter>
+    </None>
+    <None Include="slony\module.mk">
+      <Filter>slony</Filter>
+    </None>
+    <None Include="ui\dlgAddFavourite.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgAggregate.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgCast.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgCheck.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgCollation.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgColumn.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgConnect.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgConversion.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgDatabase.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgDirectDbg.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgDomain.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgEditGridOptions.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgExtension.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgExtTable.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgFindReplace.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgForeignDataWrapper.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgForeignKey.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgForeignServer.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgForeignTable.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgFunction.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgGroup.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgHbaConfig.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgIndex.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgIndexConstraint.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgJob.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgLanguage.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgMainConfig.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgManageFavourites.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgManageMacros.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgOperator.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgPackage.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgPgpassConfig.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgReassignDropOwned.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepCluster.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepClusterUpgrade.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepListen.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepNode.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepPath.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepSequence.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepSet.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepSetMerge.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepSetMove.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepSubscription.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRepTable.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRole.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgRule.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSchedule.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSchema.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSearchObject.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSelectConnection.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSequence.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgServer.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgStep.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgSynonym.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTable.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTablespace.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTextSearchConfiguration.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTextSearchDictionary.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTextSearchParser.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTextSearchTemplate.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgTrigger.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgType.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgUser.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgUserMapping.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\dlgView.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\embed-xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\embed-xrc.bat">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmBackup.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmBackupGlobals.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmBackupServer.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmExport.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmGrantWizard.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmHint.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmMaintenance.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmOptions.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmPassword.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmReport.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\frmRestore.xrc">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="ui\module.mk">
+      <Filter>ui</Filter>
+    </None>
+    <None Include="utils\module.mk">
+      <Filter>utils</Filter>
+    </None>
+    <None Include="utils\tab-complete.inc">
+      <Filter>utils</Filter>
+    </None>
+    <None Include="utils\tabcomplete.pl">
+      <Filter>utils</Filter>
+    </None>
+    <None Include="gqb\module.mk">
+      <Filter>gqb</Filter>
+    </None>
+    <None Include="pgscript\module.mk">
+      <Filter>pgscript</Filter>
+    </None>
+    <None Include="pgscript\parser.sh">
+      <Filter>pgscript</Filter>
+    </None>
+    <None Include="pgscript\pgsParser.yy">
+      <Filter>pgscript</Filter>
+    </None>
+    <None Include="pgscript\pgsScanner.ll">
+      <Filter>pgscript</Filter>
+    </None>
+    <None Include="pgscript\README">
+      <Filter>pgscript</Filter>
+    </None>
+    <None Include="pgscript\exceptions\module.mk">
+      <Filter>pgscript\exceptions</Filter>
+    </None>
+    <None Include="pgscript\expressions\module.mk">
+      <Filter>pgscript\expressions</Filter>
+    </None>
+    <None Include="pgscript\generators\module.mk">
+      <Filter>pgscript\generators</Filter>
+    </None>
+    <None Include="pgscript\objects\module.mk">
+      <Filter>pgscript\objects</Filter>
+    </None>
+    <None Include="pgscript\statements\module.mk">
+      <Filter>pgscript\statements</Filter>
+    </None>
+    <None Include="pgscript\utilities\module.mk">
+      <Filter>pgscript\utilities</Filter>
+    </None>
+    <None Include="pgscript\utilities\m_apm\module.mk">
+      <Filter>pgscript\utilities\m_apm</Filter>
+    </None>
+    <None Include="ogl\module.mk">
+      <Filter>ogl</Filter>
+    </None>
+    <None Include="ogl\README">
+      <Filter>ogl</Filter>
+    </None>
+    <None Include="dd\module.mk">
+      <Filter>dd</Filter>
+    </None>
+    <None Include="dd\dditems\module.mk">
+      <Filter>dd\dditems</Filter>
+    </None>
+    <None Include="dd\dditems\figures\module.mk">
+      <Filter>dd\dditems\figures</Filter>
+    </None>
+    <None Include="dd\dditems\handles\module.mk">
+      <Filter>dd\dditems\handles</Filter>
+    </None>
+    <None Include="dd\dditems\locators\module.mk">
+      <Filter>dd\dditems\locators</Filter>
+    </None>
+    <None Include="dd\dditems\tools\module.mk">
+      <Filter>dd\dditems\tools</Filter>
+    </None>
+    <None Include="dd\dditems\utilities\module.mk">
+      <Filter>dd\dditems\utilities</Filter>
+    </None>
+    <None Include="dd\ddmodel\module.mk">
+      <Filter>dd\ddmodel</Filter>
+    </None>
+    <None Include="hotdraw\module.mk">
+      <Filter>hotdraw</Filter>
+    </None>
+    <None Include="hotdraw\connectors\module.mk">
+      <Filter>hotdraw\connectors</Filter>
+    </None>
+    <None Include="hotdraw\figures\module.mk">
+      <Filter>hotdraw\figures</Filter>
+    </None>
+    <None Include="hotdraw\figures\defaultAttributes\module.mk">
+      <Filter>hotdraw\figures\defaultAttributes</Filter>
+    </None>
+    <None Include="hotdraw\figures\xml\module.mk">
+      <Filter>hotdraw\figures\xml</Filter>
+    </None>
+    <None Include="hotdraw\handles\module.mk">
+      <Filter>hotdraw\handles</Filter>
+    </None>
+    <None Include="hotdraw\locators\module.mk">
+      <Filter>hotdraw\locators</Filter>
+    </None>
+    <None Include="hotdraw\main\module.mk">
+      <Filter>hotdraw\main</Filter>
+    </None>
+    <None Include="hotdraw\tools\module.mk">
+      <Filter>hotdraw\tools</Filter>
+    </None>
+    <None Include="hotdraw\utilities\module.mk">
+      <Filter>hotdraw\utilities</Filter>
+    </None>
+    <None Include="Makefile.am" />
+    <None Include="plugins.ini" />
+    <None Include="settings.ini" />
+    <None Include="ver_svn.bat" />
+    <None Include="include\libssh2\module.mk">
+      <Filter>include\libssh2</Filter>
+    </None>
+    <None Include="libssh2\module.mk">
+      <Filter>libssh2</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="include\copyright.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgAdmin3.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\postgres.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\precomp.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\svnversion.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\version.h">
+      <Filter>include</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\csvfiles.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\factory.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\favourites.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\macros.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\misc.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\pgconfig.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\pgDefs.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\pgfeatures.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\registr.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\registry.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\sysLogger.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\sysProcess.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\sysSettings.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\utffile.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\calbox.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlAuiNotebook.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlCheckTreeView.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlColourPicker.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlComboBox.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlDefaultSecurityPanel.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlListView.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlMenuToolbar.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlSeclabelPanel.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlSecurityPanel.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlSQLBox.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlSQLGrid.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlSQLResult.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\ctlTree.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\explainCanvas.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\timespin.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\wxgridsel.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_calb.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_ctlchecktreeview.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_ctlcolourpicker.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_ctlcombo.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_ctltree.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_sqlbox.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ctl\xh_timespin.h">
+      <Filter>include\ctl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\parser\keywords.h">
+      <Filter>include\parser</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\dlgJob.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\dlgSchedule.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\dlgStep.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\pgaJob.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\pgaSchedule.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\agent\pgaStep.h">
+      <Filter>include\agent</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepCluster.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepListen.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepNode.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepPath.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepProperty.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepSequence.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepSet.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepSubscription.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\dlgRepTable.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slCluster.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slListen.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slNode.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slPath.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slSequence.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slSet.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slSubscription.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\slony\slTable.h">
+      <Filter>include\slony</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgAddFavourite.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgAggregate.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgCast.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgCheck.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgClasses.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgCollation.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgColumn.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgConnect.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgConversion.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgDatabase.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgDomain.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgEditGridOptions.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgExtension.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgExtTable.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgFindReplace.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgForeignDataWrapper.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgForeignKey.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgForeignServer.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgForeignTable.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgFunction.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgGroup.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgHbaConfig.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgIndex.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgIndexConstraint.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgLanguage.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgMainConfig.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgManageFavourites.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgManageMacros.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgOperator.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgPackage.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgPgpassConfig.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgProperty.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgReassignDropOwned.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgRole.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgRule.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSchema.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSearchObject.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSelectConnection.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSelectDatabase.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSequence.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgServer.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgSynonym.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTable.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTablespace.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTextSearchConfiguration.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTextSearchDictionary.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTextSearchParser.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTextSearchTemplate.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgTrigger.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgType.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgUser.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgUserMapping.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dlg\dlgView.h">
+      <Filter>include\dlg</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmAbout.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmBackup.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmBackupGlobals.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmBackupServer.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmConfig.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmDatabaseDesigner.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmEditGrid.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmExport.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmGrantWizard.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmHbaConfig.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmHint.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmImport.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmMain.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmMainConfig.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmMaintenance.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmOptions.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmPassword.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmPgpassConfig.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmQuery.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmReport.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmRestore.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmSplash.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\frmStatus.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\frm\menu.h">
+      <Filter>include\frm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\edbPackage.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\edbPackageFunction.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\edbPackageVariable.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\edbPrivateSynonym.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\edbSynonym.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\gpExtTable.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\gpPartition.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\gpResQueue.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgAggregate.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgCast.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgCatalogObject.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgCheck.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgCollation.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgCollection.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgColumn.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgConstraints.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgConversion.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgDatabase.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgDatatype.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgDomain.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgExtension.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgForeignDataWrapper.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgForeignKey.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgForeignServer.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgForeignTable.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgFunction.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgGroup.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgIndex.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgIndexConstraint.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgLanguage.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgObject.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgOperator.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgOperatorClass.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgOperatorFamily.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgRole.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgRule.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgSchema.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgSequence.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgServer.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTable.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTablespace.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTextSearchConfiguration.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTextSearchDictionary.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTextSearchParser.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTextSearchTemplate.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgTrigger.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgType.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgUser.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgUserMapping.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\schema\pgView.h">
+      <Filter>include\schema</Filter>
+    </ClInclude>
+    <ClInclude Include="include\db\pgConn.h">
+      <Filter>include\db</Filter>
+    </ClInclude>
+    <ClInclude Include="include\db\pgQueryThread.h">
+      <Filter>include\db</Filter>
+    </ClInclude>
+    <ClInclude Include="include\db\pgSet.h">
+      <Filter>include\db</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\ctlMessageWindow.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\ctlResultGrid.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\ctlStackWindow.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\ctlTabWindow.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\ctlVarWindow.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\dbgBreakPoint.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\dbgConst.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
     <ClInclude Include="include\debugger\dbgController.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
+      <Filter>include\debugger</Filter>
+    </ClInclude>
     <ClInclude Include="include\debugger\dbgModel.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\dbgTargetInfo.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\debugger.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\dlgDirectDbg.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\debugger\frmDebugger.h">
-      <Filter>include\debugger</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbArrayCollection.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbBrowser.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbCollection.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbCollectionBase.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbColumn.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbDatabase.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbEvents.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGraphBehavior.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGraphSimple.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGridJoinTable.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGridOrderTable.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGridProjTable.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbGridRestTable.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbModel.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbObject.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbObjectCollection.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbQueryObjs.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbSchema.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbTable.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbViewController.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\gqb\gqbViewPanels.h">
-      <Filter>include\gqb</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\FlexLexer.h">
-      <Filter>include\pgscript</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\pgsApplication.h">
-      <Filter>include\pgscript</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\pgScript.h">
-      <Filter>include\pgscript</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsArithmeticException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsAssertException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsBreakException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsCastException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsContinueException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsInterruptException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\exceptions\pgsParameterException.h">
-      <Filter>include\pgscript\exceptions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsAnd.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsAssign.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsAssignToRecord.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsCast.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsColumns.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsDifferent.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsEqual.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsExecute.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsExpression.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsExpressions.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenDate.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenDateTime.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenDictionary.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenInt.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenReal.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenReference.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenRegex.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenString.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGenTime.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGreater.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsGreaterEqual.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsIdent.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsIdentRecord.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsLines.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsLower.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsLowerEqual.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsMinus.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsModulo.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsNegate.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsNot.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsOperation.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsOr.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsOver.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsParenthesis.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsPlus.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsRemoveLine.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsTimes.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\expressions\pgsTrim.h">
-      <Filter>include\pgscript\expressions</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsDateGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsDateTimeGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsDictionaryGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsIntegerGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsNumberGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsObjectGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsRealGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsReferenceGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsRegexGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsStringGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\generators\pgsTimeGen.h">
-      <Filter>include\pgscript\generators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsGenerator.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsNumber.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsObjects.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsRecord.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsString.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\objects\pgsVariable.h">
-      <Filter>include\pgscript\objects</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsAssertStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsBreakStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsContinueStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsDeclareRecordStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsExpressionStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsIfStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsPrintStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsProgram.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsStatements.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsStmtList.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\statements\pgsWhileStmt.h">
-      <Filter>include\pgscript\statements</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsAlloc.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsContext.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsCopiedPtr.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsDriver.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsMapm.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsScanner.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsSharedPtr.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsThread.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\pgsUtilities.h">
-      <Filter>include\pgscript\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm.h">
-      <Filter>include\pgscript\utilities\m_apm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm_lc.h">
-      <Filter>include\pgscript\utilities\m_apm</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\basic.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\basicp.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\bmpshape.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\canvas.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\composit.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\constrnt.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\divided.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\drawn.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\drawnp.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\lines.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\linesp.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\mfutils.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\misc.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\ogl.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\ogl\ogldiag.h">
-      <Filter>include\ogl</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddColumnFigure.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddColumnKindIcon.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddColumnOptionIcon.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipFigure.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipItem.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddRelationshipTerminal.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddTableFigure.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\ddTextTableItemFigure.h">
-      <Filter>include\dd\dditems\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\figures\xml\ddXmlStorage.h">
-      <Filter>include\dd\dditems\figures\xml</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddAddColButtonHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddAddFkButtonHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddMinMaxTableButtonHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddRemoveTableButtonHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddScrollBarHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\handles\ddSouthTableSizeHandle.h">
-      <Filter>include\dd\dditems\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddAddColLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddAddFkLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddMinMaxTableLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddRemoveTableLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddScrollBarTableLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\locators\ddTableBottomLocator.h">
-      <Filter>include\dd\dditems\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\tools\ddColumnFigureTool.h">
-      <Filter>include\dd\dditems\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\tools\ddColumnTextTool.h">
-      <Filter>include\dd\dditems\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\utilities\ddDataType.h">
-      <Filter>include\dd\dditems\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\utilities\ddPrecisionScaleDialog.h">
-      <Filter>include\dd\dditems\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\utilities\ddSelectKindFksDialog.h">
-      <Filter>include\dd\dditems\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\dditems\utilities\ddTableNameDialog.h">
-      <Filter>include\dd\dditems\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddBrowserDataContainer.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddDatabaseDesign.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddDBReverseEngineering.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddDrawingEditor.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddDrawingView.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddGenerationWizard.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\dd\ddmodel\ddModelBrowser.h">
-      <Filter>include\dd\ddmodel</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\connectors\hdChopBoxConnector.h">
-      <Filter>include\hotdraw\connectors</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\connectors\hdIConnector.h">
-      <Filter>include\hotdraw\connectors</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\connectors\hdLocatorConnector.h">
-      <Filter>include\hotdraw\connectors</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\connectors\hdStickyRectangleConnector.h">
-      <Filter>include\hotdraw\connectors</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdAbstractFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdAbstractMenuFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdAttribute.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdAttributeFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdBitmapFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdCompositeFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdIConnectionFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdIFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdLineConnection.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdLineTerminal.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdPolyLineFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdRectangleFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\hdSimpleTextFigure.h">
-      <Filter>include\hotdraw\figures</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFillAttribute.h">
-      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontAttribute.h">
-      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontColorAttribute.h">
-      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdLineAttribute.h">
-      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\figures\xml\hdStorage.h">
-      <Filter>include\hotdraw\figures\xml</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdButtonHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionEndHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionStartHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdIHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdLineConnectionHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdLocatorHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\handles\hdPolyLineHandle.h">
-      <Filter>include\hotdraw\handles</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\locators\hdILocator.h">
-      <Filter>include\hotdraw\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\locators\hdPolyLineLocator.h">
-      <Filter>include\hotdraw\locators</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\main\hdDrawing.h">
-      <Filter>include\hotdraw\main</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\main\hdDrawingEditor.h">
-      <Filter>include\hotdraw\main</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\main\hdDrawingView.h">
-      <Filter>include\hotdraw\main</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\main\hdObject.h">
-      <Filter>include\hotdraw\main</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdAbstractTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdCanvasMenuTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdCompositeFigureTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdConnectionCreationTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdCreationTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdDragCreationTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdDragTrackerTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdFigureTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdHandleTrackerTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdITool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdMenuTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdPolyLineFigureTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdSelectAreaTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdSelectionTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\tools\hdSimpleTextTool.h">
-      <Filter>include\hotdraw\tools</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdArrayCollection.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdCollection.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdCollectionBase.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdGeometry.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdKeyEvent.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdMouseEvent.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdMultiPosRect.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdPoint.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdRect.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-    <ClInclude Include="include\hotdraw\utilities\hdRemoveDeleteDialog.h">
-      <Filter>include\hotdraw\utilities</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <png2c Include="include\images\aggregate-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\aggregate.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\aggregates.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\back.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\backup.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\baddatabase.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\cast-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\cast.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\casts.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalog-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalog.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalogobject-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalogobject.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalogobjects.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\catalogs.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\check.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\checkbad.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\checked.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\clearAll.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\clip_copy.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\clip_cut.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\clip_paste.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\closeddatabase-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\closeddatabase.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\collation-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\collation.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\collations.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\column-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\column.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\columns.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\configuration.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\configurations.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\connect.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\constraints.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\continue.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\conversion.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\conversions.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\create.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\database-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\database.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\databases.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddAddColumn.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddAddColumnCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddAddForeignKey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddcancel.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddDeleteTableCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddDown.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddforeignkey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddforeignkeyfromuk.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddforeignkeyuniquekey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddforeignkeyuniquekeyfromuk.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddgendiagram.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddMaximizeTable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddMinimizeTable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddMinMaxCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddmodel-32.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddnewdiagram.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddnotnull.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddnull.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddprimaryforeignkey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddprimaryforeignkeyfromuk.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddprimarykey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddprimarykeyuniquekey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddRelationshipCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddRemoveColumn.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddRemoveColumnCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddRemoveTable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddRemoveTable2.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddunique.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ddUp.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\debugger.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\delete.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\dictionaries.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\dictionary.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\disabled.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\dnd_copy.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\dnd_move.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\dnd_none.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\domain-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\domain.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\domains.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\down.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\drop.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\edit_clear.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\edit_find.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\edit_redo.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\edit_undo.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\enumeration.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\enumerations.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_aggregate.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_append.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_bmp_heap.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_bmp_index.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_broadcast_motion.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_cte_scan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_gather_motion.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_group.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_anti_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_semi_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_setop_except.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_setop_except_all.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_setop_intersect.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_setop_intersect_all.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_hash_setop_unknown.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_index_scan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_limit.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_materialize.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_merge.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_merge_anti_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_merge_semi_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_nested.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_nested_loop_anti_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_nested_loop_semi_join.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_recursive_union.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_redistribute_motion.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_result.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_scan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_seek.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_setop.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_sort.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_subplan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_tid_scan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_unique.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_unknown.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_window_aggregate.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\ex_worktable_scan.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\exclude.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\extension-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\extension.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\extensions.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\exttable-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\exttable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\exttables.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\favourite.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\file_new.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\file_open.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\file_save.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\folder.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreigndatawrapper-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreigndatawrapper.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreigndatawrappers.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreignkey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreignkeybad.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreignserver-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreignserver.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreignservers.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreigntable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\foreigntables.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\forward.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\function.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\functions.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbAdd.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbAddRest.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbColNotSel.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbColSel.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbDown.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbDownBottom.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbJoin.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbJoinCursor.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbOrderAdd.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbOrderAddAll.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbOrderRemove.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbOrderRemoveAll.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbRemove.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbRemoveRest.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbUp.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\gqbUpTop.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\group.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\groups.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\help.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\help2.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\hint.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\hint2.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\index.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\indexes.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\job.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\jobdisabled.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\jobs.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\key.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\language-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\language.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\languages.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\loginroles.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\namespace-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\namespace.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\namespaces.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operator.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operatorclass.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operatorclasses.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operatorfamilies.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operatorfamily.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\operators.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\package.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\packages.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\parser.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\parsers.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\pgAdmin3-16.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\pgAdmin3-32.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\pgAdmin3.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\plugins.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\primarykey.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\procedure.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\procedures.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\properties.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\property.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\query_cancel.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\query_execfile.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\query_execute.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\query_explain.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\query_pgscript.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\readdata.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\refresh.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\reload.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\restore.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\roles.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\rule.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\rulebad.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\rules.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\schedule.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\schedules.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sequence-repl.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sequence.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sequences.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\server-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\server.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\serverbad-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\serverbad.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\servers.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\setBreak.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slcluster.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slclusters.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sllisten.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sllistens.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slnode-disabled.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slnode-local.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slnode.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slnodes.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slpath.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slpaths.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slset.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slset2.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slsets.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slsubscription.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slsubscription2.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\slsubscriptions.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sortfilter.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\splash.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sql-16.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sql-32.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\sql.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\statistics.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\step.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\stepInto.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\stepOver.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\steps.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\stop.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\storedata.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\synonym.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\synonyms.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\table-repl-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\table-repl.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\table-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\table.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\tables.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\tablespace.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\tablespaces.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\template.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\templates.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\terminate_backend.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\textsearch.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\trigger.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\triggerbad.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\triggerfunction.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\triggerfunctions.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\triggers.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\type.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\types.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\uncheck.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\unchecked.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\unique.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\up.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\user.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\usermapping-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\usermapping.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\usermappings.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\users.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\vacuum.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\variable.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\variables.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\view-sm.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\view.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\viewdata.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\viewfiltereddata.png">
-      <Filter>include\images</Filter>
-    </png2c>
-    <png2c Include="include\images\views.png">
-      <Filter>include\images</Filter>
-    </png2c>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="pgAdmin3.rc" />
-  </ItemGroup>
-</Project>
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\dbgTargetInfo.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\debugger.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\dlgDirectDbg.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\debugger\frmDebugger.h">
+      <Filter>include\debugger</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbArrayCollection.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbBrowser.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbCollection.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbCollectionBase.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbColumn.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbDatabase.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbEvents.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGraphBehavior.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGraphSimple.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGridJoinTable.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGridOrderTable.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGridProjTable.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbGridRestTable.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbModel.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbObject.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbObjectCollection.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbQueryObjs.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbSchema.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbTable.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbViewController.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\gqb\gqbViewPanels.h">
+      <Filter>include\gqb</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\FlexLexer.h">
+      <Filter>include\pgscript</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\pgsApplication.h">
+      <Filter>include\pgscript</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\pgScript.h">
+      <Filter>include\pgscript</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsArithmeticException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsAssertException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsBreakException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsCastException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsContinueException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsInterruptException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\exceptions\pgsParameterException.h">
+      <Filter>include\pgscript\exceptions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsAnd.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsAssign.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsAssignToRecord.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsCast.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsColumns.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsDifferent.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsEqual.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsExecute.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsExpression.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsExpressions.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenDate.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenDateTime.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenDictionary.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenInt.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenReal.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenReference.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenRegex.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenString.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGenTime.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGreater.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsGreaterEqual.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsIdent.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsIdentRecord.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsLines.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsLower.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsLowerEqual.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsMinus.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsModulo.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsNegate.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsNot.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsOperation.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsOr.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsOver.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsParenthesis.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsPlus.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsRemoveLine.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsTimes.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\expressions\pgsTrim.h">
+      <Filter>include\pgscript\expressions</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsDateGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsDateTimeGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsDictionaryGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsIntegerGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsNumberGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsObjectGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsRealGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsReferenceGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsRegexGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsStringGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\generators\pgsTimeGen.h">
+      <Filter>include\pgscript\generators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsGenerator.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsNumber.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsObjects.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsRecord.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsString.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\objects\pgsVariable.h">
+      <Filter>include\pgscript\objects</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsAssertStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsBreakStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsContinueStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsDeclareRecordStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsExpressionStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsIfStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsPrintStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsProgram.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsStatements.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsStmtList.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\statements\pgsWhileStmt.h">
+      <Filter>include\pgscript\statements</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsAlloc.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsContext.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsCopiedPtr.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsDriver.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsMapm.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsScanner.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsSharedPtr.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsThread.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\pgsUtilities.h">
+      <Filter>include\pgscript\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm.h">
+      <Filter>include\pgscript\utilities\m_apm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\pgscript\utilities\mapm-lib\m_apm_lc.h">
+      <Filter>include\pgscript\utilities\m_apm</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\basic.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\basicp.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\bmpshape.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\canvas.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\composit.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\constrnt.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\divided.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\drawn.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\drawnp.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\lines.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\linesp.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\mfutils.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\misc.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\ogl.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ogl\ogldiag.h">
+      <Filter>include\ogl</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddColumnFigure.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddColumnKindIcon.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddColumnOptionIcon.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipFigure.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipItem.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddRelationshipTerminal.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddTableFigure.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\ddTextTableItemFigure.h">
+      <Filter>include\dd\dditems\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\figures\xml\ddXmlStorage.h">
+      <Filter>include\dd\dditems\figures\xml</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddAddColButtonHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddAddFkButtonHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddMinMaxTableButtonHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddRemoveTableButtonHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddScrollBarHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\handles\ddSouthTableSizeHandle.h">
+      <Filter>include\dd\dditems\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddAddColLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddAddFkLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddMinMaxTableLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddRemoveTableLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddScrollBarTableLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\locators\ddTableBottomLocator.h">
+      <Filter>include\dd\dditems\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\tools\ddColumnFigureTool.h">
+      <Filter>include\dd\dditems\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\tools\ddColumnTextTool.h">
+      <Filter>include\dd\dditems\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\utilities\ddDataType.h">
+      <Filter>include\dd\dditems\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\utilities\ddPrecisionScaleDialog.h">
+      <Filter>include\dd\dditems\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\utilities\ddSelectKindFksDialog.h">
+      <Filter>include\dd\dditems\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\dditems\utilities\ddTableNameDialog.h">
+      <Filter>include\dd\dditems\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddBrowserDataContainer.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddDatabaseDesign.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddDBReverseEngineering.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddDrawingEditor.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddDrawingView.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddGenerationWizard.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\dd\ddmodel\ddModelBrowser.h">
+      <Filter>include\dd\ddmodel</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\connectors\hdChopBoxConnector.h">
+      <Filter>include\hotdraw\connectors</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\connectors\hdIConnector.h">
+      <Filter>include\hotdraw\connectors</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\connectors\hdLocatorConnector.h">
+      <Filter>include\hotdraw\connectors</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\connectors\hdStickyRectangleConnector.h">
+      <Filter>include\hotdraw\connectors</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdAbstractFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdAbstractMenuFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdAttribute.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdAttributeFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdBitmapFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdCompositeFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdIConnectionFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdIFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdLineConnection.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdLineTerminal.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdPolyLineFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdRectangleFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\hdSimpleTextFigure.h">
+      <Filter>include\hotdraw\figures</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFillAttribute.h">
+      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontAttribute.h">
+      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdFontColorAttribute.h">
+      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\defaultAttributes\hdLineAttribute.h">
+      <Filter>include\hotdraw\figures\defaultAttributes</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\figures\xml\hdStorage.h">
+      <Filter>include\hotdraw\figures\xml</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdButtonHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionEndHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdChangeConnectionStartHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdIHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdLineConnectionHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdLocatorHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\handles\hdPolyLineHandle.h">
+      <Filter>include\hotdraw\handles</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\locators\hdILocator.h">
+      <Filter>include\hotdraw\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\locators\hdPolyLineLocator.h">
+      <Filter>include\hotdraw\locators</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\main\hdDrawing.h">
+      <Filter>include\hotdraw\main</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\main\hdDrawingEditor.h">
+      <Filter>include\hotdraw\main</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\main\hdDrawingView.h">
+      <Filter>include\hotdraw\main</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\main\hdObject.h">
+      <Filter>include\hotdraw\main</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdAbstractTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdCanvasMenuTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdCompositeFigureTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdConnectionCreationTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdCreationTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdDragCreationTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdDragTrackerTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdFigureTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdHandleTrackerTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdITool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdMenuTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdPolyLineFigureTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdSelectAreaTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdSelectionTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\tools\hdSimpleTextTool.h">
+      <Filter>include\hotdraw\tools</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdArrayCollection.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdCollection.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdCollectionBase.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdGeometry.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdKeyEvent.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdMouseEvent.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdMultiPosRect.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdPoint.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdRect.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\hotdraw\utilities\hdRemoveDeleteDialog.h">
+      <Filter>include\hotdraw\utilities</Filter>
+    </ClInclude>
+    <ClInclude Include="include\db\pgQueryResultEvent.h" />
+    <ClInclude Include="include\libssh2\channel.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\comp.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\crypto.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\libgcrypt.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\libssh2.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\libssh2_priv.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\libssh2_publickey.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\libssh2_sftp.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\mac.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\misc.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\openssl.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\packet.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\session.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\sftp.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\transport.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\userauth.h">
+      <Filter>include\libssh2</Filter>
+    </ClInclude>
+    <ClInclude Include="include\libssh2\Win32\libssh2_config.h">
+      <Filter>include\libssh2\win32</Filter>
+    </ClInclude>
+    <ClInclude Include="include\utils\sshTunnel.h">
+      <Filter>include\utils</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <png2c Include="include\images\aggregate-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\aggregate.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\aggregates.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\back.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\backup.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\baddatabase.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\cast-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\cast.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\casts.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalog-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalog.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalogobject-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalogobject.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalogobjects.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\catalogs.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\check.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\checkbad.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\checked.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\clearAll.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\clip_copy.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\clip_cut.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\clip_paste.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\closeddatabase-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\closeddatabase.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\collation-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\collation.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\collations.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\column-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\column.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\columns.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\configuration.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\configurations.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\connect.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\constraints.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\continue.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\conversion.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\conversions.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\create.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\database-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\database.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\databases.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddAddColumn.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddAddColumnCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddAddForeignKey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddcancel.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddDeleteTableCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddDown.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddforeignkey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddforeignkeyfromuk.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddforeignkeyuniquekey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddforeignkeyuniquekeyfromuk.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddgendiagram.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddMaximizeTable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddMinimizeTable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddMinMaxCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddmodel-32.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddnewdiagram.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddnotnull.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddnull.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddprimaryforeignkey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddprimaryforeignkeyfromuk.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddprimarykey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddprimarykeyuniquekey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddRelationshipCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddRemoveColumn.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddRemoveColumnCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddRemoveTable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddRemoveTable2.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddunique.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ddUp.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\debugger.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\delete.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\dictionaries.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\dictionary.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\disabled.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\dnd_copy.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\dnd_move.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\dnd_none.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\domain-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\domain.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\domains.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\down.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\drop.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\edit_clear.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\edit_find.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\edit_redo.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\edit_undo.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\enumeration.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\enumerations.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_aggregate.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_append.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_bmp_heap.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_bmp_index.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_broadcast_motion.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_cte_scan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_gather_motion.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_group.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_anti_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_semi_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_setop_except.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_setop_except_all.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_setop_intersect.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_setop_intersect_all.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_hash_setop_unknown.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_index_scan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_limit.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_materialize.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_merge.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_merge_anti_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_merge_semi_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_nested.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_nested_loop_anti_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_nested_loop_semi_join.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_recursive_union.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_redistribute_motion.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_result.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_scan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_seek.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_setop.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_sort.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_subplan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_tid_scan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_unique.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_unknown.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_window_aggregate.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\ex_worktable_scan.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\exclude.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\extension-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\extension.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\extensions.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\exttable-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\exttable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\exttables.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\favourite.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\file_new.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\file_open.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\file_save.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\folder.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreigndatawrapper-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreigndatawrapper.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreigndatawrappers.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreignkey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreignkeybad.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreignserver-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreignserver.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreignservers.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreigntable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\foreigntables.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\forward.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\function.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\functions.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbAdd.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbAddRest.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbColNotSel.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbColSel.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbDown.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbDownBottom.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbJoin.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbJoinCursor.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbOrderAdd.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbOrderAddAll.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbOrderRemove.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbOrderRemoveAll.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbRemove.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbRemoveRest.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbUp.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\gqbUpTop.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\group.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\groups.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\help.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\help2.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\hint.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\hint2.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\index.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\indexes.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\job.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\jobdisabled.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\jobs.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\key.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\language-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\language.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\languages.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\loginroles.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\namespace-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\namespace.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\namespaces.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operator.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operatorclass.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operatorclasses.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operatorfamilies.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operatorfamily.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\operators.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\package.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\packages.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\parser.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\parsers.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\pgAdmin3-16.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\pgAdmin3-32.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\pgAdmin3.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\plugins.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\primarykey.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\procedure.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\procedures.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\properties.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\property.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_cancel.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_execfile.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_execute.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_explain.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_pgscript.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\readdata.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\refresh.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\reload.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\restore.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\roles.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\rule.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\rulebad.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\rules.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\schedule.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\schedules.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sequence-repl.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sequence.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sequences.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\server-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\server.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\serverbad-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\serverbad.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\servers.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\setBreak.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slcluster.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slclusters.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sllisten.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sllistens.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slnode-disabled.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slnode-local.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slnode.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slnodes.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slpath.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slpaths.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slset.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slset2.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slsets.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slsubscription.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slsubscription2.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\slsubscriptions.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sortfilter.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\splash.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sql-16.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sql-32.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\sql.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\statistics.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\step.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\stepInto.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\stepOver.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\steps.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\stop.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\storedata.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\synonym.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\synonyms.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\table-repl-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\table-repl.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\table-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\table.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\tables.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\tablespace.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\tablespaces.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\template.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\templates.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\terminate_backend.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\textsearch.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\trigger.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\triggerbad.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\triggerfunction.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\triggerfunctions.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\triggers.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\type.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\types.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\uncheck.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\unchecked.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\unique.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\up.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\user.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\usermapping-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\usermapping.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\usermappings.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\users.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\vacuum.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\variable.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\variables.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\view-sm.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\view.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\viewdata.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\viewfiltereddata.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\views.png">
+      <Filter>include\images</Filter>
+    </png2c>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="pgAdmin3.rc" />
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/pgadmin/precomp.cpp b/pgadmin/precomp.cpp
index 5af2403..b224b3e 100644
--- a/pgadmin/precomp.cpp
+++ b/pgadmin/precomp.cpp
@@ -9,6 +9,10 @@
 //
 //////////////////////////////////////////////////////////////////////////
 
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#endif
+
 #include <wx/wxprec.h>
 
 #include "pgAdmin3.h"
diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp
index 27e7f48..26d05e3 100644
--- a/pgadmin/schema/pgServer.cpp
+++ b/pgadmin/schema/pgServer.cpp
@@ -38,9 +38,16 @@
 #include "frm/frmReport.h"
 #include "dlg/dlgServer.h"
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+#include "utils/sshTunnel.h"
+#endif
+
 #define DEFAULT_PG_DATABASE wxT("postgres")
 
-pgServer::pgServer(const wxString &newName, const wxString &newHostAddr, const wxString &newDescription, const wxString &newService, const wxString &newDatabase, const wxString &newUsername, int newPort, bool _storePwd, const wxString &newRolename, bool _restore, int _ssl, const wxString &_colour, const wxString &_group)
+pgServer::pgServer(const wxString &newName, const wxString &newHostAddr, const wxString &newDescription, const wxString &newService,
+                   const wxString &newDatabase, const wxString &newUsername, int newPort, bool _storePwd, const wxString &newRolename, bool _restore,
+                   int _ssl, const wxString &_colour, const wxString &_group, bool _sshTunnel, const wxString &newTunnelHost, const wxString &newTunnelUserName,
+                   bool _authModePwd, const wxString &newTunnelPassword, const wxString &newPublicKey, const wxString &newIdentity)
 	: pgObject(serverFactory, newName)
 {
 	description = newDescription;
@@ -65,6 +72,19 @@ pgServer::pgServer(const wxString &newName, const wxString &newHostAddr, const w
 	restore = _restore;
 	superUser = false;
 	createPrivilege = false;
+	sshTunnel = _sshTunnel;
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	// SSH Tunnel
+	tunnelObj = NULL;
+	tunnelHost = newTunnelHost;
+	tunnelUserName = newTunnelUserName;
+	authModePwd = _authModePwd;
+	tunnelPassword = newTunnelPassword;
+	publicKeyFile = newPublicKey;
+	identityFile = newIdentity;
+#endif
+
 #ifdef WIN32
 	scmHandle = 0;
 	serviceHandle = 0;
@@ -76,6 +96,17 @@ pgServer::~pgServer()
 	if (conn)
 		delete conn;
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if(tunnelObj)
+	{
+		if(tunnelObj->IsAlive())
+		{
+			tunnelObj->Cleanup();
+		}
+		tunnelObj = NULL;
+	}
+#endif
+
 #ifdef WIN32
 	if (serviceHandle)
 		CloseServiceHandle(serviceHandle);
@@ -188,7 +219,18 @@ pgConn *pgServer::CreateConn(wxString dbName, OID oid, wxString applicationname)
 		dbName = GetDatabaseName();
 		oid = dbOid;
 	}
-	pgConn *conn = new pgConn(GetName(), service, hostaddr, dbName, username, password, port, rolename, ssl, oid, applicationname, sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+
+	pgConn *conn = NULL;
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if(sshTunnel)
+	{
+		conn = new pgConn(local_listenhost, service, hostaddr, dbName, username, password, local_listenport, rolename, ssl, oid, applicationname, sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+	}
+	else
+#endif
+	{
+		conn = new pgConn(GetName(), service, hostaddr, dbName, username, password, port, rolename, ssl, oid, applicationname, sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+	}
 
 	if (conn && conn->GetStatus() != PGCONN_OK)
 	{
@@ -215,6 +257,17 @@ wxString pgServer::GetFullIdentifier()
 
 bool pgServer::Disconnect(frmMain *form)
 {
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	if(tunnelObj)
+	{
+		if(tunnelObj->IsAlive())
+		{
+			tunnelObj->Cleanup();
+		}
+		tunnelObj = NULL;
+	}
+#endif
+
 	if (conn)
 	{
 		delete conn;
@@ -611,7 +664,7 @@ void pgServer::StorePassword()
 }
 
 
-int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool forceStorePassword)
+int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool forceStorePassword, bool askTunnelPassword)
 {
 	wxLogInfo(wxT("Attempting to create a connection object..."));
 
@@ -626,13 +679,18 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
 		}
 		if (askPassword)
 		{
-			if (!passwordValid || !GetPasswordIsStored() || !GetStorePwd())
+			if (sshTunnel || !passwordValid || !GetPasswordIsStored() || !GetStorePwd())
 			{
 				wxString txt;
 				txt.Printf(_("Please enter password for user %s\non server %s (%s)"), username.c_str(), description.c_str(), GetName().c_str());
-				dlgConnect dlg(form, txt, GetStorePwd());
+				dlgConnect *dlg = NULL;
+				// if sshTunnel is true then we have to hide 'Stored Password' option
+				if(sshTunnel)
+					dlg = new dlgConnect(NULL, txt, false);
+				else
+					dlg = new dlgConnect(form, txt, GetStorePwd());
 
-				switch (dlg.Go())
+				switch (dlg->Go())
 				{
 					case wxID_OK:
 						// Give the UI a chance to redraw
@@ -656,9 +714,14 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
 						return PGCONN_BAD;
 				}
 
-				iSetStorePwd(dlg.GetStorePwd());
-				password = dlg.GetPassword();
+				iSetStorePwd(dlg->GetStorePwd());
+				password = dlg->GetPassword();
 				storePassword = true;
+				if(dlg)
+				{
+					delete dlg;
+					dlg = NULL;
+				}
 			}
 		}
 		else
@@ -666,23 +729,82 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
 
 		form->StartMsg(_("Connecting to database"));
 
+		wxString host;
+		int iPort;
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		if(sshTunnel)
+		{
+			//Ask Tunnel Password
+			if(askTunnelPassword)
+			{
+				wxString txt;
+				if(GetAuthModePwd())
+				{
+					txt.Printf(_("Please enter the SSH tunnel password for user %s\non server %s"), tunnelUserName.c_str(), tunnelHost.c_str());
+				}
+				else
+				{
+					txt.Printf(_("Please enter the pass phrase for the identity file\n%s"), identityFile.c_str());
+				}
+				dlgConnect dlg(NULL, txt, false);
+
+				switch (dlg.Go())
+				{
+					case wxID_OK:
+						// Give the UI a chance to redraw
+						wxSafeYield();
+						wxMilliSleep(100);
+						wxSafeYield();
+						tunnelPassword = dlg.GetPassword();
+						break;
+					case wxID_CANCEL:
+					case -1:
+					default:
+						// Give the UI a chance to redraw
+						wxSafeYield();
+						wxMilliSleep(100);
+						wxSafeYield();
+						form->EndMsg(false);
+						return PGCONN_ABORTED;
+				}
+			}
+			// Create SSH Tunnel if required
+			if(!tunnelObj)
+			{
+				if(!createSSHTunnel())
+				{
+					form->EndMsg(false);
+					return PGCONN_SSHTUNNEL_ERROR;
+				}
+			}
+
+			host = local_listenhost;
+			iPort = local_listenport;
+		}
+		else
+#endif
+		{
+			host = GetName();
+			iPort = port;
+		}
+
 		if (database.IsEmpty())
 		{
-			conn = new pgConn(GetName(), service, hostaddr, DEFAULT_PG_DATABASE, username, password, port, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+			conn = new pgConn(host, service, hostaddr, DEFAULT_PG_DATABASE, username, password, iPort, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
 			if (conn->GetStatus() == PGCONN_OK)
 				database = DEFAULT_PG_DATABASE;
 			else if (conn->GetStatus() == PGCONN_BAD && conn->GetLastError().Find(
 			             wxT("database \"") DEFAULT_PG_DATABASE wxT("\" does not exist")) >= 0)
 			{
 				delete conn;
-				conn = new pgConn(GetName(), service, hostaddr, wxT("template1"), username, password, port, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+				conn = new pgConn(host, service, hostaddr, wxT("template1"), username, password, iPort, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
 				if (conn && conn->GetStatus() == PGCONN_OK)
 					database = wxT("template1");
 			}
 		}
 		else
 		{
-			conn = new pgConn(GetName(), service, hostaddr, database, username, password, port, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
+			conn = new pgConn(host, service, hostaddr, database, username, password, iPort, rolename, ssl, 0, appearanceFactory->GetLongAppName() + _(" - Browser"), sslcert, sslkey, sslrootcert, sslcrl, sslcompression);
 			if (!conn)
 			{
 				form->EndMsg(false);
@@ -1008,7 +1130,7 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
 				properties->AppendItem(_("Port"), wxEmptyString);
 			else
 				properties->AppendItem(_("Port"), (long)GetPort());
-#ifdef SSL
+#ifdef PG_SSL
 			if (GetConnected())
 			{
 				properties->AppendItem(_("Encryption"),
@@ -1057,6 +1179,7 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
 		properties->AppendItem(_("Username"), GetUsername());
 		if (!GetRolename().IsEmpty())
 			properties->AppendItem(_("Default role"), GetRolename());
+
 		properties->AppendYesNoItem(_("Store password?"), GetStorePwd());
 		properties->AppendYesNoItem(_("Restore environment?"), GetRestore());
 		if (GetConnected())
@@ -1094,6 +1217,20 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
 
 		if (!GetDbRestriction().IsEmpty())
 			properties->AppendItem(_("DB restriction"), GetDbRestriction());
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		if(sshTunnel)
+		{
+			properties->AppendItem(_("SSH tunneling?"), (sshTunnel ? _("Yes") : _("No")));
+			properties->AppendItem(_("Tunnel host"), GetTunnelHost());
+			properties->AppendItem(_("Tunnel username"), GetTunnelUserName());
+			properties->AppendItem(_("Authentication mode"), (GetAuthModePwd() ? _("Password") : _("Identity file")));
+			if(!GetAuthModePwd())
+			{
+				properties->AppendItem(_("Identity file path"), GetIdentityFile());
+			}
+		}
+#endif
 	}
 
 	if(!GetConnected())
@@ -1105,6 +1242,49 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
 	}
 }
 
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+
+bool pgServer::createSSHTunnel()
+{
+	bool retVal = false;
+
+	tunnelObj = new CSSHTunnelThread(tunnelHost, GetName(), port, tunnelUserName, tunnelPassword, publicKeyFile,
+	                                 identityFile, authModePwd ? AUTH_PASSWORD : AUTH_PUBLICKEY);
+
+	if(tunnelObj)
+	{
+		if(tunnelObj->Initialize())
+		{
+			if ( tunnelObj->Create() != wxTHREAD_NO_ERROR )
+			{
+				delete tunnelObj;
+				tunnelObj = NULL;
+				wxLogError(_("SSH Error: Unable to create SSH Tunnling Thread"));
+			}
+			else
+			{
+				if (tunnelObj->Run() != wxTHREAD_NO_ERROR )
+				{
+					delete tunnelObj;
+					tunnelObj = NULL;
+					wxLogError(_("SSH Error: Unable to start SSH Tunnling Thread"));
+				}
+
+				SetLocalListenHost(tunnelObj->GetLocalListenIP());
+				SetLocalListenPort(tunnelObj->GetLocalListenPort());
+				retVal = true;
+			}
+		}
+		else
+		{
+			delete tunnelObj;
+			tunnelObj = NULL;
+		}
+	}
+
+	return retVal;
+}
+#endif
 
 void pgServer::ShowStatistics(frmMain *form, ctlListView *statistics)
 {
@@ -1216,7 +1396,6 @@ bool pgServer::AddNamedRestorePoint()
 	return false;
 }
 
-
 pgServerCollection::pgServerCollection(pgaFactory *factory)
 	: pgCollection(factory)
 {
@@ -1289,6 +1468,10 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 	wxString key, servername, hostaddr, description, service, database, username, lastDatabase, lastSchema;
 	wxString storePwd, rolename, restore, serviceID, discoveryID, dbRestriction, colour;
 	wxString group, sslcert, sslkey, sslrootcert, sslcrl, sslcompression;
+
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+	wxString sshTunnel, authModePwd, tunnelHost, tunnelUserName, tunnelPassword, publicKeyFile, identityFile;
+#endif
 	pgServer *server = 0;
 
 	wxArrayString discoveredServers;
@@ -1327,7 +1510,14 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 		settings->Read(key + wxT("SSLRootCert"), &sslrootcert, wxEmptyString);
 		settings->Read(key + wxT("SSLCrl"), &sslcrl, wxEmptyString);
 		settings->Read(key + wxT("SSLCompression"), &sslcompression, wxT("true"));
-
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		settings->Read(key + wxT("SSHTunnel"), &sshTunnel, wxT("false"));
+		settings->Read(key + wxT("TunnelHost"), &tunnelHost, wxEmptyString);
+		settings->Read(key + wxT("TunnelUserName"), &tunnelUserName, wxEmptyString);
+		settings->Read(key + wxT("TunnelModePwd"), &authModePwd, wxT("true"));
+		settings->Read(key + wxT("PublicKeyFile"), &publicKeyFile, wxEmptyString);
+		settings->Read(key + wxT("IdentityFile"), &identityFile, wxEmptyString);
+#endif
 		// Sanitize the colour
 		colour = colour.Trim();
 
@@ -1350,7 +1540,7 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 		}
 
 		// SSL mode
-#ifdef SSL
+#ifdef PG_SSL
 		settings->Read(key + wxT("SSL"), &ssl, 0);
 #endif
 
@@ -1361,7 +1551,13 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 		}
 
 		// Add the Server node
-		server = new pgServer(servername, hostaddr, description, service, database, username, port, StrToBool(storePwd), rolename, StrToBool(restore), ssl);
+#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
+		server = new pgServer(servername, hostaddr, description, service, database, username, port, StrToBool(storePwd), rolename, StrToBool(restore), ssl,
+		                      colour, group, StrToBool(sshTunnel), tunnelHost, tunnelUserName, StrToBool(authModePwd), tunnelPassword, publicKeyFile, identityFile);
+#else
+		server = new pgServer(servername, hostaddr, description, service, database, username, port, StrToBool(storePwd), rolename, StrToBool(restore), ssl,
+		                      colour, group);
+#endif
 		server->iSetLastDatabase(lastDatabase);
 		server->iSetLastSchema(lastSchema);
 		server->iSetService(service);
@@ -1369,8 +1565,6 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 		server->iSetDiscoveryID(discoveryID);
 		server->iSetDiscovered(false);
 		server->iSetDbRestriction(dbRestriction);
-		server->iSetColour(colour);
-		server->iSetGroup(group);
 		server->iSetServerIndex(loop);
 		server->SetSSLCert(sslcert);
 		server->SetSSLKey(sslkey);
@@ -1740,6 +1934,11 @@ wxWindow *addServerFactory::StartDialog(frmMain *form, pgObject *obj)
 
 				break;
 			}
+			case PGCONN_SSHTUNNEL_ERROR:
+			{
+				delete server;
+				break;
+			}
 			default:
 			{
 				wxLogInfo(__("pgServer object didn't initialise because the user aborted."));
diff --git a/pgadmin/ui/dlgServer.xrc b/pgadmin/ui/dlgServer.xrc
index c0bbd77..60f5ef5 100644
--- a/pgadmin/ui/dlgServer.xrc
+++ b/pgadmin/ui/dlgServer.xrc
@@ -257,6 +257,130 @@
             </object>
           </object>
           <object class="notebookpage">
+            <label>SSH Tunnel</label>
+            <object class="wxPanel" name="pnlSSH">
+              <object class="wxFlexGridSizer">
+                <cols>2</cols>
+                <vgap>5</vgap>
+                <hgap>5</hgap>
+                <growablecols>1</growablecols>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stSSHTunnel">
+                    <label>Use SSH tunneling</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxCheckBox" name="chkSSHTunnel">
+                    <label></label>
+                    <checked>0</checked>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stTunnelHost">
+                    <label>Tunnel host</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtTunnelHost"/>
+                  <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stTunnelUsername">
+                    <label>Username</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtTunnelUsername"/>
+                  <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stAuthentication">
+                    <label>Authentication</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFlexGridSizer">
+                    <cols>2</cols>
+                    <vgap>10</vgap>
+                    <hgap>10</hgap>
+                    <growablecols>1</growablecols>
+                    <object class="sizeritem">
+                      <object class="wxRadioButton" name="radioBtnPassword">
+                        <label>Password</label>
+                        <style>wxRB_GROUP</style>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL</flag>
+                    </object>
+                    <object class="sizeritem">
+                      <object class="wxRadioButton" name="radioBtnKeyfile">
+                        <label>Identity file</label>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL</flag>
+                    </object>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stIdentityFile">
+                    <label>Identity file</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFilePickerCtrl" name="pickerIdentityFile">
+                    <message>Select identity file</message>
+                    <wildcard>*</wildcard>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stPublicKeyFile">
+                    <label>Public key</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxFilePickerCtrl" name="pickerPublicKeyFile">
+                    <message>Select public key file</message>
+                    <wildcard>*.pub</wildcard>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticText" name="stTunnelPassword">
+                    <label>Password/Passphrase</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtTunnelPassword">
+                    <style>wxTE_PASSWORD</style>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+              </object>
+            </object>
+          </object>
+          <object class="notebookpage">
             <label>Advanced</label>
             <object class="wxPanel" name="pnlOptional">
               <object class="wxFlexGridSizer">
diff --git a/pgadmin/utils/module.mk b/pgadmin/utils/module.mk
index 3e09f0b..8820bf5 100644
--- a/pgadmin/utils/module.mk
+++ b/pgadmin/utils/module.mk
@@ -23,6 +23,11 @@ pgadmin3_SOURCES += \
 	utils/utffile.cpp \
 	utils/macros.cpp
 
+if BUILD_SSH_TUNNEL
+pgadmin3_SOURCES += \
+	utils/sshTunnel.cpp
+endif
+
 EXTRA_DIST += \
 	utils/module.mk \
 	utils/tab-complete.inc \
diff --git a/pgadmin/utils/sshTunnel.cpp b/pgadmin/utils/sshTunnel.cpp
new file mode 100644
index 0000000..ca32bd1
--- /dev/null
+++ b/pgadmin/utils/sshTunnel.cpp
@@ -0,0 +1,560 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+//
+// Copyright (C) 2002 - 2013, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// sshTunnel.cpp - Used to create SSH Tunnels
+//
+//////////////////////////////////////////////////////////////////////////
+
+// App headers
+#include "pgAdmin3.h"
+#include <wx/dynlib.h>
+
+#undef ssize_t
+#define ssize_t long
+#include "libssh2/libssh2.h"
+#include "utils/sshTunnel.h"
+#include "frm/frmMain.h"
+
+#pragma comment (lib, "Ws2_32.lib")
+
+typedef const char *(*inet_ntop_t) (int af, const void *src, char *dst, socklen_t size);
+
+#ifdef WIN32
+const char *custom_inet_ntop(int af, const void *src, char *dst, int cnt)
+{
+	struct sockaddr_in srcaddr;
+
+	memset(&srcaddr, 0, sizeof(struct sockaddr_in));
+	memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));
+
+	srcaddr.sin_family = af;
+	if (WSAAddressToStringA((struct sockaddr *) &srcaddr, sizeof(struct sockaddr_in), 0, dst, (LPDWORD) &cnt) != 0)
+	{
+
+		wxLogInfo(wxT("SSH error: WSAAddressToStringA failed with error code %d"), WSAGetLastError());
+		return NULL;
+	}
+	return dst;
+}
+
+static inet_ntop_t gs_fnPtr_inet_ntop = &custom_inet_ntop;
+#else
+static inet_ntop_t gs_fnPtr_inet_ntop = &inet_ntop;
+#endif
+
+char CSSHTunnelThread::m_keyboard_interactive_pwd[SSH_MAX_PASSWORD_LEN];
+
+CSSHTunnelThread::CSSHTunnelThread(const wxString tunnelhost, const wxString remote_desthost, const unsigned int remote_destport,
+                                   const wxString username, const wxString password, const wxString publickey, const wxString privatekey,
+                                   const enAuthenticationMethod &enAuthMethod)
+	: m_tunnelhost(tunnelhost), m_remote_desthost(remote_desthost), m_remote_destport(remote_destport), m_username(username),
+	  m_password(password), m_publickey(publickey), m_privatekey(privatekey), m_enAuthMethod(enAuthMethod)
+{
+	m_local_listenip = wxEmptyString;
+	m_local_listenport = 0;
+	m_listensock = -1, m_sock = -1;
+	m_session = NULL;
+
+	memset(m_keyboard_interactive_pwd, 0 , strlen(m_keyboard_interactive_pwd));
+	strncpy(m_keyboard_interactive_pwd, (const char *)password.mb_str(wxConvUTF8), password.Length());
+}
+
+CSSHTunnelThread::~CSSHTunnelThread(void)
+{
+}
+
+bool CSSHTunnelThread::Initialize()
+{
+	int rc, auth = AUTH_NONE;
+	const char *fingerprint;
+	char *userauthlist;
+
+#ifdef WIN32
+	char sockopt;
+	WSADATA wsadata;
+	int err;
+
+	err = WSAStartup(MAKEWORD(2, 0), &wsadata);
+	if(err != 0)
+	{
+		wxLogInfo(wxT("WSAStartup failed with error: %d"), err);
+		return false;
+	}
+#else
+	int sockopt;
+#endif
+
+	wxArrayString arrTunnelHostIP;
+
+	if (resolveDNS(m_tunnelhost.mb_str(), arrTunnelHostIP))
+	{
+		rc = libssh2_init (0);
+
+		if (rc != 0)
+		{
+			LogSSHTunnelErrors(wxString::Format(_("libssh2 initialization failed with error code %d"), rc), GetId());
+			return false;
+		}
+
+		/* Connect to SSH server */
+		m_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+		m_sin.sin_family = AF_INET;
+		if (INADDR_NONE == (m_sin.sin_addr.s_addr = inet_addr(arrTunnelHostIP.Item(0).mb_str())))
+		{
+			LogSSHTunnelErrors(wxString::Format(_("SSH error: Error in inet address with error code %d"), wxSysErrorCode()), GetId());
+			return false;
+		}
+		m_sin.sin_port = htons(22);
+		if (connect(m_sock, (struct sockaddr *)(&m_sin),
+		            sizeof(struct sockaddr_in)) != 0)
+		{
+			LogSSHTunnelErrors(wxString::Format(_("SSH error: Could not connect to socket with error code %d"), wxSysErrorCode()), GetId());
+			return false;
+		}
+
+		/* Create a session instance */
+		m_session = libssh2_session_init();
+
+		if (!m_session)
+		{
+			LogSSHTunnelErrors(_("SSH error: Could not initialize SSH session!"), GetId());
+			return false;
+		}
+
+		/* ... start it up. This will trade welcome banners, exchange keys,
+		* and setup crypto, compression, and MAC layers
+		*/
+		rc = libssh2_session_handshake(m_session, m_sock);
+		if (rc)
+		{
+			LogSSHTunnelErrors(wxString::Format(_("SSH error: Error when starting up SSH session with error code %d"), rc), GetId());
+			return false;
+		}
+
+		/* At this point we havn't yet authenticated.  The first thing to do
+		* is check the hostkey's fingerprint against our known hosts Your app
+		* may have it hard coded, may go to a file, may present it to the
+		* user, that's your call
+		*/
+		fingerprint = libssh2_hostkey_hash(m_session, LIBSSH2_HOSTKEY_HASH_SHA1);
+
+		/* check what authentication methods are available */
+		userauthlist = libssh2_userauth_list(m_session, m_username.mb_str(), strlen(m_username.mb_str()));
+
+		if (strstr(userauthlist, "password"))
+			auth |= AUTH_PASSWORD;
+		if(strstr(userauthlist, "keyboard-interactive"))
+			auth |= AUTH_KEYBOARD_INTERACTIVE;
+		if (strstr(userauthlist, "publickey"))
+			auth |= AUTH_PUBLICKEY;
+
+		if ((auth & AUTH_PASSWORD) && (m_enAuthMethod == AUTH_PASSWORD))
+			auth = AUTH_PASSWORD;
+		else if ((auth & AUTH_KEYBOARD_INTERACTIVE) && (m_enAuthMethod == AUTH_PASSWORD))
+			auth = AUTH_KEYBOARD_INTERACTIVE;
+		if ((auth & AUTH_PUBLICKEY) && (m_enAuthMethod == AUTH_PUBLICKEY))
+			auth = AUTH_PUBLICKEY;
+
+		if (auth & AUTH_PASSWORD)
+		{
+			rc = libssh2_userauth_password(m_session, m_username.mb_str(), m_password.mb_str());
+			if (rc)
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: Authentication by password failed with error code %d"), rc), GetId());
+				Cleanup();
+				return false;
+			}
+		}
+		else if (auth & AUTH_KEYBOARD_INTERACTIVE)
+		{
+			rc = libssh2_userauth_keyboard_interactive(m_session, m_username.mb_str(), &CSSHTunnelThread::keyboard_interactive);
+			if (rc)
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: Authentication by password failed with error code %d"), rc), GetId());
+				Cleanup();
+				return false;
+			}
+		}
+		else if (auth & AUTH_PUBLICKEY)
+		{
+#ifdef HAVE_GCRYPT
+			rc = libssh2_userauth_publickey_fromfile(m_session, m_username.mb_str(), m_publickey.mb_str(), m_privatekey.mb_str(), m_password.mb_str());
+#else
+			rc = libssh2_userauth_publickey_fromfile(m_session, m_username.mb_str(), NULL, m_privatekey.mb_str(), m_password.mb_str());
+#endif
+			if (rc)
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: Authentication by identity file failed with error code %d"), rc), GetId());
+				Cleanup();
+				return false;
+			}
+		}
+		else
+		{
+			LogSSHTunnelErrors(_("SSH error: No supported authentication methods found!"), GetId());
+			Cleanup();
+			return false;
+		}
+
+		//Get the IP Address of local machine
+		wxArrayString arrLocalIP;
+		if(resolveDNS("localhost", arrLocalIP))
+		{
+			m_listensock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+			memset(&m_sin, 0 , sizeof(m_sin));
+			m_sin.sin_family = AF_INET;
+
+			// Give port no to 0 so that bind will automatically select the available port.
+			m_sin.sin_port = htons(0);
+			if (INADDR_NONE == (m_sin.sin_addr.s_addr = inet_addr(arrLocalIP.Item(0).mb_str())))
+			{
+				Cleanup();
+				return false;
+			}
+
+			sockopt = 1;
+			setsockopt(m_listensock, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(sockopt));
+			m_sinlen = sizeof(m_sin);
+			if (-1 == bind(m_listensock, (struct sockaddr *)&m_sin, m_sinlen))
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: bind failed with error code %d"), wxSysErrorCode()), GetId());
+				Cleanup();
+				return false;
+			}
+
+			if (getsockname(m_listensock, (struct sockaddr *)&m_sin, &m_sinlen) == -1)
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: getsockname() failed with error code %d"), wxSysErrorCode()), GetId());
+				Cleanup();
+				return false;
+			}
+
+			if (-1 == listen(m_listensock, 2))
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: listen failed with error code %d"), wxSysErrorCode()), GetId());
+				Cleanup();
+				return false;
+			}
+
+			m_local_listenip = wxString(inet_ntoa(m_sin.sin_addr), wxConvLibc);
+			m_local_listenport = ntohs(m_sin.sin_port);
+
+			wxLogInfo(wxT("Waiting for TCP connection on %s:%d..."), m_local_listenip.c_str(), m_local_listenport);
+			return true;
+		}
+		else
+		{
+			LogSSHTunnelErrors(_("SSH error: Unable to resolve localhost"), GetId());
+		}
+	}
+	else
+	{
+		LogSSHTunnelErrors(wxString::Format(_("SSH error: Unable to resolve host: %s"), m_tunnelhost.c_str()), GetId());
+	}
+
+	return false;
+}
+
+void *CSSHTunnelThread::Entry()
+{
+	while (1)
+	{
+		int forwardsock = accept(m_listensock, (struct sockaddr *) & m_sin, &m_sinlen);
+		if (-1 == forwardsock)
+		{
+#ifdef WIN32
+			if(wxSysErrorCode() != WSAEINTR && wxSysErrorCode() != WSAEBADF)
+#else
+			if(wxSysErrorCode() != EINTR && wxSysErrorCode() != EBADF && wxSysErrorCode() != ECONNABORTED)
+#endif
+			{
+				LogSSHTunnelErrors(wxString::Format(_("SSH error: accept failed with error code %d"), wxSysErrorCode()), GetId());
+				Cleanup();
+			}
+			break;
+		}
+		// Create thread for read/write.
+		CSubThread *subThread = new CSubThread(m_sin, m_remote_desthost, m_remote_destport, m_session, forwardsock);
+		if ( subThread->Create() != wxTHREAD_NO_ERROR )
+		{
+			delete subThread;
+			subThread = NULL;
+		}
+		else
+		{
+			if (subThread->Run() != wxTHREAD_NO_ERROR )
+			{
+				delete subThread;
+				subThread = NULL;
+			}
+			else
+			{
+				g_SSHThreadMutex.Lock();
+				g_setSocketDescriptor.insert(forwardsock);
+				g_SSHThreadMutex.Unlock();
+			}
+		}
+	}
+
+	return NULL;
+}
+
+void CSSHTunnelThread::Cleanup()
+{
+	// Close all the sockets
+	g_SSHThreadMutex.Lock();
+	subThreadSDSet::iterator it;
+	for( it = g_setSocketDescriptor.begin(); it != g_setSocketDescriptor.end(); ++it )
+	{
+		int socketDescriptor = *it;
+#ifdef WIN32
+		closesocket(socketDescriptor);
+#else
+		close(socketDescriptor);
+#endif
+	}
+	g_SSHThreadMutex.Unlock();
+
+	Sleep(1000);
+
+	if(m_session)
+	{
+		libssh2_session_disconnect(m_session, "Client disconnecting normally");
+		libssh2_session_free(m_session);
+		m_session = NULL;
+	}
+
+	if (m_listensock)
+	{
+#ifdef WIN32
+		closesocket(m_listensock);
+#else
+		close(m_listensock);
+#endif
+		m_listensock = 0;
+	}
+
+	if (m_sock)
+	{
+#ifdef WIN32
+		closesocket(m_sock);
+#else
+		close(m_sock);
+#endif
+		m_sock = 0;
+	}
+
+	libssh2_exit();
+}
+
+bool CSSHTunnelThread::resolveDNS(const char *host, wxArrayString &arrIPAddress)
+{
+	struct addrinfo hints, *res, *p;
+	int status;
+	char ipstr[INET6_ADDRSTRLEN];
+
+	memset(&hints, 0, sizeof hints);
+	memset(&ipstr, 0, sizeof ipstr);
+	hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
+
+	if ((status = getaddrinfo(host, NULL, &hints, &res)) != 0)
+	{
+		wxLogInfo(wxT("getaddrinfo failed with error code: %d"), status);
+		return false;
+	}
+
+	for(p = res; p != NULL; p = p->ai_next)
+	{
+		void *addr;
+		if (p->ai_family == AF_INET)
+		{
+			struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
+			addr = &(ipv4->sin_addr);
+
+			/* convert the IP to a string*/
+			if(NULL != gs_fnPtr_inet_ntop(p->ai_family, addr, ipstr, sizeof ipstr))
+				arrIPAddress.Add(wxString(ipstr, wxConvLocal));
+		}
+	}
+
+	if(res)
+	{
+		freeaddrinfo(res); // free the linked list
+	}
+
+	if(arrIPAddress.Count() > 0)
+	{
+		return true;
+	}
+
+	return false;
+}
+
+void CSSHTunnelThread::keyboard_interactive(const char *name, int name_len, const char *instr, int instr_len,
+        int num_prompts,  const struct _LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE *res,
+        void **abstract)
+{
+	if (num_prompts == 1)
+	{
+		res[0].text = strdup(m_keyboard_interactive_pwd);
+		res[0].length = strlen(m_keyboard_interactive_pwd);
+	}
+}
+
+CSubThread::CSubThread(const struct sockaddr_in sin, const wxString remote_desthost, const unsigned int remote_destport,
+                       LIBSSH2_SESSION *session, int forwardsock)
+	: m_sin(sin), m_remote_desthost(remote_desthost), m_remote_destport(remote_destport),
+	  m_subThreadSession(session), m_forwardsock(forwardsock)
+{
+}
+
+CSubThread::~CSubThread(void)
+{
+	g_SSHThreadMutex.Lock();
+	g_setSocketDescriptor.erase(m_forwardsock);
+	g_SSHThreadMutex.Unlock();
+}
+
+void *
+CSubThread::Entry()
+{
+	fd_set fds;
+	struct timeval tv;
+	ssize_t len, wr;
+	char buf[20480];
+	int rc, i = 0;
+
+	const char *shost = inet_ntoa(m_sin.sin_addr);
+	unsigned int sport = ntohs(m_sin.sin_port);
+
+	wxLogInfo(wxT("Forwarding connection from %s:%d to %s:%d"), wxString(inet_ntoa(m_sin.sin_addr), wxConvLibc).c_str(),
+	          sport, m_remote_desthost.c_str(), m_remote_destport);
+
+	/* Must use blocking here to avoid connect errors */
+	//libssh2_session_set_blocking(m_subThreadSession, 1);
+
+	while((m_channel = libssh2_channel_direct_tcpip_ex(m_subThreadSession, m_remote_desthost.mb_str(),
+	                   m_remote_destport, shost, sport)) == NULL)
+	{
+		rc = libssh2_session_last_error(m_subThreadSession, NULL, NULL, 0);
+		if (rc == LIBSSH2_ERROR_EAGAIN)
+			Sleep(10);
+		else
+			break;
+	}
+
+	/* Must use non-blocking IO hereafter due to the current libssh2 API */
+	libssh2_session_set_blocking(m_subThreadSession, 0);
+
+	if (!m_channel)
+	{
+		wxLogInfo(_("SSH error: Could not open a direct-tcpip channel!"));
+		goto shutdown;
+	}
+
+	while (1)
+	{
+		FD_ZERO(&fds);
+		FD_SET(m_forwardsock, &fds);
+		tv.tv_sec = 0;
+		tv.tv_usec = 100000;
+		rc = select(m_forwardsock + 1, &fds, NULL, NULL, &tv);
+		memset(buf, 0, sizeof(buf));
+		if (-1 == rc)
+		{
+			wxLogInfo(_("SSH error: select failed with error code %d"), wxSysErrorCode());
+			goto shutdown;
+		}
+		if (rc && FD_ISSET(m_forwardsock, &fds))
+		{
+			len = recv(m_forwardsock, buf, sizeof(buf), 0);
+			if (len < 0)
+			{
+				wxLogInfo(_("SSH error: read failed with error code %d"), wxSysErrorCode());
+				goto shutdown;
+			}
+			else if (0 == len)
+			{
+				wxLogInfo(_("The client at %s:%d disconnected!"), wxString(inet_ntoa(m_sin.sin_addr), wxConvLibc).c_str(), sport);
+				goto shutdown;
+			}
+			wr = 0;
+			do
+			{
+				i = libssh2_channel_write(m_channel, buf, len);
+
+				if (i < 0)
+				{
+					wxLogInfo(_("SSH error: libssh2_channel_write with error code %d"), i);
+					goto shutdown;
+				}
+				wr += i;
+			}
+			while (i > 0 && wr < len);
+		}
+		while (1)
+		{
+			len = libssh2_channel_read(m_channel, buf, sizeof(buf));
+
+			if (LIBSSH2_ERROR_EAGAIN == len)
+				break;
+			else if (len < 0)
+			{
+				wxLogInfo(_("SSH error: libssh2_channel_read with error code %d"), (int)len);
+				goto shutdown;
+			}
+			wr = 0;
+			while (wr < len)
+			{
+				i = send(m_forwardsock, buf + wr, len - wr, 0);
+				if (i <= 0)
+				{
+					wxLogInfo(_("SSH error: write failed with error code %d"), wxSysErrorCode());
+					goto shutdown;
+				}
+				wr += i;
+			}
+			if (libssh2_channel_eof(m_channel))
+			{
+				wxLogInfo(_("Connection at %s:%d disconnected by server"),
+				          wxString(inet_ntoa(m_sin.sin_addr), wxConvLibc).c_str(), sport);
+				goto shutdown;
+			}
+		}
+	}
+shutdown:
+#ifdef WIN32
+	closesocket(m_forwardsock);
+#else
+	close(m_forwardsock);
+#endif
+
+	if (m_channel)
+	{
+		libssh2_channel_close(m_channel);
+		libssh2_channel_free(m_channel);
+		m_channel = NULL;
+	}
+
+	return NULL;
+}
+
+void LogSSHTunnelErrors(const wxString &msg, const int &id)
+{
+	g_SSHThreadMutex.TryLock();
+
+	wxCommandEvent event(SSH_TUNNEL_ERROR_EVENT, id);
+	// Give it some contents
+	event.SetString(msg);
+
+	// Do send it
+	wxPostEvent(winMain, event);
+
+	g_SSHThreadMutex.Unlock();
+}
