Microsoft like to make it so you can’t compile drivers with visual studios and have to use an external program to do it. This is how you set it up so you can compile drivers (tested on visual studio 2010).

First you probably need an earlier version of the DDK if you are going to target drivers and XP+ so I suggest the windows server 2003 DDK, you can get it here:

Once you have installed it to whatever location you choose you should see a folder called “WinDDK” with a subfolder like “3790.1830” inside. This is what we need. Please note i will be using “C:\WinDDK” as my directory, you may have to change it.

Now you are ready to setup Visual Studio 2010 to work with it. Open it up and create a new Win32 Application. You need to set it up as a DLL and select empty project like so.

Once that is done go to “Build > Configuration Manager” Then set the top left box to release.

Now to set up Visual Studio to work with the DDK.

Configuration Properties > General

C\C++ > General
C:\WinDDK\3790.1830\inc\ddk\wxp; C:\WinDDK\3790.1830\inc\wxp; C:\WinDDK\6001.18001\inc\; C:\WinDDK\6001.18001\inc\crt;

C\C++ > Code Generation

Linker > General
C:\WinDDK\3790.1830\lib\wxp\i386\;

Linker > Input
uuid.lib; ndis.lib; ntoskrnl.lib; int64.lib; hal.lib;

Linker > Manifest File

Linker > System

Linker > System

Linker > Advanced

Now if all was done correctly you should be able to add a new c file (remember to set extension to .c) then paste in the following code and it should compile.

Code:
#define _X86_
#include <ntddk.h>


NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
	DbgPrint("Hello World");
}


might help

Advertisements