Building NT kernel mode drivers in MS Visual Studio 8.0 (VS 2005)
Let's continue. I'm publishing detailed step-by-step instruction for creating
NT kernel-mode driver project in MS Visual Studio 8.0
Contents
- set environment variables
- create project
- adding files.
Note: add files before configuring project. Othervise VS may not
show some important options.
- change project settings
- sample:
Warning: filesize() [function.filesize]: stat failed for /usr/local/www/data/alter//../../..//docs/nt_kernel/vc6_proj/driver_template_v7.rar in /var/home/alter/html/common.inc.php on line 385
Warning: filesize() [function.filesize]: stat failed for /usr/local/www/data/alter//../../..//docs/nt_kernel/vc6_proj/driver_template_v7.tgz in /var/home/alter/html/common.inc.php on line 386
driver_template_v7.rar/tgz ( bytes/ bytes) in pch_cpp subdirectory
Set environment variables
Set BASEDIRNT4, BASEDIR2K, BASEDIRXP, BASEDIR2K3 environment variables (I would recommend system ones,
not user-specific) like this:
BASEDIRNT4 = C:\Develop\DDKNT4
BASEDIR2K = C:\Develop\DDK2000
BASEDIRXP = C:\Develop\DDKXP
BASEDIR2K3 = C:\Develop\DDK2003
Set BASEDIR environment variable to point to your favorite DDK (I prefer NT4, because I'm writing highly compatible drivers).
But latest time DDK 2003 is oftenly used. So we shall tune template project for DDK 2003.
See migrating VC6 driver project to VC8 with DDK 2003 for DDK 2003 specific details.
BASEDIR = %BASEDIR2K3%
Create project
-
File -> New... -> Project
-
Chose Visual C++ -> Win32 in Project Types tree.
-
Chose Win32 Project in Templates list.
-
Enter project name, directory path and solution name. As usually. You can also uncheck Create directory for solution
box. Then both project file (.VCPROJ) and .SLN will be created in same directory. By default Visual Studio 8 creates separate
subdirectory for project.
-
OK -> DLL, Empty project -> Finish
Adding files
-
Just add files to your project.
Project -> Add Existing Item or Project -> Add Item
-
If you decided to use .PCH, do not forget to insert the following line in all added *.C and *.CPP files
#include "stdafx.h"
instead of
#include <ntddk.h>
.....
Change project settings
2006.12.07
See also:
|