| 27 | std::wstring& processor_name) { |
| 28 | struct ComHelper { |
| 29 | ComHelper() { |
| 30 | HRESULT result{CoInitializeEx(nullptr, COINIT_MULTITHREADED)}; |
| 31 | |
| 32 | if (FAILED(result)) { |
| 33 | throw std::runtime_error( |
| 34 | std::format("Failed CoInitializeEx. Result: {}", result).c_str()); |
| 35 | } |
| 36 | |
| 37 | result = CoInitializeSecurity( |
| 38 | nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, |
| 39 | RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE, nullptr); |
| 40 | |
| 41 | if (FAILED(result)) { |
| 42 | CoUninitialize(); |
| 43 | throw std::runtime_error( |
| 44 | std::format("Failed CoInitializeSecurity. Result: {}", result) |
| 45 | .c_str()); |
| 46 | } |
| 47 | } |
| 48 | ComHelper(const ComHelper& t) = delete; |
| 49 | ComHelper& operator=(const ComHelper& t) = delete; |
| 50 | ~ComHelper() { CoUninitialize(); } |
nothing calls this directly
no outgoing calls
no test coverage detected