What does NTSTATUS 0xC0000251 (STATUS_BAD_DLL_ENTRYPOINT) mean?

 
Previous Next
STATUS_INSUFFICIENT_LOGON_INFO STATUS_BAD_SERVICE_ENTRYPOINT

STATUS_BAD_DLL_ENTRYPOINT

The DLL entry point uses an invalid ABI or calling convention

The loader calls a DLL entry point with the DllMain signature and platform calling convention. This status reports evidence that the callback did not preserve the stack as required, commonly because it was declared with the wrong prototype or calling convention, implemented in incompatible assembly, or invoked through a corrupted function pointer.

Continuing after stack imbalance can move the failure into unrelated code and make diagnostics misleading. The entry point also runs under loader-lock restrictions, so complex initialization, LoadLibrary calls, or thread synchronization can introduce additional problems even when the prototype is correct.

What to inspect

  • Compare the compiled entry-point symbol and declaration with BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID).
  • Inspect compiler architecture, calling-convention options, exports, and any hand-written assembly wrapper.
  • Break on process attach and verify the stack pointer before and after the callback returns.
  • Keep DllMain minimal and move dependency loading or blocking work to explicit initialization outside loader lock.

References


Looking for a different code? Search another status or error code.