Microsoft KB Archive/126415

{|
 * width="100%"|

SAMPLE: Async.exe Demonstrates Notification from Kernel Mode

 * }

Q126415

-

The information in this article applies to:


 * Microsoft Win32 Device Driver Kit (DDK) for Windows NT, versions 3.5, 3.51

-

SUMMARY
Async.exe is a sample that demonstrates how to notify a user-mode application that a certain event it has been waiting for has occurred. This type of operation is typically performed when the application needs to be notified of a hardware interrupt.

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

"Async.exe" Release Date: Sep-16-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.

The Async.exe driver consists of two pieces, a kernel-mode driver and a user-mode application. You could use your own user-mode application with this driver, however the one supplied demonstrates the preferred method.

In the kernel-mode driver, an interrupt is simulated by using an IoTimer routine to maintain a time-out count. When this count has been reached, the routine completes the IOCTL request from the user-mode application that asked to be notified of this event. In the meantime, the driver is free to process other requests.

The user-mode application is a multi-threaded application. The first thread is responsible for sending down an IOCTL_HOLD_REQUEST. This IOCTL will, when handled by the kernel-mode driver, cause the IRP to be held in the driver until the IoTimer routine releases the IRP. The second thread sends down an IOCTL_DO_NOTHING, which does nothing except return every 1000 ms.

When installing the driver, you should create a subkey named parameters under the master key for the driver. In this key, you should have three DWORD values DebugValue, DelayValue, and BreakOnEntry. If BreakOnEntry is set to value not equal to zero (0), it will execute a hardcoded breakpoint in DriverEntry. If DebugValue is greater than or equal to one, it will print out a verbose level of DbgPrint statements, otherwise it will print out statements only on errors, DriverEntry, and the unload routine. DelayValue will indicate how many seconds should go by before the IOCTL_HOLD_REQUEST IRP should be completed. Generally speaking, this value should be five or greater. The default value if not specified is five.

Additional query words: Async

Keywords : _IK kbfile kbsample kbDDK _IK

Issue type :

Technology : kbAudDeveloper kbWinDDKSearch kbWin32sSearch kbWin32DDKSearch kbWin32DDKNT350 kbWin32DDKNT351 kbWin32DDKNTSearch