This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

NT kernel keymap hack I requested



Many thanks for all the responses to my question about remapping the
control key function to the caps lock key.  The rest of this note is a
report on what I found.

Two solutions were recommended:

1. I tried "ctrl2cap" from http://www.ntinternals.com/ntutil.htm, an
   add-on filter.  It worked fine, although the README has a confusing
   typo in it; beware.  Later I decided to use another solution (see
   below).  Working entirely by guesswork (and none too efficiently,
   as you will see), in order to get rid of ctrl2cap I searched for
   everything in the registry that matched "ctrl2cap" and deleted it.
   Then I rebooted, but it was still being loaded at boot time.  I
   searched the registry again, this time finding something about
   ctrl2cap in a key called something like "legacy".  I deleted it
   from there and rebooted.  It was still being loaded, although yet
   another search of the registry found nothing.  Bizarre, eh? So I
   physically deleted the file from the drivers directory.  Now it was
   gone, and caps lock was its old annoying self again.  (You can see
   what a neophyte I am in NT.  Yoicks, how very strange it is to have
   all the system stuff stored, used, and edited entirely in binary
   form.  Why is that considered advantageous, I wonder?  Just to set
   the PATH variable I have to literally type everything in by hand,
   even though what I was typing in I had generated by means of a
   "find" process that looked for executables.  All this seems to me
   quite weird and suboptimal in terms of human productivity.  But
   then, we must remember I'm an SGML bigot, as well as a Unix and
   Emacs bigot.)  In the end, I think ctrl2cap's primary purpose and
   benefit is as an example of NT driver hacking; full source is
   included with it, which is very nice indeed.

2. Chuck Bogorad suggested editing the registry in such a way as to
   provide a keymap.  This "more native" solution was more appealing
   to me, and I'm using it now.  I had a lot of unnecessary trouble
   using this solution because I'm so inexperienced with regedit.
   Chuck finally sent me a screen shot that set me straight, although,
   oddly, judging from the screen shot, Chuck's binary value regedit
   screen for NT 4.0 looks quite different from mine.  Anyway, after
   editing his instructions in such a way that I think maybe even I
   could have understood them the first time, I'm attaching them
   below, FYI.

-Steve

--
Steven R. Newcomb, President, TechnoTeacher, Inc.
srn@techno.com  http://www.techno.com  ftp.techno.com

voice: +1 972 231 4098 (at ISOGEN: +1 214 953 0004 x137)
fax    +1 972 994 0087 (at ISOGEN: +1 214 953 3152)

3615 Tanner Lane
Richardson, Texas 75082-2618 USA


********************************************************************************

From: "Chuck Bogorad" <chuck@ethereal.ru>
To: "Steven R. Newcomb" <srn@techno.com>, "gnu-win32" <gnu-win32@cygnus.com>
Subject: Re: NT kernel keymap hack
Date: Sun, 11 Jan 1998 18:42:47 +0300

>Does anybody know of an NT kernel hack that switches the caps-lock key
>with the control key (that lies under the shift key on most machines
>these days)?  I just can't adjust to the idea that the control key
>should be so inaccessible.  I'm an Emacs/bash bigot, and I like using
>the control key a lot.

Sure, enjoy (author is unknown). on my system, i totally disabled CAPS
LOCK, so both keys act like CONTROL key.

my system (caps -> ctrl) has this setting:
00 00 00 00 - 00 00 00 00 - 02 00 00 00 - 1d 00 3a 00 - 00 00 00 00

=== cut ===

To the following key in your NT registry:

HKEY_LOCAL_MACHINE
  \System
    \CurrentControlSet
      \Control
        \KeyBoard Layout

add the value (i.e., NOT a key)  "Scancode Map"

The value must be a "binary" value, i.e., NOT a "string" value and NOT
a "DWORD" value, although, purely for purposes of explanation, it is
described below in terms of DWORDs.

Scancode Map is a binary value that lets you map keystrokes in the
low-level keyboard drivers in NT.  As a result you don't have to worry
about applications bypassing mappings that you've done at a higher
level (i.e. it just works).

Here's the format of the value:

        DWORD:  0x00000000      header

        DWORD:  0x00000000      header

        DWORD:  length (in DWORDs) of remaining data, including terminating
                DWORD

        DWORD:  mapping 1

        ...

        DWORD:  mapping n

        DWORD:  0x00000000      terminating null DWORD

Each mapping DWORD  has two parts: the input scancode, and an output
scancode.  To map scancode 0x1d (left control) to scancode 0x3a (caps
lock), you want a value of 0x003a001d.  Note that this does not swap the
keys.  Using just this mapping value, both the left control and the caps
lock key will behave as caps-lock.  To swap, you also need to map 0x3a to
0x1d, using 0x001d003a.  So, the complete registry value you'd use to swap
left-control and caps-lock is:

00 00 00 00 00 00 00 00 03 00 00 00 1d 00 3a 00 3a 00 1d 00 00 00 00 00

This works on NT 4.0, I don't know about 3.51.  This registry value is
system wide, and can't be made user-specific.  It also only takes affect on
reboot.

=== cut ===
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]