Index: AutoBuild.h
===================================================================
--- AutoBuild.h	(revision 1fc246c9f5796420ed34e179136a17c104adcaf7)
+++ AutoBuild.h	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -3,8 +3,8 @@
 // change the FALSE to TRUE for autoincrement of build number
 #define INCREMENT_VERSION TRUE
-#define FILEVER        0,3,7,347
-#define PRODUCTVER     0,3,7,347
-#define STRFILEVER     _T("0.3.7.347")
-#define STRPRODUCTVER  _T("0.3.7.347")
-#define STRPRODUCTDATE  _T("2009-09-20")
+#define FILEVER        0,3,7,422
+#define PRODUCTVER     0,3,7,422
+#define STRFILEVER     _T("0.3.7.422")
+#define STRPRODUCTVER  _T("0.3.7.422")
+#define STRPRODUCTDATE  _T("2009-10-04")
 #endif // AUTOBUILD_H
Index: Jamroot
===================================================================
--- Jamroot	(revision 1fc246c9f5796420ed34e179136a17c104adcaf7)
+++ Jamroot	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -208,6 +208,6 @@
 		all-modules = $(result) ;
 	}
-	for local l in $(all-modules)
-	{
+	all-modules-text = "" ;
+	for local l in $(all-modules) {
 		alias $(l) 
 			: # sources
@@ -218,29 +218,23 @@
 			<dependency>$(target)
 			;
-		echo "Adding module: $(l)" ;
 		explicit $(l) ;
-	}
-	for local l in $(all-scripts)
+		all-modules-text = "$(all-modules-text) $(l)" ;
+	}
+	echo "Building modules: $(all-modules-text)" ;
+	for local l in $(all-scripts) {
+		all-scripts-lst = $(all-scripts-lst) scripts/$(l) ;
+	}
+} else {
+	all-installers =
+		[ MATCH .*helpers/(.*)/.* : [ glob helpers/*installer/Jamfile ] ]
+		;
+	all-installers-text = "" ;
+	for local l in $(all-installers)
 	{
-		#make scripts-$(l) : scripts/$(l) : common.copy ;
-		#explicit scripts/$(l) ;
-
-		#alias scripts-$(l) : scripts/$(l) ;
-		#explicit scripts-$(l) ;
-
-		all-scripts-lst = $(all-scripts-lst) scripts/$(l) ;
-
-		echo "Adding script: $(l)" ;
-	}
-}
-
-all-installers =
-    [ MATCH .*helpers/(.*)/.* : [ glob helpers/*installer/Jamfile ] ]
-    ;
-for local l in $(all-installers)
-{
-	alias $(l) : helpers/$(l) ;
-	echo "Adding installer target for: $(l)" ;
-	explicit $(l) ;
+		alias $(l) : helpers/$(l) ;
+		explicit $(l) ;
+		all-installers-text = "$(all-installers-text) $(l)" ;
+	}
+	echo "Building installers: $(all-installers-text)" ;
 }
 
@@ -280,10 +274,18 @@
 rule get-root-prefix ( properties * )
 {
+	tag = "UNKNOWN" ;
     if <architecture>ia64 in $(properties) { 
-		return IA64 ; 
+		tag = "IA64" ;
 	} else { 
-		if <address-model>64 in $(properties) { return x64 ; }
-		else { return Win32 ; }
-	}
+		if <address-model>64 in $(properties) { 
+			tag = "x64" ; 
+		} else { 
+			tag = "Win32" ; 
+		}
+	}
+    if <variant>debug in $(properties) {
+		tag = "$(tag)-debug" ;
+	}
+	return $(tag) ;
 }
 rule generate-binary-location ( properties * )
@@ -327,8 +329,9 @@
 explicit build-archives ;
 
-
 alias build-installer : all-installer-targets : <location>$(BOOST_STAGE_LOCATE)/installer ;
 explicit build-installer ;
 
-
-
+alias source-archive : helpers/build-source : <location>$(BOOST_STAGE_LOCATE)/archive ;
+explicit source-archive ;
+
+
Index: NSClient++.cpp
===================================================================
--- NSClient++.cpp	(revision 308b6f579f55e2e664da3dffbbf08b23c66a3e9f)
+++ NSClient++.cpp	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -25,4 +25,7 @@
 #include <remote_processes.hpp>
 #include <Lmcons.h>
+//#ifdef DEBUG
+#include <assert.h>
+//#endif
 
 NSClient mainClient(SZSERVICENAME);	// Global core instance.
@@ -451,4 +454,8 @@
 					std::wcout << _T("Reattaching to session 0") << std::endl;
 					mainClient.startTrayIcon(0);
+//#ifdef DEBUG
+				} else if (s == _T("assert")) {
+					assert(false);
+//#endif
 				} else if (std::cin.peek() < 15) {
 					buff += s;
Index: bjam/zip.jam
===================================================================
--- bjam/zip.jam	(revision 1d53fe0e6d8e9f90d3971dd0414b92307ebeed5d)
+++ bjam/zip.jam	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -5,11 +5,15 @@
 
 feature source-folder : : path free ;
+feature exclude : : free ;
+feature recursive : off on : propagated ;
 
 type.register ZIP : zip ;
 generators.register-composing bjam/zip.make-zip : : ZIP ;
 flags bjam/zip.make-zip SOURCE_FOLDER <source-folder> ;
+flags bjam/zip.make-zip EXCLUDES <exclude> : -x ;
+flags bjam/zip.make-zip FLAGS <recursive>on : -r ;
 
 actions make-zip {
-	echo 7z.exe a -tzip -bd "$(<)" "$(SOURCE_FOLDER)"
-	7z.exe a -tzip -bd "$(<)" "$(SOURCE_FOLDER)"
+	echo 7z.exe a -tzip -bd "$(<)" "$(FLAGS)" "$(SOURCE_FOLDER)" "-x!$(EXCLUDES)"
+	7z.exe a -tzip -bd "$(<)" "$(FLAGS)" "$(SOURCE_FOLDER)" "-x!$(EXCLUDES)"
 } 
Index: build.bat
===================================================================
--- build.bat	(revision 358cda1ba013b34f24eac9a5f3baf17dc5cef0af)
+++ build.bat	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -2,25 +2,27 @@
 @call env.bat
 
-SET cmdline=%jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% %* build-binaries
-%jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% warnings=off %* build-binaries
+echo :: %jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% warnings=off --with-psdk="%PLATTFORM_SDK_INCLUDE%" %* build-binaries >> build.log
+%jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% warnings=off --with-psdk="%PLATTFORM_SDK_INCLUDE%" %* build-binaries
 if %ERRORLEVEL% == 1 goto :error
+echo :: Result: %ERRORLEVEL% >> build.log
 
-SET cmdline=%jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% warnings=off %* build-archives
-%jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% warnings=off %* build-archives
+echo :: %jam% --toolset=msvc warnings=off %* build-archives >> build.log
+%jam% --toolset=msvc warnings=off %* build-archives
 if %ERRORLEVEL% == 1 goto :error
+echo :: Result: %ERRORLEVEL% >> build.log
 
-SET cmdline=%jam% --toolset=wix %* build-installer
-%jam% --toolset=wix %* build-installer
+echo :: %jam% --toolset=wix "--wix=%WIX_PATH%" %* build-installer >> build.log
+%jam% --toolset=wix "--wix=%WIX_PATH%" %* build-installer
 if %ERRORLEVEL% == 1 goto :error
+echo :: Result: %ERRORLEVEL% >> build.log
 
-exit /b 1
+exit /b 0
 goto :eof
 
 :error
+echo :: Error: %ERRORLEVEL% >> build.log
 echo *************
 echo * E R R O R *
 echo *************
-echo %cmdline%
-echo *************
 
 exit /b -1
Index: helpers/build-archive/Jamfile
===================================================================
--- helpers/build-archive/Jamfile	(revision 1fc246c9f5796420ed34e179136a17c104adcaf7)
+++ helpers/build-archive/Jamfile	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -13,10 +13,5 @@
 {
     local properties = [ $(property-set).raw ] ;
-    if <architecture>ia64 in $(properties) { 
-		tag = IA64 ; 
-	} else { 
-		if <address-model>64 in $(properties) { tag = x64 ; }
-		else { tag = Win32 ; }
-	}
+	local tag = [ get-root-prefix $(properties) ] ;
 	local date = [ SHELL "perl helpers/perl/echo_date.pl" ] ;
 	local version = [ SHELL "perl helpers/perl/echo_version.pl $(TOP)/../../AutoBuild.h" ] ;
Index: helpers/build-source/Jamfile
===================================================================
--- helpers/build-source/Jamfile	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
+++ helpers/build-source/Jamfile	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -0,0 +1,34 @@
+import common ;
+import path ; 
+local target = "NSClient++.zip" ;
+
+constant _MODULE : $(__name__) ;
+path-constant TOP : . ;
+
+rule format-name ( name : type ? : property-set )
+{
+    local properties = [ $(property-set).raw ] ;
+	local date = [ SHELL "perl helpers/perl/echo_date.pl" ] ;
+	local version = [ SHELL "perl helpers/perl/echo_version.pl $(TOP)/../../AutoBuild.h" ] ;
+	return "$(name)-$(version)-source-$(date).zip" ;
+}
+
+use-project master : ../.. ;
+
+zip $(target) : /master//NSClient++ : 
+	<tag>@format-name 
+	<source-folder>../../*.c*
+	<source-folder>../../*.h*
+	<source-folder>../../*.def
+	<recursive>on
+	<exclude>.svn
+	<exclude>bin
+	<exclude>lib-source
+	<exclude>to_remove
+	<exclude>Debug
+	<exclude>tmp
+; 
+
+explicit $(target) ;
+install build-archive : $(target) : <location>$(BOOST_STAGE_LOCATE)/archive ;
+
Index: release-build.bat
===================================================================
--- release-build.bat	(revision e7dbac93510ba14b903573c781bfbd7d2f0423f4)
+++ release-build.bat	(revision 55e44d48a8c1a164db08f1afd8e121917d0188f4)
@@ -1,28 +1,27 @@
 @echo off
-
 @call env.bat
 
-SET version=crypto_hdr
-SET cmdline=%jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers
+SET _ERROR=
+echo Starting build > build.log
+
+echo %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log
 %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers
 if %ERRORLEVEL% == -1 goto :error
+echo :: Result: %ERRORLEVEL% >> build.log
 
-REM build x86 binary
-SET version=x86
-SET cmdline=build.bat runtime-link=static variant=release address-model=32 --library-path="%TARGET_LIB_x86_DIR%" --with-psdk-lib=%"PLATTFORM_SDK_LIB_x86%" --with-psdk="%PLATTFORM_SDK_INCLUDE%" --wix="%WIX_PATH%"
-call build.bat runtime-link=static variant=release address-model=32 --library-path="%TARGET_LIB_x86_DIR%" --with-psdk-lib="%PLATTFORM_SDK_LIB_x86%" --with-psdk="%PLATTFORM_SDK_INCLUDE%" --wix="%WIX_PATH%"
+echo %jam% --toolset=msvc source-archive >> build.log
+%jam% --toolset=msvc source-archive
 if %ERRORLEVEL% == -1 goto :error
+echo :: Result: %ERRORLEVEL% >> build.log
 
-REM build x64 (Amd64, Emt64) binary
- SET version=x64
- SET cmdline=build.bat runtime-link=static variant=release address-model=64 --library-path="%TARGET_LIB_x64_DIR%" --with-psdk-lib="%PLATTFORM_SDK_LIB_x64%" --with-psdk="%PLATTFORM_SDK_INCLUDE%" --wix="%WIX_PATH%"
- call build.bat runtime-link=static variant=release address-model=64 --library-path="%TARGET_LIB_x64_DIR%" --with-psdk-lib="%PLATTFORM_SDK_LIB_x64%" --with-psdk="%PLATTFORM_SDK_INCLUDE%" --wix="%WIX_PATH%"
- if %ERRORLEVEL% == -1 goto :error
-
-
-REM TODO: Add IA64 version
-rem version=IA64
+call :build_one variant=debug address-model=32 "--library-path=%TARGET_LIB_x86_DIR%" "--with-psdk-lib=%PLATTFORM_SDK_LIB_x86%"
+IF DEFINED _ERROR goto :error
+call :build_one variant=release address-model=32 "--library-path=%TARGET_LIB_x86_DIR%" "--with-psdk-lib=%PLATTFORM_SDK_LIB_x86%"
+IF DEFINED _ERROR goto :error
+call :build_one variant=debug address-model=64 "--library-path=%TARGET_LIB_x64_DIR%" "--with-psdk-lib=%PLATTFORM_SDK_LIB_x64%"
+IF DEFINED _ERROR goto :error
+call :build_one variant=release address-model=64 "--library-path=%TARGET_LIB_x64_DIR%" "--with-psdk-lib=%PLATTFORM_SDK_LIB_x64%"
+IF DEFINED _ERROR goto :error
 rem call build.bat runtime-link=static variant=release architecture=ia64 --library-path=%TARGET_LIB_IA64_DIR%
-rem if %ERRORLEVEL% == -1 goto :error
 
 echo *************
@@ -31,14 +30,29 @@
 echo *           *
 echo *************
-
 goto :eof
 
-:error
+:build_one
+echo build.bat runtime-link=static %* >> build.log
+call build.bat runtime-link=static %*
+if %ERRORLEVEL% == -1 goto :error_one
+echo Result: %ERRORLEVEL% >> build.log
+goto :eof
+
+:error_one
 echo *********************
 echo *                   *
 echo *    E R R O R      *
 echo *                   *
-echo * When building %version% *
+echo *********************
+set _ERROR=1
+exit /b -1
+goto :eof
+
+:error
+echo :: Error: %ERRORLEVEL% >> build.log
+echo *********************
+echo *                   *
+echo *    E R R O R      *
 echo *                   *
 echo *********************
-echo %cmdline%
+type build.log
