Sign in to follow this  

DirectInput Hook Problem

This topic is 4255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After reading the thread Help Needed - DirectX and SendKeys and [C++] DirectInput Hooking component and sample. I have tried the code my one of my favourite game. unfortunately, sample seems fail to hook to my game. It cannot connect to the game. This game using a updater program as startup. After updating any necessary, it start the program afterwards. I have tried to hook to the main program but fail. Does anyone have idea what is happening?

Share this post


Link to post
Share on other sites
Muhammad seems to be the resident expert on this subject. If he doesn't spot this thread, you can try sending him a private message [smile]

It would help if you posted more details though. What game are you trying to hook? Exactly what are you hooking (you need to hook the game not the updater)? Any other important details - OS, versions etc...

Cheers,
Jack

Share this post


Link to post
Share on other sites
This game is a chinese game, seems do not have a english name.
I am trying to add Joystick support to it.
Currently, I know how to capture Joystick input.
I want to convert it to Key press. Also I want to convert the movement too.

jollyjeffers, have you tried Muhammad's solution?
I can only hook to his sample app. (Keyboard.exe)

My OS version is WinXP SP2, .Net Framework 1.1 SP1, .Net Framework 2.0

I have tried all these, but fail to work with DirectInput.
SendMessage, PostMessage, SendKeys, SendInput, keybd_event

Share this post


Link to post
Share on other sites
Get Dependency Walker, open the game's executable and check whether it references DInput8.dll or not.

The possibilities I can think of are:
1) It's using an old version of DInput that's not supported by my sample (I seem to recall the sample supported 7 and 8)
2) It's loading DInput8.dll using LoadLibrary, retrieving a pointer to DirectInputCreate8 using GetProcAddress, and calling it. In this case, hooking won't work. The solution would be to place a custom DInput8.dll in the game's folder, since LoadLibrary starts searching in the current folder before system folders.

Share this post


Link to post
Share on other sites
I have check the game's executable with Dependency Walker.
It does reference to DInput8.dll.

How do I know it use LoadLibrary or not?
You are talking about custom DInput8.dll? It seems a hard job.

Here is the run result
Inhstalling hook...Done.
Waiting for server...(Press 'Escape' to exit, 'Space' to attempt connection now)
<The game start, but this launcher does not detect, I press 'Space' here>
Attempting to connect...
Could not connect to server.
Press enter to unhook and exit..

Share this post


Link to post
Share on other sites
Quote:
Original post by fredkwok
I have check the game's executable with Dependency Walker.
It does reference to DInput8.dll.

Does dependency walker say it uses the DirectInputCreate8 function?

Quote:
How do I know it use LoadLibrary or not?
You are talking about custom DInput8.dll? It seems a hard job.

Not really. Just create a DInput8.dll that has one function called DirectInputCreate8 and returns a pointer to a custom object implementing IDirectInput8.

Other than that, I'm afraid I can't help.

Share this post


Link to post
Share on other sites
Anyone can help me to create the DInput8.dll?

I am weak in writing C/C++.

After I have created the DLL and being reference my others, it said "The procedure entry point DirectInput8Create could not be located in the dynamic link library DInput8.dll"

I just want to create a DInput8.dll with its DirectInput8Create function return
Muhammad's MyDirectInput8.

Thanks in Advance

Share this post


Link to post
Share on other sites

This topic is 4255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this