Hello,

After first experimentations with the DynsinstAPI, I would like to use PatchAPI in order to develop a fine-grained binary editing solution. Unfortunately, at the moment, I have troubles with the extension of the Snippet class:

For the beginning, I would like to simply include some raw bytes into an existing binary to be edited. I have followed the recently posted issue concerning the same topic (https://www-auth.cs.wisc.edu/lists/dyninst-api/2014/msg00061.shtml) and wondered whether you could provide me with some existing binary modification examples, as well. As can be seen in the code below, my current test-implementation is based on the above mentioned issue, which is as well provided by the PatchAPI documentation - in more or less same detail.

The following code produces errors during compilation at the point when the snippet-pointer is created. Error message: "static Dyninst::PatchAPI::Snippet::Ptr Dyninst::PatchAPI::Snippet::create(Dyninst::PatchAPI::Snippet*)' is inaccessible within this context"

---

class MySnippet : Snippet {
public:
    virtual bool generate(Point *point, Buffer &buf) {
        buf.copy((void*)"BBBBBBBBBBBBBBBBBBBB", 20);

        return true;
    }
};

...

/* The folowing line leads to errors during compilation */
MySnippet::Ptr snippet = MySnippet::create(new MySnippet());

Point *point = mgr->findPoint(Location::Instruction(b, b->last()), Point::BlockExit);

Patcher patcher(mgr);
patcher.add(PushBackCommand::create(point, snippet));
patcher.commit();

---

I would really appreciate it if you could help me with my concern.
Thank you very much in advance.

Best regards,
Sergej

PS: I am using the DynsinstAPI bundle version 8.1.2 (including ParseAPI, PatchAPI, ...).



_______________________________________________
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

Reply via email to