jni - What is a "hook" and how can I write one in Java? And how to communicate with kernel to know the keys pressed by the user/registering with OS -


Although I searched a lot, it is still unclear that what I actually do is a "hook" for example, I read this post on this:

In front of the second code of a piece of a hook code, there is a way to separate a code from one another, so that the first piece of code is the second piece The first piece of code gives the opportunity to monitor and / or filter the behavior of the other part of the code. For example, a mouse may hook up, allowing the hook code to monitor the mouse, while at the same time while preserving the original mouse event processing routine functionality.

I have also read this, but I still can not understand what a "hook" is actually what someone can explain, in general terms, what is "hook" ? Why do some write a "hook"? Also, is it possible to write "hook" in Java?

Note:

I wanted to write a kelloggener in Java and a friend of mine said that you have to write "hook" in C. I can not write the whole kinelogor in Java (can be operated only on windows)?

Edit

Please provide a reply wrt keylogger. How can I ask kernel to give information about the key pressed for my application? Or how can I use JNI with my application OS? I want my application to be recorded by the user pressed keys.

From

,

In computer programming, hooking word function calls or Contains many techniques used to change or enhance the behavior of an operating system, applications or other software components, stopping programs passing between messages or software components. This type of intercepted function handles calls, events, or messages, which is called "hook".

There will be a good example built in Java. An shutdown hook is just an initial but unstated thread. When the virtual machine starts its shutdown sequence, it will start all registered shutdown hooks in some unspecified order and let them run together.

  runtime. AddShutdownHook (new thread) {@Override public void run} {// do something before the application ends}});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -