钩子教程 - 原理(十五) : JournalRecordProc

原文地址:http://www.zdexe.com/program/201004/589.html

方法10 : JournalRecordProc Function

The JournalRecordProc hook procedure is an application-defined or library-defined callback function used with the SetWindowsHookEx function. The function records messages the system removes from the system message queue. Later, an application can use a JournalPlaybackProc hook procedure to play back the messages.

  JournalRecordProc钩子子程是与SetWindowsHookEx一起使用的、程序定义的或者库定义的回调函数。该方法记录系统从系统消息队列中移除的消息。过后,应用程序可以使用JournalPlaybackProc钩子子程回放这些消息。

The HOOKPROC type defines a pointer to this callback function.JournalRecordProc is a placeholder for the application-defined or library-defined function name.

  HOOKPROC类型定义了指向该回调函数的指针。JournalRecordProc是程序定义的或者库定义的方法名字。

Syntax 语法

LRESULT CALLBACK JournalRecordProc(      
        int code,

WPARAM wParam,

LPARAM lParam

);

Parameters 参数

code  :[in] Specifies how to process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned byCallNextHookEx. This parameter can be one of the following values.

  指定如何处理消息。如果code小于0,钩子子程不对其进行任何进一步的处理,必须将消息传递给CallNextHookEx方法,并返回由CallNextHookEx方法返回的返回值。该参数可以是以下值之一:

  1.HC_ACTION  : The lParam parameter is a pointer to an EVENTMSG structure containing information about a message removed from the system queue. The hook procedure must record the contents of the structure by copying them to a buffer or file.

    参数lParam 是一个指向EVENTMSG结构的指针,该结构包含从系统队列中移除的消息的信息。钩子子程应该通过将消息信息拷贝到缓冲区中或者文件中来记录内 容。

  2.HC_SYSMODALOFF :A system-modal dialog box has been destroyed. The hook procedure must resume recording.

    系统模式对话框已经被销毁。钩子子程必须恢复纪录。

  3.HC_SYSMODALON :A system-modal dialog box is being displayed. Until the dialog box is destroyed, the hook procedure must stop recording.

    系统模式对话框正在被显示。钩子子程应该停止记录,直到对话框被销毁。

wParam :This parameter is not used.

  该参数未使用。

lParam :[in] Pointer to an EVENTMSG structure that contains the message to be recorded.

  指向EVENTMSG结构的指针,其中包含即将被记录的消息。

Return Value  返回值

  The return value is ignored. 被忽略。

Remarks 备注

A JournalRecordProc hook procedure must copy but not modify the messages. After the hook procedure returns control to the system, the message continues to be processed.

  JournalRecordProc钩子子程应该复制而不是不修改消息。在钩子子程将控制全交还给系统后,消息将被继续处理。

Install the JournalRecordProc hook procedure by specifying the WH_JOURNALRECORD hook type and a pointer to the hook procedure in a call to the SetWindowsHookEx function.

  通过下面方式安装该钩子子程:指定WH_JOURNALRECORD钩子类型;指定在调用SetWindowsHookEx方法的函数中指向钩子子程的指针。

A JournalRecordProc hook procedure does not need to live in a dynamic-link library. A JournalRecordProc hook procedure can live in the application itself. JournalRecordProc

  钩子子程没必要生存在动态链接库中,可以在应用程序自身中生存。

Unlike most other global hook procedures, the JournalRecordProc andJournalPlaybackProc hook procedures are always called in the context of the thread that set the hook.

  和其它全局钩子子程不一样,JournalRecordProca和JournalPlaybackProc钩子子程总是在设置钩子的线程的上下文中被调用。

An application that has installed a JournalRecordProc hook procedure should watch for the VK_CANCEL virtual key code (which is implemented as the CTRL+BREAK key combination on most keyboards). This virtual key code should be interpreted by the application as a signal that the user wishes to stop journal recording. The application should respond by ending the recording sequence and removing the JournalRecordProc hook procedure. Removal is important. It prevents a journaling application from locking up the system by hanging inside a hook procedure.

  安装有JournalRecordProc钩子子程的应用程序应该监视VK_CANCEL虚拟键码(在多数键盘上就是像CTRL+BREAK一样实现的组合键)。虚拟键值应该被应用程序解释为用户希望停止日志记录的信号。应用程序应该通过结束记录队列或者移除JournalRecordProc钩子子程来响应用户的信号。可移除性是重要的,可以防止日志应用程序由于钩子子程内部的挂起而引起的系统锁死。

This role as a signal to stop journal recording means that a CTRL+BREAK key combination cannot itself be recorded. Since the CTRL+C key combination has no such role as a journaling signal, it can be recorded. There are two other key combinations that cannot be recorded: CTRL+ESC and CTRL+ALT+DEL. Those two key combinations cause the system to stop all journaling activities (record or playback), remove all journaling hooks, and post a WM_CANCELJOURNAL message to the journaling application.

  CTRL+BREAK组合键扮演着停止日志记录的信号的角色,这意味着CTRL+BREAK组合键不能被自我记录。既然CTRL+C组合键没有扮演这样的角色,它就可以被记录。还有其它2种组合键不能被记录: CTRL+ESC 和CTRL+ALT+DEL。.这2种组合键引起系统停止所有日志活动(记录或者回放),移除所有日志钩子,传递WM_CANCELJOURNAL消息给日志记录应用程序。

时间: 2024-08-04 10:47:58

钩子教程 - 原理(十五) : JournalRecordProc的相关文章

钩子教程 - 原理(十六) : KeyboardProc

原文地址:http://www.zdexe.com/program/201004/590.html 方法11 : KeyboardProc Function The KeyboardProc hook procedure is an application-defined or library-defined callback function used with the SetWindowsHookEx function. The system calls this function when

Senparc.Weixin.MP SDK 微信公众平台开发教程(十五):消息加密

原文:Senparc.Weixin.MP SDK 微信公众平台开发教程(十五):消息加密 前不久,微信的企业号使用了强制的消息加密方式,随后公众号也加入了可选的消息加密选项.目前企业号和公众号的加密方式是一致的(格式会有少许差别). 加密设置 进入公众号后台的“开发者中心”,我们可以看到Url对接的设置: 点击[修改设置],可以进入到修改页面: 加密的方式一共有3种: 明文模式,即原始的消息格式 兼容模式,明文.密文将共存,正式发布的产品不建议使用(因为仍然包含了明文,达不到加密的效果) 安全模

NeHe OpenGL教程 第二十五课:变形

转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线教程的编写,以及yarn的翻译整理表示感谢. NeHe OpenGL第二十五课:变形 变形和从文件中加载3D物体: 在这一课中,你将学会如何从文件加载3D模型,并且平滑的从一个模型变换为另一个模型. 欢迎来到这激动人心的一课,在这一课里,我们将介绍模型的变形.需要注意的是各个模型必须要有相同的顶点,

How Javascript works (Javascript工作原理) (十五) 类和继承及 Babel 和 TypeScript 代码转换探秘

个人总结:读完这篇文章需要15分钟,文章主要讲解了Babel和TypeScript的工作原理,(例如对es6 类的转换,是将原始es6代码转换为es5代码,这些代码中包含着类似于 _classCallCheck 和 _createClass这样的函数,而这些函数已经在Babel和TypeScript的标准库中预先定义好了,然后进行处理). 顺便温习了Object.create这个方法,  比如有一个obj:{name:'是ho',f:function(){alert(1)}} var a = O

Android简易实战教程--第十五话《在外部存储中读写文件》

第七话里面介绍了在内部存储读写文件 点击打开链接. 这样有一个比较打的问题,假设系统内存不够用,杀本应用无法执行,或者本应用被用户卸载重新安装后.以前保存的用户名和密码都不会得到回显.所以,有必要注意这个问题 因此把文件保存到sd卡中.即今天所写的  第十五话<在外部存储中读写文件> 首先布局文件和第七话一样: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:

《80X86汇编语言程序设计教程》十五 任务切换实例

1.  理论知识参考"<80X86汇编语言程序设计教程>十二 任务状态段.控制门和控制转移",演示内容:直接通过TSS段的任务切换.通过任务门的任务切换.任务内特权级的变换及参数传递.实现的逻辑功能是:从Temp任务切换到Demo任务以后显示原任务(Temp)的挂起点EIP的值. 2.  源代码 "386scd.asm"不再贴上来.参考"<80X86汇编语言程序设计教程>十三 任务内无特权级变换转移实例",演示代码如下:

AC620教程 第十五节 8位7段数码管驱动设计与验证

本章导读 电子系统中常用的显示设备有数码管.LCD液晶以及VGA显示器等.其中数码管又可分为段式显示(7段.米字型等)以及点阵显示(8*8.16*16等),LCD液晶的应用可以分为字符式液晶(1602.12864等)以及真彩液晶屏,VGA显示器一般是现在的电脑显示器.芯航线开发板对以上三种设备均提供了硬件接口. 本章将实现FPGA驱动数码管动态显示并提取出实现的电路结构,从电路结构入手编写代码,仿真对设计进行验证.最终板级调试时使用In system sources and probes edi

钩子教程 - 原理(三)

原文地址:http://www.zdexe.com/program/201004/577.html 勿在浮沙筑高台.继续学习.今天主要学习官方的资料.但是查找到的都是E文,俺只是翻译了一下.全部查找自msdn. Hooks tend to slow down the system because they increase the amount of processing the system must perform for each message. You should install a

钩子教程 - 原理(一)

原文地址:http://www.zdexe.com/program/201004/575.html 第一步.了解什么是钩子. 我们可以首先从字面上了解钩子,钩子是干什么的呢?日常生活中,我们的钩子是用来钩住某种东西的,比如,说,鱼钩是用来钓鱼的,一旦鱼咬了钩,钩子就一直钩住鱼了,任凭鱼在水里怎么游,也逃不出鱼钩的控制.同样的,Windows的钩子Hook也是用来钩东西的,比较抽象的是他是用来钩Windows事件或者消息的.最常见的就是鼠标和键盘钩子,用Hook钩子钩住鼠标.键盘,当你的鼠标.键盘