Hello - I'm trying to include 4k of binary data into my
masm32 executable. Maybe I'm not doing it right?

declaration in resource file:

program fragment:
szText ResType, "BINARY"
invoke FindResource, hInst, JISFONT, ADDR ResType
invoke LoadResource, hInst, eax
mov hRSrc, eax
invoke LockResource, hRSrc
mov WCharBMP.bmBits, eax

In the last line I assume that eax has the address of the
resource in memory. WCharBMP is a bitmap structure that has been previously setup correctly (tested).

Can anyone spot the error? I'm a bit at a loss here...
Posted on 2001-08-12 06:00:21 by michaelm
I am not at 100% sure, but I think you should use RAWDATA in your resource file. Only that is imported As Is. BINARY is not!
Posted on 2001-08-12 06:11:30 by sch.jnn
try the type RCDATA in your resource file...

Posted on 2001-08-12 09:20:28 by NOP-erator
If your not too sure how to use RCDATA, I have posted a discusion of how to use it to decompress binary data stored in RCDATA to disk. (Using Jeremy Collake's MASM
compression libraries)

Its a short discussion, read it over if you think it will help... your purpose is a bit different, but the method of using RCDATA isnt.

NaN's Web Site

Hope it helps...

Posted on 2001-08-12 10:16:43 by NaN

try the type RCDATA in your resource file...


Thanks to all who replied! It works when using RCDATA as the resource type. RAWDATA for some reason didn't do it. Thanks a lot NaN for the pointer to your site!

Can someone make a comment on the difference between RCDATA, BINARY and RAWDATA?
Posted on 2001-08-12 10:33:16 by MichaelM
I was about to let this one slide untill the question popped into my head "what the hell is RAWDATA anyways?".

So i decided to hit the MSDN... no luck on the topic.. only a switch for DUMPBIN.exe....

Then i consulted your code posted at the top, and looked up FindResource in my API reference (found on my web-page in the help group..) While is says what your doing is ok.. (i think ~ the lack of extension in vga8x16 got me wondering...), I suggests common resouce types "RT_*" to use instead of your string "binary".

Out of all the predefined types to choose from, nowhere is the type RAWDATA. There is a RT_RCDATA which is defined to be "raw data" there is no "RT_RAWDATA".

Im starting to think its not an actual type... As well, you mentioned it was to store a bitmap image, so i sould point out there is a RT_BITMAP type..

Im currious where you got the idea to use RAWDATA from?

Posted on 2001-08-12 21:01:41 by NaN
I am sorry for that RAWDATA "bug". It came from another RC compiler. The right one is:


Specifies raw data consisting of one or more integers or strings of characters. Integers can be specified in decimal, octal, or hexadecimal format. RC does not automatically append a terminating null character to a string. The string is a sequence of the specified ANSI (byte) characters unless explicitly qualified as a wide-character string with the L prefix. Strings in all resources other than RCDATA and user-defined resources are Unicode strings.
The block of data begins on a DWORD boundary and RC performs no padding or alignment of data within the raw-data block. It is the programmer's responsibility to ensure the proper alignment of data within the block.


The following example demonstrates the use of the RCDATA statement:

resname RCDATA
L"Here is a Unicode string\0", /* A Unicode string. Note: explicitly
null-terminated */
1024, /* int */
0x029a, /* hex int */
0o733, /* octal int */
"\07" /* octal byte */
Posted on 2001-08-14 14:13:01 by sch.jnn