派遣例程和 IRQLs

Dispatch Routines and IRQLs

Most drivers' dispatch routines are called in an arbitrary thread context at IRQL = PASSIVE_LEVEL, with the following exceptions:

  • Any highest-level driver's dispatch routines are called in the context of the thread that originated the I/O request, which is commonly a user-mode application thread.

    In other words, the dispatch routines of file system drivers and other highest-level drivers are called in a nonarbitrary thread context at IRQL = PASSIVE_LEVEL.

  • The DispatchRead, DispatchWrite, and DispatchDeviceControl routines of lowest-level device drivers, and of intermediate drivers layered above them in the system paging path, can be called at IRQL = APC_LEVEL and in an arbitrary thread context.

    The DispatchRead and/or DispatchWrite routines, and any other routine that also processes read and/or write requests in such a lowest-level device or intermediate driver, must be resident at all times. These driver routines can neither be pageable nor be part of a driver's pageable-image section; they must not access any pageable memory. Furthermore, they should not be dependent on any blocking calls (such as KeWaitForSingleObject with a nonzero time-out).

  • The DispatchPower routine of drivers in the hibernation and/or paging paths can be called at IRQL = DISPATCH_LEVEL. The DispatchPnP routines of such drivers must be prepared to handle PnPIRP_MN_DEVICE_USAGE_NOTIFICATION requests.
  • The DispatchPower routine of drivers that require inrush power at start-up can be called at IRQL = DISPATCH_LEVEL.

 

 

符号 格式说明符 类型
%c, %lc ANSI字符 char
%C, %wc 宽字符 wchar_t
%d, %i 十进制有符号整数 int
%D 十进制__int64 __int64
%L 十六进制的LARGE_INTEGER LARGE_INTEGER
%s, %ls NULL终止的ANSI字符串 char*
%S, %ws NULL终止的宽字符串 wchar_t*
%Z ANSI_STRING字符串 PANSI_STRING
%wZ UNICODE_STRING字符串 PUNICODE_STRING
%u 十进制的ULONG ULONG
%x 小写字符十六进制的ULONG ULONG
%X 大写字符十六进制的ULONG ULONG
%p 指针Pointer 32/64位  

根据DDK上说明,Unicode格式(%C, %S, %lc, %ls, %wc, %ws, and %wZ)只能在 IRQL = PASSIVE_LEVEL时才能使用。

posted on 2013-01-06 19:08  emissary  阅读(258)  评论(0)    收藏  举报

导航