LhBarrierGetCallingModule causes access violation at program termination

Apr 2, 2011 at 1:00 AM

I'm successfully using the unmanaged EasyHook API, and its working perfectly.

In one of the functions I am hooking (ws2_32's send) I am using LhBarrierGetCallingModule() to determine if my own module is calling the function so that I know to handle that call differently.

This is also working perfectly ... until some time during the application's termination.


It appears that during the process termination send is getting called, no idea how, and at this point my call to LhBarrierGetCallingModule causes the access violation.

I've even tried adding LhUninstallAllHooks(); LhWaitForPendingRemovals(); to DLL_PROCESS_DETACH, and confirmed that it is running before the crash, but my hooked send function is still getting called, and it is still crashing.


Im not a very experienced c/c++ programmer, so I'm a lost as to where to go from here or why its even happening.

Anyone got any ideas?