网站首页  词典首页

请输入您要查询的函数:

 

术语 createpipe
释义 CreatePipe
语法:
C++
BOOL WINAPI CreatePipe(
__out PHANDLE hReadPipe,
__out PHANDLE hWritePipe,
__in_opt LPSECURITY_ATTRIBUTES lpPipeAttributes,
__in DWORD nSize
);
CreatePipe函数
创建一个匿名管道,并返回处理的读取和写入管道的两端。
参数
hReadPipe [out]
一个变量,它接收读取处理管道指针。
hWritePipe [out]
一个变量,它接收写处理管道指针。
lpPipeAttributes [中,可选]
一个 SECURITY_ATTRIBUTES结构,决定是否返回的句柄可以被继承的子进程的指针。如果lpPipeAttributes为NULL,则句柄不能被继承。
结构的lpSecurityDescriptor成员指定为新的管道安全描述符。如果lpPipeAttributes为NULL,管道得到默认的安全描述。在对来自管道的默认安全描述符的ACL或模拟的主要创造者的象征。
nSize [in]
该管道为缓冲区大小,以字节为单位。大小只是一个建议,该系统使用的价值来计算一个适当的缓冲机制。如果此参数为0,系统将使用默认的缓冲区大小。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
CreatePipe创建管道,管道分配指定大小的存储缓冲区。 CreatePipe还创建处理该进程用来读取和写入到的ReadFile和WriteFile函数的后续调用的缓冲区。
读取管道,一个进程使用的读取调用句柄ReadFile函数。 ReadFile返回时,下列之一:写操作完成的写管道年底,字节数的要求已经被阅读,或发生错误。
当一个进程使用WriteFile写入一个匿名管道,写操作,直到所有字节被写入完成。如果管道缓冲区之前所有字节写入充分,WriteFile不会返回,直到另一个进程或线程使用ReadFile,使更多的缓冲空间。
匿名管道是使用一个独特的名字命名管道。因此,您通常可以通过的句柄匿名管道的功能,需要处理到一个命名管道。
实例
有关示例,请参阅创建与重定向输入和输出子进程。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
管功能
管概述
ReadFile
SECURITY_ATTRIBUTES
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==CreatePipe Function
Creates an anonymous pipe, and returns handles to the read and write ends of the pipe.
Syntax
C++
BOOL WINAPI CreatePipe(
__out PHANDLE hReadPipe,
__out PHANDLE hWritePipe,
__in_opt LPSECURITY_ATTRIBUTES lpPipeAttributes,
__in DWORD nSize
);
Parameters
hReadPipe [out]
A pointer to a variable that receives the read handle for the pipe.
hWritePipe [out]
A pointer to a variable that receives the write handle for the pipe.
lpPipeAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpPipeAttributes is NULL, the handle cannot be inherited.
The lpSecurityDescriptor member of the structure specifies a security descriptor for the new pipe. If lpPipeAttributes is NULL, the pipe gets a default security descriptor. The ACLs in the default security descriptor for a pipe come from the primary or impersonation token of the creator.
nSize [in]
The size of the buffer for the pipe, in bytes. The size is only a suggestion; the system uses the value to calculate an appropriate buffering mechanism. If this parameter is zero, the system uses the default buffer size.
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 .
Remarks
CreatePipe creates the pipe, assigning the specified pipe size to the storage buffer. CreatePipe also creates handles that the process uses to read from and write to the buffer in subsequent calls to the ReadFile and WriteFile functions.
To read from the pipe, a process uses the read handle in a call to the ReadFile function. ReadFile returns when one of the following is true: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
When a process uses WriteFile to write to an anonymous pipe, the write operation is not completed until all bytes are written. If the pipe buffer is full before all bytes are written, WriteFile does not return until another process or thread uses ReadFile to make more buffer space available.
Anonymous pipes are implemented using a named pipe with a unique name. Therefore, you can often pass a handle to an anonymous pipe to a function that requires a handle to a named pipe.
Examples
For an example, see Creating a Child Process with Redirected Input and Output .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Pipe Functions
Pipes Overview
ReadFile
SECURITY_ATTRIBUTES
WriteFile
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365152(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:16:01