Eric Pouech : dbghelp: Store the 32/64 bitness in the image structure.
Alexandre Julliard
julliard at winehq.org
Tue Feb 14 13:23:31 CST 2012
Module: wine
Branch: master
Commit: 8328606141e6278063b93aabc84c2a97e12855c4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8328606141e6278063b93aabc84c2a97e12855c4
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Mon Feb 13 21:41:34 2012 +0100
dbghelp: Store the 32/64 bitness in the image structure.
---
dlls/dbghelp/elf_module.c | 1 +
dlls/dbghelp/image_private.h | 1 +
dlls/dbghelp/pe_module.c | 6 ++++++
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index e4c6e44..e18c9ef 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -324,6 +324,7 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
#else
if (fmap->u.elf.elfhdr.e_ident[EI_CLASS] != ELFCLASS32) goto done;
#endif
+ fmap->addr_size = fmap->u.elf.elfhdr.e_ident[EI_CLASS] == ELFCLASS64 ? 64 : 32;
fmap->u.elf.sect = HeapAlloc(GetProcessHeap(), 0,
fmap->u.elf.elfhdr.e_shnum * sizeof(fmap->u.elf.sect[0]));
if (!fmap->u.elf.sect) goto done;
diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index 2642f28..2afed79 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -74,6 +74,7 @@
struct image_file_map
{
enum module_type modtype;
+ unsigned addr_size; /* either 16 (not used), 32 or 64 */
union
{
struct elf_file_map
diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c
index 79a4d90..f43d971 100644
--- a/dlls/dbghelp/pe_module.c
+++ b/dlls/dbghelp/pe_module.c
@@ -224,6 +224,12 @@ static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_ty
if (!(nthdr = RtlImageNtHeader(mapping))) goto error;
memcpy(&fmap->u.pe.ntheader, nthdr, sizeof(fmap->u.pe.ntheader));
+ switch (nthdr->OptionalHeader.Magic)
+ {
+ case 0x10b: fmap->addr_size = 32; break;
+ case 0x20b: fmap->addr_size = 64; break;
+ default: return FALSE;
+ }
section = (IMAGE_SECTION_HEADER*)
((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader);
fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0,
More information about the wine-cvs
mailing list