The loader hook allows the library and procedure loading and deleting calls to be intercepted. The following code shows the syntax for a loader hook function:

BOOL EXPENTRY LoaderHook(HAB   hab,
                         LONG  idContext,
                         PSZ   pszLibname,
                         PHLIB hlib,
                         PSZ   pszProcname,
                         PFNWP wndProc);

If the hook attempts a load or deletion which is unsuccessful, then the hook must establish the relevant error information.

The hab parameter is the anchor block handle.

The idContext parameter is the origin of the call to the hook: