Skip to content

Commit

Permalink
add how to compile winkernel and run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tandasat committed Apr 23, 2016
1 parent d45d7e3 commit b85b44e
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions COMPILE_MSVC.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ To compile Capstone with CMake, see COMPILE_CMAKE.TXT

*-*-*-*-*-*

Capstone requires no prerequisite packages, so it is easy to compile & install.
Open the Visual Studio solution "msvc/capstone.sln" and follow the instructions
below.
Capstone requires no prerequisite packages with default configurations, so it is
easy to compile & install. Open the Visual Studio solution "msvc/capstone.sln"
and follow the instructions below.

NOTE: This requires Visual Studio 2010 or newer versions.

If you wish to embed Capstone in a kernel driver, Visual Studio 2013 or newer
versions, and Windows Driver Kit 8.1 Update 1 or newer versions are required.


(0) Tailor Capstone to your need.

Out of 8 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC, Sparc,
SystemZ, X86 & XCore), if you just need several selected archs, choose the ones
you want to compile in by opening Visual Studio solution "msvc\capstone.sln",
then directly editing the projects "capstone_static" & "capstone_dll" for static
and dynamic libraries, respectively. This must be done before going to the
next steps.
and dynamic libraries, respectively. For compiling Capstone for a driver, reload
"capstone_static_winkernel" first and then edit the project. This must be done
before going to the next steps.

In VisualStudio interface, modify the preprocessor definitions via
"Project Properties" -> "Configuration Propertis" -> "C/C++" -> "Preprocessor"
Expand Down Expand Up @@ -58,9 +62,44 @@ NOTE: This requires Visual Studio 2010 or newer versions.
(1) Compile from source on Windows with Visual Studio

- Choose the configuration and the platform you want: Release/Debug & Win32/Win64.
- Build only the libraries, or the libraries along with all the tests.
- Build only the libraries, or the libraries along with all the tests. To build
tests for a driver, reload the "test_winkernel" project first and compile it.



(2) You can make sure the prior steps successfully worked by launching one of the
testing binary (test*.exe).

The testing binary for a driver "test_winkernel.sys" is made up of all tests for
supported architectures configured with the step (0) along side its own tests.
Below explains a procedure to run the test driver and check test results.

On the x64 platform, the test signing mode has to be enabled to install the test
driver. To do it, open the command prompt with the administrator privileges and
type the following command, and then restart the system to activate the change:

>bcdedit /set testsigning on

Test results from the test driver is sent to kernel debug buffer. In order to
see those results, download DebugView and run it with the administrator
privileges, then check [Capture Kernel] through the [Capture] menu.

DebugView: https://technet.microsoft.com/en-us/sysinternals/debugview.aspx

To install and uninstall the driver, use the 'sc' command. For installing and
executing test_winkernel.sys, execute the following commands with the
administrator privileges:

>sc create test_winkernel type= kernel binPath= <full path to test_winkernel.sys>
[SC] CreateService SUCCESS

>sc start test_winkernel
[SC] StartService FAILED 995:

The I/O operation has been aborted because of either a thread exit or an application request.

To uninstall the driver, execute the following commands with the administrator
privileges:

>sc delete test_winkernel
>bcdedit /deletevalue testsigning

0 comments on commit b85b44e

Please sign in to comment.