News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Keyboard hook

Started by szgabor, November 05, 2005, 06:35:43 PM

Previous topic - Next topic

szgabor

Hi all!
I made a "driver" app for multimedia keyboards in Delphi. However, the standard keyboard hook provided by Windows is not good for this purpose, because it does not work when there is no (standard) window in focus (this is the case with most of the games and this also causes a major bug). According my current knowledge, I need to write a KMD to circumvent this limitation. And I need to work in MASM if I don't want to buy the Microsoft DDKs.
Unfortunately I have no deep knowledge of drivers, nor of ASM programming. I also know this is a very hard topic of programming... So if anyone could help putting this one thing together... The KMD I need has to send all keystrokes to my app, and cancel out certain ones according to a list that my app would supply.
Important: currently I have NO internet at home, so don't expect quick replies! Dump info here and I'll read when I have acces to internet again.
Many thanks in advance!!! Anyone who helps will receive dedicated copies of my app!!!

sluggy

Don't take this as being rude, but we typically don't assist brand new members with writing kernel mode drivers or keyboard hooks when they have no knowledge in that area, simply because 99.9% of those users are up to no good. It sounds harsh, but i hope you understand.

However, you could be in the 0.1% who are legitimately looking for information, so i will point you to this web page, it contains some KMD tutorials, and a copy of the Iczelion tutorials, all of which will help you.

If you are in that 0.1%, then good luck with your research  :P

Retsim_X

im with sluggy.

i was one unfortunate person who un knowingly put the keybarod hook example at iczeliaons site on a disk and tryed to look at another file on the disk at school and was kicked off the schools computers for the rest of this year

beacuase it was a TROJAN or so i was told. i have steered very clear of this sort of stuff as there are so many people out there who know little and want us to help them write viri and other bad stuff


lol i might only be 16 but iv been progamming since i was 7 and iv seen some bad stuff in my time

yours retsim x

P1

szgabor,

Welcome to MASMforum!     :U

Read around the different areas and get a feel for the place.    :dance:

Read the help files and tutorials of MASM32.   It's better if you download the MASM32 package and install it. 

'Search' & Google are your friends for programming.  Then ask your questions.     

Keep coming back !!!  If you go away, then we were right.  But as the others pointed out, we have been deceived more times than not.  We collectively, prefer not to add to the trojan/virus problem in the world.

Add some detail to your profile.  Tell us more about yourself.  Participate in the forum, as you do your research and when you do get stuck something specific ask then for help.  And you will find us quite helpful.

Regards,  P1  :8)

Ghirai

No need to write a filter driver.

Just use a global keyboard hook, from ring3, there are a few ways to do this, and it works great.
You don't need any windows, or anything like that, and it's very mild when it comes to CPU usage.
MASM32 Project/RadASM mirror - http://ghirai.com/hutch/mmi.html

szgabor

I understand that you don't want to help anyone in writing malware, but don't know how could I prove that I'm with good intentions... Maybe a copy of my program in its current state is enough evidence?

Ghirai: the hook you mentioned isn't that one that can be created with the "SetWindowsHookEx" API call?

thx.

MusicalMike

I figure I should chime in here. One thing I would like to mention is, there is a nice example on hooks that ships with masm, source code included. I will admit, I know very little about hooks. I never use them. I never have to. I do know one thing, you can do some very nasty things with hooks. Hooks can give you dirrect access to the handles used by other programs, they can allow you to modify the behavior of a running program, many other scary things can be accomplished with them. The fact is, hooks are not toys. I am also with sluggy, on this one. But going back to my origonal point, if I hypothetically wanted to do something, the demo on hooks given in the masm package would more than enough. So I guess what I am asking is, if you are so cautious about creating a monster, why is the demo on hooks included in the masm package?

Ps. Just as a sanity check, I would like to know if I have proven myself trust worthy enough where such I question I might ask would be answered? If one of the moderators could answer me on this, I would appreciate that.

szgabor

This debate is pointless IMO. If someone wants to write something bad, he can read thousands of tutorials written by REAL bad guys (and I know some such forums too). You are not the only source of programming information.

There is a complete article on hooks on MSDN, and the hook demo in MASM is only an ASM translation of a C++, Delphi or VB example (there are dozens of such hook examples, it's not a top secret technique). My app in its current state already uses this hook, with the only difference of monitoring the keyboard instead of mouse. Anything can be used for bad purposes.

On the other hand, to write some really useful app (not the classic "database+math+100.000th solution for a common problem" type), you must go deeply into the guts of the system. Withholding information is never a good technique: it tends to effectively prevent the legitimate use of things but bad guys always find their way. This is proven in many aspects of life.

hutch--

This topic just ran out of puff. Forum rules are not a matter of debate, especially with new members. This topic is closed and will head for the scrapheap real soon.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php