diff -aruN libssh2-1.1-orig\include\libssh2.h libssh2-1.1\include\libssh2.h
--- libssh2-1.1-orig\include\libssh2.h	Thu Apr 02 09:49:51 2009
+++ libssh2-1.1\include\libssh2.h	Fri May 29 18:04:55 2009
@@ -58,6 +58,9 @@
 #  endif /* LIBSSH2_LIBRARY */
 # else /* !LIBSSH2_WIN32 */
 #  define LIBSSH2_API
+#  ifndef WINAPI
+#   define WINAPI
+#  endif
 # endif /* LIBSSH2_WIN32 */
 #endif /* LIBSSH2_API */
 
@@ -159,10 +159,13 @@
 #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, \
+#define LIBSSH2_ALLOC_FUNC(name)		LIBSSH2_Alloc_Func name
+#define LIBSSH2_REALLOC_FUNC(name)		LIBSSH2_ReAlloc_Func name
+#define LIBSSH2_FREE_FUNC(name)			LIBSSH2_Free_Func name
+#define LIBSSH2_ALLOC_FUNC_DECL(name)   void * WINAPI name(size_t count, void **abstract)
+#define LIBSSH2_REALLOC_FUNC_DECL(name) void * WINAPI name(void *ptr, size_t count, \
                                               void **abstract)
-#define LIBSSH2_FREE_FUNC(name)    void name(void *ptr, void **abstract)
+#define LIBSSH2_FREE_FUNC_DECL(name)    void WINAPI name(void *ptr, void **abstract)
 
 typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT
 {
@@ -178,41 +181,17 @@
 } LIBSSH2_USERAUTH_KBDINT_RESPONSE;
 
 /* '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)
+#define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name)	LIBSSH2_Userauth_KbdInt_Response_Func name
 
 /* 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, \
+#define LIBSSH2_IGNORE_FUNC(name)				LIBSSH2_Ignore_Func name
+#define LIBSSH2_DEBUG_FUNC(name)				LIBSSH2_Debug_Func name
+#define LIBSSH2_DISCONNECT_FUNC(name)			LIBSSH2_Disconnect_Func name
+#define LIBSSH2_PASSWD_CHANGEREQ_FUNC(name)		LIBSSH2_Password_ChangeReq_Func name
+#define LIBSSH2_MACERROR_FUNC(name)				LIBSSH2_Macerror_Func name
+#define LIBSSH2_X11_OPEN_FUNC(name)				LIBSSH2_X11_Open_Func name
+#define LIBSSH2_CHANNEL_CLOSE_FUNC(name)		LIBSSH2_Channel_Close_Func name
+#define LIBSSH2_CHANNEL_CLOSE_FUNC_DECL(name)	void WINAPI name(LIBSSH2_SESSION *session, void **session_abstract, \
             LIBSSH2_CHANNEL *channel, void **channel_abstract)
 
 /* libssh2_session_callback_set() constants */
@@ -349,11 +328,38 @@
 #define LIBSSH2_ERROR_PUBLICKEY_PROTOCOL        -36
 #define LIBSSH2_ERROR_EAGAIN                    -37
 
+/* Supporting typedef's for callback functions */
+typedef void * WINAPI LIBSSH2_Alloc_Func(size_t count, void **abstract);
+typedef void * WINAPI LIBSSH2_ReAlloc_Func(void *ptr, size_t count, void **abstract);
+typedef void WINAPI LIBSSH2_Free_Func(void *ptr, void **abstract);
+
+typedef void WINAPI LIBSSH2_Userauth_KbdInt_Response_Func(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);
+
+typedef void WINAPI LIBSSH2_Ignore_Func(LIBSSH2_SESSION *session, const char *message, int message_len, \
+           void **abstract);
+typedef void WINAPI LIBSSH2_Debug_Func(LIBSSH2_SESSION *session, int always_display, const char *message, \
+           int message_len, const char *language, int language_len, \
+           void **abstract);
+typedef void WINAPI LIBSSH2_Disconnect_Func(LIBSSH2_SESSION *session, int reason, const char *message, \
+           int message_len, const char *language, int language_len, \
+           void **abstract);
+typedef void WINAPI LIBSSH2_Password_ChangeReq_Func(LIBSSH2_SESSION *session, char **newpw, int *newpw_len, \
+           void **abstract);
+typedef int WINAPI LIBSSH2_Macerror_Func(LIBSSH2_SESSION *session, const char *packet, int packet_len, \
+          void **abstract);
+typedef void WINAPI LIBSSH2_X11_Open_Func(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel, \
+           const char *shost, int sport, void **abstract);
+typedef void WINAPI LIBSSH2_Channel_Close_Func(LIBSSH2_SESSION *session, void **session_abstract, \
+            LIBSSH2_CHANNEL *channel, void **channel_abstract);
+
 /* 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);
+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);
diff -aruN libssh2-1.1-orig\src\session.c libssh2-1.1\src\session.c
--- libssh2-1.1-orig\src\session.c	Fri Mar 27 21:18:24 2009
+++ libssh2-1.1\src\session.c	Fri May 29 17:38:56 2009
@@ -56,7 +56,7 @@
 /* libssh2_default_alloc
  */
 static
-LIBSSH2_ALLOC_FUNC(libssh2_default_alloc)
+LIBSSH2_ALLOC_FUNC_DECL(libssh2_default_alloc)
 {
     (void) abstract;
     return malloc(count);
@@ -65,7 +65,7 @@
 /* libssh2_default_free
  */
 static
-LIBSSH2_FREE_FUNC(libssh2_default_free)
+LIBSSH2_FREE_FUNC_DECL(libssh2_default_free)
 {
     (void) abstract;
     free(ptr);
@@ -74,7 +74,7 @@
 /* libssh2_default_realloc
  */
 static
-LIBSSH2_REALLOC_FUNC(libssh2_default_realloc)
+LIBSSH2_REALLOC_FUNC_DECL(libssh2_default_realloc)
 {
     (void) abstract;
     return realloc(ptr, count);
diff -aruN libssh2-1.1-orig\src\sftp.c libssh2-1.1\src\sftp.c
--- libssh2-1.1-orig\src\sftp.c	Sun Mar 29 22:54:50 2009
+++ libssh2-1.1\src\sftp.c	Fri May 29 18:25:48 2009
@@ -93,17 +93,17 @@
 static void
 _libssh2_htonu64(unsigned char *buf, libssh2_uint64_t value)
 {
-    unsigned long msl = ((libssh2_uint64_t)value >> 32);
+    unsigned long msl = (unsigned long)((libssh2_uint64_t)value >> 32);
 
-    buf[0] = (msl >> 24) & 0xFF;
-    buf[1] = (msl >> 16) & 0xFF;
-    buf[2] = (msl >> 8) & 0xFF;
-    buf[3] = msl & 0xFF;
-
-    buf[4] = (value >> 24) & 0xFF;
-    buf[5] = (value >> 16) & 0xFF;
-    buf[6] = (value >> 8) & 0xFF;
-    buf[7] = value & 0xFF;
+    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;
 }
 
 /*
@@ -509,12 +509,10 @@
    * 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_CHANNEL_CLOSE_FUNC_DECL(libssh2_sftp_dtor)
 {
     LIBSSH2_SFTP *sftp = (LIBSSH2_SFTP *) (*channel_abstract);
 
diff -aruN libssh2-1.1-orig\win32\config.mk libssh2-1.1\win32\config.mk
--- libssh2-1.1-orig\win32\config.mk	Sun Jul 15 22:09:00 2007
+++ libssh2-1.1\win32\config.mk	Thu May 28 17:15:51 2009
@@ -1,7 +1,7 @@
 
 # Tweak these for your system
-OPENSSLINC=..\openssl-0.9.8e\inc32
-OPENSSLLIB=..\openssl-0.9.8e\out32dll
+OPENSSLINC=..\openssl-0.9.8k\inc32
+OPENSSLLIB=..\openssl-0.9.8k\out32dll
 
 ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\zlib-1.2.3
 ZLIBLIB=..\zlib-1.2.3
 
diff -aru libssh2-1.1-orig\win32\libssh2_dll.dsp libssh2-1.1\win32\libssh2_dll.dsp
--- libssh2-1.1-orig\win32\libssh2_dll.dsp	Mon Sep 24 21:43:43 2007
+++ libssh2-1.1\win32\libssh2_dll.dsp	Mon Jun 08 14:11:27 2009
@@ -7,19 +7,19 @@
 CFG=libssh2_dll - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE 
 !MESSAGE NMAKE /f "libssh2_dll.mak".
-!MESSAGE
+!MESSAGE 
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE 
 !MESSAGE NMAKE /f "libssh2_dll.mak" CFG="libssh2_dll - Win32 Debug"
-!MESSAGE
+!MESSAGE 
 !MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE 
 !MESSAGE "libssh2_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
 !MESSAGE "libssh2_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
+!MESSAGE 
 
 # Begin Project
 # PROP AllowPerConfigDependencies 0
@@ -40,10 +40,10 @@
 # PROP Use_Debug_Libraries 0
 # PROP Output_Dir "Release_dll"
 # PROP Intermediate_Dir "Release_dll"
-# PROP Ignore_Export_Lib 0
+# PROP Ignore_Export_Lib 1
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /I "..\..\openssl-0.9.8k\inc32" /I "..\..\zlib-1.2.3" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -54,7 +54,8 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /map /debug /machine:I386 /out:"Release_dll/libssh2.dll"
+# ADD LINK32 libeay32.lib ssleay32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib ..\..\zlib-1.2.3\zlib.lib /nologo /version:1.1 /dll /pdb:none /machine:I386 /out:"Release_dll/libssh2.dll" /libpath:"..\..\openssl-0.9.8k\out32"
+# SUBTRACT LINK32 /debug
 
 !ELSEIF  "$(CFG)" == "libssh2_dll - Win32 Debug"
 
@@ -67,11 +68,11 @@
 # PROP Use_Debug_Libraries 1
 # PROP Output_Dir "Debug_dll"
 # PROP Intermediate_Dir "Debug_dll"
-# PROP Ignore_Export_Lib 0
+# PROP Ignore_Export_Lib 1
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# SUBTRACT CPP /WX /YX
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /I "..\..\openssl-0.9.8k\inc32" /I "..\..\zlib-1.2.3" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /FD /GZ /c
+# SUBTRACT CPP /WX /Fr /YX
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -81,10 +82,10 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug_dll/libssh2.dll" /pdbtype:sept
-# SUBTRACT LINK32 /nodefaultlib
+# ADD LINK32 libeay32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib ..\..\zlib-1.2.3\zlib.lib /nologo /version:1.1 /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"Debug_dll/libssh2.dll" /libpath:"..\..\openssl-0.9.8k\out32dll.dbg"
+# SUBTRACT LINK32 /pdb:none /nodefaultlib
 
-!ENDIF
+!ENDIF 
 
 # Begin Target
 
@@ -171,7 +198,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\include\libssh2_priv.h
+SOURCE=..\src\libssh2_priv.h
 # End Source File
 # Begin Source File
 
@@ -180,5 +207,3 @@
 # End Group
 # End Target
 # End Project
-
-
diff -aruN libssh2-1.1-orig\win32\libssh2_lib.dsp libssh2-1.1\win32\libssh2_lib.dsp
--- libssh2-1.1-orig\win32\libssh2_lib.dsp	Mon Sep 24 21:43:43 2007
+++ libssh2-1.1\win32\libssh2_lib.dsp	Fri May 29 15:49:22 2009
@@ -7,19 +7,19 @@
 CFG=libssh2_lib - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE 
 !MESSAGE NMAKE /f "libssh2_lib.mak".
-!MESSAGE
+!MESSAGE 
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE 
 !MESSAGE NMAKE /f "libssh2_lib.mak" CFG="libssh2_lib - Win32 Debug"
-!MESSAGE
+!MESSAGE 
 !MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE 
 !MESSAGE "libssh2_lib - Win32 Release" (based on "Win32 (x86) Static Library")
 !MESSAGE "libssh2_lib - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
+!MESSAGE 
 
 # Begin Project
 # PROP AllowPerConfigDependencies 0
@@ -49,7 +49,6 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
 # ADD LIB32 /nologo /out:"Release_lib\libssh.lib"
 
 !ELSEIF  "$(CFG)" == "libssh2_lib - Win32 Debug"
@@ -75,7 +74,7 @@
 # ADD BASE LIB32 /nologo
 # ADD LIB32 /nologo /out:"Debug_lib\libssh2d.lib"
 
-!ENDIF
+!ENDIF 
 
 # Begin Target
 
@@ -162,7 +161,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\include\libssh2_priv.h
+SOURCE=..\src\libssh2_priv.h
 # End Source File
 # Begin Source File
 
@@ -171,5 +170,3 @@
 # End Group
 # End Target
 # End Project
-
-

