<?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>风过明岚,雁过留痕</title>
	<atom:link href="http://blog.kingse.org/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.kingse.org</link>
	<description>杂七杂八,想啥说啥</description>
	<lastBuildDate>Tue, 10 Aug 2010 07:02:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>内存中载入DLL并执行(C代码，兼容vc,bcb)</title>
		<link>http://blog.kingse.org/2010/08/381.html</link>
		<comments>http://blog.kingse.org/2010/08/381.html#comments</comments>
		<pubDate>Tue, 10 Aug 2010 06:59:27 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[内存]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=381</guid>
		<description><![CDATA[系统载入dll的整体过程可以分为以下几个步骤：
1、将dll文件内容载入内存，并按照对齐粒度进行对齐并设置对应的各个内存区间的权限属性；
2、如果dll有重定位表，则进行重定位操作；
3、填充dll的导入表；
4、用ATTACH参数调用dll的入口函数进行初始化，之后返回imagebase即可。
因此了解了系统载入dll的整体流程，也就可以自己实现将dll载入内存并执行，这种方法对于加密等有一定意义。
但由于自己载入内存后，系统api GetProcAddress函数失效，因此在自己实现loadlibrary函数的同时必须自己实现此函数。
下面附上参考网上现有代码原理后写的代码。
进过少量测试，暂未发现bug，如发现bug，欢迎提出。
DLLLoader.h文件内容如下

//---------------------------------------------------------------------------
&#160;
#ifndef DLLLoaderH
#define DLLLoaderH
&#160;
#ifdef __cplusplus
extern &#34;C&#34; &#123;
#endif
&#160;
#include &#60;stdio.h&#62;
#include &#60;windows.h&#62;
//---------------------------------------------------------------------------
&#160;
//public functions
&#160;
DWORD LoadDllFromMemory&#40;LPVOID lpBuffer,__int64 BufferSize&#41;;
DWORD FreeDllFromMemory&#40;LPVOID lpBaseAddress&#41;;
FARPROC GetDllProcAddress&#40;LPVOID imagebase,char * FuncName&#41;;
&#160;
// private functions
&#160;
DWORD AlignDllToMemory&#40;LPVOID lpBuffer,PIMAGE_DOS_HEADER &#38;dosHeader,PIMAGE_NT_HEADERS &#38;ntHeader,__int64 BufferSize&#41;;   //从内存载入到对齐内存
DWORD GetAlignedSize&#40;DWORD Origin,DWORD Alignment&#41;;                        [...]]]></description>
			<content:encoded><![CDATA[<p>系统载入dll的整体过程可以分为以下几个步骤：</p>
<p>1、将dll文件内容载入内存，并按照对齐粒度进行对齐并设置对应的各个内存区间的权限属性；</p>
<p>2、如果dll有重定位表，则进行重定位操作；</p>
<p>3、填充dll的导入表；</p>
<p>4、用ATTACH参数调用dll的入口函数进行初始化，之后返回imagebase即可。</p>
<p>因此了解了系统载入dll的整体流程，也就可以自己实现将dll载入内存并执行，这种方法对于加密等有一定意义。</p>
<p>但由于自己载入内存后，系统api GetProcAddress函数失效，因此在自己实现loadlibrary函数的同时必须自己实现此函数。</p>
<p>下面附上参考网上现有代码原理后写的代码。</p>
<p>进过少量测试，暂未发现bug，如发现bug，欢迎提出。</p>
<p>DLLLoader.h文件内容如下</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">//---------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #339900;">#ifndef DLLLoaderH</span>
<span style="color: #339900;">#define DLLLoaderH</span>
&nbsp;
<span style="color: #339900;">#ifdef __cplusplus</span>
<span style="color: #0000ff;">extern</span> <span style="color: #FF0000;">&quot;C&quot;</span> <span style="color: #008000;">&#123;</span>
<span style="color: #339900;">#endif</span>
&nbsp;
<span style="color: #339900;">#include &lt;stdio.h&gt;</span>
<span style="color: #339900;">#include &lt;windows.h&gt;</span>
<span style="color: #666666;">//---------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #666666;">//public functions</span>
&nbsp;
DWORD LoadDllFromMemory<span style="color: #008000;">&#40;</span>LPVOID lpBuffer,__int64 BufferSize<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
DWORD FreeDllFromMemory<span style="color: #008000;">&#40;</span>LPVOID lpBaseAddress<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
FARPROC GetDllProcAddress<span style="color: #008000;">&#40;</span>LPVOID imagebase,<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span> FuncName<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// private functions</span>
&nbsp;
DWORD AlignDllToMemory<span style="color: #008000;">&#40;</span>LPVOID lpBuffer,PIMAGE_DOS_HEADER <span style="color: #000040;">&amp;</span>dosHeader,PIMAGE_NT_HEADERS <span style="color: #000040;">&amp;</span>ntHeader,__int64 BufferSize<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>   <span style="color: #666666;">//从内存载入到对齐内存</span>
DWORD GetAlignedSize<span style="color: #008000;">&#40;</span>DWORD Origin,DWORD Alignment<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                                                                    <span style="color: #666666;">//计算对齐后的位置</span>
DWORD GetImageSize<span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS ntHeader,PIMAGE_SECTION_HEADER sectionHeaders<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                                   <span style="color: #666666;">//计算总imagesize</span>
DWORD Relocation<span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS ntHeader,LPVOID NewBase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                                                           <span style="color: #666666;">//修正重定位</span>
DWORD FillImportTable<span style="color: #008000;">&#40;</span>LPVOID imagebase,PIMAGE_NT_HEADERS ntHeader<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                                                    <span style="color: #666666;">//填充IAT</span>
&nbsp;
&nbsp;
<span style="color: #666666;">//entrypoint function type</span>
<span style="color: #0000ff;">typedef</span> UINT <span style="color: #008000;">&#40;</span>CALLBACK <span style="color: #000040;">*</span> LPENTRYPOINT<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#40;</span>HANDLE hInstance, DWORD Reason, LPVOID Reserved<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
&nbsp;
<span style="color: #339900;">#ifdef __cplusplus</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #339900;">#endif</span>
&nbsp;
<span style="color: #339900;">#endif</span></pre></div></div>

<p><span id="more-381"></span>DLLLoader.c内容如下</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">//---------------------------------------------------------------------------</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #339900;">#include &quot;DLLLoader.h&quot;</span>
&nbsp;
<span style="color: #666666;">//---------------------------------------------------------------------------</span>
&nbsp;
&nbsp;
&nbsp;
DWORD GetAlignedSize<span style="color: #008000;">&#40;</span>DWORD Origin,DWORD Alignment<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>Origin<span style="color: #000040;">+</span>Alignment<span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">/</span>Alignment<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">*</span> Alignment<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
DWORD GetImageSize<span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS ntHeader,PIMAGE_SECTION_HEADER sectionHeaders<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	DWORD imagesize <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	imagesize <span style="color: #000080;">=</span> GetAlignedSize<span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SizeOfHeaders</span>,ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SectionAlignment</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">NumberOfSections</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Misc</span>.<span style="color: #007788;">VirtualSize</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				imagesize <span style="color: #000080;">=</span> GetAlignedSize<span style="color: #008000;">&#40;</span>sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #000040;">+</span>sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Misc</span>.<span style="color: #007788;">VirtualSize</span>,ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SectionAlignment</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
				imagesize <span style="color: #000080;">=</span> GetAlignedSize<span style="color: #008000;">&#40;</span>sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #000040;">+</span>sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">SizeOfRawData</span>,ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SectionAlignment</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
			imagesize <span style="color: #000040;">+</span><span style="color: #000080;">=</span> GetAlignedSize<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Misc</span>.<span style="color: #007788;">VirtualSize</span> <span style="color: #000080;">&gt;</span> sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">SizeOfRawData</span><span style="color: #008000;">&#41;</span> <span style="color: #008080;">?</span> sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Misc</span>.<span style="color: #007788;">VirtualSize</span> <span style="color: #008080;">:</span> sectionHeaders<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">SizeOfRawData</span><span style="color: #008000;">&#41;</span>,ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SectionAlignment</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">return</span> imagesize<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
DWORD AlignDllToMemory<span style="color: #008000;">&#40;</span>LPVOID lpBuffer,PIMAGE_DOS_HEADER <span style="color: #000040;">&amp;</span>dosHeader,PIMAGE_NT_HEADERS <span style="color: #000040;">&amp;</span>ntHeader,__int64 BufferSize<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	DWORD result<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	LPVOID DLLBuffer<span style="color: #008080;">;</span>
	PIMAGE_SECTION_HEADER psectionHeader<span style="color: #008080;">;</span>
	PIMAGE_IMPORT_DESCRIPTOR pImportDesc<span style="color: #008080;">;</span>
	PIMAGE_IMPORT_BY_NAME pOridinalName<span style="color: #008080;">;</span>
	PIMAGE_BASE_RELOCATION baseReloc<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span><span style="color: #000080;">==</span>lpBuffer<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	dosHeader<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>PIMAGE_DOS_HEADER<span style="color: #008000;">&#41;</span>lpBuffer<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>IMAGE_DOS_SIGNATURE<span style="color: #000040;">!</span><span style="color: #000080;">=</span>dosHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>e_magic<span style="color: #008000;">&#41;</span><span style="color: #000040;">||</span>IsBadReadPtr<span style="color: #008000;">&#40;</span>dosHeader,<span style="color: #0000dd;">sizeof</span> <span style="color: #008000;">&#40;</span>IMAGE_DOS_HEADER<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	ntHeader<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>dosHeader<span style="color: #000040;">+</span>dosHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>e_lfanew<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>IsBadReadPtr<span style="color: #008000;">&#40;</span>ntHeader,<span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>IMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">||</span><span style="color: #008000;">&#40;</span>IMAGE_NT_SIGNATURE<span style="color: #000040;">!</span><span style="color: #000080;">=</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Signature<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">SizeOfOptionalHeader</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">||</span><span style="color: #008000;">&#40;</span>IMAGE_NT_OPTIONAL_HDR32_MAGIC<span style="color: #000040;">!</span><span style="color: #000080;">=</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">Magic</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">NumberOfSections</span> <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	psectionHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_SECTION_HEADER<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>ntHeader <span style="color: #000040;">+</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>IMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	DWORD imagesize <span style="color: #000080;">=</span> GetImageSize<span style="color: #008000;">&#40;</span>ntHeader,psectionHeader<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> imagesize<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000080;">==</span> DLLBuffer<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		dosHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		ntHeader <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	DWORD movesize <span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">SizeOfHeaders</span><span style="color: #008080;">;</span>
	DWORD totalrawsize <span style="color: #000080;">=</span>movesize<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">NumberOfSections</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		totalrawsize <span style="color: #000040;">+</span><span style="color: #000080;">=</span> psectionHeader<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">SizeOfRawData</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>totalrawsize <span style="color: #000080;">&gt;</span> BufferSize<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	DLLBuffer <span style="color: #000080;">=</span> VirtualAlloc<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span>,imagesize,MEM_COMMIT<span style="color: #000040;">|</span>MEM_RESERVE,PAGE_EXECUTE_READWRITE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>    <span style="color: #666666;">//为了方便，所有内存权限都设成了可执行。</span>
	MoveMemory<span style="color: #008000;">&#40;</span>DLLBuffer,lpBuffer,movesize<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">NumberOfSections</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		MoveMemory<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>LPVOID<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>DLLBuffer<span style="color: #000040;">+</span>psectionHeader<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008000;">&#41;</span>,<span style="color: #008000;">&#40;</span>LPVOID<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>lpBuffer<span style="color: #000040;">+</span>psectionHeader<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">PointerToRawData</span><span style="color: #008000;">&#41;</span>,psectionHeader<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">SizeOfRawData</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	dosHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_DOS_HEADER<span style="color: #008000;">&#41;</span>DLLBuffer<span style="color: #008080;">;</span>
	ntHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>dosHeader<span style="color: #000040;">+</span>dosHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>e_lfanew<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
DWORD Relocation<span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS ntHeader,LPVOID NewBase<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_BASERELOC<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span> <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;&amp;</span> <span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_BASERELOC<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Size</span> <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		DWORD delta<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>NewBase <span style="color: #000040;">-</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">ImageBase</span><span style="color: #008080;">;</span>
		PIMAGE_BASE_RELOCATION reloc <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_BASE_RELOCATION<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">long</span><span style="color: #008000;">&#41;</span>NewBase <span style="color: #000040;">+</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_BASERELOC<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>reloc<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>VirtualAddress <span style="color: #000040;">+</span> reloc<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>SizeOfBlock<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
			WORD <span style="color: #000040;">*</span>relocdata<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>WORD <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>reloc <span style="color: #000040;">+</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>IMAGE_BASE_RELOCATION<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">int</span> relocNumber <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>reloc<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>SizeOfBlock <span style="color: #000040;">-</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>IMAGE_BASE_RELOCATION<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">/</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>WORD<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> relocNumber<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>relocdata<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0xF000</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #208080;">0x00003000</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
					DWORD <span style="color: #000040;">*</span>address <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>DWORD <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">long</span><span style="color: #008000;">&#41;</span>NewBase <span style="color: #000040;">+</span> reloc<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>VirtualAddress <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>relocdata<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0x0fff</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
					<span style="color: #000040;">*</span>address <span style="color: #000040;">+</span><span style="color: #000080;">=</span> delta<span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
			reloc <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_BASE_RELOCATION<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>reloc <span style="color: #000040;">+</span> reloc<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>SizeOfBlock<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
DWORD FillImportTable<span style="color: #008000;">&#40;</span>LPVOID imagebase,PIMAGE_NT_HEADERS ntHeader<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	DWORD IATOffset <span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_IMPORT<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> IATOffset<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	PIMAGE_IMPORT_DESCRIPTOR iat <span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>PIMAGE_IMPORT_DESCRIPTOR<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> IATOffset<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> iat<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Characteristics<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
		PIMAGE_THUNK_DATA realIAT <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_THUNK_DATA<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> iat<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FirstThunk<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		PIMAGE_THUNK_DATA originalIAT <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_THUNK_DATA<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> iat<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OriginalFirstThunk<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">char</span> buf<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">256</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		<span style="color: #0000dd;">memset</span><span style="color: #008000;">&#40;</span>buf,<span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">256</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		BYTE <span style="color: #000040;">*</span>name<span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>BYTE <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> iat<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Name<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">int</span> i<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">256</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> name<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
			buf<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> name<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">&gt;=</span> <span style="color: #0000dd;">256</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
		HMODULE hDll <span style="color: #000080;">=</span> GetModuleHandle<span style="color: #008000;">&#40;</span>buf<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000080;">==</span> hDll<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			hDll <span style="color: #000080;">=</span> LoadLibrary<span style="color: #008000;">&#40;</span>buf<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000080;">==</span> hDll<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> <span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>originalIAT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">u1</span>.<span style="color: #007788;">Function</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
			FARPROC lpFunction <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>originalIAT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">u1</span>.<span style="color: #007788;">Ordinal</span> <span style="color: #000040;">&amp;</span> IMAGE_ORDINAL_FLAG<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				lpFunction <span style="color: #000080;">=</span> GetProcAddress<span style="color: #008000;">&#40;</span>hDll,<span style="color: #008000;">&#40;</span>LPCSTR<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>originalIAT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">u1</span>.<span style="color: #007788;">Ordinal</span> <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0x0000FFFF</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
				PIMAGE_IMPORT_BY_NAME byname <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_IMPORT_BY_NAME<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>originalIAT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">u1</span>.<span style="color: #007788;">AddressOfData</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
				lpFunction <span style="color: #000080;">=</span> GetProcAddress<span style="color: #008000;">&#40;</span>hDll,<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>byname<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Name<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> lpFunction<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				realIAT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">u1</span>.<span style="color: #007788;">Function</span> <span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>lpFunction<span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
		iat <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_IMPORT_DESCRIPTOR<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>iat <span style="color: #000040;">+</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>IMAGE_IMPORT_DESCRIPTOR<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
DWORD LoadDllFromMemory<span style="color: #008000;">&#40;</span>LPVOID lpBuffer,__int64 BufferSize<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	LPVOID imagebase <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	PIMAGE_DOS_HEADER dosHeader<span style="color: #008080;">;</span>
	PIMAGE_NT_HEADERS ntHeader<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>AlignDllToMemory<span style="color: #008000;">&#40;</span>lpBuffer,dosHeader,ntHeader,BufferSize<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		imagebase <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>LPVOID<span style="color: #008000;">&#41;</span>dosHeader<span style="color: #008080;">;</span>
		Relocation<span style="color: #008000;">&#40;</span>ntHeader,imagebase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>FillImportTable<span style="color: #008000;">&#40;</span>imagebase,ntHeader<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			LPENTRYPOINT EntryPointFunc <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>LPENTRYPOINT<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">AddressOfEntryPoint</span> <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>EntryPointFunc<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>HINSTANCE<span style="color: #008000;">&#41;</span>imagebase,DLL_PROCESS_ATTACH,<span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				EntryPointFunc<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>HINSTANCE<span style="color: #008000;">&#41;</span>imagebase,DLL_PROCESS_DETACH,<span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
				VirtualFree<span style="color: #008000;">&#40;</span>imagebase,<span style="color: #0000dd;">0</span>,MEM_RELEASE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
				EntryPointFunc <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">return</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008080;">;</span>
            <span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
			VirtualFree<span style="color: #008000;">&#40;</span>imagebase,<span style="color: #0000dd;">0</span>,MEM_RELEASE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
DWORD FreeDllFromMemory<span style="color: #008000;">&#40;</span>LPVOID lpBaseAddress<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	PIMAGE_DOS_HEADER dosHeader<span style="color: #008080;">;</span>
	PIMAGE_NT_HEADERS ntHeader<span style="color: #008080;">;</span>
	dosHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_DOS_HEADER<span style="color: #008000;">&#41;</span>lpBaseAddress<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000080;">==</span> dosHeader<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	ntHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>dosHeader <span style="color: #000040;">+</span> dosHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>e_lfanew<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>IMAGE_NT_SIGNATURE <span style="color: #000040;">!</span><span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Signature<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">SizeOfOptionalHeader</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">||</span> <span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">Magic</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> IMAGE_NT_OPTIONAL_HDR32_MAGIC<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	LPENTRYPOINT EntryPointFunc <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>LPENTRYPOINT<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">AddressOfEntryPoint</span> <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>lpBaseAddress<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	EntryPointFunc<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>HINSTANCE<span style="color: #008000;">&#41;</span>lpBaseAddress,DLL_PROCESS_DETACH,<span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> i<span style="color: #000080;">=</span>VirtualFree<span style="color: #008000;">&#40;</span>lpBaseAddress,<span style="color: #0000dd;">0</span>,MEM_RELEASE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">return</span> i<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
FARPROC GetDllProcAddress<span style="color: #008000;">&#40;</span>LPVOID imagebase,<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span> FuncName<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	PIMAGE_DOS_HEADER dosHeader<span style="color: #008080;">;</span>
	PIMAGE_NT_HEADERS ntHeader<span style="color: #008080;">;</span>
	dosHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_DOS_HEADER<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span> <span style="color: #000080;">==</span> dosHeader<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	ntHeader <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_NT_HEADERS<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>dosHeader <span style="color: #000040;">+</span> dosHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>e_lfanew<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>IMAGE_NT_SIGNATURE <span style="color: #000040;">!</span><span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Signature<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>FileHeader.<span style="color: #007788;">SizeOfOptionalHeader</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">||</span> <span style="color: #008000;">&#40;</span>ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">Magic</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> IMAGE_NT_OPTIONAL_HDR32_MAGIC<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
	DWORD exportsStartRVA,size<span style="color: #008080;">;</span>
	exportsStartRVA <span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_EXPORT<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008080;">;</span>
	size <span style="color: #000080;">=</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_EXPORT<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">Size</span><span style="color: #008080;">;</span>
	PIMAGE_EXPORT_DIRECTORY pexports <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PIMAGE_EXPORT_DIRECTORY<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> ntHeader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>OptionalHeader.<span style="color: #007788;">DataDirectory</span><span style="color: #008000;">&#91;</span>IMAGE_DIRECTORY_ENTRY_EXPORT<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">VirtualAddress</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> iBase <span style="color: #000080;">=</span> pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Base<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> iNumOfFuncs <span style="color: #000080;">=</span> pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>NumberOfFunctions<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> iNumOfNames <span style="color: #000080;">=</span> pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>NumberOfNames<span style="color: #008080;">;</span>
	LPDWORD pAddressOfFuncs <span style="color: #000080;">=</span><span style="color: #008000;">&#40;</span>LPDWORD<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>AddressOfFunctions <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	LPWORD pAddressOfOrdinals <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>LPWORD<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>AddressOfNameOrdinals <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	LPDWORD pAddressOfNames <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>LPDWORD<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>pexports<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>AddressOfNames <span style="color: #000040;">+</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> iOrdinal <span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>FuncName <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0xFFFF0000</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		iOrdinal <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>FuncName <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0x0000FFFF</span> <span style="color: #000040;">-</span> iBase<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">int</span> iFound <span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> iNumOfNames<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>pAddressOfNames<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #000040;">+</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase<span style="color: #008000;">&#41;</span>,FuncName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				iFound <span style="color: #000080;">=</span> i<span style="color: #008080;">;</span>
				<span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>iFound <span style="color: #000080;">&gt;=</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			iOrdinal <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span>pAddressOfOrdinals<span style="color: #008000;">&#91;</span>iFound<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>iOrdinal <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">||</span> <span style="color: #008000;">&#40;</span>iOrdinal <span style="color: #000080;">&gt;=</span> iNumOfFuncs<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
		DWORD FuncOffset <span style="color: #000080;">=</span> pAddressOfFuncs<span style="color: #008000;">&#91;</span>iOrdinal<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>FuncOffset <span style="color: #000080;">&gt;</span> exportsStartRVA<span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;&amp;</span> <span style="color: #008000;">&#40;</span>FuncOffset <span style="color: #000080;">&lt;</span> exportsStartRVA <span style="color: #000040;">+</span> size<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span><span style="color: #0000ff;">else</span><span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">return</span> <span style="color: #008000;">&#40;</span>FARPROC<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>DWORD<span style="color: #008000;">&#41;</span>imagebase <span style="color: #000040;">+</span> FuncOffset<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>


                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=381">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/08/381.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>aXmag PDF to Flash Converter 绿色破解版</title>
		<link>http://blog.kingse.org/2010/08/377.html</link>
		<comments>http://blog.kingse.org/2010/08/377.html#comments</comments>
		<pubDate>Thu, 05 Aug 2010 07:41:32 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=377</guid>
		<description><![CDATA[Why AXPDF PDF to Flash Converter?
It&#8217;s because we are using vector technology, vector files are very much smaller and much faster to transfer via network, and, it will be always highest quality even magnify limitlessly. See comparison details:



AXPDF uses Vector solution
Others are Raster type output


Original PDF size at 308KB,
Created Online magazine file at 779KB
Download example
Same [...]]]></description>
			<content:encoded><![CDATA[<h3>Why AXPDF PDF to Flash Converter?</h3>
<p>It&#8217;s because we are using vector technology, vector files are very much smaller and much faster to transfer via network, and, it will be always highest quality even magnify limitlessly. See comparison details:</p>
<table cellspacing="1" cellpadding="5">
<tbody>
<tr align="center">
<td><strong>AXPDF uses Vector solution</strong></td>
<td><strong>Others are Raster type output</strong></td>
</tr>
<tr align="center">
<td>Original PDF size at 308KB,<br />
Created Online magazine file at 779KB<br />
<a href="http://www.axpdf.com/images/AXPDF_Example.zip">Download example</a></td>
<td>Same original PDF size at 308KB,<br />
Created Online magazine file at <span style="color: #ff0000;">5.23</span> MB<br />
(7 times the size of AXPDF solution)</td>
</tr>
<tr align="center">
<td>1M connection, downloading takes: 0.78 Sec</td>
<td>1M connection, downloading takes: 5.23 Sec</td>
</tr>
<tr align="center">
<td valign="top">Always highest quality on both text and icons:<img src="http://www.axpdf.com/pdf_to_flash/images/by_axmag.png" alt="" /></td>
<td valign="top">Blurry for all texts and icons:<img src="http://www.axpdf.com/pdf_to_flash/images/by_competitor.png" alt="" /></td>
</tr>
</tbody>
</table>
<table width="100%">
<tbody>
<tr>
<td><a name="features"></a></p>
<h3>Key Features</h3>
<ul>
<li><strong>Convert PDF into Flash files including: </strong><br />
Digital magazines, online magazines, digital catalogs, flash magazine, online manuals, interactive flyers, reports, whitepapers, newsletters, brochures, flipping photo albums and other digital documents in PDF formats.</li>
<li><strong>Page flip simulating: </strong><br />
Feel ease flipping the online e-book and have fun in reading.</li>
<li><strong>Quick loading e-pages:<br />
</strong>Pages are processed for high speed online loading, with few seconds all pages will be cashed. No snoring waiting for pages loading.<strong> </strong></li>
<li><strong>Zoom viewing with variable resolution:<br />
</strong>Zoom dynamic, zoom in, zoom all, zoom out, either way and pan pages to view details.<strong> </strong></li>
<li><strong>Hyperlinks detective:</strong><br />
Automatically detect http links in PDF and create hyperlinks in SWF.</li>
<li><strong>Stand-alone version: </strong><br />
Works independently of Adobe PDF reader and other 3rd party viewers.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>aXmag的PDF to Flash Converter是个pdf转swf的软件，支持翻页型效果，之前52ba有位朋友求破，软件算法比较繁琐，就不去写注册机了，直接爆破之。<span id="more-377"></span><br />
界面截图如下：</p>
<p>注：软件使用时，水印是直接去掉的，但是logo是可以定制的，也就是说默认没有定制logo的话，还是厂家的logo，因此需要选中logo picture的那个框，然后文件为空即可</p>
<p><img class="aligncenter size-medium wp-image-378" title="1" src="http://blog.kingse.org/wp-content/uploads/2010/08/1-300x253.jpg" alt="" width="300" height="253" /></p>
<p>绿色破解版下载如下：</p>
<p><a href="http://files.kingse.org/PDF2Flash.rar">aXmag PDF2Flash 破解版</a></p>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=377">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/08/377.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>重磅炸弹：iebook 2010 全功能破解版【Stop】</title>
		<link>http://blog.kingse.org/2010/07/370.html</link>
		<comments>http://blog.kingse.org/2010/07/370.html#comments</comments>
		<pubDate>Fri, 30 Jul 2010 04:28:17 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[iebook]]></category>
		<category><![CDATA[杂志]]></category>
		<category><![CDATA[破解]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=370</guid>
		<description><![CDATA[08.05：打击盗版狗目的已达到，停止发放
RT，之前iebook 2010发布的时候也凑过热闹，扔了一个截图，当时没有发布，鉴于最近某论坛打着复制加密狗的旗号进行破解并贩卖，因此特免费放出此全功能破解版，无需任何狗。
现发布iebook 2010 全功能破解版，实现专业版的所有功能，另加按钮可替换。
附去除封底技术支持信息步骤：
如下图所示，将显示技术支持设置为false，并且点击 应用，之后生成杂志即无封底技术支持信息：

下为截图：


预期目标完成，停止发放。


                            
                       [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">08.05：打击盗版狗目的已达到，停止发放</span></p>
<p>RT，之前iebook 2010发布的时候也凑过热闹，扔了一个截图，当时没有发布，鉴于最近某论坛打着复制加密狗的旗号进行破解并贩卖，因此特免费放出此全功能破解版，无需任何狗。</p>
<p>现发布iebook 2010 全功能破解版，实现专业版的所有功能，另加按钮可替换。</p>
<p><span style="color: #ff0000;">附去除封底技术支持信息步骤：</span></p>
<p><span style="color: #ff0000;">如下图所示，将显示技术支持设置为false，并且点击 应用，之后生成杂志即无封底技术支持信息：</span></p>
<p><a href="http://blog.kingse.org/wp-content/uploads/2010/07/7.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-376" title="7" src="http://blog.kingse.org/wp-content/uploads/2010/07/7-143x300.jpg" alt="" width="143" height="300" /></a></p>
<p>下为截图：<a href="http://blog.kingse.org/wp-content/uploads/2010/07/1.jpg" class="highslide-image" onclick="return hs.expand(this);"></a><img class="aligncenter size-medium wp-image-371" title="1" src="http://blog.kingse.org/wp-content/uploads/2010/07/1-300x219.jpg" alt="" width="300" height="219" /><br />
<a href="http://blog.kingse.org/wp-content/uploads/2010/07/2.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-372" title="2" src="http://blog.kingse.org/wp-content/uploads/2010/07/2-218x300.jpg" alt="" width="218" height="300" /></a><a href="http://blog.kingse.org/wp-content/uploads/2010/07/3.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-full wp-image-373" title="3" src="http://blog.kingse.org/wp-content/uploads/2010/07/3.jpg" alt="" width="156" height="234" /></a><a href="http://blog.kingse.org/wp-content/uploads/2010/07/4.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-374" title="4" src="http://blog.kingse.org/wp-content/uploads/2010/07/4-300x144.jpg" alt="" width="300" height="144" /></a><br />
<span id="more-370"></span></p>
<p><span style="color: #ff0000;">预期目标完成，停止发放。</span></p>
<p><a href="http://files.kingse.org/spirit_pro.rar"></a></p>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=370">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/07/370.html/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>简论Direct Ui的体系架构</title>
		<link>http://blog.kingse.org/2010/07/367.html</link>
		<comments>http://blog.kingse.org/2010/07/367.html#comments</comments>
		<pubDate>Sat, 17 Jul 2010 02:26:41 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[DirectUI]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=367</guid>
		<description><![CDATA[Direct UI自从某个大牛第一次使用以后，获得了越来越多的人的追捧。究其原因，无外乎，DirectUI由于是整个窗口只有一个句柄，重绘只有一个句柄掌握，效率高。同时DirectUI窗口更容易实现皮肤效果的统一，例如任一控件可以实现背景透明，不规则形状等等。换肤也比以前简单的多，贴图而已。效果参见qq2009，2010.
这里简要说明下自己研究DirectUI的心得。传统的GUI程序中，大部分控件都是有句柄的。有句柄也就意味着其具有独立的消息队列，独立承担自绘的任务。由于其有句柄，因此整个体系架构简单得多，想让某个控件发生某种状态或响应，直接用其句柄对其发送消息即可。
但是DirectUI窗口中，由于所有控件都是无句柄的，无法直接响应消息，那么怎么办呢？
看下以下的体系架构：

这里处于整个架构顶端的directui基类，这是个有句柄的窗口类，其首先根据配置绘制出所有的directui控件，并保存每个directui控件的指针(取代句柄)。之后响应消息，并通过位置判断等将消息用指针指向进行派发到下级的directui控件中，而不需要sendmessage和postmessage这种方式，类似于delphi控件组中的perform方法。下级控件获得响应的消息，并进行响应，并且调用响应的回调函数。
也就是说，整个架构中，必然存在一个directui基类，这个基类必然是有句柄的，只有这个有句柄的基类的存在，才能保证directui界面中的所有控件能正常响应消息，因为这个基类起到了一个绘制和无句柄情形下消息分发的作用。
以qq2010为例，其directui基类就是TXGuiFoundation类，所有窗口都由此类产生并绘制。

                            
                          [...]]]></description>
			<content:encoded><![CDATA[<p>Direct UI自从某个大牛第一次使用以后，获得了越来越多的人的追捧。究其原因，无外乎，DirectUI由于是整个窗口只有一个句柄，重绘只有一个句柄掌握，效率高。同时DirectUI窗口更容易实现皮肤效果的统一，例如任一控件可以实现背景透明，不规则形状等等。换肤也比以前简单的多，贴图而已。效果参见qq2009，2010.</p>
<p>这里简要说明下自己研究DirectUI的心得。传统的GUI程序中，大部分控件都是有句柄的。有句柄也就意味着其具有独立的消息队列，独立承担自绘的任务。由于其有句柄，因此整个体系架构简单得多，想让某个控件发生某种状态或响应，直接用其句柄对其发送消息即可。</p>
<p>但是DirectUI窗口中，由于所有控件都是无句柄的，无法直接响应消息，那么怎么办呢？</p>
<p>看下以下的体系架构：</p>
<p><a href="http://blog.kingse.org/wp-content/uploads/2010/07/DirectUI.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-368" title="DirectUI" src="http://blog.kingse.org/wp-content/uploads/2010/07/DirectUI-300x179.jpg" alt="" width="300" height="179" /></a></p>
<p>这里处于整个架构顶端的directui基类，这是个有句柄的窗口类，其首先根据配置绘制出所有的directui控件，并保存每个directui控件的指针(取代句柄)。之后响应消息，并通过位置判断等将消息用指针指向进行派发到下级的directui控件中，而不需要sendmessage和postmessage这种方式，类似于delphi控件组中的perform方法。下级控件获得响应的消息，并进行响应，并且调用响应的回调函数。</p>
<p>也就是说，整个架构中，必然存在一个directui基类，这个基类必然是有句柄的，只有这个有句柄的基类的存在，才能保证directui界面中的所有控件能正常响应消息，因为这个基类起到了一个绘制和无句柄情形下消息分发的作用。</p>
<p>以qq2010为例，其directui基类就是TXGuiFoundation类，所有窗口都由此类产生并绘制。</p>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=367">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/07/367.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>浅谈swf中的加密及对策</title>
		<link>http://blog.kingse.org/2010/05/364.html</link>
		<comments>http://blog.kingse.org/2010/05/364.html#comments</comments>
		<pubDate>Sun, 30 May 2010 14:49:02 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[encrypt]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[swf]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=364</guid>
		<description><![CDATA[DelphiSwfSdk近一年没更新，作者消失无踪，留下bug一堆。最近在完善DelphiSwfSdk的过程中，对swf文件格式有了系统的了解，同时就自己比较感兴趣的as加密，也进行了一下研究。研究发现，as1，as2时代的加密，其实大部分都只能称之为“混淆”，利用混淆达到迷惑反编译器甚至卡死反编译器的目的。
就其原理，本质上只在于 反编译器  与 播放器 在处理swf文件时的细节上的差异。详述如下：
1. swf反编译器在反编译过程中，是按照swf的文件规范，将swf依次拆分为很多tag，然后如果tag中含有脚本，例如doaction或doinitaction等tag，则对这个tag中的bytecode，按照最紧凑原则进行依次读取解析，直至解析完整个swf文件。
2.swf播放器，在拆分swf为tag的过程中，和swf反编译器基本类似，差别不大，差别只在于，swf播放器解析tag中的脚本的时候，是变执行变解析，因此并不是按照最紧凑原则进行依次读取解析，而是执行到哪，就解析到哪。这点差别，也就成为了as1，as2时代很多swf加密工具保护swf文件中脚本的基本出发点。
下面，给出两种简单的加密示例的图示说明。
1、如下图所示：
将含有脚本的tag拆分，其中一部分bytecode，移到新加入swf的非官方说明中提到的tag，例如tag id为253等等，只要不和官方已有tag冲突即可，然后再原脚本tag的末尾跳到新tag中自行即可，这里主要利用了swf中的jump指令不但可以在本tag中跳转，同样可以跳转到其他tag，但是swf反编译器就不会这么办，swf反编译器只会将脚本tag当做一个整体去解析，这样当然就得不到正确的结果，swf encrpt中广泛使用了这中方法。
2、如下图所示：
将tag中的脚本中加入jmp，可以是有条件jmp，也可以是无条件jmp，有条件jmp利用好，可以实现多种变种。然后jmp到realcode。而jmp和realcode中插入fake code 或者error code，哪些压根就没有任何意义的bytecode或者错误的bytecode。这样，swf播放器在执行脚本的时候由于是边解析边执行，那么就会跳过fake code段，直接执行real code段。但是swf反编译器是采用 最紧凑法依次解析的，碰到fake code或error code，就挂了，后面的realcode就得到了保护。
在实际过程中，1、2两种方法可以整合使用，以实现更加复杂的方案。
这里也简单的谈谈对付这种加密方案的对策，一句话：模拟执行，模拟真实swf播放器的边解析边执行的过程，将所有可能执行分支全部取出，不可能执行分支全部跳过，之后再合并下得到的结果即可。剩下的仅仅是优化下代码以实现能解析bytecode为as脚本了。

                            
            [...]]]></description>
			<content:encoded><![CDATA[<p>DelphiSwfSdk近一年没更新，作者消失无踪，留下bug一堆。最近在完善DelphiSwfSdk的过程中，对swf文件格式有了系统的了解，同时就自己比较感兴趣的as加密，也进行了一下研究。研究发现，as1，as2时代的加密，其实大部分都只能称之为“混淆”，利用混淆达到迷惑反编译器甚至卡死反编译器的目的。</p>
<p>就其原理，本质上只在于 反编译器  与 播放器 在处理swf文件时的细节上的差异。详述如下：<br />
1. swf反编译器在反编译过程中，是按照swf的文件规范，将swf依次拆分为很多tag，然后如果tag中含有脚本，例如doaction或doinitaction等tag，则对这个tag中的bytecode，按照最紧凑原则进行依次读取解析，直至解析完整个swf文件。<br />
<span id="more-364"></span>2.swf播放器，在拆分swf为tag的过程中，和swf反编译器基本类似，差别不大，差别只在于，swf播放器解析tag中的脚本的时候，是变执行变解析，因此并不是按照最紧凑原则进行依次读取解析，而是执行到哪，就解析到哪。这点差别，也就成为了as1，as2时代很多swf加密工具保护swf文件中脚本的基本出发点。</p>
<p>下面，给出两种简单的加密示例的图示说明。<br />
1、如下图所示：</p>
<p><a href="http://blog.kingse.org/wp-content/uploads/2010/05/encrypt1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-365" title="encrypt1" src="http://blog.kingse.org/wp-content/uploads/2010/05/encrypt1-300x179.jpg" alt="" width="300" height="179" /></a>将含有脚本的tag拆分，其中一部分bytecode，移到新加入swf的非官方说明中提到的tag，例如tag id为253等等，只要不和官方已有tag冲突即可，然后再原脚本tag的末尾跳到新tag中自行即可，这里主要利用了swf中的jump指令不但可以在本tag中跳转，同样可以跳转到其他tag，但是swf反编译器就不会这么办，swf反编译器只会将脚本tag当做一个整体去解析，这样当然就得不到正确的结果，swf encrpt中广泛使用了这中方法。<br />
2、如下图所示：</p>
<p><a href="http://blog.kingse.org/wp-content/uploads/2010/05/encrypt2.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="aligncenter size-medium wp-image-366" title="encrypt2" src="http://blog.kingse.org/wp-content/uploads/2010/05/encrypt2-300x108.jpg" alt="" width="300" height="108" /></a>将tag中的脚本中加入jmp，可以是有条件jmp，也可以是无条件jmp，有条件jmp利用好，可以实现多种变种。然后jmp到realcode。而jmp和realcode中插入fake code 或者error code，哪些压根就没有任何意义的bytecode或者错误的bytecode。这样，swf播放器在执行脚本的时候由于是边解析边执行，那么就会跳过fake code段，直接执行real code段。但是swf反编译器是采用 最紧凑法依次解析的，碰到fake code或error code，就挂了，后面的realcode就得到了保护。</p>
<p>在实际过程中，1、2两种方法可以整合使用，以实现更加复杂的方案。</p>
<p>这里也简单的谈谈对付这种加密方案的对策，一句话：模拟执行，模拟真实swf播放器的边解析边执行的过程，将所有可能执行分支全部取出，不可能执行分支全部跳过，之后再合并下得到的结果即可。剩下的仅仅是优化下代码以实现能解析bytecode为as脚本了。</p>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=364">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/05/364.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>swf中tag整理</title>
		<link>http://blog.kingse.org/2010/05/363.html</link>
		<comments>http://blog.kingse.org/2010/05/363.html#comments</comments>
		<pubDate>Thu, 27 May 2010 14:41:57 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=363</guid>
		<description><![CDATA[swf文件格式是基于tag的，每个tag之间独立，只有引用与被引用的关系。软件在处理swf文件时，遇见不认识的tag，可以跳过处理。
截止swf 10为止，tag共有以下种类，其中有些tag已经被废弃不用。已经标出。
tagEnd = 0;
tagShowFrame = 1;
tagDefineShape = 2;
tagFreeCharacter =3;
tagPlaceObject = 4;
tagRemoveObject = 5;
tagDefineBits = 6;
tagDefineButton = 7;
tagJPEGTables = 8;
tagSetBackgroundColor = 9;
tagDefineFont = 10;
tagDefineText = 11;
tagDoAction = 12;
tagDefineFontInfo = 13;
tagDefineSound = 14;
tagStartSound = 15;
tagStopSound =16;
tagDefineButtonSound = 17;
tagSoundStreamHead = 18;
tagSoundStreamBlock = 19;
tagDefineBitsLossless = 20;
tagDefineBitsJPEG2 = 21; 
tagDefineShape2 = 22;
tagDefineButtonCxform = 23;
tagProtect = 24;
tagPathsArePostScript = 25;
tagPlaceObject2 = 26;
tagRemoveObject2 [...]]]></description>
			<content:encoded><![CDATA[<p>swf文件格式是基于tag的，每个tag之间独立，只有引用与被引用的关系。软件在处理swf文件时，遇见不认识的tag，可以跳过处理。</p>
<p>截止swf 10为止，tag共有以下种类，其中有些tag已经被废弃不用。已经标出。</p>
<blockquote><p>tagEnd = 0;<br />
tagShowFrame = 1;<br />
tagDefineShape = 2;<br />
tagFreeCharacter =3;<br />
tagPlaceObject = 4;<br />
tagRemoveObject = 5;<br />
tagDefineBits = 6;<br />
tagDefineButton = 7;<br />
tagJPEGTables = 8;<br />
tagSetBackgroundColor = 9;<br />
tagDefineFont = 10;<br />
tagDefineText = 11;<br />
tagDoAction = 12;<br />
tagDefineFontInfo = 13;<br />
tagDefineSound = 14;<br />
tagStartSound = 15;<br />
tagStopSound =16;<br />
tagDefineButtonSound = 17;<br />
tagSoundStreamHead = 18;<br />
tagSoundStreamBlock = 19;<br />
tagDefineBitsLossless = 20;<br />
tagDefineBitsJPEG2 = 21; <span id="more-363"></span><br />
tagDefineShape2 = 22;<br />
tagDefineButtonCxform = 23;<br />
tagProtect = 24;<br />
tagPathsArePostScript = 25;<br />
tagPlaceObject2 = 26;<br />
tagRemoveObject2 = 28;<br />
tagDefineShape3 = 32;<br />
tagDefineText2 = 33;<br />
tagDefineButton2 = 34;<br />
tagDefineBitsJPEG3 = 35;<br />
tagDefineBitsLossless2 = 36;<br />
tagDefineEditText = 37;<br />
// tagDefineVideo = 38;<br />
tagDefineSprite = 39;<br />
tagNameCharacter = 40;<br />
tagProductInfo = 41; // non officially<br />
tagFrameLabel = 43;<br />
tagSoundStreamHead2 = 45;<br />
tagDefineMorphShape = 46;<br />
tagDefineFont2 = 48;<br />
tagExportAssets = 56;<br />
tagImportAssets = 57;<br />
tagEnableDebugger = 58;<br />
tagDoInitAction = 59;<br />
tagDefineVideoStream = 60;<br />
tagVideoFrame = 61;<br />
tagDefineFontInfo2 = 62;<br />
tagExtDebuggerInfo = 63;<br />
tagEnableDebugger2 = 64;<br />
tagScriptLimits = 65;<br />
tagSetTabIndex = 66;<br />
//tagDefineShape4 = 67; // use 83<br />
tagFileAttributes = 69;<br />
tagPlaceObject3 = 70;<br />
tagImportAssets2 = 71;<br />
tagDoABC = 72;<br />
tagDefineFontAlignZones = 73;<br />
tagCSMTextSettings = 74;<br />
tagDefineFont3 = 75;<br />
tagSymbolClass = 76;<br />
tagMetadata = 77;<br />
tagDefineScalingGrid = 78;<br />
tagDoABC2 = 82;<br />
tagDefineShape4 = 83;<br />
tagDefineMorphShape2 = 84;<br />
tagDefineSceneAndFrameLabelData = 86;<br />
tagDefineBinaryData = 87;<br />
tagDefineFontName = 88;<br />
tagStartSound2 = 89;<br />
tagDefineBitsJPEG4 = 90;<br />
tagDefineFont4 = 91; </p></blockquote>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=363">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/05/363.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>以zm的旧瓶，装fflippage的新酒</title>
		<link>http://blog.kingse.org/2010/05/359.html</link>
		<comments>http://blog.kingse.org/2010/05/359.html#comments</comments>
		<pubDate>Thu, 13 May 2010 12:34:45 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FFlipPage]]></category>
		<category><![CDATA[zine]]></category>
		<category><![CDATA[zinemaker]]></category>
		<category><![CDATA[电子杂志]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=359</guid>
		<description><![CDATA[篇首语：这篇文章老早就想写了，但是本人懒散，兴趣爱好多变，因此本文一直流产至今，知道最近受CGFinal的CGArt杂志的as3翻页核心刺激，重新研究as3杂志时，才有了写这篇唠叨之词的兴致。
另：本文中仅唠叨思想，而无完整实现给出，因此想不自己动手的可以关掉此页面了，对你们的乘兴而来，败兴而归，本人深感抱歉！
电子杂志从初出茅庐，到兴起，乃至今天的回归平淡，依稀走过了6，7年的时光。
zinemaker的诞生，是推动当时电子杂志行业发展的一大举措，也是她将电子杂志这个原来遥不可及的东西摆到了普通业余爱好者的面前，之后，业余杂志数不胜数。
即使2010年的今天，zinemaker沉寂多年后的今天，zinemaker在电子杂志爱好者的手中，依然发挥着她的余光预热。
但是，不得不说，zinemaker的杂志表现形式太单调，翻页效果不够完善。令人失望的是，网上见得比比皆是的都是基于原杂志核心就行的改进，诸如：1、尺寸改进后的模板，2：按钮美化后的模板，3：添加个别功能，诸如打开密码后的模板，4：搜索，放大缩小，自动缩略图等等。  但  这些并不涉及zinemaker的翻页核心：pageflip.swf，而只是其外在的部分表现形式的更改及优化。zinemaker杂志的翻页依旧是那么死板，那么别扭，那么令人感到难受。
要明白，要从本质上将zinemaker当成一个打包程序看待，而不要仅仅将它限于一个放进页面，点击编译就能得到杂志的自动化生产工具。
zinemaker的杂志，涉及到的主要文件无非就两个，index.swf,pages.txt或pages.xml，至于我为什么说其他文件不是，因为其他文件可以自定义文件名，甚至没有,一切仅仅看index.swf这位老大哥的爱好。
这两个中间中，index.swf可以看成是一个外壳，一个从pages.xml中读取页面数据并展示出来的外壳。pageflip.swf仅仅为index.swf服务而已。
zinemaker做出来的杂志，相比于使用fictiony的fflippage组件做出来的杂志，我想大家都知道，翻页效果的表现形式远远比不上。既然比不上，为什么不见zinemaker的翻页核心直接换成fflippage？
这并不是天方夜谭，你可以反编译原index.swf，更改程序将翻页核心替换成fflippage，这是下策，切记“反编译出来的东西，仅有参考价值，而无实用价值”。 最佳做法是，自己新建index.swf，这个index.swf中，你只要在使用fflippage组件的基础上实现以下接口，就可包装成杂志模板，与zinemaker完美兼容
1、zinemaker软件外壳所需要用到的部分全局变量，例如杂志宽度，杂志高度等。这些在新建的index.swf中必须得以体现。
2、实现调用pages.xml或pages.txt进行页面初始化的接口，zinemaker的杂志均为外调页面型，因此必须实现对页面列表文件的调用接口，这个借口的输出是固化在zinemaker软件外壳之中的。
3、为了和zinemaker本身自带的翻页静帧功能相适应，可以考虑实现调用 zinemaker在编译杂志的过程中自动添加到index.swf中的那些有导出链接的图片。当然，你也可以不用自带的翻页静帧功能，自己采用bitmap截图法熟悉翻页静帧。这两种方法各有优缺点，尤其在在线杂志上体现明显，这里就不多说了。
4、保留zinemaker的按钮等辅助设施的实现分离功能，见按钮，片头，等分离到单独文件中，由index.swf调用，方便制作杂志时的自定义。
成功实现了以上四种接口，那么即可将index.swf等组成新的主模板文件输出到zinemaker中使用。从而，你的zinemaker输出的杂志，既有zinemaker做杂志的方便快捷的高效，也有fflippage翻页的美观，华丽。

                            
                       [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #800080;">篇首语：这篇文章老早就想写了，但是本人懒散，兴趣爱好多变，因此本文一直流产至今，知道最近受CGFinal的CGArt杂志的as3翻页核心刺激，重新研究as3杂志时，才有了写这篇唠叨之词的兴致。</span></p>
<p><span style="color: #ff0000;">另：本文中仅唠叨思想，而无完整实现给出，因此想不自己动手的可以关掉此页面了，对你们的乘兴而来，败兴而归，本人深感抱歉！</span></p>
<p>电子杂志从初出茅庐，到兴起，乃至今天的回归平淡，依稀走过了6，7年的时光。</p>
<p>zinemaker的诞生，是推动当时电子杂志行业发展的一大举措，也是她将电子杂志这个原来遥不可及的东西摆到了普通业余爱好者的面前，之后，业余杂志数不胜数。<br />
即使2010年的今天，zinemaker沉寂多年后的今天，zinemaker在电子杂志爱好者的手中，依然发挥着她的余光预热。</p>
<p>但是，不得不说，zinemaker的杂志表现形式太单调，翻页效果不够完善。令人失望的是，网上见得比比皆是的都是基于原杂志核心就行的改进，诸如：1、尺寸改进后的模板，2：按钮美化后的模板，3：添加个别功能，诸如打开密码后的模板，4：搜索，放大缩小，自动缩略图等等。  但  这些并不涉及zinemaker的翻页核心：pageflip.swf，而只是其外在的部分表现形式的更改及优化。zinemaker杂志的翻页依旧是那么死板，那么别扭，那么令人感到难受。<span id="more-359"></span></p>
<p>要明白，要从本质上将zinemaker当成一个打包程序看待，而不要仅仅将它限于一个放进页面，点击编译就能得到杂志的自动化生产工具。</p>
<p>zinemaker的杂志，涉及到的主要文件无非就两个，index.swf,pages.txt或pages.xml，至于我为什么说其他文件不是，因为其他文件可以自定义文件名，甚至没有,一切仅仅看index.swf这位老大哥的爱好。</p>
<p>这两个中间中，index.swf可以看成是一个外壳，一个从pages.xml中读取页面数据并展示出来的外壳。pageflip.swf仅仅为index.swf服务而已。</p>
<p>zinemaker做出来的杂志，相比于使用fictiony的fflippage组件做出来的杂志，我想大家都知道，翻页效果的表现形式远远比不上。既然比不上，为什么不见zinemaker的翻页核心直接换成fflippage？</p>
<p>这并不是天方夜谭，你可以反编译原index.swf，更改程序将翻页核心替换成fflippage，这是下策，切记“反编译出来的东西，仅有参考价值，而无实用价值”。 最佳做法是，自己新建index.swf，这个index.swf中，你只要在使用fflippage组件的基础上实现以下接口，就可包装成杂志模板，与zinemaker完美兼容</p>
<p>1、zinemaker软件外壳所需要用到的部分全局变量，例如杂志宽度，杂志高度等。这些在新建的index.swf中必须得以体现。</p>
<p>2、实现调用pages.xml或pages.txt进行页面初始化的接口，zinemaker的杂志均为外调页面型，因此必须实现对页面列表文件的调用接口，这个借口的输出是固化在zinemaker软件外壳之中的。</p>
<p>3、为了和zinemaker本身自带的翻页静帧功能相适应，可以考虑实现调用 zinemaker在编译杂志的过程中自动添加到index.swf中的那些有导出链接的图片。当然，你也可以不用自带的翻页静帧功能，自己采用bitmap截图法熟悉翻页静帧。这两种方法各有优缺点，尤其在在线杂志上体现明显，这里就不多说了。</p>
<p>4、保留zinemaker的按钮等辅助设施的实现分离功能，见按钮，片头，等分离到单独文件中，由index.swf调用，方便制作杂志时的自定义。</p>
<p>成功实现了以上四种接口，那么即可将index.swf等组成新的主模板文件输出到zinemaker中使用。从而，你的zinemaker输出的杂志，既有zinemaker做杂志的方便快捷的高效，也有fflippage翻页的美观，华丽。</p>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=359">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/05/359.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>倒，榜首</title>
		<link>http://blog.kingse.org/2010/05/358.html</link>
		<comments>http://blog.kingse.org/2010/05/358.html#comments</comments>
		<pubDate>Mon, 10 May 2010 15:30:48 +0000</pubDate>
		<dc:creator>coolspace</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[摩羯]]></category>
		<category><![CDATA[星座]]></category>

		<guid isPermaLink="false">http://blog.kingse.org/?p=358</guid>
		<description><![CDATA[嘛也不说了，悲剧的榜首了
发信人: emptyll (空空如也&#8221;"媚灵狐&#8221;"似水流年&#8221;"&#8221;), 信区: Astrology
标  题: 对感情不主动！不拒绝！不负责的男生星座
发信站: 天大求实BBS (Mon May 10 18:05:55 2010), 本站(bbs.tju.edu.cn)
第一名：魔羯男
魔羯男有两种，一种是好男人型，另一种则是玩家型的魔羯男，玩家型的魔羯男喜欢到声色场所，外表给人家一种道貌盎然的感觉的他再加上天生有一种旁观者的天份，因此会让他特别吸引异性的爱慕，所以他虽然不主动，但是异性缘超乎想像的好，而且希望大家开心的他对於异性的主动不会拒绝，因为他认为这一切都是缘分，但是要他负责完全不可能！魔羯男认为从头到尾自己都没有主动，为什麽要负责任。
第二名：水瓶男
水瓶男是隐性的主动者，若是他属於玩家级，光是摆出绅士的派头，根本不必主动很多女性就已经被他迷倒了，因为水瓶男很注重穿着、仪态的优雅、对事物的品味&#8230;.等等，而且水瓶男总有一段堕落时期，这段时期私生活可说是非常混乱，简直是逢人就上，不过水瓶男绝对不会让自己弄到要负责的程度，因为他不可能让这些不列入人生计画的脱轨邂逅影响到自己未来的人生。
第三名：双鱼男
双鱼男有两种面貌，光明面的他慈善温和，不过要是论起阴暗面时他也是一等一的高手，他对待女生很贴心体贴，让异性对他丝毫不设防，根本不需要主动对方就送上门了，另外双鱼男也不会拒绝主动送上门来的对象，当他胃口好的时候，*都无所谓，他的不拒绝也很有手腕，双鱼男会用很多正当的藉口让对方死心。

                            
              [...]]]></description>
			<content:encoded><![CDATA[<p>嘛也不说了，悲剧的榜首了</p>
<blockquote><p>发信人: emptyll (空空如也&#8221;"媚灵狐&#8221;"似水流年&#8221;"&#8221;), 信区: Astrology<br />
标  题: 对感情不主动！不拒绝！不负责的男生星座<br />
发信站: 天大求实BBS (Mon May 10 18:05:55 2010), 本站(bbs.tju.edu.cn)</p>
<p>第一名：魔羯男</p>
<p>魔羯男有两种，一种是好男人型，另一种则是玩家型的魔羯男，玩家型的魔羯男喜欢到声色场所，外表给人家一种道貌盎然的感觉的他再加上天生有一种旁观者的天份，因此会让他特别吸引异性的爱慕，所以他虽然不主动，但是异性缘超乎想像的好，而且希望大家开心的他对於异性的主动不会拒绝，因为他认为这一切都是缘分，但是要他负责完全不可能！魔羯男认为从头到尾自己都没有主动，为什麽要负责任。</p>
<p>第二名：水瓶男</p>
<p>水瓶男是隐性的主动者，若是他属於玩家级，光是摆出绅士的派头，根本不必主动很多女性就已经被他迷倒了，因为水瓶男很注重穿着、仪态的优雅、对事物的品味&#8230;.等等，而且水瓶男总有一段堕落时期，这段时期私生活可说是非常混乱，简直是逢人就上，不过水瓶男绝对不会让自己弄到要负责的程度，因为他不可能让这些不列入人生计画的脱轨邂逅影响到自己未来的人生。</p>
<p>第三名：双鱼男</p>
<p>双鱼男有两种面貌，光明面的他慈善温和，不过要是论起阴暗面时他也是一等一的高手，他对待女生很贴心体贴，让异性对他丝毫不设防，根本不需要主动对方就送上门了，另外双鱼男也不会拒绝主动送上门来的对象，当他胃口好的时候，*都无所谓，他的不拒绝也很有手腕，双鱼男会用很多正当的藉口让对方死心。</p></blockquote>

                            <div id="downaspdf">
                                <a href="http://blog.kingse.org/wp-content/plugins/down-as-pdf/generate.php?id=358">
                                    <span>下载本文PDF文档</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://blog.kingse.org/2010/05/358.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
