Thomas Weidenmueller wrote:
The attached patch implements SymGetSymFromAddr64, called by steam.
a couple of coments:
@@ -996,7 +996,8 @@ sym = pair.effective->addr_sorttab[idx];
symt_fill_sym_info(&pair, &sym->symt, Symbol); - *Displacement = Address - Symbol->Address; + if (Displacement) + *Displacement = Address - Symbol->Address; return TRUE; }
why do you need this ?
@@ -1053,6 +1054,31 @@ return TRUE; }
+/****************************************************************** + * SymGetSymFromAddr (DBGHELP.@) + * + */ +BOOL WINAPI SymGetSymFromAddr64(HANDLE hProcess, DWORD64 Address, + PDWORD64 Displacement, 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 (!SymFromAddr(hProcess, Address, &Displacement, si))
- you should test that Address can be casted down to a 32 bit entity (see other functions for how to do it) - &Displacement looks pretty wrong: you need a local 32 bit dword, pass its address, and then convert the local 32 bit value into the 64 bit pointer (Displacement)
+ 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; +} + static BOOL find_name(struct process* pcs, struct module* module, const char* name, SYMBOL_INFO* symbol) {
------------------------------------------------------------------------