亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lion-tutorial24.htm

?? 內有一些代碼
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<html>

<head>
<link rel="stylesheet" href="../../asm.css">

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Iczelion's win32 asm tutorial</title>
</head>

<body bgcolor="#FFFFFF" background="../../images/back01.jpg">
<p align="center">Tutorial 24: Windows Hooks</p>
<hr size="1">
We will learn about Windows hooks in this tutorial. Windows hooks are very powerful. 
With them, you can poke inside other processes and sometimes alter their behaviors. 
<br>
Download the example <a href="files/tut24.zip">here</a>. 
<h3> Theory:</h3>
Windows hooks can be considered one of the most powerful features of Windows. 
With them, you can trap events that will occur, either in your own process or 
in other processes. By "hooking", you tell Windows about a function, filter function 
also called hook procedure, that will be called everytime an event you're interested 
in occurs. There are two types of them: local and remote hooks. 
<ul>
  <li> Local hooks trap events that will occur in your own process.</li>
  <li> Remote hooks trap events that will occur in other process(es). There are 
    two types of remote hooks</li>
  <ul>
    <li> thread-specific&nbsp; traps events that will occur in a specific thread 
      in other process. In short, you want to observe events in a specific thread 
      in a specific process.</li>
    <li> system-wide&nbsp; traps all events destined for all threads in all processes 
      in the system.</li>
  </ul>
</ul>
When you install hooks, remember that they affect system performance. System-wide 
hooks are the most notorious. Since ALL related events will be routed through 
your filter function, your system may slow down noticeably. So if you use a system-wide 
hook, you should use it judiciously and unhook it as soon as you don't need it. 
Also, you have a higher chance of crashing the other processes since you can meddle 
with other processes and if something is wrong in your filter function, it can 
pull the other processes down to oblivion with it. Remember: Power comes with 
responsibility. <br>
You have to understand how a hook works before you can use it efficiently. When 
you create a hook, Windows creates a data structure in memory, containing information 
about the hook, and adds it to a linked list of existing hooks. New hook is added 
in front of old hooks. When an event occurs, if you install a local hook, the 
filter function in your process is called so it's rather straightforward. But 
if it's a remote hook, the system must inject the code for the hook procedure 
into the address space(s) of the other process(es). And the system can do that 
only if the function resides in a DLL. Thus , if you want to use a remote hook, 
your hook procedure must reside in a DLL. There is two exceptions to this rule: 
journal record and journal playback hooks. The hook procedures for those two hooks 
must reside in the thread that installs the hooks. The reason why it must be so 
is that: both hooks deal with the low-level interception of hardware input events. 
The input events must be recorded/playbacked in the order they appeared. If the 
code of those two hooks is in a DLL, the input events may scatter among several 
threads and it is impossible to know the order of them. So the solution: the hook 
procedure of those two hooks must be in a single thread only i.e. the thread that 
installs the hooks. <br>
There are 14 types of hooks: 
<ul>
  <li> <b>WH_CALLWNDPROC</b>&nbsp; called when SendMessage is called</li>
  <li> <b>WH_CALLWNDPROCRET</b>&nbsp; called when SendMessage returns</li>
  <li> <b>WH_GETMESSAGE</b>&nbsp;&nbsp; called when GetMessage or PeekMessage 
    is called</li>
  <li> <b>WH_KEYBOARD</b>&nbsp; called when GetMessage or PeekMessage retrieves 
    WM_KEYUP or WM_KEYDOWN from the message queue</li>
  <li> <b>WH_MOUSE</b>&nbsp; called when GetMessage or PeekMessage retrieves a 
    mouse message from the message queue</li>
  <li> <b>WH_HARDWARE</b> called when GetMessage or PeekMessage retrieves some 
    hardware message that is not related to keyboard or mouse.</li>
  <li> <b>WH_MSGFILTER&nbsp;</b> called when a dialog box, menu or scrollbar is 
    about to process a message. This hook is local. It's specifically for those 
    objects which have their own internal message loops.</li>
  <li> <b>WH_SYSMSGFILTER</b>&nbsp; same as WH_MSGFILTER but system-wide</li>
  <li> <b>WH_JOURNALRECORD</b>&nbsp; called when Windows retrieves message from 
    the hardware input queue</li>
  <li> <b>WH_JOURNALPLAYBACK</b>&nbsp; called when an event is requested from 
    the system's hardware input queue.</li>
  <li> <b>WH_SHELL</b>&nbsp; called when something interesting about the shell 
    occurs such as when the task bar needs to redraw its button.</li>
  <li> <b>WH_CBT</b>&nbsp; used specifically for computer-based training (CBT).</li>
  <li> <b>WH_FOREGROUNDIDLE</b> used internally by Windows. Little use for general 
    applications</li>
  <li> <b>WH_DEBUG</b>&nbsp; used to debug the hooking procedure</li>
</ul>
Now that we know some theory, we can move on to how to install/uninstall the hooks. 
<br>
To install a hook, you call SetWindowsHookEx which has the following syntax: 
<blockquote><b>SetWindowsHookEx proto HookType:DWORD, pHookProc:DWORD, hInstance:DWORD, 
  ThreadID:DWORD</b> 
  <ul>
    <li> HookType is one of the values listed above, e.g., <b>WH_MOUSE</b>, <b>WH_KEYBOARD</b></li>
    <li> pHookProc is the address of the hook procedure that will be called to 
      process the messages for the specified hook. If the hook is a remote one, 
      it must reside in a DLL. If not, it must be in your process.</li>
    <li> hInstance is the instance handle of the DLL in which the hook procedure 
      resides. If the hook is a local one, this value must be NULL</li>
    <li> ThreadID&nbsp; is the ID of the thread you want to install the hook to 
      spy on. This parameter is the one that determines whether a hook is local 
      or remote. If this parameter is NULL, Windows will interpret the hook as 
      a system-wide remote hook that affects all threads in the system. If you 
      specify the thread ID of a thread in your own process, this hook is a local 
      one. If you specify the thread ID from other process, the hook is a thread-specific 
      remote one. There are two exceptions to this rule: <b>WH_JOURNALRECORD</b> 
      and <b>WH_JOURNALPLAYBACK</b> are always local system-wide hooks that are 
      not required to be in a DLL. And <b>WH_SYSMSGFILTER</b> is always a system-wide 
      remote hook. Actually it is identical to <b>WH_MSGFILTER</b> hook with ThreadID==0.</li>
  </ul>
  If the call is successful, it returns the hook handle in eax. If not, NULL is 
  returned. You must save the hook handle for unhooking later.</blockquote>
You can uninstall a hook by calling<b> UnhookWindowsHookEx</b> which accepts only 
one parameter, the handle of the hook you want to uninstall. If the call succeeds, 
it returns a non-zero value in eax. Otherwise, it returns NULL. <br>
Now that you know how to install/uninstall hooks, we can examine the hook procedure. 
<br>
The hook procedure will be called whenever an event that is associated with the 
type of hook you have installed occurs. For example, if you install <b>WH_MOUSE</b> 
hook, when a mouse event occurs, your hook procedure will be called. Regardless 
of the type of hook you installed, the hook procedure always has the following 
prototype: 
<ul>
  <b>HookProc proto nCode:DWORD, wParam:DWORD, lParam:DWORD</b> <br>
  &nbsp; 
  <ul>
    <li> nCode specifies the hook code.</li>
    <li> wParam and lParam contain additional information about the event</li>
  </ul>
</ul>
HookProc is actually a placeholder for the function name. You can name it anything 
you like so long as it has the above prototype. The interpretation of nCode, wParam 
and lParam is dependent on the type of hook you install. So as the return value 
from the hook procedure. For example: 
<blockquote><b>WH_CALLWNDPROC</b> 
  <ul>
    <li> nCode can be only HC_ACTION which means there is a message sent to a 
      window</li>
    <li> wParam contains the message being sent, if it's not zero</li>
    <li> lParam points to a CWPSTRUCT structure</li>
    <li> return value: not used, return zero</li>
  </ul>
  <b>WH_MOUSE</b> 
  <ul>
    <li> nCode can be HC_ACTION or HC_NOREMOVE</li>
    <li> wParam contains the mouse message</li>
    <li> lParam points to a MOUSEHOOKSTRUCT structure</li>
    <li> return value: zero if the message should be processed. 1 if the message 
      should be discarded.</li>
  </ul>
</blockquote>
The bottom line is: you must consult your win32 api reference for details about 
the meanings of the parameters and return value of the hook you want to install. 
<br>
Now there is a little catch about the hook procedure. Remember that the hooks 
are chained in a linked list with the most recently installed hook at the head 
of the list. When an event occurs, Windows will call only the first hook in the 
chain. It's your hook procedure's responsibility to call the next hook in the 
chain. You can choose not to call the next hook but you'd better know what you're 
doing. Most of the time, it's a good practice to call the next procedure so other 
hooks can have a shot at the event. You can call the next hook by calling <b>CallNextHookEx</b> 
which has the following prototype: 
<blockquote><b>CallNextHookEx proto hHook:DWORD, nCode:DWORD, wParam:DWORD, lParam:DWORD</b> 
  <ul>
    <li> hHook is your own hook handle. The function uses this handle to traverse 
      the linked list and search for the hook procedure it should call next.</li>
    <li> nCode, wParam and lParam&nbsp; you can just pass those three values you 
      receive from Windows to CallNextHookEx.</li>
  </ul>
</blockquote>
An important note about remote hooks: the hook procedure must reside in a DLL 
which will be mapped into other processes. When Windows maps the DLL into other 
processes, it will not map the data section(s) into the other processes. In short, 
all processes share a single copy of code but they will have their own private 
copy of the DLL's data section! This can be a big surprise to the unwary. You 
may think that when you store a value into a variable in the data section of a 
DLL, that value will be shared among all processes that load the DLL into their 
process address space. It's simply not true. In normal situation, this behavior 
is desirable since it provides the illusion that each process has its own copy 
of the DLL. But not when Windows hook is concerned. We want the DLL to be identical 
in all processes, including the data. The solution: you must mark the data section 
as shared. You can do this by specifying the section(s) attribute in the linker 
switch. For MASM, you need to use this switch: 
<blockquote><b>/SECTION:&lt;section name>, S</b></blockquote>
The name of the initialized data section is .data and the uninitialized data is 
.bss. For example if you want to assemble a DLL which contains a hook procedure 
and you want the uninitialized data section to be shared amoung processes, you 
must use the following line: 
<blockquote><b>link /section:.bss,S&nbsp; /DLL&nbsp; /SUBSYSTEM:WINDOWS ..........</b></blockquote>
S attribute marks the section as shared. 
<h3> Example:</h3>
There are two modules: one is the main program which will do the GUI part and 
the other is the DLL that will install/uninstall the hook. 
<p>;--------------------------------------------- This is the source code of the 
  main program -------------------------------------- <br>
  <b>.386</b> <br>
  <b>.model flat,stdcall</b> <br>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米精品一区二区三区在线观看一 | 国产色综合一区| 99精品热视频| 老司机精品视频导航| 中文字幕一区二区在线播放| 欧美一区二区三区免费在线看 | 精品成人一区二区三区| 日本道色综合久久| 国产黄色精品网站| 裸体一区二区三区| 亚洲一区二区三区四区五区黄| 国产嫩草影院久久久久| 欧美一区二区三区在| 色欧美乱欧美15图片| 国产aⅴ综合色| 国产精品69毛片高清亚洲| 日韩电影在线观看网站| 亚洲高清免费视频| 亚洲乱码国产乱码精品精可以看| wwww国产精品欧美| 欧美一二三四区在线| 欧美日韩一卡二卡三卡 | 国产日韩欧美a| 欧美哺乳videos| 日韩一区二区三区免费观看| 欧美羞羞免费网站| 色视频成人在线观看免| 99精品偷自拍| 91天堂素人约啪| 99免费精品视频| 成人性生交大合| 成人听书哪个软件好| 大白屁股一区二区视频| 国产一区二区三区在线观看精品 | 最新国产の精品合集bt伙计| 久久精品视频一区| 久久久精品国产免费观看同学| 日韩欧美中文一区二区| 欧美一级黄色录像| 91精品国产综合久久精品app| 欧美日韩小视频| 欧美日韩精品一区二区三区| 在线精品视频免费观看| 色94色欧美sute亚洲线路一久| 色综合天天在线| 欧美成人精品3d动漫h| 7777精品伊人久久久大香线蕉完整版| 欧美亚洲愉拍一区二区| 欧美日韩五月天| 欧美精品丝袜中出| 日韩三区在线观看| 国产网站一区二区三区| 国产精品传媒视频| 亚洲综合在线第一页| 亚洲一卡二卡三卡四卡| 日韩av成人高清| 国产综合成人久久大片91| 国产毛片精品视频| eeuss影院一区二区三区 | 日本久久精品电影| 欧美精品在线一区二区三区| 日韩欧美精品在线视频| 久久精品亚洲一区二区三区浴池| 国产精品国产三级国产| 一区二区三区中文字幕电影| 香蕉成人伊视频在线观看| 国产一区欧美一区| 99久久精品国产一区| 欧美精品一级二级三级| 26uuu国产电影一区二区| 中文字幕亚洲一区二区va在线| 亚洲午夜国产一区99re久久| 麻豆免费看一区二区三区| 成人高清视频在线观看| 欧美日韩大陆在线| 国产午夜精品久久| 亚洲高清免费观看 | 国产成人aaaa| 欧美午夜免费电影| www国产亚洲精品久久麻豆| 亚洲乱码精品一二三四区日韩在线| 天天av天天翘天天综合网| 国产精品亚洲午夜一区二区三区| 在线欧美一区二区| 精品乱人伦一区二区三区| 亚洲人成7777| 黑人巨大精品欧美一区| 色系网站成人免费| 久久亚洲欧美国产精品乐播 | 韩国欧美一区二区| 色婷婷一区二区| 精品国产亚洲在线| 亚洲国产cao| 成人高清在线视频| 欧美成人vr18sexvr| 一区二区高清在线| 国产91精品久久久久久久网曝门| 欧美日本在线观看| 中文字幕一区二区视频| 国产主播一区二区| 欧美一区二区视频在线观看2020| 亚洲美女屁股眼交| 国产成人av电影在线| 欧美一二三区精品| 午夜在线成人av| 91丨porny丨首页| 久久久久一区二区三区四区| 亚洲123区在线观看| 99久久99久久精品国产片果冻| 久久影院午夜片一区| 日韩av网站免费在线| 在线国产亚洲欧美| 18成人在线观看| 成人久久视频在线观看| 久久美女高清视频| 免费在线欧美视频| 制服丝袜av成人在线看| 亚洲最大成人网4388xx| av在线播放不卡| 中文字幕av资源一区| 国产最新精品精品你懂的| 日韩欧美一区二区三区在线| 五月激情六月综合| 欧美日韩视频一区二区| 亚洲综合一区二区精品导航| 91亚洲男人天堂| 国产精品久久久久久久第一福利| 国产一区二区三区四区五区入口| 日韩视频一区二区| 美女一区二区三区| 91精品国产一区二区| 青青青伊人色综合久久| 91精品国产综合久久久蜜臀图片| 天天综合天天综合色| 欧美日韩精品一区视频| 日韩中文字幕亚洲一区二区va在线| 欧美在线观看视频一区二区| 亚洲国产中文字幕在线视频综合 | 欧美亚一区二区| 亚洲成人免费看| 777亚洲妇女| 麻豆精品视频在线观看| 久久网这里都是精品| 国产曰批免费观看久久久| 久久蜜臀精品av| www..com久久爱| 亚洲男人的天堂在线aⅴ视频| 色婷婷亚洲一区二区三区| 亚洲午夜精品久久久久久久久| 欧美男同性恋视频网站| 麻豆成人综合网| 国产欧美日韩三级| 国产91精品在线观看| 亚洲免费在线观看| 欧美日韩色综合| 久久91精品久久久久久秒播| 久久色.com| 91蜜桃在线免费视频| 亚洲高清不卡在线观看| 日韩精品影音先锋| 成人做爰69片免费看网站| 玉足女爽爽91| 欧美电影免费观看高清完整版在| 精品一区二区三区不卡 | 日韩欧美亚洲国产另类| 国产精品一二一区| 一区二区三区欧美在线观看| 欧美精品v日韩精品v韩国精品v| 极品销魂美女一区二区三区| 国产精品全国免费观看高清 | 中文字幕va一区二区三区| 91福利国产精品| 九九视频精品免费| 亚洲天堂免费看| 欧美一区二区三区思思人| 国产成人小视频| 亚洲国产精品一区二区尤物区| 26uuuu精品一区二区| 在线一区二区视频| 国产一区二区三区国产| 亚洲精品写真福利| 精品久久免费看| 欧美午夜片在线看| 成人永久aaa| 蜜臀a∨国产成人精品| 国产精品萝li| 日韩欧美成人午夜| 日本福利一区二区| 国产99一区视频免费| 爽好多水快深点欧美视频| 国产精品欧美经典| 精品国精品国产尤物美女| 91豆麻精品91久久久久久| 国产剧情一区二区| 午夜视频一区二区三区| 国产精品乱码一区二三区小蝌蚪| 欧美精品v国产精品v日韩精品 | 国内精品写真在线观看 | aaa国产一区| 国精产品一区一区三区mba视频|