简体   繁体   English

从delphi.exe提取项目文件

[英]Extracting project file from delphi.exe

I have all the files needed to open the unit and code but I can't make any changes or compile because the Project.dproj and Project.dpr files are missing. 我拥有打开设备和代码所需的所有文件,但是由于缺少Project.dproj和Project.dpr文件,因此无法进行任何更改或编译。 However, I have the .exe file. 但是,我有.exe文件。 Is there any way by which the aforementioned files can be extracted from the .exe file? 有什么方法可以从.exe文件中提取上述文件?

The compiler adds RTTI metadata, including unit names, when it builds, and if you know about how the RTTI tables are laid out it's possible to extract this. 编译器在构建时会添加RTTI元数据,包括单位名称,如果您知道RTTI表的布局方式,则可以提取它。 The unit list is the principal component of the DPR file, but it takes some serious work to access it and I'm not aware of any tools out there that read the RTTI tables that have been kept up to date beyond the Delphi 7 era. 单元列表是DPR文件的主要组成部分,但是访问它需要花费一些认真的工作,我不知道那里有任何工具可以读取在Delphi 7时代之后一直更新的RTTI表。

As for the .dproj file, you're out of luck. 至于.dproj文件,您不走运。 That doesn't actually contain any code that gets "compiled in" to the EXE; 那实际上不包含任何“编译”到EXE的代码。 it's a set of build instructions for how to produce the EXE. 这是有关如何生成EXE的一组构建说明。 But if the Delphi IDE doesn't have one, it can generate a default .dproj from the .dpr, if you can produce that. 但是,如果没有Delphi IDE,则可以从.dpr生成默认的.dproj(如果可以生成的话)。

I'm curious, though. 我很好奇。 How did you obtain the .pas files but not the .dpr? 您如何获取.pas文件而不是.dpr文件?

If you have all of the source files, meaning the .pas and .dfm files, then the first thing I'd do is add them all into a new project and try to compile it. 如果您拥有所有源文件,即.pas和.dfm文件,那么我要做的第一件事就是将它们全部添加到新项目中并尝试对其进行编译。 It'll either work, meaning you've got everything you need, or it will generate errors. 它会起作用,这意味着您拥有所需的一切,否则会产生错误。

There would be three kinds of errors: 将出现三种错误:

The first is the most likely -- the forms might use components that you don't have installed. 第一种是最有可能的-表单可能会使用您尚未安装的组件。 This will be obivous if you try to open the forms in the IDE. 如果您尝试在IDE中打开表单,这将是显而易见的。 If they open without fanfare, GREAT! 如果他们没有大张旗鼓地开放,那就太好了! If you get a warning box saying "Cannot locate component: remove references to it?" 如果出现警告框,提示“找不到组件:是否删除对它的引用?” or something like that, then you're probably hosed. 或类似的东西,那么您可能会被淘汰。

The second is version-specific errors -- stuff that's old and crufty and no longer supported by the language. 第二个是特定于版本的错误-这些东西已经过时且笨拙,不再受该语言支持。

Third, the program may use run-time libraries that you don't have. 第三,程序可能会使用您没有的运行时库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM