tools: WD exclusions support - internal improvements

* use {group} symbolic path instead of {autostartmenu) due to backward compatibility
* don't check Defender module existence in PS scripts (done by the installer)
This commit is contained in:
Martin Vychodil 2019-12-13 01:53:55 +01:00 committed by Ivan Grokhotkov
parent bcb9ba6783
commit 66aac70286
3 changed files with 2 additions and 30 deletions

View File

@ -73,7 +73,7 @@ Type: filesandordirs; Name: "{app}\dist"
Type: filesandordirs; Name: "{app}\releases"
Type: filesandordirs; Name: "{app}\tools"
Type: filesandordirs; Name: "{app}\python_env"
Type: files; Name: "{autostartmenu}\Programs\ESP-IDF\{#IDFCmdExeShortcutFile}"
Type: files; Name: "{group}\{#IDFCmdExeShortcutFile}"
Type: files; Name: "{autodesktop}\{#IDFCmdExeShortcutFile}"
[Tasks]
@ -84,7 +84,7 @@ Name: wdexcl; Description: "Register the ESP-IDF Tools executables as Windows De
[Run]
Filename: "{app}\dist\{#PythonInstallerName}"; Parameters: "/passive PrependPath=1 InstallLauncherAllUsers=0 Include_dev=0 Include_tcltk=0 Include_launcher=0 Include_test=0 Include_doc=0"; Description: "Installing Python"; Check: PythonInstallRequired
Filename: "{app}\dist\{#GitInstallerName}"; Parameters: "/silent /tasks="""" /norestart"; Description: "Installing Git"; Check: GitInstallRequired
Filename: "{autostartmenu}\Programs\ESP-IDF\{#IDFCmdExeShortcutFile}"; Flags: postinstall shellexec; Description: "Run ESP-IDF Command Prompt (cmd.exe)"; Check: InstallationSuccessful
Filename: "{group}\{#IDFCmdExeShortcutFile}"; Flags: postinstall shellexec; Description: "Run ESP-IDF Command Prompt (cmd.exe)"; Check: InstallationSuccessful
[UninstallRun]
Filename: "powershell.exe"; \

View File

@ -35,11 +35,6 @@ $retVal = 1
Try
{
#check the Defender module availability
if (!(Get-Module "Defender")) {
Write-Output "Windows Defender module not available, aborting"
[Environment]::Exit(0)
}
Import-Module Defender
@ -59,7 +54,6 @@ Try
if( [string]::IsNullOrEmpty($logFile) ) {
$tempFileName = Get-Date -UFormat "%Y%m%d%H%M%s"
$lf = Join-Path -Path $env:TEMP -ChildPath "WDEspLog$tempFileName.log"
#Write-Output "Logfile: $lf"
}
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"
@ -77,7 +71,6 @@ Try
Remove-Item $lf
}
#Write-Output "Process finished with code " $proc.ExitCode
exit $proc.ExitCode
}

View File

@ -88,13 +88,6 @@ Try
}
}
#check the Defender module availability
$wdModuleDir = Join-Path -Path $env:SystemRoot -ChildPath "System32\WindowsPowerShell\v1.0\Modules\Defender"
if( -not (Test-Path -Path $wdModuleDir) ) {
Write-Output "Windows Defender module not found, aborting"
[Environment]::Exit($retVal)
}
Import-Module Defender
#self-elevation support
@ -119,7 +112,6 @@ Try
if( $bOwnLogFile ) {
$tempFileName = Get-Date -UFormat "%Y%m%d%H%M%s"
$lf = Join-Path -Path $env:TEMP -ChildPath "WDEspLog$tempFileName.log"
Write-Output "Logfile: $lf"
}
else { $lf = $logFile }
@ -164,37 +156,24 @@ Try
#ADD exclusion paths
if( $bAddPath ) {
#foreach ($wdPath in $AddExclPath) {
# $pathsToExclude.Add( $wdPath )
#}
$pathsToExclude.Add( $AddExclPath )
}
#ADD exclusion files
if( $bAddFile ) {
#foreach ($wdFile in $AddExclFile) {
# $filesToExclude.Add( $wdFile )
#}
$filesToExclude.Add( $AddExclFile )
}
#REMOVE exclusion paths
if( $bRmPath ) {
#foreach ($wdPath in $RmExclPath) {
# $pathsToInclude.Add( $wdPath )
#}
$pathsToInclude.Add( $RmExclPath )
}
#ADD exclusion file
if( $bAddFile ) {
#foreach ($wdFile in $RmExclFile) {
# $filesToRemove.Add( $wdFile )
#}
$filesToRemove.Add( $RmExclFile )
}
}
#default: throw exception
else {
throw (New-Object -TypeName System.ArgumentException -ArgumentList "Mandatory parameter(s) missing")
}