How to Compile and Run PeToPe
The complete PeToPe sample, including a Visual Studio 2008 project file, is in the CCI Metadata source tree under the Samples folder.
To compile and run PeToPe:
- If you have not done so already, download the CCI Metadata source tree. For details on how to download the CCI Metadata sources, see
- In the source tree’s root folder, double-click the tree’s Visual Studio 2008 solution file, Metadata.sln. This solution encompasses the entire source tree, including the samples.
- If you have not done so already, build the entire source tree. This builds the CCI Metadata DLLs that the sample requires, along with the PeToPe application, PeToPe.exe.
- To view the complete PeToPe source code, go to Solution Explorer and expand the Samples folder, which contains all the CCI Metadata samples.
- To run PeToPe, open a command window, navigate to the PeToPe project’s bin\Debug folder, and run PeToPe.exe against a .NET DLL or EXE.
The following example runs PeToPe against one of the CCI MetadataHelper DLLs and its associated PDB file, which are in the PeToPe project’s Debug folder.
PeToPe creates copies of the DLL and PDB files and names them Microsoft.Cci.MetadataHelper.dll.pe and Microsoft.Cci.MetadataHelper.dll.pdb.
You do not explicitly pass a PDB file to PeToPe. Instead, PeToPe assumes that the PDB file has the same name as the input PE file (except for the extension), and is located in the same folder. If the folder doesn’t contain an appropriately named
PDB file, PeToPe simply makes a copy of the input PE file.