Send correct data to MiDereferenceImports()

svn path=/trunk/; revision=31015
This commit is contained in:
Hervé Poussineau 2007-12-05 16:04:47 +00:00
parent 155a5c8344
commit e3876e7f3c

View file

@ -177,15 +177,23 @@ NTSTATUS
NTAPI NTAPI
MiDereferenceImports(IN PLOAD_IMPORTS ImportList) MiDereferenceImports(IN PLOAD_IMPORTS ImportList)
{ {
SIZE_T i;
/* Check if there's no imports or if we're a boot driver */ /* 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 */ /* Then there's nothing to do */
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/* Otherwise, FIXME */ /* 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; return STATUS_UNSUCCESSFUL;
} }
@ -813,9 +821,8 @@ MiResolveImageReferences(IN PVOID ImageBase,
TAG_LDR_WSTR); TAG_LDR_WSTR);
if (LoadedImports) if (LoadedImports)
{ {
/* Zero it and set the count */ /* Zero it */
RtlZeroMemory(LoadedImports, LoadedImportsSize); RtlZeroMemory(LoadedImports, LoadedImportsSize);
LoadedImports->Count = ImportCount;
} }
} }
else else
@ -1006,8 +1013,8 @@ CheckDllState:
if (!(LdrEntry->Flags & LDRP_LOAD_IN_PROGRESS)) if (!(LdrEntry->Flags & LDRP_LOAD_IN_PROGRESS))
{ {
/* Add the entry */ /* Add the entry */
LoadedImports->Entry[ImportCount] = LdrEntry; LoadedImports->Entry[LoadedImports->Count] = LdrEntry;
ImportCount++; LoadedImports->Count++;
} }
} }
@ -1104,17 +1111,17 @@ CheckDllState:
if (NewImports) if (NewImports)
{ {
/* Set count */ /* Set count */
NewImports->Count = ImportCount; NewImports->Count = 0;
/* Loop all the imports */ /* 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 */ /* Make sure it's valid */
if (LoadedImports->Entry[i]) if (LoadedImports->Entry[i])
{ {
/* Copy it */ /* Copy it */
NewImports->Entry[i] = LoadedImports->Entry[i]; NewImports->Entry[NewImports->Count] = LoadedImports->Entry[i];
ImportCount++; NewImports->Count++;
} }
} }