Commit fca60677 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implemented LdrProcessRelocationBlock.

parent d2dd8f94
......@@ -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
*
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment