Hi Shady,
Let's start from the beginning.
WDK (Windows Driver Kit) is a fully integrated driver development system for the Microsoft Windows platforms. The kit contain samples, documentation, tools and most important the build environments.
If you want Visual Studio to use WDK files, you will have to tell VS where to fine them.
The default installation directories of WDK header and library files are:
WDKInstallationPath\BuildNumber\ inc
and
WDKInstallationPath\BuildNumber\ lib
Setting it up is easy.
I'll show you how to do it under VS2005 and you can adapt it to the version you are using.
1. Run VS2005
2. Select Tools->Options->Project and Solutions->VC++ Directories
3. On the right side choose Include file (from show directories from)
4. Add WDKInstallationPath\BuildNumber\ inc to the list
5. On the right side choose Library file (from show directories from)
6. Add WDKInstallationPath\BuildNumber\ lib to the list
7. Press OK
You're done.
Now when you include a header file from WDK (like ntddk.h), VS will look for it according to the directories you've selected.
After you write your driver, You will need to create 2 more files to be able to build it.
The first file is a simple text file contain a single line which you should NEVER change.
Code:
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirect to the real make file
# that is shared by all the driver components of the Windows NT DDK
!INCLUDE $(NTMAKEENV)\makefile.def
Name the file:
makefile
It is very important that the makefile WILL NOT have an extention after the file name (My advice is to allow windows to show file extensions from the folder options).
The second file is another text file (again with no file extention) called sources which is simply a list of source files and builds options.
It contains the (minimum) following lines:
Code:
TARGETNAME = myapp
TARGETPATH = obj
TARGETTYPE = DRIVER
INCLUDES =..\inc // Set it to the include dir
LIBS=..\lib // Set it to the lib dir
SOURCES= main.c
send.c
recv.c
...
To build the driver simply open the WDK build command prompt (Checked Build Environment) from Windows start menu and go to your application directory.
Finally run the command build.exe.
You're driver is built and ready to use.
Best regards
Doron Moraz