| 5195 | } |
| 5196 | |
| 5197 | static HANDLE win_pipe_instance_new(const wchar_t *pipe_name, bool first_instance) { |
| 5198 | win_security_t security; |
| 5199 | if (!win_security_init(&security)) { |
| 5200 | return INVALID_HANDLE_VALUE; |
| 5201 | } |
| 5202 | DWORD open_mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED; |
| 5203 | if (first_instance) { |
| 5204 | open_mode |= FILE_FLAG_FIRST_PIPE_INSTANCE; |
| 5205 | } |
| 5206 | HANDLE pipe = CreateNamedPipeW( |
| 5207 | pipe_name, open_mode, |
| 5208 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, |
| 5209 | PIPE_UNLIMITED_INSTANCES, 64U * 1024U, 64U * 1024U, 0, &security.attributes); |
| 5210 | win_security_destroy(&security); |
| 5211 | if (pipe != INVALID_HANDLE_VALUE) { |
| 5212 | (void)SetHandleInformation(pipe, HANDLE_FLAG_INHERIT, 0); |
| 5213 | } |
| 5214 | return pipe; |
| 5215 | } |
| 5216 | |
| 5217 | /* This is a namespace reservation, never a protocol endpoint. Every current |
| 5218 | * participant owns one idle instance. The first uses |
no test coverage detected