Don't fallback to linear search for exports, it's not needed.

svn path=/trunk/; revision=16963
This commit is contained in:
Filip Navara 2005-08-01 18:11:54 +00:00
parent 1dfc824d91
commit 2b6bb7a79e

View file

@ -1077,7 +1077,6 @@ LdrGetExportByName(PVOID BaseAddress,
PDWORD * ExFunctions;
PDWORD * ExNames;
USHORT * ExOrdinals;
ULONG i;
PVOID ExName;
ULONG Ordinal;
PVOID Function;
@ -1142,7 +1141,7 @@ LdrGetExportByName(PVOID BaseAddress,
}
/*
* Try a binary search first
* Binary search
*/
minn = 0;
maxn = ExportDir->NumberOfNames - 1;
@ -1188,31 +1187,6 @@ LdrGetExportByName(PVOID BaseAddress,
}
}
/*
* Fall back on a linear search
*/
DPRINT("LdrGetExportByName(): Falling back on a linear search of export table\n");
for (i = 0; i < ExportDir->NumberOfNames; i++)
{
ExName = RVA(BaseAddress, ExNames[i]);
if (strcmp(ExName, (PCHAR)SymbolName) == 0)
{
Ordinal = ExOrdinals[i];
Function = RVA(BaseAddress, ExFunctions[Ordinal]);
DPRINT("%x %x %x\n", Function, ExportDir, ExportDir + ExportDirSize);
if (((ULONG)Function >= (ULONG)ExportDir) &&
((ULONG)Function < (ULONG)ExportDir + (ULONG)ExportDirSize))
{
DPRINT("Forward: %s\n", (PCHAR)Function);
Function = LdrFixupForward((PCHAR)Function);
}
if (Function == NULL)
{
break;
}
return Function;
}
}
DPRINT1("LdrGetExportByName(): failed to find %s\n",SymbolName);
return (PVOID)NULL;
}