INFO: LoadLibrary API Fails With 31 (ERROR_GEN_FAILURE) Error

ID: Q200767


The information in this article applies to:


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 
Version           : winnt:
Platform          : winnt 
Issue type        : kbinfo 

Last Reviewed: April 14, 1999