| 4975 | } |
| 4976 | |
| 4977 | static HANDLE win_pipe_instance_new(const wchar_t *pipe_name, bool first_instance) { |
| 4978 | win_security_t security; |
| 4979 | if (!win_security_init(&security)) { |
| 4980 | return INVALID_HANDLE_VALUE; |
| 4981 | } |
| 4982 | DWORD open_mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED; |
| 4983 | if (first_instance) { |
| 4984 | open_mode |= FILE_FLAG_FIRST_PIPE_INSTANCE; |
| 4985 | } |
| 4986 | HANDLE pipe = CreateNamedPipeW( |
| 4987 | pipe_name, open_mode, |
| 4988 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, |
| 4989 | PIPE_UNLIMITED_INSTANCES, 64U * 1024U, 64U * 1024U, 0, &security.attributes); |
| 4990 | win_security_destroy(&security); |
| 4991 | if (pipe != INVALID_HANDLE_VALUE) { |
| 4992 | (void)SetHandleInformation(pipe, HANDLE_FLAG_INHERIT, 0); |
| 4993 | } |
| 4994 | return pipe; |
| 4995 | } |
| 4996 | |
| 4997 | /* This is a namespace reservation, never a protocol endpoint. Every current |
| 4998 | * participant owns one idle instance. The first uses |
no test coverage detected