-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release these reserved names: COM1-COM9, LPT1-LPT9, CON, AUX, PRN, and NUL #18245
Comments
@be5invis Can you clarify what you're asking for? Reserved where? Thanks! |
@JeremyKuhne You cannot create ANY file named them, in ANY directory, with ANY extension, on Windows. This is a limitation of the “default” win32 API, because they are mapped to device names (like, |
Thanks for the details! .NET allows you to create them yourself now if you really want to as we allow you to use I don't, however, recommend doing so. As you point out, the Win32 API will treat these differently. Most applications aren't going to have logic to allow for legacy device names used as file names. I would also be shocked if .NET was bug free with these- too many places where filenames are recombined with base paths. Windows is unlikely to ever remove the mapping as the command shell and batch files depend on the current behavior ( |
@JeremyKuhne Maybe at least .NET can limit these names in "direct occur" manner. That is, |
Generally speaking we're trying very hard to not code specifically to internal details of Windows APIs. Even if we do get things right, doing so risks breaking on future versions of Windows. Trying to be helpful here is risky and could either break with a future Windows change or inhibit them from making a change (say, if they decided to remove or alter the way they handle legacy device names). As a concrete example: The well-meaning code we had in What I have been doing that impacts this is using |
@be5invis I'm going to close this for now. If you still want to discuss the issue feel free to reopen. If you find any places where we fall over on legacy device filenames please open issues so we can investigate the plausibility of handling them. |
Use the
\\?\
prefix to access them internally.The text was updated successfully, but these errors were encountered: