Index: ntoskrnl/include/internal/ps.h =================================================================== --- ntoskrnl/include/internal/ps.h (revision 73516) +++ ntoskrnl/include/internal/ps.h (working copy) @@ -442,7 +442,7 @@ extern EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY]; extern EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]; extern PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine; -extern ULONG PspThreadNotifyRoutineCount, PspProcessNotifyRoutineCount; +extern ULONG PspThreadNotifyRoutineCount, PspProcessNotifyRoutineCount, PspLoadImageNotifyRoutineCount; extern BOOLEAN PsImageNotifyEnabled; extern PKWIN32_PROCESS_CALLOUT PspW32ProcessCallout; extern PKWIN32_THREAD_CALLOUT PspW32ThreadCallout; Index: ntoskrnl/include/internal/ps_x.h =================================================================== --- ntoskrnl/include/internal/ps_x.h (revision 73516) +++ ntoskrnl/include/internal/ps_x.h (working copy) @@ -87,15 +87,20 @@ { ULONG i; - /* Loop the notify routines */ - for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; ++ i) + /* Check if we have registered load image notify routines */ + if (PspLoadImageNotifyRoutineCount) { - /* Do the callback */ - ExDoCallBack(&PspLoadImageNotifyRoutine[i], - FullImageName, - ProcessId, - ImageInfo); + /* Loop the notify routines */ + for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; i++) + { + /* Do the callback */ + ExDoCallBack(&PspLoadImageNotifyRoutine[i], + FullImageName, + ProcessId, + ImageInfo); + } } + } FORCEINLINE