Raw data resource types (a) taking data from a file

With these resources the Resource Compiler merely takes raw data from an input file and adds it to the output file (sometimes with some extra processing). Hence the data from these files makes its way to the EXE, when the file is linked, for use during run-time. This is a convenient way to keep the data from such files in the EXE. An alternative would be to ship the individual files with the product for loading at run-time, but this runs the risk that those files may get lost.

The data (as raw data) can be used at run-time by calling the FindResource and LoadResource APIs, but there are some specific APIs which also provide manipulation of the data. The various raw data resource types which work using files, their resource type numbers, and the specific API (if any) to load them during run-time are:-

CURSOR 1 LoadCursor or LoadImage
BITMAP 2 LoadBitmap or LoadImage
ICON 3 LoadIcon or LoadImage
FONT 8 no longer in use
RCDATA 10
MESSAGETABLE 11 FormatMessage
PLUGPLAY 19
VXD 20
ANICURSOR 21
ANIICON 22
HTML 23
MANIFEST 24
User-defined resource

The User defined resource is a resource holding raw data only, which is of the type defined by the user. It can be defined by name, for example, MyRes, or by number, which can be any 16-bit number above 0FFh. The numbers 1 to 0FFh are reserved for the system defined resources.

The general syntax for these resource types in the resource script (using CURSOR as an example) is:-

nameID CURSOR filename

Where, in the normal case,

nameID can be either:-

a 16-bit number of value 1 to 7FFFh
an expression which evaluates to that number
a name (except for FONT)

A FONT resource cannot identified by name, so in the case of a FONT,

nameID can be either:-

a 16-bit number of value 1 to 7FFFh
an expression which evaluates to that number

filename can be either:- a quoted string
a non-quoted string
a string in less-than and greater-than characters
unless the file is in the current directory, the full path should be given Examples
2 CURSOR happy.cur
0x6666 BITMAP c:\bitmaps\happy.bmp
MyIcon ICON "happy.ico"
#define ID_MINE 22
ID_MINE ICON <happier.ico>
44h RCDATA happy.txt
ID_MINE RCDATA happier.txt
1 MANIFEST "YourApp.manifest"
788h MYRES happier.txt      ;(a user-defined resource)
MY_CAT WAVE sounds/cat.wav  ;(a user-defined resource)
788h 100h happier.txt       ;(a user-defined resource)

Raw data resource types (b) taking data from resource script

These resources allow you to insert raw data into the EXE via the binary resource file. The Resource Compiler makes no alteration to the raw data. Unless use is being made of the ability of the system to distinguish between resources of different languages, assembler programmers would probably not find much use for this as it is so simple to use the data segment to keep data..

The data (as raw data) can be used at run-time by calling the FindResource and LoadResource APIs.

This type of resource is RCDATA (type number 10) when used with BEGIN and END, and not with a filename. Alternatively you can choose any name for the resource in which case it works the same way as RCDATA except that the resource type has a name. This is called a user-defined resource. Alternatively you can also simply provide any 16 bit number above 0FFh for the resource type.

The syntax for RCDATA used in this way is:-
nameID RCDATA
[defining-statements]
BEGIN
raw-data
END

Or, in the case of a user-defined resource:-
nameID type
[defining-statements]
BEGIN
raw-data
END

Where,

nameID can be either:-

a 16-bit number of value 1 to 7FFFh
an expression which evaluates to that number
a name

defining-statements need not be present, but can be either:- a VERSION statement
a CHARACTERISTICS statement
a LANGUAGE statement

see below for details

type can be either:- a 16-bit number greater than 0FFh
an expression which evaluates to a 16-bit number greater than 255
a name in characters

raw-data can be either:- an ANSI quoted string
a Unicode quoted string starting L"
a numerical value stored as a word
a numerical value stored as a dword (ending in L)

Examples
0x3333 RCDATA
BEGIN "Hello world"
"Hello world (zero terminated)\0"
L"A Unicode version of the above\0"
0x9999  ;hex number stored as a word
END

MyRes RCDATA
BEGIN

1034  ;decimal number stored as a word END

MyRes MyResType
BEGIN

10456L  ;decimal number stored as a dword
1234L,56666L,99999L  ;decimal numbers stored as dwords
END

34h 100h
BEGIN

33hL,34hL,35hL,36hL  ;hex numbers stored as dwords
0x37L,0x38L,0x39L,0x40L  ;C-style hex numbers stored as dwords
END