13

does anyone have an article how to do this ?

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
  • look at http://stackoverflow.com/questions/18981595/how-to-configure-visual-studio-2008-for-compiling-drivers/18996448#18996448 – PU. Sep 25 '13 at 09:05
  • [How to Configure Visual Studio 2008 for Compiling Drivers](http://www.codeproject.com/KB/winsdk/vs2008_and_drivers.aspx) – Kirill V. Lyadvinsky Jun 24 '09 at 09:42
  • @Bill the Lizard: how is this offtopic? This is not to find a tool or library, this is a very real-life issue driver writers have faced for over a decade before MS reintegrated driver building into VS and VisualDDK came about. Really can't understand the **rationale** pointed out in the closing. I mean even "spam" would have been a more logical choice here. – 0xC0000022L Aug 12 '14 at 13:00
  • @0xC0000022L Read the question. "does anyone have an article how to do this?" is asking for an off-site resource. – Bill the Lizard Aug 12 '14 at 13:01
  • @BilltheLizard: I read the question **and** the title. The question itself merely references the title. – 0xC0000022L Aug 12 '14 at 13:04
  • @0xC0000022L Then I don't understand where your confusion is coming from. This is not a good question and should not be reopened. – Bill the Lizard Aug 12 '14 at 13:06

7 Answers7

10

Since you gave no exact version of Visual Studio, let me give you the options I am aware of.

Visual Studio 2012, 2013 and 2015

Respective contemporary DDK/WDK versions: WDKs 8, 8.1 and 10 (as of this writing).

With the WDK for Windows 8, the WDK team at Microsoft finally offers full integration with Visual Studio again directly from Microsoft.

However, while Visual Studio 2017 exists in minor version 15.4 already by the time of this update, the WDK still requires Visual Studio 2015.

Visual Studio 2002 through 2010

Respective contemporary DDK/WDK versions: DDKs for Windows XP/2003 Server, WDKs for Windows Vista and Windows 7 with their respective service pack levels and the respective server versions.

Those versions were not officially supported by Microsoft to build drivers. The only worse choice to compile a driver would be a complete third-party toolchain (other than Intel's C compiler which was sanctioned by MS, IIRC).

It was considered very bad form to use the Visual Studio compilers during that period, and Microsoft explicitly recommended against it. However, C++ in kernel mode was also once frowned upon and now MS provides C++ frameworks for kernel mode. The times they are changin' ... ;)

Anyway, workarounds exist in the form of ddkbuild.bat and ddkbuild.cmd which use the DDK toolchain, but effectively allow you to integrate the resulting invocation from your "make" project inside Visual Studio. DDKWizard is a project creation wizard for both of those scripts. DDKWizard does not support Visual Studio 2010! The links to the two scripts provide a good documentation and DDKWizard also comes with a decent documentation.

To my knowledge ddkbuild.cmd is originally based on ddkbuild.bat and the HollisTech version can also trace its heritage back to that version from OSR.

VisualDDK combined with VirtualKD emerged later than the aforementioned, but is to be considered a far superior, more sophisticated solution. But your mileage may vary. In either case the integration into Visual Studio is far more complete in the latter solution.

Visual Studio 6

Respective contemporary DDK/WDK versions: DDKs for Windows NT 4 and Windows 2000.

Prior to the Windows XP DDK (now DDK is called WDK) the compiler was not included in the DDK, so you had to have the compiler toolchain installed. This would be the case for NT 4.0 and Windows 2000.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
7

Download and install VisualDDK and you'll be able to create driver projects and debug drivers directly from Visual Studio.

1

If you want to use DDK build and WDK use ddkbuild.bat, it is pretty good (I think most of it works still) that should have you going. Alternatively check out ddkbuild.cmd from OSR.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
CrazyChris
  • 106
  • 2
  • 6
1

The ddkbuild from OSR-Online is a nice alternative ddkbuild download link.

Christopher
  • 8,912
  • 3
  • 33
  • 38
1

create a makefile project and use the following as the build command:

pushd .  
call C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1\ chk x86 WXP no_oacr   
popd  
build -cgwiz  

(obviously tweak the arguments to setenv to suit)

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
  • Looks like cargo-cult programming to me. You should have explained the parameters and which ones are available. – 0xC0000022L Dec 10 '13 at 00:10
  • made me giggle that; "setenv /?" will tell you the parameters. The specifics will depend on what you are trying to do and that is not stated in the question.... it's a cargo cult question perhaps.... –  Aug 12 '14 at 12:54
  • the base path of the WDK, the build config, the target OS and the flags are therefore "too specific", I reckon? – 0xC0000022L Aug 12 '14 at 12:57
  • 1
    i should have explained my giggle; this stuff is well documented - stackoverflow is the place to go for cargo cult programming; for everything else there is the WDK documentation. Let's go - there are more interesting problems! 0xc00000bc :-) –  Aug 12 '14 at 13:28
  • 1
    lol, ack. `0x00000080L` – 0xC0000022L Aug 12 '14 at 14:39
1

To build my driver i used VisualDDK in visual studio 2008. In the beginning i start debugging using my computer and virtualBox machine but when i launch the debugging process in visual studio, my virtual machine did not show me the external ip address(normally should show me 192.168.1.102 and 10.0.1.15 in DDKLauncherMonitor but it show me only 10.0.1.15 ).

I stopped using virtual machine and i decide to use real computer. In the second computer i launched DDKLauncherMonitor. And i start debugging from my first computer. I received Udp package in my second machine and also the driver.sys. But when i tried to load the driver from visual studio(First computer) nothing work. Plus this, in the second machine tell me "Windows required digitally signed driver".

There is same one meet this kind of problem and he/she can help.

Mourad Karim
  • 161
  • 1
  • 1
  • 11
0

In VS create a makefile project. Add your sources, headers, makefile and sourcefile. Open project properties->Configuration properties->NMake->Build Command Line and write:

call $(WINDDK)\bin\setenv.bat $(WINDDK) fre wnet
cd /d $(ProjectDir)
build.exe -I

Now you can build from VS. The advantage of the makefile project: it provides you with as many configurations as you need (w2k, wxp, wnet, wlh and etc) and you can build from the DDK command line.

P.S. fre wnet - is a sample configuration, use what is required for your project. It is good to have both fre and chk configurations. WINDDK - environment variable with a path to the DDK root.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
Sergey Podobry
  • 7,101
  • 1
  • 41
  • 51