Fires after data is read from a file.
The 'callback' is called when the 'AfterReadFile' event is emited.
The argument 'e' has the following properties:
e.fileName e.position e.buffer e.bufferLength e.bytesToRead e.direction e.bytesRead e.status e.fileContext e.handleContext e.resultCode
This event fires after data is read from the file specified by FileName.
Applications may use this event to modify the data that was read from the file before it is returned to the requestor. Applications that choose to do this must:
- Enable the ModifiableReadWriteBuffers configuration setting (before this event fires, that is).
- Copy no more than BytesToRead bytes into Buffer.
- Update the BytesRead parameter's value afterwards so that it correctly reflects the amount of data in Buffer.
The Position parameter reflects the byte offset in the file at which reading started.
The Buffer parameter points to a memory buffer that, if the request was successful, contains the data that was read from the file. The BufferLength parameter reflects the capacity of Buffer, in bytes. Please refer to the Buffer Parameters topic for more information on how to work with memory buffer event parameters.
The BytesToRead parameter reflects how many bytes were to be read from the file (i.e., how many bytes the requestor expects will be read).
The Direction parameter indicates the request direction; please refer to the Cached and Non-Cached Requests topic for more information. Possible values are:
|FS_REQUEST_DIR_USER_NONCACHED||0||Operations performed in the 'user mode application <--> filesystem' direction.|
|FS_REQUEST_DIR_USER_CACHED||1||Operations performed in the 'user mode application <--> system cache' direction.|
|FS_REQUEST_DIR_SYSTEM_NONCACHED||2||Operations performed in the 'system cache <--> filesystem' direction.|
|FS_REQUEST_DIR_SYSTEM_CACHED||3||Operations performed in the 'system component <--> system cache' direction.|
The BytesRead parameter specifies how many bytes were actually read from the file, and thus the length of the data in Buffer. This parameter's value must not exceed BufferLength (and should not exceed BytesToRead; please refer to BeforeReadFile for more information).
The Status parameter contains an NT status code that indicates the outcome of the operation; 0 indicates success. To convert this value to a Win32 error code, call the NtStatusToWin32Error method. Please note that this event won't fire for failed requests unless the ProcessFailedRequests property is enabled. Applications may change this parameter's value if they want a different NT status code to be returned.
The FileContext and HandleContext parameters are placeholders for application-defined data associated with the file and specific handle, respectively. Please refer to the Contexts topic for more information. (If the system's cache manager or memory manager initiated the operation, HandleContext may be absent, in which case it will be .)
The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.
This event is fired synchronously; please refer to the Event Types topic for more information.