PRB: LoadLibrary API Fails with 998 (ERROR_NOACCESS) Error

Article translations Article translations
Article ID: 196069 - View products that this article applies to.
This article was previously published under Q196069
Expand all | Collapse all

SYMPTOMS

The LoadLibrary() API may sometimes encounter an access violation while attempting to map a specified module into the address space of the calling process. In this event, LoadLibrary() returns a value of NULL and GetLastError() returns an error code of 998 (ERROR_NOACCESS).

CAUSE

The Windows NT status code STATUS_ACCESS_VIOLATION is mapped to the Win32 error code ERROR_NOACCESS. As a result, if the operating system loader encounters an access violation (exception C0000005) while mapping the specified DLL file image or executing the startup code, the loader will set the last error to 998 (ERROR_NOACCESS) and the LoadLibrary() function will fail with a return value of NULL.

MORE INFORMATION

When an access violation occurs anywhere in the startup code, the exception dispatcher detects whether the process that encountered this exception is being debugged. If so, this first chance exception is sent to the debugger.

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

For information on how to enable first chance exception handling for the C0000005 Access violation exception, please refer to the debugger documentation.

Properties

Article ID: 196069 - Last Review: November 21, 2006 - Revision: 4.1
APPLIES TO
  • Microsoft Win32 Application Programming Interface, when used with:
    • Microsoft Windows NT 4.0
    • Microsoft Windows 2000 Standard Edition
    • the operating system: Microsoft Windows XP
Keywords: 
kbdll kbkernbase kbprb KB196069

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com