How can I hook DllMain ?
I'm playing around with VLD which is inline patching LdrLoadDll in order to hook to dynamic library functions that allocate memory, in order to detect memory leaks.
At this point the dll has not been loaded yet so I dont have a module handle to setup library hooks. Also setting up hooks after the original LdrLoadDll is called means that DllMain has already been called, which might allocate some memory that is not recorded by the leak detector.
My question is, where is the best place to setup the hooks just before the call to DllMain, in order to be able to record memory allocations within DllMain?
|