Recognize CONOUT$ and CONIN$ as reserved device names (#13508)
This commit is contained in:
parent
d25d964d57
commit
3effa20410
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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' }
|
||||
|
|
Loading…
Reference in a new issue