Solved

Resource file

Posted on 1997-06-01
20
365 Views
Last Modified: 2012-05-04
Can anybody tell me the excact format of the resource file Delphi 2.0 uses?
0
Comment
Question by:djernaes
  • 10
  • 6
  • 2
  • +2
20 Comments
 
LVL 1

Expert Comment

by:ozzy
ID: 1336713
I'm not sure what you exactly mean.  However, if you go to 'Tools' and run image editor, then you can load, create, or delete a resource file from there.  Select file-New Resource File, or Icon, or Image.  You can add icons to one, or add bitmaps from there.

0
 

Author Comment

by:djernaes
ID: 1336714
I mean the format ogf the .RES file, which is included in your Delphi programs.

I know it is a header + resource entry's, but how do I code/decode the file to bitmaps, icons, strings, rc_data... etc.?
0
 

Author Comment

by:djernaes
ID: 1336715
When asking for a format of a file, I do not expect to be told how to start a program which can read the file.

Martin
0
 
LVL 1

Expert Comment

by:Gabor
ID: 1336716
There is a utility called Convert.exe.If you use it on a .dfm file, you get a readable .txt file.The .dfm files are stored as resources, and you can access them as by its name.All other resources are the same as in any other windows application.
0
 

Author Comment

by:djernaes
ID: 1336717
Sorry,

Header? Format? Body? etc

Martin
0
 
LVL 1

Expert Comment

by:Gabor
ID: 1336718
I tried to help you, not to get your points. I think you can figure it out if you see it's contents. I can see it for you, but it's worth more than 100 points.Gabor
0
 

Author Comment

by:djernaes
ID: 1336719
? Sorry Gabor,

I have increased the amount of points - What do you want for the answer to the question?

Martin
0
 

Author Comment

by:djernaes
ID: 1336720
? Sorry Gabor,

I have increased the amount of points - What do you want for the answer to the question?

Martin
0
 

Expert Comment

by:gfk081397
ID: 1336721
I understand you are really interested in the format. It might however help you to have a look at the TResourceStream class if you haven't done so ages ago. It gives access to all resources in a EXE or DLL file.

The Res file format and the corresponding Res sections in Exe's/Dll's are of course Microsoft's tech.

Try ftp.microsoft.com\SOFTLIB\MSLFILES\EXEVIEW.EXE. (c-source code for the "old" Win3.x format) if it is still there.

Microsoft Press have books on the RESOURCE format. It is extensive.....
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1336722
This isn't much, but it can help.

Look at this site : http://www.wotsit.demon.co.uk/

It's a file format collection site. I don't believe that they have the format of RESOURCE file but if it isn't urgent you can ask them. You can give a request there and maybe they help you with it.
I believe I've once saw it in a book myself, but that's a long time ago. But I'll run over the books I've got. If I find something I'll let you know.

Well, good luck, hope you are something with this, I thought I could help you this way.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Expert Comment

by:ZifNab
ID: 1336723
Well, look at the BMP format on this site http://www.wotsit.demon.co.uk, it's a text-file with formats of resource files. It's a little bit too big, otherwise I had posted it here.

Hope you're something with it.

Have fun,
c.u. ZifNab
0
 

Author Comment

by:djernaes
ID: 1336724
Thanks
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1336725
Found what you were looking for?

Have fun,
c.u. BanZif;
0
 

Author Comment

by:djernaes
ID: 1336726
Looks like, thangs again :-)
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1336727
Hi djernaes,

Why didn't you deleted this question? Haven't got the answer yet?
Maybe this is :

By Ray Lischner, Tempest Software

A Windows resource file (.RES) contains a series of packed resource entries, with no other structure, that is no headers, footers, padding, etc. The format of a resource entry is different for Windows 3.x (16-bit) and Win32, that is, Windows 95 and Windows NT (32-bit).

32-bit

A 32-bit .RES file starts with an empty resource entry of 32 bytes:

00000000 20000000 FFFF0000 FFFF0000 00000000 00000000 00000000 00000000

After that comes the real resource entries, packed into the file with no padding or other structure--just a series of resource entries.

Each resource entry has a header followed immediately by the resource data. Immediately after the data for one entry comes the header for the next entry. Each header has the following format:

Field/Size (bytes)/ Description

Data Size/4/Size of the resource data that follow the header
Header Size/4/Size of the resource header (always at least 16)
Type/variable/{Resource type }
Name/variable/Resource name or identifier
Data Version/4/Version number for resource data format, usually 0
Flags/2/Most flags are for backward compability with Win16. Discardable (100016) is the only Win32 flag.
Language/2/Primary and secondary language identifiers. Zero for language-neutral, or look up your Windows documentation for a full list of identifiers. Form a language identifier from a primary and sublanguage as follows: (sublanguage << 10 | primary).
Version/4/Version number for the resource entry
Characteristics/4/Anything you want

The type and name can be numeric or textual. If the first two bytes are FFFF16, the subsequent two bytes are the numeric value. Otherwise, the first two bytes are the first Unicode character in a zero-terminated string.

16-bit

Each resource entry has a header followed immediately by the resource data. Immediately after the data for one entry comes the header for the next entry. Each header has the following format:

Field/Size/Description

Type/variable/Resource type
Name/variable/Resource name or identifier
Flags/2/Discardable=100016, Moveable=001016, Pure=002016, Preload=004016
Size/4/Size of the resource data that immediately follow the header

The type and name can be numeric or textual. If the first byte is FF16, the subsequent two bytes are the numeric value. Otherwise, the first byte is the first character of the ANSI string.

Resource types

Windows reserves numeric resource types under 256 for its own use. In this range are several predefined resource types:

Type/Value/Description

RT_CURSOR/1/Cursor image (one entry in a cursor group)
RT_BITMAP/2/Bitmap (Windows or OS/2 BMP format)
RT_ICON/3/Icon image (one entry in an icon group)
RT_MENU/4/Menu
RT_DIALOG/5/Dialog box
RT_STRING/6/String table (must have numeric identifier, not textual)
RT_FONTDIR/7/Font directory
RT_FONT/8/Font entry
RT_ACCELERATOR/9/Keyboard accelerator table
RT_RCDATA/10/Application-defined data
RT_GROUP_CURSOR/12/Group header for a cursor
RT_GROUP_ICON/14/Group header for an icon

Win32 defines additional resource types:

Type/Value/Description

RT_MESSAGETABLE/11/Message table
RT_VERSION/16/Version information
RT_DLGINCLUDE/17/Dialog include
RT_PLUGPLAY/19/Plug and play
RT_VXD/20/VxD
RT_ANICURSOR/21/Animated cursor

If you want an htm version of this text, I can send it to you.
You can also get it from the Wotsit's file format collection site. It came from there.

Have fun,
c.u. ZifNab;

0
 

Author Comment

by:djernaes
ID: 1336728
I can not delete a question (or how do I delete a question)

I have got an answer as you can se from the comments, so I don't quite know if it's fair giving you the points !

Martin
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1336729
Hi djernaes,

Don't need the points, just wanted to help you,
because I thought you still hadn't a clear solution. I already gave you a comment (BMP format, see above) and I thought that this was a solution (not so clear solution) for you. But now I founded a clear format about the RES-files. So to be sure you read this comment I made an answer of it.
Don't care if you reject this, i'm glad you found a solution.

Have fun,
c.u. ZifNab;

0
 

Author Comment

by:djernaes
ID: 1336730
Hi ZifNab,

First sorry if my comment offended you, that was not my intension. I just have the idea at the person who actually gave me the information ourght to get the points :) What I didn't see (and not looked after) was that the one actually were you.

Thanks for the ekstra comments about the fileformat, I'll store it for later use, while I don't have time using at the moment (but that have to come later).

Regards & thanks
  Martin
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1336731
No problem, glad I could help you.
And I'm more hapier knowing I've helped someone than earning points for it, but 10x for the points.

c.u.
ZifNab
0
 

Author Comment

by:djernaes
ID: 1336732
Hi ZiNab,

You are welcome - my pleasure.

Martin
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now