| View previous topic :: View next topic |
| Author |
Message |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Wed Jul 08, 2009 1:35 am Post subject: DirectInput/SendInput question... |
|
|
A game I'm playing uses DirectInput for key control and I've written a program to send keys via SendInput (SendMessage() nor PostMessage() nor SendKeys() work, only SendInput).
Got any ideas on a way hook the game's DirectInput stream to inject keys so I do not have to do global DirectInput?
|
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Wed Jul 08, 2009 4:26 am Post subject: |
|
|
| It is possible using Postmessage and MapVirtualKeys, bitshift it left 16 times (<<). Not sure if it's the same for SendInput, since I never/rarely use it.
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Wed Jul 08, 2009 9:03 am Post subject: |
|
|
| Holland wrote: | | It is possible using Postmessage and MapVirtualKeys, bitshift it left 16 times (<<). | Doesn't work.
| mStorm wrote: | | Got any ideas on a way hook the game's DirectInput stream to inject keys so I do not have to do global DirectInput? | I did mine by hooking the key parser (function?) of the game. Hooking SendInput seemed way too complicated and I didn't want to put effort on this. Anyway, back the day I found this: http://www.gamedev.net/community/forums/topic.asp?topic_id=371104
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Wed Jul 08, 2009 3:30 pm Post subject: |
|
|
| Got any ideas on how to find the address of the function?
|
|
| Back to top |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Jul 08, 2009 4:47 pm Post subject: |
|
|
| mStorm wrote: | | Got any ideas on how to find the address of the function? |
LoadLibrary retrieves the address of a function as far as I know.
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Wed Jul 08, 2009 5:55 pm Post subject: |
|
|
| hm, yea.. but how do you know which function to hook?
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Wed Jul 08, 2009 6:13 pm Post subject: |
|
|
nwong LoadLibrary does not return the address of a function ... it returns the address to the base of a image that was either loaded or already is loaded...GetProcAddress ..does what it says..and maybe the article and code about getting input from the keyboardClass0 from a Native application could help this discussion along..
_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you. |
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Wed Jul 08, 2009 7:04 pm Post subject: |
|
|
| Directly calling the WndProc works as well. I think...
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Thu Jul 09, 2009 7:26 am Post subject: |
|
|
BanMe, I read up on the keyboard input from a native app and it's pretty interesting.
So you would create a nativekeyboard class while injected and channel the keys in this way?
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Jul 09, 2009 9:39 am Post subject: |
|
|
| mStorm wrote: | | Got any ideas on how to find the address of the function? | It needs some reverse engineering.. :)
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Thu Jul 09, 2009 11:25 am Post subject: |
|
|
| Jani wrote: | | mStorm wrote: | | Got any ideas on how to find the address of the function? | It needs some reverse engineering..  |
Enlighten me!
What's a good place to start?
Maybe flood the game with a specific string of keys and freeze the process, then do a memory scan for the dinput scancodes?
Maybe find the read function in dinput8.dll that is loaded into memory and do something with that?
| dnsi0 wrote: | | Directly calling the WndProc works as well. I think... |
I don't know if this will work because they game uses DirectInput which deals with scancodes on the same level as Windows ( I believe).
SendMessage/PostMessage nonsense doesn't quite work with DirectInput games; at least from my experience. Unless someone knows something I don't.
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Thu Jul 09, 2009 4:25 pm Post subject: |
|
|
| mStorm wrote: | | Jani wrote: | | mStorm wrote: | | Got any ideas on how to find the address of the function? | It needs some reverse engineering..  |
Enlighten me!
What's a good place to start?
Maybe flood the game with a specific string of keys and freeze the process, then do a memory scan for the dinput scancodes?
Maybe find the read function in dinput8.dll that is loaded into memory and do something with that?
| dnsi0 wrote: | | Directly calling the WndProc works as well. I think... |
I don't know if this will work because they game uses DirectInput which deals with scancodes on the same level as Windows ( I believe).
SendMessage/PostMessage nonsense doesn't quite work with DirectInput games; at least from my experience. Unless someone knows something I don't.  |
Yea. I tryed this for ms and it doesn't even call DIDevice.GetDeviceState or whatever that function was.
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Fri Jul 10, 2009 8:47 am Post subject: |
|
|
| Hm, I'm just trying to figure out how that method would be able to send keys to a specific application. Seems like it would just send it globally.
|
|
| Back to top |
|
 |
|