windows-nt/Source/XPSP1/NT/shell/osshell/dskquota/common/except.cpp

105 lines
3.2 KiB
C++
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
#include "pch.h"
#pragma hdrstop
#include "except.h"
CExceptionString::CExceptionString(
LPCTSTR pszText
) : m_pszText(NULL)
{
m_pszText = Dup(pszText);
}
CExceptionString::CExceptionString(
const CExceptionString& rhs
) : m_pszText(NULL)
{
*this = rhs;
}
CExceptionString&
CExceptionString::operator = (
const CExceptionString& rhs
)
{
if (this != &rhs)
{
delete[] m_pszText;
m_pszText = Dup(rhs.m_pszText);
}
return *this;
}
LPTSTR
CExceptionString::Dup(
LPCTSTR psz
)
{
LPTSTR pszNew = new TCHAR[lstrlen(psz) + 1];
lstrcpy(pszNew, psz);
return pszNew;
}
#if DBG
//
// Don't include these strings in free builds. Since the strings
// aren't localized, they're intended for debug output only.
//
LPCTSTR CMemoryException::m_pszReasons[] = { TEXT("alloc"),
TEXT("overflow"),
TEXT("index"),
TEXT("range"),
TEXT("pointer") };
LPCTSTR CFileException::m_pszReasons[] = { TEXT("create"),
TEXT("read"),
TEXT("write"),
TEXT("diskfull"),
TEXT("access"),
TEXT("device") };
LPCTSTR CSyncException::m_pszReasons[] = { TEXT("create"),
TEXT("timeout"),
TEXT("abandoned") };
LPCTSTR CSyncException::m_pszObjects[] = { TEXT("mutex"),
TEXT("critsect"),
TEXT("semaphore"),
TEXT("event"),
TEXT("thread"),
TEXT("process") };
LPCTSTR CResourceException::m_pszReasons[] = { TEXT("accelerator"),
TEXT("anicursor"),
TEXT("aniicon"),
TEXT("bitmap"),
TEXT("cursor"),
TEXT("dialog"),
TEXT("font"),
TEXT("fontdir"),
TEXT("group_cursor"),
TEXT("group_icon"),
TEXT("icon"),
TEXT("menu"),
TEXT("messagetable"),
TEXT("rcdata"),
TEXT("string"),
TEXT("version") };
LPCTSTR
CResourceException::ReasonText(
void
) const
{
static TCHAR szMsg[MAX_PATH];
wsprintf(szMsg, TEXT("%s (id: %d)"), m_pszReasons[Type()], m_uResId );
return szMsg;
}
#endif // DBG