sending keys (sorta OT)

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

Eyston
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue Mar 11, 2003 11:10 pm

sending keys (sorta OT)

Post by Eyston » Tue Mar 11, 2003 11:38 pm

Howdy,

Been bored with EQ lately and decided to try writing some code to automize some things (just as a toy). My abjuration skill was always quite low, so something to press keys and watch the log file seemed like a good use of time. Like I said though, mostly just something to do.

Anyways, I haven't done Win32 programming before, so took awhile. Read up on different methods. keykb_event, sendinput, send/postmessage. All of these are useless it seems. I use from Perl using Win32::api, but it works with stuff like notepad, so I don't think it is perl problem (just mine/eq's).

So I find your site, and it is open source. I download source, and start looking.

I know Dev are busy, but if someone with a good understanding of the code wouldn't mind pointing me in the right direction, I'd be very appreciative. Here is my understanding:

VOID HookDInput(BOOL Patch) -- I know a bit about hooks (reading up on my problem). So we make a Direct Input device. We set it equal to a memory address (or something memory related, not too clear on how can just set it equal to # from ini file, keyboard always same place?) to value in eq ini file. And then confusing part. We link stuff up in ourdetours, and then Trampoline.

Trampoline is beyond me, but leads to...

HRESULT __stdcall DInputDataDetour(~) -- first part I sort of understand. Look at link-list made by /press and more importantly /sendkeys functions from later in library. Then take the link-list and set the key press into deviceobject structure (or whatever structure is, that is explained a lot on MSDN, so np). Tic-count, sorta ignore, not sure if important. Call trampoline again, not sure~. Then do more stuff with pdwinout and didadd (honestly haven't looked much at them yet, but will do, just wanted make post).

The Sendkeys function is clear.

So I'm not really sure what I'm asking =). I don't really need code-lines explained to me as much as I'd like to know what the general idea is here. I just want to know where to look for more info on the subject, not handout. Setup keyboard hook, stuff things into object, all done?

Thank you,

-Eyston

kaz
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 14, 2003 4:09 am

Post by kaz » Wed Mar 12, 2003 12:16 am

The point of the detour is to *intercept* control when eq calls the directx keyboard function to ask if there is any data waiting.

At that point, fake data keypresses (from /sendkeys and /press) that are waiting to be processed are inserted into the datastructs and made to look like they came from the real directx function, and then the trampoline is called to go ahead and fill in the *real* key press data if any exists.

calling the trampoline essentially results in the original directx function getting called (see detours documentation on what a trampoline is)

Eyston
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue Mar 11, 2003 11:10 pm

Post by Eyston » Wed Mar 12, 2003 12:54 am

Okay. That is good place to start looking then, thank you for explanation. Quick google search result in a few pdf on issue (from msdn), so I will take look! Any suggestion good too =)

Thank you,

-Eyston