网站首页  词典首页

请输入您要查询的函数:

 

术语 fileiocompletionroutine
释义 FileIOCompletionRoutine
语法:
C++
VOID CALLBACK FileIOCompletionRoutine(
__in DWORD dwErrorCode,
__in DWORD dwNumberOfBytesTransfered,
__in LPOVERLAPPED lpOverlapped
);
FileIOCompletionRoutine回调函数
一个应用程序定义的回调函数与ReadFileEx和WriteFileEx函数中使用。这就是所谓当异步输入和输出(I / O)操作完成或取消,并调用线程在一个可报警状态(使用设置为TRUE fAlertable参数SleepEx,MsgWaitForMultipleObjectsEx,WaitForSingleObjectEx,或WaitForMultipleObjectsEx功能)。
在LPOVERLAPPED_COMPLETION_ROUTINE类型定义一个指向这个回调函数。 FileIOCompletionRoutine是一个应用程序的占位符定义函数的名称。
参数
dwErrorCode [in]
的I / O完成状态。此参数可以是系统错误代码之一。
dwNumberOfBytesTransfered [in]
在传输的字节数。如果发生错误,这个参数是零。
lpOverlapped [in]
一个OVERLAPPED结构的异步I指定/ O函数的指针。
该系统不使用后,完成例程OVERLAPPED结构被调用,所以完成例程释放的重叠结构,使用的内存。
返回值
这个函数没有返回值。
备注
对于异步操作的返回值为0(ERROR_SUCCESS)如果操作成功完成,或者如果操作发出警告完成。要确定是否I / O操作成功完成,请检查dwErrorCode为0,调用GetOverlappedResult,然后调用GetLastError函数。例如,如果缓冲区不够大,从收到的数据调用所有ReadFileEx,dwErrorCode设置为0,GetOverlappedResult失败,并且GetLastError返回ERROR_MORE_DATA。
从这个函数返回允许其他挂起的I / O完成例程被调用。所有等待的完成例程被称为前可报警线程的等待与一个WAIT_IO_COMPLETION返回代码完成。该系统可调用任何顺序等待完成例程。他们可能会或可能不会被调用的的I / O功能完成订单。
每次系统调用完成例程,它使用应用程序的堆栈一些。如果没有额外的完成例程的异步I / O和可报警等待,堆栈可能会增大。
有关更多信息,请参阅异步过程调用。
实例
例如代码,请参见服务器使用命名管道完成例程。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
参见
文件管理函数
的OVERLAPPED
ReadFileEx
SleepEx
同步和异步I / O
WaitForMultipleObjectsEx
WaitForSingleObjectEx
WriteFileEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==FileIOCompletionRoutine Callback Function
An application-defined callback function used with the ReadFileEx and WriteFileEx functions. It is called when the asynchronous input and output (I/O) operation is completed or canceled and the calling thread is in an alertable state (using the SleepEx , MsgWaitForMultipleObjectsEx , WaitForSingleObjectEx , or WaitForMultipleObjectsEx function with the fAlertable parameter set to TRUE).
The LPOVERLAPPED_COMPLETION_ROUTINE type defines a pointer to this callback function. FileIOCompletionRoutine is a placeholder for the application-defined function name.
Syntax
C++
VOID CALLBACK FileIOCompletionRoutine(
__in DWORD dwErrorCode,
__in DWORD dwNumberOfBytesTransfered,
__in LPOVERLAPPED lpOverlapped
);
Parameters
dwErrorCode [in]
The I/O completion status. This parameter can be one of the system error codes .
dwNumberOfBytesTransfered [in]
The number of bytes transferred. If an error occurs, this parameter is zero.
lpOverlapped [in]
A pointer to the OVERLAPPED structure specified by the asynchronous I/O function.
The system does not use the OVERLAPPED structure after the completion routine is called, so the completion routine can deallocate the memory used by the overlapped structure.
Return Value
This function does not return a value.
Remarks
The return value for an asynchronous operation is 0 (ERROR_SUCCESS) if the operation completed successfully or if the operation completed with a warning. To determine whether an I/O operation was completed succesfully, check that dwErrorCode is 0, call GetOverlappedResult , then call GetLastError . For example, if the buffer was not large enough to receive all of the data from a call to ReadFileEx, dwErrorCode is set to 0, GetOverlappedResult fails, and GetLastError returns ERROR_MORE_DATA.
Returning from this function allows another pending I/O completion routine to be called. All waiting completion routines are called before the alertable thread's wait is completed with a return code of WAIT_IO_COMPLETION. The system may call the waiting completion routines in any order. They may or may not be called in the order the I/O functions are completed.
Each time the system calls a completion routine, it uses some of the application's stack. If the completion routine does additional asynchronous I/O and alertable waits, the stack may grow.
For more information, see Asynchronous Procedure Calls .
Examples
For example code, see Named Pipe Server Using Completion Routines .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
See Also
File Management Functions
OVERLAPPED
ReadFileEx
SleepEx
Synchronous and Asynchronous I/O
WaitForMultipleObjectsEx
WaitForSingleObjectEx
WriteFileEx
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364052(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 11:27:02