DirectInput

c++ / delphi package - dll injection and api hooking

DirectInput

Postby Delshire » Sun Aug 02, 2015 12:07 am

Hello, how are you. I am writing because I want to send keys via c++ code but because of DirectInput i clearly can't. I've been told to look into API hooking to hook DirectInput but i do not really know why is it needed. So i looked up what really DirectInput does and I found this:
Image

The reverse of that is just what i need, been able to use SendMessage or kbd_event but since it ignores all this, i'm stucked in this problem.

Thanks!

EDIT: My question is how can i apply the tool in order to gain knowledge about this?
Delshire
 
Posts: 4
Joined: Sat Aug 01, 2015 11:58 pm

Re: DirectInput

Postby madshi » Sun Aug 02, 2015 7:24 am

If APIs like kbd_event are ignored, that's surely ugly. API hooking with madCodeHook might make it possible for you to simulate keyboard and mouse events, but I'm not sure how difficult it would be to implement. Is DirectInput sending events to the application when a mouse/keyboard event occurs? Or is the application polling for keyboard/mouse events? In the latter case you would have to hook the DirectInput polling function, then you could return simulated events to the application calling the API. In the first case you would have to notify the application about keyboard/mouse events in the same way that DirectInput does.
madshi
Site Admin
 
Posts: 9827
Joined: Sun Mar 21, 2004 5:25 pm

Re: DirectInput

Postby Delshire » Sun Aug 02, 2015 7:15 pm

Thanks for the quick reply!

The application is polling for keyboard events, so I will have a look on how to hook the polling func as you said. I was doing some tests and saw that SendInput() func from AHK (AutoHotkey) is working. Since it's an open source project I will have a look at that but if you can help me i would be really grateful!

Again, thanks for the response!

good luckk
Delshire
 
Posts: 4
Joined: Sat Aug 01, 2015 11:58 pm

Re: DirectInput

Postby madshi » Sun Aug 02, 2015 8:55 pm

Well, what AutoHotkey is doing works for you, then that's the cheaper and simpler way to achieve your goal.
madshi
Site Admin
 
Posts: 9827
Joined: Sun Mar 21, 2004 5:25 pm

Re: DirectInput

Postby Delshire » Sun Aug 02, 2015 9:17 pm

Well but let's say I want to implement it to my C++ code and not be working with AHK (Because I would need to read all the documentation, haha)
Delshire
 
Posts: 4
Joined: Sat Aug 01, 2015 11:58 pm

Re: DirectInput

Postby madshi » Sun Aug 02, 2015 9:22 pm

Well, if you want to use madCodeHook, you'll need a license, and maybe a code signing certificate, and you'll have to get used to doing API hooking and stuff. I dare say it would be easier and faster for you to check the AHK code to see how they're doing that. If you're lucky, maybe they found some undocumented API they call, or something like that.
madshi
Site Admin
 
Posts: 9827
Joined: Sun Mar 21, 2004 5:25 pm

Re: DirectInput

Postby Delshire » Mon Aug 03, 2015 12:07 am

Seems fair enough, thank you for all @madshi
Delshire
 
Posts: 4
Joined: Sat Aug 01, 2015 11:58 pm


Return to madCodeHook

Who is online

Users browsing this forum: Google [Bot] and 13 guests

cron