void mapfile_apply(list_t* names) { TCHAR* undecorated; ULONG total = 0, filtered = 0, applied = 0, addr; int err, result; name_t* nm, *nm_last; list_t* rmtable; module_t* module = module_info(&err); if (!err) { Addtolist(0, 0, "Applying names from map file to module '%s'", module->name); if (!g_Config->collisionchecks) { rmtable = list_create(); } nm = (name_t*)names->first; while (nm) { if (nm->segment < module->nseg) { if (g_Config->demangle) { undecorated = (TCHAR*)malloc(2 * nm->size * sizeof(TCHAR)); if (result = Demanglename(nm->buffer, NM_LIBRARY, undecorated)) { free(nm->buffer); nm->size = result + 1; nm->buffer = undecorated; } else { free(undecorated); } } addr = module->base + module->segments[nm->segment] + nm->offset; if (g_Config->usemasks) { if (result = mask_filter(nm)) { filtered++; if ((result & FILTER_SKIP) && !g_Config->collisionchecks && /* Findname for NM_ANYNAME fails everytime, dunno why */ (Findname(addr, NM_COMMENT, NULL) || Findname(addr, NM_LABEL, NULL))) { list_addname(rmtable, NULL, 0, nm->segment, nm->offset); total++; nm = nm->next; continue; } } } if (g_Config->comments) { if (g_Config->collisionchecks) { if (!Findname(addr, NM_COMMENT, NULL) && !Quickinsertname(addr, NM_COMMENT, nm->buffer)) { applied++; } } else if (!Quickinsertname(addr, NM_COMMENT, nm->buffer)) { applied++; } } if (g_Config->labels) { if (g_Config->collisionchecks) { if (!Findlabel(addr, NULL) && !Quickinsertname(addr, NM_LABEL, nm->buffer)) { applied++; } } else if (!Quickinsertname(addr, NM_LABEL, nm->buffer)) { applied++; } } } total++; Progress(total * 1000 / names->count, "Inserting names"); nm = nm->next; } Progress(0, ""); Infoline("Merging names"); Mergequicknames(); if (!g_Config->collisionchecks) { Infoline("Cleaning skipped entries"); nm = (name_t*)rmtable->first; while (nm) { addr = module->base + module->segments[nm->segment] + nm->offset; if (g_Config->comments) { Insertname(addr, NM_COMMENT, ""); } if (g_Config->labels) { Insertname(addr, NM_LABEL, ""); } nm_last = nm; nm = nm->next; /* Manual list_freenames expansion to speed it up somehow */ free(nm_last); } } Infoline("Total loaded: %d, Names applied: %d, Names filtered: %d", total, applied, filtered); Addtolist(0, -1, " Total loaded: %d, Names applied: %d, Names filtered: %d", total, applied, filtered); module_free(module); } else { module_error(err); } }
static void kitchen_sink(SkPaint* paint) { color_filter(paint); path_effect(paint); mask_filter(paint); }