Ctrl2Cap v2.0

Ctrl2Cap是一款内核模式设备驱动程序,用于将系统键盘类驱动中的大写锁定字符转换为控制字符。适用于从UNIX迁移到NT系统的用户,提供在标准PC键盘上将控制键替换为大写锁定键的功能。适用于NT 4.0及更高版本,包括64位Windows XP、Windows Server 2003、Vista和Longhorn Server。安装通过运行"ctrl2cap /install"命令,卸载则使用"ctrl2cap /uninstall"。

By Mark Russinovich

Published: November 1, 2006

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.

Ctrl2cap works on NT 4.0 and higher, as well as 64-bit Windows XP, Window Server 2003, Vista and Longhorn Server.

Installation and Use

Install Ctrl2cap running the command "ctrl2cap /install" from the directory into which you've unzipped the Ctrl2cap files. To uninstall type "ctrl2cap /uninstall".

Building Ctrl2cap

Ctrl2cap requires ntddkbd.h from the ddk/src/input/inc directory, so you must first copy that file to the ctrl2cap directory. To build a standard NT 4 driver type "buildnt4" and to build a Win2K WDM driver type "buildnt5". Output files are placed in the /release subdirectory.

How Ctrl2cap Works

On NT 4 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.

On Win2K Ctrl2cap is a WDM filter driver that layers in the keyboard class device's stack above the keyboard class device. This is in contrast to the Win2K DDK's kbfiltr example that layers itself between the i8042 port device and the keyboard class device. I chose to layer on top of the keyboard class device for several reasons:

It means that the Ctrl2cap IRP_MJ_READ interception and manipulation code is shared between the NT 4 and Win2K versions.

I don't need to supply an INF file and have the user go through the Device Manager to install Ctrl2cap - I simply modify the appropriate Registry value (the keyboard class devices's HKLM/System/CurrentControlSet/Control/Class UpperFilters value).

The disadvantage of my approach is (and this an advantage or disadvantage depending on your point of view):

Because I don't install with an INF file via the Device Manager, the user is not warned that the Ctrl2cap driver file is not digitally signed by Microsoft.

In this particular case I felt that the advantages outweigh the disadvantages. However, before you model a Win2K keyboard filter on Ctrl2cap I strongly suggest that you study the kbfiltr example from the Win2K DDK. Kbfiltr's interception point in the key input sequence makes it very easy for kbfiltr to inject keystrokes into the input stream.

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 and Windows 2000 DDK sample /src/storage/filter/diskperf

The Windows 2000 DDK sample /src/input/kbfiltr

"Examining the Windows NT File System," by Mark Russinovich and Bryce Cogswell, Dr. Dobb's Journal, February 1997 the accompanying file system filter driver, Filemon

Download Ctrl2cap (48 KB)

sysinternals程序和部分程序源码 Sysinternals_Source/ AccessEnumSource filemon434 NtfsInfoSource TokenmonSource AdRestoreSource fmifs procfeatures TVcache AutologonSource FundeleteSource regmon435 VcMonSource CacheSetSource JunctionSource SDeleteSource VxDMonSource Ctrl2CapSource NetstatpSource SecDemoSource DiskExt NewSidSource ShareEnumSource SysinternalsSuite/ accesschk.exe Diskmnt.hlp PHYSMEM.EXE Reghide.exe AccessEnum.exe Diskmon.exe pipelist.exe regjump.exe AdExplorer.chm DISKMON.HLP PORTMON.CNT Regmon.exe ADExplorer.exe DiskView.exe portmon.exe REGMON.HLP ADInsight.chm DMON.SYS PORTMON.HLP RootkitRevealer.chm ADInsight.exe du.exe procexp.chm RootkitRevealer.exe adrestore.exe efsdump.exe procexp.exe sdelete.exe Autologon.exe Eula.txt ProcFeatures.exe ShareEnum.exe autoruns.chm Filemon.exe procmon.chm ShellRunas.exe autoruns.exe FILEMON.HLP Procmon.exe sigcheck.exe autorunsc.exe handle.exe psexec.exe streams.exe Bginfo.exe hex2dec.exe psfile.exe strings.exe Cacheset.exe junction.exe psgetsid.exe sync.exe Clockres.exe ldmdump.exe Psinfo.exe tcpvcon.exe Contig.exe Listdlls.exe pskill.exe tcpview.chm Coreinfo.exe livekd.exe pslist.exe Tcpview.exe ctrl2cap.amd.sys LoadOrd.exe psloggedon.exe TCPVIEW.HLP ctrl2cap.exe logonsessions.exe psloglist.exe Volumeid.exe ctrl2cap.nt4.sys movefile.exe pspasswd.exe whois.exe ctrl2cap.nt5.sys newsid.exe psservice.exe Winobj.exe dbgview.chm ntfsinfo.exe psshutdown.exe WINOBJ.HLP Dbgview.exe pagedfrg.exe pssuspend.exe ZoomIt.exe Desktops.exe pagedfrg.hlp Pstools.chm diskext.exe pdh.dll psversion.txt Diskmnt.exe pendmoves.exe RegDelNull.exe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值