| 11 | using namespace ::pmon::util; |
| 12 | |
| 13 | ComManager::ComManager() |
| 14 | { |
| 15 | if (auto hr = CoInitializeEx(0, COINIT_MULTITHREADED); FAILED(hr)) |
| 16 | { |
| 17 | pmlog_error("Failed to init COM").hr(hr); |
| 18 | throw Except<Exception>(); |
| 19 | } |
| 20 | |
| 21 | if (auto hr = CoInitializeSecurity( |
| 22 | nullptr, |
| 23 | -1, // COM negotiates service |
| 24 | nullptr, // Authentication services |
| 25 | nullptr, // Reserved |
| 26 | RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication |
| 27 | RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation |
| 28 | nullptr, // Authentication info |
| 29 | EOAC_NONE, // Additional capabilities |
| 30 | nullptr // Reserved |
| 31 | ); FAILED(hr) && hr != RPC_E_TOO_LATE) |
| 32 | { |
| 33 | CoUninitialize(); |
| 34 | pmlog_error("Failed to init COM security").hr(hr); |
| 35 | throw Except<Exception>(); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | ComManager::~ComManager() |
| 40 | { |
nothing calls this directly
no outgoing calls
no test coverage detected