Ah, the Compatibility Sins of the Father. Does anyone else think it's a hoot that you can't have a file called lpt1.png on your system? Or a folder called con?
There's a old story about the .NET CLR team - before they took over an entire Top-Level-Domain as their name, thereby effectively thwarting my own .ORG world domination strategy - where they wanted to call the successor to COM and COM++, "COM3."
Apparently it didn't take long for them to realize that this was a sub-optimal name. Probably about this long:
C:\Users\Scott>md com3The directory name is invalid.
I'm still not clear, however, why this would be a problem in Vista. It's no doubt "compassionate conservative compatibilityism" (my new phrase of the day) on the part of Microsoft.
Of course, it's because the underlying Win32 APIs for opening a file STILL will accept "COM1" as a file name, as in:
portHandle = CreateFile("COM1", EFileAccess.GenericWrite, EFileShare.None, IntPtr.Zero, ECreationDisposition.OpenExisting, EFileAttributes.Device | EFileAttributes.Overlapped, IntPtr.Zero);
There's even a special way in Windows to refer to Serial Ports larger than COM9 in your code, like this -\\.\COM10.
You see, they only choose to oppress us 9 times, for COM1 to COM9. From then on, we can live footloose and fancy-free.
C:\Users\Scott>md com9The directory name is invalid. C:\Users\Scott>md com10 C:\Users\Scott>dir com10Volume in drive C is 70 GIGS SYSTEMVolume Serial Number is 98A2-64B2 Directory of C:\Users\Scott\com10
C:\Users\Scott>md com9The directory name is invalid.
C:\Users\Scott>md com10
C:\Users\Scott>dir com10Volume in drive C is 70 GIGS SYSTEMVolume Serial Number is 98A2-64B2
Directory of C:\Users\Scott\com10
From MSDN:
Do not use the following reserved device names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed by an extension, for example, NUL.tx7. CLOCK$ is also a reserved device name.
Do not use the following reserved device names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed by an extension, for example, NUL.tx7.
CLOCK$ is also a reserved device name.
Good times.
Scott at DevReach in Bulgaria in October
Developer Stand up Comedy - Coding 4 Fun
TechDays/DevDays Netherlands and Belgium:
Posts by Category Posts by Month
Greatest Hits Dev Tools List