When compiling a WDM program, two files are required:
Makefile
(What is this? You may ask .) For younger programmers, you may not have seen this file. In fact, before the emergence of the vc ide, we must use makefile to determine which files in the project need to be re-compiled. The current ide has automatically completed this job.
The job we need to do is to provide such a file with the following content:
- #
- # 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 driver components of the Windows NT DDK
- #
- ! Include $ (ntmakeenv)/makefile. Def
As it said, Do not edit this file. In fact, the makefile content required by each WDM program is the same, that is, we only need to simply copy a makefile to a new project.
Sources
- Targetname = hellowdm // name of the compiled driver
- Targettype = driver // The compilation type is driver compilation.
- Drivertype = WDM // The driver type is WDM.
- Targetpath = OBJ // The generated file is stored in the OBJ directory.
- Required des = $ (basedir)/INC; // This is the header file to be introduced.
- $ (Basedir)/INC/DDK ;/
- Targetlibs = $ (basedir)/lib/*/free/usbd. Lib // This is the library file to be introduced.
- Sources = hellowdm. cpp // This is the source code file
This file specifies that the target name of the driver is hellowdm. SYS. It is a WDM driver and the generated file is stored in the OBJ directory. It is worth noting that there cannot be spaces before and after "=", otherwise there will be errors during compilation.
1. Generation of "debug"
First, assume that your source code is stored in D:/hellowdm. Follow these steps:
Start> program> Development Kits> Windows 2000 DDK> checked Build Environment"
2. Generate "release"
Follow these steps:
Start> program> Development Kits> Windows 2000 DDK> Free Build Environment"