PRB: 16-Bit Resource Table Limitation Under Win32s

Last reviewed: May 16, 1996
Article ID: Q150617
The information in this article applies to:
  • Microsoft Win32s versions 1.30 and later

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 reference words: 1.30 win32s
KBCategory: kbprg kbhowto
KBSubcategory: APrgOther



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 16, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.