tags:

views:

139

answers:

6

Hi, 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

+2  A: 

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.

Jim Brissom
+3  A: 

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".

Mason Wheeler
A: 

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 http://stackoverflow.com/questions/335104/is-there-a-program-to-decompile-delphi

Remko
+1  A: 

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.

Daniele Teti
You can if the Enhanced RTTI is enabled. It is a configurable option.
Remy Lebeau - TeamB
A: 

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.

Roland Bengtsson
A: 

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.

crypto