ntdll: Implemented LdrProcessRelocationBlock.

This commit is contained in:
Alexandre Julliard 2008-04-02 20:38:51 +02:00
parent d2dd8f94db
commit fca6067748
3 changed files with 37 additions and 1 deletions

View File

@ -2035,6 +2035,41 @@ NTSTATUS WINAPI LdrAddRefDll( ULONG flags, HMODULE module )
}
/***********************************************************************
* LdrProcessRelocationBlock (NTDLL.@)
*
* Apply relocations to a given page of a mapped PE image.
*/
IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count,
USHORT *relocs, INT delta )
{
while (count--)
{
USHORT offset = *relocs & 0xfff;
int type = *relocs >> 12;
switch(type)
{
case IMAGE_REL_BASED_ABSOLUTE:
break;
case IMAGE_REL_BASED_HIGH:
*(short *)((char *)page + offset) += HIWORD(delta);
break;
case IMAGE_REL_BASED_LOW:
*(short *)((char *)page + offset) += LOWORD(delta);
break;
case IMAGE_REL_BASED_HIGHLOW:
*(int *)((char *)page + offset) += delta;
break;
default:
FIXME("Unknown/unsupported fixup type %x.\n", type);
return NULL;
}
relocs++;
}
return (IMAGE_BASE_RELOCATION *)relocs; /* return address of next block */
}
/******************************************************************
* LdrQueryProcessModuleInformation
*

View File

@ -72,7 +72,7 @@
@ stub LdrLoadAlternateResourceModule
@ stdcall LdrLoadDll(wstr long ptr ptr)
@ stdcall LdrLockLoaderLock(long ptr ptr)
@ stub LdrProcessRelocationBlock
@ stdcall LdrProcessRelocationBlock(ptr long ptr long)
@ stub LdrQueryImageFileExecutionOptions
@ stdcall LdrQueryProcessModuleInformation(ptr long ptr)
@ stub LdrSetAppCompatDllRedirectionCallback

View File

@ -1844,6 +1844,7 @@ NTSYSAPI NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, UL
NTSYSAPI void WINAPI LdrInitializeThunk(ULONG,ULONG,ULONG,ULONG);
NTSYSAPI NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
NTSYSAPI NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT);
NTSYSAPI NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
NTSYSAPI void WINAPI LdrShutdownProcess(void);
NTSYSAPI void WINAPI LdrShutdownThread(void);