Thursday, March 06, 2008

Windows XP CON bug

The bug has been tried and tested in both Windows XP Home and Professional. If you try to make a folder named "CON" (case insensitive), Windows XP renames it back to what it was. So creating a new folder with the name "CON" just renames it to "New Folder".

The bug seems like a variable that got treated as a string or vice-versa. Trying to create the folder from a cmd prompt failed with an error "The directory name is invalid.".

This also works when you try to create a file called "CON", or "CON.". ".CON" shows up the way it should.

If you create a folder named "CON" on a linux filesystem say, and open up a samba share of it, the "CON" directory shows up as being "CSHOFG~F". A "CON." file or folder shows up as "CRW2KU~B"! Very Strange!

This actually is a unix-like feature. DOS device drivers are accessible like normal files, i.e. the everything-is-a-file philosophy. CON is the equivalent of /dev/tty, NUL of /dev/null, COM# of /dev/ttyS#, LPT# of /dev/lp# and CLOCK$ corresponds to /dev/rtc (PRN is an alias to LPT1, AUX is COM1). Every character device can be opened this way, block devices (which are assumed to be FAT formatted...) are named A: to Z:, as you will know. Many pseudo character devices (drivers which had to be loaded as drivers but were no character devices, like EMM386, HIMEM.SYS, ..) had forbidden characters like '*' in their device names to be hidden from the user.

Somebody at Microsoft willing to explain?

Share |

No comments yet


Embed Wave to Blogger