zoukankan      html  css  js  c++  java
  • 低级键盘钩子,在WIN7以上版本的问题

    最近在项目用到低级键盘钩子。发现一个很奇怪的事情,在开发环境和测试环境下都正常运行的键盘钩子,

    到了现场环境,总是偶发性出现 键盘钩子不能用了,而且退出时产生1404 错误。

    后经过阅读MSDN 的Remark

    An application installs the hook procedure by specifying the WH_KEYBOARD_LL hook type and a pointer to the hook procedure in a call to the SetWindowsHookEx function.

    This hook is called in the context of the thread that installed it. The call is made by sending a message to the thread that installed the hook. Therefore, the thread that installed the hook must have a message loop.

    The hook procedure should process a message in less time than the data entry specified in the LowLevelHooksTimeout value in the following registry key:

    HKEY_CURRENT_USERControl PanelDesktop

    The value is in milliseconds. If the hook procedure does not return during this interval, the system will pass the message to the next hook.

    Note that debug hooks cannot track this type of hook.

    发现是现场的机器没有 Lowlevelhookstimeout 这个注册表项目,增加,修改值为10000,重启,解决。

    这个地方的问题说明,钩子的处理一定要快。其次超时的值应该要记得设置。最好是程序中进行设置一下。

  • 相关阅读:
    oralce 10g(10.2.0.1) 冷备份从64位恢复到32位
    Java反序列化漏洞总结
    正则表达式优化总结
    机器学习笔记(持续更新)
    Java反序列化漏洞分析
    ThinkPHP5 远程命令执行漏洞分析
    Joomla对象注入漏洞分析
    crontab一句话后门分析
    WeCenter3.1.7 blind xxe 分析
    Redis Getshell总结
  • 原文地址:https://www.cnblogs.com/songr/p/5131655.html
Copyright © 2011-2022 走看看