From e7cbb7feda84706dc95d41de10926fc12c1c3ec0 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Tue, 20 Nov 2007 16:04:16 -0500 Subject: [PATCH] Fix file searching to search only listed directories instead of the whole HD. Also, improve many TRACEs. --- dlls/dbghelp/path.c | 47 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 2e191af..7fffb20 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -57,12 +57,25 @@ HANDLE WINAPI FindDebugInfoFile(PCSTR FileName, PCSTR SymbolPath, PSTR DebugFile { HANDLE h; - h = CreateFileA(DebugFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, + + TRACE("(FileName = %s, SymbolPath = %s, DebugFilePath = %s)\n", + debugstr_a(FileName), debugstr_a(SymbolPath), debugstr_a(DebugFilePath)); + + h = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (h == INVALID_HANDLE_VALUE) { - if (!SearchPathA(SymbolPath, file_name(FileName), NULL, MAX_PATH, DebugFilePath, NULL)) - return NULL; + TRACE("file didn't exist in the current directory. Trying search path %s\n", debugstr_a(SymbolPath)); + + if (!SearchPathA(SymbolPath, file_name(FileName), NULL, MAX_PATH, DebugFilePath, NULL)){ + TRACE("the symbol file %s wasn't found on the path %s\n", debugstr_a(FileName), debugstr_a(SymbolPath)); + return 0; + } + + + TRACE("the symbol file %s was found at %s\n", debugstr_a(FileName), debugstr_a(DebugFilePath)); h = CreateFileA(DebugFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); } @@ -79,7 +92,7 @@ HANDLE WINAPI FindDebugInfoFileEx(PCSTR FileName, PCSTR SymbolPath, PVOID CallerData) { FIXME("(%s %s %p %p %p): stub\n", - FileName, SymbolPath, DebugFilePath, Callback, CallerData); + debugstr_a(FileName), debugstr_a(SymbolPath), debugstr_a(DebugFilePath), Callback, CallerData); return NULL; } @@ -109,9 +122,21 @@ HANDLE WINAPI FindExecutableImageEx(PCSTR FileName, PCSTR SymbolPath, PSTR Image { HANDLE h; - if (Callback) FIXME("Unsupported callback yet\n"); - if (!SearchPathA(SymbolPath, FileName, NULL, MAX_PATH, ImageFilePath, NULL)) + + TRACE("(FileName = %s, SymbolPath = %s, ImageFilePath = %s, Callback = %p, user = %p)\n", + debugstr_a(FileName), debugstr_a(SymbolPath), debugstr_a(ImageFilePath), Callback, user); + + if (Callback) + FIXME("Unsupported callback yet\n"); + + + if (!SearchPathA(SymbolPath, FileName, NULL, MAX_PATH, ImageFilePath, NULL)){ + ERR("the file %s was not found in the path %s\n", debugstr_a(FileName), debugstr_a(SymbolPath)); return NULL; + } + + + TRACE("found the file %s at %s\n", debugstr_a(FileName), debugstr_a(ImageFilePath)); h = CreateFileA(ImageFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); return (h == INVALID_HANDLE_VALUE) ? NULL : h; @@ -191,7 +216,7 @@ BOOL WINAPI SymMatchFileName(PCSTR file, PCSTR match, PCSTR fptr; PCSTR mptr; - TRACE("(%s %s %p %p)\n", file, match, filestop, matchstop); + TRACE("(%s %s %p %p)\n", debugstr_a(file), debugstr_a(match), filestop, matchstop); fptr = file + strlen(file) - 1; mptr = match + strlen(match) - 1; @@ -215,9 +240,9 @@ static BOOL do_searchW(PCWSTR file, PWSTR buffer, BOOL recurse, WIN32_FIND_DATAW fd; unsigned pos; BOOL found = FALSE; - static const WCHAR S_AllW[] = {'*','.','*','\0'}; - static const WCHAR S_DotW[] = {'.','\0'}; - static const WCHAR S_DotDotW[] = {'.','\0'}; + static const WCHAR S_AllW[] = {'*', '.', '*', '\0'}; + static const WCHAR S_DotW[] = {'.', '\0'}; + static const WCHAR S_DotDotW[] = {'.', '.', '\0'}; pos = strlenW(buffer); if (buffer[pos - 1] != '\\') buffer[pos++] = '\\'; @@ -478,7 +503,7 @@ BOOL WINAPI SymFindFileInPathW(HANDLE hProcess, PCWSTR searchPath, PCWSTR full_p WCHAR* ptr; const WCHAR* filename; - TRACE("(%p %s %s %p %08x %08x %08x %p %p %p)\n", + TRACE("(hProcess = %p, searchPath = %s, full_path = %s, id = %p, two = 0x%08x, three = 0x%08x, flags = 0x%08x, buffer = %p, cb = %p, user = %p)\n", hProcess, debugstr_w(searchPath), debugstr_w(full_path), id, two, three, flags, buffer, cb, user); -- 1.4.4.2