2

I understand that this may seem like a really obvious question, but bear with me.

I have this compiled game executable written in Borland Delphi 2010, it is based on the Win32 platform and is compiled in x86. It uses Windows Forms for the UI.

I searched heavily and used Resource Hacker and IDR to go through the program. Both seemed to detect all Windows Forms really well (IDR a little bit better) and I am able to view the raw structures here:

enter image description here

enter image description here

There are two types of definition in here: Picture.Data & Bitmap. It seems that both are slightly different formats although they are still Bitmaps.

Here is an example form with Bitmap (form_menu): https://pastebin.com/raw/r81sJRyq

Here is an example form with Picture.Data (form_submenu): https://gist.githubusercontent.com/sjain882/d33e261480d0f13c442ffb4b84d1d1ed/raw/0d188b2ed1673757e512236672c6b0c458ea74d1/form_submenu.txt

Scroll down to the Bitmap or Picture.Data area. Here there is an ASCII representation of the image in hex. It turns out Delphi has its own custom image headers, and this differs between Bitmap and Picture.Data (the latter being 07 54 42 69 74 6D 61 70).

However, this is the header for the whole thing, which is a bunch of bitmaps clumped together it seems, in one {} bracketed area. The bitmaps themselves have the normal headers of 42 4D.

So... given all this information, I opened the assembly in IDA Pro and searched for these headers, many different types, different lengths. But all I found was this:

enter image description here

Given whats right after this "header" i believe its just some string, highly doubt its an actual bitmap.

So, this makes me think that the Windows Forms have their own encoding somewhere, instead of just storing raw bitmaps.

Is there a good way of replacing these? I would be really grateful for any ideas. I came across How can one replace bitmap (image) inside exe?, but nothing much came of it...

It would also be brilliant if I could change the entire windows forms (like dimensions of boxes etc) and the image formats, to allow for transparancy / alpha!

Thanks in advance!

1
  • 1
    Delphi uses a complete own way to generate forms. The easiest way would be to get yourself a Delphi version and create a mini app that contains a Bitmap element on a Form . In the form designer load the desired image into the Bitmap element and save the project. AFAIR the resources of the form will be saved in the same format as used in the EXE, so you can decode it and extract the Bitmap blob of the image you want to use.
    – Robert
    Jun 24 at 15:08
2

Delphi used not “Windows Forms” (a .Net framework) but a custom UI framework called VCL (Visual Component Library). The forms use a format called DFM and there exist editors that can extract and edit them, for example DFM Editor.

If you want to edit them manually, you can find out how the forms are serialized in the VCL sources (IIRC streams.pas). The bitmap data is probably stored as raw pixels, without any headers (metadata like width/height is provided by the form description) which is why you don’t find the signature.

2
  • Thanks for the corrections & extra info. Just tried out DFM Editor and its brilliant. For the serialisation of the forms, I was wondering where I could find the Visual Component Library sources? I had a good look on GitHub, google and other sites. I'm assuming this is something within the RAD Editor?
    – sjain668
    Jun 29 at 9:19
  • 1
    @sjain668 VCL source is shipped with the full versions of Delphi/C++ Builder. It's not "open source" but "source available to customers".
    – Igor Skochinsky
    Jun 29 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.