Driver development-Tools

Source: Internet
Author: User
Because I did it in Win2000 when I was learning, so everything is subject to the configuration I learned.

1. Install the Win2000 operating system. I have installed the Win2000 Advanced Server version.

Second, install VC ++ 6.0. I installed the English version.

Third: Install win2000ddk;

Generally, the driver debugging is completed in cmd with DDK. I have skipped this part for the moment. The following describes how to configure VC ++ 6.0 to develop a device driver in the Visual Studio 6.0 integrated environment.

On Windows, the development environment provided by Windows DDK is based on the command line, which is inconvenient to operate. Visual Studio 6.0 provides a friendly and easy-to-use integrated environment, it makes us feel more powerful.
So can we use the Integrated Environment of Visual Studio to develop drivers? The answer is yes. By setting the Visual Studio integrated environment, you can create your own driver development integrated environment.

First, the system must have DDK and Visual C ++ 6.0 installed (all tools are selected during installation ),

1. Next we need to modify DDK/bin/setenv. bat comment out the related statements that require mstools (if you want to develop a driver in the command line environment, you also need to add call vc_dir/vc98/bin/vcvars32. BAT ), this allows you to use VC-related tools in the command line. If you only want to develop in the IDE environment, you do not have to call vcvars32.bat, because the path information of related tools can be set in the VC environment .)

2. Create a directory driverenv (the directory name is random) as the base camp for your development driver.

3. Create a batch file named makedrvr. BAT in this directory. The content is as follows:

@ Echo off
If "% 1" = "" Goto usage
If "% 3" = "" Goto usage
If not exist % 1/bin/setenv. Bat goto usage
Call % 1/bin/setenv % 1% 4
% 2

Cd % 3
Build-B-w % 5% 6% 7% 9

Goto exit

: Usage
Echo usage makedrvr ddk_dir driver_drive driver_dir free/checked [build_options] echo eg makedrvr % ddkroot % C: % wdmbook % free-CEF
: Exit

The batch processing first checks the passed parameters, then calls the setenv command of DDK to set the environment variable, then changes the directory to the drive and directory where the source program is located, and finally calls build, -B ensures that all error messages are displayed.-W ensures that warnings are output on the screen. These errors and warnings are displayed in the output window of VC IDE.

4. Create a blank Project
Select the new menu item of file, select the makefile in the project column, and enter the path to go down the next step. Visual Studio provides two types of configuration: Win32 debug and Win32 release.

5. Modify the two configurations.
Select the settings menu item Win32 debug for the project:
Fill in makedrvr ddk_dir source_drive source_dir checked [Build options] In the build command line column.
Enter-nmake/a in the rebuild all options column.
Fill in the output file column with the same targetname as the sources file.
Fill in OBJ/i386/checked/In the Browse info file name column (for the same file name as targetname, see the following). BSC

Win32 release:
Enter makedrvr ddk_dir source_drive source_dir free [Build options] In the build command line column.
Enter-nmake/a in the rebuild all options column.
Fill in the output file column with the same targetname as the sources file.
In the Browse info file name field, enter OBJ/i386/free/(the same file name as targetname). BSC
Note: ddk_dir can generally be written as % basedir %, and build options is generally-CEF, that is, enough

6. Add the source file to the Project
It can be created or added, which is the same as that of common Win32 development.

7. Add a resource file
Select the insert resource menu item.

8. Put the makefile in the source program directory, and its content is always
#
# 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

9. Put the file sources into the source program directory. The content is
Targetname = ramdrive // The Name Of The driver. SYS file to be generated
Targetpath = OBJ // The upper directory of the directory where the. SYS file is located. (due to the DDK bug) You should manually create the checked and free directories under the OBJ directory to serve as the final directory of. sys.
Targettype = driver // type of the driver, which is generally unchanged
Supported des = $ (basedir)/INC // DDK contains the file path, which is generally unchanged
Sources = ramdrive. cpp ramdrive. RC // source file (not header file), resource file
Browser_info = 1 // if you want to browse information, you must have a row. Otherwise, you can

10. Because makedrvr. bat is in the driverenv directory, add the directory to executable files of VC.
Select the Options menu of tools, select the directories page, select executable files in the show directories for column, and then add.

Now, the environment has been set up. You can press F7 to build your driver.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.