1 #include <msp/core/systemerror.h>
2 #include <msp/strings/format.h>
3 #include "handle_private.h"
11 void Pipe::platform_init()
13 string name = format("\\\\.\\pipe\\%u.%p", GetCurrentProcessId(), this);
14 *read_handle = CreateNamedPipe(name.c_str(), PIPE_ACCESS_INBOUND|FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE, 1, 1024, 1024, 0, 0);
16 throw system_error("CreateNamedPipe");
18 *write_handle = CreateFile(name.c_str(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
21 unsigned err = GetLastError();
22 CloseHandle(*read_handle);
23 throw system_error(format("CreateFile(%s)", name), err);