Why Microsoft has the name of an old mouse hidden in its Bluetooth drivers
Screw-up or conspiracy?
Lurking within the Windows Bluetooth stack is a hardcoded reference to the Microsoft Wireless Notebook Presenter Mouse 8000. Is this nostalgic favoritism from Microsoft? Or is it just somebody, somewhere, making a mistake that an engineer had to work around?
You'll be unsurprised to know that, according to veteran Microsoft engineer Raymond Chen, it's the latter.
"There is a lot of bad hardware out there," writes Chen, "and there are a lot of compatibility hacks to deal with it." There's hardware that spouts nonsense or does things that it says it absolutely won't (Chen cites the example of a USB device that drew more power than it promised it would.) Still, the vast majority can be dealt with behind the scenes with code that can repair or ignore corrupted values.
However, sometimes something gets screwed up so badly while appearing deceptively innocuous that extreme measures are needed.
Enter 2006's Microsoft Wireless Notebook Presenter Mouse 8000. Released during the heyday of Windows XP, the Bluetooth device could function as a slide presenter, a laser pointer, and a media controller, as well as serving as a notebook mouse.
It even shipped with a carrying case.
However, it was also given a name that caused Windows to choke when trying to parse the text. The device local string is specified to be encoded in UTF-8. However, Chen explains, "the Microsoft Wireless Notebook Presenter Mouse 8000 reports its name as Microsoft⟪AE⟫ Wireless Notebook Presenter Mouse 8000, encoding the registered trademark symbol ® not as UTF-8 as required by the specification but in code page 1252.
"What's even worse is that a bare ⟪AE⟫ is not a legal UTF-8 sequence, so the string wouldn't even show up as corrupted; it would get rejected as invalid."
AE gives the location of the ® symbol in the legacy Windows 1252 code page, but UTF-8 is a rather different beast.
"Thanks, Legal Department, for sticking [an] ® in the descriptor and messing up the whole thing."
- Microsoft veteran's worst Windows bug was Pinball running at 5,000 FPS
- Microsoft eventually realized the world isn't just the Northern Hemisphere
- Windows reports two CPU speeds because one would be too simple
- The passive aggression of connecting USB to PS/2
But how could such a thing happen? Chen speculates, "Maybe Windows version N does not validate the string. Device ships with invalid string. Device works on Windows version N because there is no enforcement. Windows version N+1 adds string validation, say, to deal with a security issue. Now device is broken."
He adds: "Windows version N+1 needs to add compatibility workaround so that device continues to work on version N+1."
And this is why there is a table lurking within the Bluetooth drivers containing a list of devices that report their names wrong and the correct name to use. Connect a device from the list, and the correct name is used.
"That table," concludes Chen, "currently has only one entry." ®