From e3876e7f3caed5f710c74cd17725f4c2f979883f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 5 Dec 2007 16:04:47 +0000 Subject: [PATCH] Send correct data to MiDereferenceImports() svn path=/trunk/; revision=31015 --- reactos/ntoskrnl/mm/sysldr.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/reactos/ntoskrnl/mm/sysldr.c b/reactos/ntoskrnl/mm/sysldr.c index b79cd61add6..9f0432b2ee4 100644 --- a/reactos/ntoskrnl/mm/sysldr.c +++ b/reactos/ntoskrnl/mm/sysldr.c @@ -177,15 +177,23 @@ NTSTATUS NTAPI MiDereferenceImports(IN PLOAD_IMPORTS ImportList) { + SIZE_T i; + /* Check if there's no imports or if we're a boot driver */ - if ((ImportList == (PVOID)-1) || (ImportList == (PVOID)-2)) + if ((ImportList == (PVOID)-1) || + (ImportList == (PVOID)-2) || + (ImportList->Count == 0)) { /* Then there's nothing to do */ return STATUS_SUCCESS; } /* Otherwise, FIXME */ - DPRINT1("Imports not dereferenced!\n"); + DPRINT1("%u imports not dereferenced!\n", ImportList->Count); + for (i = 0; i < ImportList->Count; i++) + { + DPRINT1("%wZ <%wZ>\n", &ImportList->Entry[i]->FullDllName, &ImportList->Entry[i]->BaseDllName); + } return STATUS_UNSUCCESSFUL; } @@ -813,9 +821,8 @@ MiResolveImageReferences(IN PVOID ImageBase, TAG_LDR_WSTR); if (LoadedImports) { - /* Zero it and set the count */ + /* Zero it */ RtlZeroMemory(LoadedImports, LoadedImportsSize); - LoadedImports->Count = ImportCount; } } else @@ -1006,8 +1013,8 @@ CheckDllState: if (!(LdrEntry->Flags & LDRP_LOAD_IN_PROGRESS)) { /* Add the entry */ - LoadedImports->Entry[ImportCount] = LdrEntry; - ImportCount++; + LoadedImports->Entry[LoadedImports->Count] = LdrEntry; + LoadedImports->Count++; } } @@ -1104,17 +1111,17 @@ CheckDllState: if (NewImports) { /* Set count */ - NewImports->Count = ImportCount; + NewImports->Count = 0; /* Loop all the imports */ - for (i = 0, ImportCount = 0; i < LoadedImports->Count; i++) + for (i = 0; i < LoadedImports->Count; i++) { /* Make sure it's valid */ if (LoadedImports->Entry[i]) { /* Copy it */ - NewImports->Entry[i] = LoadedImports->Entry[i]; - ImportCount++; + NewImports->Entry[NewImports->Count] = LoadedImports->Entry[i]; + NewImports->Count++; } }