OLD | NEW |
1 #include <Windows.h> | 1 #include <Windows.h> |
2 #include <Lmcons.h> | 2 #include <Lmcons.h> |
3 #include <Sddl.h> | 3 #include <Sddl.h> |
4 | 4 |
5 #include "Communication.h" | 5 #include "Communication.h" |
6 | 6 |
7 namespace | 7 namespace |
8 { | 8 { |
9 const int bufferSize = 1024; | 9 const int bufferSize = 1024; |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return Communication::InputBuffer(stream.str()); | 123 return Communication::InputBuffer(stream.str()); |
124 } | 124 } |
125 | 125 |
126 void Communication::Pipe::WriteMessage(Communication::OutputBuffer& message) | 126 void Communication::Pipe::WriteMessage(Communication::OutputBuffer& message) |
127 { | 127 { |
128 DWORD bytesWritten; | 128 DWORD bytesWritten; |
129 std::string data = message.Get(); | 129 std::string data = message.Get(); |
130 if (!WriteFile(pipe, data.c_str(), data.length(), &bytesWritten, 0)) | 130 if (!WriteFile(pipe, data.c_str(), data.length(), &bytesWritten, 0)) |
131 throw std::runtime_error("Failed to write to pipe"); | 131 throw std::runtime_error("Failed to write to pipe"); |
132 } | 132 } |
| 133 |
| 134 bool Communication::PipeExists(const std::wstring& name) |
| 135 { |
| 136 return WaitNamedPipe(name.c_str(), 100) || GetLastError() == ERROR_SEM_TIMEOUT
; |
| 137 } |
OLD | NEW |