Maarten Lankhorst : ntdll: Make the loader process relocations correctly for x86_64.
Alexandre Julliard
julliard at winehq.org
Fri Dec 26 12:35:21 CST 2008
Module: wine
Branch: master
Commit: 72423f5f6d8e0619ee4e3ad53fa2c2e5aceb2392
URL: http://source.winehq.org/git/wine.git/?a=commit;h=72423f5f6d8e0619ee4e3ad53fa2c2e5aceb2392
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Mon Dec 22 00:07:58 2008 +0100
ntdll: Make the loader process relocations correctly for x86_64.
---
dlls/ntdll/loader.c | 8 +++++++-
dlls/ntdll/virtual.c | 2 +-
include/winternl.h | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 968d7fd..aa103ac 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2101,7 +2101,7 @@ NTSTATUS WINAPI LdrAddRefDll( ULONG flags, HMODULE module )
* Apply relocations to a given page of a mapped PE image.
*/
IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count,
- USHORT *relocs, INT delta )
+ USHORT *relocs, INT_PTR delta )
{
while (count--)
{
@@ -2111,6 +2111,7 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count
{
case IMAGE_REL_BASED_ABSOLUTE:
break;
+#ifdef __i386__
case IMAGE_REL_BASED_HIGH:
*(short *)((char *)page + offset) += HIWORD(delta);
break;
@@ -2120,6 +2121,11 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count
case IMAGE_REL_BASED_HIGHLOW:
*(int *)((char *)page + offset) += delta;
break;
+#elif defined(__x86_64__)
+ case IMAGE_REL_BASED_DIR64:
+ *(INT_PTR *)((char *)page + offset) += delta;
+ break;
+#endif
default:
FIXME("Unknown/unsupported fixup type %x.\n", type);
return NULL;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index bda8be1..7801941 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -993,7 +993,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
struct stat st;
struct file_view *view = NULL;
char *ptr, *header_end;
- int delta = 0;
+ INT_PTR delta = 0;
/* zero-map the whole range */
diff --git a/include/winternl.h b/include/winternl.h
index d0180a5..ed93bbf 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1978,7 +1978,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);
+IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR);
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