Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

keyboard filter


  • Please log in to reply
48 replies to this topic
Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005

I'll deliver an updated library/driver with new samples

It sounds wonderful. Will it be a dll, which can be used from AHK, or from pure C programs?

Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
Couple of days ago,
I tried following C Codes;
But, it made Error messages, such as
""...bufferoverflowk.lib(gs_support.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]""



VOID
KbFilter_ServiceCallback(
    IN PDEVICE_OBJECT DeviceObject,
    IN PKEYBOARD_INPUT_DATA InputDataStart,
    IN PKEYBOARD_INPUT_DATA InputDataEnd,
    IN OUT PULONG InputDataConsumed
    )
{
	PDEVICE_EXTENSION   devExt;

	switch (InputDataStart->MakeCode)	
		{
		   case 0x01C:   						//	Return 		Keypad Enter
		      InputDataStart->MakeCode = 0x054; 		
		      break;
		   case 0x01D:   						//	Left Control	Right Control
		      InputDataStart->MakeCode = 0x055; 		
		      break;
		   case 0x02A:   						//	Left Shift		?????
		      InputDataStart->MakeCode = 0x059; 		
		      break;
		   case 0x035:   						//	/?				Keypad /
		      InputDataStart->MakeCode = 0x05A; 		
		      break;
		   case 0x036:   						// 	Not sure		Right Shift
		      InputDataStart->MakeCode = 0x079; 		
		      break;
		   case 0x037:   						//	Keypad *		Print Screen
		      InputDataStart->MakeCode = 0x06D; 					
		      break;		
		   case 0x038:   						//	Left Alt		Right Alt
		      InputDataStart->MakeCode = 0x062; 					
		      break;		
		   case 0x047:   						//	Keypad 7		Home
		      InputDataStart->MakeCode = 0x063; 					
		      break;		
		   case 0x048:   						//	Keypad 8		Up
		      InputDataStart->MakeCode = 0x06C; 					
		      break;		
		   case 0x049:   						//	Keypad 9		Page Up
		      InputDataStart->MakeCode = 0x06E; 					
		      break;		
		   case 0x04B:   						//	Keypad 4		Left
		      InputDataStart->MakeCode = 0x06F; 					
		      break;		
		   case 0x04D:   						//	Keypad 6		Right
		      InputDataStart->MakeCode = 0x070; 					
		      break;		
		   case 0x04F:   						//	Keypad 1		End 
		      InputDataStart->MakeCode = 0x074; 					
		      break;		
		   case 0x050:   						//	Keypad 2		Down
		      InputDataStart->MakeCode = 0x075; 					
		      break;		
		   case 0x051:   						//	Keypad 3		Page Down
		      InputDataStart->MakeCode = 0x076; 					
		      break;		
		   case 0x052:   						//	Keypad 0		Insert
		      InputDataStart->MakeCode = 0x077; 					
		      break;		
		   case 0x053:   						//	Keypad .		Delete 
		      InputDataStart->MakeCode = 0x078; 					
		      break;		
		}

	devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

	(*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
		devExt->UpperConnectData.ClassDeviceObject,
		InputDataStart,
		InputDataEnd,
		InputDataConsumed);
}

Unfortunately I am not at all expert in this area.
So, for the first time in my life time I downloaded WDK and tried to 'build -ceZ' stuffs..

The result is disastrous..

My intention was like this.

To Use additional PS/2 keyboard with full scan code under my control.
Which means that any of the keyboard scan codes should not the same one with main keyboard scan codes.

The final goal is to use additional USB keyboard with the same purpose.

Yorick
  • Guests
  • Last active:
  • Joined: --

I'll deliver an updated library/driver with new samples

It sounds wonderful. Will it be a dll, which can be used from AHK, or from pure C programs?


There's already a library that can be used from any .net language on my site, it uses the driver I've built. Go there, there's a sample right now, I'll post more and update the library with new functionality.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Yorick, Maybe the best use of AHK was to write a prototype of a functional part of a large program, test it, tune its user interface, and then re-write it in a compiled language, like C. This does not work with static libraries, only with dll's. Also, if your really nice library was going to be used as part of another program, the need for installing low-level drivers in the client machine not pleasant. Is there any chance to do similar things without messing with the setup of the PC's of the users?

Yorick
  • Guests
  • Last active:
  • Joined: --

Yorick, Maybe the best use of AHK was to write a prototype of a functional part of a large program, test it, tune its user interface, and then re-write it in a compiled language, like C. This does not work with static libraries, only with dll's. Also, if your really nice library was going to be used as part of another program, the need for installing low-level drivers in the client machine not pleasant. Is there any chance to do similar things without messing with the setup of the PC's of the users?

Humm..., have you read the topic in which you are?
Another thing is that I'm not planning to do anything to join my driver/library with AutoHotkey, given that it's just an alternative that requires driver installation.

Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
Dear, Yorick !
Can you help me out ? I am a prince in distress.

I know the codes above are silly one, but it was what I can do best.
I used all the same file in C:\WinDDK\6001.18002\src\input\kbfiltr except the .c file (it is just patch work of others).

I posted this agony to some expert group websites in my country, nooobody was interested in.
Is it too hard to get there ? or they thought it is just waste of time to play with beginner ? I do not know.

Can you please make .sys file for me ? I guess that is all I need.
Many thanks.

Yorick
  • Guests
  • Last active:
  • Joined: --

Dear, Yorick !
Can you help me out ? I am a prince in distress.

I know the codes above are silly one, but it was what I can do best.
I used all the same file in C:\WinDDK\6001.18002\src\input\kbfiltr except the .c file (it is just patch work of others).

I posted this agony to some expert group websites in my country, nooobody was interested in.
Is it too hard to get there ? or they thought it is just waste of time to play with beginner ? I do not know.

Can you please make .sys file for me ? I guess that is all I need.
Many thanks.


Alas poor Hamlet, I know you. :D (unbelievable how this wolrd is small :lol: ).

Humm, if you are a beginner in programming in general I do not recommend starting with drivers, but if you know C and want to start with drivers it's ok. I recommend first trying to build the driver from WDK and see if it worked. If so just do little modifications on the driver. You can send me a mail to solve any doubt or you may use the drivers I've already built. See yah.

Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
Dear king's jester.

As far as I know, I need 6 files to complete building process.
kbfiltr.c (the only file I modified, I already posted in this article.)
kbfiltr.h
kbfiltr.inf
kbfiltr.rc
makefile
sources
Last 5 files are the same original ones in C:\WinDDK\6001.18002\src\input\kbfiltr directory.

I had error messages while "build"ing the kbfiltr.c file with WDK program-->
...\bufferoverflowk.lib(gs_support.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
...\objchk_wlh_x86\i386\kbfiltr.sys : error LNK1120: 1 unresolved externals

I am sorry, but I think there is nothing I can do any farther.

Pls help me. I feel like bounded in a nut shell.

Thanks.

Yorick
  • Guests
  • Last active:
  • Joined: --
Hi, I'm not sure whether this is the case, but if all the source your kbfiltr.c has is the KbFilter_ServiceCallback function your driver will not build. You must provide an entry point for the system, and this is the DriverEntry function, beyond that, a lot of functions on the original kbfiltr.c are of vital importance . See ya :wink: .

Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
I got it. I got it.
Your advice was great one. Thanks Yorick !

I should have used all the contents in original kbfiltr.c file.
I used very small portion of that file and modified it and deleted all the rests. I was wrong.

As soon as I saw Your advice, I made new one.
Which has all the original contents and some of my own codes too.

Build it nicely.
It worked perfectly !!

Thanks again Yorick, I am pretty sure, you are born again !!!


And I have to try it out with two USB keyboards.
Umm......

Bye..

Hamlet
  • Members
  • 302 posts
  • Last active: Mar 23 2014 03:37 PM
  • Joined: 22 Jan 2009
Thanks, Nyo !! (for USB hints)
Thanks, Yorick !! (for Building process)
Thanks, joelhewitt !! (for DVORAK codes)
Thanks, GeomanNL !! (for Extention scan codes and this posting itself)

It works with USB Keyboards too.
And you do not have to re-boot your computer,
if you want original one, you just roll-back or update it.
(with PS/2, you have to re-boot.)
It looks like it distinguish every USB port.

I am using 32bit Vista, so someone who read this post have to make codes for 64bit version.. Sorry, It is out of my ability. hahaha....

Bye, guys...

Yorick
  • Guests
  • Last active:
  • Joined: --
Very good Hamlet :D, I'm happy you were able to accomplish what you desired. Now that you have done all that I'd like to suggest you to use my tool. It works with a driver like yours, that must be installed only once. But it is much powerfull because it doesn't do any mapping logic inside itself. It just wait for commands from user mode, a common program not a driver one, this one is the real filter and you'll be able to stop it at any moment. It works with mice too. Visit http://www.oblita.com/hooking-part1.
The only thing is that soon I'll update the site with a new library that is much better and post more basic samples.

See ya.

98acura
  • Guests
  • Last active:
  • Joined: --
I downloaded this and attempted to install it with no luck. I am using Vista64. What would be required to make this work? Also how would I go about installing this correctly?

98acura
  • Guests
  • Last active:
  • Joined: --
Ok, so I figured out I need to build my own driver from the sources. I modified the kbfiltr.c file with the contents from the zip file. Driver is built fine. However, when I attempt to install the file, it tells me that the driver doesnt support my version of windows.

What flags would I need to use while building the file? I am using a core 2 duo, and vista 64. Should I be compiling for amd64, or ia64 ?

Gismo
  • Guests
  • Last active:
  • Joined: --
have anybody a filterdriver for Windows xp USB HID-Keyboard that disabled the sleep button ?

please i canĀ“t find one on the net :-(