void LhCriticalFinalize() { /* Description: Will be called in the DLL_PROCESS_DETACH event and just uninstalls all hooks. If it is possible also their memory is released. */ LhUninstallAllHooks(); LhWaitForPendingRemovals(); RtlDeleteLock(&GlobalHookLock); }
void LhBarrierProcessDetach() { /* Description: Will be called on DLL unload. */ ULONG Index; #ifdef DRIVER PsRemoveCreateThreadNotifyRoutine(OnThreadDetach); #endif RtlDeleteLock(&Unit.TLS.ThreadSafe); // release thread specific resources for(Index = 0; Index < MAX_THREAD_COUNT; Index++) { if(Unit.TLS.Entries[Index].Entries != NULL) RtlFreeMemory(Unit.TLS.Entries[Index].Entries); } RtlZeroMemory(&Unit, sizeof(Unit)); }