Windows – Caps lock can only be turned off by shift key, regardless of setting

capslockkeyboardsony-vaiowindows 7

I'm using Windows 7 Home Premium on a Sony VAIO VPC-F23BFX laptop.
The problem is that the caps lock key can only be turned off using the shift key.
In Control Panel's Regional Settings, it does not matter if I set it to turn off with the caps lock key or the shift key, it always expects the shift key.
I checked and the registry value for this option is being saved correctly.
I also tested with this utility and the scan codes being generated are:

OnKeyDown, Key code=20, Control keys=, Key name CAPS LOCK  
OnKeyup, Key code=20, Control keys=, Key name CAPS LOCK  

when pressing caps lock the first time (it turns on); and:

OnKeyup, Key code=20, Control keys=, Key name CAPS LOCK  

when pressing it a second time (it doesn't turn off).
If I then press shift, it generates:

OnKeyDown, Key code=16, Control keys=Shift{Left}, Key name SHIFT
OnKeyDown, Key code=20, Control keys=Shift{Left}, Key name CAPS LOCK
OnKeyup, Key code=20, Control keys=Shift{Left}, Key name CAPS LOCK
OnKeyup, Key code=16, Control keys=, Key name SHIFT

Maybe some program is messing with the keyboard events? (I'm not using AutoHotkey or anything similar).

Best Answer

After some investigation, I found the culprit: I had been using a custom keyboard layout that disabled dead keys, and apparently it also forced the usage of the Shift key to turn off caps-lock (ShiftLock as some call it).

I had tried switching to the default layout before and it didn't seem to work, now I realize that probably was because I had tested on an existing Notepad window instead of opening a new one.

Solution: I downloaded MSKLC and created a new layout based on that one but without enabling ShiftLock.