Link to home
Start Free TrialLog in
Avatar of ashben
ashben

asked on

DFM from DCU file

I'm dying here!  My hard disk became corrupted and I've lost some important delphi code.  Some of my program units have working .PAS files but stuffed .DFM files.  Is there any way of regenerating the .DFM file from the .DCU compiled version?
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ashben
ashben

ASKER

Yes, I have the exe file, so any help getting forms would be appreciated (at the moment I'm creating objects on the forms using the names from the .PAS files but I obviously can't identify the rest of the property values :(
ill give you this but note ,it is only to be used on your own software  not other persons as it is illegal if used on someone else's.

you can get back all the form and its contents and all resourses and the units come back like:

{*****************************************************************************}
{*      -> Multi Ripper 2.60 <-       The Multi-Purpose File Extractor       *}
{******** To have the last release send an email to baccan@isanet.it *********}
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, StdCtrls, Buttons, ExtCtrls, CommCtrl;

type
  TForm1 = class(TForm)
    DGCScreen1: TDGCScreen;
    DGCImageLib1: TDGCImageLib;
    DGCSpriteMgr1: TDGCSpriteMgr;
    DGCSoundLib1: TDGCSoundLib;
    DGCAudio1: TDGCAudio;
    procedure DGCSpriteMgr1SpriteDirChange(Sender: TObject);
    procedure DGCScreen1CleanUp(Sender: TObject);
    procedure DGCScreen1Initialize(Sender: TObject);
    procedure DGCScreen1Flip(Sender: TObject);
    procedure FormKeyPress(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.DGCSpriteMgr1SpriteDirChange(Sender: TObject);
begin
  { Address xxxxxx }
end;

procedure TForm1.DGCScreen1CleanUp(Sender: TObject);
begin
  { Address xxxxxx }
end;

procedure TForm1.DGCScreen1Initialize(Sender: TObject);
begin
  { Address xxxxxx }
end;

procedure TForm1.DGCScreen1Flip(Sender: TObject);
begin
  { Address xxxxxx }
end;

procedure TForm1.FormKeyPress(Sender: TObject);
begin
  { Address xxxxxx }
end;

end.

and you get a directory full of icons etc and the pas, dpr, dfm files etc..

see:
http://www.csee.uq.edu.au/~csmweb/decompilation/mrip260.zip 

another:
http://www.ems.ru/~gold/exe2dpr.html 
 
ps..really only use on your own exe's or you may face prison or something ;-)
these where found using www.yahoo.com and are totally nothing to do with me

most importantly for you the forms come back fully,only the coede from pas files isnt filled in..
hope it a help
Regards Barry
Avatar of ashben

ASKER

You have just saved me several days' work!  Thanks Barry :)

And don't worry, I'll use this program for good, not evil!  It's probably a good thing it only produces DFM files actually, otherwise I don't think I'd feel safe distributing Delphi programs any more!!!
bit worrying isnt it but our code will remain safe for a long while yet ,this is one of the good things about dcu format ,no one know how to uncode ;-)

good luck
Avatar of ashben

ASKER

Quick update - i've managed to recover all my DFM files (7 of them) - now I just need to reprogram 1 PAS file (fortunately a simple one) and my work is done :)

One note about the MRip program - I had to do a bit of hex editing of the DFM headers before Delphi would recognise them (maybe this is because I'm using Delphi 5? or maybe because I used the shareware version of the ripper, and it was only supposed to correctly rip 3 forms?)

Cheers
good ;-)
yes there is some shareware thing if i remeber right..