Various issues when rewriting function

11 views
Skip to first unread message

Stanisław Pitucha

unread,
Nov 27, 2011, 9:52:31 AM11/27/11
to apparat-framework
Hi all,
I've got a couple of questions regarding function rewriting. I run
into 3 problems:

1. When a symbol is not available in SWF yet, I get an exception when
trying to introduce it (for example when adding a PushString that
wasn't available anywhere else before) Is there some way to register
new symbols?

2. Following example of Stripper tool, I've got a main loop that looks
like:

for {
method <- abc.methods
body <- method.body
bytecode <- body.bytecode
} {
bytecode rewrite something
bytecode rewrite somethingElse
...
}

But when I try to get the name of the method, it's always `null`. Why
is that? How can I get a name of the method (I only want to apply
something in one, but not the other)

3. How can I completely rewrite a function? Is that possible? Even
better, is there a way to load a result of asmifier that I modified by
hand and use that as some function instead?

Thanks for any ideas.

Joa Ebert

unread,
Nov 27, 2011, 10:31:13 AM11/27/11
to apparat-...@googlegroups.com
1) Symbols need to be part of the constant pool. You can ask Apparat to rebuild the constant pool.

2) Methods do not have a name. Only if you compile with -debug=true. However a trait has a qualified name associated with it and that's what you are looking for.

3) Sure you can rewrite whatever you want. But maybe an already existing tool like TDSI is enough for you. You can write __asm instructions as actual ActionScript code and TDSI will turn those into real bytecode.

If you really want to rewrite whole methods you need to understand the SWF/ABC format a little bit more. But Apparat gives you all the tools to do that.


Best,

Joa

2011/11/27 Stanisław Pitucha <vira...@gmail.com>
Reply all
Reply to author
Forward
0 new messages