PeToPe Sample Walkthrough

CCI Metadata

PeToPe is a console application that demonstrates the basic structure of a Common Compiler Infrastructure (CCI) Metadata rewriting application. Such applications typically:
  1. Take an input assembly or module. For simplicity, this walkthrough assumes an input assembly. PeToPe handles modules in the same way.
  2. Modify the assembly, for example, by inserting code into method bodies.
  3. Write the modified assembly back to storage.
PeToPe performs steps 1 and 3, but does not modify the assembly.

PeToPe uses the programming pattern that is described in the following set of topics:

Create a Host
Load the Assembly
Write the Results to Storage

For details on how to obtain the PeToPe sample, see How to Compile and Run PeToPe.

Create a Host

The CCI libraries are not associated with any particular application environment. From a CCI perspective, issues such as file locations or the targeted .NET version are matters of application policy. An application host object handles the details of implementing application policies and presents the results to CCI through a standard interface.

PeToPe uses the default host, and the host creation code is identical to that used by the HelloIL example. See Create a Host for details. For a general discussion of hosts, see Hosts.

Next: Load the Assembly

Last edited Jan 12, 2010 at 3:14 PM by Guy_Smith, version 1

Comments

No comments yet.