分类: C/C++
2009-03-05 18:29:31
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, .
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.
Setup Visual Studio 2008.
Setup DDK (WDK).
Add to VS paths DDK include files, libs and bins.
Create new empty "Win32 project" and add source file (i.e. HelloWorld.c).
Configure project properties (All Configurations):
OK. Done. Now you can test it with simple code, e.g.:
#include "ntddk.h"
NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING
RegistryPath)
{
return STATUS_UNSUCCESSFUL;
}
Visual Studio + DDK - it's cool! :)