Commit 7d4194f5 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Implemented SymFromAddrW.

parent d2d85a1b
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
@ stdcall SymFindFileInPath(long str str ptr long long long ptr ptr ptr) @ stdcall SymFindFileInPath(long str str ptr long long long ptr ptr ptr)
@ stub SymFindFileInPathW @ stub SymFindFileInPathW
@ stdcall SymFromAddr(ptr double ptr ptr) @ stdcall SymFromAddr(ptr double ptr ptr)
@ stub SymFromAddrW @ stdcall SymFromAddrW(ptr double ptr ptr)
@ stub SymFromIndex @ stub SymFromIndex
@ stub SymFromIndexW @ stub SymFromIndexW
@ stdcall SymFromName(long str ptr) @ stdcall SymFromName(long str ptr)
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "dbghelp_private.h" #include "dbghelp_private.h"
#include "winnls.h"
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt); WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
...@@ -763,6 +764,31 @@ static BOOL symt_enum_locals(struct process* pcs, const char* mask, ...@@ -763,6 +764,31 @@ static BOOL symt_enum_locals(struct process* pcs, const char* mask,
} }
/****************************************************************** /******************************************************************
* 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.@) * SymEnumSymbols (DBGHELP.@)
* *
* cases BaseOfDll = 0 * cases BaseOfDll = 0
...@@ -901,6 +927,31 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, ...@@ -901,6 +927,31 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
} }
/****************************************************************** /******************************************************************
* 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.@) * SymGetSymFromAddr (DBGHELP.@)
* *
*/ */
......
...@@ -817,6 +817,25 @@ typedef struct _SYMBOL_INFO ...@@ -817,6 +817,25 @@ typedef struct _SYMBOL_INFO
CHAR Name[1]; CHAR Name[1];
} SYMBOL_INFO, *PSYMBOL_INFO; } 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 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
{ {
TI_GET_SYMTAG, TI_GET_SYMTAG,
...@@ -881,6 +900,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PV ...@@ -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); typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*); 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 SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO); BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL); BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
......
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