Update ProcessAttachCalled flag

This commit is contained in:
Boring
2024-01-15 13:08:33 +08:00
parent 32dca6b715
commit 54cacf2bf7
2 changed files with 11 additions and 3 deletions
+10
View File
@@ -140,6 +140,16 @@ BOOL NTAPI LdrpCallInitializers(PMEMORYMODULE module, DWORD dwReason) {
// notify library about attaching to process
if (((PLDR_INIT_ROUTINE)(module->codeBase + headers->OptionalHeader.AddressOfEntryPoint))((HINSTANCE)module->codeBase, dwReason, 0)) {
module->initialized = TRUE;
if (dwReason == DLL_PROCESS_ATTACH) {
if (MmpGlobalDataPtr->WindowsVersion <= WINDOWS_VERSION::winBlue) {
PLDR_DATA_TABLE_ENTRY_WINBLUE(module->LdrEntry)->ProcessAttachCalled = TRUE;
}
else {
PLDR_DATA_TABLE_ENTRY(module->LdrEntry)->Flags |= LDRP_PROCESS_ATTACH_CALLED;
}
}
return TRUE;
}
SetLastError(ERROR_DLL_INIT_FAILED);