| 31 | } |
| 32 | |
| 33 | std::wstring Error::MessageFromIRestrictedErrorInfo(IRestrictedErrorInfo *info, HRESULT errCode) |
| 34 | { |
| 35 | if (info) |
| 36 | { |
| 37 | wil::unique_bstr description, restrictedDescription, capabilitySid; |
| 38 | if (SUCCEEDED(info->GetErrorDetails(description.put(), &errCode, restrictedDescription.put(), capabilitySid.put()))) |
| 39 | { |
| 40 | if (restrictedDescription) |
| 41 | { |
| 42 | return impl::FormatIRestrictedErrorInfo(errCode, restrictedDescription.get()); |
| 43 | } |
| 44 | else if (description) |
| 45 | { |
| 46 | return impl::FormatIRestrictedErrorInfo(errCode, description.get()); |
| 47 | } |
| 48 | |
| 49 | // fall down to the return below, to call MessageFromHRESULT with the error code extracted from the error info. |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | return MessageFromHRESULT(errCode); |
| 54 | } |
| 55 | |
| 56 | std::wstring Error::MessageFromHresultError(const winrt::hresult_error &error) |
| 57 | { |