UPDATE: the described problems in compiling the default PIN projects seems to be fixed in the new PIN release: 3.10.
PIN (of Intel) is a great platform for dynamic binary instrumentation. I use it on daily for tracing and deobfuscating malware, and I often recommend it to others. Unfortunately, figuring out how to set it up is not so straight-forward. If you want to compile the default projects that are distributed in the package, you may get multiple errors.
I never saw the full process of fixing them documented. I struggled with this myself, and from time to time people approach me asking for help. That’s why, I decided to make a walk-through, describing all the steps I did in order to get a tool compiled.
-
- Used PIN package:
- pin-3.7-97619-g0d0c92f4f-msvc-windows (link)
- Environment:
- Microsoft Visual Studio Community 2017 (Version 15.6.5)
- Windows 8.1 64bit
- Used PIN package:
Step 0 – I downloaded the PIN package and unpacked it into C:\pin\
I will be compiling MyPinTool, that is a part of the PIN Package:
Step 1 – I opened the single tool in Visual Studio and tried to compile it.
I got an error:
So, I searched the pin main directory, and I found where this file is. It was in “C:\pin\extras\xed-ia32\include\xed” (we need to pick a 32 bit version for a 32 bit build).
So, I included that folder:

[C/C++] -> [General] -> [Additional Include Directories]
So, I went to disable SAFESEH. From:

[Linker] -> [Advanced] -> [Image Has Safe Exception Handlers]

[Linker] -> [Advanced] -> [Image Has Safe Exception Handlers] -> [No]
I googled for those errors and I found this blog. Following the advice, I solved it by adding “crtbeginS.obj” to additional dependencies:

[Linker] -> [Input] -> [Additional Dependencies] -> add: crtbeginS.obj
I can only say that it was the nastiest part of PIN, and now it should go much easier. There are various sample projects included in the package, very helpful in learning the functionality.
To make working with it even easier, I made some scripts that are adding PIN along with my favorite tracer to the context menu. Thanks to them, I can start tracing any EXE just by one click. You can find them here.
Appendix
- Dynamic Binary Instrumentation Primer – more about Pin, and the technique of Dynamic Binary Instrumentation (DBI)
- [VIDEO] Tracing executables with a Pin Tool (tiny_tracer)
This is interesting! I’m not sure how PIN is superior to other tools and what are it’s advantages but I’m going to check it out.
Thanks
Thanks for the clear instructions and the shell integration tip! Works perfectly.
thanks!!
Thank you so much! This helped me a lot in my thesis research.
Pingback: Intel PIN: Dynamic Binary Analiz aracı - Manalysiz