Esempio n. 1
0
static void
gum_darwin_mapper_init_dependencies (GumDarwinMapper * self)
{
  GumDarwinModule * module = self->module;
  GPtrArray * dependencies;
  guint i;

  self->dependencies = g_ptr_array_sized_new (5);

  if (self->parent == NULL)
  {
    self->mappings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
        (GDestroyNotify) gum_darwin_mapping_free);
    gum_darwin_mapper_add_pending_mapping (self, module->name, self);
    gum_darwin_enumerate_modules (module->task,
        gum_darwin_mapper_add_existing_mapping_from_module, self);
  }

  dependencies = module->dependencies;
  for (i = 0; i != dependencies->len; i++)
  {
    GumDarwinMapping * dependency;

    dependency = gum_darwin_mapper_resolve_dependency (self,
        g_ptr_array_index (dependencies, i));
    g_ptr_array_add (self->dependencies, dependency);
  }
}
Esempio n. 2
0
void
gum_darwin_enumerate_exports (mach_port_t task,
                              const gchar * module_name,
                              GumFoundExportFunc func,
                              gpointer user_data)
{
    GumEnumerateExportsContext ctx;

    ctx.task = task;
    ctx.modules = g_hash_table_new_full (g_str_hash, g_str_equal,
                                         g_free, (GDestroyNotify) g_variant_unref);
    ctx.module_name = module_name;
    ctx.func = func;
    ctx.user_data = user_data;

    gum_darwin_enumerate_modules (task, gum_store_module_address, &ctx);

    gum_do_enumerate_exports (&ctx, module_name);

    g_hash_table_unref (ctx.modules);
}