AutoHotkey Community

It is currently May 25th, 2012, 9:23 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 134 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject:
PostPosted: February 22nd, 2005, 9:52 pm 
I used to use AHK in a game I play, but with the recent addition of nprotect/gameguard, AHK bindings trigger but the keystroke sequences do not appear in the game any more. I've tried all of the options in the links Chris suggested, but none of them worked. I haven't (yet?) tried writing my own kb hook.

I've read through this entire thread and understand much of it, but do not have the programming knowledge of most of you. Instead of trying a programming solution, I instead downloaded and tried over 40 other Windows hotkey programs to see if any of them worked in the game. Of the ~40 programs I tested, 5 of them worked in the game. They are (sorry if this is taboo):

Journal Macro
QuicKeys
KeyGO
OnHand
Toggle Keyboard

The above 5 programs do not have the macroing programming logic control that AHK does, and thus aren't useful to me. If I get the time, I may try to find out how the above 5 programs are hooking into the kb to see if the same methods can be used in AHK. It's likely they are using a method similar to what Astaelan is using, or they are using their own kb device driver. I do not know at this point. I need to order the DDK, and do quite a bit of research on DD programming before I go anywhere.

Astaelan, are you still here? Is it possible you can reveal the code you used for your mouse hooks?

Chris, any idea how these 5 programs are working in the game (Lineage2), while AHK is not?

Thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2005, 10:46 pm 
Offline

Joined: September 23rd, 2004, 4:56 pm
Posts: 34
Location: Canada
I'm still around, sort of. THough I'm not really working on this at all anymore. I'm not even sure if I have the code I was working on back then, as it turned out to be unstable. Basically, sometimes the driver could be attached to and sometimes it couldn't. No idea why.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2005, 6:30 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Guest wrote:
I haven't (yet?) tried writing my own kb hook.
I don't think a hook is the answer for pushing keystrokes and mouse clicks into a DirectInput game. However, a hook is very useful for detecting keystrokes and mouse clicks at a low level (circumventing just about anything that might try to stop it).

Quote:
I instead downloaded and tried over 40 other Windows hotkey programs
Wow!

Quote:
Of the ~40 programs I tested, 5 of them worked in the game. They are (sorry if this is taboo):

Journal Macro
QuicKeys
KeyGO
OnHand
Toggle Keyboard
It's not taboo at all. In fact, your research is quite valuable to me and will certainly prove useful to others who are looking for ways to send keystrokes and mouse clicks to games that ignore the API functions keybd_event() and mouse_event().

Quote:
It's likely they are using a method similar to what Astaelan is using, or they are using their own kb device driver.

...any idea how these 5 programs are working in the game (Lineage2), while AHK is not?
I can't escape the feeling that it might be something really obvious that we just haven't stumbled across yet. Perhaps a journal record hook (which can also play back keystrokes?) Or perhaps something at the interrupt level, from the Win9x era (though I doubt that such tricks work on NT-based OSes such as XP). Or perhaps it has something to do with AttachThreadInput().

Or could it be something even simpler such as SendInput() (which requires Win98+ or NT4 SP3+). Maybe you could write a test program that attempts a single call to SendInput() while the game window is active.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2005, 3:50 pm 
I took a quick look at the dependencies of the game's EXEs and DLLs, and found...

Main game EXE Uses:
DDRAW.DLL

A WinDrv.dll within the game's dir tree uses:
DINPUT8.DLL

One of the dlls exports:
GL2UseKeyCryp


So it looks as though the game is using Dinput. It's a Unreal engine based game, but I don't know if the base Unreal engine uses dinput or not.

I'll reinstall those 5 tools that worked with the game, examine their contents to see if I can find some similarities, and report back ASAP. I may even go so far as to send their dev teams an emails asking if they would be so kind as to reveal/hint on how they were putting keystrokes into the input stream in their app.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2005, 6:39 pm 
Update.

I wrote a simple hotkey program with vc7 using "SendInput", but the game didn't recieve the keystrokes.

I did verify that my hotkey callback was triggered from within the game, but the keystroke output never made it to the game.

-flipper09 (same person as "Guest" above)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2005, 10:26 pm 
Offline

Joined: September 23rd, 2004, 4:56 pm
Posts: 34
Location: Canada
This is pretty much the same issue I was running into. In the end, it was the Windows DDK that held the answer for me. But as I said, my solution was neither stable nor complete.
First of all, I had some issues with keyboard input, but I had mouse control working fine. The real problem was that sometimes my SYS file could not be connected to using DeviceIoControl, and so no control could be taken.

If the interest in this remains, I'll try to find the source for the modifications to the mouse driver I did.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2005, 10:42 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Darn; it was worth a try. Did you verify that the program correctly sent the keystrokes to a normal window? If you did, that pretty much confirms that SendInput isn't the answer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2005, 3:41 am 
Offline

Joined: February 25th, 2005, 2:59 am
Posts: 4
I have also been trying to resolve the problem of being able to send keys and macros to games for quite some time. I'd like to share with you my results since this seems to be a topic of interest:

Able to simulate all keys, keys being held down, mouse click/movement in the games: Sacred, Thief III (Deadly Shadows), Warhammer 40K, DAoC. As an example I'm am using a program to have a key stay held down in Thief III to switch between a Run/Walk mode by the press of a key. The Thief III game I believe uses a modified Unreal Engine and I don't believe it is doing anything unusual with DirectInput. Probably AutoHotkey works flawlessly in all the games I mentioned above also.

Able to simulate macros by sending keys to the active game window identifier in game CONSOLE windows only for games like Far Cry (Havok Engine?), Doom III, Half-Life 2 (source engine) - useful for macroing in cheat codes by pressing just one key. However once in the actual active game window the macros or remapped keys will not work.

Able to map keys to the modifier keys (CTRL, ALT, SHIFT) in all games that I have tested so far that I believe use DirectInput. This is of limited use, but I can simulate sprinting for example by just pressing a key and have it hold down a modifier key for a certain amount of time.

For all of this I am using the libraries GetKeyState, GetAsyncKeyState, keybd_event, and mouse_event. In all of these games GetAsyncKeyState is always detecting whether a key is pressed or not. The problem comes when trying to send keystrokes to the active game window. The really frustrating part is I don't understand why the modifier keys always work, but not regular keys.

Ultimately I think Astaelan is on the right track by creating a driver to resolve this problem. My fear though is that you would have to create drivers for each specific game you are having problems with recognizing sent keystrokes. It may not be possible to create universal drivers that work with all games.

Maybe another way to resolve this problem is to tackle it at the hardware level. Have any of you looked at the Nostromo SpeedPad n52 (Belkin)? I believe it has a software macro language included with it.

Anyway for those interested in the program I developed it is called G-Hotkey if you would like to take a look at it.

Chris: Please remove the reference to the G-Hotkey program if you deem it to be inappropriate.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2005, 12:36 am 
Offline

Joined: February 9th, 2005, 1:17 am
Posts: 6
Chris wrote:
Darn; it was worth a try. Did you verify that the program correctly sent the keystrokes to a normal window? If you did, that pretty much confirms that SendInput isn't the answer.


I did verify that my program was sending keystrokes to any window that had focus. I also know the Nostromo SpeedPad n50/52 (Belkin) works in the game that AHK doesn't (and many other macro programs), and I believe, but cannot prove, that the n50/52 are able to it via the DD route. Both of these devices are USB, but I don't know if they can send kb keystrokes at the hardware (IRQ?) level.

There is a software solution here, as the ~5 programs I mentioned above do work in this game, but I haven't yet found out if all (or any) of them do it via the DD method.

Astaelan, do you still have your dinput code? If so, could you let us monkey with it? I'm wondering if it'll work in the game I'm messing with.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2005, 3:05 am 
For those that are interested I have updated the G-Hotkey program I developed and it is now working in games that use DirectInput. I found that using MapVirtualKey in conjunction with the keybd_event library allows me to send key presses to games that use DirectInput. While this is not 100% reliable - it does work well for gaming purposes. Although Astaelan's solution to write a program to hook DirectInput is probably a more reliable way of accomplishing this.

Anyway I have tried successfully so far the following games out by sending macros and in-game key presses (which I had previously been unable to get to work properly):

Rome: Total War
Vampire Bloodlines
Doom III

It appears to be working so far with any game that uses DirectInput.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2005, 3:12 am 
Just to follow up on the last thread I don't believe the G-Hotkey program will work with games that use nprotect/gameguard. As I don not play any games that use this I have no way of trying this out (my understanding is this blocks the keybd_event library?).


Report this post
Top
  
Reply with quote  
 Post subject: direct input
PostPosted: April 20th, 2005, 9:17 pm 
i had a thought umm what about useing verual keyboard its a valed windows program that gameguard or anyone has no right to block considering its for andycap w/e my point is i think it will work im curently haveing isues with knight online just figured id share


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2005, 9:50 pm 
Offline

Joined: February 9th, 2005, 1:17 am
Posts: 6
I gave up looking for a robust macro program, or a solution, that works with gameguard/nprotect. At this point, I believe the only way to send keystrokes to a game protected with gameguard/nprotect is to use a device driver.

I have the Belkin n50 and n52 controllers and both work with gameguard/nprotect games. The drivers for these devices interact with the kb device driver somehow, but I never dug deep enough to find out how.

A solution in AutoHotkey would be much better, as it has superior contorl logic to anything else I've seen, but the Belkin devices do fine for simple automation/assistance.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: direct input
PostPosted: April 20th, 2005, 9:51 pm 
Offline

Joined: February 9th, 2005, 1:17 am
Posts: 6
guysingleton wrote:
i had a thought umm what about useing verual keyboard its a valed windows program that gameguard or anyone has no right to block considering its for andycap w/e my point is i think it will work im curently haveing isues with knight online just figured id share


I'm afraid you lost me, sorry.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 21st, 2005, 3:36 am 
Offline

Joined: February 25th, 2005, 2:59 am
Posts: 4
The Belkin n52 looks like an interesting device - I think I may want to pick one up to see how it works in conjunction with the software used with it. The device driver makes sense although I'm somewhat surprised that it is still able to bypass the gameguard/nprotect software. Flipper09 - are there any games that the n52 controller does not work with? I have heard mixed reports about it working correctly with all games. Thank you for the information.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 134 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group