Delphi RTTI 可执行项目
在 C# 中,您可以轻松打开程序集(只是 EXE 中的另一个词),然后从该程序集中获取反射信息。我一直在为 Delphi 寻找类似的东西,我可以编写一个 Delphi 程序,它可以指向 Delphi EXE,然后获取反射信息。我怎样才能存档这个?谢谢
in C# you can easily open an assembly (just another word from an EXE) and then get reflection information from that assembly. I've been looking for something similar for Delphi where I can write a Delphi program that can point to a Delphi EXE then get me reflection information. How can I archive this? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有一些程序可以从 Delphi 程序和 DLL 中提取 RTTI。它不像 .NET 那样丰富,但可以在有限的程度上完成。 Delphi 2010 及更高版本中提供了更多 RTTI,但据我所知,还没有程序可以从中提取信息。
我参加了正式宣布该系统的会议,很多人问这将如何影响安全性。创建新 RTTI 的巴里·凯利 (Barry Kelly) 表示,没有足够的元数据可用于创建“Delphi Reflector”。
There are a handful of programs that can extract RTTI from Delphi programs and DLLs. It's not as rich as what's available for .NET, but it can be done to a limited degree. There's a lot more RTTI available in Delphi 2010 and later versions, but as far as I know there's no program out yet that can extract info from them.
I was at the conference where this system was formally announced, and a bunch of people asked how this would affect security. Barry Kelly, who created the new RTTI, said that there would not be enough metadata available to create a "Delphi Reflector".
好吧,悲伤的消息是,你可能做不到。您可以轻松查看 .NET 程序集,因为它们 a) 被编译为所谓的中间语言(因此您甚至可以使用 Reflector 等获取代码),b) 包含元数据。另一方面,Delphi 编译为本机代码并生成常规 PE 文件,这些文件不包含像 .NET 程序集那样的丰富元数据。
Delphi 就不是这样工作的。
Well, sad news is, you probably can't. You can easily view .NET assemblies because they a) are compiled to what is called intermediate language (thus you can even get the code back using the likes of Reflector etc.), and b) contain metadata. Delphi, on the other hand, compiles to native code that and produces regular PE files that do not include rich metadata like a .NET assembly.
Delphi just doesn't work that way.
有一些工具可以帮助逆向(Delphi 编写的)可执行文件,但这绝非易事,并且需要良好的 x86 汇编知识。
此类工具的一些示例包括:
Delphi 可执行文件的资源部分还显示有用的信息,例如表单及其组件。
另请参阅 是否有反编译 Delphi 的程序?
There are tools that can assist in reversing (Delphi written) executables but it will never be easy and it requires good x86 assembly knowledge.
Some examples of such tools are:
The resource sections of a Delphi Executable also reveals usefull info like the form and it's components.
See also Is there a program to decompile Delphi?
如果你有 Delphi2010+,你可以加载一个 bpl,然后使用丰富的 rtti 来覆盖它。你可以使用 C# 和 .net 程序集来完成。如果您需要在 .exe 中执行此操作,据我所知,您不能。
If you have Delphi2010+ you can load a bpl and then use the rich rtti over it lik. e you do with c# and a .net assembly. If you need to do this in a .exe AFAIK you can't.
TestComplete 似乎可以识别正在运行的 Delphi 可执行文件中的大多数对象。您可以使用脚本提取此信息。 下载演示
可以从 http://www.automatedqa.com/downloads/testcomplete 也许不是您想要的应用程序类型,因为它很大并且是为 GUI 测试而设计的,但是它可以识别对象。
TestComplete seems to identify most objects in a running Delphi executable. You can extract this information with a script. A demo can be downloaded from http://www.automatedqa.com/downloads/testcomplete
This is maybe not the type of application you want as it is big and made for GUI-testing, but yes it can identify the objects.
正如Remko提到的,IDR(交互式Delphi重构器)可以提取Delphi 2到2009版本的所有RTTI信息(如果程序包含它!)。2010版本将在稍后推出。此外,IDR 可以使用它在程序中找到的所有信息来为反汇编的程序代码创建大量注释(这是分析的第一步)。您还可以查看表单并轻松访问与控件关联的事件处理程序。
As mentioned Remko, IDR (Interactive Delphi Reconstructor) can extract all RTTI information (if program contains it!) for Delphi version from 2 to 2009. Version 2010 will be available later. Moreover IDR can use all information that it finds in program to create a lot of comments to disassemled program code (this is a first step of analyses). You can also look forms and easy go to event hadlers associated with controls.