Monday, August 2, 2010

Microsoft KLC keyboard doesn't uninstall

I was trying out Microsoft's Keyboard Layout Creator this week. I ended up creating a keyboard and then wanted to correct it and reinstall it. When I tried reinstalling it, though, it said that there was already a keyboard with that name installed even though I removed it.

I figured out the problem and posted the steps to resolve it here.

How to uninstall a keyboard (the correct way):

  1. Go to add/remove programs
  2. Find the keyboard, it should be the same name as the Description field of the project's properties in Keyboard Layout Creator.
  3. Press Modify
  4. Choose Remove the keyboard layout

This will also cause it to be removed from the add/remove program list. This method will even remove the keyboard if it is set up as your secondary keyboard. There's no need to remove it from the Regional settings prior to uninstalling it with this method.

The problem is that I uninstalled the keyboard incorrectly. These are the steps I did which caused it to uninstall incorrectly. (I'm including this here for reference, do not repeat these steps).

DO NOT repeat these steps:

How to uninstall a keyboard (the INCORRECT way):

  1. Go to add/remove programs
  2. Press Support
  3. Again: Do not repeat these steps unless you purposely want a keyboard that you won't be able to uninstall correctly.
  4. Press Repair
  5. Now press uninstall.

You will now not be able to uninstall the keyboard properly even if you reinstall it. The reason is that when you reinstall it, it will actually create a second entry in the registry rather than overwriting the first.

If you did something similar to the steps above, read on for a way to manually uninstall it.

Here's how I manually removed the keyboard, partially following these instructions, and partially using Process Monitor to see what files and registry entires are created:

How to manually remove a keyboard that was installed using Keyboard Layout Creator:

  1. Remove the keyboard from the Language and Regional settings:
    1. Control Panel > Regional and Language Options > Languages > Details...
    2. If it exists as one of the installed services, you should remove it. You can do this by adding another keyboard (e.g. US) and making it the default one, then removing the keyboard you are trying to get rid of.
  2. Open regedit
  3. Warning: you should backup your registry in case you accidentally delete something important.
  4. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\
  5. Find the key that represents your keyboard: (referred to as "the key" in following steps)
    • It should be in the form XXXXXXXX (an 8 hex digit number).
    • Each key should have values such as: Layout Display Name, Layout File, Layout Id, Layout Product Code, Layout Text.
    • The Layout Text property should match the keyboard name that you chose.
    • Mine was near the end and started with an a instead of a 0 like all the others.
  6. Take a look at the Layout File which should be a .dll name. I will refer to it as "the dll" in the following steps.
  7. Look for the dll in C:\WINDOWS\system32\dllcache and delete it if it exists.
  8. Look for the dll in C:\WINDOWS\system32 and delete it if it exists.
  9. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes and see if it has a Name which is equal to the key's name (e.g. XXXXXXXX) and a value such as en. If it does, delete it.
  10. Navigate back to the key (from step 5), and delete the entire key.

It should now no longer exist in the Regional Settings dialog, and you can recreate your keyboard!