<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>知识库 &#187; FltReadFile</title>
	<atom:link href="http://www.wezu.net/blog/archives/tag/fltreadfile/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wezu.net/blog</link>
	<description>知识就是力量，知识就是财富！</description>
	<lastBuildDate>Fri, 06 Feb 2009 03:15:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>FltReadFile</title>
		<link>http://www.wezu.net/blog/archives/43</link>
		<comments>http://www.wezu.net/blog/archives/43#comments</comments>
		<pubDate>Thu, 27 Nov 2008 07:29:31 +0000</pubDate>
		<dc:creator>snox</dc:creator>
				<category><![CDATA[miniFilter]]></category>
		<category><![CDATA[FltReadFile]]></category>

		<guid isPermaLink="false">http://www.wezu.net/blog/?p=43</guid>
		<description><![CDATA[FltReadFile 从一个打开的文件、流或者设备中读取数据。 NTSTATUS   FltReadFile(     IN PFLT_INSTANCE  InitiatingInstance,     IN PFILE_OBJECT  FileObject,     IN PLARGE_INTEGER  ByteOffset OPTIONAL,     IN ULONG  Length,     OUT PVOID  Buffer,     IN FLT_IO_OPERATION_FLAGS  Flags,     OUT PULONG  BytesRead OPTIONAL,     IN PFLT_COMPLETED_ASYNC_IO_CALLBACK  CallbackRoutine OPTIONAL,     IN PVOID  CallbackContext OPTIONAL     );  参数 InitiatingInstance Opaque instance pointer for the minifilter driver instance that is initiating the read request. This parameter is required and cannot be NULL. FileObject Pointer to a file object for the file that the data is to be read from. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>FltReadFile</strong> 从一个打开的文件、流或者设备中读取数据。</p>
<p>NTSTATUS<br />
  FltReadFile(<br />
    IN PFLT_INSTANCE  <em><a class="synParam" onclick="showTip(this)" href="about:blank">InitiatingInstance</a></em>,<br />
    IN PFILE_OBJECT  <em><a class="synParam" onclick="showTip(this)" href="about:blank">FileObject</a></em>,<br />
    IN PLARGE_INTEGER  <em><a class="synParam" onclick="showTip(this)" href="about:blank">ByteOffset</a> </em>OPTIONAL,<br />
    IN ULONG  <em><a class="synParam" onclick="showTip(this)" href="about:blank">Length</a></em>,<br />
    OUT PVOID  <em><a class="synParam" onclick="showTip(this)" href="about:blank">Buffer</a></em>,<br />
    IN FLT_IO_OPERATION_FLAGS  <em><a class="synParam" onclick="showTip(this)" href="about:blank">Flags</a></em>,<br />
    OUT PULONG  <em><a class="synParam" onclick="showTip(this)" href="about:blank">BytesRead</a> </em>OPTIONAL,<br />
    IN PFLT_COMPLETED_ASYNC_IO_CALLBACK  <em><a class="synParam" onclick="showTip(this)" href="about:blank">CallbackRoutine</a></em> OPTIONAL,<br />
    IN PVOID  <em><a class="synParam" onclick="showTip(this)" href="about:blank">CallbackContext</a></em> OPTIONAL<br />
    ); </p>
<dl>
<h4>参数</h4>
<dt><em>InitiatingInstance</em> </dt>
<dd>Opaque instance pointer for the minifilter driver instance that is initiating the read request. This parameter is required and cannot be NULL. </dd>
<dt><em>FileObject</em> </dt>
<dd>Pointer to a file object for the file that the data is to be read from. This file object must be currently open. Calling <strong>FltReadFile</strong> when the file object is not yet open or is no longer open (for example, in a pre-create or post-cleanup callback routine) causes the system to ASSERT on a checked build. This parameter is required and cannot be NULL. </dd>
<dt><em>ByteOffset</em> </dt>
<dd>Pointer to a caller-allocated variable that specifies the starting byte offset within the file where the read operation is to begin.If this offset is supplied, or if the FLTFL_IO_OPERATION_DO_NOT_UPDATE_BYTE_OFFSET flag is specified in the <em>Flags</em> parameter, <strong>FltReadFile</strong> does not update the file object&#8217;s <strong>CurrentByteOffset</strong> field.If the file object that <em>FileObject</em> points to was opened for synchronous I/O, the caller of <strong>FltReadFile</strong> can specify that the current file position offset be used instead of an explicit <em>ByteOffset</em> value by setting this parameter to NULL. If the current file position is used, <strong>FltReadFile</strong> updates the file object&#8217;s <strong>CurrentByteOffset</strong> field by adding the number of bytes read when it completes the read operation.</p>
<p>If the file object that <em>FileObject</em> points to was opened for asynchronous I/O, this parameter is required and cannot be NULL.</p>
</dd>
<dt><em>Length</em> </dt>
<dd>Size, in bytes, of the buffer that the <em>Buffer</em> parameter points to. </dd>
<dt><em>Buffer</em> </dt>
<dd>Pointer to a caller-allocated buffer that receives the data that is read from the file. </dd>
<dt><em>Flags</em> </dt>
<dd>Bitmask of flags specifying the type of read operation to be performed. <strong></strong></p>
<table border="0">
<tbody>
<tr valign="top">
<th>标志</th>
<th>含义</th>
</tr>
<tr valign="top">
<td>FLTFL_IO_OPERATION_DO_NOT_UPDATE_BYTE_OFFSET</td>
<td>Minifilter drivers can set this flag to specify that <strong>FltReadFile</strong> should not update the file object&#8217;s <strong>CurrentByteOffset</strong> field.</td>
</tr>
<tr valign="top">
<td>FLTFL_IO_OPERATION_NON_CACHED</td>
<td>Minifilter drivers can set this flag to specify a noncached read, even if the file object was not opened with FILE_NO_INTERMEDIATE_BUFFERING.</td>
</tr>
<tr valign="top">
<td>FLTFL_IO_OPERATION_PAGING</td>
<td>Minifilter drivers can set this flag to specify a paging read.</td>
</tr>
</tbody>
</table>
<p> </p>
</dd>
<dt><em>BytesRead</em> </dt>
<dd>Pointer to a caller-allocated variable that receives the number of bytes read from the file. If <em>CallbackRoutine</em> is not NULL, this parameter is ignored. Otherwise, this parameter is optional and can be NULL. </dd>
<dt><em>CallbackRoutine</em> </dt>
<dd>Pointer to a <a href="http://www.wezu.net/blog/wp-admin/fltcallbacks_b85c12a6-7d3b-4d0c-9d21-9d9613aa057c.xml.htm">PFLT_COMPLETED_ASYNC_IO_CALLBACK</a>-typed callback routine to call when the read operation is complete. This parameter is optional and can be NULL. </dd>
<dt><em>CallbackContext</em> </dt>
<dd>Context pointer to be passed to the <em>CallbackRoutine</em> if one is present. This parameter is optional and can be NULL. If <em>CallbackRoutine</em> is NULL, this parameter is ignored. </dd>
</dl>
<h4>返回值</h4>
<p><strong>FltReadFile</strong> returns the NTSTATUS value that was returned by the file system.</p>
<h4>注释</h4>
<p>微过滤器调用 <strong>FltReadFile</strong> 从一个打开的文件中读取数据。</p>
<p><strong>FltReadFile</strong> 创建一个读请求并发送到微过滤器驱动挂载的进程后到文件系统。指定的进程之上的挂载进程则收不到读请求。</p>
<p><strong>FltReadFile</strong> 在下列条件成立时，准备非缓存I/O：</p>
<p><strong></strong></p>
<ul type="disc">
<li>调用者在参数 <em>Flags</em> 中设置了 FLTFL_IO_OPERATION_NON_CACHED 标志；</li>
<li>文件对象使用非缓存I/O打开的。通常是在调用 <a href="http://www.wezu.net/blog/wp-admin/fltapiref_a_to_d_2059a625-6d9e-4083-9c2e-d92e76c7539a.xml.htm"><strong>FltCreateFile</strong></a>, <a href="http://www.wezu.net/blog/wp-admin/fltapiref_a_to_d_3bc45f49-48cd-4c08-8906-09074f48e712.xml.htm"><strong><span style="text-decoration: underline;">FltCreateFileEx</span></strong></a>, 或 <strong>ZwCreateFile </strong>时，在参数<em>CreateOptions</em> 标志中指定了FILE_NO_INTERMEDIATE_BUFFERING 。 </li>
</ul>
<p>Noncached I/O imposes the following restrictions on the parameter values passed to <strong>FltReadFile</strong>:</p>
<p><strong></strong></p>
<ul type="disc">
<li>The buffer that the <em>Buffer</em> parameter points to must be aligned in accordance with the alignment requirement of the underlying storage device. To allocate such an aligned buffer, call <a href="http://www.wezu.net/blog/wp-admin/fltapiref_a_to_d_b617aed0-5103-4a1e-aa0d-86247d99e803.xml.htm"><strong>FltAllocatePoolAlignedWithTag</strong></a>.</li>
<li>The byte offset that the <em>ByteOffset</em> parameter points to must be a nonnegative multiple of the volume&#8217;s sector size.</li>
<li>The length specified in the <em>Length</em> parameter must be a nonnegative multiple of the volume&#8217;s sector size.</li>
</ul>
<p> </p>
<p>If an attempt is made to read beyond the end of the file, <strong>FltReadFile</strong> returns an error.</p>
<p>If the value of the <em>CallbackRoutine</em> parameter is not NULL, the read operation is performed asynchronously.</p>
<p>If the value of the <em>CallbackRoutine</em> parameter is NULL, the read operation is performed synchronously. That is, <strong>FltReadFile</strong> waits until the read operation is complete before returning. This is true even if the file object that <em>FileObject</em> points to was opened for asynchronous I/O.</p>
<p>If multiple threads call <strong>FltReadFile</strong> for the same file object, and the file object was opened for synchronous I/O, the Filter Manager does not attempt to serialize I/O on the file. In this respect, <strong>FltReadFile</strong> differs from <strong>ZwReadFile</strong>.</p>
<h4>Requirements</h4>
<p><strong>IRQL: </strong>PASSIVE_LEVEL</p>
<p><strong>Headers: </strong>Declared in <em>fltkernel.h</em>. Include <em>fltkernel.h</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wezu.net/blog/archives/43/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
