﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; hook</title>
	<atom:link href="https://www.softwareace.cn/?feed=rss2&#038;tag=hook" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>windows sdk编程系列文章 &#8212;- 钩子(下)</title>
		<link>https://www.softwareace.cn/?p=357</link>
		<comments>https://www.softwareace.cn/?p=357#comments</comments>
		<pubDate>Mon, 15 Apr 2013 10:26:46 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[屏幕取词]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=357</guid>
		<description><![CDATA[[crayon-69f0b5195f14f028135019/] &#160; 该应用程序有一个全局变量，Ho [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">if(InstallHook(hwndDlg) != NULL)
                        {
                            HookFlag = TRUE;
                            SetDlgItemText(hwndDlg,IDC_HOOK,UnhookText);
                            OutputDebugString("hook/n");
                        }</pre><p>&nbsp;</p>
<p>该应用程序有一个全局变量，HookFlag，它用来监视钩子的状态。如果安装来钩子它就是TRUE，否则是FALSE。 当用户按下Hook按钮时，应用程序检查钩子是否已经安装。如果还没有的话，它将调用DLL中引出的函数InstallHook来安装它。注意我们把主对话框的句柄传递给了DLL，这样这个钩子DLL就可以把WM_MOUSEHOOK消息传递给正确的窗口了。当应用程序加载时，钩子DLL也同时加载。时机上当主程序一旦加载到内存中后，DLL就立即加载。DLL的入口点函数载主程序的第一条语句执行前就前执行了。所以当主程序执行时，DLL已经初始化好了。我们载入口点处放入如下代码：</p>
<p><strong>BOOL APIENTRY DllMain( HANDLE hModule,                        DWORD ul_reason_for_call,                         LPVOID lpReserved                     ) {    g_hInstance = (HINSTANCE)hModule;     return TRUE; }</strong></p>
<p>该段代码把DLL自己的实例句柄放到一个全局变量中保存。由于入口点函数是在所有函数调用前被执行的，所以hInstance总是有效的。我们把该变量放到.data中，使得每一个进程都有自己一个该变量的值。因为当鼠标光标停在一个窗口上时，钩子DLL被映射进进程的地址空间。加入在DLL缺省加载的地址处已经加载其它的DLL，那钩子DLL将要被映射到其他的地址。hInstance将被更新成其它的值。当用户按下Unhook再按下Hook时，SetWindowsHookEx将被再次调用。这一次，它将把新的地址作为实例句柄。而在例子中这是错误的，DLL装载的地址并没有变。这个钩子将变成一个局部的，您只能钩挂发生在您窗口中的鼠标事件，这是很难让人满意的 。</p>
<p><strong>HHOOK InstallHook (HWND hWnd) {    g_hWnd = hWnd;    g_hHook = SetWindowsHookEx(WH_MOUSE,MouseProc,g_hInstance,0);    return g_hHook; }<br />
</strong></p>
<p>InstallHook 函数非常简单。它把传递过来的窗口句柄保存在hWnd中以备后用。接着调用SetWindowsHookEx函数来安装一个鼠标钩子。该函数的返回值放在全局变量hHook中，将来在UnhookWindowsHookEx中还要使用。在调用SetWindowsHookEx后，鼠标钩子就开始工作了。无论什么时候发生了鼠标事件，MouseProc函数都将被调用：</p>
<p><strong> LRESULT CALLBACK MouseProc(          int nCode,     WPARAM wParam,     LPARAM lParam ) {    CallNextHookEx(g_hHook,nCode,wParam,lParam);    LPMOUSEHOOKSTRUCT ps = (LPMOUSEHOOKSTRUCT)lParam;    HWND hWnd = WindowFromPoint(ps-&gt;pt);    PostMessage(g_hWnd,WM_MOUSEHOOK,(WPARAM)hWnd,0);    return 0; }<br />
</strong></p>
<p>钩子函数首先调用CallNextHookEx函数让其它的钩子处理该鼠标事件。然后，调用WindowFromPoint函数来得到给定屏幕坐标位置处的窗口句柄。注意：我们用lParam指向的MOUSEHOOKSTRUCT型结构体变量中的POINT成员变量作为当前的鼠标位置。在我们调用PostMessage函数把WM_MOUSEHOOK消息发送到主程序。您必须记住的一件事是：在钩子函数中不要使用SendMessage函数，它会引起死锁。MOUSEHOOKSTRUCT的定义如下：</p><pre class="crayon-plain-tag">typedef struct {     POINT pt;     HWND hwnd;     UINT wHitTestCode;     ULONG_PTR dwExtraInfo; } MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT;</pre><p>&nbsp;</p>
<ul>
<li>pt 是当前鼠标所在的屏幕位置。</li>
<li>hwnd 是将接收鼠标消息的窗口的句柄。通常它是鼠标所在处的窗口，但是如果窗口调用了SetCapture，鼠标的输入将到向到这个窗口。因我们不用该成员变量而是用WindowFromPoint函数。</li>
<li>wHitTestCode 指定hit-test值，该值给出了更多的鼠标位置值。它指定了鼠标在窗口的那个部位。该值的完全列表，请参考WIN32 API 指南中的WM_NCHITTEST消息。</li>
<li>dwExtraInfo 该值包含了相关的信息。一般该值由mouse_event函数设定，可以调用GetMessageExtraInfo来获得。</li>
</ul>
<p>&nbsp;</p>
<p>当主窗口接收到WM_MOUSEHOOK 消息时，它用wParam参数中的窗口句柄来查询窗口的消息。</p>
<p><strong>       case WM_MOUSEHOOK:         GetDlgItemText(hwndDlg,IDC_HANDLE,(LPSTR)temp,128);         wsprintf((LPSTR)buffer,mytemplate,wParam);         if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)             SetDlgItemText(hwndDlg,IDC_HANDLE,(LPCSTR)buffer);                  GetDlgItemText(hwndDlg,IDC_CLASSNAME,(LPSTR)temp,128);         GetClassName((HWND)wParam,(LPSTR)buffer,128);         if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)             SetDlgItemText(hwndDlg,IDC_CLASSNAME,(LPCSTR)buffer);<br />
GetDlgItemText(hwndDlg,IDC_WNDPROC,(LPSTR)temp,128);         wsprintf((LPSTR)buffer,mytemplate,GetClassLong((HWND)wParam,GCL_WNDPROC));         if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)             SetDlgItemText(hwndDlg,IDC_WNDPROC,(LPCSTR)buffer);         break;</strong></p>
<p>为了避免重绘文本时的抖动，我们把已经在编辑空间中线时的文本和我们将要显示的对比。如果相同，就可以忽略掉。得到类名调用GetClassName，得到窗口过程调用GetClassLong并传入GCL_WNDPROC标志，然后把它们格式化成文本串并放到相关的编辑空间中去。</p>
<p><strong>                           UninstallHook();                             SetDlgItemText(hwndDlg,IDC_HOOK,HookText);                             HookFlag = FALSE;                             SetDlgItemText(hwndDlg,IDC_CLASSNAME,NULL);                             SetDlgItemText(hwndDlg,IDC_HANDLE,NULL);                             SetDlgItemText(hwndDlg,IDC_WNDPROC,NULL);</strong></p>
<p>当用户按下Unhook后，主程序调用DLL中的UninstallHook函数。该函数调用UnhookWindowsHookEx函数。然后，它把按钮的文本换回“Hook”，HookFlag的值设成FALSE再清除掉编辑控件中的文本。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=357</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>windows sdk编程系列文章 &#8212;- 钩子(上)</title>
		<link>https://www.softwareace.cn/?p=356</link>
		<comments>https://www.softwareace.cn/?p=356#comments</comments>
		<pubDate>Mon, 15 Apr 2013 10:25:33 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[屏幕取词]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=356</guid>
		<description><![CDATA[本课中我们将要学习WINDOWS钩子函数的使用方法。WINDOWS钩子函数的功能非常强大，有了它您可以探测其它 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>本课中我们将要学习WINDOWS钩子函数的使用方法。WINDOWS钩子函数的功能非常强大，有了它您可以探测其它进程并且改变其它进程的行为。</p>
<h3>理论：</h3>
<p>WINDOWS的钩子函数可以认为是WINDOWS的主要特性之一。利用它们，您可以捕捉您自己进程或其它进程发生的事件。通过“钩挂”，您可以给WINDOWS一个处理或过滤事件的回调函数，该函数也叫做“钩子函数”，当每次发生您感兴趣的事件时，WINDOWS都将调用该函数。一共有两种类型的钩子：局部的和远程的。</p>
<ul>
<li>局部钩子仅钩挂您自己进程的事件。</li>
<li>远程的钩子还可以将钩挂其它进程发生的事件。远程的钩子又有两种：
<ul>
<li>基于线程的 它将捕获其它进程中某一特定线程的事件。简言之，就是可以用来观察其它进程中的某一特定线程将发生的事件。</li>
<li>系统范围的 将捕捉系统中所有进程将发生的事件消息。</li>
</ul>
</li>
</ul>
<p>安装钩子函数将会影响系统的性能。监测“系统范围事件”的系统钩子特别明显。因为系统在处理所有的相关事件时都将调用您的钩子函数，这样您的系统将会明显的减慢。所以应谨慎使用，用完后立即卸载。还有，由于您可以预先截获其它进程的消息，所以一旦您的钩子函数出了问题的话必将影响其它的进程。记住：功能强大也意味着使用时要负责任。 在正确使用钩子函数前，我们先讲解钩子函数的工作原理。当您创建一个钩子时，WINDOWS会先在内存中创建一个数据结构，该数据结构包含了钩子的相关信息，然后把该结构体加到已经存在的钩子链表中去。新的钩子将加到老的前面。当一个事件发生时，如果您安装的是一个局部钩子，您进程中的钩子函数将被调用。如果是一个远程钩子，系统就必须把钩子函数插入到其它进程的地址空间，要做到这一点要求钩子函数必须在一个动态链接库中，所以如果您想要使用远程钩子，就必须把该钩子函数放到动态链接库中去。当然有两个例外：工作日志钩子和工作日志回放钩子。这两个钩子的钩子函数必须在安装钩子的线程中。原因是：这两个钩子是用来监控比较底层的硬件事件的，既然是记录和回放，所有的事件就当然都是有先后次序的。所以如果把回调函数放在DLL中，输入的事件被放在几个线程中记录，所以我们无法保证得到正确的次序。故解决的办法是：把钩子函数放到单个的线程中，譬如安装钩子的线程。 钩子一共有14种，以下是它们被调用的时机：</p>
<ul>
<li>WH_CALLWNDPROC 当调用SendMessage时</li>
<li>WH_CALLWNDPROCRET 当SendMessage的调用返回时</li>
<li>WH_GETMESSAGE 当调用GetMessage 或 PeekMessage时</li>
<li>WH_KEYBOARD 当调用GetMessage 或 PeekMessage 来从消息队列中查询WM_KEYUP 或 WM_KEYDOWN 消息时</li>
<li>WH_MOUSE 当调用GetMessage 或 PeekMessage 来从消息队列中查询鼠标事件消息时</li>
<li>WH_HARDWARE 当调用GetMessage 或 PeekMessage 来从消息队列种查询非鼠标、键盘消息时</li>
<li>WH_MSGFILTER 当对话框、菜单或滚动条要处理一个消息时。该钩子是局部的。它时为那些有自己的消息处理过程的控件对象设计的。</li>
<li>WH_SYSMSGFILTER 和WH_MSGFILTER一样，只不过是系统范围的</li>
<li>WH_JOURNALRECORD 当WINDOWS从硬件队列中获得消息时</li>
<li>WH_JOURNALPLAYBACK 当一个事件从系统的硬件输入队列中被请求时</li>
<li>WH_SHELL 当关于WINDOWS外壳事件发生时，譬如任务条需要重画它的按钮.</li>
<li>WH_CBT 当基于计算机的训练(CBT)事件发生时</li>
<li>WH_FOREGROUNDIDLE 由WINDOWS自己使用，一般的应用程序很少使用</li>
<li>WH_DEBUG 用来给钩子函数除错</li>
</ul>
<p>现在我们知道了一些基本的理论，现在开始讲解如何安装/卸载一个钩子。  要安装一个钩子，您可以调用SetWindowHookEx函数。该函数的原型如下：</p>
<blockquote><p>HHOOK SetWindowsHookEx( int <em>idHook</em>,      HOOKPROC <em>lpfn</em>,      HINSTANCE <em>hMod</em>,      DWORD <em>dwThreadId</em> );</p>
<ul>
<li><em>idHook</em> 是我们上面列出的值之一,譬如： WH_MOUSE, WH_KEYBOARD</li>
<li><em>lpfn</em>是钩子函数的地址。如果使用的是远程的钩子，就必须放在一个DLL中，否则放在本身代码中</li>
<li><em>hMod</em> 钩子函数所在DLL的实例句柄。如果是一个局部的钩子，该值为NULL</li>
<li><em>dwThreadId</em> 是您安装该钩子函数后想监控的线程的ID号。该参数可以决定该钩子是局部的还是系统范围的。如果该值为NULL，那么该钩子将被解释成系统范围内的，那它就可以监控所有的进程及它们的线程。如果您指定了您自己进程中的某个线程ID 号，那该钩子是一个局部的钩子。如果该线程ID是另一个进程中某个线程的ID，那该钩子是一个全局的远程钩子。这里有两个特殊情况：WH_JOURNALRECORD 和 WH_JOURNALPLAYBACK总是代表局部的系统范围的钩子，之所以说是局部，是因为它们没有必要放到一个DLL中。WH_SYSMSGFILTER 总是一个系统范围内的远程钩子。其实它和WH_MSGFILTER钩子类似，如果把参数ThreadID设成0的话，它们就完全一样了。</li>
</ul>
<p>如果该函数调用成功的话，将返回钩子的句柄，否则返回NULL。您必须保存该句柄，因为后面我们还要它来卸载钩子。</p></blockquote>
<p>要卸载一个钩子时调用UnhookWidowHookEx函数，该函数仅有一个参数，就是欲卸载的钩子的句柄。如果调用成功的话，返回非0值，否则返回NULL。 现在您知道了如何安装和卸载一个钩子了，接下来我们将看看钩子函数。.  只要您安装的钩子的消息事件类型发生，WINDOWS就将调用钩子函数。譬如您安装的钩子是WH_MOUSE类型，那么只要有一个鼠标事件发生时，该钩子函数就会被调用。不管您安装的时那一类型钩子，钩子函数的原型都时是一样的：<br />
<strong>LRESULT CALLBACK HookProc ( int <em>code</em>,      WPARAM <em>wParam</em>,      LPARAM <em>lParam</em> );</strong></p>
<ul>
<li>
<ul>
<li>nCode 指定是否需要处理该消息</li>
<li>wParam 和 lParam 包含该消息的附加消息</li>
</ul>
</li>
</ul>
<p>HookProc 可以看作是一个函数名的占位符。只要函数的原型一致，您可以给该函数取任何名字。至于以上的几个参数及返回值的具体含义各种类型的钩子都不相同。譬如：</p>
<blockquote><p><strong>WH_CALLWNDPROC</strong></p>
<ul>
<li>nCode 只能是HC_ACTION，它代表有一个消息发送给了一个窗口</li>
<li>wParam 如果非0，代表正被发送的消息</li>
<li>lParam 指向CWPSTRUCT型结构体变量的指针</li>
<li>return value: 未使用，返回0</li>
</ul>
<p><strong>WH_MOUSE</strong></p>
<ul>
<li>nCode 为HC_ACTION 或 HC_NOREMOVE</li>
<li>wParam 包含鼠标的事件消息</li>
<li>lParam 指向MOUSEHOOKSTRUCT型结构体变量的指针</li>
<li>return value: 如果不处理返回0，否则返回非0值</li>
</ul>
</blockquote>
<p>所以您必须查询您的WIN32 API 指南来得到不同类型的钩子的参数的详细定义以及它们返回值的意义。这里还有一个问题需要注意：所有的钩子都串在一个链表上，最近加入的钩子放在链表的头部。当一个事件发生时，WINDOWS将按照从链表头到链表尾调用的顺序。所以您的钩子函数有责任把消息传到下一个链中的钩子函数。当然您可以不这样做，但是您最好明白这时这么做的原因。在大多数的情况下，最好把消息事件传递下去以便其它的钩子都有机会获得处理这一消息的机会。调用下一个钩子函数可以调用函数CallNextHookEx。该函数的原型如下：<br />
LRESULT CallNextHookEx( HHOOK <em>hhk</em>,      int <em>nCode</em>,      WPARAM <em>wParam</em>,      LPARAM <em>lParam</em> );</p>
<blockquote>
<ul>
<li><em>hhk</em> 时是您自己的钩子函数的句柄。利用该句柄可以遍历钩子链。</li>
<li>nCode, wParam and lParam 您只要把传入的参数简单传给CallNextHookEx即可。</li>
</ul>
</blockquote>
<p>请注意：对于远程钩子，钩子函数必须放到DLL中，它们将从DLL中映射到其它的进程空间中去。当WINDOWS映射DLL到其它的进程空间中去时，不会把数据段也进行映射。简言之，所有的进程仅共享DLL的代码，至于数据段，每一个进程都将有其单独的拷贝。这是一个很容易被忽视的问题。您可能想当然的以为，在DLL中保存的值可以在所有映射该DLL的进程之间共享。在通常情况下，由于每一个映射该DLL的进程都有自己的数据段，所以在大多数的情况下您的程序运行得都不错。但是钩子函数却不是如此。对于钩子函数来说，要求DLL的数据段对所有的进程也必须相同。这样您就必须把数据段设成共享的，这可以通过在链接开关中指定段的属性来实现。<br />
#pragma   data_seg(&#8220;Shared&#8221;)  HINSTANCE g_hInstance = NULL; HHOOK       g_hHook = NULL; HWND         g_hWnd = NULL; #pragma   data_seg()  #pragma   comment(linker,&#8221;/SECTION:Shared,RWS&#8221;)   <strong><br />
</strong>Shared代表该段是共享段。</p>
<h3>例子：</h3>
<p>一共有两个模块：一个是GUI部分，见光盘D:/mybook/examples/FirstWindow22/exe 另一个是安装和卸载钩子的DLL,见光盘D:/mybook/examples/FirstWindow22/dll</p><pre class="crayon-plain-tag">dll代码：
#include &quot;windows.h&quot;
#define WM_MOUSEHOOK WM_USER+6

#pragma   data_seg(&quot;Shared&quot;) 
HINSTANCE g_hInstance = NULL;
HHOOK       g_hHook = NULL;
HWND         g_hWnd = NULL;
#pragma   data_seg() 
#pragma   comment(linker,&quot;/SECTION:Shared,RWS&quot;)   

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD ul_reason_for_call, 
                       LPVOID lpReserved
                    )
{
    g_hInstance = (HINSTANCE)hModule;
    return TRUE;
}

LRESULT CALLBACK MouseProc(          int nCode,
    WPARAM wParam,
    LPARAM lParam
)
{
    CallNextHookEx(g_hHook,nCode,wParam,lParam);
    LPMOUSEHOOKSTRUCT ps = (LPMOUSEHOOKSTRUCT)lParam;
    HWND hWnd = WindowFromPoint(ps-&amp;gt;pt);
    PostMessage(g_hWnd,WM_MOUSEHOOK,(WPARAM)hWnd,0);
    return 0;
}

HHOOK InstallHook (HWND hWnd)
{
    g_hWnd = hWnd;
    g_hHook = SetWindowsHookEx(WH_MOUSE,MouseProc,g_hInstance,0);
    return g_hHook;
}

void UninstallHook()
{
    UnhookWindowsHookEx(g_hHook);
}

exe代码：
#include &quot;windows.h&quot;
#include &quot;tchar.h&quot;
#pragma comment(lib,&quot;mhook.lib&quot;)
HHOOK InstallHook (HWND hWnd);
void UninstallHook();
LRESULT CALLBACK MouseProc(          int nCode,
    WPARAM wParam,
    LPARAM lParam
);

#define IDD_MAINDLG                      101
#define IDC_CLASSNAME                    1000
#define IDC_HANDLE                       1001
#define IDC_WNDPROC                      1002
#define IDC_HOOK                         1004
#define IDC_EXIT                         1005
#define WM_MOUSEHOOK                     WM_USER+6

BOOL HookFlag = FALSE;
TCHAR HookText[] = _T(&quot;&amp;amp;Hook&quot;);
TCHAR UnhookText[] = _T(&quot;&amp;amp;Unhook&quot;);
TCHAR mytemplate[] = _T(&quot;%lx&quot;);
HINSTANCE g_hInstance;
HHOOK hHook;

INT CALLBACK DlgFunc(          
                            HWND hwndDlg,
                            UINT uMsg,
                            WPARAM wParam,
                            LPARAM lParam
                            )
{
    BYTE buffer[128];
    BYTE temp[128];
    RECT rect;
    switch(uMsg)
    {
    case WM_CLOSE:
        if(HookFlag)
            UninstallHook();
        EndDialog(hwndDlg,NULL);
        break;
    case WM_INITDIALOG:
        GetWindowRect(hwndDlg,&amp;amp;rect);
        SetWindowPos(hwndDlg,HWND_TOPMOST,rect.left,rect.top,rect.right,rect.bottom,SWP_SHOWWINDOW);
        break;
    case WM_MOUSEHOOK:
        GetDlgItemText(hwndDlg,IDC_HANDLE,(LPSTR)temp,128);
        wsprintf((LPSTR)buffer,mytemplate,wParam);
        if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)
            SetDlgItemText(hwndDlg,IDC_HANDLE,(LPCSTR)buffer);

        GetDlgItemText(hwndDlg,IDC_CLASSNAME,(LPSTR)temp,128);
        GetClassName((HWND)wParam,(LPSTR)buffer,128);
        if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)
            SetDlgItemText(hwndDlg,IDC_CLASSNAME,(LPCSTR)buffer);

        GetDlgItemText(hwndDlg,IDC_WNDPROC,(LPSTR)temp,128);
        wsprintf((LPSTR)buffer,mytemplate,GetClassLong((HWND)wParam,GCL_WNDPROC));
        if(lstrcmpi((LPCSTR)buffer,(LPCSTR)temp) != 0)
            SetDlgItemText(hwndDlg,IDC_WNDPROC,(LPCSTR)buffer);
        break;

    case WM_COMMAND:
        if(lParam != 0)
        {
            if(HIWORD(wParam) == BN_CLICKED)
            {
                if(LOWORD(wParam) == IDC_EXIT)
                    SendMessage(hwndDlg,WM_CLOSE,0,0);

                else if(LOWORD(wParam) == IDC_HOOK)
                {
                    if(!HookFlag)
                    {
                        if(InstallHook(hwndDlg) != NULL)
                        {
                            HookFlag = TRUE;
                            SetDlgItemText(hwndDlg,IDC_HOOK,UnhookText);
                            OutputDebugString(&quot;hook/n&quot;);
                        }
                    }
                    else
                    {
                            OutputDebugString(&quot;unhook/n&quot;);
                            UninstallHook();
                            SetDlgItemText(hwndDlg,IDC_HOOK,HookText);
                            HookFlag = FALSE;
                            SetDlgItemText(hwndDlg,IDC_CLASSNAME,NULL);
                            SetDlgItemText(hwndDlg,IDC_HANDLE,NULL);
                            SetDlgItemText(hwndDlg,IDC_WNDPROC,NULL);

                    }
                }
            }
        }
        break;
    default:
        return FALSE;

    }
    return TRUE;

}
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
     // TODO: Place code here.
    g_hInstance = hInstance;
    DialogBoxParam(g_hInstance,MAKEINTRESOURCE(IDD_MAINDLG),NULL,DlgFunc,NULL);
    return 0;
}</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=356</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows钩子简介</title>
		<link>https://www.softwareace.cn/?p=355</link>
		<comments>https://www.softwareace.cn/?p=355#comments</comments>
		<pubDate>Mon, 15 Apr 2013 10:09:29 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[屏幕取词]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=355</guid>
		<description><![CDATA[钩子（HOOK）是windows一种消息处理机制。一个钩子应用程序可以截获windows消息进行处理，并控制消 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>钩子（HOOK）是windows一种消息处理机制。一个钩子应用程序可以截获windows消息进行处理，并控制消息的流动。钩子起作用的原因是因为windows系统提供了钩子链。这个钩子链就是应用程序定义的钩子处理函数队列。当某种类型消息产生时，系统将消息传递到钩子链的第一个处理函数，该处理函数处理完，再决定是否将消息传递到链中的下一个处理函数。如果某个钩子处理函数获得消息后没有继续传送，则其以后的处理函数则无法获得应有的消息。（注意：对于某些类型的HOOK，不管HOOK链中的处理函数是否向下传递消息，与此类型HOOK关联的所有HOOK函数都会收到系统发送的消息。）最近安装的钩子总是放在钩子链的最前端，而最早安装的则放在最尾端。但是windows并不要求钩子的卸载顺序一定与安装顺序相反，只要有钩子卸载，系统便释放其占用的内存，并更新整个HOOK链表。如果程序安装了钩子，但还没使用程序便结束了，则系统会自动完成卸载操作。</p>
<p>钩子根据其对消息监视的范围的不同而分为系统钩子和线程钩子两大类： 线程钩子（局部钩子）只能监视本进程中某个指定线程的事件消息。一般在当前线程或当前线程派生的线程内。 系统钩子（全局钩子）是监视当前系统下运行的所以线程的事件消息。系统钩子可以监视系统中所有的应用程序，所以在使用系统钩子时必须放在独立的动态链接库（DLL）中。系统自动将这个DLL映射到受钩子函数影响的所有进程的地址空间中。 如果对于同一类型事件（如鼠标消息）既安装了线程钩子有安装了系统钩子，那么windows系统默认线程钩子优先级要高，即先调用线程钩子再调用系统钩子。对同一事件消息可安装多个钩子处理函数，这些钩子处理函数便形成了钩子链。（注意：系统钩子在使用过程中会延长消息处理时间，降低系统性能，所以在使用完毕要及时卸载。）</p>
<p>可以把钩子理解成一个回调函数，所以它的语法应符合回调函数的语法。其具体形式参考如下： LRESULT CALLBACK HookProc              // HookProc是钩子函数名称，CALLBACK也可换成WINAPI { int nCode;       // 确定钩子的行为，依赖于HOOOK的类型，每一种HOOK类型都有自己的HOOK代码特征字符集 WPARAM wParam;       // 与回调函数相似，包含关于发送或接收消息的信息 LPARAM lParam;       // 与回调函数相似，包含关于发送或接收消息的信息 }; windows针对不同的HOOK类型给出其钩子函数的形式，参数、返回值等都相同，只有钩子函数名和具体的参数取值不同。已有的HOOK函数有：CallWndProc、CallWndRetProc、CBTProc、DebugProc、ForegroundIdleProc、GetMsgProc、JournalPlaybackProc、JournalRecordProc、KeyboardProc、LowLevelKeyboardProc、LowLevelMouseProc、MessageProc、MouseProc、ShellProc、SysMsgProc。（具体的参数说明参考MSDN）</p>
<p>光定义了钩子处理函数还无法起作用，必须将钩子放入钩子链中它们才能发挥功能。将钩子放入钩子链需要SetWindowsHookEx函数的帮助。 HHOOK SetWindowsHookEx( int idHook,        // 欲安装的钩子类型 HOOKPROC lpfn,     // 钩子处理函数指针 HINSTANCE hMod,    // 应用程序实例句柄 DWORD dwThreadId   // 与钩子相关联的线程ID ); idHook指定了钩子处理函数的类型，它决定了钩子能处理什么事件消息。其取值主要有以下几种： 钩子类型                                         描述 WH_CALLWNDPROC                      监视系统将要传送给目标窗口处理函数的消息的钩子 WH_CALLWNDPROCRET                监视已被目标窗口处理函数处理后的消息的钩子 WH_CBT                                        基于CBT（computer-based training）应用程序钩子 WH_DEBUG                                   用于其他钩子处理函数调试的钩子 WH_FOREGROUNDIDLE                 当应用程序前台线程将要转向空闲时被调用的钩子 WH_GETMESSAGE                         监视进入消息队列的消息钩子 WH_JOURNALPLAYBACK               回放记录输入消息钩子 WH_JOURNALRECORD                  记录进入系统消息队列的输入消息钩子 WH_KEYBOARD                             监视键盘消息钩子 WH_KEYBOARD_LL                        监视低级键盘输入事件钩子 WH_MOUSE                                  监视鼠标消息钩子 WH_MOUSE_LL                             监视低级鼠标输入事件钩子 WH_MSGFILTER                            监视对话框、消息框、菜单或滚动条输入消息钩子 WH_SHELL                                    外壳钩子 WH_SYSMSGFILTER                      监视系统消息钩子 lpfn指定钩子处理函数的地址指针。如果dwThreadId为0或是一个由其他进程创建的线程标识，则lpfn必须指向DLL中钩子处理函数。lpfn也可指向当前进程中的钩子处理函数。 hMod是包含钩子处理函数的DLL句柄。如果dwThreadId标识的线程由当前进程所创建，而且钩子处理函数也属于当前进程，则hMod必须置为NULL。 dwThreadId指定与钩子处理函数相关联的线程的标识符。如果该参数为0，则钩子处理函数与所有已存在的线程关联，即全局钩子。钩子处理函数与线程相关联是指在一个钩子链表中发给该线程消息的同时也发送给钩子，且该消息先被钩子处理。钩子本身占用一个线程。 函数如果执行成功返回钩子函数的句柄，如果失败则返回NULL。我们也可以通过直接返回TRUE来丢弃该消息，并阻止该消息的传递。但是这样的话，钩子链中其他的钩子就不会接到通知，这将有可能造成不可预料的结果。 SetWindowsHookEx函数总是改应用程序定义的钩子安装到钩子链表的开头。是否通过调用CallNextHookEx函数将消息传递给钩子链中下一个钩子函数是可选的，但是建议最好通过显式调用该函数将消息传递给钩子链中其他的钩子函数，除非你的目的就是阻止该消息的向下传递。</p>
<p>LRESULT CallNextHookEx( HHOOK hhk,      // 当前钩子的句柄，由SetWindowsHookEx返回。 int nCode,      // 传递给钩子处理函数的事件代码，同钩子处理函数中参数nCode意义相同 WPARAM wParam, // 传递给钩子处理函数的包含关于发送或接收消息的信息 LPARAM lParam   // 传递给钩子处理函数的包含关于发送或接收消息的信息 ); 一个钩子处理完消息后，如果需要将消息传递给钩子链中的下一个钩子，就需要调用该函数。</p>
<p>BOOL UnhookWindowsHookEx( HHOOK hhk   // 要卸载的钩子句柄 ); 钩子在使用完之后需要调用该函数进行卸载，否则会造成不可预知的结果。</p>
<p>下面是一个使用钩子监视键盘信息的例子： // 这两个文件，可以将其编译成动态链接库，再在自己的应用程序中调用接口函数Start和stop，至于是隐式调用还是动态加载，视你自己的应用程序而定，至于如何编译动态链接库DLL可参考我的另一篇文章（<a href="http://hi.baidu.com/halty86/blog/item/1543ecb286edb8add9335a8c.html" target="_blank">动态链接库创建于使用</a>）。 头文件（hook.h）： extern &#8220;C&#8221; __declspec(dllexport) BOOL WINAPI Start(); extern &#8220;C&#8221; __declspec(dllexport) void WINAPI Stop();</p>
<p>源文件（hook.cpp）： #include &lt;windows.h&gt; #include &#8220;dll.h&#8221; #pragma data_seg(&#8220;Shared&#8221;) HHOOK mhook = NULL; HINSTANCE hInstance = NULL; #pragma data_seg() //#pragma comment(linker,&#8221;/section:Shared,rws&#8221;</p>
<p>LRESULT WINAPI KeyProc(int code, WPARAM wParam, LPARAM lParam) { if(code == HC_ACTION &amp;&amp; (lParam &amp; 0xc000ffff) == 1) {    char *sName;    BOOL b_Sft = ::GetAsyncKeyState(VK_SHIFT) &gt;&gt; ((sizeof(short) * 8)-1);    if(b_Sft)    {     switch(wParam)     {       case &#8217;1&#8242;:sName = &#8220;!&#8221;;break;       case &#8217;2&#8242;:sName = &#8220;@&#8221;;break;       case &#8217;3&#8242;:sName = &#8220;#&#8221;;break;       case &#8217;4&#8242;:sName = &#8220;$&#8221;;break;       case &#8217;5&#8242;:sName = &#8220;%&#8221;;break;       case &#8217;6&#8242;:sName = &#8220;^&#8221;;break;       case &#8217;7&#8242;:sName = &#8220;&amp;&#8221;;break;       case &#8217;8&#8242;:sName = &#8220;*&#8221;;break;       case &#8217;9&#8242;:sName = &#8220;(&#8220;;break;       case &#8217;0&#8242;:sName = &#8220;)&#8221;;break;       case &#8216;A&#8217;:sName = &#8220;A&#8221;;break;       case &#8216;B&#8217;:sName = &#8220;B&#8221;;break;       case &#8216;C&#8217;:sName = &#8220;C&#8221;;break;       case &#8216;D&#8217;:sName = &#8220;D&#8221;;break;       case &#8216;E&#8217;:sName = &#8220;E&#8221;;break;       case &#8216;F&#8217;:sName = &#8220;F&#8221;;break;       case &#8216;G&#8217;:sName = &#8220;G&#8221;;break;       case &#8216;H&#8217;:sName = &#8220;H&#8221;;break;       case &#8216;I&#8217;:sName = &#8220;I&#8221;;break;       case &#8216;J&#8217;:sName = &#8220;J&#8221;;break;       case &#8216;K&#8217;:sName = &#8220;K&#8221;;break;       case &#8216;L&#8217;:sName = &#8220;L&#8221;;break;       case &#8216;M&#8217;:sName = &#8220;M&#8221;;break;       case &#8216;N&#8217;:sName = &#8220;N&#8221;;break;       case &#8216;O&#8217;:sName = &#8220;O&#8221;;break;       case &#8216;P&#8217;:sName = &#8220;P&#8221;;break;       case &#8216;Q&#8217;:sName = &#8220;Q&#8221;;break;       case &#8216;R&#8217;:sName = &#8220;R&#8221;;break;       case &#8216;S&#8217;:sName = &#8220;S&#8221;;break;       case &#8216;T&#8217;:sName = &#8220;T&#8221;;break;       case &#8216;U&#8217;:sName = &#8220;U&#8221;;break;       case &#8216;V&#8217;:sName = &#8220;V&#8221;;break;       case &#8216;W&#8217;:sName = &#8220;W&#8221;;break;       case &#8216;X&#8217;:sName = &#8220;X&#8221;;break;       case &#8216;Y&#8217;:sName = &#8220;Y&#8221;;break;       case &#8216;Z&#8217;:sName = &#8220;Z&#8221;;break;     }    }    else    {     switch(wParam)     { // 0~9        case &#8217;1&#8242;:sName = &#8220;1&#8243;;break;       case &#8217;2&#8242;:sName = &#8220;2&#8243;;break;       case &#8217;3&#8242;:sName = &#8220;3&#8243;;break;       case &#8217;4&#8242;:sName = &#8220;4&#8243;;break;        case &#8217;5&#8242;:sName = &#8220;5&#8243;;break;       case &#8217;6&#8242;:sName = &#8220;6&#8243;;break;       case &#8217;7&#8242;:sName = &#8220;7&#8243;;break;       case &#8217;8&#8242;:sName = &#8220;8&#8243;;break;       case &#8217;9&#8242;:sName = &#8220;9&#8243;;break;       case &#8217;0&#8242;:sName = &#8220;0&#8243;;break;</p>
<p>// A~Z       case &#8216;A&#8217;:sName = &#8220;a&#8221;;break;       case &#8216;B&#8217;:sName = &#8220;b&#8221;;break;       case &#8216;C&#8217;:sName = &#8220;c&#8221;;break;       case &#8216;D&#8217;:sName = &#8220;d&#8221;;break;       case &#8216;E&#8217;:sName = &#8220;e&#8221;;break;       case &#8216;F&#8217;:sName = &#8220;f&#8221;;break;       case &#8216;G&#8217;:sName = &#8220;g&#8221;;break;       case &#8216;H&#8217;:sName = &#8220;h&#8221;;break;        case &#8216;I&#8217;:sName = &#8220;i&#8221;;break;      case &#8216;J&#8217;:sName = &#8220;j&#8221;;break;      case &#8216;K&#8217;:sName = &#8220;k&#8221;;break;       case &#8216;L&#8217;:sName = &#8220;l&#8221;;break;       case &#8216;M&#8217;:sName = &#8220;m&#8221;;break;       case &#8216;N&#8217;:sName = &#8220;n&#8221;;break;       case &#8216;O&#8217;:sName = &#8220;o&#8221;;break;       case &#8216;P&#8217;:sName = &#8220;p&#8221;;break;       case &#8216;Q&#8217;:sName = &#8220;q&#8221;;break;       case &#8216;R&#8217;:sName = &#8220;r&#8221;;break;       case &#8216;S&#8217;:sName = &#8220;s&#8221;;break;       case &#8216;T&#8217;:sName = &#8220;t&#8221;;break;       case &#8216;U&#8217;:sName = &#8220;u&#8221;;break;       case &#8216;V&#8217;:sName = &#8220;v&#8221;;break;       case &#8216;W&#8217;:sName = &#8220;w&#8221;;break;       case &#8216;X&#8217;:sName = &#8220;x&#8221;;break;       case &#8216;Y&#8217;:sName = &#8220;y&#8221;;break;       case &#8216;Z&#8217;:sName = &#8220;z&#8221;;break;     }    } //数字键</p>
<p>switch(wParam)    {     case VK_BACK:sName = &#8220;~&#8221;;break;     case VK_NUMPAD1:sName = &#8220;1&#8243;;break;     case VK_NUMPAD2:sName = &#8220;2&#8243;;break;     case VK_NUMPAD3:sName = &#8220;3&#8243;;break;     case VK_NUMPAD4:sName = &#8220;4&#8243;;break;     case VK_NUMPAD5:sName = &#8220;5&#8243;;break;     case VK_NUMPAD6:sName = &#8220;6&#8243;;break;      case VK_NUMPAD7:sName = &#8220;7&#8243;;break;     case VK_NUMPAD8:sName = &#8220;8&#8243;;break;     case VK_NUMPAD9:sName = &#8220;9&#8243;;break;     case VK_NUMPAD0:sName = &#8220;0&#8243;;break;      case VK_MULTIPLY:sName = &#8220;*&#8221;;break;     case VK_ADD:     sName = &#8220;+&#8221;;break;     case VK_SUBTRACT:sName = &#8220;-&#8221;;break;     case VK_DECIMAL: sName = &#8220;.&#8221;;break;     case VK_DIVIDE: sName = &#8220;/&#8221;;break;    }</p>
<p>HWND H_wnd = ::GetForegroundWindow();    MessageBox(H_wnd,sName,&#8221;键盘&#8221;,MB_OK); }</p>
<p>return FALSE; }</p>
<p>BOOL APIENTRY DllMain(HANDLE hModule,        DWORD ul_reason_for_call,        LPVOID lpReserved) { switch(ul_reason_for_call)    {     case DLL_PROCESS_ATTACH:     hInstance=(HINSTANCE)hModule;     break;     case DLL_THREAD_ATTACH:     case DLL_THREAD_DETACH:     case DLL_PROCESS_DETACH:     break; } return TRUE; }</p>
<p>extern &#8220;C&#8221; __declspec(dllexport) BOOL WINAPI Start() {    if(mhook!=NULL)    return FALSE; mhook=::SetWindowsHookEx(WH_KEYBOARD,KeyProc,hInstance,0); return mhook!=NULL; }</p>
<p>extern &#8220;C&#8221; __declspec(dllexport) void WINAPI Stop() { ::UnhookWindowsHookEx(mhook); }</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=355</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>线程注入、HOOK APIs（附VC6源码）</title>
		<link>https://www.softwareace.cn/?p=80</link>
		<comments>https://www.softwareace.cn/?p=80#comments</comments>
		<pubDate>Thu, 17 Jan 2013 07:00:29 +0000</pubDate>
		<dc:creator><![CDATA[littlesu]]></dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://192.168.0.106/?p=80</guid>
		<description><![CDATA[工作关系，想HOOK并修改一些API，使得不支持某些设备的第三方工具可以正常运行，因此花时间写了这么个工具。比 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	工作关系，想HOOK并修改一些API，使得不支持某些设备的第三方工具可以正常运行，因此花时间写了这么个工具。比如ReadFile时，某些设备不支持指定的缓存大小（如512KB），可以HOOK ReadFile，把缓存大小修改为更小，可能ReadFile就能正常工作，第三方工具也能正常使用。其实，只是想借工作这个契机，学习远程线程注入和HOOK API。工作上测试的设备和第三方工具运行在64位机上，还没有时间在64位机上修改并编译。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　运行DEMO说明：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　首先进入TestExe目录，打开MFCDialogApplication.exe，8个按钮分别简单的调用8个API，可一一点击查看效果，标题栏显示进程ID：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	<img alt="" src="http://img.my.csdn.net/uploads/201301/12/1358005044_5206.jpg" style="border: none;" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　打开DllImport.exe，弹出Console，以下显示的是我输入并HOOK完的界面：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	<img alt="" src="http://img.my.csdn.net/uploads/201301/12/1358005205_5471.jpg" style="border: none;" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　首先输入需要HOOK的进程ID，这里输入对话框进程ID12600。然后提示选择需HOOK的API，每个API有FLAG值，占一位，可以用位组合，这里输入511，即9个API都需HOOK。然后选择是HOOK还是UNHOOK，这里当然输入1。然后这个程序向对话框程序注入线程，调用DllExport.dll，DllExport.dll中HOOK这9个API。结果全部成功，见上图。HOOK对话框后，会在对话框进程中弹出一个Console窗口，用以显示相关信息，见下图：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	<img alt="" src="http://img.my.csdn.net/uploads/201301/12/1358005514_7118.jpg" style="border: none;" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　然后在对话框上一一点击各个按钮，并随时查看弹出的Console窗口中内容，单击完后，见下图：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	<img alt="" src="http://img.my.csdn.net/uploads/201301/12/1358005670_4990.jpg" style="border: none;" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　每点击一个按钮后，在Console中会显示相关信息。这些信息是HOOK时打印的，我只设置了打印简单的信息。还要注意，HOOK MessageBoxA和MessageBoxW时，改变了弹出消息框的标题、文字等。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　然后再打开DllImport.exe，把HOOK的API还原，并从对话框进程中卸载DllExport.dll，输入顺序与HOOK一致，只是第三步时需指定0，见下图：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	<img alt="" src="http://img.my.csdn.net/uploads/201301/12/1358005954_6363.jpg" style="border: none;" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　UNHOOK API时我选择的全部还原。完后，9个API不再被HOOK，正常执行，之前显示信息的Console关闭，对话框正常运行。所有API UNHOOK后，DllExport.dll被卸载，可改名、删除等。此时，再点击对话框按钮，就不再有任何显示显示。注意点击两个MessageBox后，消息框的标题与文字。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　编译说明：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　MFCDialogApplication是生成被注入的对话框工程；DllWorkspace中，DllExport生成需注入的DllExport.dll，DllImport生成执行注入操作的DllImport.exe。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　DllWorkspace工作空间中，两个项目都是用的安全字符串操作函数，如果出现找不到头文件，需要更新SDK，我的VC6 Include路径包括&ldquo;C:Program FilesMicrosoft SDKsWindowsv6.0AInclude&rdquo;和&ldquo;C:Program FilesMicrosoft Visual Studio 9.0VCinclude&rdquo;，即可编译通过。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　DllWorkspace下的两个项目，ANSI、UNICODE编译均可，既四种组合的编译，都可正常注入并HOOK。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　注入及HOOK代码简要说明：<br />
	　　注入主要代码如下：</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 687.046875px; overflow: auto; padding-top: 1px; color: rgb(51, 51, 51); line-height: 26px; margin: 18px 0px !important;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108);">
			<b>[cpp]</b>&nbsp;<a class="ViewSource" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="view plain">view plain</a><a class="CopyToClipboard" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="copy">copy</a></p>
<div style="position: absolute; left: 675px; top: 3125px; width: 18px; height: 18px; z-index: 99;">
				<embed align="middle" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" flashvars="id=1&amp;width=18&amp;height=18" height="18" id="ZeroClipboardMovie_1" loop="false" menu="false" name="ZeroClipboardMovie_1" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="best" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" type="application/x-shockwave-flash" width="18" wmode="transparent"></embed></div>
</p></div>
</p></div>
<ol class="dp-cpp" start="1" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;">
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;create&nbsp;a&nbsp;remote&nbsp;thread,&nbsp;and&nbsp;start&nbsp;LoadLibrary&nbsp;to&nbsp;load&nbsp;dll&nbsp;that&nbsp;we&nbsp;make,&nbsp;in&nbsp;the&nbsp;dll,&nbsp;we&nbsp;can</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;hook&nbsp;apis&nbsp;and&nbsp;can&nbsp;do&nbsp;everything&nbsp;we&nbsp;want</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;CreateRemoteThread(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hProcess,&nbsp;LPTHREAD_START_ROUTINE&nbsp;pfnStartAddr,&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPVOID</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;pRemoteMem)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet&nbsp;=&nbsp;FALSE;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hThread&nbsp;=&nbsp;CreateRemoteThread(hProcess,&nbsp;NULL,&nbsp;0,&nbsp;pfnStartAddr,&nbsp;pRemoteMem,&nbsp;0,&nbsp;NULL);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">do</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!hThread)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;CreateRemoteThread&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TCOUT&nbsp;&lt;&lt;&nbsp;_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;Waiting&nbsp;for&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;remote&nbsp;thread&#8230;&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)&nbsp;&lt;&lt;&nbsp;endl;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WaitForSingleObject(hThread,&nbsp;INFINITE);&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hThread);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hThread&nbsp;=&nbsp;NULL;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bRet&nbsp;=&nbsp;TRUE;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(FALSE);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">}&nbsp;&nbsp;</span></li>
</ol>
</div>
<p><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　</span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">用CreateRemoteThread创建一个远程进程下的线程，开始执行pfnStartAddr（为LoadLibrary的地址）地址处的代码，传递的参数为pRemoteMem（远程进程下的一段内存空间，保存的是DllExport.dll的路径），创建的远程线程由LoadLibrary开始执行，然后加载DllExport.dll，在DllExport.dll中可执行我们的处理。注意：DllExport.dll的路径是相对于被注入进程的，因此被注入进程需要能找到这个Dll。程序中szDllPath保存路径。</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　dll运行时可以和执行注入的进程交换数据，我使用file-mapping实现，代码如下：</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /></p>
<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 687.046875px; overflow: auto; padding-top: 1px; color: rgb(51, 51, 51); line-height: 26px; margin: 18px 0px !important;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108);">
			<b>[cpp]</b>&nbsp;<a class="ViewSource" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="view plain">view plain</a><a class="CopyToClipboard" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="copy">copy</a></p>
<div style="position: absolute; left: 675px; top: 3719px; width: 18px; height: 18px; z-index: 99;">
				<embed align="middle" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" flashvars="id=2&amp;width=18&amp;height=18" height="18" id="ZeroClipboardMovie_2" loop="false" menu="false" name="ZeroClipboardMovie_2" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="best" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" type="application/x-shockwave-flash" width="18" wmode="transparent"></embed></div>
</p></div>
</p></div>
<ol class="dp-cpp" start="1" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;">
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;write&nbsp;infomation&nbsp;to&nbsp;file-mapping,&nbsp;the&nbsp;infomation&nbsp;includes&nbsp;witch&nbsp;apis&nbsp;need&nbsp;to&nbsp;be&nbsp;(un)hooked,</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;and&nbsp;includes&nbsp;the&nbsp;(un)hook&nbsp;results&nbsp;and&nbsp;so&nbsp;on</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPVOID</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;WriteFileMapping(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hMap,&nbsp;CONTENT_FILE_MAPPING&nbsp;content)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPVOID</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;pContent&nbsp;=&nbsp;NULL;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">do</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!hMap)&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintMsg(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;WriteFileMapping&nbsp;fail&nbsp;:&nbsp;hMap&nbsp;is&nbsp;null,&nbsp;file&nbsp;:&nbsp;%s,&nbsp;line&nbsp;:&nbsp;%dn&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__FILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pContent&nbsp;=&nbsp;MapViewOfFile(hMap,&nbsp;FILE_MAP_ALL_ACCESS,&nbsp;0,&nbsp;0,&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">sizeof</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(content));&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!pContent)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;MapViewOfFile&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memcpy(pContent,&nbsp;&amp;content,&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">sizeof</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(content));&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(FALSE);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;pContent;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">}&nbsp;&nbsp;</span></li>
</ol>
</div>
<p><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　</span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">hMap是名字为宏NAME_FILE_MAPPING定义的一个file-mapping，然后向其中写入数据。dll执行时，再打开这个file-mapping，从中读取数据，再把结果写回。</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　然后是卸载被注入进程中DllExport.dll的代码：</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 687.046875px; overflow: auto; padding-top: 1px; color: rgb(51, 51, 51); line-height: 26px; margin: 18px 0px !important;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108);">
			<b>[cpp]</b>&nbsp;<a class="ViewSource" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="view plain">view plain</a><a class="CopyToClipboard" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="copy">copy</a></p>
<div style="position: absolute; left: 675px; top: 4315px; width: 18px; height: 18px; z-index: 99;">
				<embed align="middle" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" flashvars="id=3&amp;width=18&amp;height=18" height="18" id="ZeroClipboardMovie_3" loop="false" menu="false" name="ZeroClipboardMovie_3" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="best" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" type="application/x-shockwave-flash" width="18" wmode="transparent"></embed></div>
</p></div>
</p></div>
<ol class="dp-cpp" start="1" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;">
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;if&nbsp;no&nbsp;apis&nbsp;be&nbsp;hooked,&nbsp;we&nbsp;must&nbsp;free&nbsp;the&nbsp;library</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;UnLoadModule(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;dwProcesssId,&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPCTSTR</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;lpModuleName)&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">{&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet&nbsp;=&nbsp;FALSE;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hModuleSnap&nbsp;=&nbsp;INVALID_HANDLE_VALUE;&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;MODULEENTRY32&nbsp;me32;&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hProcess&nbsp;=&nbsp;NULL;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HMODULE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hModule&nbsp;=&nbsp;NULL;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;me32.dwSize&nbsp;=&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">sizeof</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(me32);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;hProcess&nbsp;=&nbsp;OpenProcess(PROCESS_ALL_ACCESS,&nbsp;TRUE,&nbsp;dwProcesssId);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">do</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!hProcess)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;OpenProcess&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hModuleSnap&nbsp;=&nbsp;CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,&nbsp;dwProcesssId);&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(INVALID_HANDLE_VALUE&nbsp;==&nbsp;hModuleSnap)&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;CreateToolhelp32Snapshot&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!Module32First(hModuleSnap,&nbsp;&amp;me32))&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;Module32First&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nRefCount&nbsp;=&nbsp;0;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">do</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(!StrCmpI(me32.szModule,&nbsp;lpModuleName)&nbsp;||&nbsp;!StrCmpI(me32.szExePath,&nbsp;lpModuleName))&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hModule&nbsp;=&nbsp;me32.hModule;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nRefCount&nbsp;=&nbsp;me32.ProccntUsage;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(Module32Next(hModuleSnap,&nbsp;&amp;me32));&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LPTHREAD_START_ROUTINE&nbsp;pfnStartAddr&nbsp;=&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;Kernel32&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)),&nbsp;</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;FreeLibrary&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!pfnStartAddr)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;GetProcAddress&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">for</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;nRefCount;&nbsp;i++)&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HANDLE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hThread&nbsp;=&nbsp;::CreateRemoteThread(hProcess,&nbsp;NULL,&nbsp;0,&nbsp;pfnStartAddr,&nbsp;hModule,&nbsp;0,&nbsp;NULL);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WaitForSingleObject(hThread,&nbsp;INFINITE);&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLOSE_HANDLE(hThread);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintMsg(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;FreeLibrary&nbsp;%s&nbsp;in&nbsp;the&nbsp;process&nbsp;%d&nbsp;finished!n&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;lpModuleName,&nbsp;dwProcesssId);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bRet&nbsp;=&nbsp;TRUE;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(FALSE);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;CLOSE_HANDLE(hModuleSnap);&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;CLOSE_HANDLE(hProcess);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet;&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">}&nbsp;&nbsp;</span></li>
</ol>
</div>
<p><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　</span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">遍历被注入进程加载的模块，如果找到了DllExport.dll，得到被这个进程引用的次数，然后再循环创建远程线程使用FreeLibrary来卸载DllExport.dll。注意，DllExport.dll被加载几次，就必须执行几次FreeLibrary才能完全卸载。至此，DllExport.dll就可以任意操作了。</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　HOOK代码简要说明：</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　使用的是跳转法，先保存API的前几个字节，再把这几个字节设置为跳转到我们自己函数的地方去。我们自己的函数中，进行相应处理后，再执行保存的API前几个字节的代码，然后跳转到API相应的位置执行。代码如下：</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /></p>
<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 687.046875px; overflow: auto; padding-top: 1px; color: rgb(51, 51, 51); line-height: 26px; margin: 18px 0px !important;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108);">
			<b>[cpp]</b>&nbsp;<a class="ViewSource" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="view plain">view plain</a><a class="CopyToClipboard" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="copy">copy</a></p>
<div style="position: absolute; left: 675px; top: 5763px; width: 18px; height: 18px; z-index: 99;">
				<embed align="middle" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" flashvars="id=4&amp;width=18&amp;height=18" height="18" id="ZeroClipboardMovie_4" loop="false" menu="false" name="ZeroClipboardMovie_4" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="best" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" type="application/x-shockwave-flash" width="18" wmode="transparent"></embed></div>
</p></div>
</p></div>
<ol class="dp-cpp" start="1" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;">
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;hook&nbsp;the&nbsp;specify&nbsp;api</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;pRecallApiInfo&nbsp;:&nbsp;infomation&nbsp;of&nbsp;the&nbsp;api</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;HookSpecifyApi(PRECALL_API_INFO&nbsp;pRecallApiInfo)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BOOL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet&nbsp;=&nbsp;FALSE;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">do</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!pRecallApiInfo)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(pRecallApiInfo-&gt;pOrgfnMem)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bRet&nbsp;=&nbsp;TRUE;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HMODULE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hModule&nbsp;=&nbsp;LoadLibrary(pRecallApiInfo-&gt;lpDllName);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!hModule)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;LoadLibrary&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USES_CONVERSION;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FARPROC&nbsp;pfnStartAddr&nbsp;=&nbsp;(FARPROC)GetProcAddress(hModule,&nbsp;T2CA(pRecallApiInfo-&gt;lpFunctionName));&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pRecallApiInfo-&gt;lpApiAddr&nbsp;=&nbsp;pfnStartAddr;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!pfnStartAddr)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;GetProcAddress&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;we&nbsp;must&nbsp;save&nbsp;the&nbsp;first&nbsp;few&nbsp;bytes&nbsp;of&nbsp;the&nbsp;api(at&nbsp;least&nbsp;five,&nbsp;and&nbsp;these&nbsp;few&nbsp;bytes&nbsp;must&nbsp;complete</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;the&nbsp;assembly&nbsp;codes),&nbsp;then&nbsp;make&nbsp;the&nbsp;5&nbsp;bytes&nbsp;in&nbsp;front&nbsp;of&nbsp;api&nbsp;to&nbsp;jump&nbsp;to&nbsp;our&nbsp;function,&nbsp;and&nbsp;our</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;function&nbsp;must&nbsp;execute&nbsp;the&nbsp;few&nbsp;bytes&nbsp;saved&nbsp;before,&nbsp;and&nbsp;then&nbsp;jump&nbsp;to&nbsp;the&nbsp;api&nbsp;to&nbsp;execute</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;the&nbsp;rest&nbsp;code&nbsp;in&nbsp;the&nbsp;api</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nSize&nbsp;=&nbsp;0;&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nDisassemblerLen&nbsp;=&nbsp;0;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">(nSize&nbsp;&lt;&nbsp;5)&nbsp;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;GetOpCodeSize&nbsp;can&nbsp;get&nbsp;the&nbsp;assembly&nbsp;code&nbsp;size</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nDisassemblerLen&nbsp;=&nbsp;GetOpCodeSize((<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)(pfnStartAddr)&nbsp;+&nbsp;nSize);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nSize&nbsp;=&nbsp;nDisassemblerLen&nbsp;+&nbsp;nSize;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;dwProtect&nbsp;=&nbsp;0;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!VirtualProtect(pfnStartAddr,&nbsp;nSize,&nbsp;PAGE_EXECUTE_READWRITE,&nbsp;&amp;dwProtect))&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;VirtualProtect&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;be&nbsp;sure&nbsp;that&nbsp;we&nbsp;must&nbsp;change&nbsp;pOrgfnMem&#39;s&nbsp;protect,&nbsp;because&nbsp;the&nbsp;code&nbsp;in&nbsp;pOrgfnMem&nbsp;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;also&nbsp;need&nbsp;to&nbsp;execute&nbsp;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pRecallApiInfo-&gt;pOrgfnMem&nbsp;=&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">new</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">[5&nbsp;+&nbsp;nSize];&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;dwMemProtect&nbsp;=&nbsp;0;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(!VirtualProtect(pRecallApiInfo-&gt;pOrgfnMem,&nbsp;5&nbsp;+&nbsp;nSize,&nbsp;PAGE_EXECUTE_READWRITE,&nbsp;&amp;dwMemProtect))&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">delete</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;[]&nbsp;pRecallApiInfo-&gt;pOrgfnMem;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pRecallApiInfo-&gt;pOrgfnMem&nbsp;=&nbsp;NULL;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintError(_T(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;VirtualProtect&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">),&nbsp;GetLastError(),&nbsp;__MYFILE__,&nbsp;__LINE__);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">break</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pRecallApiInfo-&gt;nOrgfnMemSize&nbsp;=&nbsp;5&nbsp;+&nbsp;nSize;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memcpy(pRecallApiInfo-&gt;pOrgfnMem,&nbsp;pfnStartAddr,&nbsp;nSize);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)(pRecallApiInfo-&gt;pOrgfnMem&nbsp;+&nbsp;nSize)&nbsp;=&nbsp;0xE9;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)(pRecallApiInfo-&gt;pOrgfnMem&nbsp;+&nbsp;nSize&nbsp;+&nbsp;1)&nbsp;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)pfnStartAddr&nbsp;+&nbsp;nSize&nbsp;-&nbsp;(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)(pRecallApiInfo-&gt;pOrgfnMem&nbsp;+&nbsp;5&nbsp;+&nbsp;nSize);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)(pfnStartAddr)&nbsp;=&nbsp;0xE9;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)((</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)pfnStartAddr&nbsp;+&nbsp;1)&nbsp;=&nbsp;(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)pRecallApiInfo-&gt;lpRecallfn&nbsp;-&nbsp;((</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">DWORD</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)pfnStartAddr&nbsp;+&nbsp;5);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset((<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">BYTE</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">*)pfnStartAddr&nbsp;+&nbsp;5,&nbsp;0&#215;90,&nbsp;nSize&nbsp;-&nbsp;5);&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;be&nbsp;sure&nbsp;that&nbsp;we&nbsp;must&nbsp;set&nbsp;the&nbsp;rest&nbsp;to&nbsp;0&#215;90(assembly&nbsp;code&nbsp;for&nbsp;nop,&nbsp;do&nbsp;nothing,&nbsp;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">//&nbsp;and&nbsp;occupy&nbsp;one&nbsp;byte),&nbsp;because&nbsp;we&nbsp;should&#39;t&nbsp;change&nbsp;the&nbsp;assembly&nbsp;code</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VirtualProtect(pfnStartAddr,&nbsp;nSize,&nbsp;dwProtect,&nbsp;&amp;dwProtect);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bRet&nbsp;=&nbsp;TRUE;&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(FALSE);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;bRet;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">}&nbsp;&nbsp;</span></li>
</ol>
</div>
<p><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　</span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">需要注意的是：</span><span style="font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);">保存的可能并不是API的前5个字节，因为前5个字节可能不是一个或几个完整的汇编指令，比如第5、6个字节合起来才是一个指令，我们就不能只保存前5个字节，最后执行这5个字节，再跳转到第6个字节处执行。这样破坏了指令，必然造成崩溃。这时需要保存前6个字节才行。程序中，我使用了从网上找到的一段代码GetOpCodeSize，GetOpCodeSize可以得到当前地址处的汇编指令长度。然后保存API前至少5个字节，并且这些字节可以组成完整的汇编指令。实际也可以不用这样，可以用另一方式，我们函数中先恢复API的前5个字节，然后再调用API，调用完后再改API前5个字节为跳转到我们函数的指令。但是，这种方式并不好，如果调用API时，API的前5个字节正常，如果再有进程中其他线程调用API，这时流程完全正常，没有被HOOK。<br />
　　另外，还需要修改保存API前几个字节内存的属性，因为这些内存是需要执行的，因此修改为可读、可写、可执行。代码修改pRecallApiInfo-&gt;pOrgfnMem段内存在属性。<br />
　　最后，如果保存的API前5个以上的字节，比如保存的6个字节，还需要把第6个字节修改为0&#215;90，编译指令为NOP，不执行任何操作。否则，第6个字节可能和后面的几个字节组合成新的指令，也是不正确的。其实，这里也可以不修改，因为我们是直接跳到第7个字节执行的，既使第6、7个字节组合成一个新指令也没关系，因为不是从第6个指令开始执行的。但是，这样处理后，调试方便，打开汇编窗口，一目了解。</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　还原就简单了，直接用之前保存的字节恢复即可。</span><br style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" /><br />
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　我们替换API的函数代码如下：</span></p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 687.046875px; overflow: auto; padding-top: 1px; color: rgb(51, 51, 51); line-height: 26px; margin: 18px 0px !important;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108);">
			<b>[cpp]</b>&nbsp;<a class="ViewSource" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="view plain">view plain</a><a class="CopyToClipboard" href="http://blog.csdn.net/beanjoy/article/details/8497307#" style="color: rgb(160, 160, 160); text-decoration: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-color: inherit; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;" title="copy">copy</a></p>
<div style="position: absolute; left: 675px; top: 7787px; width: 18px; height: 18px; z-index: 99;">
				<embed align="middle" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" flashvars="id=5&amp;width=18&amp;height=18" height="18" id="ZeroClipboardMovie_5" loop="false" menu="false" name="ZeroClipboardMovie_5" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="best" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" type="application/x-shockwave-flash" width="18" wmode="transparent"></embed></div>
</p></div>
</p></div>
<ol class="dp-cpp" start="1" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;">
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;WINAPI&nbsp;MyMessageBoxA(IN&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">HWND</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;hWnd,&nbsp;IN&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPCSTR</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;lpText,&nbsp;IN&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPCSTR</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;lpCaption,&nbsp;IN&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">UINT</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;uType)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nOrderHookApi&nbsp;=&nbsp;ORDER_MESSAGEBOXA;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nRet&nbsp;=&nbsp;0;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;i&nbsp;=&nbsp;1;&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;(g_arHookAPIs[nOrderHookApi].pOrgfnMem)&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USES_CONVERSION;&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintMsgA(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;%-18s&nbsp;%08d&nbsp;:&nbsp;0x%08x&nbsp;&quot;%s&quot;&nbsp;&quot;%s&quot;&nbsp;0x%08xn&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T2CA(g_arHookAPIs[nOrderHookApi].lpFunctionName),&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i++,&nbsp;hWnd,&nbsp;VALID_CHAR(lpText),&nbsp;VALID_CHAR(lpCaption),&nbsp;uType);&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;</span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nRet&nbsp;=&nbsp;((pfnMessageBoxA)(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold;">LPVOID</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">)g_arHookAPIs[nOrderHookApi].pOrgfnMem)(&nbsp;&nbsp;</span></span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hWnd,&nbsp;<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;HelloWorld&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,&nbsp;</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">&quot;Caption&quot;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,&nbsp;MB_OKCANCEL);&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li>
<li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold;">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">&nbsp;nRet;&nbsp;&nbsp;</span></span></li>
<li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;">
			<span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">}&nbsp;&nbsp;</span></li>
</ol>
</div>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　最后一定要从保存的API的地址处开始执行。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　代码中已实现同时HOOK9个API（MessageBoxA、MessageBoxW、DeviceIoControl、CreateFileA、CreateFileW、ReadFile、ReadFileEx、WriteFile、WriteFileEx），稍加修改，即可实现HOOK更多的API。</p>
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
	　　编译环境：Windows XP SP3、VC++ 6.0 SP6</p>
<p><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">　　源码及DEMO下载地址：</span><a href="http://download.csdn.net/detail/beanjoy/4989537" style="color: rgb(51, 102, 153); text-decoration: initial; font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);" target="_blank">线程注入、HOOK APIs（附VC6源码）</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=80</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
