Cancel.exe Self Queued Cancel and Cleanup Routines

ID: Q188276


The information in this article applies to:
  • Microsoft Win32 Device Driver Kit (DDK) for Windows NT, version 4.0


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. Click the file name below to download the file:

Cancel.exe
Release Date: Dec-10-1999

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

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:

Keywords : kbfile kbsample kbDDK kbNTOS400 kbDSupport
Version : winnt:4.0
Platform : winnt
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.