Microsoft KB Archive/108448

From BetaArchive Wiki

Use LoadLibrary() on .EXE Files Only for Resources

ID: Q108448



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), included with:
    • Microsoft Windows NT, versions 3.1, 3.5



The LoadLibrary() application programming interface (API) can be used to load an executable module. A common use of this function is to load a dynamic-link library (DLL), perform a subsequent call to GetProcAddress() to get the address of an exported DLL routine, and call this DLL routine through the address that is returned. Another use of LoadLibrary() is to load an executable module and retrieve its resources.

In Windows NT, a LoadLibrary() of an .EXE file is supported only for the purposes of retrieving resources. It was decided that it was rather uncommon to load an .EXE for any other purpose, so this limitation was imposed on LoadLibrary() to improve the performance in loading resources. Calling a routine in an .EXE through an address obtained with GetProcAddress() can cause an access violation. Additional query words: 3.10 3.50

Keywords          : 
Version           : winnt:3.1,3.5
Platform          : winnt 
Issue type        : 

Last Reviewed: October 20, 1999
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.