This is the fourth and last part of a larger serie to cover module loading and debug info file lookup in dbghelp. This fourth part covers:
- support for SLMFLAG_NO_SYMBOLS flag in SymLoadModule - PDB related values in module information now match what native returns
Note: some modifications require new todo marks in the tests, as the full fix will require changing other areas that would make the change too large. At the end of the serie, all the todo:s are now resolved.
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/tests/path.c | 53 +++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 13 deletions(-)
diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c index 9afefd2d12a..b57a6644d45 100644 --- a/dlls/dbghelp/tests/path.c +++ b/dlls/dbghelp/tests/path.c @@ -1639,7 +1639,7 @@ static BOOL has_mismatch(const char *str, char ch, unsigned *val) { if (str && *str == ch) { - if (val && (ch == 'D' || ch == 'P' || ch == '!')) + if (val && (ch == 'F' || ch == 'P' || ch == '!')) *val = char2index(str[1]); return TRUE; } @@ -1671,7 +1671,9 @@ static void test_load_modules_details(void) const char *test_files; /* various test_files to be created */ /* output parameters */ SYM_TYPE sym_type; - const char *mismatch_in; /* 'PN'=PDB, 'DN'=DBG, NULL (N index of expected found file) */ + const char *mismatch_in; /* format if CN, where + C={'F' for full match of PDB, 'P' for partial match of PDB, '!' found pdb without info} + N index of expected file */ } module_details_tests[] = { @@ -1686,10 +1688,10 @@ static void test_load_modules_details(void) {0, 0, L"bar.dll", L"foo_bar", -1, "0", SymPdb, "!0"}, {0, SYMOPT_DEFERRED_LOADS, L"bar.dll", L"foo_bar", -1, "0", SymDeferred},
- {SLMFLAG_NO_SYMBOLS, 0, L"bar.dll", L"foo_bar", 0, "0", SymNone}, + {SLMFLAG_NO_SYMBOLS, 0, L"bar.dll", L"foo_bar", 0, "0", SymNone, "F0"}, {SLMFLAG_NO_SYMBOLS, SYMOPT_DEFERRED_LOADS, L"bar.dll", L"foo_bar", 0, "0", SymDeferred},
-/*10*/ {0, 0, L"bar.dll", L"foo_bar", 0, "0", SymPdb}, +/*10*/ {0, 0, L"bar.dll", L"foo_bar", 0, "0", SymPdb, "F0"}, {0, SYMOPT_DEFERRED_LOADS, L"bar.dll", L"foo_bar", 0, "0", SymDeferred},
{SLMFLAG_NO_SYMBOLS, 0, L"bar.dll", L"foo_bar", 1, "0", SymNone, "P0"}, @@ -1698,6 +1700,9 @@ static void test_load_modules_details(void) {0, 0, L"bar.dll", L"foo_bar", 1, "0", SymNone, "P0"}, /*15*/ {0, SYMOPT_DEFERRED_LOADS, L"bar.dll", L"foo_bar", 1, "0", SymDeferred},
+ {SLMFLAG_NO_SYMBOLS, 0, L"bar.dll", L"foo_bar", -1, "", SymNone}, + {SLMFLAG_NO_SYMBOLS, SYMOPT_DEFERRED_LOADS, L"bar.dll", L"foo_bar", -1, "", SymDeferred}, + /* FIXME add lookup path, exact symbol, .DBG files */ };
@@ -1721,7 +1726,6 @@ static void test_load_modules_details(void) struct debug_directory_blob* blob_refs[2];
old_options = SymGetOptions(); - im.SizeOfStruct = sizeof(im);
len = GetTempPathW(ARRAY_SIZE(topdir), topdir); ok(len && len < ARRAY_SIZE(topdir), "Unexpected length\n"); @@ -1731,7 +1735,7 @@ static void test_load_modules_details(void)
init_headers64(&h.nt_header64, 12324, 3242, 0); blob_refs[0] = make_pdb_ds_blob(12324, &guid1, 0x0030cafe, "bar.pdb"); - blob_refs[1] = make_pdb_ds_blob(12324, &guid1, 0x0030caff, "bar.pdb"); /* shall generate a mismatch */ + blob_refs[1] = make_pdb_ds_blob(12325, &guid1, 0x0030caff, "bar.pdb"); /* shall generate a mismatch */
for (i = 0; i < ARRAY_SIZE(module_details_tests); i++) { @@ -1775,6 +1779,8 @@ static void test_load_modules_details(void) test->in_image_name, test->in_module_name, 0x4000, 0x6666, NULL, test->flags); ok(base == 0x4000, "SymLoadModuleExW failed: %lu\n", GetLastError()); + memset(&im, 0xA5, sizeof(im)); + im.SizeOfStruct = sizeof(im); ret = SymGetModuleInfoW64(dummy, base, &im); ok(ret, "SymGetModuleInfow64 failed: %lu\n", GetLastError()); if (test->in_image_name) @@ -1797,52 +1803,73 @@ static void test_load_modules_details(void) } else loaded_img_name = test->in_image_name; - todo_wine_if(test->options & SYMOPT_DEFERRED_LOADS) + todo_wine_if(i == 3 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || i == 15 || i == 17) ok(!wcsicmp(im.LoadedImageName, (test->options & SYMOPT_DEFERRED_LOADS) ? L"" : loaded_img_name), "Unexpected loaded image name '%ls' (%ls)\n", im.LoadedImageName, loaded_img_name); - todo_wine_if(i == 3 || i == 4 || i == 6 || i == 8) + todo_wine_if(i == 3 || i == 4 || i == 6 || i == 8 || i == 16) ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType); - todo_wine_if(i == 8 || i == 10) - ok(!im.TypeInfo, "No type info present\n"); if (test->mismatch_in) { unsigned val; if (has_mismatch(test->mismatch_in, '!', &val)) { + ok(val < ARRAY_SIZE(test_files), "Incorrect index\n"); make_path(filename, topdir, NULL, L"bar.pdb"); todo_wine ok(!wcscmp(filename, im.LoadedPdbName), "Unexpected value '%ls\n", im.LoadedPdbName); todo_wine ok(im.PdbUnmatched, "Unexpected value\n"); - todo_wine - ok(im.PdbUnmatched, "Unexpected value\n"); ok(!im.DbgUnmatched, "Unexpected value\n"); todo_wine ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n", wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid)); + ok(im.PdbSig == 0, "Unexpected value\n"); todo_wine ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n"); } else if (has_mismatch(test->mismatch_in, 'P', &val)) { ok(val < ARRAY_SIZE(test_files), "Incorrect index\n"); + ok(!im.LoadedPdbName[0], "Unexpected value\n"); ok(!im.PdbUnmatched, "Unexpected value\n"); ok(!im.DbgUnmatched, "Unexpected value\n"); ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n", wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid)); + ok(im.PdbSig == 0, "Unexpected value\n"); ok(im.PdbAge == test_files[val].age_or_timestamp + 1, "Unexpected value\n"); } - else if (has_mismatch(test->mismatch_in, 'D', &val)) + else if (has_mismatch(test->mismatch_in, 'F', &val)) { ok(val < ARRAY_SIZE(test_files), "Incorrect index\n"); + if (test->flags & SLMFLAG_NO_SYMBOLS) + todo_wine_if(i == 8) + ok(!im.LoadedPdbName[0], "Unexpected value\n"); + else + { + make_path(filename, topdir, NULL, L"bar.pdb"); + ok(!wcscmp(im.LoadedPdbName, filename), "Unexpected value\n"); + } ok(!im.PdbUnmatched, "Unexpected value\n"); ok(!im.DbgUnmatched, "Unexpected value\n"); + ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n", + wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid)); + todo_wine_if(i == 10) + ok(im.PdbSig == 0, "Unexpected value\n"); + ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n"); } + ok(im.TimeDateStamp == 12324, "Unexpected value\n"); } else { + ok(!im.LoadedPdbName[0], "Unexpected value3 %ls\n", im.LoadedPdbName); ok(!im.PdbUnmatched, "Unexpected value\n"); ok(!im.DbgUnmatched, "Unexpected value\n"); + ok(IsEqualGUID(&im.PdbSig70, &null_guid), "Unexpected value %s\n", wine_dbgstr_guid(&im.PdbSig70)); + ok(im.PdbSig == 0, "Unexpected value\n"); + ok(!im.PdbAge, "Unexpected value\n"); + /* native returns either 0 or the actual timestamp depending on test case */ + todo_wine_if(i == 4 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || (i >= 15 && i <= 17)) + ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n"); } ok(im.ImageSize == 0x6666, "Unexpected image size\n"); memset(&md, 0, sizeof(md));
From: Eric Pouech epouech@codeweavers.com
Also correctly handling ImageName (the passed image name in SymLoadModule) and LoadedImageName, which is only set when debug info have been loaded (and is always an absolute path, contrary to ImageName which can be relative).
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/dbghelp_private.h | 1 + dlls/dbghelp/module.c | 17 +++++++++++++---- dlls/dbghelp/msc.c | 11 +++++++---- dlls/dbghelp/path.c | 1 + dlls/dbghelp/pe_module.c | 9 ++++++--- dlls/dbghelp/tests/path.c | 9 +++------ 6 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 628cb1e6442..5677f6bfdb3 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -442,6 +442,7 @@ struct module struct module* next; enum dhext_module_type type : 16; unsigned short is_virtual : 1, + dont_load_symbols : 1, is_wine_builtin : 1, has_file_image : 1; struct cpu* cpu; diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 5021d54c93e..70a57edf3f9 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -376,8 +376,12 @@ BOOL module_load_debug(struct module* module) if (module->module.SymType == SymDeferred) { BOOL ret; - - if (module->is_virtual) ret = FALSE; + + if (module->is_virtual) + { + module->module.SymType = SymVirtual; + ret = TRUE; + } else if (module->type == DMT_PE) { idslW64.SizeOfStruct = sizeof(idslW64); @@ -942,7 +946,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if (!(pcs = process_find_by_handle(hProcess))) return 0;
- if (Flags & ~(SLMFLAG_VIRTUAL)) + if (Flags & ~(SLMFLAG_VIRTUAL | SLMFLAG_NO_SYMBOLS)) FIXME("Unsupported Flags %08lx for %s\n", Flags, debugstr_w(wImageName));
/* Trying to load a new module at the same address of an existing one, @@ -970,7 +974,6 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam if (!wImageName) wImageName = L""; module = module_new(pcs, wImageName, DMT_PE, FALSE, TRUE, BaseOfDll, SizeOfDll, 0, 0, IMAGE_FILE_MACHINE_UNKNOWN); if (!module) return 0; - module->module.SymType = SymVirtual; } else { @@ -996,6 +999,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam return 0; } } + if (Flags & SLMFLAG_NO_SYMBOLS) module->dont_load_symbols = 1;
/* Store alternate name for module when provided. */ if (wModuleName) @@ -1531,6 +1535,11 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr,
if (dbghelp_opt_real_path && module->real_path) lstrcpynW(miw64.LoadedImageName, module->real_path, ARRAY_SIZE(miw64.LoadedImageName)); + else if (miw64.SymType == SymDeferred) + { + miw64.LoadedImageName[0] = '\0'; + miw64.TimeDateStamp = 0; + }
/* update debug information from container if any */ if (module->module.SymType == SymNone) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index aeaa55cc713..035bc2d7295 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3889,16 +3889,18 @@ static BOOL pdb_process_file(const struct process *pcs, const struct msc_debug_info *msc_dbg, const char *filename, const GUID *guid, DWORD timestamp, DWORD age) { - BOOL ret; struct module_format* modfmt; struct pdb_module_info* pdb_module_info; SYMSRV_INDEX_INFOW info; BOOL unmatched;
- if (path_find_symbol_file(pcs, msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched) && + if (!msc_dbg->module->dont_load_symbols && + path_find_symbol_file(pcs, msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched) && (modfmt = HeapAlloc(GetProcessHeap(), 0, - sizeof(struct module_format) + sizeof(struct pdb_module_info)))) + sizeof(struct module_format) + sizeof(struct pdb_module_info)))) { + BOOL ret; + pdb_module_info = (void*)(modfmt + 1); msc_dbg->module->format_info[DFI_PDB] = modfmt; modfmt->module = msc_dbg->module; @@ -3926,6 +3928,7 @@ static BOOL pdb_process_file(const struct process *pcs, msc_dbg->module->module.TypeInfo = TRUE; msc_dbg->module->module.SourceIndexed = TRUE; msc_dbg->module->module.Publics = TRUE; + return TRUE; } msc_dbg->module->format_info[DFI_PDB] = NULL; @@ -3936,7 +3939,7 @@ static BOOL pdb_process_file(const struct process *pcs, msc_dbg->module->module.PdbSig70 = *guid; else memset(&msc_dbg->module->module.PdbSig70, 0, sizeof(GUID)); - msc_dbg->module->module.PdbSig = timestamp; + msc_dbg->module->module.PdbSig = 0; msc_dbg->module->module.PdbAge = age; return FALSE; } diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index db0873f133c..0f52bca3684 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -498,6 +498,7 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID user) mf->info->guid = info.guid; mf->info->timestamp = info.timestamp; mf->info->age = info.age; + mf->info->sig = info.sig; } /* yes, EnumDirTree/do_search and SymFindFileInPath callbacks use the opposite * convention to stop/continue enumeration. sigh. diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 8d713450386..1a6efc99392 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -721,9 +721,12 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY)) { - ret = image_check_alternate(&module->format_info[DFI_PE]->u.pe_info->fmap, module); - ret = pe_load_stabs(pcs, module) || ret; - ret = pe_load_dwarf(module) || ret; + if (!module->dont_load_symbols) + { + ret = image_check_alternate(&module->format_info[DFI_PE]->u.pe_info->fmap, module); + ret = pe_load_stabs(pcs, module) || ret; + ret = pe_load_dwarf(module) || ret; + } ret = pe_load_msc_debug_info(pcs, module) || ret; ret = ret || pe_load_coff_symbol_table(module); /* FIXME */ /* if we still have no debug info (we could only get SymExport at this diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c index b57a6644d45..bf3f20faf2f 100644 --- a/dlls/dbghelp/tests/path.c +++ b/dlls/dbghelp/tests/path.c @@ -1803,10 +1803,9 @@ static void test_load_modules_details(void) } else loaded_img_name = test->in_image_name; - todo_wine_if(i == 3 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || i == 15 || i == 17) ok(!wcsicmp(im.LoadedImageName, (test->options & SYMOPT_DEFERRED_LOADS) ? L"" : loaded_img_name), "Unexpected loaded image name '%ls' (%ls)\n", im.LoadedImageName, loaded_img_name); - todo_wine_if(i == 3 || i == 4 || i == 6 || i == 8 || i == 16) + todo_wine_if(i == 4 || i == 6 || i == 16) ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType); if (test->mismatch_in) { @@ -1842,7 +1841,6 @@ static void test_load_modules_details(void) { ok(val < ARRAY_SIZE(test_files), "Incorrect index\n"); if (test->flags & SLMFLAG_NO_SYMBOLS) - todo_wine_if(i == 8) ok(!im.LoadedPdbName[0], "Unexpected value\n"); else { @@ -1853,7 +1851,6 @@ static void test_load_modules_details(void) ok(!im.DbgUnmatched, "Unexpected value\n"); ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n", wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid)); - todo_wine_if(i == 10) ok(im.PdbSig == 0, "Unexpected value\n"); ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n"); } @@ -1868,7 +1865,7 @@ static void test_load_modules_details(void) ok(im.PdbSig == 0, "Unexpected value\n"); ok(!im.PdbAge, "Unexpected value\n"); /* native returns either 0 or the actual timestamp depending on test case */ - todo_wine_if(i == 4 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || (i >= 15 && i <= 17)) + todo_wine_if(i == 4 || i == 16) ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n"); } ok(im.ImageSize == 0x6666, "Unexpected image size\n"); @@ -1887,7 +1884,7 @@ static void test_load_modules_details(void) SymFromNameW(dummy, L"foo", sym); } ret = SymAddSymbol(dummy, base, "winetest_symbol_virtual", base + 4242, 13, 0); - todo_wine_if(i >= 12 && i <= 15) { /* temp */ + todo_wine_if(i == 8 || i == 9 || (i >= 12 && i <= 15)) { /* temp */ ok(ret, "Failed to add symbol\n"); memset(sym, 0, sizeof(*sym)); sym->SizeOfStruct = sizeof(*sym);
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/module.c | 4 ++-- dlls/dbghelp/tests/path.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 70a57edf3f9..d06c4417be6 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -404,8 +404,9 @@ BOOL module_load_debug(struct module* module) if (!ret) module->module.SymType = SymNone; assert(module->module.SymType != SymDeferred); module->module.NumSyms = module->ht_symbols.num_elts; + return ret; } - return module->module.SymType != SymNone; + return TRUE; }
/****************************************************************** @@ -416,7 +417,6 @@ BOOL module_load_debug(struct module* module) * the module itself) * - if the module has no debug info and has an ELF container, then return the ELF * container (and also force the ELF container's debug info loading if deferred) - * - otherwise return the module itself if it has some debug info */ BOOL module_get_debug(struct module_pair* pair) { diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c index bf3f20faf2f..e27539643be 100644 --- a/dlls/dbghelp/tests/path.c +++ b/dlls/dbghelp/tests/path.c @@ -1884,7 +1884,6 @@ static void test_load_modules_details(void) SymFromNameW(dummy, L"foo", sym); } ret = SymAddSymbol(dummy, base, "winetest_symbol_virtual", base + 4242, 13, 0); - todo_wine_if(i == 8 || i == 9 || (i >= 12 && i <= 15)) { /* temp */ ok(ret, "Failed to add symbol\n"); memset(sym, 0, sizeof(*sym)); sym->SizeOfStruct = sizeof(*sym); @@ -1899,7 +1898,6 @@ static void test_load_modules_details(void) ret = SymFromNameW(dummy, sym_name, (void*)sym); ok(ret, "Couldn't find symbol %ls\n", sym_name); } - } /* temp */ ret = SymCleanup(dummy); ok(ret, "SymCleanup failed: %lu\n", GetLastError()); for (ptr = test->test_files; *ptr; ptr++)
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 22 ++++++++++++++++++++++ dlls/dbghelp/pe_module.c | 3 +-- dlls/dbghelp/tests/path.c | 6 ------ 3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 035bc2d7295..d7c22075428 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -49,6 +49,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_msc);
+static const GUID null_guid; + struct pdb_stream_name { const char* name; @@ -4467,6 +4469,26 @@ typedef struct _FPO_DATA ret = FALSE; } __ENDTRY + + /* we haven't found yet any debug information, fallback to unmatched pdb */ + if (module->module.SymType == SymDeferred) + { + SYMSRV_INDEX_INFOW info = {.sizeofstruct = sizeof(info)}; + char buffer[MAX_PATH]; + char *ext; + DWORD options; + + WideCharToMultiByte(CP_ACP, 0, module->module.LoadedImageName, -1, buffer, ARRAY_SIZE(buffer), 0, NULL); + ext = strrchr(buffer, '.'); + if (ext) strcpy(ext + 1, "pdb"); else strcat(buffer, ".pdb"); + options = SymGetOptions(); + SymSetOptions(options | SYMOPT_LOAD_ANYTHING); + ret = pdb_process_file(pcs, &msc_dbg, buffer, &null_guid, 0, 0); + SymSetOptions(options); + if (!ret && module->dont_load_symbols) + module->module.TimeDateStamp = 0; + } + return ret; }
diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 1a6efc99392..255c9f1832d 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -598,7 +598,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod if (!(mapping = pe_map_full(fmap, &nth))) return FALSE; /* Read in debug directory */ dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg ); - if (!dbg || !(nDbg /= sizeof(IMAGE_DEBUG_DIRECTORY))) goto done; + nDbg = dbg ? nDbg / sizeof(IMAGE_DEBUG_DIRECTORY) : 0;
/* Parse debug directory */ if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) @@ -624,7 +624,6 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), nth->FileHeader.NumberOfSections, dbg, nDbg); } -done: pe_unmap_full(fmap); return ret; } diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c index e27539643be..804d6885ec3 100644 --- a/dlls/dbghelp/tests/path.c +++ b/dlls/dbghelp/tests/path.c @@ -1805,7 +1805,6 @@ static void test_load_modules_details(void) loaded_img_name = test->in_image_name; ok(!wcsicmp(im.LoadedImageName, (test->options & SYMOPT_DEFERRED_LOADS) ? L"" : loaded_img_name), "Unexpected loaded image name '%ls' (%ls)\n", im.LoadedImageName, loaded_img_name); - todo_wine_if(i == 4 || i == 6 || i == 16) ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType); if (test->mismatch_in) { @@ -1814,16 +1813,12 @@ static void test_load_modules_details(void) { ok(val < ARRAY_SIZE(test_files), "Incorrect index\n"); make_path(filename, topdir, NULL, L"bar.pdb"); - todo_wine ok(!wcscmp(filename, im.LoadedPdbName), "Unexpected value '%ls\n", im.LoadedPdbName); - todo_wine ok(im.PdbUnmatched, "Unexpected value\n"); ok(!im.DbgUnmatched, "Unexpected value\n"); - todo_wine ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n", wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid)); ok(im.PdbSig == 0, "Unexpected value\n"); - todo_wine ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n"); } else if (has_mismatch(test->mismatch_in, 'P', &val)) @@ -1865,7 +1860,6 @@ static void test_load_modules_details(void) ok(im.PdbSig == 0, "Unexpected value\n"); ok(!im.PdbAge, "Unexpected value\n"); /* native returns either 0 or the actual timestamp depending on test case */ - todo_wine_if(i == 4 || i == 16) ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n"); } ok(im.ImageSize == 0x6666, "Unexpected image size\n");