News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to properly capture combined keys in a hook?

Started by Xacker, October 20, 2008, 02:56:30 PM

Previous topic - Next topic

Xacker

Hi,
it gives me a shiver to be between some of the best in this scene  :8)

I'm trying to use GetClipboardData in a keyboard hook procedure, the problem is that the data are not stored in the clipboard unless I release the hook, but doing that will make me lose control, I tried to call CallNextHookEx inside the hook but it didn't work, so I went for this solution, to simulate the keys using keybd_event, the problem is, the simulation is again captured by the hook procedure which eventually leads into copying "the wrong text" for about 32 times  :eek

any better/proper way for doing that?

no, I'm not trying to hook the clipboard functions.
no, I'm not developing a keylogger in assembly, and yes, I read the rules and Hutchs topic about keyloggers.   :toothy

p.s: code is available upon request but it's basically un-commented and contains lots of functions warped together, it will take sometime to shape it.

tnx, X.

MichaelW

I'm not going to waste my time playing a guessing game here. Provide detailed explanations of what you are trying to do, and why it is not a violation of the forum rules, or I will assume the worst and remove this topic.
eschew obfuscation

Xacker

I understand, you don't have to play the guess game.

it's a small utility to allow me copy several phrases/words several times from any window and put them in a list, then by user request and right click of the mouse a pop-up menu shows up to select what phrases/words to paste so the user doesn't have to copy > paste immediately but only when he feels to.

again, it's not a keylogger, if I'm not concerned about not violating the rules, I wouldn't have read them and searched in the first place.

Xacker

I was doing some thinking,

so no one thinks this is some topic about keyloggers too (maybe it's being discussed by the moderators now!)

it occurred to me that the user might even use the right-click menu > copy/paste - to copy the text s/he wants, then, the hook is useless, so probably a hook on some functions is the best way for the tool I'm working on, not using a system wide hook. is my assumption correct?

then let's change the question if my assumption is correct, say, what is the best/proper way for monitoring the clipboard copy/paste events (without using a system wide hook on windows) (from assembly point-of-view)

I guess the question now is OK, right?  :U

jj2007

Why so complicated? Insert your monitoring window into the clipboard chain, check for new events, get the text and store it somewhere. Use a window or SendTo or whatever to offer the stored items to the user.