示例#1
0
void
_gum_duk_add_properties_to_class (duk_context * ctx,
                                  const gchar * class_name,
                                  const GumDukPropertyEntry * entries)
{
  duk_get_global_string (ctx, class_name);
  duk_get_prop_string (ctx, -1, "prototype");
  _gum_duk_add_properties_to_class_by_heapptr (ctx,
      duk_require_heapptr (ctx, -1), entries);
  duk_pop_2 (ctx);
}
示例#2
0
void
_gum_duk_kernel_init (GumDukKernel * self,
                      GumDukCore * core)
{
  GumDukScope scope = GUM_DUK_SCOPE_INIT (core);
  duk_context * ctx = scope.ctx;

  self->core = core;

  duk_push_object (ctx);
  duk_push_uint (ctx, gum_kernel_query_page_size ());
  duk_put_prop_string (ctx, -2, "pageSize");
  _gum_duk_add_properties_to_class_by_heapptr (ctx,
      duk_require_heapptr (ctx, -1), gumjs_kernel_values);
  duk_put_function_list (ctx, -1, gumjs_kernel_functions);
  duk_put_global_string (ctx, "Kernel");
}
示例#3
0
void
_gum_duk_stalker_init (GumDukStalker * self,
                       GumDukCore * core)
{
  duk_context * ctx = core->ctx;

  self->core = core;
  self->stalker = NULL;
  self->queue_capacity = 16384;
  self->queue_drain_interval = 250;

  duk_push_c_function (ctx, gumjs_stalker_construct, 0);
  duk_push_object (ctx);
  duk_put_function_list (ctx, -1, gumjs_stalker_functions);
  duk_put_prop_string (ctx, -2, "prototype");
  duk_new (ctx, 0);
  _gum_duk_put_data (ctx, -1, self);
  _gum_duk_add_properties_to_class_by_heapptr (ctx,
      duk_require_heapptr (ctx, -1), gumjs_stalker_values);
  duk_put_global_string (ctx, "Stalker");
}