Programming 版 (精华区)
发信人: zpw (zhao), 信区: Programming
标 题: Using IOCTL METHOD_IN/OUT_DIRECT
发信站: 紫 丁 香 (Wed Jul 29 21:00:58 1998), 转信
Using IOCTL METHOD_IN/OUT_DIRECT
When an application calls the Win32 API DeviceIoControl to access a device
driver, it passes a code to specify the operation that it is requesting.
The driver writer supplies a set of codes, each of which is formed using macro
CTL_CODE. One parameter to CTL_CODE specifies the buffer access method that
the operation uses. The method may be one of the following:
METHOD_BUFFERED
METHOD_IN_DIRECT
METHOD_OUT_DIRECT
METHOD_NEITHER
The semantics of METHOD_IN_DIRECT and METHOD_OUT_DIRECT cause some confusion
for driver developers. The buffer pointed to by parameter InputBuffer (unless
NULL) is copied to a system buffer, and the system inserts a pointer to the
system buffer in the IRP sent to the driver. For the buffer to which parameter
OutputBuffer points, the systems creates an MDL, after probing and locking the
corresponding memory pages. The MDL address appears in the IRP at field
MdlAddress.
The buffer pointed to by parameter InputBuffer never receives any data from the
driver. However, note that the buffer pointed to by parameter OutputBuffer is
sometimes an input buffer (METHOD_IN_DIRECT) and sometimes an output buffer
(METHOD_OUT_DIRECT). In the latter case, the buffer must be writable, or the
system will fail the call.
--
※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: yaoyu.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.155毫秒