Ctrl2Cap Logo
Copyright © 1997Mark Russinovich
Last Updated July 9, 1997
Introduction Ctrl2cap is a kernel-mode device driver that filters the system's keyboard class driver in order to convert caps-lock characters into control characters. People like myself that migrated to NT from UNIX are used to having the control key located where the caps-lock key is on the standard PC keyboard, so a utility like this is essential for our editing well-being.

The primary purpose of this driver is not serve as a caps-lock to control mapping utility, but rather to demonstrate how system keyboard input can be caught and manipulated before NT even "sees" it. At this level it is even possible to filter out the ctrl-alt-del combination (why you would want to do that is beyond me, given that administrative support exists to provide the same end-effect, but whatever…).

Installation and Use Install Ctrl2cap by first copying ctrl2cap.sys to your SystemRoot\system32\drivers driectory. If you are running on NT 4.0, type "regedit ctrl2cap.reg" and reboot. If you are running on NT 3.51, create by hand the registry key specified in ctrl2cap.reg, along with the indicated values.
Building Ctrl2cap Ctrl2cap requires ntddkbd.h from the ddk\src\input\inc directory, so you must first copy that file to the ctrl2cap directory. Then build with the standard tools. Ctrl2cap also demonstrates the use of the function HalDisplayString(), which can be used either to throw a custom blue-screen, or to print messages to the blue screen that is present during system initialization. Ctrl2cap prints a message that it has initialized at System-Start time.

How Ctrl2cap Works

Ctrlcap is actually quite trivial. It simply attaches itself to the keyboard class driver so that it will catch keyboard read requests. For each request, it posts an I/O completion callback, at which point it takes a peek at the scancode that is being returned. If it happens to be a caps-lock, ctrl2cap changes it into a left-control.

More Information

For more information on writing filter drivers (drivers that attach themselves to other drivers so that they can see their input and/or output), here are sources to check out:

The Windows NT DDK sample \src\storage\filter\diskperf "Examining the Windows NT File System," by Mark Russinovich and Bryce Cogswell, Dr. Dobb's Journal, February 1997, and the accompanying file system filter driver, NTFilemon.


Download Ctrl2cap Plus Source (6KB)