From e18c5c1218c29b48cb59db18e47d1013f0ecf2f5 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Mon, 1 Aug 2005 08:58:15 +0000 Subject: [PATCH] Fix LdrAccessResource for ordinary mapped files. svn path=/trunk/; revision=16935 --- reactos/ntoskrnl/ldr/resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/ldr/resource.c b/reactos/ntoskrnl/ldr/resource.c index a4444f6ea67..34c82019d7b 100644 --- a/reactos/ntoskrnl/ldr/resource.c +++ b/reactos/ntoskrnl/ldr/resource.c @@ -43,10 +43,10 @@ LdrAccessResource(IN PVOID BaseAddress, if (Data == 0) return STATUS_RESOURCE_DATA_NOT_FOUND; - if ((ULONG)BaseAddress & 1) + if ((ULONG_PTR)BaseAddress & 1) { /* loaded as ordinary file */ - NtHeader = RtlImageNtHeader((PVOID)((ULONG)BaseAddress & ~1UL)); + NtHeader = RtlImageNtHeader((PVOID)((ULONG_PTR)BaseAddress & ~1)); Offset = (ULONG)BaseAddress - Data + NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress; Section = RtlImageRvaToSection (NtHeader, BaseAddress, NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress); if (Section == NULL) @@ -64,7 +64,7 @@ LdrAccessResource(IN PVOID BaseAddress, if (Resource) { - *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + (ULONG)BaseAddress); + *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + ((ULONG_PTR)BaseAddress & ~1)); } if (Size)