https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58e2e22449927df874dc27e5f156eb4ca4e25bca

commit 58e2e22449927df874dc27e5f156eb4ca4e25bca
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 15:53:04 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:38 2020 +0200

    [WINESYNC] dbghelp: Return a Unicode path in path_find_symbol_file().
    
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 3e1a56290191e37aded204c554f2e550c0257300 by Alexandre 
Julliard <[email protected]>
---
 dll/win32/dbghelp/dbghelp_private.h |  2 +-
 dll/win32/dbghelp/msc.c             |  4 ++--
 dll/win32/dbghelp/path.c            | 29 ++++++++++-------------------
 dll/win32/dbghelp/pe_module.c       |  6 +++---
 sdk/tools/winesync/dbghelp.cfg      |  2 +-
 5 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/dll/win32/dbghelp/dbghelp_private.h 
b/dll/win32/dbghelp/dbghelp_private.h
index 759aaa93c98..3cf215a25e2 100644
--- a/dll/win32/dbghelp/dbghelp_private.h
+++ b/dll/win32/dbghelp/dbghelp_private.h
@@ -690,7 +690,7 @@ extern BOOL pdb_virtual_unwind(struct cpu_stack_walk *csw, 
DWORD_PTR ip,
 /* path.c */
 extern BOOL         path_find_symbol_file(const struct process* pcs, const 
struct module* module,
                                           PCSTR full_path, const GUID* guid, 
DWORD dw1, DWORD dw2,
-                                          PSTR buffer, BOOL* is_unmatched) 
DECLSPEC_HIDDEN;
+                                          WCHAR *buffer, BOOL* is_unmatched) 
DECLSPEC_HIDDEN;
 
 /* pe_module.c */
 extern BOOL         pe_load_nt_header(HANDLE hProc, DWORD64 base, 
IMAGE_NT_HEADERS* nth) DECLSPEC_HIDDEN;
diff --git a/dll/win32/dbghelp/msc.c b/dll/win32/dbghelp/msc.c
index 6003bc34017..493c440ea7b 100644
--- a/dll/win32/dbghelp/msc.c
+++ b/dll/win32/dbghelp/msc.c
@@ -2444,7 +2444,7 @@ static HANDLE map_pdb_file(const struct process* pcs,
                            struct module* module)
 {
     HANDLE      hFile, hMap = NULL;
-    char        dbg_file_path[MAX_PATH];
+    WCHAR       dbg_file_path[MAX_PATH];
     BOOL        ret = FALSE;
 
     switch (lookup->kind)
@@ -2463,7 +2463,7 @@ static HANDLE map_pdb_file(const struct process* pcs,
         WARN("\tCouldn't find %s\n", lookup->filename);
         return NULL;
     }
-    if ((hFile = CreateFileA(dbg_file_path, GENERIC_READ, FILE_SHARE_READ, 
NULL,
+    if ((hFile = CreateFileW(dbg_file_path, GENERIC_READ, FILE_SHARE_READ, 
NULL,
                              OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != 
INVALID_HANDLE_VALUE)
     {
         hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
diff --git a/dll/win32/dbghelp/path.c b/dll/win32/dbghelp/path.c
index 0b9a1e35b17..a0fc0cf5b17 100644
--- a/dll/win32/dbghelp/path.c
+++ b/dll/win32/dbghelp/path.c
@@ -623,11 +623,10 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID 
user)
 
 BOOL path_find_symbol_file(const struct process* pcs, const struct module* 
module,
                            PCSTR full_path, const GUID* guid, DWORD dw1, DWORD 
dw2,
-                           PSTR buffer, BOOL* is_unmatched)
+                           WCHAR *buffer, BOOL* is_unmatched)
 {
     struct module_find  mf;
     WCHAR               full_pathW[MAX_PATH];
-    WCHAR               tmp[MAX_PATH];
     WCHAR*              ptr;
     const WCHAR*        filename;
     WCHAR*              searchPath = pcs->search_path;
@@ -648,7 +647,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const 
struct module* modul
     /* first check full path to file */
     if (module_find_cb(full_pathW, &mf))
     {
-        WideCharToMultiByte(CP_ACP, 0, full_pathW, -1, buffer, MAX_PATH, NULL, 
NULL);
+        strcpyW( buffer, full_pathW );
         return TRUE;
     }
 
@@ -662,38 +661,30 @@ BOOL path_find_symbol_file(const struct process* pcs, 
const struct module* modul
               (dll may be exe, or sys depending on the file extension)   */
 
     /* 2. check module-path */
-    file_pathW(module->module.LoadedImageName, tmp);
-    if (do_searchW(filename, tmp, FALSE, module_find_cb, &mf))
-    {
-        WideCharToMultiByte(CP_ACP, 0, tmp, -1, buffer, MAX_PATH, NULL, NULL);
-        return TRUE;
-    }
+    file_pathW(module->module.LoadedImageName, buffer);
+    if (do_searchW(filename, buffer, FALSE, module_find_cb, &mf)) return TRUE;
 
     while (searchPath)
     {
         ptr = strchrW(searchPath, ';');
         if (ptr)
         {
-            memcpy(tmp, searchPath, (ptr - searchPath) * sizeof(WCHAR));
-            tmp[ptr - searchPath] = '\0';
+            memcpy(buffer, searchPath, (ptr - searchPath) * sizeof(WCHAR));
+            buffer[ptr - searchPath] = '\0';
             searchPath = ptr + 1;
         }
         else
         {
-            strcpyW(tmp, searchPath);
+            strcpyW(buffer, searchPath);
             searchPath = NULL;
         }
-        if (do_searchW(filename, tmp, FALSE, module_find_cb, &mf))
-        {
-            /* return first fully matched file */
-            WideCharToMultiByte(CP_ACP, 0, tmp, -1, buffer, MAX_PATH, NULL, 
NULL);
-            return TRUE;
-        }
+        /* return first fully matched file */
+        if (do_searchW(filename, buffer, FALSE, module_find_cb, &mf)) return 
TRUE;
     }
     /* if no fully matching file is found, return the best matching file if 
any */
     if ((dbghelp_options & SYMOPT_LOAD_ANYTHING) && mf.matched)
     {
-        WideCharToMultiByte(CP_ACP, 0, mf.filename, -1, buffer, MAX_PATH, 
NULL, NULL);
+        strcpyW( buffer, mf.filename );
         *is_unmatched = TRUE;
         return TRUE;
     }
diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c
index 4b9eac4f032..6d0a9a6b5f9 100644
--- a/dll/win32/dbghelp/pe_module.c
+++ b/dll/win32/dbghelp/pe_module.c
@@ -553,7 +553,7 @@ static BOOL pe_load_rsym(struct module* module)
 static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
                              const char* dbg_name, DWORD timestamp)
 {
-    char                                tmp[MAX_PATH];
+    WCHAR tmp[MAX_PATH];
     HANDLE                              hFile = INVALID_HANDLE_VALUE, hMap = 0;
     const BYTE*                         dbg_mapping = NULL;
     BOOL                                ret = FALSE;
@@ -561,7 +561,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, 
struct module* module,
     TRACE("Processing DBG file %s\n", debugstr_a(dbg_name));
 
     if (path_find_symbol_file(pcs, module, dbg_name, NULL, timestamp, 0, tmp, 
&module->module.DbgUnmatched) &&
-        (hFile = CreateFileA(tmp, GENERIC_READ, FILE_SHARE_READ, NULL,
+        (hFile = CreateFileW(tmp, GENERIC_READ, FILE_SHARE_READ, NULL,
                              OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != 
INVALID_HANDLE_VALUE &&
         ((hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) 
!= 0) &&
         ((dbg_mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL))
@@ -584,7 +584,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, 
struct module* module,
                                       hdr->DebugDirectorySize / sizeof(*dbg));
     }
     else
-        ERR("Couldn't find .DBG file %s (%s)\n", debugstr_a(dbg_name), 
debugstr_a(tmp));
+        ERR("Couldn't find .DBG file %s (%s)\n", debugstr_a(dbg_name), 
debugstr_w(tmp));
 
     if (dbg_mapping) UnmapViewOfFile(dbg_mapping);
     if (hMap) CloseHandle(hMap);
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 0b9cafb96c7..9088f216084 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: 6030ee5f6f64a2ebe6df2e505e2588eb300222c2
+  wine: 3e1a56290191e37aded204c554f2e550c0257300

Reply via email to