#49 #52 add initialize/cleanup to achieve graceful shutdown

This commit is contained in:
Boring
2024-10-03 01:04:09 +08:00
parent 61a80f4ec9
commit 06968d8feb
15 changed files with 176 additions and 87 deletions
+11
View File
@@ -798,4 +798,15 @@ BOOL NTAPI MmpTlsInitialize() {
return TRUE;
}
VOID NTAPI MmpTlsCleanup() {
DetourTransactionBegin();
DetourUpdateThread(NtCurrentThread());
DetourDetach((PVOID*)&MmpGlobalDataPtr->MmpTls->Hooks.OriginLdrShutdownThread, HookLdrShutdownThread);
DetourDetach((PVOID*)&MmpGlobalDataPtr->MmpTls->Hooks.OriginNtSetInformationProcess, HookNtSetInformationProcess);
DetourDetach((PVOID*)&MmpGlobalDataPtr->MmpTls->Hooks.OriginRtlUserThreadStart, HookRtlUserThreadStart);
DetourTransactionCommit();
}
#endif