Author: gedmurphy
Date: Mon Jul 21 12:50:27 2008
New Revision: 34641
URL:
http://svn.reactos.org/svn/reactos?rev=34641&view=rev
Log:
Fix Rva handling code
Modified:
trunk/reactos/lib/rtl/image.c
Modified: trunk/reactos/lib/rtl/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/image.c?rev=34641&…
==============================================================================
--- trunk/reactos/lib/rtl/image.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/image.c [iso-8859-1] Mon Jul 21 12:50:27 2008
@@ -112,13 +112,13 @@
ULONG Count;
Count = SWAPW(NtHeader->FileHeader.NumberOfSections);
- Section = (PIMAGE_SECTION_HEADER)((ULONG)&NtHeader->OptionalHeader +
- SWAPW(NtHeader->FileHeader.SizeOfOptionalHeader));
- while (Count)
+ Section = IMAGE_FIRST_SECTION(NtHeader);
+
+ while (Count--)
{
Va = SWAPD(Section->VirtualAddress);
if ((Va <= Rva) &&
- (Rva < Va + SWAPD(Section->SizeOfRawData)))
+ (Rva < Va + SWAPD(Section->Misc.VirtualSize)))
return Section;
Section++;
}
@@ -145,7 +145,7 @@
if (Section == NULL ||
Rva < SWAPD(Section->VirtualAddress) ||
- Rva >= SWAPD(Section->VirtualAddress) + SWAPD(Section->SizeOfRawData))
+ Rva >= SWAPD(Section->VirtualAddress) + SWAPD(Section->Misc.VirtualSize))
{
Section = RtlImageRvaToSection (NtHeader, BaseAddress, Rva);
if (Section == NULL)