A forum for reverse engineering, OS internals and malware analysis 

Forum for discussion about kernel-mode development.
 #23596  by p4r4n0id
 Tue Aug 12, 2014 6:56 am
Hi Guys,

Are you familiar with a notify routine for image unload? if not, what r my options?

Thx
p4r4n0id
 #23613  by Brock
 Thu Aug 14, 2014 4:59 am
I'm not aware of any documented kernel callback for when a DLL is unloaded. However, in ring3 I would use the documented LdrRegisterDllNotification (LDR_DLL_NOTIFICATION_REASON_UNLOADED) - main downfall is it's only supported from Vista/Win2k8+ and only affects the calling process, not system-wide solution out of the box.
 #23781  by p4r4n0id
 Thu Sep 04, 2014 6:28 pm
Hi Guys,

Thanks for ur replies but I need it in KM.

@EP_X0FF - need it to track loaded and unloaded modules in kernel space. don't want to enumerate every time. hook on zwunmapviewofsection will not help me cause of x64....

Any ideas?
 #23785  by EP_X0FF
 Fri Sep 05, 2014 6:06 am
p4r4n0id wrote:Hi Guys,

Thanks for ur replies but I need it in KM.

@EP_X0FF - need it to track loaded and unloaded modules in kernel space. don't want to enumerate every time. hook on zwunmapviewofsection will not help me cause of x64....

Any ideas?
Inject your monitoring dlls and inform your driver from LdrRegisterDllNotification handler.
 #23787  by EP_X0FF
 Fri Sep 05, 2014 7:32 am
p4r4n0id wrote:Getting notificatins from UM is an option but I want from KM only :)
Since Ldr is all about user mode implementation, just using Nt* services for i/o and memory I don't think you can find more simple and stable ways.