Files
dotnet-runtime/src/coreclr/utilcode/comex.cpp
T
Tomáš Rylek 69e114c1ab December infra rollout - remove duplicated 'src' from coreclr subrepo (src/coreclr/src becomes src/coreclr) (#44973)
* Move src/coreclr/src/Directory.Build.targets to src/coreclr
Merge src/coreclr/src/CMakeLists.txt into src/coreclr/CMakeLists.txt

* Mechanical move of src/coreclr/src to src/coreclr

* Scripts adjustments to reflect the changed paths
2020-12-08 03:19:44 +01:00

51 lines
1.3 KiB
C++

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ---------------------------------------------------------------------------
// COMEx.cpp
//
//
// ---------------------------------------------------------------------------
#include "stdafx.h"
#include "string.h"
#include "ex.h"
#include "holder.h"
#include "corerror.h"
// ---------------------------------------------------------------------------
// COMException class. Implements exception API for standard COM-based error info
// ---------------------------------------------------------------------------
COMException::~COMException()
{
WRAPPER_NO_CONTRACT;
if (m_pErrorInfo != NULL)
m_pErrorInfo->Release();
}
IErrorInfo *COMException::GetErrorInfo()
{
LIMITED_METHOD_CONTRACT;
IErrorInfo *pErrorInfo = m_pErrorInfo;
if (pErrorInfo != NULL)
pErrorInfo->AddRef();
return pErrorInfo;
}
void COMException::GetMessage(SString &string)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_NOTRIGGER;
if (m_pErrorInfo != NULL)
{
BSTRHolder message(NULL);
if (SUCCEEDED(m_pErrorInfo->GetDescription(&message)))
string.Set(message, SysStringLen(message));
}
}