29-Jan-96  5:08:06-GMT,6176;000000000015
Received: from skinner.cs.uoregon.edu (skinner.cs.uoregon.edu [128.223.4.13]) by watsun.cc.columbia.edu (8.7.3/8.7.3) with SMTP id AAA08834 for <fdc@watsun.cc.columbia.edu>; Mon, 29 Jan 1996 00:07:59 -0500 (EST)
Received: from majestix.cs.uoregon.edu by skinner.cs.uoregon.edu with SMTP id AA15611
  (5.65/IDA-1.4.2 for fdc@watsun.cc.columbia.edu); Sun, 28 Jan 96 21:07:51 -0800
Message-Id: <9601290507.AA15611@skinner.cs.uoregon.edu>
To: Frank da Cruz <fdc@watsun.cc.columbia.edu>
Subject: Re: ctrl2cap.vxd 
In-Reply-To: Your message of "Sun, 28 Jan 1996 11:19:15 EST."
             <CMM.0.90.4.822845955.fdc@watsun.cc.columbia.edu> 
Date: Sun, 28 Jan 1996 21:07:50 -0800
From: mark eugene russinovich <mer@majestix.cs.uoregon.edu>

Hi, Frank,

The status of ctrl2cap is that I wrote it -it is freeware. Here
is the source. The only restriction is that my consent is required
for commercial use. Note that this source only changes caps-lock into
control - I have no use for caps-lock.

-Mark

----------------------------------------------------------------------
;****************************************************************************
;                                                                           *
; CTRL2CAP								    *
;								  	    *
; Copyright (c) 1995 Mark Russinovich                                       *
;                                                                           *
; You may not use this for commercial purposes.                             *  
;									    *
;****************************************************************************
;									    *
; CTRL2CAP: Switches the caps and control key universally (no exceptions)   *
;                                                                           *
;****************************************************************************

;===========================================================================
	page	,132
	title	ctrl2cap - ctrl2cap VxD
	name	ctrl2cap.vxd
;===========================================================================
;
;   Module:
;	Contains everything
;
;===========================================================================
;
;   Functional Description: - switches ctrl and caps universally (we don't
;			      want the DOS ctrl2cap because it will defeat
;			      the purpose)
;			
;============================================================================

;============================================================================
;				I N C L U D E S
;============================================================================
.386p
	.xlist
	include	vmm.inc
	include vwin32.inc
	include vkd.inc
	include vmd.inc
	include debug.inc
	include ctrl2cap.inc
.list

;============================================================================
;		   I N I T I A L I Z A T I O N  D A T A
;============================================================================

VXD_IDATA_SEG


VXD_IDATA_ENDS

;============================================================================
; 			  P U B L I C   D A T A
;============================================================================

VXD_LOCKED_DATA_SEG

; Previous routine on keyboard hook
Keyboard_Proc		dd	0

VXD_LOCKED_DATA_ENDS


;============================================================================
;	           D E V I C E   D E C L A R A T I O N
;============================================================================

VXD_LOCKED_CODE_SEG

; registration block

DECLARE_VIRTUAL_DEVICE CTRL2CAP,	\
	CTRL2CAP_MAJOR_VERSION, 	\
	CTRL2CAP_MINOR_VERSION,	        \
	Ctrl2cap_Control,,	        \
	UNDEFINED_INIT_ORDER

;============================================================================
;			    M A I N   C O D E
;============================================================================

;============================================================================
;
; Ctrl2cap_Control - Device control procedure for the VxD. Dispatches all
;                  Windows VxD messages.
;
; Exit:	If carry clear then
;	    Successful
;	else
;	    Control call failed
;
; Destroys: EAX, EBX, ECX, EDX, ESI, EDI, Flags
;
;============================================================================

public Ctrl2cap_Control
Ctrl2cap_Control PROC NEAR

	Control_Dispatch INIT_COMPLETE, Ctrl2cap_Device_Init
	clc
	ret

Ctrl2cap_Control ENDP

VXD_LOCKED_CODE_ENDS

;==============================================================================
;		 	 P A G E A B L E   C O D E
;==============================================================================

VXD_PAGEABLE_CODE_SEG

;============================================================================
;
; Ctrl2cap - keyboard hook switches the control and caps when it sees those
; 	     keys come through. We've got to switch both the up key and the
;	     down key.
;
; Entry: CL - Scancode of key pressed.
;
;============================================================================

BeginProc Ctrl2cap, Hook_Proc Keyboard_Proc

        mov     dl, cl
        and     dl, 7Fh
	cmp	dl, 3Ah
	jnz	chain
	and	cl, 80h
	or	cl, 1Dh

	; call the previous hooker
chain:
	call	Keyboard_Proc
	clc				; let the key through
	ret

EndProc Ctrl2cap

VXD_PAGEABLE_CODE_ENDS

;============================================================================
;	   D E V I C E   I N I T I A L I Z A T I O N   C O D E
;============================================================================

VXD_ICODE_SEG

;============================================================================
;									
; Ctrl2cap_Device_Init
;									
;									
; Entry: ebx -> System VM handle (not used)
;        edx -> Reference data from real mode init portion
;
; Exit: If successful then
;           Carry flag is clear
;       else
;           Carry flag is set to indicate an error -- Device not initialized
;
;============================================================================

BeginProc Ctrl2cap_Device_Init

	GetVxDServiceOrdinal eax, VKD_Filter_Keyboard_Input
	mov	esi, offset32 Ctrl2cap
	VMMCall	Hook_Device_Service
	mov	Keyboard_Proc, esi
	clc
	ret

EndProc Ctrl2cap_Device_Init

VXD_ICODE_ENDS

end

30-Jan-96  7:54:22-GMT,914;000000000005
Received: from skinner.cs.uoregon.edu (skinner.cs.uoregon.edu [128.223.4.13]) by watsun.cc.columbia.edu (8.7.3/8.7.3) with SMTP id CAA11690 for <fdc@watsun.cc.columbia.edu>; Tue, 30 Jan 1996 02:54:19 -0500 (EST)
Received: from majestix.cs.uoregon.edu by skinner.cs.uoregon.edu with SMTP id AA29998
  (5.65/IDA-1.4.2 for fdc@watsun.cc.columbia.edu); Mon, 29 Jan 96 23:54:12 -0800
Message-Id: <9601300754.AA29998@skinner.cs.uoregon.edu>
To: Frank da Cruz <fdc@watsun.cc.columbia.edu>
Subject: Re: ctrl2cap.vxd 
In-Reply-To: Your message of "Mon, 29 Jan 1996 10:37:36 EST."
             <CMM.0.90.4.822929856.fdc@watsun.cc.columbia.edu> 
Date: Mon, 29 Jan 1996 23:54:11 -0800
From: mark eugene russinovich <mer@majestix.cs.uoregon.edu>


>Terrific, thanks.  Would you have any objection to our distributing it
>with Kermit 95, with credit of course?  Info about Kermit 95 is at:

That would be fine.

Thanks,

-Mark

30-Jan-96 18:01:42-GMT,1148;000000000001
Received: from skinner.cs.uoregon.edu (skinner.cs.uoregon.edu [128.223.4.13]) by watsun.cc.columbia.edu (8.7.3/8.7.3) with SMTP id NAA10218 for <fdc@watsun.cc.columbia.edu>; Tue, 30 Jan 1996 13:01:40 -0500 (EST)
Received: from majestix.cs.uoregon.edu by skinner.cs.uoregon.edu with SMTP id AA05107
  (5.65/IDA-1.4.2 for fdc@watsun.cc.columbia.edu); Tue, 30 Jan 96 10:01:37 -0800
Message-Id: <9601301801.AA05107@skinner.cs.uoregon.edu>
To: Frank da Cruz <fdc@watsun.cc.columbia.edu>
Subject: Re: ctrl2cap.vxd 
In-Reply-To: Your message of "Tue, 30 Jan 1996 12:06:11 EST."
             <CMM.0.90.4.823021571.fdc@watsun.cc.columbia.edu> 
Date: Tue, 30 Jan 1996 10:01:36 -0800
From: mark eugene russinovich <mer@majestix.cs.uoregon.edu>


Okay, Frank, here it is:

;****************************************************************************
;
; Ctrl2cap header file
;
;****************************************************************************

; Ctrl2cap Info Equates		
				
	Ctrl2capName 	EQU	<'CTRL2CAP   VXD  '> 	;Must be 16 chars
	Ctrl2capRev	EQU	00H

; Ctrl2cap version equates

CTRL2CAP_MAJOR_VERSION	EQU	1
CTRL2CAP_MINOR_VERSION	EQU	0