diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 5885413c7..12f170937 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -1258,14 +1258,14 @@ namespace System.Management.Automation internal static bool IsReservedDeviceName(string destinationPath) { #if !UNIX - string[] reservedDeviceNames = { "CON", "PRN", "AUX", "CLOCK$", "NUL", + string[] reservedDeviceNames = { "CON", "PRN", "AUX", "CLOCK$", "NUL", "CONIN$", "CONOUT$", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" }; string compareName = Path.GetFileName(destinationPath); string noExtensionCompareName = Path.GetFileNameWithoutExtension(destinationPath); - if (((compareName.Length < 3) || (compareName.Length > 6)) && - ((noExtensionCompareName.Length < 3) || (noExtensionCompareName.Length > 6))) + if (((compareName.Length < 3) || (compareName.Length > 7)) && + ((noExtensionCompareName.Length < 3) || (noExtensionCompareName.Length > 7))) { return false; } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index 015ad53cc..0e4adaeec 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -28,6 +28,8 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { @{ deviceName = 'AUX' } @{ deviceName = 'CLOCK$' } @{ deviceName = 'NUL' } + @{ deviceName = 'CONIN$' } + @{ deviceName = 'CONOUT$' } @{ deviceName = 'COM0' } @{ deviceName = 'COM1' } @{ deviceName = 'COM2' }