Debugging and Tuning Your Driver

During driver development and testing, you will need to adjust the registry of your Windows NT development and test machines. You will need to enable/disable driver loading, add/modify registry keys and values, and so on.

Windows NT provides an application for this purpose called Registry Editor. Registry Editor (regedt2.exe) is documented in the Windows NT documentation.

Additionally, the DDK includes two registry tools, regini and regdmp, which are script-driven. These tools provide a “-?” option, which provides help from the command line. Regdmp dumps the contents of the registry to a script file. Regini creates registry entries according to the specified script. Sample regini script files can be found in several driver source directories in the DDK.

The methods available for driver debugging center around the kernel debugger and the checked build, both of which have already been discussed in some detail. Additional information about the kernel debugger is available in the Win32 SDK documentation and the Windows NT DDK Programmer’s Guide.

Some debugger extensions have also been included for the Windows NT STREAMS (strmexts.dll), Windows NT GDI (gdiexts.dll) and Windows NT USER (userexts.dll) components. These are installed and placed in your path by DDK Setup, to be used while debugging.

Performance tuning is covered in the Win32 SDK documentation and in the Programmer’s Guide topic of the DDK Help online documentation. The DDK includes a sample illustrating performance counters that is based on the VGA display driver; this sample is found in the src\perf directory of the DDK.

Also included are the utilities that are useful for quickly loading performance counter information into the registry, lodctrs and unlodctrs. The tools are script-driven and are documented in the Windows NT DDK Programmer’s Guide.

Other useful tools include the ObjDir and Drivers tools, which provide information about objects in the system and what resources drivers have created, own, or are using. The ObjDir tool is similar to the WinObj tool that is included with the Win32 SDK, except it is console based. The Drivers tool provides a listing of what drivers are loaded in the system and their resource usage.