How crypto2011/idr works
Project Type and Purpose
• IDR is a decompiler tool targeted at analyzing and recovering Delphi executables and DLLs. The README explains that it performs static analysis on compiled files (from Delphi2 up to Delphi XE4) to extract as much of the original source code information as possible. It is also used safely for malware analysis.
• Since the application features a rich interactive UI (many files ending in .dfm and matching dialog-based C++ units indicate this) along with a strong back-end decompilation/disassembly engine, it is effectively a desktop application organized around a core analysis engine with several supporting modules.
Analyzing the File Structure
• At the top-level, you see source files (CPP and header files) such as Main.cpp/main.h, and many dialog files (e.g., AboutDlg, ActiveProcesses, EditFunctionDlg, Explorer, etc.). This indicates a substantial graphical UI built with dialogs.
• Core engine components are evident from files like Decompiler.cpp/decompiler.h, Disasm.cpp/disasm.h, Analyze1.cpp, Analyze2.cpp, and other analysis-related files. These form the heart of the static analysis and decompilation process.
• There is also a plugins folder (with its own files and resources) that suggests extensibility and modularity.
• The existence of a KnowledgeBase module (KnowledgeBase.cpp, KBViewer, kb*.7z files, and syskb*.bin files) points to integration of preconfigured decompilation rules/data for various Delphi versions.
• Build scripts and configuration files (e.g., .gitignore, idr.ini) round out the ecosystem.
Components
a. User Interface (UI) Layer:
• Dialog windows (AboutDlg, ActiveProcesses, EditFieldsDlg, Explorer, FindDlg, InputDlg, etc.). These form the interactive layer between the user and the core decompilation engine.
b. Core Analysis Engine:
• Decompiler Component: Illustrate modules such as Decompiler.cpp/Decompiler.h and its supporting analysis units (e.g., Analyze1.cpp, Analyze2.cpp, etc.) which process binary executables.
• Disassembly Engine: Represent files like Disasm.cpp/Disasm.h that provide low-level binary disassembly prior to decompilation.
• Helper/Utility Components: Indicate analysis helpers (e.g., Hex2Double, EditFunctionDlg, and Misc) that support parsing and data transformation.
c. Plugin/Extensibility Layer:
d. Knowledge Base Integration:
• KnowledgeBase component (including KnowledgeBase.cpp, KBViewer, and supporting binary knowledge files such as kb*.7z and syskb*.bin files) that facilitates version-specific decompilation rules and heuristics.
e. External Configuration/Resource Files:
• Also denote build configuration elements (e.g., idr.ini) for runtime settings.
Relationships and Data Flows
• The Core Analysis Engine should be subdivided to show the interaction between the Disassembly Engine (for low-level code translation) and the Decompiler Component (for higher-level reconstruction).
• Knowledge Base as feeding into the decompilation engine, providing rules, metadata, and other critical data used during analysis.
• Outputs sent back to the UI – results, performance reports, or recovered source code – alongside any logging or debugging components.
Architectural Patterns and Design Principles
• The design implies a separation of concerns between presentation (UI dialogs) and business logic (decompilation and disassembly processing).
• An extensibility mechanism is present (plugins) which can be highlighted as an inversion of control or interface-based integration.