Microsoft KB Archive/Q188276

From BetaArchive Wiki

PSS ID Number: 188276

Article Last Modified on 12/22/2001



The information in this article applies to:

  • Microsoft Win32 Device Driver Kit (DDK) for Windows NT 4.0



This article was previously published under Q188276

SUMMARY

Cancel.exe is a sample that demonstrates how the cancel-and-cleanup driver uses the new I/O request packet (IRP) cancellation technique that minimizes the use of global cancel spinlock, thereby reducing contention and improving overall system performance.

The sample also shows how to queue cancelable IRPs in a driver's private queue and handle the cancelled IRPs in the cancel-and-cleanup routine by the new design. The cancel-and-cleanup driver is functionally similar to the STARTIO driver, except that it manages its own queue instead of using DeviceObject's internal device queue and IoStartPacket/IoStartNextPacket system functions.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:

Release Date: Dec-10-1999

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on secure servers that prevent any unauthorized changes to the file.

Generic Sample CANCEL Driver

The following are included with this file:

  • A driver source that demonstrates how to use the new IRP cancellation technique that minimizes the use of global cancel spinlock, thereby reducing contention and improving overall system performance. It also shows how to queue cancelable IRPs in a driver's private queue and handle the cancelled IRPs in the cancel-and-cleanup routine by the new design. In purpose, this driver is similar to the STARTIO driver, except it uses and manages it own queue instead of I/O manager-managed DeviceObject's internal queue.
  • A simple multithreaded Win32 Console application to stress and test the driver's cancel-and-cleanup routine.

This sample contains an example of a minimal driver. Neither it nor the sample programs are intended to be used in a production environment. Rather, they are intended for educative purposes and as a skeleton driver.

Building the Driver and Examples

To compile the device driver:

  1. Start the checked or free build environment MS-DOS box.
  2. Run Build. This starts the Microsoft make routines, which produce log files called Build.wrn, and Build.log. The .wrn file contains warnings that no components have been extracted from certain libraries, even if the build succeeds. If it does succeed, the driver can be found in the %basedir%\Lib\i386\Free or %basedir%\Lib\i386\checked folder.
  3. Copy the .sys file to %systemroot%\System32\Drivers folder where all the Windows NT device drivers are stored.

To install the sample driver, use the REGINI utility to create the entries listed in the .ini file.

Testing

  1. Restart your computer.
  2. Start the driver with "net start".
  3. Run multiple instances of Testapp.c.
  4. Exit gracefully (enter "q") or press CTRL+C and watch how the driver cancels all the pending I/Os in the debug trace.



Additional query words: Cancel

Keywords: kbDSupport kbfile kbSample KB188276
Technology: kbAudDeveloper kbWin32DDKNT400 kbWin32DDKNTSearch kbWin32DDKSearch kbWin32sSearch kbWinDDKSearch