dbghelp: Implement SymSrvGetFileIndexInfo() for .dbg files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
34128f1ae7
commit
767fc14ef7
4 changed files with 37 additions and 3 deletions
|
@ -767,6 +767,7 @@ struct pdb_cmd_pair {
|
|||
extern BOOL pdb_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip,
|
||||
union ctx *context, struct pdb_cmd_pair *cpair);
|
||||
extern DWORD pdb_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX_INFOW* info);
|
||||
extern DWORD dbg_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX_INFOW* info);
|
||||
|
||||
/* path.c */
|
||||
extern BOOL path_find_symbol_file(const struct process* pcs, const struct module* module,
|
||||
|
|
|
@ -4573,3 +4573,36 @@ DWORD msc_get_file_indexinfo(void* image, const IMAGE_DEBUG_DIRECTORY* debug_dir
|
|||
}
|
||||
return info->stripped && !num_misc_records ? ERROR_BAD_EXE_FORMAT : ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD dbg_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX_INFOW* info)
|
||||
{
|
||||
const IMAGE_SEPARATE_DEBUG_HEADER *header;
|
||||
DWORD num_directories;
|
||||
|
||||
if (size < sizeof(*header)) return ERROR_BAD_EXE_FORMAT;
|
||||
header = image;
|
||||
if (header->Signature != 0x4944 /* DI */ ||
|
||||
size < sizeof(*header) + header->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) + header->ExportedNamesSize + header->DebugDirectorySize)
|
||||
return ERROR_BAD_EXE_FORMAT;
|
||||
|
||||
/* header is followed by:
|
||||
* - header->NumberOfSections of IMAGE_SECTION_HEADER
|
||||
* - header->ExportedNameSize
|
||||
* - then num_directories of IMAGE_DEBUG_DIRECTORY
|
||||
*/
|
||||
num_directories = header->DebugDirectorySize / sizeof(IMAGE_DEBUG_DIRECTORY);
|
||||
|
||||
if (!num_directories) return ERROR_BAD_EXE_FORMAT;
|
||||
|
||||
info->age = 0;
|
||||
memset(&info->guid, 0, sizeof(info->guid));
|
||||
info->sig = 0;
|
||||
info->dbgfile[0] = L'\0';
|
||||
info->pdbfile[0] = L'\0';
|
||||
info->size = header->SizeOfImage;
|
||||
/* seems to use header's timestamp, not debug_directory one */
|
||||
info->timestamp = header->TimeDateStamp;
|
||||
info->stripped = FALSE; /* FIXME */
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -860,6 +860,8 @@ BOOL WINAPI SymSrvGetFileIndexInfoW(const WCHAR *file, SYMSRV_INDEX_INFOW* info,
|
|||
ret = pe_get_file_indexinfo(image, fsize, info);
|
||||
if (ret == ERROR_BAD_FORMAT)
|
||||
ret = pdb_get_file_indexinfo(image, fsize, info);
|
||||
if (ret == ERROR_BAD_FORMAT)
|
||||
ret = dbg_get_file_indexinfo(image, fsize, info);
|
||||
}
|
||||
else ret = ERROR_FILE_NOT_FOUND;
|
||||
|
||||
|
|
|
@ -907,10 +907,8 @@ static void test_srvgetindexes_dbg(void)
|
|||
memset(&ssii, 0x45, sizeof(ssii));
|
||||
ssii.sizeofstruct = sizeof(ssii);
|
||||
ret = SymSrvGetFileIndexInfoW(filename, &ssii, 0);
|
||||
todo_wine
|
||||
ok(ret, "SymSrvGetFileIndexInfo failed: %lu\n", GetLastError());
|
||||
|
||||
if (ret){
|
||||
ok(ssii.age == 0, "Mismatch in age: %lx\n", ssii.age);
|
||||
ok(!memcmp(&ssii.guid, &null_guid, sizeof(GUID)),
|
||||
"Mismatch in guid: guid=%s\n", wine_dbgstr_guid(&ssii.guid));
|
||||
|
@ -922,7 +920,7 @@ static void test_srvgetindexes_dbg(void)
|
|||
ok(!wcscmp(ssii.file, filename), "Mismatch in file: %ls\n", ssii.file);
|
||||
ok(!ssii.pdbfile[0], "Mismatch in pdbfile: %ls\n", ssii.pdbfile);
|
||||
ok(!ssii.dbgfile[0], "Mismatch in dbgfile: %ls\n", ssii.dbgfile);
|
||||
}
|
||||
|
||||
DeleteFileW(filename);
|
||||
winetest_pop_context();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue