diff --git a/TimedExec.sln b/TimedExec.sln
index e851c58..5ddf401 100644
--- a/TimedExec.sln
+++ b/TimedExec.sln
@@ -8,13 +8,19 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Debug|Win32.ActiveCfg = Debug|Win32
{7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Debug|Win32.Build.0 = Debug|Win32
+ {7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Debug|x64.ActiveCfg = Debug|x64
+ {7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Debug|x64.Build.0 = Debug|x64
{7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Release|Win32.ActiveCfg = Release|Win32
{7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Release|Win32.Build.0 = Release|Win32
+ {7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Release|x64.ActiveCfg = Release|x64
+ {7BB6FBD8-4531-4CBB-B9EE-D440ACD7BCEC}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/TimedExec.vcxproj b/TimedExec.vcxproj
index 5d90e99..ff8a4ff 100644
--- a/TimedExec.vcxproj
+++ b/TimedExec.vcxproj
@@ -5,10 +5,18 @@
Debug
Win32
+
+ Debug
+ x64
+
Release
Win32
+
+ Release
+ x64
+
@@ -25,6 +33,12 @@
Unicode
v120_xp
+
+ Application
+ true
+ Unicode
+ v120_xp
+
Application
false
@@ -32,27 +46,64 @@
Unicode
v120_xp
+
+ Application
+ false
+ true
+ Unicode
+ v120_xp
+
+
+
+
+
+
+
true
- $(SolutionDir)\bin\$(Configuration)\
- $(SolutionDir)\obj\$(Configuration)\
+ $(SolutionDir)\bin\$(Platform)\$(Configuration)\
+ $(SolutionDir)\obj\$(Platform)\$(Configuration)\
+
+
+ true
+ $(SolutionDir)\bin\$(Platform)\$(Configuration)\
+ $(SolutionDir)\obj\$(Platform)\$(Configuration)\
false
- $(SolutionDir)\bin\$(Configuration)\
- $(SolutionDir)\obj\$(Configuration)\
+ $(SolutionDir)\bin\$(Platform)\$(Configuration)\
+ $(SolutionDir)\obj\$(Platform)\$(Configuration)\
+
+
+ false
+ $(SolutionDir)\bin\$(Platform)\$(Configuration)\
+ $(SolutionDir)\obj\$(Platform)\$(Configuration)\
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ NoExtensions
+
+
+ Console
+ true
+
+
+
@@ -66,6 +117,34 @@
+
+ Level3
+
+
+ Full
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ AnySuitable
+ Speed
+ MultiThreaded
+ NoExtensions
+ false
+ true
+ false
+ Fast
+
+
+ Console
+ false
+ true
+ true
+ UseLinkTimeCodeGeneration
+ $(SolutionDir)../EncodePointerLib/Release/EncodePointer.lib;%(AdditionalDependencies)
+ false
+
+
+
Level3
@@ -81,6 +160,7 @@
false
true
false
+ Fast
Console
diff --git a/etc/date.exe b/etc/date.exe
new file mode 100644
index 0000000..069bae1
Binary files /dev/null and b/etc/date.exe differ
diff --git a/etc/head.exe b/etc/head.exe
new file mode 100644
index 0000000..bee187d
Binary files /dev/null and b/etc/head.exe differ
diff --git a/etc/sed.exe b/etc/sed.exe
new file mode 100644
index 0000000..2a9f38c
Binary files /dev/null and b/etc/sed.exe differ
diff --git a/etc/zip.exe b/etc/zip.exe
new file mode 100644
index 0000000..55be81d
Binary files /dev/null and b/etc/zip.exe differ
diff --git a/src/TimedExec.cpp b/src/TimedExec.cpp
index 923c99a..61c841e 100644
--- a/src/TimedExec.cpp
+++ b/src/TimedExec.cpp
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
#define NOMINMAX 1
@@ -144,7 +145,7 @@ static int initializeCommandLine(tstring &commandLine, tstring &programFile)
programFile.clear();
int nArgs = 0;
- TCHAR **szArglist = CommandLineToArgvW(GetCommandLine(), &nArgs);
+ TCHAR **szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
if((szArglist == NULL) || (nArgs < 2))
{
@@ -256,7 +257,7 @@ static LONG WINAPI crashHandlerRoutine(struct _EXCEPTION_POINTERS *ExceptionInfo
{
static const char *const message = "\n\nGURU MEDITATION: UNHANDELED SYSTEM EXCEPTION !!!\n\n";
DWORD bytesWritten;
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), message, strlen(message), &bytesWritten, NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), message, lstrlenA(message), &bytesWritten, NULL);
TerminateProcess(GetCurrentProcess(), UINT(-1));
return EXCEPTION_EXECUTE_HANDLER;
}
diff --git a/z_build.bat b/z_build.bat
new file mode 100644
index 0000000..1407bda
--- /dev/null
+++ b/z_build.bat
@@ -0,0 +1,169 @@
+@echo off
+setlocal enabledelayedexpansion
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Set Paths
+REM ///////////////////////////////////////////////////////////////////////////
+set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
+set "UPX3_PATH=C:\Program Files (x86)\UPX"
+set "PDOC_PATH=C:\Program Files (x86)\Pandoc"
+
+REM ###############################################
+REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
+REM ###############################################
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Setup environment
+REM ///////////////////////////////////////////////////////////////////////////
+call "%MSVC_PATH%\vcvarsall.bat" x86
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Check environment
+REM ///////////////////////////////////////////////////////////////////////////
+if "%VCINSTALLDIR%"=="" (
+ echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var^^!
+ goto BuildError
+)
+if not exist "%VCINSTALLDIR%\bin\cl.exe" (
+ echo C++ compiler binary not found. Please check your MSVC_PATH var^^!
+ goto BuildError
+)
+if not exist "%UPX3_PATH%\upx.exe" (
+ echo UPX binary could not be found. Please check your UPX3_PATH var^^!
+ goto BuildError
+)
+if not exist "%PDOC_PATH%\pandoc.exe" (
+ echo Pandoc binary could not be found. Please check your PDOC_PATH var^^!
+ goto BuildError
+)
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Get current date and time (in ISO format)
+REM ///////////////////////////////////////////////////////////////////////////
+set "ISO_DATE="
+set "ISO_TIME="
+if not exist "%~dp0\etc\date.exe" goto BuildError
+for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
+ if "%%a"=="ISODATE" set "ISO_DATE=%%b"
+)
+for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do (
+ if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
+)
+if "%ISO_DATE%"=="" goto BuildError
+if "%ISO_TIME%"=="" goto BuildError
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Clean Binaries
+REM ///////////////////////////////////////////////////////////////////////////
+for /d %%d in (%~dp0\bin\*) do (rmdir /S /Q "%%~d")
+for /d %%d in (%~dp0\obj\*) do (rmdir /S /Q "%%~d")
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Build the binaries
+REM ///////////////////////////////////////////////////////////////////////////
+for %%p in (Win32, x64) do (
+ echo ---------------------------------------------------------------------
+ echo BEGIN BUILD [%%p/Release]
+ echo ---------------------------------------------------------------------
+
+ MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:clean "%~dp0\TimedExec.sln"
+ if not "!ERRORLEVEL!"=="0" goto BuildError
+ MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:rebuild "%~dp0\TimedExec.sln"
+ if not "!ERRORLEVEL!"=="0" goto BuildError
+ MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:build "%~dp0\TimedExec.sln"
+ if not "!ERRORLEVEL!"=="0" goto BuildError
+)
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Copy program files
+REM ///////////////////////////////////////////////////////////////////////////
+set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
+mkdir "%PACK_PATH%"
+
+echo ---------------------------------------------------------------------
+echo BEGIN PACKAGING [Release]
+echo ---------------------------------------------------------------------
+
+mkdir "%PACK_PATH%"
+mkdir "%PACK_PATH%\x64"
+
+copy "%~dp0\bin\Win32\Release\*.exe" "%PACK_PATH%"
+copy "%~dp0\bin\x64\.\Release\*.exe" "%PACK_PATH%\x64"
+copy "%~dp0\LICENSE.html" "%PACK_PATH%"
+
+"%PDOC_PATH%\pandoc.exe" --from markdown_github+header_attributes --to html5 --standalone -H "%~dp0\img\Style.inc" "%~dp0\README.md" --output "%PACK_PATH%\README.html"
+
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Compress
+REM ///////////////////////////////////////////////////////////////////////////
+"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.exe"
+"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\x64\*.exe"
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Create version tag
+REM ///////////////////////////////////////////////////////////////////////////
+echo TimedExec > "%PACK_PATH%\BUILD_TAG"
+echo Copyright (C) 2014 LoRd_MuldeR ^ >> "%PACK_PATH%\BUILD_TAG"
+echo. >> "%PACK_PATH%\BUILD_TAG"
+echo Built on %ISO_DATE%, at %ISO_TIME% >> "%PACK_PATH%\BUILD_TAG"
+echo. >> "%PACK_PATH%\BUILD_TAG"
+cl 2>&1 | "%~dp0\etc\head.exe" -n1 | "%~dp0\etc\sed.exe" -e "/^$/d" -e "s/^/Compiler version: /" >> "%PACK_PATH%\BUILD_TAG"
+ver 2>&1 | "%~dp0\etc\sed.exe" -e "/^$/d" -e "s/^/Build platform: /" >> "%PACK_PATH%\BUILD_TAG"
+echo. >> "%PACK_PATH%\BUILD_TAG"
+echo This program is free software; you can redistribute it and/or >> "%PACK_PATH%\BUILD_TAG"
+echo modify it under the terms of the GNU General Public License >> "%PACK_PATH%\BUILD_TAG"
+echo as published by the Free Software Foundation; either version 2 >> "%PACK_PATH%\BUILD_TAG"
+echo of the License, or (at your option) any later version. >> "%PACK_PATH%\BUILD_TAG"
+echo. >> "%PACK_PATH%\BUILD_TAG"
+echo This program is distributed in the hope that it will be useful, >> "%PACK_PATH%\BUILD_TAG"
+echo but WITHOUT ANY WARRANTY; without even the implied warranty of >> "%PACK_PATH%\BUILD_TAG"
+echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> "%PACK_PATH%\BUILD_TAG"
+echo GNU General Public License for more details. >> "%PACK_PATH%\BUILD_TAG"
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Attributes
+REM ///////////////////////////////////////////////////////////////////////////
+attrib +R "%PACK_PATH%\*"
+attrib +R "%PACK_PATH%\x64\*"
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Generate outfile name
+REM ///////////////////////////////////////////////////////////////////////////
+mkdir "%~dp0\out" 2> NUL
+set "OUT_NAME=TimedExec.%ISO_DATE%"
+:CheckOutName
+if exist "%~dp0\out\%OUT_NAME%.zip" (
+ set "OUT_NAME=%OUT_NAME%.new"
+ goto CheckOutName
+)
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // Build the package
+REM ///////////////////////////////////////////////////////////////////////////
+pushd "%PACK_PATH%"
+"%~dp0\etc\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%PACK_PATH%\BUILD_TAG"
+popd
+attrib +R "%~dp0\out\%OUT_NAME%.zip"
+
+
+REM Clean up!
+rmdir /Q /S "%PACK_PATH%"
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // COMPLETE
+REM ///////////////////////////////////////////////////////////////////////////
+echo.
+echo Build completed.
+echo.
+pause
+goto:eof
+
+REM ///////////////////////////////////////////////////////////////////////////
+REM // FAILED
+REM ///////////////////////////////////////////////////////////////////////////
+:BuildError
+echo.
+echo Build has failed ^^!^^!^^!
+echo.
+pause