1.使用VC6IDE创建一个makefile项目[TestDrv]
2.添加TestDrv.h,TestDrv.cpp并编写代码,代码内容略
3.设置项目,选择菜单[Project]->Settings
Command Line:
MakeDrv D:\WINDDK\2600 fre
Rebuild All Options:
-nmake /a
Output File Name:
TestDrv.sys
4. 在项目目录下创建一个 MakeDrv.bat
@echo off
if "%1"=="" goto usage
if "%2"=="" goto usage
if not exist %1\bin\setenv.bat goto usage
set ProjectDir=%cd%
call %1\bin\setenv %1 %2
%ProjectDir:~0,2%
cd %ProjectDir%
build -b -w %3 %4 %5 %6 %7
goto exit
:usage
echo usage MakeDrv DDK_dir fre/chk [build_options]
:exit
5. 创建一个makefile文件,下面是文件内容,内容固定。
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def
6. 创建一个sources文件,下面是文件内容.
TARGETNAME=TestDrv
TARGETTYPE=DRIVER
TARGETPATH=obj
INCLUDES=.\
SOURCES = TestDrv.c
7.现在就可以编译了.