About Keyboard Button Presses

Learn or Teach General Knowledge Related to Coding or Hacking

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

About Keyboard Button Presses

Postby TheInsaneAssassin » Wed Apr 23, 2008 6:53 am

How can keyboard button presses be simulated and how can they be simulated without them possibly being identified as simulated by my computer? I am aware that I could just simulate them with hardware that my computer identifies as a keyboard, but I don't think I have something that could be used like that.
Also, I would like to mention that I have a controller in which I can program keyboard buttons to any of the buttons on the controller. How can I find out if my controller is sending the exact same data a keyboard would send or if it's just simulating the keyboard button presses through software on my computer?

Note: I hope this is the right section and I probably have no idea what I'm talking about. Also, it's actually more important that GameGuard doesn't know what I'm doing than my computer not knowing.
TheInsaneAssassin
I Ask A Lot Of Questions
 
Posts: 12
Joined: Sat Jul 22, 2006 5:41 am

Postby Lobbie » Wed Apr 23, 2008 7:53 am

I assume you want to automate the process of key presses to perform repetitive actions for eg like one of my mate did on DiabloII to automate "his player to kill the cows" so as to gain player XP.

Normally, I would say your controller will send the same data as your keyboard presses. The only difference between what you intend to do vs what you are doing now is automation vs manual.

If you intend to code a mini app and knows VB, you could possibly use the Application.SendKey method to achieve this. Alternatively, do a google and you may find these macro utilities already available for some games.

Cheers,
Lobbie
Lobster in Szechuan sauce, Baked Lobster in Cheese, Lobster in Ginger and Shallot....YUM!

ImageImage
By JB Gzn & emocore

Muahahaha...I am the LobsterMaster...Muahahaha
Image
User avatar
Lobbie
Been Around
 
Posts: 286
Joined: Fri Mar 07, 2008 7:56 pm
Location: Australia

Postby TheInsaneAssassin » Wed Apr 23, 2008 8:05 pm

I actually don't want to automate anything to perform repetitive actions. The problem is that I just want to use a controller for a particular game and I don't think Nexon wants people using controllers for their game. There is a possibility of getting banned for using a controller with their game. Although, I still need to confirm this.

I think it is actually less than likely that my controller sends the exact same data to my computer that a keyboard would. I suspect that when I hit a button on my controller the same data is sent for each individual button that is pressed every time regardless of what I have programmed the controller's buttons to do. I suspect this because I believe the software that runs with the controller receives the button press data and simulates a keyboard button press corresponding with my controller's current configuration. It would make less sense to put software on the controller itself to make the buttons programmable than it would to hardwire the controller to do only the same things every time and put software on the computer that let's one change how the computer reacts to the exact same data being received. This is why I think that I will only get simulated keyboard button presses when using my controller. I need something as close to the real deal as possible.

Perhaps somebody could enlighten me more on the details of how a keyboard works. I know that it sounds like a simple thing, but I suspect that I don't quite know all the details that might be important to me.
Note: If anything I typed isn't clear, please ask me to clarify.
TheInsaneAssassin
I Ask A Lot Of Questions
 
Posts: 12
Joined: Sat Jul 22, 2006 5:41 am

Postby L. Spiro » Wed Apr 23, 2008 8:57 pm

To be honest this is something I need to study as well.
SendInput() simulates keystrokes and does not work on DirectX games depending on how they handle input.
Furthermore it can be hooked, but this can be bypassed fairly easily.

I believe the only way to get true from-the-keyboard automated button presses is by using a kernel-mode driver, and this is something I plan to study later to improve MHS’s functionality as a bot tool.

But it will be a while, and I believe the method is very hacky. There is no native method for doing this so you would have to use tricks to get the HAL function that handles this and if not done correctly it would break on every new version of Windows, having to be manually recoded for each new one.

Though if someone knows better do feel free to correct me. It will be valuable information for the sake of MHS as well.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby mezzo » Wed Apr 23, 2008 9:53 pm

I was reading a bit about the above, and I came to understand that each HW device that is directinput compatible is either seen as a keyboard or as a joystick.. Only one of these is possible. The manufacturer of each of these devices need to provide their drivers with a uniq UID so that dxinput can make the distinction.
I haven't gottent to the point of checking actual source code, but from what I read about emulating keyboards through directinput manipulation, it seems possible to fool directinput into thinking that your real device is actually something else (joypad becomes a keyboard, etc).

(I haven't gone that very deep into it, as I only want it for botting purposes, so I am only interested in how I can create a 'fake' keyboard, so that I can send keystrokes, without the game knowing/thinking that I used sendinput).

On a sidenote, I use a logitech G15 and a Belkin nostromo N52. Both of these are able to execute 'macro' style keypresses in just about every game I have ever played, with GG and other protection schemes.
Even the ones that don't allow sendinput through MHS LSS.

I would LOVE to know how this works, perhaps reuse their driver DLL's or somehow exploit what they do to use it in MHS to simplify the sending of keystrokes.. (sendinput works in a lot of applications, but not the games that I want to use it in most).

UPDATE: "tricks of the windows game programming gurus" has a lot of info about directinput, joysticks, joypads n keyboards. All related to dxinput, which is what I think is required to do what you want.
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby LIVEAID » Thu May 08, 2008 5:03 pm

and this is something I plan to study later to improve MHS’s functionality as a bot tool.



wow ive been waiting for MHS to become more in the way so we can bot lol im sick of sittin there for hours on end training in most games..

WOOT go L.Spiro
Code: Select all
Nothing can stop the man with the right mental attitude from achieving his goal; nothing on earth can help the man with the wrong mental attitude.
- Thomas Jefferson
User avatar
LIVEAID
Been Around More
 
Posts: 314
Joined: Tue Jan 29, 2008 11:36 am
Location: Google Inc.

Postby devsed » Fri Jan 30, 2009 3:55 am

This is an old topic, but an interesting one. If theoretically anti-cheat engines begin looking for attempts to send keys via DX or not, it could become trickier.

Perhaps write a keyboard driver for a non-existant keyboard, so you could [from windows' point of view] send real physical keyboard strokes to the OS?

A lil bit of a keyboard drivercode at:
http://www.geocities.com/dev_das_2k/keyboard_driver.html
your answers = `head /dev/urandom`
devsed
I Have A Few Questions
 
Posts: 8
Joined: Thu Jan 29, 2009 1:35 am

Postby Premium » Tue Jul 28, 2009 11:28 pm

Hi,

if I understand you correctly you want to simulate keystrokes in a game.

If this is your question, then i would suggest you use C++. If you are running windows as your OS you need to include the windows header file.

A simple example would be:

Code: Select all
#include <windows.h>

int main(void)
{
// Comment: Press Key 0x11 (CTRL)

   keybd_event(0x11, 0, 0, NULL);       

// Comment: Stop pressing Key 0x11 (CTRL)       
       
   keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0);

   return 0;
}
Ahnungslosigkeit ist die Objektivität der schlichteren Gemüter.


- H. Schmidt

Knowledge is the only asset that increases when you share it with others.
User avatar
Premium
I Have A Few Questions
 
Posts: 4
Joined: Fri Jul 17, 2009 1:13 pm

Postby spunge » Wed Jul 29, 2009 1:52 am

keybd_event is a wrapper to SendInput, which has already been suggested. If SendInput doesn't work, keybd_event won't work as well.

DirectInput is a deprecated technology, you should expect more and more games to handle input without DirectInput. For the games that still use DirectInput, a simple interface hook on ISomeBigInterfaceName:GetDeviceState() should do the trick.
spunge
NULL
 
Posts: 121
Joined: Sun Jul 27, 2008 4:58 am
Location: VEH callback

Postby L. Spiro » Wed Jul 29, 2009 7:15 am

Direct Input does not use any special interfaces with the mouse hardware; it catches Windows messages just as you could on your own using WM_KEYDOWN etc.

SendInput() causes the same messages to be sent, which means it works on Direct Input, if you send it to the correct (hidden) window.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby RoboC » Sun Aug 23, 2009 10:20 pm

A HID (Human Interface Device) can send keypresses without any botting or macro tool legitly.
Image
User avatar
RoboC
Been Around More
 
Posts: 360
Joined: Fri Apr 25, 2008 1:51 pm
Location: Behind You

Re: About Keyboard Button Presses

Postby L. Spiro » Thu Nov 19, 2009 3:42 pm

SimulateKeyEvent() exists only one Symbian devices.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: About Keyboard Button Presses

Postby denispn » Wed Apr 28, 2010 8:12 am

If i unsderstood what you meant to say, you can use GlovePIE.

GlovePIE is a free Programmable Input Emulator, originally for the Essential Reality P5 Virtual Reality Glove, which now supports a huge range of input devices, especially the Nintendo Wii Remote (Wiimote).
GlovePIE is used to map gestures, button presses, and other actions to keyboard keys, mouse input, or joystick buttons and axes.


http://glovepie.org/

Cheers,
ctl3d32
denispn
Hacker Smacker
 
Posts: 43
Joined: Wed Dec 26, 2007 9:45 am


Return to Knowledge Base

Who is online

Users browsing this forum: No registered users and 0 guests