网站首页  词典首页

请输入您要查询的函数:

 

术语 readfilescatter
释义 ReadFileScatter
语法:
C++
BOOL WINAPI ReadFileScatter(
__in HANDLE hFile,
__out FILE_SEGMENT_ELEMENT aSegmentArray[],
__in DWORD nNumberOfBytesToRead,
__reserved LPDWORD lpReserved,
__inout LPOVERLAPPED lpOverlapped
);
ReadFileScatter功能
从文件中读取,并在一个缓冲区的数组其存储的数据。
函数开始读的是一个由一个OVERLAPPED结构中指定位置的文件数据。该ReadFileScatter异步运行的功能。
参数
hFile [in]
一个句柄,文件被读取。
文件句柄必须创建与GENERIC_READ权和FILE_FLAG_OVERLAPPED和FILE_FLAG_NO_BUFFERING标志。有关更多信息,请参阅文件安全性和访问权限。
aSegmentArray [out]
一个对数组的指针的FILE_SEGMENT_ELEMENT缓冲区接收数据。对于这个联盟说明,请参见备注。
每个元素都可以接收一个数据页。
注意:要确定一个系统的页面大小,使用的GetSystemInfo。
该数组必须包含足够的内容来存储终止空nNumberOfBytesToRead字节的数据,加上一个元素。举例来说,如果有40K的字节被读取和页大小是4K字节的数组必须有11种元素,其中包括的数据和空1 10。
每个缓冲区必须至少在一个系统内存页面大小,必须在一个系统内存页大小的边界上对齐。该系统每个缓冲区读入一个系统的数据存储器页。
函数中的数据存储顺序的缓冲区。例如,它存储到第一个缓冲区数据,然后将第二个缓冲区,并依此类推,直至每个缓冲区填充,所有的数据存储,或者没有更多的缓冲区。
nNumberOfBytesToRead [in]
总字节数,可以从该文件。每个aSegmentArray元素包含一个单页的其中一块。因为该文件必须与FILE_FLAG_NO_BUFFERING打开的字节数必须是一个文件系统的多个部门的规模该文件的位置。
lpReserved
这个参数是保留供将来使用,必须为NULL。
lpOverlapped [ in , out ]
一个OVERLAPPED数据结构的指针。
该ReadFileScatter函数需要一个有效的OVERLAPPED结构。该lpOverlapped参数不能为NULL。
该ReadFileScatter函数开始读的是一个由偏移和OVERLAPPED结构OffsetHigh成员中指定位置的文件数据。
该ReadFileScatter函数可能返回读操作前完成。在这种情况下,该ReadFileScatter函数返回值为0(零),GetLastError函数返回值ERROR_IO_PENDING。这ReadFileScatter异步操作允许调用进程继续下去,而读操作完成。您可以调用GetOverlappedResult,HasOverlappedIoCompleted,或GetQueuedCompletionStatus函数来获取有关的信息读取操作完成。有关更多信息,请参阅同步和异步I / O。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零(0)。为了获得更多错误信息,调用GetLastError函数。
如果函数试图读取过去的文件的末尾,该函数返回零(0),GetLastError返回ERROR_HANDLE_EOF。
如果在读取操作的函数返回完成后,该函数返回零(0),GetLastError返回ERROR_IO_PENDING。
备注
此功能不支持32 -基于英特尔Itanium处理器系列的WOW64位应用程序。
该FILE_SEGMENT_ELEMENT工会的定义如下:
typedef工会_FILE_SEGMENT_ELEMENT(
PVOID64缓冲区;
ULONGLONG对齐;
)FILE_SEGMENT_ELEMENT,* PFILE_SEGMENT_ELEMENT;
分配给该缓冲区的成员指针将符号扩展,如果代码被编译的价值为32位,这可以打破大报告的应用程序运行的系统配置与使用/ 3GB。在那里,使用PtrToPtr64宏在分配缓冲区的指针。
交易业务
如果绑定到文件处理事务,那么该函数返回从文件的交易视图数据。阿交易读句柄保证显示为期限的处理文件相同的看法。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
CreateFile
文件管理函数
GetOverlappedResult
GetQueuedCompletionStatus
HasOverlappedIoCompleted
的OVERLAPPED
ReadFile
ReadFileEx
WriteFileGather
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==ReadFileScatter Function
Reads data from a file and stores it in an array of buffers.
The function starts reading data from the file at a position that is specified by an OVERLAPPED structure. The ReadFileScatter function operates asynchronously.
Syntax
C++
BOOL WINAPI ReadFileScatter(
__in HANDLE hFile,
__out FILE_SEGMENT_ELEMENT aSegmentArray[],
__in DWORD nNumberOfBytesToRead,
__reserved LPDWORD lpReserved,
__inout LPOVERLAPPED lpOverlapped
);
Parameters
hFile [in]
A handle to the file to be read.
The file handle must be created with the GENERIC_READ right, and the FILE_FLAG_OVERLAPPED and FILE_FLAG_NO_BUFFERING flags. For more information, see File Security and Access Rights .
aSegmentArray [out]
A pointer to an array of FILE_SEGMENT_ELEMENT buffers that receives the data. For a description of this union, see Remarks.
Each element can receive one page of data.
Note To determine the size of a system page, use GetSystemInfo .
The array must contain enough elements to store nNumberOfBytesToRead bytes of data, plus one element for the terminating NULL. For example, if there are 40K-bytes to be read and the page size is 4K-bytes, the array must have 11 elements that includes 10 for the data and one for the NULL.
Each buffer must be at least the size of a system memory page and must be aligned on a system memory page size boundary. The system reads one system memory page of data into each buffer.
The function stores the data in the buffers in sequential order. For example, it stores data into the first buffer, then into the second buffer, and so on until each buffer is filled and all the data is stored, or there are no more buffers.
nNumberOfBytesToRead [in]
The total number of bytes to be read from the file. Each element of aSegmentArray contains a one-page chunk of this total. Because the file must be opened with FILE_FLAG_NO_BUFFERING, the number of bytes must be a multiple of the sector size of the file system where the file is located.
lpReserved
This parameter is reserved for future use and must be NULL.
lpOverlapped [in, out]
A pointer to an OVERLAPPED data structure.
The ReadFileScatter function requires a valid OVERLAPPED structure. The lpOverlapped parameter cannot be NULL.
The ReadFileScatter function starts reading data from the file at a position that is specified by the Offset and OffsetHigh members of the OVERLAPPED structure.
The ReadFileScatter function may return before the read operation is complete. In that scenario, the ReadFileScatter function returns the value 0 (zero), and the GetLastError function returns the value ERROR_IO_PENDING. This asynchronous operation of ReadFileScatter lets the calling process continue while the read operation completes. You can call the GetOverlappedResult , HasOverlappedIoCompleted , or GetQueuedCompletionStatus functions to obtain information about the completion of the read operation. For more information, see Synchronous and Asynchronous I/O .
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero (0). To get extended error information, call the GetLastError function.
If the function attempts to read past the end of the file, the function returns zero (0), and GetLastError returns ERROR_HANDLE_EOF.
If the function returns before the read operation is complete, the function returns zero (0), and GetLastError returns ERROR_IO_PENDING.
Remarks
This function is not supported for 32-bit applications by WOW64 on the Intel Itanium Processor Family.
The FILE_SEGMENT_ELEMENT union is defined as follows:
typedef union _FILE_SEGMENT_ELEMENT {
PVOID64 Buffer;
ULONGLONG Alignment;
}FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
Assigning a pointer to the Buffer member will sign-extend the value if the code is compiled as 32-bits; this can break large-address aware applications running on systems configured with /3GB. There, use the PtrToPtr64 macro when assigning pointers to Buffer.
Transacted Operations
If there is a transaction bound to the file handle, then the function returns data from the transacted view of the file. A transacted read handle is guaranteed to show the same view of a file for the duration of the handle.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
CreateFile
File Management Functions
GetOverlappedResult
GetQueuedCompletionStatus
HasOverlappedIoCompleted
OVERLAPPED
ReadFile
ReadFileEx
WriteFileGather
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365469(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:20:32