Microsoft KB Archive/200767

{|
 * width="100%"|

INFO: LoadLibrary API Fails With 31 (ERROR_GEN_FAILURE) Error

 * }

Q200767

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows 95
 * Microsoft Windows 98

-

SUMMARY
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).

MORE INFORMATION
LoadLibrary API fails with the ERROR_GEN_FAILURE error if the operating system loader is not able to build the import address table successfully. This error occurs if the DLL being loaded implicitly imports a function that is not exported from a dependant DLL.

The LoadLibrary API also fails with the ERROR_GEN_FAILURE error if the DLL does not have an MS-DOS MZ header or a Portable Executable (PE) header. The same error also occurs if the subsystem version contained in the DLL header is more than 4.00

Additional query words: kbDSupport

Keywords : kbDLL kbKernBase kbFAQ

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API