Editor Press: The content of this paper is mainly compiled by DriverStudio's random document translation. The readers of this article preferably have the following software: DriverStudio2.5, Visual Studio6.0, and Windows 2000 DDK. This article assumes that you have installed these software. DriversTUDIO2.5 can be downloaded to the beta version in the drive development network (www.driverdevelop.com), Windows 2000 DDK can be downloaded for free in Microsoft, Visual Studio 6.0 needs to be purchased. Author: Yang Jun E-mail: y9980@263.net
Develop drivers for Windows 98, Windows ME, Windows NT, Windows 2000, and Windows XP with DriverWorks
Introduction DriverWorks simplifies the development of the device driver by providing powerful and advanced code generation wizards - DriverWizard, there are thousands of lines that have strictly tested in the library and examples. The Windows NT and WDM driver interface provide good conditions for object-oriented applications. DriverWorks takes full advantage of the operating system's object-oriented excellent characteristics, compared to Microsoft's DDK, which provides a more friendly way to design a driver based on Windows NT and WDM (driver design models). Using DriverWorks, designers can develop NT and WDM drivers at a faster speed. In most cases, the use of the DriverWorks library can greatly reduce the length of the code for the driver. Using these well-designed functions, you can complete all your work. Of course, the DDK's C language level API function is also available.
Note: The Windows NT device driver can run on Windows NT or Windows 2000; and WDM device driver can run on Windows 98, Windows ME, Windows 2000, and Windows XP, and WINDOWS XP.
DriversTUDIO encapsulates the code required by each driver into classes. The library code automatically handles routine operations, which greatly shorts the complexity of the task. Moreover, the C compiler provides the advantages of ANSI C: including improved type safety checks, internal function optimization, and better code organizations. DriverWizard - DRIVERWORKS code wizard, closely integrated with Microsoft Visual C . More than 1500 rows of driver source code frames can be done with a few mouse clicks. These code also contain detailed comments. In addition, DriverWizard can also generate code specific for special equipment, such as USB devices, PCI devices, plug and play devices, ISA devices, and more. DriverStudio's support for Microsoft Developer Studio is far more than DriverWizard to construct a new project as simple as it is. DriverWorks provides a complete development environment similar to Microsoft Developer Studio, including Checked and Free Compile Environment, Similar Code Editor, Error Code Position, and Class Browser.
Compiling libraries You must compile needed library files before you start working with DriverWorks. You can compile library files in the Microsoft Visual Studio environment or by command line. The following describes how to compile the library in the VC environment. Start Visual C . 2. Select Menu File | Open Workspace. Open the workspace file located in DriverStudio / DriverWorks / Source / VDwlibs.dsw. 3. Select the menu build | Batch Build, select the library you want to compile in the pop-up dialog box. 4. Click Build to compile you selected library. How to compile the library with a command line, omitted here. Test your installation If you want to compile a simple driver example with the command line (not in Microsoft Visual Studio), you must first run two batch files (the suffix .bat file), these two files in DDK And Visual C . You can also complete this operation by running Checked Build Environment or Free Build Enviroment in Start Menu / Development Kits / Windows 2000 DDK. The first batch file is setenv.bat, and it requires 2 parameters: the first is the root directory of DDK, the second is "free" or "checked". The second parameter tells the compilation system to join debugging information in the driver. The second batch file is vcvars32.bat, which establishes a path for the compiler.
Compilation Example For Windows NT 4.0, the easiest example is in the DriversTudio / DriverWorks / Examples / NT / Hello folder. You can compile this example and then load it with DriverMonitor to the WDM driver (for Windows 98, Windows Me, Windows 2000, and Windows XP), the easiest example in the DriversTudio / DriverWorks / Examples / WDM / HellowDM folder. You compile it and then load it with the Add New Hard Wizard in the Control Panel. If you have a Microsoft Visual C 5.0 or updated version, you can open the workspace file% DriverWorks% / Examples / NT / Hello / Hello.dsw, then compile in the Visual C environment. Compile the WDM driver, use the HellowDM example. If you want to compile from the command line, press the following method to set the working directory, then run the build program compile:
CD / ProgramFiles / Numega / DriversTUDIO / DRIVERWORKS / Examples / NT / Hellobuild
Please check if there is an error in "build.log" (or "buildchk.log" or "buildchk.log" or "buildchk.log").
The driver loaded in Windows 98 and Windows ME first copies the Hellowdm.inf file to the system folder. Then open the control panel and run the new hardware wizard. In the first step of adding a new hardware wizard, select Select Hardware from the list, pay attention to HellowDM in other hardware. When you ask the manufacturer, select the directory where you install, locate it to the INF file. If you run DRIVERMONITOR in installation, you will see the message popped up. After the installation is complete, open the system icon in the control panel, the installed device will appear in the Device Manager.
In Windows NT, Windows 2000, and Windows XP, the driver is loaded on the WDM driver in Windows 2000 and Windows XP, and the method is similar to the previous introduction. For Windows NT, Windows 2000, and Windows XP, run DriverMonitor to confirm that your driver works fine. Note that hello.sys will be created in the ./i386/* directory, this * depends on your compilation environment is Checked or Free. When you load hello.sys from DriverMonitor, you should see the confirmation information in the window, then the Hello message emitted by the driver. Note: Load the device driver under Windows NT, you need to log in with an administrator account. If you don't have enough permissions to install the kernel mode driver, DriverMonitor will prompt the error message. Uninstall the driver before exiting from DriverMonitor.