Fix LdrAccessResource for ordinary mapped files.
Modified: trunk/reactos/ntoskrnl/ldr/resource.c
_____
Modified: trunk/reactos/ntoskrnl/ldr/resource.c
--- trunk/reactos/ntoskrnl/ldr/resource.c 2005-08-01 08:56:51 UTC
(rev 16934)
+++ trunk/reactos/ntoskrnl/ldr/resource.c 2005-08-01 08:58:15 UTC
(rev 16935)
@@ -43,10 +43,10 @@
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].V
irtualAddress;
Section = RtlImageRvaToSection (NtHeader, BaseAddress,
NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].V
irtualAddress);
if (Section == NULL)
@@ -64,7 +64,7 @@
if (Resource)
{
- *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset +
(ULONG)BaseAddress);
+ *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset +
((ULONG_PTR)BaseAddress & ~1));
}
if (Size)