we get signal

2007-01-10

Delete "WinDir" at your own risk

(tags Windows, Input Method Editor, environment variable, failure)

I booted up my computers at work this morning and was greeted with the inability to input Japanese via the MS IME (Microsoft Input Method Editor). I do crazy things with my keyboard, like remap Caps Lock as Control, use the IME Watcher for XP, do Windows key mods with HotKeyPlus and Mado Tsukai no Yuuutsuu. I even suspected Synergy, which gets wonky with the control and shift key sometimes.

The day before I was cleaning up the computers in some wierd fashion relating to environment variables (envvars). Then I remembered that I deleted the "WinDir" System envvar, because there already was a "SystemRoot" System envvar and I obviously (smacks forehead) made this "new" "WinDir" for my own funky utilities.

Bad move:

"Windir" environment variable is used throught the Windows Registry, especially for the MS-IME.

What is this "WinDir" envvar and what is the difference between it and the "SystemRoot"? It turns out that the "Windir" envvar is a Windows 3.0-ism, defined for the benefit of applications who need to know if they're running under Windows. It's been with us since 1990! Go do a search in your Windows registry for "Windir" and see how the "Manage" command in your "My Computer" uses the "Windir" envvar to launch the Computer Management Snap-In. In other words, it's very necessary.

The "SystemRoot" is also an oldie but goodie. It points to the parent directory of the "system" folder of the Windows OS (according to Commenter "KC" on Joel on Software Discussion Group), which is usually "WinDir" but could be on a seperate network share in the good ol' days of network-booted 16-bit Windows! (according to Raymond Chen's "Why is there a separate GetSystemDirectory function?")

I could gripe that I shouldn't be able to modify or delete "WinDir", but maybe there's a use case. Anyway, enough rope to shoot yourself in the foot.