You are currently offline, waiting for your internet to reconnect

PRB: LoadLibrary API Fails with 998 (ERROR_NOACCESS) Error

This article was previously published under Q196069
SYMPTOMS
The LoadLibrary() API may sometimes encounter an access violation whileattempting to map a specified module into the address space of the callingprocess. In this event, LoadLibrary() returns a value of NULL andGetLastError() returns an error code of 998 (ERROR_NOACCESS).
CAUSE
The Windows NT status code STATUS_ACCESS_VIOLATION is mapped to the Win32error code ERROR_NOACCESS. As a result, if the operating system loaderencounters an access violation (exception C0000005) while mapping thespecified DLL file image or executing the startup code, the loader will setthe last error to 998 (ERROR_NOACCESS) and the LoadLibrary() function willfail with a return value of NULL.
MORE INFORMATION
When an access violation occurs anywhere in the startup code, the exceptiondispatcher detects whether the process that encountered this exception isbeing debugged. If so, this first chance exception is sent to the debugger.

To troubleshoot the LoadLibrary() failure, run the application under adebugger and enable first chance exception handling for the C0000005 AccessViolation exception. If an access violation occurs when the LoadLibrary()function is called, the application will break into the debugger. Thedebugger's call stack can then be used to trace where the exceptionoccurred. The stack trace should help you narrow down the actual problemrelated to the exception being encountered.

For information on how to enable first chance exception handling for theC0000005 Access violation exception, please refer to the debuggerdocumentation.
LoadLibrary 998 ERROR_NOACCESS
Properties

Article ID: 196069 - Last Review: 11/21/2006 15:40:00 - Revision: 4.1

  • Microsoft Win32 Application Programming Interface
  • kbdll kbkernbase kbprb KB196069
Feedback