ORPHANWARE RECOVERY
Home/Guides/Recover Delphi source code

How to recover Delphi source code from a compiled EXE

Yes, you can often recover a large part of a Delphi program from its compiled EXE, but not the original project files. Forms come back nearly whole, because Delphi links each form into the EXE as a resource with its components and property values. Class names, published fields, and event handler names usually survive too, because the runtime needs them to load those forms. Comments, formatting, and local variable names do not. Delphi decompilers give you a map of the program and partial listings, not a project that compiles, so a usable recovery means reconstructing readable source, compiling it, and testing the rebuild against the program you still run.

Last updated

Why so many Delphi applications are still running

Delphi and Object Pascal applications are common in utilities, industrial tools, and internal business software, valued for fast native programs that run for years without attention. Many were built by one developer or a small shop, and many are still in daily use long after the developer retired or moved on and the project folder with the .dpr, .pas, and .dfm files went with an old PC or a failed drive. The program still runs. Nothing about it can be patched, ported, or audited without source, and the day an operating system, database connection, or hardware interface changes, the owner has no way to adapt it.

First question: which compiler built it?

"Delphi" covers many compiler versions released over many years, and the version that built your EXE shapes which tools can read it. The README for IDR, the Interactive Delphi Reconstructor, says it processes GUI and console programs compiled by Delphi versions Delphi 2 through Delphi XE4 (IDR on GitHub). NCC Group's Pythia, which extracts Delphi class information, notes that it has only been tested on 32-bit code and only supports Windows PE files (Pythia on GitHub). A program built with an older Delphi as a 32-bit Windows EXE sits squarely inside what public tooling handles; a 64-bit build from a recent release falls outside what those two tools document. A Free Pascal or Lazarus build is a related but different case, which matters below.

Neither situation is hopeless, but they are different jobs, and a recovery estimate that does not first identify the compiler and the target is guessing.

What survives in a compiled Delphi EXE

A compiled Delphi EXE keeps a good deal of the program's structure, because its form system and its runtime type information need names and layouts at run time.

  • Forms and their layout. A form file usually shares its unit's name and is linked in with the {$R *.dfm} directive; when the program is linked, each resource is copied into the executable (Embarcadero DocWiki: Resource file). Embarcadero's documentation notes that if that directive is missing, the form is not included and loading it fails, which is a reminder that the form really does live inside the EXE (Embarcadero DocWiki: EResNotFound). Inside the program, form resources are stored as RCDATA resources named after the form class in capital letters, so TForm1 becomes TFORM1, in a compact binary format that holds the same properties as the original .dfm (Soluling: Delphi form files).
  • Class names, published fields, and event handler names. Embarcadero's documentation says the compiler generates run-time type information for published members, and that this information is used to save and load form files and to associate event handlers with events (Embarcadero DocWiki: Classes and Objects). Classes derived from TPersistent get this information for their published sections (Embarcadero DocWiki: Run-Time Type Information). In practice that means the names of forms, the components placed on them, and handlers such as FormCreate or a button's click handler tend to come back as written. A published security analysis of a Delphi program recovered method names such as TForm1.FormCreate using symbols retrieved by IDR (Reversec Labs: AtivarSpy analysis).
  • The class tree. Delphi's virtual method tables carry class names and parent relationships, and tools such as Pythia scan for them to rebuild a class hierarchy from the EXE (Pythia on GitHub).
  • Resources. Icons, images, and other resources from the project's resource files are copied into the executable at link time (Embarcadero DocWiki: Resource file).

In practice the screens your staff use every day, and the names behind the buttons and fields on them, are the best preserved part of a Delphi program.

What is lost for good

The human layer of the source was never needed at run time, so the compiler did not keep it. Comments and formatting are gone, the original names of local variables are usually gone, and the reasons behind decisions were never in the binary to begin with, as the binary recovery guide explains for compiled programs in general. Routine logic comes back as machine code that has to be lifted into readable Pascal. The same security write-up notes that even after recovering symbols with IDR, further adjustments to things like calling conventions and function signatures were needed before the decompiled view resembled the original (Reversec Labs: AtivarSpy analysis).

The pattern is easy to remember: the interface and class structure come back with their names, and the logic inside the routines comes back without its labels. No tool restores what is not in the file, so anyone promising your original comments back is promising something the EXE does not contain.

Why raw decompiler output is not a rebuildable project

The tool makers are candid about this. IDR's README says the final goal is a program that can restore most of the original Delphi source from the compiled file, but that IDR, like other Delphi decompilers, cannot do that yet; it describes IDR as considerably easing that process instead (IDR on GitHub). Pythia's README says it is not designed to be a full Delphi decompiler and points to other tools for that job (Pythia on GitHub).

Even a clean listing leaves the harder questions open. Does it build? Does it run with the same third party components, database drivers, and packages the original uses? Does it print the same invoice, calculate the same totals, and reject the same bad input? A decompiler cannot answer those. That is why the homepage describes the deliverable as readable source structured the way a developer would write it, and says plainly that it is not raw decompiler output.

How Orphanware Recovery approaches a Delphi recovery

The pipeline is the same four stages used on every engagement. Reconnaissance inventories the program: what it does, the files it reads and writes, the platform and compiler it was built with, and whether full recovery is realistic, and you get an honest verdict first. Decompilation produces a first draft of the logic. Reconstruction rebuilds that draft into clean, readable source with meaningful names and normal structure, then compiles it into a working program. Differential verification runs the rebuild and the original side by side across thousands of generated test cases and compares the outputs exactly, and any divergence is found, fixed, and retested. The binary recovery guide walks each stage, and the differential testing guide explains what zero divergence does and does not prove.

For Object Pascal specifically, there is one measured result. Feasibility passed on October 19, 2026: a Free Pascal compiled target was recovered with class and property names intact from runtime type information, verified across 4,654 fuzz cases. Stated plainly: that target was built with Free Pascal, not Embarcadero Delphi, and VCL forms applications have not been tested yet. The rest of the measured record on this site comes from C and C++ targets. So an Embarcadero Delphi engagement starts with a recon verdict on your specific EXE before any recovery is promised, as the Delphi and Object Pascal directory entry describes. If a part of the program cannot be recovered, the report documents exactly where and why instead of filling the gap with plausible looking code.

Orphanware Recovery is operated by Josiah Wilson, who directs every engagement and signs off on every result. The decompilation, reconstruction, and testing pipeline is carried out by AI agents under his direction.

What to gather before you ask

Collect what you can without changing the working machine: the EXE, any DLL and package (.bpl) files installed with it, the installer or setup folder if it still exists, configuration files, the database or data files it uses, and a few sample printouts or exports that show what correct output looks like. If you know roughly when the program was built or which Delphi version was used, note it. The intake checklist lists the rest. Please do not attach the binary to your first email; after an initial reply, the transfer is arranged. Work is only done on binaries you own or have the right to reverse engineer, and the guide to decompiling legality covers the questions owners usually ask.

If you are not sure which compiler built your program, which files matter, or whether recovery is realistic at all, that is exactly what the Recon Report answers, for a fixed $45, before any larger commitment. See pricing for the tiers.

Start with a $45 Recon Report

An honest verdict on whether your program can be recovered, what it does, and what a full recovery would take. Fixed price, delivery in about 3 days.