mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
Use import hint if present
svn path=/trunk/; revision=1608
This commit is contained in:
parent
ae14d5ffc6
commit
c93d52a405
|
@ -1,4 +1,4 @@
|
|||
/* $Id: utils.c,v 1.37 2001/02/06 02:03:35 dwelch Exp $
|
||||
/* $Id: utils.c,v 1.38 2001/02/06 05:50:50 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -638,8 +638,7 @@ LdrGetExportByOrdinal (
|
|||
*
|
||||
*/
|
||||
static PVOID
|
||||
LdrGetExportByName (PVOID BaseAddress,
|
||||
PUCHAR SymbolName)
|
||||
LdrGetExportByName (PVOID BaseAddress, PUCHAR SymbolName, WORD Hint)
|
||||
{
|
||||
PIMAGE_EXPORT_DIRECTORY ExportDir;
|
||||
PDWORD * ExFunctions;
|
||||
|
@ -665,6 +664,19 @@ LdrGetExportByName (PVOID BaseAddress,
|
|||
ExportDir->AddressOfNameOrdinals);
|
||||
ExFunctions = (PDWORD *)RVA(BaseAddress,
|
||||
ExportDir->AddressOfFunctions);
|
||||
|
||||
/*
|
||||
* Check the hint first
|
||||
*/
|
||||
if (Hint < ExportDir->NumberOfFunctions)
|
||||
{
|
||||
ExName = RVA(BaseAddress, ExNames[Hint]);
|
||||
if (strcmp(ExName, SymbolName) == 0)
|
||||
{
|
||||
Ordinal = ExOrdinals[Hint];
|
||||
return(RVA(BaseAddress, ExFunctions[Ordinal]));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Try a binary search first
|
||||
|
@ -867,7 +879,7 @@ static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders,
|
|||
PULONG FunctionNameList;
|
||||
UNICODE_STRING DllName;
|
||||
DWORD pName;
|
||||
PWORD pHint;
|
||||
WORD pHint;
|
||||
|
||||
DPRINT("ImportModule->Directory->dwRVAModuleName %s\n",
|
||||
(PCHAR)(ImageBase + ImportModuleDirectory->dwRVAModuleName));
|
||||
|
@ -911,10 +923,9 @@ static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders,
|
|||
}
|
||||
else
|
||||
{
|
||||
FunctionNameList = (PULONG) (
|
||||
ImageBase
|
||||
+ ImportModuleDirectory->dwRVAFunctionAddressList
|
||||
);
|
||||
FunctionNameList =
|
||||
(PULONG)(ImageBase
|
||||
+ ImportModuleDirectory->dwRVAFunctionAddressList);
|
||||
}
|
||||
/*
|
||||
* Walk through function list and fixup addresses.
|
||||
|
@ -930,17 +941,11 @@ static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders,
|
|||
}
|
||||
else
|
||||
{
|
||||
pName = (DWORD) (
|
||||
ImageBase
|
||||
+ *FunctionNameList
|
||||
+ 2);
|
||||
pHint = (PWORD) (
|
||||
ImageBase
|
||||
+ *FunctionNameList);
|
||||
pName = (DWORD) (ImageBase + *FunctionNameList + 2);
|
||||
pHint = *(PWORD)(ImageBase + *FunctionNameList);
|
||||
|
||||
*ImportAddressList =
|
||||
LdrGetExportByName(BaseAddress,
|
||||
(PUCHAR) pName);
|
||||
*ImportAddressList =
|
||||
LdrGetExportByName(BaseAddress, (PUCHAR)pName, pHint);
|
||||
if ((*ImportAddressList) == NULL)
|
||||
{
|
||||
DbgPrint("Failed to import %s\n", pName);
|
||||
|
|
|
@ -216,13 +216,12 @@ exception_handler(struct trap_frame* tf)
|
|||
|
||||
DbgPrint("stack<%p>: ", stack);
|
||||
|
||||
for (i = 0; i < 16; i = i + 4)
|
||||
for (i = 0; i < 18; i = i + 6)
|
||||
{
|
||||
DbgPrint("%.8x %.8x %.8x %.8x\n",
|
||||
stack[i],
|
||||
stack[i+1],
|
||||
stack[i+2],
|
||||
stack[i+3]);
|
||||
stack[i], stack[i+1],
|
||||
stack[i+2], stack[i+3],
|
||||
stack[i+4], stack[i+5]);
|
||||
}
|
||||
DbgPrint("Frames:\n");
|
||||
for (i = 0; i < 32; i++)
|
||||
|
@ -249,7 +248,7 @@ exception_handler(struct trap_frame* tf)
|
|||
if (MmIsPagePresent(NULL,&stack[i]))
|
||||
{
|
||||
DbgPrint("%.8x ",stack[i]);
|
||||
if (((i+1)%4) == 0)
|
||||
if (((i+1)%8) == 0)
|
||||
{
|
||||
DbgPrint("\n");
|
||||
}
|
||||
|
@ -258,7 +257,7 @@ exception_handler(struct trap_frame* tf)
|
|||
|
||||
if (MmIsPagePresent(NULL, (PVOID)tf->eip))
|
||||
{
|
||||
char instrs[512];
|
||||
unsigned char instrs[512];
|
||||
|
||||
memcpy(instrs, (PVOID)tf->eip, 512);
|
||||
|
||||
|
|
Loading…
Reference in a new issue