The blog continues at suszter.com/ReversingOnWindows

June 24, 2013

Sample Pintools for Visual Studio

Creating a Visual Studio Project for Pintools (32-bit)

  • Start Visual Studio 2010 and create a new Win32 Project.
  • In the Win32 Application Wizard, select DLL for Application type, and tick Empty project in the Additional options.
  • Create directory Pin in the Solution folder and copy Pin framework here.
  • Copy Pin\source\tools\ManualExamples\inscount0.cpp to the Project folder. This is a sample Pintools file. Add the copied inscount0.cpp to the project.
  • Set Active Configuration to Release.
  • Add the following to the Additional Include Directories:
$(SolutionDir)Pin\source\include\pin;$(SolutionDir)Pin\source\include\pin\gen;$(SolutionDir)Pin\extras\xed2-ia32\include;$(SolutionDir)Pin\extras\components\include;%(AdditionalIncludeDirectories)
  • Add the following to the Additional Library Directories:
$(SolutionDir)Pin\ia32\lib;$(SolutionDir)Pin\ia32\lib-ext;$(SolutionDir)Pin\extras\xed2-ia32\lib;%(AdditionalLibraryDirectories)
  • Add the following to the Preprocessor:
TARGET_WINDOWS
TARGET_IA32
HOST_IA32
  • Set Enable C++ Exceptions to No, and set Runtime Library to Multi-threaded (/MT).
  • Add the following to the Additional Dependencies in the Linker settings:
ntdll-32.lib
libxed.lib
pin.lib
pinvm.lib
libcmt.lib
libcpmt.lib
  • Set Ignore All Default Libraries to Yes (/NODEFAULTLIB).
  • Set Entry Point to Ptrace_DllMainCRTStartup@12.
  • Add the following to the Additional Options of the Command Line linker option:
/EXPORT:main

Downloading&Building Sample Pintools for Visual Studio

  • To download Sample Pintools Project created with the above settings click here [SkyDrive].
  • Open the solution file in Visual Studio and set the active configuration to Release.
  • Create directory Pin in the Solution folder and copy Pin framework here.
  • Copy Pin\source\tools\ManualExamples\inscount0.cpp to the Project folder. This is a sample Pintools file.
  • Build the project.
  This blog is written and maintained by Attila Suszter. Read in Feed Reader.