SAMPLE: Async.exe Demonstrates Notification from Kernel Mode
ID: 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
Software Library:
~ Async.exe
For more information about downloading files from the Microsoft Software
Library, please see the following article in the Microsoft Knowledge Base:
Q119591
How to Obtain Microsoft Support Files from Online Services
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.
Keywords : kbcode kbfile kbsample
Version : 3.50 3.51
Platform : winnt
Issue type :
Last Reviewed: March 2, 1999