diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index c5b20df98..e36ddd791 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -5,6 +5,10 @@ Features/Enhancements: Added more logging/notifications options #429: Added Czech translation +General Changes: +---------------- +Improved compatability between environments when building mRemoteNG from source + 1.75.7005 (2017-04-XX) diff --git a/Tools/find_vstool.ps1 b/Tools/find_vstool.ps1 new file mode 100644 index 000000000..d476b69fe --- /dev/null +++ b/Tools/find_vstool.ps1 @@ -0,0 +1,47 @@ +param ( + [string] + # Name of the file to find + $FileName +) + + + +function EditBinCertificateIsValid() { + param ( + [string] + $Path + ) + + # Verify file certificate + $valid_microsoft_cert_thumbprints = @( + "3BDA323E552DB1FDE5F4FBEE75D6D5B2B187EEDC", + "98ED99A67886D020C564923B7DF25E9AC019DF26", + "108E2BA23632620C427C570B6D9DB51AC31387FE" + ) + $file_signature = Get-AuthenticodeSignature -FilePath $Path + if (($file_signature.Status -ne "Valid") -or ($valid_microsoft_cert_thumbprints -notcontains $file_signature.SignerCertificate.Thumbprint)) { + Write-Warning "Could not validate the signature of $Path" + return $false + } else { + return $true + } +} + +$rootSearchPaths = @( + [System.IO.Directory]::EnumerateFileSystemEntries("C:\Program Files", "*Visual Studio*", [System.IO.SearchOption]::TopDirectoryOnly), + [System.IO.Directory]::EnumerateFileSystemEntries("C:\Program Files (x86)", "*Visual Studio*", [System.IO.SearchOption]::TopDirectoryOnly) +) + +# Returns the first full path to the $FileName that our search can find +foreach ($searchPath in $rootSearchPaths) { + foreach ($visualStudioFolder in $searchPath) { + $matchingExes = [System.IO.Directory]::EnumerateFileSystemEntries($visualStudioFolder, $FileName, [System.IO.SearchOption]::AllDirectories) + foreach ($matchingExe in $matchingExes) { + if (EditBinCertificateIsValid -Path $matchingExe) { + return $matchingExe + } + } + } +} + +Write-Error "Could not find any valid file by the name $FileName." -ErrorAction Stop \ No newline at end of file diff --git a/Tools/postbuild_mremotev1.ps1 b/Tools/postbuild_mremotev1.ps1 index 3e1d9d098..3fca2a0dc 100644 --- a/Tools/postbuild_mremotev1.ps1 +++ b/Tools/postbuild_mremotev1.ps1 @@ -41,6 +41,7 @@ Format-Table -AutoSize -Wrap -InputObject @{ & "$PSScriptRoot\copy_puttyng.ps1" -SolutionDir $SolutionDir -TargetDir $TargetDir & "$PSScriptRoot\move_help_files.ps1" -TargetDir $TargetDir & "$PSScriptRoot\set_LargeAddressAware.ps1" -TargetDir $TargetDir -TargetFileName $TargetFileName +& "$PSScriptRoot\verify_LargeAddressAware.ps1" -TargetDir $TargetDir -TargetFileName $TargetFileName & "$PSScriptRoot\tidy_files_for_release.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName & "$PSScriptRoot\sign_binaries.ps1" -SolutionDir $SolutionDir -TargetDir $TargetDir -CertificatePath $CertificatePath -CertificatePassword $CertificatePassword -ConfigurationName $ConfigurationName -Exclude $ExcludeFromSigning & "$PSScriptRoot\verify_binary_signatures.ps1" -TargetDir $TargetDir -ConfigurationName $ConfigurationName diff --git a/Tools/set_LargeAddressAware.ps1 b/Tools/set_LargeAddressAware.ps1 index ba785aea5..71018fc72 100644 --- a/Tools/set_LargeAddressAware.ps1 +++ b/Tools/set_LargeAddressAware.ps1 @@ -11,20 +11,12 @@ param ( Write-Output "===== Beginning $($PSCmdlet.MyInvocation.MyCommand) =====" # Find editbin.exe -$path_editBin = @((Resolve-Path -Path "C:\Program Files*\Microsoft Visual Studio*\VC\bin\editbin.exe").Path)[0] - -# Verify editbin certificate -$microsoft_cert_thumbprint = "3BDA323E552DB1FDE5F4FBEE75D6D5B2B187EEDC" -$editbin_signature = Get-AuthenticodeSignature -FilePath $path_editBin -if (($editbin_signature.Status -ne "Valid") -or ($editbin_signature.SignerCertificate.Thumbprint -ne $microsoft_cert_thumbprint)) { - Write-Error "Could not validate the signature of editbin.exe - we can not set LargeAddressAware" -ErrorAction Stop -} - +$path_editBin = & "$PSScriptRoot\find_vstool.ps1" -FileName "editbin.exe" $path_outputExe = Join-Path -Path $TargetDir -ChildPath $TargetFileName # Set LargeAddressAware -Write-Output "Setting LargeAddressAware on binary file `"$path_outputExe`"" +Write-Output "Setting LargeAddressAware on binary file:`n`"$path_outputExe`" `nwith:`n`"$path_editBin`"" & $path_editBin "/largeaddressaware" "$path_outputExe" Write-Output "" \ No newline at end of file diff --git a/Tools/verify_LargeAddressAware.ps1 b/Tools/verify_LargeAddressAware.ps1 new file mode 100644 index 000000000..2a3525f44 --- /dev/null +++ b/Tools/verify_LargeAddressAware.ps1 @@ -0,0 +1,32 @@ +param ( + [string] + [Parameter(Mandatory=$true)] + $TargetDir, + + [string] + [Parameter(Mandatory=$true)] + $TargetFileName +) + +Write-Output "===== Beginning $($PSCmdlet.MyInvocation.MyCommand) =====" + +# Find editbin.exe +$path_dumpBin = & "$PSScriptRoot\find_vstool.ps1" -FileName "dumpbin.exe" + +$path_outputExe = Join-Path -Path $TargetDir -ChildPath $TargetFileName + +# Dump exe header +$output = & "$path_dumpBin" /NOLOGO /HEADERS $path_outputExe | Select-String large + +if ($output -eq $null) +{ + Write-Warning "Could not validate LargeAddressAware" +} +else +{ + Write-Output $output.ToString().TrimStart(" ") +} + + + +Write-Output "" \ No newline at end of file