4 * Copyright 1998 Alexandre Julliard
13 #include "server/request.h"
22 /***********************************************************************
23 * CreatePipe (KERNEL32.170)
25 BOOL WINAPI
CreatePipe( PHANDLE hReadPipe
, PHANDLE hWritePipe
,
26 LPSECURITY_ATTRIBUTES sa
, DWORD size
)
28 struct create_pipe_request req
;
29 struct create_pipe_reply reply
;
30 PIPE
*read_pipe
, *write_pipe
;
33 req
.inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
34 CLIENT_SendRequest( REQ_CREATE_PIPE
, -1, 1, &req
, sizeof(req
) );
35 if (CLIENT_WaitReply( &len
, NULL
, 1, &reply
, sizeof(reply
) ) != ERROR_SUCCESS
)
39 if (!(read_pipe
= (PIPE
*)K32OBJ_Create( K32OBJ_PIPE
, sizeof(*read_pipe
),
40 NULL
, reply
.handle_read
,
41 STANDARD_RIGHTS_REQUIRED
|SYNCHRONIZE
|GENERIC_READ
,
44 CLIENT_CloseHandle( reply
.handle_write
);
45 /* handle_read already closed by K32OBJ_Create */
49 K32OBJ_DecCount( &read_pipe
->header
);
50 if (!(write_pipe
= (PIPE
*)K32OBJ_Create( K32OBJ_PIPE
, sizeof(*write_pipe
),
51 NULL
, reply
.handle_write
,
52 STANDARD_RIGHTS_REQUIRED
|SYNCHRONIZE
|GENERIC_WRITE
,
55 CloseHandle( *hReadPipe
);
56 *hReadPipe
= INVALID_HANDLE_VALUE
;
61 K32OBJ_DecCount( &write_pipe
->header
);
62 SetLastError(0); /* FIXME */