有人解释一下为什么下一段代码会在ntdll.dll中返回一个指针吗?
GetProcAddress(LoadLibraryA("kernel32.dll"), "EncodePointer");
GetProcAddress(LoadLibraryA("kernel32.dll"), "DecodePointer");PS:如果调用kernel32的导出表所指向的函数,就会抛出断点。
发布于 2012-06-14 05:12:56
这是一个简单的出口转发案例,正如Matt Pietrek的一篇优秀的MSDN杂志文章An In-Depth Look into the Win32 Portable Executable File Format, Part 2中所描述的那样。
你可以用Dependency Walker或dumpbin这样的工具来验证这一点。
dumpbin /exports kernel32.dll | grep codePointer
205 CC DecodePointer (forwarded to NTDLL.RtlDecodePointer)
240 EF EncodePointer (forwarded to NTDLL.RtlEncodePointer)发布于 2012-06-14 05:13:04
它被称为DLL转发/重定向或函数别名。导出条目的定义为:
entryname[=internalname] [@ordinal [NONAME]] [PRIVATE] [DATA]因此,可以定义entryname
EncodePointer=ntdll.RtlEncodePointer要检查:
C:\>findaddress ntdll.dll RtlEncodePointer
ntdll.dll : 7C900000
RtlEncodePointer@ntdll.dll: 7C9132D9
C:\>findaddress kernel32.dll EncodePointer
kernel32.dll : 7C800000
EncodePointer@kernel32.dll: 7C9132D9(findaddress是我快速完成此任务的个人工具)
你可以在这里看到更多:http://msdn.microsoft.com/en-us/library/hyx1zcd3(v=vs.80).aspx
我认为这是一个很好的问题。如果你想写一个小程序(甚至是恶意软件)来做研究,这并没有错!
https://stackoverflow.com/questions/11022930
复制相似问题