DBGHELP: Implement SymGetSymFromAddr64

Thomas Weidenmueller wine-patches at reactsoft.com
Fri May 26 13:44:32 CDT 2006


The attached patch implements SymGetSymFromAddr64, called by steam.

- Thomas

-- 
P.S.: Please let me know if there's something wrong with this patch or
tell me why it was rejected. Otherwise I'm going to assume the fixes
aren't appreciated or necessary because the implementation is considered
mature and stable.
-------------- next part --------------
Index: dlls/dbghelp/dbghelp.spec
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/dbghelp.spec,v
retrieving revision 1.34
diff -u -r1.34 dbghelp.spec
--- dlls/dbghelp/dbghelp.spec	11 May 2006 10:58:05 -0000	1.34
+++ dlls/dbghelp/dbghelp.spec	26 May 2006 18:29:55 -0000
@@ -99,7 +99,7 @@
 @ stub SymGetSourceVarFromToken
 @ stub SymGetSourceVarFromTokenW
 @ stdcall SymGetSymFromAddr(long long ptr ptr)
-@ stub SymGetSymFromAddr64
+@ stdcall SymGetSymFromAddr64(long double ptr ptr)
 @ stdcall SymGetSymFromName(long str ptr)
 @ stub SymGetSymFromName64
 @ stdcall SymGetSymNext(long ptr)
Index: dlls/dbghelp/symbol.c
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/symbol.c,v
retrieving revision 1.42
diff -u -r1.42 symbol.c
--- dlls/dbghelp/symbol.c	23 May 2006 12:47:47 -0000	1.42
+++ dlls/dbghelp/symbol.c	26 May 2006 18:33:20 -0000
@@ -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;
 }
 
@@ -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))
+        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)
 {


More information about the wine-patches mailing list