What does Windows error code 1285 (ERROR_DELAY_LOAD_FAILED) mean?

 
Previous Next
ERROR_DEBUGGER_INACTIVE ERROR_VDM_DISALLOWED

ERROR_DELAY_LOAD_FAILED

Meaning and context of ERROR_DELAY_LOAD_FAILED

The Visual C++ linker now supports the delayed loading of DLLs. This relieves you of the need to use the Windows SDK functions LoadLibrary and GetProcAddress to implement DLL delayed loading.

Before Visual C++ 6.0, the only way to load a DLL at run time was by using LoadLibrary and GetProcAddress; the operating system would load the DLL when the executable or DLL using it was loaded.

Beginning with Visual C++ 6.0, when statically linking with a DLL, the linker provides options to delay load the DLL until the program calls a function in that DLL.

An application can delay load a DLL using the /DELAYLOAD (Delay Load Import) linker option with a helper function (default implementation provided by Visual C++). The helper function will load the DLL at run time by calling LoadLibrary and GetProcAddress for you.

You should consider delay loading a DLL if:

  • Your program may not call a function in the DLL.

The delayed loading of a DLL can be specified during the build of either a.EXE or.DLL project. A.DLL project that delays the loading of one or more DLLs should not itself call a delay-loaded entry point in Dllmain.

Bound imports means that in PE-import table store fixed (bound) addresses of import functions for a specific version of DLL with those function. Bound addresses are calculated and written to import table by linker during program compilation and linking phase.

Delay load and ERROR_DELAY_LOAD_FAILED (1285) error

Delayed imports means that in import table instead of import functions addresses contains addresses of a special program part called "delay load helper" (sometimes is called also "thunk"), which substitutes real imported function address when the function is called for the first time. And subsequent function calls use real function address written by delay load helper.

Where the result is returned

This result is Win32 system error 1285 (0x00000505) from winerror.h. AllStat describes it as “An attempt to delay-load a.dll or get a function address in a delay-loaded.dll failed.”. The code is useful only together with the API that failed, because multiple Windows components can reuse system-error values while imposing different retry and cleanup rules.

Diagnostic sequence

  • Call GetLastError immediately after the failing API and save this result, the function name, all relevant flags, and the target path, handle, service, device, account, or policy object.
  • Capture the component log that owns the delay / load operation and retain the original numeric value before a framework converts it to an HRESULT or exception.
  • compare preconditions with the API documentation and reproduce with a minimal request before changing system-wide configuration.

Retry this result only after the resource or state named in “An attempt to delay-load a.dll or get a function address in a delay-loaded.dll failed.” has changed. For invalid parameters, unsupported formats, missing objects, policy restrictions, and access failures, correct the input or configuration instead of immediately repeating the same call.

Official references


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