Makes Start-Trace escape file paths correctly (#3863)
Start-Trace neglects qualifying arguments to the -o and -pf command line switches, causing logman (and subsequently Start-Trace) to exit with 0x80070057 and return: Error: The argument is incorrect. Whenever arguments to either -ProviderFilePath or -OutputFilePath contain spaces because Start-Trace doesn't escape the path in any way. This commit moves basic input validation for output file paths to the ProviderFilePath and OutputFilePath parameter definitions, and adds text qualifiers (double-quotes) around input arguments
This commit is contained in:
parent
7d5367a9f7
commit
f15a8dab28
|
@ -27,9 +27,11 @@ function Start-Trace
|
|||
[string]
|
||||
$SessionName,
|
||||
[Parameter(Position=1)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$OutputFilePath,
|
||||
[Parameter(Position=2)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$ProviderFilePath,
|
||||
[Parameter()]
|
||||
|
@ -63,12 +65,12 @@ function Start-Trace
|
|||
|
||||
if ($null -ne $OutputFilePath)
|
||||
{
|
||||
$executestring += " -o $OutputFilePath"
|
||||
$executestring += " -o ""$OutputFilePath"""
|
||||
}
|
||||
|
||||
if ($null -ne $ProviderFilePath)
|
||||
{
|
||||
$executestring += " -pf $ProviderFilePath"
|
||||
$executestring += " -pf ""$ProviderFilePath"""
|
||||
}
|
||||
|
||||
if ($null -ne $Format)
|
||||
|
|
Loading…
Reference in a new issue