dbghelp: Implemented SymFromAddrW.

This commit is contained in:
Eric Pouech 2006-05-10 21:35:22 +02:00 committed by Alexandre Julliard
parent d2d85a1b46
commit 7d4194f57b
3 changed files with 72 additions and 1 deletions

View File

@ -56,7 +56,7 @@
@ stdcall SymFindFileInPath(long str str ptr long long long ptr ptr ptr)
@ stub SymFindFileInPathW
@ stdcall SymFromAddr(ptr double ptr ptr)
@ stub SymFromAddrW
@ stdcall SymFromAddrW(ptr double ptr ptr)
@ stub SymFromIndex
@ stub SymFromIndexW
@ stdcall SymFromName(long str ptr)

View File

@ -36,6 +36,7 @@
#include "wine/debug.h"
#include "dbghelp_private.h"
#include "winnls.h"
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
@ -762,6 +763,31 @@ static BOOL symt_enum_locals(struct process* pcs, const char* mask,
return EnumSymbolsCallback(sym_info, sym_info->Size, UserContext);
}
/******************************************************************
* copy_symbolW
*
* Helper for transforming an ANSI symbol info into an UNICODE one.
* Assume that MaxNameLen is the same for both version (A & W).
*/
static void copy_symbolW(SYMBOL_INFOW* siw, const SYMBOL_INFO* si)
{
siw->SizeOfStruct = si->SizeOfStruct;
siw->TypeIndex = si->TypeIndex;
siw->Reserved[0] = si->Reserved[0];
siw->Reserved[1] = si->Reserved[1];
siw->Index = si->info; /* FIXME: see dbghelp.h */
siw->Size = si->Size;
siw->ModBase = si->ModBase;
siw->Flags = si->Flags;
siw->Value = si->Value;
siw->Address = si->Address;
siw->Register = si->Register;
siw->Scope = si->Scope;
siw->Tag = si->Tag;
siw->NameLen = si->NameLen;
siw->MaxNameLen = si->MaxNameLen;
MultiByteToWideChar(CP_ACP, 0, si->Name, -1, siw->Name, siw->MaxNameLen);
}
/******************************************************************
* SymEnumSymbols (DBGHELP.@)
*
@ -900,6 +926,31 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
return TRUE;
}
/******************************************************************
* SymFromAddrW (DBGHELP.@)
*
*/
BOOL WINAPI SymFromAddrW(HANDLE hProcess, DWORD64 Address,
DWORD64* Displacement, PSYMBOL_INFOW Symbol)
{
PSYMBOL_INFO si;
unsigned len;
BOOL ret;
len = sizeof(*si) + Symbol->MaxNameLen * sizeof(WCHAR);
si = HeapAlloc(GetProcessHeap(), 0, len);
if (!si) return FALSE;
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = Symbol->MaxNameLen;
if ((ret = SymFromAddr(hProcess, Address, Displacement, si)))
{
copy_symbolW(Symbol, si);
}
HeapFree(GetProcessHeap(), 0, si);
return ret;
}
/******************************************************************
* SymGetSymFromAddr (DBGHELP.@)
*

View File

@ -817,6 +817,25 @@ typedef struct _SYMBOL_INFO
CHAR Name[1];
} SYMBOL_INFO, *PSYMBOL_INFO;
typedef struct _SYMBOL_INFOW
{
ULONG SizeOfStruct;
ULONG TypeIndex;
ULONG64 Reserved[2];
ULONG Index;
ULONG Size;
ULONG64 ModBase;
ULONG Flags;
ULONG64 Value;
ULONG64 Address;
ULONG Register;
ULONG Scope;
ULONG Tag;
ULONG NameLen;
ULONG MaxNameLen;
WCHAR Name[1];
} SYMBOL_INFOW, *PSYMBOL_INFOW;
typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
{
TI_GET_SYMTAG,
@ -881,6 +900,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PV
typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
BOOL WINAPI SymFromAddrW(HANDLE, DWORD64, DWORD64*, SYMBOL_INFOW*);
BOOL WINAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);