钩子教程 - 原理(二十四) : UnhookWindowsHookEx

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

方法19 :UnhookWindowsHookEx Function

The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.

  UnhookWindowsHookEx方法移除由SetWindowsHookEx方法安装在钩子链表中的钩子子程。

Syntax语法

BOOL UnhookWindowsHookEx(HHOOK hhk);

Parameters 参数

hhk :[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx. 即将被移除的钩子的句柄。该参数是由前面调用SetWindowsHookEx的方法所保留的钩子句柄。

Return Value 返回值

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

如果该方法执行成功,返回非0值。如果卸载失败,返回0。调用GetLastError可以得到更多的错误信息。

Remarks备注

The hook procedure can be in the state of being called by another thread even afterUnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.

在UnhookWindowsHookEx方法返回后,钩子子程可能处于正在被其他线程调用的状态。如果钩子子程不是被并发调用,钩子子程会在UnhookWindowsHookEx方法返回前被迅速的移除。

posted @ 2016-05-17 14:56  C/C++/Python/Java  阅读(698)  评论(0编辑  收藏  举报