WDK + Visual Studio 2008 compiler driver configuration

Introduction


As it is known, Microsoft officially doesn't support integration of DDK with Visual Studio (any version). So we can use the Visual Studio editor (or any other text editor) for developing the source codes of a driver, but for compiling we should use the DDK build utility. Of course it is not very convenient because we must always switch between editor and console window, but the worst thing is that the developer must spend a lot of time to find lines with errors in the editor.

Background


There are several ways to compile Drivers with Visual Studio. Co. can most of them in the Find Mark Roddy nice article, Windows Driver Build Methods and Tools .

Mark offers some third party utilities. That's good, but I will show a more handy way (IMHO): how to configure and use Visual Studio for compiling drivers.

Have Fun

  1. Setup Visual Studio 2008.
  2. Setup DDK (WDK).
  3. Add to VS paths DDK include files, libs and bins.
  4. Create new empty "Win32 project" and add source file (ie HelloWorld.c).
  5. Configure project properties (All Configurations):

    1. C \ C + + - General - Debug Information Format = Program Database (/ Zi)
    2. C \ C + + - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
    3. C \ C + + - Code Generation - Enable C + + Exceptions = No
    4. C \ C + + - Code Generation - Basic Runtime Checks = Default
    5. C \ C + + - Code Generation - Buffer Security Check = No (/ GS -)
    6. C \ C + + - Advanced - Calling Convention = __stdcall (/ Gz)
    7. C \ C + + - Advanced - Compile As = Compile as C Code (/ TC) [if you are going to use plain C]
    8. Linker - General - Output File = $ (OutDir) \ $ (ProjectName). Sys
    9. Linker - General - Enable Incremental Linking = Default
    10. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $ (NOINHERIT) [add needed libs here eg ntoskrnl.lib hal.lib]
    11. Linker - Input - Ignore All Default Libraries = Yes (/ NODEFAULTLIB)
    12. Linker - Manifest File - Generate Manifest = No
    13. Linker - System - SubSystem = Native (/ SUBSYSTEM: NATIVE)
    14. Linker - System - Driver = Driver (/ DRIVER)
    15. Linker - Advanced - Entry Point = DriverEntry
    16. Linker - Advanced - Base Address = 0x10000
    17. Linker - Advanced - Randomized Base Address = Disable (/ DYNAMICBASE: NO)
    18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/ NXCOMPAT: NO)
  6. OK. Done. Now you can test it with simple code, eg:
  7. #include "ntddk.h"
    
    NTSTATUS
    DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING
    RegistryPath)
    {
    return STATUS_UNSUCCESSFUL;
    }
    

    About the Author

    Andrey Sergienko
  8. From: http://www.codeproject.com/KB/winsdk/vs2008_and_drivers.aspx

To find a Chinese version of the:

1, is to let Visual Studio 2008 to compile the driver, follow these steps:

(1) Open VS2008, click Tools -> Options; in the options bar select the list of projects and solutions -> C + + directory; in the left displays the following items in the first select include files, and in the following New D: \ WinDDK \ 6001.18002 \ inc \ api and D: \ WinDDK \ 6001.18002 \ inc \ ddk two paths (Note: D: \, please replace your WDK installation directory); and then displayed the following projects Select Library files, add the following D: \ WinDDK \ 6001.18002 \ lib \ wxp \ i386 (Note: D: \, please replace your WDK installation directory).
(2) Next is the time to create projects to do. First create a project to build the project and click project - "(project name) attribute, click the Configuration Manager and Configuration Manager to create a new configuration called the Free (new copy from the Release configuration); after the property the right side of the page select Configuration Properties -> C / C + + -> Advanced, and calling convention to __stdcall (/ Gz); then to the right of choice in the property page configuration properties -> linker, in the output of conventional file to $ (OutDir) \ $ (ProjectName). sys, in the manifest file to enable the User Account Control (UAC) to No (this is the new VS2008 features increase) in optimized code generation will be time to change the link the default value will be random address read in high default value (this is also the additional features in VS2008), and finally the command line, type:
ntoskrnl.lib
/ Base: "0x10000"
/ Entry: "DriverEntry"
/ Subsystem: native
/ Nologo
/ Stack: 0x400000, 0x1000
/ Incremental: no
/ Nodefaultlib

Original from: http://flyxxtt.blogbus.com/logs/42680411.html
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of WDK + Visual Studio 2008 compiler driver configuration

  • Development of my SSH configuration database

    Recently used at Struts1.x + Spring2.5 + Hibernate3.2 the development of an online examination system, a lot of feel! One of configuration are dependent on at a time when packet is not good hands, because the habit of using IDE, anything can be automatica

  • 6. Configuration JBoss data source

    M in the main SQL as an example: (1): add driver package Put MySQL driver mysql-connector-java-5.0.8-bin.jar copied to the% JBOSS_HOME% / server / default / lib directory (the default configuration is the default, can be altered according to the actu ...

  • AS3 with javascript interaction

    Also diverted to the HA, the longer the front of the shop more, hoping to calm down and put points trenches deepened. At AS2, the access to external variables passed to the flash can be accessed only through _root.value that simultaneously simply thr ...

  • Rails 2.0 step by step [translated statement Translate]

    Rails 2.0 step by step Rails core team in the December 7 release of the Ruby on Rails 2.0. At this version includes a lot of changes, including Rails scaffold code generation approach. This change may be under the old version will make use of the curricul

  • CentOS 5.2 on the deployment of rails applications

    Today at a newly installed server to deploy a rails small Web site, the system is Centos 5.2, the direct use of convenience of the system built-in apache and mod_rails. 1. First of all rpm -qa|grep -i ruby The system comes with the ruby version is 1.8.5,

  • fedora8 install ror

    Fedora installation of Ruby on Rails Pre-action The following are the action is for the whole process has helped, but not necessarily the way to do. 1. Modify yum server, refer to the server internal I-Shou vi / etc / yum.repos.d / fedora.repo baseur ...

  • Study Application hibernate (1)

    Basic configurations: Environment: myeclipse Version: 5.5.1 tomcat version: 5.5 1, myEclipse to adjust to the MyEclipse Database Explorer mode; a new database connection, the need for database-driven 2, myEclipse to adjust to the MyEclipse Hibernate ...

  • [Have resolved] how to give rails of the model class of congestive (include / extent module)

    Has been resolved Please visit: http://henrik.nyh.se/2008/02/rails-model-extensions 1: the introduction of new features to the controller My approach: I tried to introduce in the application controller extra modules: require "string" This "string

  • EJB ant script to deploy template works

    <? xml version = "1.0" encoding = "UTF-8"?> <! - Name Project name basedir build.xml file directory -> <project name="HelloWorld" basedir="."> <! - Property variables -> <! - The sour ...

  • RoR explained

    ROR is Ruby on Rails. Ruby is a well-known has been very good dynamic language It's dynamic language. Simple and easy. Dynamic languages are interpreted, but the performance may make a discount, but not absolute, because the application is complex, th

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries