DosGetResource returns the address of the specified resource object.
Resource objects are read-only data objects that can be accessed dynamically at run time. The access key is two 32-bit numbers. The first number is a type ID; the second, a name ID. These are similar to the file extension and file-name portions of a file name.
Resource objects are placed into an executable file by the Resource Compiler (RC.EXE).
If a STRINGTABLE or MESSAGETABLE resource is specified in an RC file, with a number of IDs and respective strings, these RT_STRING or RT_MESSAGE string resources are bundled together in groups of 16. Any missing IDs are replaced with zero length strings. Each group, or bundle, of RT_STRING or RT_MESSAGE resources is assigned a unique sequential ID. The resource string ID is not necessarily the same as the ID specified when using DosGetResource. The formula for calculating the ID of the resource bundle, for use in DosGetResource, is as follows:
bundle ID = ( id / 16) +1where id is the string ID assigned in the RC file.
Thus, bundle 1 contains strings 0 to 15, bundle 2 contains strings 16 to 31, and so on. Once the address of the bundle has been returned by DosGetResource (using the calculated ID), the buffer can be parsed to locate the particular string within the bundle. The number of the string is calculated by the formula:
string = id % 16(string = remainder for id/16).
The buffer returned consists of the CodePage of the strings in the first USHORT, followed by the 16 strings in the bundle. The first BYTE of each string is the length of the string (including the null terminator), followed by the string and the terminator. A zero length string is represented by two bytes: 01 (string length) followed by the null terminator.