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:
LHK_DELETEPROC
The pszLibname parameter is the library name.
The hlib parameter is a pointer to a library handle.
If the idContext parameter parameter is set to LHK_LOADLIB, then this hook must set the value of this parameter to the handle of the loaded library or to NULLHANDLE if the load fails.
The pszProcname parameter is the procedure name.
The wndProc parameter is the window procedure identifier.
If the idContext parameter is set LHK_LOADPROC, then this hook must set the value of this parameter to the handle of the loaded procedure or to NULL if the load fails.
The pfSuccess parameter is the success indicator, which is either TRUE or FALSE. If it is TRUE, the library or procedure loaded or deleted successfully. If it is FALSE, the library or procedure not loaded or deleted successfully.
When this function returns TRUE, it does not call the next hook in chain. When this function returns FALSE, then it does call the next hook in chain.