dbghelp: Read the Elf_auxv_t struct corresponding to the target's architecture.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bb53152faa
commit
51ada19ac2
|
@ -1522,7 +1522,6 @@ static BOOL elf_search_auxv(const struct process* pcs, unsigned type, unsigned l
|
|||
void* addr;
|
||||
void* str;
|
||||
void* str_max;
|
||||
Elf_auxv_t auxv;
|
||||
|
||||
si->SizeOfStruct = sizeof(*si);
|
||||
si->MaxNameLen = MAX_SYM_NAME;
|
||||
|
@ -1548,6 +1547,10 @@ static BOOL elf_search_auxv(const struct process* pcs, unsigned type, unsigned l
|
|||
while (addr < str_max && ReadProcessMemory(pcs->handle, addr, &str, sizeof(str), NULL) && str == NULL)
|
||||
addr = (void*)((DWORD_PTR)addr + sizeof(str));
|
||||
|
||||
if (pcs->is_64bit)
|
||||
{
|
||||
Elf64_auxv_t auxv;
|
||||
|
||||
while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && auxv.a_type != AT_NULL)
|
||||
{
|
||||
if (auxv.a_type == type)
|
||||
|
@ -1557,6 +1560,21 @@ static BOOL elf_search_auxv(const struct process* pcs, unsigned type, unsigned l
|
|||
}
|
||||
addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Elf32_auxv_t auxv;
|
||||
|
||||
while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && auxv.a_type != AT_NULL)
|
||||
{
|
||||
if (auxv.a_type == type)
|
||||
{
|
||||
*val = auxv.a_un.a_val;
|
||||
return TRUE;
|
||||
}
|
||||
addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,8 @@ typedef struct section macho_section;
|
|||
|
||||
#ifdef _WIN64
|
||||
#define Elf_Sym Elf64_Sym
|
||||
#define Elf_auxv_t Elf64_auxv_t
|
||||
#else
|
||||
#define Elf_Sym Elf32_Sym
|
||||
#define Elf_auxv_t Elf32_auxv_t
|
||||
#endif
|
||||
#else
|
||||
#ifndef SHT_NULL
|
||||
|
|
Loading…
Reference in New Issue