mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 05:01:03 +00:00
[WINESYNC] dbghelp: Support 32 and 64-bit binaries in ImageDirectoryEntryToDataEx.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id ab4c64a4093b98ca7a74ec29a9d947333791b26d by Piotr Caban <piotr@codeweavers.com>
This commit is contained in:
parent
b7d8c1b1c2
commit
e27e4dbaee
2 changed files with 19 additions and 5 deletions
|
@ -896,11 +896,25 @@ PVOID WINAPI ImageDirectoryEntryToDataEx( PVOID base, BOOLEAN image, USHORT dir,
|
|||
if (section) *section = NULL;
|
||||
|
||||
if (!(nt = RtlImageNtHeader( base ))) return NULL;
|
||||
if (dir >= nt->OptionalHeader.NumberOfRvaAndSizes) return NULL;
|
||||
if (!(addr = nt->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;
|
||||
if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
|
||||
{
|
||||
const IMAGE_NT_HEADERS64 *nt64 = (const IMAGE_NT_HEADERS64 *)nt;
|
||||
|
||||
*size = nt->OptionalHeader.DataDirectory[dir].Size;
|
||||
if (image || addr < nt->OptionalHeader.SizeOfHeaders) return (char *)base + addr;
|
||||
if (dir >= nt64->OptionalHeader.NumberOfRvaAndSizes) return NULL;
|
||||
if (!(addr = nt64->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;
|
||||
*size = nt64->OptionalHeader.DataDirectory[dir].Size;
|
||||
if (image || addr < nt64->OptionalHeader.SizeOfHeaders) return (char *)base + addr;
|
||||
}
|
||||
else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
const IMAGE_NT_HEADERS32 *nt32 = (const IMAGE_NT_HEADERS32 *)nt;
|
||||
|
||||
if (dir >= nt32->OptionalHeader.NumberOfRvaAndSizes) return NULL;
|
||||
if (!(addr = nt32->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;
|
||||
*size = nt32->OptionalHeader.DataDirectory[dir].Size;
|
||||
if (image || addr < nt32->OptionalHeader.SizeOfHeaders) return (char *)base + addr;
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
return RtlImageRvaToVa( nt, base, addr, section );
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@ files:
|
|||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
|
||||
tags:
|
||||
wine: 8000b5415d2c249176bda3d8b49f8fc9978e1623
|
||||
wine: ab4c64a4093b98ca7a74ec29a9d947333791b26d
|
||||
|
|
Loading…
Reference in a new issue