From 329c22f32392ccee09a35d688adbee5485d1bd58 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 23 Apr 2009 12:41:29 +0200 Subject: [PATCH] dbghelp: Add a few more 64-bit symbol functions. --- dlls/dbghelp/dbghelp.spec | 8 +++--- dlls/dbghelp/symbol.c | 57 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index d7c7faa2ef9..63a107c46e5 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -118,11 +118,11 @@ @ stdcall SymGetSymFromAddr(long long ptr ptr) @ stdcall SymGetSymFromAddr64(long double ptr ptr) @ stdcall SymGetSymFromName(long str ptr) -@ stub SymGetSymFromName64 +@ stdcall SymGetSymFromName64(long str ptr) @ stdcall SymGetSymNext(long ptr) -@ stub SymGetSymNext64 +@ stdcall SymGetSymNext64(long ptr) @ stdcall SymGetSymPrev(long ptr) -@ stub SymGetSymPrev64 +@ stdcall SymGetSymPrev64(long ptr) @ stub SymGetSymbolFile @ stub SymGetSymbolFileW @ stdcall SymGetTypeFromName(ptr double str ptr) @@ -180,7 +180,7 @@ # @ stub SymSetSymWithAddr64 no longer present ?? @ stub SymSetSymWithAddr64 @ stdcall SymUnDName(ptr str long) -@ stub SymUnDName64 +@ stdcall SymUnDName64(ptr str long) @ stdcall SymUnloadModule(long long) @ stdcall SymUnloadModule64(long double) @ stdcall UnDecorateSymbolName(str str long long) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index ce3b8420afe..3e70e85f4ae 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1349,6 +1349,28 @@ BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol) return FALSE; } +/*********************************************************************** + * SymGetSymFromName64 (DBGHELP.@) + */ +BOOL WINAPI SymGetSymFromName64(HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL64 Symbol) +{ + char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; + SYMBOL_INFO*si = (SYMBOL_INFO*)buffer; + size_t len; + + if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE; + si->SizeOfStruct = sizeof(*si); + si->MaxNameLen = MAX_SYM_NAME; + if (!SymFromName(hProcess, Name, si)) return FALSE; + + Symbol->Address = si->Address; + Symbol->Size = si->Size; + Symbol->Flags = si->Flags; + len = min(Symbol->MaxNameLength, si->MaxNameLen); + lstrcpynA(Symbol->Name, si->Name, len); + return TRUE; +} + /*********************************************************************** * SymGetSymFromName (DBGHELP.@) */ @@ -1407,9 +1429,9 @@ BOOL symt_fill_func_line_info(const struct module* module, const struct symt_fun } /*********************************************************************** - * SymGetSymNext (DBGHELP.@) + * SymGetSymNext64 (DBGHELP.@) */ -BOOL WINAPI SymGetSymNext(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol) +BOOL WINAPI SymGetSymNext64(HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol) { /* algo: * get module from Symbol.Address @@ -1422,10 +1444,29 @@ BOOL WINAPI SymGetSymNext(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol) return FALSE; } +/*********************************************************************** + * SymGetSymNext (DBGHELP.@) + */ +BOOL WINAPI SymGetSymNext(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol) +{ + FIXME("(%p, %p): stub\n", hProcess, Symbol); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * SymGetSymPrev64 (DBGHELP.@) + */ +BOOL WINAPI SymGetSymPrev64(HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol) +{ + FIXME("(%p, %p): stub\n", hProcess, Symbol); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + /*********************************************************************** * SymGetSymPrev (DBGHELP.@) */ - BOOL WINAPI SymGetSymPrev(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol) { FIXME("(%p, %p): stub\n", hProcess, Symbol); @@ -1685,7 +1726,15 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase) */ BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL sym, PSTR UnDecName, DWORD UnDecNameLength) { - TRACE("(%p %s %u)\n", sym, UnDecName, UnDecNameLength); + return UnDecorateSymbolName(sym->Name, UnDecName, UnDecNameLength, + UNDNAME_COMPLETE) != 0; +} + +/*********************************************************************** + * SymUnDName64 (DBGHELP.@) + */ +BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym, PSTR UnDecName, DWORD UnDecNameLength) +{ return UnDecorateSymbolName(sym->Name, UnDecName, UnDecNameLength, UNDNAME_COMPLETE) != 0; }