Click here to Skip to main content
13,297,048 members (59,604 online)
Click here to Skip to main content
Add your own
alternative version


55 bookmarked
Posted 18 Dec 2008

How to Configure Visual Studio 2008 for Compiling Drivers

, 18 Dec 2008
Rate this:
Please Sign up or sign in to vote.
How to configure Visual Studio 2008 for compiling drivers without using DDK's console tools.


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.


There are several ways to compile drivers with Visual Studio. You can find most of them in the nice Mark Roddy 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 (i.e. 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 e.g. 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, e.g.:

    #include "ntddk.h"

Points of Interest 

Visual Studio + DDK - it's cool! :) 


  • 18th December, 2008: First post 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Andrey Sergienko
President anseko
Ukraine Ukraine
Born 7 Apr 1980 in Bulgan (Mongolia).
2004 - Master of Computer Sciences, Kharkiv National University of Radioelectronics.
Now live in Poltava (Ukraine).

You may also be interested in...

Comments and Discussions

Bug[My vote of 1] My Vote of 1 Pin
Member 963207716-Jul-13 10:13
memberMember 963207716-Jul-13 10:13 
GeneralRe: [My vote of 1] My Vote of 1 Pin
Member 102420899-Oct-13 6:43
memberMember 102420899-Oct-13 6:43 
GeneralRe: [My vote of 1] My Vote of 1 Pin
Assarbad9-Jul-17 1:40
memberAssarbad9-Jul-17 1:40 
GeneralMy vote of 5 Pin
gndnet22-Oct-12 2:20
membergndnet22-Oct-12 2:20 
Question5 Pin
kostay_scr16-Aug-12 5:17
memberkostay_scr16-Aug-12 5:17 
QuestionDDKWizard vs. VisualDDK Pin
Will217-May-12 7:47
memberWill217-May-12 7:47 

I am about to start writing some legacy kernel driver code. Could someone shares experience of using VisualDDK vs. DDKWizard in the context of kernel driver development in VS 2008.

Thanks in advance.
AnswerRe: DDKWizard vs. VisualDDK Pin
Assarbad9-Jul-17 1:38
memberAssarbad9-Jul-17 1:38 
GeneralOr you use DDKWizard? ... Pin
Assarbad26-Feb-09 13:35
memberAssarbad26-Feb-09 13:35 
GeneralRe: Or you use DDKWizard? ... Pin
Andrey Sergienko14-Mar-10 4:57
memberAndrey Sergienko14-Mar-10 4:57 
GeneralBe carefully Pin
alexd77776-Jan-09 4:09
memberalexd77776-Jan-09 4:09 
GeneralMy vote of 1 Pin
brucelee23-Dec-08 4:31
memberbrucelee23-Dec-08 4:31 
GeneralRe: My vote of 1 Pin
Andrey Sergienko14-Mar-10 4:56
memberAndrey Sergienko14-Mar-10 4:56 
GeneralMy vote of 1 Pin
Jack Knife23-Dec-08 2:02
memberJack Knife23-Dec-08 2:02 
GeneralRe: My vote of 1 Pin
bodewig24-Mar-10 4:10
memberbodewig24-Mar-10 4:10 
GeneralHi Pin
Andrey Sergienko18-Dec-08 22:55
memberAndrey Sergienko18-Dec-08 22:55 
GeneralDelete this !, this is a 1 Pin
_elli_18-Dec-08 21:09
member_elli_18-Dec-08 21:09 
GeneralMy vote of 1 Pin
_elli_18-Dec-08 21:03
member_elli_18-Dec-08 21:03 
GeneralMy vote of 2 Pin
Josh_Jackson18-Dec-08 15:58
memberJosh_Jackson18-Dec-08 15:58 
GeneralMy vote of 1 Pin
poltrone18-Dec-08 8:16
memberpoltrone18-Dec-08 8:16 
GeneralRe: My vote of 1 Pin
yafan18-Dec-08 8:23
memberyafan18-Dec-08 8:23 
QuestionMakefile project? Pin
Alex Fr18-Dec-08 4:24
memberAlex Fr18-Dec-08 4:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 18 Dec 2008
Article Copyright 2008 by Andrey Sergienko
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid