Commit 83286061 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Store the 32/64 bitness in the image structure.

parent b3ab012a
...@@ -324,6 +324,7 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map* ...@@ -324,6 +324,7 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
#else #else
if (fmap->u.elf.elfhdr.e_ident[EI_CLASS] != ELFCLASS32) goto done; if (fmap->u.elf.elfhdr.e_ident[EI_CLASS] != ELFCLASS32) goto done;
#endif #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.sect = HeapAlloc(GetProcessHeap(), 0,
fmap->u.elf.elfhdr.e_shnum * sizeof(fmap->u.elf.sect[0])); fmap->u.elf.elfhdr.e_shnum * sizeof(fmap->u.elf.sect[0]));
if (!fmap->u.elf.sect) goto done; if (!fmap->u.elf.sect) goto done;
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
struct image_file_map struct image_file_map
{ {
enum module_type modtype; enum module_type modtype;
unsigned addr_size; /* either 16 (not used), 32 or 64 */
union union
{ {
struct elf_file_map struct elf_file_map
......
...@@ -224,6 +224,12 @@ static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_ty ...@@ -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; if (!(nthdr = RtlImageNtHeader(mapping))) goto error;
memcpy(&fmap->u.pe.ntheader, nthdr, sizeof(fmap->u.pe.ntheader)); 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*) section = (IMAGE_SECTION_HEADER*)
((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader); ((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader);
fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0, fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment