Commit a5b1581e authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: SymFindFileInPath and PDB

- implemented correct lookup when SymFindFileInPath is called to find a PDB file - added pdb_fetch_file_info to gather relevant information - when looking for a PDB file (from a .EXE or a .DLL), now using SymFindFileInPath to locate the PDB file with the correct information
parent 2a1d8efd
......@@ -325,6 +325,28 @@ struct module_pair
struct module* effective; /* out: module with debug info */
};
enum pdb_kind {PDB_JG, PDB_DS};
struct pdb_lookup
{
const char* filename;
DWORD age;
enum pdb_kind kind;
union
{
struct
{
DWORD timestamp;
struct PDB_JG_TOC* toc;
} jg;
struct
{
GUID guid;
struct PDB_DS_TOC* toc;
} ds;
} u;
};
/* dbghelp.c */
extern struct process* process_find_by_handle(HANDLE hProcess);
extern HANDLE hMsvcrt;
......@@ -376,6 +398,8 @@ extern BOOL pe_load_debug_directory(const struct process* pcs,
const BYTE* mapping,
const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg);
extern BOOL pdb_fetch_file_info(struct pdb_lookup* pdb_lookup);
/* pe_module.c */
extern BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth);
extern struct module*
......
......@@ -1300,7 +1300,7 @@ struct PDB_JG_ROOT
{
DWORD Version;
DWORD TimeDateStamp;
DWORD unknown;
DWORD Age;
DWORD cbNames;
CHAR names[1];
};
......@@ -1309,7 +1309,7 @@ struct PDB_DS_ROOT
{
DWORD Version;
DWORD TimeDateStamp;
DWORD unknown;
DWORD Age;
GUID guid;
DWORD cbNames;
CHAR names[1];
......@@ -1409,7 +1409,7 @@ typedef struct _PDB_SYMBOL_IMPORT
DWORD unknown1;
DWORD unknown2;
DWORD TimeDateStamp;
DWORD nRequests;
DWORD Age;
CHAR filename[1];
} PDB_SYMBOL_IMPORT, *PPDB_SYMBOL_IMPORT;
......@@ -1556,5 +1556,3 @@ typedef struct _CV_ENTRY_GLOBAL_TYPES
types_record[];
*/
} CV_ENTRY_GLOBAL_TYPES;
......@@ -229,7 +229,6 @@ static BOOL CALLBACK sffip_cb(LPCSTR buffer, void* user)
{
struct sffip* s = (struct sffip*)user;
DWORD size, checksum;
DWORD_PTR timestamp;
/* FIXME: should check that id/two/three match the file pointed
* by buffer
......@@ -240,6 +239,7 @@ static BOOL CALLBACK sffip_cb(LPCSTR buffer, void* user)
{
HANDLE hFile, hMap;
void* mapping;
DWORD timestamp;
timestamp = ~(DWORD_PTR)s->id;
size = ~s->two;
......@@ -282,7 +282,49 @@ static BOOL CALLBACK sffip_cb(LPCSTR buffer, void* user)
}
break;
case DMT_PDB:
FIXME("NIY on '%s'\n", buffer);
{
struct pdb_lookup pdb_lookup;
pdb_lookup.filename = buffer;
if (!pdb_fetch_file_info(&pdb_lookup)) return FALSE;
switch (pdb_lookup.kind)
{
case PDB_JG:
if (s->flags & SSRVOPT_GUIDPTR)
{
WARN("Found %s, but wrong PDB version\n", buffer);
return FALSE;
}
if (pdb_lookup.u.jg.timestamp != (DWORD_PTR)s->id)
{
WARN("Found %s, but wrong signature: %08lx %08lx\n",
buffer, pdb_lookup.u.jg.timestamp, (DWORD_PTR)s->id);
return FALSE;
}
break;
case PDB_DS:
if (!(s->flags & SSRVOPT_GUIDPTR))
{
WARN("Found %s, but wrong PDB version\n", buffer);
return FALSE;
}
if (!(memcmp(&pdb_lookup.u.ds.guid, (GUID*)s->id, sizeof(GUID))))
{
WARN("Found %s, but wrong GUID: %s %s\n",
buffer, debugstr_guid(&pdb_lookup.u.ds.guid),
debugstr_guid((GUID*)s->id));
return FALSE;
}
break;
}
if (pdb_lookup.age != s->two)
{
WARN("Found %s, but wrong age: %08lx %08lx\n",
buffer, pdb_lookup.age, s->two);
return FALSE;
}
}
break;
default:
FIXME("What the heck??\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment