术语 | transactnamedpipe |
释义 | TransactNamedPipe 语法: C++ BOOL WINAPI TransactNamedPipe( __in HANDLE hNamedPipe, __in LPVOID lpInBuffer, __in DWORD nInBufferSize, __out LPVOID lpOutBuffer, __in DWORD nOutBufferSize, __out LPDWORD lpBytesRead, __inout_opt LPOVERLAPPED lpOverlapped ); TransactNamedPipe功能 结合函数写了信息和读取指定的命名管道到一个单一的网络操作的消息。 参数 hNamedPipe [in] 句柄到命名管道的CreateNamedPipe或CreateFile函数返回。 此参数也可以是一个处理一个匿名管道,由CreatePipe函数返回。 lpInBuffer [in] 甲到缓冲区包含要写入管道数据的指针。 nInBufferSize [in] 在输入缓冲区的大小,以字节为单位。 lpOutBuffer [out] 一个缓冲区,接收数据的指针从管道中读取。 nOutBufferSize [in] 输出缓冲区的大小,以字节为单位。 lpBytesRead [out] 一个指针变量,接收从管道读取的字节数。 如果lpOverlapped为NULL,lpBytesRead不能是NULL。 如果lpOverlapped不为NULL,lpBytesRead可以为NULL。如果这是一个重叠读操作,您可以由调用GetOverlappedResult读取的字节数。如果hNamedPipe是与本人联系/ O完成端口,您可以得到通过调用GetQueuedCompletionStatus读取的字节数。 lpOverlapped [中,指出,可选] 一个OVERLAPPED结构的指针。这种结构则需要hNamedPipe是与FILE_FLAG_OVERLAPPED打开。 如果hNamedPipe开幕时FILE_FLAG_OVERLAPPED的lpOverlapped参数必须是NULL。它必须指向一个有效的OVERLAPPED结构。如果hNamedPipe创造了与FILE_FLAG_OVERLAPPED和lpOverlapped为NULL,函数可以错误地报告说,操作完成。 如果hNamedPipe开幕时FILE_FLAG_OVERLAPPED和lpOverlapped不为NULL,TransactNamedPipe是作为重叠操作执行。重叠结构应包含一个手动重置事件对象(可以使用CreateEvent函数创建)。如果该操作不能立即完成,TransactNamedPipe返回FALSE并GetLastError返回ERROR_IO_PENDING。在这种情况下,事件对象设置为无信号状态之前TransactNamedPipe回报,这是设置为信号状态时,交易完成。如需有关重叠操作信息,请管。 如果hNamedPipe不符合FILE_FLAG_OVERLAPPED打开,TransactNamedPipe不会返回,直到操作完成。 返回值 如果函数成功,返回值为非零。 如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。 如果消息被读取的长度超过了nOutBufferSize参数指定的缓冲区,TransactNamedPipe返回FALSE和GetLastError函数返回ERROR_MORE_DATA。该邮件的其余部分可以读取后续调用ReadFile,ReadFileEx,或PeekNamedPipe。 备注 TransactNamedPipe失败如果服务器没有创建一个消息类型管道或管道的管道句柄消息不读模式。例如,如果一个客户端运行在同一台计算机作为服务器,并使用\\ \\。\\管道\\ pipename格式打开管道,管道是在字节模式开幕命名管道文件系统(国家粮食安全计划)。如果客户端使用的表格\\ \\服务器\\管道\\ pipename,重定向器中打开消息模式管。字节模式管道句柄可改为消息阅读与SetNamedPipeHandleState功能模式。 该函数不能成功完成,直到把数据由lpOutBuffer参数指定的缓冲区写入。该lpOverlapped参数可以使调用线程执行其他任务,而行动是在后台执行。 实例 有关示例,请参见命名管道交易。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 CreateEvent CreateFile CreateNamedPipe GetOverlappedResult GetQueuedCompletionStatus PeekNamedPipe 管功能 管概述 ReadFile ReadFileEx SetNamedPipeHandleState 的OVERLAPPED 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009/5/7 ==英文原文==TransactNamedPipe Function Combines the functions that write a message to and read a message from the specified named pipe into a single network operation. Syntax C++ BOOL WINAPI TransactNamedPipe( __in HANDLE hNamedPipe, __in LPVOID lpInBuffer, __in DWORD nInBufferSize, __out LPVOID lpOutBuffer, __in DWORD nOutBufferSize, __out LPDWORD lpBytesRead, __inout_opt LPOVERLAPPED lpOverlapped ); Parameters hNamedPipe [in] A handle to the named pipe returned by the CreateNamedPipe or CreateFile function. This parameter can also be a handle to an anonymous pipe, as returned by the CreatePipe function. lpInBuffer [in] A pointer to the buffer containing the data to be written to the pipe. nInBufferSize [in] The size of the input buffer, in bytes. lpOutBuffer [out] A pointer to the buffer that receives the data read from the pipe. nOutBufferSize [in] The size of the output buffer, in bytes. lpBytesRead [out] A pointer to the variable that receives the number of bytes read from the pipe. If lpOverlapped is NULL, lpBytesRead cannot be NULL. If lpOverlapped is not NULL, lpBytesRead can be NULL. If this is an overlapped read operation, you can get the number of bytes read by calling GetOverlappedResult . If hNamedPipe is associated with an I/O completion port, you can get the number of bytes read by calling GetQueuedCompletionStatus . lpOverlapped [in, out, optional] A pointer to an OVERLAPPED structure. This structure is required if hNamedPipe was opened with FILE_FLAG_OVERLAPPED. If hNamedPipe was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hNamedPipe was created with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the operation is complete. If hNamedPipe was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, TransactNamedPipe is executed as an overlapped operation. The OVERLAPPED structure should contain a manual-reset event object (which can be created by using the CreateEvent function). If the operation cannot be completed immediately, TransactNamedPipe returns FALSE and GetLastError returns ERROR_IO_PENDING. In this situation, the event object is set to the nonsignaled state before TransactNamedPipe returns, and it is set to the signaled state when the transaction has finished. For more information about overlapped operations, see Pipes . If hNamedPipe was not opened with FILE_FLAG_OVERLAPPED, TransactNamedPipe does not return until the operation is complete. Return Value If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. If the message to be read is longer than the buffer specified by the nOutBufferSize parameter, TransactNamedPipe returns FALSE and the GetLastError function returns ERROR_MORE_DATA. The remainder of the message can be read by a subsequent call to ReadFile , ReadFileEx , or PeekNamedPipe . Remarks TransactNamedPipe fails if the server did not create the pipe as a message-type pipe or if the pipe handle is not in message-read mode. For example, if a client is running on the same machine as the server and uses the \\\\.\\pipe\\pipename format to open the pipe, the pipe is opened in byte mode by the named pipe file system (NPFS). If the client uses the form \\\\server\\pipe\\pipename, the redirector opens the pipe in message mode. A byte mode pipe handle can be changed to message-read mode with the SetNamedPipeHandleState function. The function cannot be completed successfully until data is written into the buffer specified by the lpOutBuffer parameter. The lpOverlapped parameter is available to enable the calling thread to perform other tasks while the operation is executing in the background. Examples For an example, see Transactions on Named Pipes . Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinbase.h (include Windows.h) LibraryKernel32.lib DLLKernel32.dll See Also CreateEvent CreateFile CreateNamedPipe GetOverlappedResult GetQueuedCompletionStatus PeekNamedPipe Pipe Functions Pipes Overview ReadFile ReadFileEx SetNamedPipeHandleState OVERLAPPED Send comments about this topic to Microsoft Build date: 5/7/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/aa365790(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。