#ifndef _NTLDR_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
// begin_msdn:"DLL Load Notification"
typedef LDR_DLL_NOTIFICATION_FUNCTION* PLDR_DLL_NOTIFICATION_FUNCTION;
View code on GitHubVOID CALLBACK LdrDllNotification(
_In_ ULONG NotificationReason,
_In_ PCLDR_DLL_NOTIFICATION_DATA NotificationData,
_In_opt_ PVOID Context
);
View the official Win32 development documentationNo description available.
[This function may be changed or removed from Windows without further notice.]
A notification callback function specified with the LdrRegisterDllNotification function. The loader calls this function when a DLL is first loaded.
[!WARNING] It is unsafe for the notification callback to call functions in ANY other module other than itself.
NotificationReason [in]
The reason that the notification callback function was called. This parameter can be one of the following values.
| Value | Meaning |
|---|---|
| LDR_DLL_NOTIFICATION_REASON_LOADED 1 |
The DLL was loaded. The NotificationData parameter points to an LDR_DLL_LOADED_NOTIFICATION_DATA structure. |
| LDR_DLL_NOTIFICATION_REASON_UNLOADED 2 |
The DLL was unloaded. The NotificationData parameter points to an LDR_DLL_UNLOADED_NOTIFICATION_DATA structure. |
NotificationData [in]
A pointer to a constant LDR_DLL_NOTIFICATION union that contains notification data. This union has the following definition:
typedef union _LDR_DLL_NOTIFICATION_DATA {
LDR_DLL_LOADED_NOTIFICATION_DATA Loaded;
LDR_DLL_UNLOADED_NOTIFICATION_DATA Unloaded;
} LDR_DLL_NOTIFICATION_DATA, *PLDR_DLL_NOTIFICATION_DATA;
The LDR_DLL_LOADED_NOTIFICATION_DATA structure has the following definition:
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA {
ULONG Flags; //Reserved.
PCUNICODE_STRING FullDllName; //The full path name of the DLL module.
PCUNICODE_STRING BaseDllName; //The base file name of the DLL module.
PVOID DllBase; //A pointer to the base address for the DLL in memory.
ULONG SizeOfImage; //The size of the DLL image, in bytes.
} LDR_DLL_LOADED_NOTIFICATION_DATA, *PLDR_DLL_LOADED_NOTIFICATION_DATA;
The LDR_DLL_UNLOADED_NOTIFICATION_DATA structure has the following definition:
typedef struct _LDR_DLL_UNLOADED_NOTIFICATION_DATA {
ULONG Flags; //Reserved.
PCUNICODE_STRING FullDllName; //The full path name of the DLL module.
PCUNICODE_STRING BaseDllName; //The base file name of the DLL module.
PVOID DllBase; //A pointer to the base address for the DLL in memory.
ULONG SizeOfImage; //The size of the DLL image, in bytes.
} LDR_DLL_UNLOADED_NOTIFICATION_DATA, *PLDR_DLL_UNLOADED_NOTIFICATION_DATA;
Context [in, optional]
A pointer to context data for the callback function.
This callback function does not return a value.
The notification callback function is called before dynamic linking takes place.
| Requirement | Value |
|---|---|
| Minimum supported client |
Windows Vista [desktop apps only] |
| Minimum supported server |
Windows Server 2008 [desktop apps only] |