1This documentation explains how to compile Capstone on Windows using 2Microsoft Visual Studio version 2010 or newer. 3 4To compile Capstone on *nix, see COMPILE.TXT 5 6To compile Capstone with CMake, see COMPILE_CMAKE.TXT 7 8 *-*-*-*-*-* 9 10Capstone requires no prerequisite packages with default configurations, so it is 11easy to compile & install. Open the Visual Studio solution "msvc/capstone.sln" 12and follow the instructions below. 13 14NOTE: This requires Visual Studio 2010 or newer versions. 15 16If you wish to embed Capstone in a kernel driver, Visual Studio 2013 or newer 17versions, and Windows Driver Kit 8.1 Update 1 or newer versions are required. 18 19 20(0) Tailor Capstone to your need. 21 22 Out of 8 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC, Sparc, 23 SystemZ, X86 & XCore), if you just need several selected archs, choose the ones 24 you want to compile in by opening Visual Studio solution "msvc\capstone.sln", 25 then directly editing the projects "capstone_static" & "capstone_dll" for static 26 and dynamic libraries, respectively. This must be done before going to the next 27 steps. 28 29 In VisualStudio interface, modify the preprocessor definitions via 30 "Project Properties" -> "Configuration Properties" -> "C/C++" -> "Preprocessor" 31 to customize Capstone library, as followings. 32 33 - CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support. 34 - CAPSTONE_HAS_ARM64: support ARM64. Delete this to remove ARM64 support. 35 - CAPSTONE_HAS_MIPS: support Mips. Delete this to remove Mips support. 36 - CAPSTONE_HAS_PPC: support PPC. Delete this to remove PPC support. 37 - CAPSTONE_HAS_SPARC: support Sparc. Delete this to remove Sparc support. 38 - CAPSTONE_HAS_SYSZ: support SystemZ. Delete this to remove SystemZ support. 39 - CAPSTONE_HAS_X86: support X86. Delete this to remove X86 support. 40 - CAPSTONE_HAS_XCORE: support XCore. Delete this to remove XCore support. 41 42 By default, all 8 architectures are compiled in. 43 44 45 Besides, Capstone also allows some more customization via following macros. 46 47 - CAPSTONE_USE_SYS_DYN_MEM: delete this to use your own dynamic memory management. 48 - CAPSTONE_DIET_NO: rename this to "CAPSTONE_DIET" to make the binaries more compact. 49 - CAPSTONE_X86_REDUCE_NO: rename this to "CAPSTONE_X86_REDUCE" to make X86 binary smaller. 50 - CAPSTONE_X86_ATT_DISABLE_NO: rename this to "CAPSTONE_X86_ATT_DISABLE" to disable 51 AT&T syntax on x86. 52 53 By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE 54 modes are disable. 55 56 57 For each option, refer to docs/README for more details. 58 59 60 61(1) Compile from source on Windows with Visual Studio 62 63 - Choose the configuration and the platform you want: Release/Debug & Win32/Win64. 64 - Build only the libraries, or the libraries along with all the tests. 65 - "capstone_static_winkernel" is for compiling Capstone for a driver and 66 "test_winkernel" is a test for a driver, and those are excluded from build by 67 default. To compile them, open the Configuration Manager through the [Build] 68 menu and check "Build" check boxes for those project. 69 70 71 72(2) You can make sure the prior steps successfully worked by launching one of the 73 testing binary (test*.exe). 74 75 The testing binary for a driver "test_winkernel.sys" is made up of all tests for 76 supported architectures configured with the step (0) along side its own tests. 77 Below explains a procedure to run the test driver and check test results. 78 79 On the x64 platform, the test signing mode has to be enabled to install the test 80 driver. To do it, open the command prompt with the administrator privileges and 81 type the following command, and then restart the system to activate the change: 82 83 >bcdedit /set testsigning on 84 85 Test results from the test driver is sent to kernel debug buffer. In order to 86 see those results, download DebugView and run it with the administrator 87 privileges, then check [Capture Kernel] through the [Capture] menu. 88 89 DebugView: https://technet.microsoft.com/en-us/sysinternals/debugview.aspx 90 91 To install and uninstall the driver, use the 'sc' command. For installing and 92 executing test_winkernel.sys, execute the following commands with the 93 administrator privileges: 94 95 >sc create test_winkernel type= kernel binPath= <full path to test_winkernel.sys> 96 [SC] CreateService SUCCESS 97 98 >sc start test_winkernel 99 [SC] StartService FAILED 995: 100 101 The I/O operation has been aborted because of either a thread exit or an application request. 102 103 To uninstall the driver, execute the following commands with the administrator 104 privileges: 105 106 >sc delete test_winkernel 107 >bcdedit /deletevalue testsigning 108