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.

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index e12ca9c..b92f136 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1763,8 +1763,14 @@
 
 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 @@
     {
         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 dac09ba..7358047 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/dbghelp/path.c
@@ -342,7 +342,10 @@
             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;
 }