/****************************************************************** * SymFindFileInPathW (DBGHELP.@) * */ BOOL WINAPI SymFindFileInPathW(HANDLE hProcess, PCWSTR searchPath, PCWSTR full_path, PVOID id, DWORD two, DWORD three, DWORD flags, PWSTR buffer, PFINDFILEINPATHCALLBACKW cb, PVOID user) { struct sffip s; struct process* pcs = process_find_by_handle(hProcess); WCHAR tmp[MAX_PATH]; WCHAR* ptr; const WCHAR* filename; 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); if (!pcs) return FALSE; if (!searchPath) searchPath = pcs->search_path; s.id = id; s.two = two; s.three = three; s.flags = flags; s.cb = cb; s.user = user; filename = file_nameW(full_path); s.kind = module_get_type_by_name(filename); /* first check full path to file */ if (sffip_cb(full_path, &s)) { strcpyW(buffer, full_path); return TRUE; } while (searchPath) { ptr = strchrW(searchPath, ';'); if (ptr) { memcpy(tmp, searchPath, (ptr - searchPath) * sizeof(WCHAR)); tmp[ptr - searchPath] = 0; searchPath = ptr + 1; } else { strcpyW(tmp, searchPath); searchPath = NULL; } if (do_searchW(filename, tmp, FALSE, sffip_cb, &s)) { strcpyW(buffer, tmp); return TRUE; } } return FALSE; }
/****************************************************************** * SymFindFileInPath (DBGHELP.@) * */ BOOL WINAPI SymFindFileInPath(HANDLE hProcess, PCSTR inSearchPath, PCSTR full_path, PVOID id, DWORD two, DWORD three, DWORD flags, LPSTR buffer, PFINDFILEINPATHCALLBACK cb, PVOID user) { struct sffip s; struct process* pcs = process_find_by_handle(hProcess); char tmp[MAX_PATH]; char* ptr; const char* filename; const char* searchPath = inSearchPath; TRACE("(%p %s %s %p %08lx %08lx %08lx %p %p %p)\n", hProcess, searchPath, full_path, id, two, three, flags, buffer, cb, user); if (!pcs) return FALSE; if (!searchPath) { unsigned len = WideCharToMultiByte(CP_ACP, 0, pcs->search_path, -1, NULL, 0, NULL, NULL); char* buf; searchPath = buf = HeapAlloc(GetProcessHeap(), 0, len); if (!searchPath) return FALSE; WideCharToMultiByte(CP_ACP, 0, pcs->search_path, -1, buf, len, NULL, NULL); } s.id = id; s.two = two; s.three = three; s.flags = flags; s.cb = cb; s.user = user; filename = file_name(full_path); s.kind = module_get_type_by_name(filename); /* first check full path to file */ if (sffip_cb(full_path, &s)) { strcpy(buffer, full_path); if (searchPath != inSearchPath) HeapFree(GetProcessHeap(), 0, (char*)searchPath); return TRUE; } while (searchPath) { ptr = strchr(searchPath, ';'); if (ptr) { memcpy(tmp, searchPath, ptr - searchPath); tmp[ptr - searchPath] = 0; searchPath = ptr + 1; } else { strcpy(tmp, searchPath); searchPath = NULL; } if (do_search(filename, tmp, FALSE, sffip_cb, &s)) { strcpy(buffer, tmp); if (searchPath != inSearchPath) HeapFree(GetProcessHeap(), 0, (char*)searchPath); return TRUE; } } if (searchPath != inSearchPath) HeapFree(GetProcessHeap(), 0, (char*)searchPath); return FALSE; }