lint_and_ddk.txt Driver File Contents (lintddk.zip)

Udo Eberhardt, Thesycon GmbH

Email: Udo.Eberhardt@thesycon.de   
Web:   www.thesycon.de


How to use PC-lint for Kernel-Mode Development
==============================================


What is PC-lint
---------------
PC-lint is a tool that allows to do a very extensive C/C++ source code
analysis. It has excellent features and supports the full language 
definition of C and C++. PC-lint is very flexible. It can be configured
to support nearly any platform and any compiler. PC-lint provides very 
extensive configuration options to customize its behavior.  


Why use PC-lint
---------------
PC-lint is very helpful in producing high-quality software. It helps 
to avoid bugs and mistakes before they appear during testing. It does
also help to avoid bugs that are difficult to discover by software test
procedures. Mostly, such problems are caused by uninitialized variables
or objects and show up randomly. 
The best guarantee on bug-free code is a thorough analysis of the source
code by means of reviews for example. PC-lint allows to automate this 
process.
In summary, PC-lint helps to save development and test time and to 
improve the software quality. So, it is highly recommended to use it for
kernel-mode development.


BulkUsb Sample Driver Project
-----------------------------
In order to demonstrate the usage of PC-lint with the Windows DDK I 
prepared a sample project that is based on the well-known DDK sample 
bulkusb. I added a build script that supports integration of PC-lint into
the standard DDK build process that is controlled by build.exe. 
Furthermore, the build script allows to run the build from within the 
Visual C++ IDE which is more convenient than using the command window.
The files that were added are described below in detail.

bulkusb_sys.dsw
The VC++ 6.0 workspace file.

bulkusb_sys.dsp
The VC++ 6.0 project file.

runbuild.cmd
The build script that takes care of setting up the environment and 
subsequently runs build.exe. The script needs to be modified to contain
the correct directory paths on the build machine. See runbuild.cmd for
detailed instructions.
The variable USE_LINT turns PC-lint processing on or off. The 
runbuild.cmd script uses the lint support that is already built into
the make files that are part of the Windows DDK. 

msvc7.lnt
This file contains lint options that are required to configure PC-lint
for the Microsoft C/C++ Compiler that is included with the Windows XP 
DDK (MSVC 7.0). The lint config file is generic and can be re-used for
any DDK project. 

lintcfg.lnt
This file contains lint options that are specific to the bulkusb project.
The file should be modified to adapt lint to personal preferences and
to individual programming style.
The lint config file can be re-used for other driver projects. However,
if it is re-used then most of the options that suppress individual
lint messages should be disabled at first. For details, see lintcfg.lnt.


Summary of Tools needed to build the Sample Driver Project
----------------------------------------------------------
- Windows XP DDK, Build 2600
- PC-lint 8.0 by Gimpel Software, www.gimpel.com
- Visual C++ 6.0 (optional)


Running PC-lint on the BulkUsb Sample Source
--------------------------------------------
There are two ways to run lint on the sample project.

(1) Open a command window (cmd.exe) and execute
        runbuild chk
    from the project directory. This will do a checked build.
    To do a free build execute
        runbuild fre
    respectively. 

(2) Use Visual C++ 6.0 to open bulkusb_sys.dsw.
    Choose Build/Build bulkusb.sys from the menu bar.
    The output produced by PC-lint will be sent to the output window.
    You can double-click a lint message to display the source code line
    that is referenced by the message or use F4 to step through the 
    messages.


The BulkUsb Sample Source
-------------------------
If PC-lint is used on the unmodified bulkusb sources then really a LOT
of messages is produced. I spent about two hours to add lint options to
lintcfg.lnt and to the source code. You can easily find the source code
locations by doing a search for the word lint.
Most of the messages are obviously mistakes made by lint. In these cases
lint options need to be added to suppress the appropriate error or 
warning message. This can be done globally by means of lintcfg.lnt or at
the particular source code line. 
Interestingly enough, PC-lint encountered some dubious problems. I added
comments at the locations concerned. Do a search for 'Warning 644' to
find these locations.
Besides, PC-lint detected lots of unused local variables. Of course, 
this is not really a problem because unused locals will be discarded by
compiler optimizations. However, for a clean and readable source code
such relicts should be removed. 
PC-lint is also able to detect unused members of structs and classes.
Such relicts will not be optimized away by the compiler or linker. 
Hence, PC-lint is also useful for optimizing the code and data size of
a program.   


Living with PC-lint
-------------------
Some hints for successful use of PC-lint are listed below.

Don't be overwhelmed by the amount of messages that is produced if
lint is run for the first time on a project. Mostly, the amount can
be reduced quite quickly by refining the lint configuration in a 
step-by-step process or by modifying the statements in question.

If possible modify your statements that lint complains about rather
than add a lint option to suppress the lint message. That way, lint
helps to enforce a clean and solid programming style. This is especially
useful for groups of developers (one programmer writes the code, several
programmers have to read it).

Before you are going to suppress a particular message or a group of
messages make sure you fully understand what caused lint to produce
the message.

To suppress a particular message prefer to add an individual lint option
to the statement concerned instead of disabling the message globally.
Messages that are globally disabled cannot be produced by lint for 
source code that is added to the project in the future.

Download Driver Pack

How To Update Drivers Manually

After your driver has been downloaded, follow these simple steps to install it.

  • Expand the archive file (if the download file is in zip or rar format).

  • If the expanded file has an .exe extension, double click it and follow the installation instructions.

  • Otherwise, open Device Manager by right-clicking the Start menu and selecting Device Manager.

  • Find the device and model you want to update in the device list.

  • Double-click on it to open the Properties dialog box.

  • From the Properties dialog box, select the Driver tab.

  • Click the Update Driver button, then follow the instructions.

Very important: You must reboot your system to ensure that any driver updates have taken effect.

For more help, visit our Driver Support section for step-by-step videos on how to install drivers for every file type.

server: web3, load: 1.86