4 * Copyright 1998 Alexandre Julliard
14 #include "server/request.h"
23 /***********************************************************************
24 * CreatePipe (KERNEL32.170)
26 BOOL32 WINAPI
CreatePipe( PHANDLE hReadPipe
, PHANDLE hWritePipe
,
27 LPSECURITY_ATTRIBUTES sa
, DWORD size
)
29 struct create_pipe_request req
;
30 struct create_pipe_reply reply
;
31 PIPE
*read_pipe
, *write_pipe
;
34 req
.inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
35 CLIENT_SendRequest( REQ_CREATE_PIPE
, -1, 1, &req
, sizeof(req
) );
36 if (CLIENT_WaitReply( &len
, NULL
, 1, &reply
, sizeof(reply
) ) != ERROR_SUCCESS
)
40 if (!(read_pipe
= (PIPE
*)K32OBJ_Create( K32OBJ_PIPE
, sizeof(*read_pipe
),
41 NULL
, reply
.handle_read
,
42 STANDARD_RIGHTS_REQUIRED
|SYNCHRONIZE
|GENERIC_READ
,
45 CLIENT_CloseHandle( reply
.handle_write
);
46 /* handle_read already closed by K32OBJ_Create */
50 K32OBJ_DecCount( &read_pipe
->header
);
51 if (!(write_pipe
= (PIPE
*)K32OBJ_Create( K32OBJ_PIPE
, sizeof(*write_pipe
),
52 NULL
, reply
.handle_write
,
53 STANDARD_RIGHTS_REQUIRED
|SYNCHRONIZE
|GENERIC_WRITE
,
56 CloseHandle( *hReadPipe
);
57 *hReadPipe
= INVALID_HANDLE_VALUE32
;
62 K32OBJ_DecCount( &write_pipe
->header
);
63 SetLastError(0); /* FIXME */