Back to Home

Building the Microsoft Detours library for Visual Studio 2008

detours

Building the Microsoft Detours library for Visual Studio 2008

    They already wrote about the excellent Microsoft Detours library here . Its capabilities are really impressive, there is only one thing: the library needs to be assembled from source (which is not typical for libraries on the Windows platform, and especially for Microsoft products). Moreover, it’s hard to find a clear instruction on how to do this (I still couldn’t), and a regular make-file when building using Visual Studio 2008 gives a bunch of errors. Having finally collected Detours, I decided to write (for myself - for the future) assembly instructions. If she saves someone a couple of minutes - I will be glad.

    1. Download Microsoft Detours .
    2. Install (all by default).
    3. Go to the project folder, open the samples \ common.mak file in any text editor (I have the full path to this file: C: \ Program Files \ Microsoft Research \ Detours Express 3.0 \ samples \ common.mak ). Attention - if you use Vista \ Win7 with UAC enabled, you will need an editor running with administrator privileges (“Run as administrator”).
    4. Find the line
      rc /nologo /fo$(@) /i$(INCD) $(*B).rc
      and replace it with
      rc /fo$(@) /i$(INCD) $(*B).rc

      those. remove "/ nologo"
    5. We launch the Visual Studio console with administrator privileges: Start-> All programs-> Microsoft Visual Studio 2008-> Visual Studio Tools-> Visual Studio 2008 Command Prompt - “Run as administrator”
    6. Go to the Microsoft Detours folder
      cd "C:\Program Files\Microsoft Research\Detours Express 3.0"
    7. Declare an environment variable with the target platform
      set DETOURS_TARGET_PROCESSOR=x86
    8. Build
      nmake all

    At the output, we get the assembled library and all the examples from the samples folder.
    Good luck to use.

    Read Next