#ifndef _NTLDR_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
// begin_msdn:"DLL Load Notification"
#if (PHNT_VERSION >= PHNT_WINDOWS_VISTA)
/**
* Registers for notification when a DLL is first loaded. This notification occurs before dynamic linking takes place.
*
* @param Flags This parameter must be zero.
* @param NotificationFunction A pointer to an LdrDllNotification notification callback function to call when the DLL is loaded.
* @param Context A pointer to context data for the callback function.
* @param Cookie A pointer to a variable to receive an identifier for the callback function. This identifier is used to unregister the notification callback function.
* @return NTSTATUS Successful or errant status.
* @remarks https://learn.microsoft.com/en-us/windows/win32/devnotes/ldrregisterdllnotification
*/
NTSYSAPI
NTSTATUS
NTAPI
LdrRegisterDllNotification(
_In_ ULONG Flags,
_In_ PLDR_DLL_NOTIFICATION_FUNCTION NotificationFunction,
_In_opt_ PVOID Context,
_Out_ PVOID *Cookie
);
View code on GitHub
This function is documented in Windows SDK.