diff --git a/meshservice/MeshService.rc b/meshservice/MeshService.rc index 7a55595..3b7ce9d 100644 --- a/meshservice/MeshService.rc +++ b/meshservice/MeshService.rc @@ -85,8 +85,10 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN + VALUE "FileDescription", "MeshCentral Background Service Agent" VALUE "FileVersion", "0.0.0.0" VALUE "LegalCopyright", "Apache 2.0 License" + VALUE "ProductName", "MeshCentral Agent" VALUE "ProductVersion", "0, 0, 0, 0" END END diff --git a/meshservice/MeshService.vcxproj b/meshservice/MeshService.vcxproj index 1f1cd89..b6dfa6a 100644 --- a/meshservice/MeshService.vcxproj +++ b/meshservice/MeshService.vcxproj @@ -180,7 +180,6 @@ false $(ProjectName)64 - false false @@ -228,7 +227,7 @@ @echo // This file is auto-generated, any edits may be overwritten > $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 2>nul | FINDSTR /C:"Date:" | FOR /F "tokens=3,4,5,6,7" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_DATE "%%I-%%F-%%G %%H%%J" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 --format=%%H | FOR /F "tokens=1" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_HASH "%%F" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h - + powershell -ExecutionPolicy Unrestricted $(ProjectDir)prebuild.ps1 $(ProjectDir)..\Microscript\ILibDuktape_Commit.h $(ProjectDir)MeshService.rc signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" "$(TargetPath)" @@ -316,7 +315,7 @@ @echo // This file is auto-generated, any edits may be overwritten > $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 2>nul | FINDSTR /C:"Date:" | FOR /F "tokens=3,4,5,6,7" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_DATE "%%I-%%F-%%G %%H%%J" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 --format=%%H | FOR /F "tokens=1" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_HASH "%%F" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h - +powershell -ExecutionPolicy Unrestricted $(ProjectDir)prebuild.ps1 $(ProjectDir)..\Microscript\ILibDuktape_Commit.h $(ProjectDir)MeshService.rc signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" "$(TargetPath)" @@ -401,7 +400,7 @@ @echo // This file is auto-generated, any edits may be overwritten > $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 2>nul | FINDSTR /C:"Date:" | FOR /F "tokens=3,4,5,6,7" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_DATE "%%I-%%F-%%G %%H%%J" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 --format=%%H | FOR /F "tokens=1" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_HASH "%%F" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h - + powershell -ExecutionPolicy Unrestricted $(ProjectDir)prebuild.ps1 $(ProjectDir)..\Microscript\ILibDuktape_Commit.h $(ProjectDir)MeshService.rc REM signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" /t http://timestamp.comodoca.com/authenticode "$(TargetPath)" @@ -489,7 +488,7 @@ @echo // This file is auto-generated, any edits may be overwritten > $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 2>nul | FINDSTR /C:"Date:" | FOR /F "tokens=3,4,5,6,7" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_DATE "%%I-%%F-%%G %%H%%J" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h git log -1 --format=%%H | FOR /F "tokens=1" %%F in ('findstr "."') do @echo #define SOURCE_COMMIT_HASH "%%F" >> $(ProjectDir)..\microscript\ILibDuktape_Commit.h - +powershell -ExecutionPolicy Unrestricted $(ProjectDir)prebuild.ps1 $(ProjectDir)..\Microscript\ILibDuktape_Commit.h $(ProjectDir)MeshService.rc REM signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" /t http://timestamp.comodoca.com/authenticode "$(TargetPath)" diff --git a/meshservice/prebuild.ps1 b/meshservice/prebuild.ps1 new file mode 100644 index 0000000..c4c2e8a --- /dev/null +++ b/meshservice/prebuild.ps1 @@ -0,0 +1,79 @@ +#Write-Host "Input: $($args[0]) Output: $($args[1])" + +# +# Read ILibDuktape_Commit.h into file_data +# +$file_data = Get-Content $($args[0]); + +$hash = $null; +$hashdate = $null; +$current = $null; +$updated = $null; + +# +# Parse out the GIT Commit Hash and GIT Commit Date, so we can update the resource +# +$tokens = $file_data -split '`n'; +for($a=0;$a -lt $tokens.length;++$a) +{ + if($tokens[$a].IndexOf('SOURCE_COMMIT_HASH') -gt 0) + { + $hash_tok = $tokens[$a] -split '"'; + $hash = $hash_tok[1]; + } + if($tokens[$a].IndexOf('SOURCE_COMMIT_DATE') -gt 0) + { + $hash_tok = $tokens[$a] -split '"'; + $hashdate = $hash_tok[1]; + } +} + +# +# Parse the resource file +# +$rc_data = Get-Content $($args[1]); +$i = $rc_data -split '`n'; + +for($x=0;$x -lt $i.length;++$x) +{ + $z = $i[$x] -split '"'; + if($z[1] -eq "ProductVersion") + { + # + # Update the ProductVersion + # + $current = $z[3]; + $z[3] = "Commit: " + $hash; + $updated = $z[3]; + } + if($z[1] -eq "FileVersion") + { + # + # Update File Version + # + $z[3] = $hashdate; + } + $i[$x] = $z -Join '"'; +} + + +# +# Only update MeshService.rc if the values were actually updated +# +if($current -ne $updated) +{ + Write-Host "Updated MeshService.rc"; + $result = $i -Join [Environment]::NewLine + $result > $($args[1]); +} +else +{ + Write-Host "MeshService.rc is already up to date"; +} + + + + + + +