Alexandre Julliard : ntdll: Implemented LdrProcessRelocationBlock.
Alexandre Julliard
julliard at winehq.org
Wed Apr 2 16:36:29 CDT 2008
Module: wine
Branch: master
Commit: fca606774864794ddc29745f076a8b2d55c1da48
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fca606774864794ddc29745f076a8b2d55c1da48
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Apr 2 20:38:51 2008 +0200
ntdll: Implemented LdrProcessRelocationBlock.
---
dlls/ntdll/loader.c | 35 +++++++++++++++++++++++++++++++++++
dlls/ntdll/ntdll.spec | 2 +-
include/winternl.h | 1 +
3 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1091c32..b0000b8 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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
*
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 2d27d61..23ee968 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -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
diff --git a/include/winternl.h b/include/winternl.h
index eafbbed..39339c2 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -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);
More information about the wine-cvs
mailing list