Author: hpoussin
Date: Wed Dec 5 19:04:47 2007
New Revision: 31015
URL:
http://svn.reactos.org/svn/reactos?rev=31015&view=rev
Log:
Send correct data to MiDereferenceImports()
Modified:
trunk/reactos/ntoskrnl/mm/sysldr.c
Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c Wed Dec 5 19:04:47 2007
@@ -177,15 +177,23 @@
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 @@
TAG_LDR_WSTR);
if (LoadedImports)
{
- /* Zero it and set the count */
+ /* Zero it */
RtlZeroMemory(LoadedImports, LoadedImportsSize);
- LoadedImports->Count = ImportCount;
}
}
else
@@ -1006,8 +1013,8 @@
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 @@
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++;
}
}