| 194 | } |
| 195 | |
| 196 | std::wstring Utf8ToWideString(const std::string& str) |
| 197 | { |
| 198 | std::wstring ret; |
| 199 | const int length = MultiByteToWideChar( |
| 200 | CP_UTF8, |
| 201 | MB_ERR_INVALID_CHARS, |
| 202 | str.c_str(), |
| 203 | static_cast<int>(str.size()), |
| 204 | nullptr, |
| 205 | 0); |
| 206 | if (length <= 0) |
| 207 | throw std::runtime_error("MultiByteToWideChar failed"); |
| 208 | ret.resize(length); |
| 209 | MultiByteToWideChar( |
| 210 | CP_UTF8, |
| 211 | MB_ERR_INVALID_CHARS, |
| 212 | str.c_str(), |
| 213 | static_cast<int>(str.size()), |
| 214 | ret.data(), |
| 215 | length); |
| 216 | return ret; |
| 217 | } |
| 218 | |
| 219 | wil::unique_hfile OpenPipe() |
| 220 | { |
no outgoing calls
no test coverage detected