https://git.reactos.org/?p=reactos.git;a=commitdiff;h=70880dd15f06e257234c9ef66e4826f9b8026834

commit 70880dd15f06e257234c9ef66e4826f9b8026834
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 16:13:16 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:42 2020 +0200

    [WINESYNC] dbghelp: Return a dos path from SymGetLineFromAddr.
    
    Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34687
    Signed-off-by: Alistair Leslie-Hughes <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 4aa7fbe0561e6a27f098a05a63c5a7d12397e678 by Alistair 
Leslie-Hughes <[email protected]>
---
 dll/win32/dbghelp/compat.h     | 17 ++++++++++-------
 dll/win32/dbghelp/symbol.c     | 14 +++++++++++++-
 sdk/tools/rsym/rsym.c          |  1 +
 sdk/tools/winesync/dbghelp.cfg |  2 +-
 4 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/dll/win32/dbghelp/compat.h b/dll/win32/dbghelp/compat.h
index e281347d0ee..b249fe1ef79 100644
--- a/dll/win32/dbghelp/compat.h
+++ b/dll/win32/dbghelp/compat.h
@@ -50,6 +50,8 @@ static __inline const char *debugstr_wn( const WCHAR *s, int 
n ) { return wine_d
 static __inline const char *debugstr_a( const char *s )  { return 
wine_dbgstr_an( s, -1 ); }
 static __inline const char *debugstr_w( const WCHAR *s ) { return 
wine_dbgstr_wn( s, -1 ); }
 static __inline const char *wine_dbgstr_w( const WCHAR *s ){return 
wine_dbgstr_wn( s, -1 );}
+/* This should never be called */
+#define wine_get_dos_file_name(__x) (assert(0), NULL)
 
 #if 0
 #define WARN(fmt, ...) fprintf(stderr, "WARN %s: " fmt, __FUNCTION__, 
##__VA_ARGS__)
@@ -829,6 +831,13 @@ typedef struct _IMAGEHLP_LINE64
     PCHAR                       FileName;
     DWORD64                     Address;
 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
+typedef enum
+{
+    SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
+    SYMOPT_EX_MAX,
+/* __WINESRC__ */
+    SYMOPT_EX_WINE_NATIVE_MODULES = 1000
+} IMAGEHLP_EXTENDED_OPTIONS;
 typedef struct _SRCCODEINFO
 {
     DWORD       SizeOfStruct;
@@ -859,6 +868,7 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
 BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64* 
Displacement, PSYMBOL_INFO Symbol);
 BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland, PCSTR 
srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user);
 DWORD WINAPI SymSetOptions(DWORD opts);
+BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value);
 BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD 
pdwDisplacement, PIMAGEHLP_LINE64 Line);
 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
 #define FindExecutableImageExW __FindExecutableImageExW
@@ -1296,13 +1306,6 @@ typedef struct API_VERSION
     USHORT  Revision;
     USHORT  Reserved;
 } API_VERSION, *LPAPI_VERSION;
-typedef enum
-{
-    SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
-    SYMOPT_EX_MAX,
-/* __WINESRC__ */
-    SYMOPT_EX_WINE_NATIVE_MODULES = 1000
-} IMAGEHLP_EXTENDED_OPTIONS;
 
 // cvconst.h
 /* symbols & types enumeration */
diff --git a/dll/win32/dbghelp/symbol.c b/dll/win32/dbghelp/symbol.c
index 8db6d403f0c..56cb673312b 100644
--- a/dll/win32/dbghelp/symbol.c
+++ b/dll/win32/dbghelp/symbol.c
@@ -1502,7 +1502,19 @@ BOOL symt_fill_func_line_info(const struct module* 
module, const struct symt_fun
         }
         if (found)
         {
-            line->FileName = (char*)source_get(module, dli->u.source_file);
+            if (dbghelp_opt_native)
+            {
+                /* Return native file paths when using winedbg */
+                line->FileName = (char*)source_get(module, dli->u.source_file);
+            }
+            else
+            {
+                WCHAR *dospath = wine_get_dos_file_name(source_get(module, 
dli->u.source_file));
+                DWORD len = WideCharToMultiByte(CP_ACP, 0, dospath, -1, NULL, 
0, NULL, NULL);
+                line->FileName = fetch_buffer(module->process, len);
+                WideCharToMultiByte(CP_ACP, 0, dospath, -1, line->FileName, 
len, NULL, NULL);
+                HeapFree( GetProcessHeap(), 0, dospath );
+            }
             return TRUE;
         }
     }
diff --git a/sdk/tools/rsym/rsym.c b/sdk/tools/rsym/rsym.c
index 9435c21a464..192d46cdf63 100644
--- a/sdk/tools/rsym/rsym.c
+++ b/sdk/tools/rsym/rsym.c
@@ -1357,6 +1357,7 @@ int main(int argc, char* argv[])
         // SYMOPT_LOAD_ANYTHING
         // SYMOPT_LOAD_LINES
         SymSetOptions(0x10000 | 0x800000 | 0x40 | 0x10);
+        SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, TRUE);
         SymInitialize(FileData, ".", 0);
 
         module_base = SymLoadModule(FileData, file, path1, path1, 0, FileSize) 
& 0xffffffff;
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index bc21b3b4ddf..a61233b26a1 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: 101820d01a1c776e4b6ff42e661ac3a1380f10c7
+  wine: 4aa7fbe0561e6a27f098a05a63c5a7d12397e678

Reply via email to