Microsoft KB Archive/188276

From BetaArchive Wiki

Cancel.exe Self Queued Cancel and Cleanup Routines

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:


Cancel.exe

Release Date: Dec-10-1999

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

Q119591 How to Obtain Microsoft Support Files from Online Services

Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed 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 : kbfile kbsample kbDDK kbOSWinNT400 _IK
Issue type :
Technology : kbAudDeveloper kbWinDDKSearch kbWin32sSearch kbWin32DDKSearch kbWin32DDKNT400 kbWin32DDKNTSearch


Last Reviewed: November 12, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.