Alexandre Julliard : dbghelp: Return a Unicode path in path_find_symbol_file().
Alexandre Julliard
julliard at winehq.org
Thu Nov 15 16:43:27 CST 2018
Module: wine
Branch: master
Commit: 3e1a56290191e37aded204c554f2e550c0257300
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3e1a56290191e37aded204c554f2e550c0257300
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Nov 15 14:24:58 2018 +0100
dbghelp: Return a Unicode path in path_find_symbol_file().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/dbghelp_private.h | 2 +-
dlls/dbghelp/msc.c | 4 ++--
dlls/dbghelp/path.c | 29 ++++++++++-------------------
dlls/dbghelp/pe_module.c | 6 +++---
4 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 1308d63..7b872fe 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -659,7 +659,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/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 6003bc3..493c440 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/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/dlls/dbghelp/path.c b/dlls/dbghelp/path.c
index 0b9a1e3..a0fc0cf 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/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/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c
index ea2a826..025cd60 100644
--- a/dlls/dbghelp/pe_module.c
+++ b/dlls/dbghelp/pe_module.c
@@ -524,7 +524,7 @@ static BOOL pe_load_dwarf(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;
@@ -532,7 +532,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))
@@ -555,7 +555,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);
More information about the wine-cvs
mailing list