Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


DirectInput/SendInput question...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Wed Jul 08, 2009 1:35 am    Post subject: DirectInput/SendInput question... Reply with quote

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
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Wed Jul 08, 2009 4:26 am    Post subject: Reply with quote

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
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Jul 08, 2009 9:03 am    Post subject: Reply with quote

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
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Wed Jul 08, 2009 3:30 pm    Post subject: Reply with quote

Got any ideas on how to find the address of the function?
Back to top
View user's profile Send private message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Wed Jul 08, 2009 4:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Wed Jul 08, 2009 5:55 pm    Post subject: Reply with quote

hm, yea.. but how do you know which function to hook?
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Wed Jul 08, 2009 6:13 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Jul 08, 2009 7:04 pm    Post subject: Reply with quote

Directly calling the WndProc works as well. I think...
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Thu Jul 09, 2009 7:26 am    Post subject: Reply with quote

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
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Jul 09, 2009 9:39 am    Post subject: Reply with quote

mStorm wrote:
Got any ideas on how to find the address of the function?
It needs some reverse engineering.. :)
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Thu Jul 09, 2009 11:25 am    Post subject: Reply with quote

Jani wrote:
mStorm wrote:
Got any ideas on how to find the address of the function?
It needs some reverse engineering.. Smile


Enlighten me! Very Happy

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. Sad
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Jul 09, 2009 4:25 pm    Post subject: Reply with quote

mStorm wrote:
Jani wrote:
mStorm wrote:
Got any ideas on how to find the address of the function?
It needs some reverse engineering.. Smile


Enlighten me! Very Happy

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. Sad


Yea. I tryed this for ms and it doesn't even call DIDevice.GetDeviceState or whatever that function was.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Jul 09, 2009 6:57 pm    Post subject: Reply with quote

mStorm wrote:
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?

no..you must read the code and understand the idea.. he opens the keyboardclassN and if that fails tries to open the UsbKeyBoardClass0..another idea is to do something similar to chpie in her posting on rootkit.com.. it is a excellent piece of code Wink

regards BanMe

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Fri Jul 10, 2009 8:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites