I'm very new to windows development specially in the field of driver creation. I want to create a driver that will be notified whenever another driver(s) (Any type of driver but preferably not device driver) has been unloaded. So far (I maybe mistaken) I haven't found any callback function that will allow me to implement that.
Here are my questions:
1.) There's a function that will allow me to detect driver load (PsSetLoadImageNotifyRoutine/Ex). Someone told me that maybe I could get the driver object of another driver and set my function in the driver unload from there but I haven't found any function to do that. Is there a function to directly get notification when a driver is being unloaded? If not, is there a function for getting the driver object?
2.) Since I haven't found any function for the first "way" of doing that. Now I am trying to accomplish this using "events". When I ran ".eventlog" in WinDbg, it showed the "Module unloaded" message. Now my question is, is there a way to listen to this event in a driver using C? I can only see tools being used to consume those events. If there is none, can I just read the ".eventlog" file and process it? If so, what should be the name of ".eventlog" file?