| |
You are here: Experts > Computing/Technology > Delphi Programming > Delphi > Extracting strings from *.exe written in Delphi
Delphi - Extracting strings from *.exe written in Delphi
Expert: Randy Sill - 10/28/2009
Question For any given Delphi written *.exe, how can I extract the string values compiled in the *.exe?
TIA
Answer I have in the past written a simple Delphi application that opens for read the exe file and scans for ASCII characters in the normal range with a minimum lenght and dumps them into a string list. A parameter can be placed on the application to determine what this minimum length is so you can filter out a lot of the junk that may appear.
Here is an example Scan:
procedure TForm1.Button1Click(Sender: TObject);
var
FileStream: TFileStream;
CharIn: char;
MinLen: integer;
CurrValue: string;
i: integer;
MaxPos: integer;
begin
MinLen := StrToInt(Edit2.Text);
CurrValue := '';
FileStream := TFileStream.Create(Edit1.Text, fmOpenRead);
try
MaxPos := FileStream.Size;
for i := 1 to MaxPos do begin
FileStream.Read(CharIn, 1);
if CharIn in [#32..#126] then
CurrValue := CurrValue + CharIn
else
if Length(CurrValue) >= MinLen then begin
Memo1.Lines.Add(CurrValue);
CurrValue := '';
end;
end;
finally
FileStream.Free;
end;
end;
Add to this Answer Ask a Question
|
|