From 92000a91da0cef9de278f4ee6d7eb3d04d13ea5c Mon Sep 17 00:00:00 2001 From: Raphael Junqueira Date: Wed, 18 May 2005 09:42:17 +0000 Subject: [PATCH] Fix open_pdb_file (used for locate/open pdbs): - pdb_match heuristic now only stop when "first file" exists - SymFindFileInPath now fill output buffer with a valid value on success. --- dlls/dbghelp/msc.c | 11 +++++++++-- dlls/dbghelp/path.c | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index e12ca9c2949..b92f1369eb9 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -1763,8 +1763,14 @@ static void pdb_convert_symbol_file(const PDB_SYMBOLS* symbols, static BOOL CALLBACK pdb_match(char* file, void* user) { - /* accept first file */ - return FALSE; + /* accept first file that exists */ + HANDLE h = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + TRACE("match with %s returns %x\n", file, h); + if (INVALID_HANDLE_VALUE != h) { + CloseHandle(h); + return FALSE; + } + return TRUE; } static HANDLE open_pdb_file(const struct process* pcs, const char* filename) @@ -1781,6 +1787,7 @@ static HANDLE open_pdb_file(const struct process* pcs, const char* filename) { h = CreateFileA(dbg_file_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + TRACE("with %s returns %x\n", dbg_file_path, h); } return (h == INVALID_HANDLE_VALUE) ? NULL : h; } diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index dac09baaeee..7358047a72a 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -342,7 +342,10 @@ BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR full_path strcpy(tmp, searchPath); searchPath = NULL; } - if (do_search(filename, tmp, FALSE, sffip_cb, &s)) return TRUE; + if (do_search(filename, tmp, FALSE, sffip_cb, &s)) { + strcpy(buffer, tmp); + return TRUE; + } } return FALSE; }