On Nov 7, 2007, at 5:53 AM, Michele Croci wrote:
Hi Timothy,
thank you for the resources and for your time. I have read a lot
and looked to some examples, but I haven't found the solution to my
problem. This is the situation:
- if I install a WH_KEYBOARD hook, the hook function is never called
- if I install a WH_KEYBOARD_LL hook the hook function is called
once, then the JVM crashes.
Probably the next step is to attach a debugger to the process
(probably while stopped in the java callback code in a java debugger)
so that you can catch the illegal access and determine exactly where
it is failing. My guess would be in the libffi trampoline code. But
unless you're handy with C/assembly and an associated debugger (VC or
gdb would probably work), that might be difficult and slow.
I have one last question. I have read again one of your previous
answers not understanding one sentence:
"I tried that example as well, and found that the regular keyboard
hook didn't work (which is why it isn't yet in the contrib area of
the project). I didn't have time to spend playing around with it to
find the problem."
What is a regular keyboard hook? The WH_KEYBOARD hook? It's not yet
supported by JNA?
I've never been able to get WH_KEYBOARD to produce anything; it may
be because that type of hook *must* reside in a DLL (I haven't tried
to get it to work in a regular C program). All the examples I've
seen on the net have used the low level hook.
I wrote a little C program to do the same thing as the java, and
while it works, it never returns from GetMessage, which seems rather
odd. Not sure if this is related to the Java issue. See attached: