Continuing the highly-sporadic series of Win32 resource formats, today we’ll look at the format of RT_DATA
resources, which are declared in resource files as RCDATA
. Also the format of custom resources, which are declared in resource files by just giving the custom resource name or ordinal as the second word on the declaration.
The format is very simple: It’s just raw binary data. If you ask for a 16-bit integer followed by an ANSI string, then you get a 16-bit integer followed by an ANSI string.
If you ask for the data to be inserted from a file, then the contents of the file become the resource data. No processing is done on the data. You get what you get.
In particular (and this is what catches some people), if your file is a text file, the resource compiler will just treat your text file as binary data and dump it raw into the resources. It doesn’t know that it’s a text file; it’s just a file. This means that if you want a null terminator at the end of your text file, you need to put a null terminator at the end of the text file. Nobody’s going to magically do it for you.
(The SizeOfResource
function may come in handy here.)
0 comments