Send output to keyboard buffer

This is a discussion on Send output to keyboard buffer within the C Programming forums, part of the General Programming Boards category; Hi there I have a question about a technique I've managed to find out about called "Stuff Keys" I think. ...

  1. #1
    Registered User DReynolds's Avatar
    Join Date
    Jun 2007
    Location
    Norwich, UK
    Posts
    2

    Question Send output to keyboard buffer

    Hi there

    I have a question about a technique I've managed to find out about called "Stuff Keys" I think. Used in password crackers and the like.

    Basically, sending output from the program to the keyboard buffer in the form of scan codes so that the computer registers the output as just input from a keyboard.

    I'm fairly new to the more advanced output techniques than simple printing on screen. Could anyone point me in the direction of a good code example for this?

    I found an example on the "A to Z of C" (can't remember the address right now) but that really wasn't very useful. Also I have found examples of information in the keyboard buffer and it seems that it is receiving a single scancode for the 'make' of the key, but it was my impression that scancodes had a 'make' and 'break' code and that they were sent to the buffer seperately, they key being assumed to be held down until the break code is sent.

    I would like to be able to do it like this as it makes it a hell of a lot simpler handling combonations and sequences of keys.

    If anyone knows of any examples online of this type of technique I would be very greatfull if you could point me in the direction of this. And whether this technique is platform specific (I figured it wasn't because it seems to be more hardware besed signals) because I am currently coding for a Linux box, but will be porting to Windows (and hopefully Mac) in the future.

    As a final note I'd like to say that this code is NOT being used for anything like a password cracker. I'm coding an HID which will interface with keystroke based commands using the keyboard buffer to make it completly compatable with any program in the foreground.

    Any help would be very appreciated. Manny Thanks.

    Danny

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Windows has a couple varieties of this functionality. The one that seems most appropriate for an HID is discussed in the MS library, here:

    http://msdn2.microsoft.com/en-us/library/ms645543.aspx

    There is also a library I saw mentioned when I googled this, called SendInput.

  3. #3
    Registered User DReynolds's Avatar
    Join Date
    Jun 2007
    Location
    Norwich, UK
    Posts
    2
    Thanks a lot for the link

    I've checked it out and it seems like it's going to be very useful, the other one you found as well. However it does seem to be a Windows thing and although the project will be going to Windows in the next stage, so that will be very helpful, currently being developed on Linux. Do you are anyone else have an idea of where I should be looking to either do this at a lower level (sort of, hardware code) or the same sort of thing on a Linux/Unix Box? (The only current coding/testing systems are running Slackware, Mandriva and Solaris).

    Or, with the idea of it being lower level interfacing, writing scancodes directly to memory segments etc. Should I be looking at a language like assembler rather than C? (I hope not, cause I like C, the rest of the engine is in C and, well, assembler scares me)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Windows) Send keyboard and mouse to another program?
    By Chrisname in forum Windows Programming
    Replies: 4
    Last Post: 06-13-2009, 06:13 PM
  2. Using recv() and send()
    By Sam_bham in forum C Programming
    Replies: 3
    Last Post: 06-08-2004, 04:36 PM
  3. DirectSound - multiple sounds
    By Magos in forum Game Programming
    Replies: 9
    Last Post: 03-03-2004, 03:33 PM
  4. Packing buffer to send it (casting)
    By gustavosserra in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2004, 05:10 PM
  5. Does anyone Know How to..?
    By kwigibo in forum C Programming
    Replies: 12
    Last Post: 09-20-2001, 08:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21