Instrumenting a function
Hi,
I am trying to inject code into a binary. The code to be injected passes a string from the binary to a function. This function contains the code that needs to be inserted after a particular point in the binary. I am trying to find instrumentation examples that show how this is done. The AddNop example in the samples directory inside Phoenix adds a single Nop operand after every valid instruction.
// Create a new Nop
Phx.IR.
ValueInstruction nop =Phx.IR.
ValueInstruction.New(functionUnit, Phx.Common.Opcode.Nop);// Insert it before the instructioninstruction.InsertBefore(nop);
// Let lower find right instruction opcode.functionUnit.Lower.Instruction(nop);
My question is that if I want to inject a whole function after an instruction in my binary, do I need to individually add every instruction. Is it possible to have a dll which contains my function and somehow link to it?
Thanks in Advance!

