uppercase or lowercase format specifier type character.
The available format specifiers cover a range of useful types. %I prints out the major and minor codes of an IRP. %T prints a UNICODE_STRING. Line feed and carriage return characters in the format string are ignored.
The %l, %L, %s, %S, and %x format specifier characters let you use one or more modifier characters to specify the maximum output width (e.g., %*l and %nl). The * modifier takes the maximum size from the next integer parameter to DebugPrint or DebugPrint2. The n modifier specifies the exact output width; where n is one or more characters between 1 and 9.
Table 6.1
Format Specifier | Type | |
---|---|---|
%c | ANSI character | char |
%C | Wide character | wchar_t |
%d, %i | Signed integer in decimal | int |
%D | __int64 in decimal | __int64 |
%I | IRP major and minor codes | PIRP |
%l | __int64 in hexadecimal | __int64 |
%L | LARGE_INTEGER in hexadecimal | LARGE_INTEGER |
%s | NULL-terminated ANSI character string | char* |
%S | NULL-terminated Wide character string | wchar_t* |
%T | UNICODE_STRING | PUNICODE_STRING |
%u | ULONG in decimal | ULONG |
%x | ULONG in hexadecimal | ULONG |
Debugging Notes
Here are some notes on how to deal with some common debugging problems.
Updating a driver is fairly straightforward. The makefile for the examples in this book copy the new driver to the Windows System32drivers directory. However, the old version will still be running in memory.
To use the new version you have to update the drivers for your device(s). Use the Update/Change driver option in the Device Manager properties for a device. Opt to 'display a list of drivers in a specific location, so you can select the driver you want'.
For the Wdm1 driver, select 'Other Devices'. You should see the list of book software drivers that you have installed. Select the one you want from this list. You do not have to select the Have Disk button (unless you want to install the checked version, say).
If asked, opt to use the new driver even if the Device Manager suggests that the current version may be newer. Windows 98 will force you to browse for the driver files. W2000 uses the driver files in the System32drivers directory.
As noted above, if the new driver returns an error during its initialization then Windows will say that the system needs to reboot. Rebooting may not cure the problem.
NT Style Drivers
As mentioned in an earlier chapter you must update NT style drivers in a different way. As usual, you must get your driver into the Windows System32drivers directory.
Run the Control Panel Devices applet. Find your driver, stop it, and start it again. You can also run the book software Servicer applet; type in the name of your driver, press Stop and then Start. If you run an NT style driver in Windows 98 you must reboot the computer to use an updated driver.
If your driver fails catastrophically during system boot, the system will not load, which makes it tricky to delete or change the offending driver.
There are three solutions to this problem. In a dual boot system, simply reboot in the other operating system and delete or change the driver. Alternatively, both W2000 and W98 have 'Safe mode' boot options that should allow you to start Windows, while only loading the most basic system drivers. Delete the offending driver and restart. A final option is to have a bootable floppy disk with a copy of Windows 98. Use this as a quick boot to delete the offending driver files.