Knowledge Base

PRB: LoadLibrary API Fails With 31 (ERROR_GEN_FAILURE) Error

PSS ID Number: 200767

Article Last Modified on 5/12/2003


The information in this article applies to:


This article was previously published under Q200767

SYMPTOMS

The LoadLibrary() API call sometimes fails to map a specified dynamic link library (DLL) into the address space of the calling process. The function returns a value of NULL and GetLastError() reports an error of 31 (ERROR_GEN_FAILURE).

CAUSE

LoadLibrary() API fails with the ERROR_GEN_FAILURE error if one of the following occur:

  • If the operating system loader is not able to build the import address table successfully.
  • If the DLL being loaded implicitly imports a function that is not exported from a dependant DLL.
  • If the DLL does not have an MS-DOS MZ header or a Portable Executable (PE) header.
  • If the subsystem version contained in the DLL header is more than 4.00.

STATUS

This behavior is by design.

Additional query words: kbDSupport

Keywords: kbDLL kbFAQ kbKernBase kbprb KB200767
Technology: kbAudDeveloper kbOSWin95 kbOSWin98 kbOSWinME kbOSWinSearch kbWin32API kbWin32sSearch