SAMPLE: Async Notification from Kernel Mode DriverLast reviewed: February 17, 1998Article ID: Q126415 |
The information in this article applies to:
SUMMARYThis ASYNC sample code for the Windows NT DDK demonstrates how to notify a user-mode application that a certain event that it has been waiting for has occurred. Frequently, this type of operation is performed when the application needs to be notified of a hardware interrupt. The following file is available for download from the Microsoft Software Library:
~ Async.exe (size: 25782 bytes)For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591 TITLE : How to Obtain Microsoft Support Files from Online Services MORE INFORMATIONThe 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 |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |