| 4847 | } |
| 4848 | |
| 4849 | static HANDLE win_pipe_instance_new(const wchar_t *pipe_name, bool first_instance) { |
| 4850 | win_security_t security; |
| 4851 | if (!win_security_init(&security)) { |
| 4852 | return INVALID_HANDLE_VALUE; |
| 4853 | } |
| 4854 | DWORD open_mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED; |
| 4855 | if (first_instance) { |
| 4856 | open_mode |= FILE_FLAG_FIRST_PIPE_INSTANCE; |
| 4857 | } |
| 4858 | HANDLE pipe = CreateNamedPipeW( |
| 4859 | pipe_name, open_mode, |
| 4860 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, |
| 4861 | PIPE_UNLIMITED_INSTANCES, 64U * 1024U, 64U * 1024U, 0, &security.attributes); |
| 4862 | win_security_destroy(&security); |
| 4863 | if (pipe != INVALID_HANDLE_VALUE) { |
| 4864 | (void)SetHandleInformation(pipe, HANDLE_FLAG_INHERIT, 0); |
| 4865 | } |
| 4866 | return pipe; |
| 4867 | } |
| 4868 | |
| 4869 | /* This is a namespace reservation, never a protocol endpoint. Every current |
| 4870 | * participant owns one idle instance. The first uses |
no test coverage detected