PRB: 16-Bit Resource Table Limitation Under Win32s

ID: Q150617


The information in this article applies to:


SYMPTOMS

When a 32-bit application is initialized or a DLL file is loaded, Win32s dynamically creates a 16-bit resource table. Because some of the 32-bit functions that handle resources, such as LoadIcon and LoadMenu, are thunked to the 16-bit side, Windows 3.1 uses this table to handle the resources. This table contains information on all the 32-bit resources that have been converted to the 16-bit form for use by Windows.


CAUSE

There is a limitation in Windows 3.1 that the 16-bit resource table created by Win32s cannot exceed 32K. If this 16-bit table limit is exceeded, the debug version of Win32s generates the following assertion failure when the application is initialized.


   "OFFSETOF(pResWrite) < 0xfffc"   or   "OFFSETOF(pResWrite) < 0xfffe" 


WORKAROUND

A workaround is to split the resources to more than one module.


STATUS

This behavior is by design.


MORE INFORMATION



Note that the limitation discussed in this article is the size of the 16- bit resource table created by Win32s and not the size of the resource data section. In Win32s version 1.15a and earlier, there is a limitation on the resource data section to be less than 64K, but that limit is eliminated in Win32s versions 1.20 and later.

The size of the resource data section is determined by using the DUMPBIN tool on the 32-bit side. The following line appears:

xxxx .rsrc

where xxxx is the size of the resource data section. However, this does not provide any information on the 16-bit resource table described earlier.

The resource table size can be calculated as follows (in bytes):


      2 + (N1 * 8) + (N2 * 16) + N3 + N4

   N1 = Number of resource types (icon, menu, etc.)
   N2 = Number of resources (all resource types)
   N3 = Sum of the lengths of all string IDs (including resource types
                                              that have string IDs)
   N4 = Number of string IDs 


The result of the calculation should be less than 32K. If a resource is specified in several languages, count it only once in N2.

Additional query words: 1.30 win32s


Keywords          : 
Version           : 1.30    | 1.30
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: March 10, 1999